Skip to content

docs(m74-002): zombiectl login verification code + --token-name#67

Merged
indykish merged 6 commits into
mainfrom
chore/m74-002-auth-update
May 22, 2026
Merged

docs(m74-002): zombiectl login verification code + --token-name#67
indykish merged 6 commits into
mainfrom
chore/m74-002-auth-update

Conversation

@indykish
Copy link
Copy Markdown
Contributor

@indykish indykish commented May 21, 2026

Reflects M74_002 (device-flow hardening) landing in usezombie/usezombie#331 — merged 2026-05-20.

What changed

  • zombiectl login now requires a 6-digit terminal-side verification code in addition to the browser approval click. The code binds the approver to the typist; URL phishing alone no longer mints a credential.
  • --token-name <label> flag persists a human-readable device label alongside the token. Shows up on the approval page and in auth status. Defaults to platform family (macos-cli / linux-cli / windows-cli).
  • zombiectl logout description clarified: removes local credentials and aborts in-flight login sessions, does NOT revoke the active JWT (Clerk-revocation is not a client-side operation), does NOT touch ZMB_TOKEN / ZOMBIE_TOKEN env vars.
  • auth status mentions token_name field in the decoded credential.
  • Quickstart Step "Sign in" mirrors the new flow with a one-line tip about --token-name for device labeling.

