feat(init): Allow agent init without implicit app selection#244
feat(init): Allow agent init without implicit app selection#244
Conversation
🦋 Changeset detectedLatest commit: 230a35b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe pull request changes Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 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. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
|
|
||
| // Auto-keyless is scoped to bootstrap (new-project) flows only in human | ||
| // mode. Existing projects keep the authenticated flow so real keys can be | ||
| // pulled unless an agent explicitly chooses keyless by omitting an app. |
There was a problem hiding this comment.
to be honest i'm not sure this is what we want, but its what we were doing before. i find the fact that clerk init doesn't require auth for bootstrapping and does require auth in existing projects a bit odd
| throwUsageError( | ||
| "clerk init in agent mode requires CLERK_PLATFORM_API_KEY or a valid stored session when using a real Clerk application. Pass --app only with auth available, or omit --app for keyless-capable frameworks.", | ||
| ); | ||
| } |
There was a problem hiding this comment.
This throws USAGE_ERROR but it is actually an auth problem, not a syntax issue. Agents that branch on error codes (as the ERROR_CODE JSDoc suggests) would misinterpret this as a bad command instead of missing credentials.
| } | |
| throwUsageError( | |
| "clerk init in agent mode requires CLERK_PLATFORM_API_KEY or a valid stored session when using a real Clerk application. Pass --app only with auth available, or omit --app for keyless-capable frameworks.", | |
| undefined, | |
| ERROR_CODE.AUTH_REQUIRED, | |
| ); |
| " clerk auth login", | ||
| " clerk link", | ||
| " clerk init --app <app_id>", | ||
| " clerk env pull", |
There was a problem hiding this comment.
Since clerk init --app <app_id> already runs link + env pull internally, the separate clerk env pull line is redundant here and might confuse agents into running it twice.
| " clerk env pull", | |
| " clerk init --app <app_id>", |
| @@ -113,12 +123,15 @@ export async function init(options: InitOptions = {}) { | |||
|
|
|||
| if (alreadySetUp) { | |||
| log.success("\nClerk is already set up in this project."); | |||
There was a problem hiding this comment.
This prints "Clerk is already set up" (success) and then the manual setup block tells the agent to run more commands. An agent might stop at the success message and never configure API keys.
Consider making the messaging unambiguous based on the mode:
| log.success("\nClerk is already set up in this project."); | |
| if (alreadySetUp) { | |
| if (agent && manualSetup) { | |
| log.info("\nClerk SDK and scaffold files are already in place, but API keys are not configured."); | |
| printBootstrapManualSetupInfo(ctx.framework.name); | |
| } else { | |
| log.success("\nClerk is already set up in this project."); | |
| } |
Summary
Validation