Conversation
…reate` (…" This reverts commit 5784df6.
|
📝 WalkthroughWalkthroughThis changeset removes the Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/cli-core/src/commands/link/index.ts`:
- Around line 224-231: search(...) currently prepends createChoice so the prompt
defaults to "create new" and Enter can create instead of selecting a matching
existing app; change the source function used by search() (the block that builds
the list for selectedId) to place existing matches from appChoices first and
append createChoice at the end (i.e., return [...filtered, createChoice] when
term is present, or [...appChoices, createChoice] when not) so existing matches
are prioritized over the __create_new__ option.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 47e01349-6d5c-454a-bb9f-bfce4d4b533e
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (45)
.changeset/users-scaffolding-and-create.md.gitignoreREADME.mdpackages/cli-core/package.jsonpackages/cli-core/src/cli-program.test.tspackages/cli-core/src/cli-program.tspackages/cli-core/src/commands/api/bapi.tspackages/cli-core/src/commands/api/index.test.tspackages/cli-core/src/commands/api/index.tspackages/cli-core/src/commands/link/index.test.tspackages/cli-core/src/commands/link/index.tspackages/cli-core/src/commands/users/README.mdpackages/cli-core/src/commands/users/create-wizard.test.tspackages/cli-core/src/commands/users/create-wizard.tspackages/cli-core/src/commands/users/create.test.tspackages/cli-core/src/commands/users/create.tspackages/cli-core/src/commands/users/index.test.tspackages/cli-core/src/commands/users/index.tspackages/cli-core/src/commands/users/interactive/attributes.test.tspackages/cli-core/src/commands/users/interactive/attributes.tspackages/cli-core/src/commands/users/interactive/instance-context.test.tspackages/cli-core/src/commands/users/interactive/instance-context.tspackages/cli-core/src/commands/users/interactive/pick-user.test.tspackages/cli-core/src/commands/users/interactive/pick-user.tspackages/cli-core/src/commands/users/lifecycle-runner.tspackages/cli-core/src/commands/users/menu.test.tspackages/cli-core/src/commands/users/menu.tspackages/cli-core/src/commands/users/output.tspackages/cli-core/src/commands/users/registry.tspackages/cli-core/src/commands/users/shared.tspackages/cli-core/src/lib/app-picker.tspackages/cli-core/src/lib/bapi-command.test.tspackages/cli-core/src/lib/bapi-command.tspackages/cli-core/src/lib/config.test.tspackages/cli-core/src/lib/config.tspackages/cli-core/src/lib/errors.tspackages/cli-core/src/lib/fapi.test.tspackages/cli-core/src/lib/fapi.tspackages/cli-core/src/lib/listage.test.tspackages/cli-core/src/lib/listage.tspackages/cli-core/src/lib/users.test.tspackages/cli-core/src/lib/users.tspackages/cli-core/src/test/integration/users-commands.test.tsskills/clerk/references/recipes.mdtest/e2e/lib/test-user.ts
💤 Files with no reviewable changes (32)
- .gitignore
- packages/cli-core/src/commands/users/README.md
- packages/cli-core/src/commands/users/index.test.ts
- packages/cli-core/src/commands/users/shared.ts
- packages/cli-core/src/commands/users/menu.ts
- packages/cli-core/src/commands/users/interactive/attributes.test.ts
- packages/cli-core/src/lib/users.test.ts
- packages/cli-core/src/commands/users/interactive/attributes.ts
- packages/cli-core/src/cli-program.test.ts
- packages/cli-core/src/commands/users/interactive/instance-context.test.ts
- packages/cli-core/src/lib/fapi.test.ts
- packages/cli-core/src/lib/errors.ts
- packages/cli-core/src/commands/users/create-wizard.test.ts
- packages/cli-core/src/commands/users/interactive/pick-user.ts
- packages/cli-core/src/commands/users/index.ts
- packages/cli-core/src/lib/app-picker.ts
- packages/cli-core/src/commands/users/create-wizard.ts
- packages/cli-core/package.json
- packages/cli-core/src/lib/bapi-command.test.ts
- packages/cli-core/src/lib/bapi-command.ts
- packages/cli-core/src/commands/users/registry.ts
- packages/cli-core/src/lib/fapi.ts
- packages/cli-core/src/commands/users/create.ts
- packages/cli-core/src/commands/users/create.test.ts
- .changeset/users-scaffolding-and-create.md
- packages/cli-core/src/lib/users.ts
- packages/cli-core/src/commands/users/interactive/pick-user.test.ts
- packages/cli-core/src/commands/users/lifecycle-runner.ts
- packages/cli-core/src/commands/users/menu.test.ts
- packages/cli-core/src/commands/users/output.ts
- packages/cli-core/src/commands/users/interactive/instance-context.ts
- packages/cli-core/src/test/integration/users-commands.test.ts
| const selectedId = await search({ | ||
| message: `Select a Clerk application to link ${dim(`(repo: ${basename(displayPath)})`)}`, | ||
| source: (term: string | undefined) => { | ||
| const filtered = term | ||
| ? appChoices.filter((c) => c.name.toLowerCase().includes(term.toLowerCase())) | ||
| : appChoices; | ||
| return [createChoice, ...filtered]; | ||
| }, |
There was a problem hiding this comment.
Put existing matches ahead of the create action.
Lines 224-231 always place __create_new__ first. search() keeps that order, and the prompt defaults the active row to the first selectable item, so typing a matching term and pressing Enter will create a new app instead of selecting the existing match. That can unexpectedly create and link the repo to the wrong application.
Suggested fix
const selectedId = await search({
message: `Select a Clerk application to link ${dim(`(repo: ${basename(displayPath)})`)}`,
source: (term: string | undefined) => {
const filtered = term
? appChoices.filter((c) => c.name.toLowerCase().includes(term.toLowerCase()))
: appChoices;
- return [createChoice, ...filtered];
+ return term ? [...filtered, createChoice] : [createChoice, ...filtered];
},
});🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/cli-core/src/commands/link/index.ts` around lines 224 - 231,
search(...) currently prepends createChoice so the prompt defaults to "create
new" and Enter can create instead of selecting a matching existing app; change
the source function used by search() (the block that builds the list for
selectedId) to place existing matches from appChoices first and append
createChoice at the end (i.e., return [...filtered, createChoice] when term is
present, or [...appChoices, createChoice] when not) so existing matches are
prioritized over the __create_new__ option.
Reverting to prevent blocking for release!