Repository navigation
Description
With #577, the CLI's not-linked advice tells an AI agent to run clerk open for an unclaimed app, an app no Clerk account owns yet. In agent mode, clerk open prints the app's claim link, so the link lands in the agent's transcript. Anyone who opens that link while signed in to the Clerk Dashboard can claim the app. The advice should have a person run clerk open in their own terminal instead, which opens the claim page in their browser.
Example. A Next.js project that ran next dev without keys gets an unclaimed app from Clerk's SDK. An agent runs clerk deploy, which stops because the folder isn't linked to a Clerk app. The error says "Run clerk open to print its claim link for a person to claim the app", and lists clerk open first in its examples, the commands the agent should run next. In agent mode, which is the CLI's output mode when no terminal is attached, clerk open prints JSON whose url field is the claim link.
Risk. A reader of the transcript could claim the app first and control its settings and users. The app is a development instance created moments earlier, and the folder's secret key already grants Backend API access to it. So the exposure is ownership of a throwaway development app, not production data.
Proposed change
Commits 4358199 and af8c910 on #577's branch implement it, and were reverted there to keep #577's scope. To restore them, run git cherry-pick 4358199f6 af8c9106e. They make three changes:
- The agent's advice says a person runs
clerk openin their own terminal, in the project folder the message names. The folder matters becauseclerk openreads the claim link from the folder it runs in. clerk opennever appears in an agent'sexamples.clerk open <subpath>on an unclaimed app gives the folder's own next step, instead of "Runclerk open(no subpath) to claim it".
What a person sees at a terminal stays the same.
Open question: should clerk open stop printing the link in agent mode?
The proposed change still leaves one path: an agent that runs clerk open on its own prints the link. Closing it has two constraints:
commands/open/README.mddocuments aurlfield in agent-mode output, so removing it breaks that output.- Agent mode means "no terminal attached", not "an agent is running". A person piping
clerk open --printis in agent mode, so--printmust keep printing.
Options, none chosen:
- Keep
clerk openas it is, and rely on the advice and the Clerk skills. - Leave out
urlin agent mode unless--printis passed. - Open the claim page in a browser on that machine, as
clerk auth logindoes, and leave outurl.
Related
- Link the folder's own Clerk app, and give each unlinked folder its next step #577: adds the not-linked advice that names
clerk open. - Give per-folder advice when a folder isn't linked to a Clerk app skills#106: already tells agents to have the person run
clerk openin their own terminal.
Drafted by Claude, reviewed by Shane
Activity