> ## Documentation Index
> Fetch the complete documentation index at: https://docs.outkit.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Reference

> Every Outkit CLI command, flag, and config file in one place

## Auth & identity

| Command                                             | What it does                                                                                                             |
| --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `outkit login`                                      | Device-code flow. Opens the dashboard, approves the device, saves a token to `~/.outkit/credentials.json` (mode `0600`). |
| `outkit whoami`                                     | Print the signed-in user, team, and device (network round-trip).                                                         |
| `outkit logout`                                     | Revoke the device on the server and wipe local credentials.                                                              |
| `outkit switch`                                     | Switch the active team or profile.                                                                                       |
| `outkit status`                                     | Local-only summary of what the CLI knows about your setup.                                                               |
| `outkit doctor [--backend <url>] [--full] [--json]` | End-to-end health check: auth, network, project mode, SDK packages, wire format, design-token meta event.                |
| `outkit telemetry on\|off\|status\|log`             | Toggle and inspect anonymous usage analytics.                                                                            |

## Project setup

| Command                                       | What it does                                                                                                                                       |
| --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `outkit init [--no-install] [--profile <id>]` | Mode-aware project wiring. Detects framework, picks a profile, writes `outkit.json`, prints the swap snippet, and offers to install the right SDK. |
| `outkit config`                               | View or edit the local `outkit.json`.                                                                                                              |
| `outkit upgrade`                              | Bump `@outkit-dev/*` packages and run any required codemods.                                                                                       |
| `outkit migrate <from> <to>`                  | Run codemods between two SDK versions.                                                                                                             |
| `outkit undo [-y]`                            | Reverse the last code-mutating command (journaled at `~/.outkit/undo.json`).                                                                       |

## Theme sync

| Command                                                                      | What it does                                                                                |
| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| `outkit theme`                                                               | Interactive: detect, preview swatches, confirm, apply.                                      |
| `outkit theme detect [--json]`                                               | Detect-only. Print the cascade result without writing.                                      |
| `outkit theme apply [--from <file>] [--map <map.json>] [--preset <id>] [-y]` | Detect (or load preset), contrast-guard, push to the active profile.                        |
| `outkit theme presets [--json]`                                              | List curated palettes (`modern-neutral`, `vibrant-violet`, `warm-editorial`, `dark-first`). |
| `outkit theme sync [--on-build]`                                             | One-shot detect+apply for CI. `--on-build` adds a `prebuild` hook to your `package.json`.   |
| `outkit theme watch`                                                         | Re-sync whenever a known source file changes.                                               |
| `outkit theme map [--explain]`                                               | Inspect or override the canonical name mapping.                                             |
| `outkit theme regen-surfaces`                                                | Recompute `surfaceLowest…surfaceHighest` from the current background.                       |
| `outkit theme pull`                                                          | Fetch the active profile back into `outkit.theme.json`.                                     |
| `outkit theme push`                                                          | Validate `outkit.theme.json`, show diff, PATCH the active profile.                          |
| `outkit theme diff`                                                          | Print local-vs-remote diff. Exits non-zero when they differ — useful for CI.                |

## Profiles & deploy

| Command                                        | What it does                                       |
| ---------------------------------------------- | -------------------------------------------------- |
| `outkit profiles list`                         | List profiles available to your team.              |
| `outkit profiles create --name <name>`         | Create a new profile.                              |
| `outkit profiles use <profileId>`              | Set the active profile for this repo.              |
| `outkit profiles pull`                         | Write the active profile to a local JSON file.     |
| `outkit profiles push`                         | Push a local profile JSON file as a new version.   |
| `outkit profiles diff [a] [b]`                 | Diff two version IDs (defaults to the latest two). |
| `outkit profiles deploy [--version <id>] [-y]` | Mark a version live.                               |
| `outkit profiles rollback <versionId>`         | Re-deploy an older version.                        |
| `outkit deploy [--version <id>] [-y]`          | Alias of `profiles deploy` for the active profile. |

## API keys

| Command                                           | What it does                                                        |
| ------------------------------------------------- | ------------------------------------------------------------------- |
| `outkit keys list [--all] [--profile <id>]`       | List API keys. Hides revoked unless `--all`.                        |
| `outkit keys create [-n <name>] [--profile <id>]` | Create a new key bound to the active profile. Plaintext shown once. |
| `outkit keys rotate <keyId>`                      | Rotate with a 24-hour grace window on the old key.                  |
| `outkit keys revoke <keyId> [-y]`                 | Immediately revoke a key everywhere.                                |
| `outkit keys stats <keyId>`                       | Show usage, errors, and last-used time.                             |

## Local development

| Command                               | What it does                                                                                                                       |
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `outkit dev`                          | Tail render logs alongside your dev server. Resolves `${VAR}` placeholders in `backendUrl` against `process.env` and `.env.local`. |
| `outkit logs list`                    | Show recent render logs (newest first).                                                                                            |
| `outkit logs tail`                    | Stream new logs as they arrive (polls every 2s).                                                                                   |
| `outkit logs replay <logId>`          | Replay a single log entry.                                                                                                         |
| `outkit logs export [--since <date>]` | Bulk-export to JSON or CSV.                                                                                                        |

## Coding agents

| Command                                                                        | What it does                                                                                                                                                                                                   |
| ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `outkit agent --task "<text>" [--agent claude\|cursor\|copilot] [--no-verify]` | Hand a complex Outkit graft to your installed coding agent. The plan is validated (path-escape, secret-leak, denied-scope, size limits), diffed, applied, and verified with `tsc` + Biome + your test command. |

## Auth model

* Device-code flow using `outkit login`.
* Use `outkit whoami` to verify your current session.
* Use `outkit logout` to revoke this device.

## Files the CLI manages

| Path                                       | Owner                  | Notes                                                                                                     |
| ------------------------------------------ | ---------------------- | --------------------------------------------------------------------------------------------------------- |
| `outkit.json`                              | committed              | `{ version, mode, teamId, profileId, backendUrl?, sdkVersion?, themeMap? }`. The CLI's repo-local config. |
| `outkit.theme.json`                        | committed              | Local copy of the active profile's design tokens. Edit, then `outkit theme push`.                         |
| `~/.outkit/credentials.json` (mode `0600`) | per-user, never commit | Auth token + cached config.                                                                               |
| `~/.outkit/undo.json` (mode `0600`)        | per-user, never commit | Append-only journal feeding `outkit undo`. Bounded to the last 50 entries.                                |
| `~/.outkit/telemetry.log` (NDJSON)         | per-user, never commit | Glass-jar log of every event the CLI would send. Auto-truncates at 1 MB.                                  |

## Environment overrides

| Variable                    | Default                  | Use case                               |
| --------------------------- | ------------------------ | -------------------------------------- |
| `OUTKIT_API_BASE_URL`       | `https://api.outkit.dev` | Point at staging / self-host.          |
| `OUTKIT_DASHBOARD_BASE_URL` | `https://app.outkit.dev` | Match the API override.                |
| `OUTKIT_DEBUG=1`            | *off*                    | Print stack traces on uncaught errors. |
