<!-- zibby-template-version: 1 -->
# /zibby-status — show current Zibby CLI context: auth, workspace, project

You are helping the user understand the CLI's current state — who they're authenticated as, which workspace they're in, which project is selected, and what credentials are active.

Canonical docs: **https://docs.zibby.app/cli-reference#status**

## What status reports

`zibby status` prints:

- **Authenticated as** — email + workspace slug + token type (`session` / `api-key`)
- **Token age** — when it was issued and when it expires (session only)
- **Default project** — `paths.workspace.defaultProject` from `.zibby.config.mjs` (or unset)
- **API URL** — usually `https://api-prod.zibby.app`; differs in dev / local
- **Credentials** — which provider tokens (ANTHROPIC, OPENAI, CURSOR, GEMINI) are configured for local agent runs

## Steps

1. **Run status:**
   ```
   Bash(zibby status)
   ```

2. **Read the result for the user.** Group by section:
   - **Auth** — say "Logged in as `<email>` (workspace `<slug>`)" or "Not authenticated".
   - **Project** — say "Working in project `<id>`" or "No default project set."
   - **Creds** — list the providers with tokens configured. Flag missing critical ones (e.g. "No `ANTHROPIC_API_KEY` — `claude` agent will fail unless you set one").

3. **Suggest follow-ups based on state:**
   - Not authenticated → `/zibby-login`
   - Token near expiry → "Run `zibby login` to refresh before the token expires on `<date>`."
   - No default project → "Pick one with `zibby project use <id>`" or `zibby list` to see options.
   - Missing creds for an agent the user uses → walk them through setting it.

## When to use

- User asks "am I logged in?" → status.
- User asks "what project am I in?" → status.
- After every login / workspace switch, to confirm the change landed.
- Before any cross-account operation that depends on workspace context.

## Quiet / scriptable

`--quiet` returns JSON for scripts:
```
Bash(zibby status --quiet | jq -r .workspace)
```

## Common pitfalls

- **Session token + `ZIBBY_API_KEY` both set** → status prints both. The env var wins. Tell the user.
- **Stale `.zibby/session.json`** → if the file is unreadable (permissions, partial write), status reports "Not authenticated" even when a recent login looked successful. Re-run `zibby login`.
- **`api-prod.zibby.app` unreachable** — status hits the API to validate the token. Without network, it reports cached info only. Don't conflate "no network" with "logged out".
