feat(whoami): show linked application and add --json output#265
Conversation
🦋 Changeset detectedLatest commit: 0ac923e 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 |
4a7c065 to
dbbf9be
Compare
c42b5a2 to
36237e7
Compare
dbbf9be to
826d9da
Compare
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR updates clerk whoami to display linked application details and adds a --json flag. It introduces WhoamiOptions and profileLabel, wires --json into the CLI, resolves a local profile best-effort, emits a structured JSON payload when requested or in agent mode, and otherwise prints the email plus a conditional "Linked to …" line to stderr. Tests and documentation were expanded to cover human and JSON modes, normalization rules, and stdout/stderr pipe contract. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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. Comment |
|
!snapshot |
Snapshot publishednpm install -g clerk@1.2.1-snapshot.826d9da
|
826d9da to
9173726
Compare
9173726 to
a565eba
Compare
a565eba to
cad89f0
Compare
cad89f0 to
7d9b2ca
Compare
Surfaces the linked Clerk application directly in `clerk whoami` so users don't have to read between the lines of next-steps to know which app the working directory is bound to. Adds a `--json` flag (and matching agent-mode auto-JSON) so scripts and AI agents can consume the email + link state as a single structured payload. The human-mode pipe contract is preserved: stdout is still just the email, the link line and next-steps stay on stderr.
7d9b2ca to
0ac923e
Compare
Summary
clerk whoaminow prints aLinked to MyApp (app_xxx)line on stderr above the next-steps when the working directory is linked to a Clerk application — preserving stdout-as-email so existing pipes (e.g.clerk whoami | grep @) keep working.--jsonflag (and matching agent-mode auto-JSON) emits a structured payload on stdout covering email and link state, including normalizednulls for missing optional fields.profileLabel(profile)helper inlib/config.tsmirroringappLabel(app)fromlib/app-picker.ts, so the localProfileshape and the liveApplicationshape have parallel display formatters.JSON shape
{ "email": "alice@example.com", "linked": { "appId": "app_xxx", "appName": "MyApp", "instances": { "development": "ins_dev_xxx", "production": "ins_prod_xxx" }, "resolvedVia": "remote", "path": "github.com/clerk/cli" } }linkedisnullwhen not linked or when profile resolution throws (best-effort path preserved from #250's commit `1652c122`).Test plan