Files

  • cli/zombiectl.mdx — login flow + flag table + logout/auth status copy
  • cli/install.mdx, zombies/install.mdx — install snippet bumps
  • quickstart.mdx — Sign in step
  • index.mdx, docs.json — minor sync
  • changelog.mdx — entry removed (lead-PR #331 carries the canonical changelog entry)

Holdback cleared

Held until usezombie/usezombie#331 merged. That landed 2026-05-20 — docs can ship.

Out of scope

Stage 1 / Stage 2 of the dashboard token-model cleanup (post-M74_002, internal architecture only) — user-invisible, no doc surface.

Greptile Summary

Documents the M74_002 device-flow hardening shipped in usezombie/usezombie#331: zombiectl login now requires a terminal-side 6-digit verification code to bind the browser approver to the typist, and gains --token-name, --token, --force, and --no-input flags for device labeling and non-interactive use.

  • cli/zombiectl.mdx rewrites the entire authentication section with the new device flow, flag table, token-resolution priority order, and clarified logout/auth-status semantics; env var naming is reconciled to the single canonical ZOMBIE_TOKEN.
  • api-reference/introduction.mdx replaces the now-invalid programmatic auth-session API steps with a two-token-type description (long-lived tenant API key vs short-lived user JWT) that matches the new security model.
  • changelog.mdx adds the required docs-site <Update> entry (May 22, 2026) at the top per AGENTS.md, and fixes a stale ZOMBIE_API_TOKEN reference in an older entry.

Confidence Score: 5/5

Documentation-only PR; no runnable code changes. All four changed files accurately reflect the shipped M74_002 behaviour and are internally consistent.

The env-var naming has been fully reconciled to ZOMBIE_TOKEN across all changed pages, the required changelog entry is present in the correct position, and the logout/auth-status semantics are clearly delineated. The one open question — whether --token accepts tenant API keys in addition to user JWTs — is a clarification gap rather than a mis-statement, and does not affect the correctness of any other documented behaviour.

cli/zombiectl.mdx — the --token flag description would benefit from explicitly stating which token types are accepted, given the two-token-type model introduced in api-reference/introduction.mdx.

Important Files Changed

Filename Overview
cli/zombiectl.mdx Major rewrite of authentication section documenting the verification-code device flow, --token-name, --token, --force, --no-input flags, updated logout semantics, and reconciled env var naming to ZOMBIE_TOKEN throughout
api-reference/introduction.mdx Replaces the now-obsolete programmatic auth-session API flow with a clean two-token-type description (tenant API key vs user JWT), accurately reflecting the new device-flow security model
changelog.mdx Adds M74_002 changelog entry (May 22, 2026) at the correct position per AGENTS.md; also fixes a stale ZOMBIE_API_TOKEN reference in an earlier entry to the canonical ZOMBIE_TOKEN
quickstart.mdx Updates Sign-in step to describe the verification code UX and adds a Tip for --token-name device labeling

Sequence Diagram

sequenceDiagram
    participant U as User (terminal)
    participant CLI as zombiectl
    participant B as Browser
    participant S as usezombie server

    U->>CLI: zombiectl login [--token-name label]
    CLI->>S: Initiate device flow session
    S-->>CLI: login_url + session_id
    CLI->>B: Open login_url in browser
    CLI->>U: Waiting for browser approval...

    B->>S: User clicks Approve
    S-->>B: Display 6-digit verification code
    B->>U: User reads code from browser

    U->>CLI: Type 6-digit code into terminal
    CLI->>S: Submit code bound to session_id
    S-->>CLI: JWT token

    CLI->>CLI: Persist token + token_name label
    CLI->>S: GET /v1/tenants/me/workspaces
    S-->>CLI: workspace list
    CLI->>CLI: Write current_workspace_id to local state
    CLI->>U: Login complete

    note over U,S: Non-interactive path (CI / scripted)
    U->>CLI: Supply token via flag, env var, or piped stdin
    CLI->>S: Validate supplied token
    S-->>CLI: OK
    CLI->>CLI: Persist token (token_name flag ignored)
    CLI->>U: Login complete
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
cli/zombiectl.mdx:49
**`--token` flag doesn't specify accepted token types**

The flag description says "authenticate non-interactively with a token directly" without clarifying whether it expects a user JWT, a tenant API key (`zmb_t_…`), or both. The `api-reference/introduction.mdx` distinguishes those two token types with very different lifetimes (User JWT ~15 min, tenant API key long-lived) and recommends tenant API keys "for unattended access". A CI engineer reading only this page who supplies a short-lived user JWT via `--token` will get silent `TOKEN_EXPIRED` failures within 15 minutes without any pointer to the correct credential type.

Reviews (5): Last reviewed commit: "docs: correct programmatic-auth guidance..." | Re-trigger Greptile

Context used:

  • Context used - AGENTS.md (source)

Reflects the M74_002 device-flow hardening landing on api.usezombie.com:

- `zombiectl login` now requires a terminal-side verification code
  (6-digit, displayed on the browser approval page) in addition to the
  browser approval click. The code binds the approver to the typist —
  URL phishing alone no longer mints a credential.
- `--token-name <label>` flag persists a human-readable device label
  alongside the token; shows up on the approval page and in
  `auth status`. Defaults to platform family (`macos-cli` / `linux-cli`
  / `windows-cli`).
- `zombiectl logout` description clarified: removes local credentials
  and aborts in-flight login sessions, does NOT revoke the active JWT
  (Clerk-revocation is not a client-side operation), does NOT touch
  `ZMB_TOKEN` / `ZOMBIE_TOKEN` env vars.
- `auth status` mentions `token_name` field in the decoded credential.

Quickstart Step "Sign in" mirrors the new flow with a one-line tip
about `--token-name` for device labeling.

Holds for PR #331 (M74_002) landing — this branch should NOT be merged
to docs main until #331 merges to usezombie main, otherwise the docs
describe a CLI flow users can't yet use.

Stage 1 / Stage 2 of the dashboard token-model cleanup (post-M74_002,
internal architecture only) are not documented here — they're user-
invisible. AUTH.md in the usezombie repo carries the full roadmap.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread cli/zombiectl.mdx Outdated
Comment thread cli/zombiectl.mdx Outdated
indykish and others added 2 commits May 22, 2026 02:25
…-token

The CLI reads a single auth-token env var, ZOMBIE_TOKEN (ZMB_TOKEN removed in
M74_003; ZOMBIE_API_TOKEN never existed). Reconcile the three names the page
used — `--no-input` guidance, the logout note, and `auth status` — to the one
canonical ZOMBIE_TOKEN, fixing the greptile P1 ambiguity.

Also brings the login docs up to the shipped flow:
- Document `--token <token>` + the non-interactive resolve order
  (--token > ZOMBIE_TOKEN > piped stdin > browser device flow), with a
  CI/scripts example.
- Note client-side 6-digit validation (a typo re-prompts, no round-trip).
- Drop `--timeout-sec` / `--poll-ms` (poll-era flags removed in M74_003).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ive exit

- `--token-name` is ignored for any non-browser token source (--token,
  ZOMBIE_TOKEN env, or piped stdin), not just --token — none carry a browser
  session to label.
- A non-interactive shell with no token exits immediately with an error
  (it can't prompt) rather than "fails fast asking for one".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@indykish
Copy link
Copy Markdown
Contributor Author

Addressed the two latest review findings on `cli/zombiectl.mdx` in 688aff7:

  • --token-name scope (line ~49) — broadened: it's ignored for any non-browser token source (--token, the ZOMBIE_TOKEN env var, or piped stdin), not just --token. Matches the handler, which emits the "ignored" note for any directly-resolved token.
  • Non-interactive exit wording (line ~55) — a non-interactive shell can't prompt, so it now reads "exits immediately with an error instructing you to supply one via --token, ZOMBIE_TOKEN, or piped stdin" rather than "fails fast asking for one".

indykish and others added 3 commits May 22, 2026 02:43
Docs-site changelog <Update> for the login work — verification-code device
flow, non-interactive token auth (--token / ZOMBIE_TOKEN / piped stdin),
device labels, and the single ZOMBIE_TOKEN env var. Addresses the greptile
P2 (docs-site changelog is a separate surface from the lead-repo notes).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Resolve changelog.mdx top-of-file conflict: order the new May 22 zombiectl
login entry above main's May 21/20 entries (API keys, steer REPL, dashboard
token, inline workspace). Both kept; newest-first.
- api-reference/introduction.mdx: the "POST /sessions -> OAuth -> poll GET
  /sessions until status:complete, extract token" steps were wrong. There is
  no status:complete, and the device flow needs the dashboard's browser +
  ECDH leg, so a bare API client cannot drive it. Replace with the two real
  bearer tokens: a tenant API key (zmb_t_..., dashboard-minted under
  Settings -> API keys) for programmatic/service callers, and the short-lived
  user JWT from `zombiectl login` for interactive humans.
- changelog.mdx: fix a stale `ZOMBIE_API_TOKEN` env-var name in the historical
  `auth status` entry — the variable the CLI actually reads is `ZOMBIE_TOKEN`.
@indykish indykish merged commit 06defcd into main May 22, 2026
4 checks passed
@indykish indykish deleted the chore/m74-002-auth-update branch May 24, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant