# CLI reference

Every `spaceboy` command an agent uses to build, ship and operate an app,
with every option. `spaceboy <command> --help` prints the same.

```bash
curl -fsSL https://spaceboy.ai/install.sh | bash   # install (Node 20+)
npm install -g @spaceboy-ai/cli                    # or with npm
npx -y @spaceboy-ai/cli@latest <command>           # or no install at all
```

## Conventions

- `--json` (before or after the command) prints exactly one JSON value on
  stdout; progress goes to stderr. Streams (`login --json`) print one JSON
  object per line.
- Failures under `--json` print `{"error": {"message", "exitCode", "code"?, "action"?}}`.
  `action` is `{"kind": "open_url" | "run_command", "value"}` when the CLI
  knows the fix.
- Exit codes: `0` success, `1` failure, `2` usage, `3` authentication,
  `4` permission or plan.
- **Linked folder.** Inside a folder made by `spaceboy init` or
  `spaceboy start`, every command that takes `--project` defaults to the
  linked project, so the examples below can leave it out there.
- Long operations (`push`, `deploy`, `build`) wait for a final state;
  `--no-wait` (where offered) returns at once. A deploy wait retries API
  errors (HTTP 5xx, network) instead of failing, so its exit code is the
  deploy's own result.

## Account

| Command | Options | What it does |
| --- | --- | --- |
| `login` | `--token <rbk_...>` store an existing key; `--api-url <url>` | Prints a URL and code for a person to approve (sign-up included), then stores an API key in `~/.spaceboy/config.json` |
| `logout` | | Removes the stored key |
| `whoami` | | The user and active organization (`Organization: none` means create one) |
| `orgs list` | | Organizations you belong to |
| `orgs create` | `--name <name>`; `--type personal\|educational\|startup\|agency\|company` (default `personal`) | Creates an organization (free) |
| `orgs use <accountId>` | | Sets the default organization |
| `orgs members list` | `--org <accountId>` | Members (address, role) and pending invitations; any member may list |
| `orgs members invite <email>` | `--org <accountId>` | Invites someone as a member (free; owners and admins; the plan's member limit applies). They join when they sign in to Spaceboy with that address; members can sign in to the organization's unpublished (development) apps. Already a member: nothing happens. Owners and admins are added in the console |
| `orgs members remove <email>` | `--org <accountId>` | Removes a member (their API keys for the organization are revoked), or withdraws a pending invitation. Owners and admins are removed in the console |

Environment variables override the config file: `SPACEBOY_API_KEY`,
`SPACEBOY_ACCOUNT`, `SPACEBOY_API_URL`, `SPACEBOY_CONFIG_PATH`. See
[Authentication](https://spaceboy.ai/docs/agents/authentication.md).

## Projects and code

| Command | Options | What it does |
| --- | --- | --- |
| `start` | `--name <name>` (default `my-app`); `--dir <path>` (default `./<name>`); `--template <key>` (default `full-stack`); `--org-name <name>` (default: "<your first name>'s workspace"); `--yes` | One step: logs in if needed, creates an organization if there is none, creates a project and downloads it into a new folder, prints what to do next. Never asks questions; when a login is needed it exits 3 with the approval link, and running it again resumes |
| `projects create` | `--name <name>`; `--template <key>` | Creates a project from a starter. `--template full-stack` is the full-stack starter; without it, a client-only site |
| `projects list` | | Projects in the active organization |
| `projects show <projectId>` | | One project, with starter-version detail |
| `projects delete <projectId>` | `--yes` (required) | Deletes the repository, every environment and its data. No undo |
| `init` | `--project <id>` (required); `--dir <path>` (default `.`, must be empty); `--ref <ref>`; `--force` | Downloads the project's code as a git checkout and links the folder to the project |
| `push` | `--project <id>`; `--source <path>` (default `.`); `--target development\|production` (default `development`); `--no-deploy`; `--acknowledge <digest>`; `--timeout <minutes>` (default 30); `--allow-dirty` (or `--yes`) | Ships new commits: preflight, pull request, merge into `main`, deploy, print the URLs. Sends committed files only: with uncommitted changes it stops before uploading (exit 1, `UNCOMMITTED_CHANGES`, the files listed) unless `--allow-dirty` |
| `projects adopt` | `--project <id>` (default: the `--source` folder's link); `--source <path or .tar.gz>` (required); `--dry-run`; `--acknowledge <digest>`; `--label <text>`; `--kernel-base <sha>` | The first step of `push`: upload and preflight, then write one commit and pull request |
| `projects adoption list` | `--project <id>` | Adoptions of a project, newest first |
| `projects adoption show <adoptionId>` | | One adoption with its preflight report |
| `projects adoption confirm <adoptionId>` | `--acknowledge <digest>` (when the report has warnings) | Writes the commit and pull request |
| `projects adoption accept <adoptionId>` | | Merges the pull request into `main` |
| `projects adoption reject <adoptionId>` | | Closes the pull request and deletes its branch |
| `projects adoption cancel <adoptionId>` | | Cancels before anything is written |
| `kernel status [projectId]` | `--source <path>` | Compares the project's starter version with the latest, and prints the starter baseline and its last move (`starter: v13, moved from v11 on 2026-12-02`) |
| `kernel upgrade` | `--project <id>`; `--source <path>` (default `.`); `--plan`/`--dry-run`; `--base <commit>`; `--allow-delete <path...>`; `--branch <name>` | Brings your checkout onto the starter the platform serves for the project now, in place: a three-way merge on a new branch, never on a dirty tree; lists conflicts file by file and the project's checks to run. Pushing the result moves the project's starter baseline forward (see Preflight) |
| `kernel refresh <projectId>` | | Prepares a branch on the platform that updates the starter's design-system files (not the contract upgrade) |

## Deploy

| Command | Options | What it does |
| --- | --- | --- |
| `deploy` | `--project <id>`; `--target development\|production` (default `development`); `--no-wait`; `--timeout <minutes>` (default 30) | Redeploys what is already hosted (`main`), not your local commits (that is `push`); warns when the linked checkout has commits or changes the hosted copy lacks. Prints the App, GraphQL and Functions URLs |
| `deploys` | `--project <id>`; `--limit <n>` (default 10); `--deploy <id>` (one deploy in full); `--log`; `--wait` with `--deploy` (wait for it to finish, exit 0 only on `SUCCEEDED`; resumes a wait after `push` or `deploy` stopped); `--timeout <minutes>` (default 30) | Recent deploys with status, stage and `failureReason` |
| `deploy-cancel` | `--deploy <deployId>`, or `--project <id>` with `--target` (default `development`) | Cancels an in-flight deploy; the environment keeps its last version |
| `undeploy` | `--project <id>`; `--target development\|production` (required); `--force` (required without a terminal) | Deletes one environment, its database and users. No undo |
| `domains list` | | Custom domains and the environments they can serve |
| `domains add <hostname>` | `--project <id>` with `--target` (default `production`), or `--env <environmentId>`; `--function <exportName>`; `--output <name>` | Serves an environment (or one function, or one extra web output) from your domain |
| `domains check <hostname>` | `--wait`; `--timeout <minutes>` (default 30) | Re-checks DNS and the certificate |
| `domains remove <hostname>` | | Unlinks the domain |

## Operate

| Command | Options | What it does |
| --- | --- | --- |
| `logs` | `--project <id>` with `--target` (default `development`), or `--environment <id>`; `--since <duration>` (e.g. `15m`, `1h`, `6h`, `24h`, `2d`, `7d`, `30d`; default `24h`, at most 30d); `--severity warning\|error`; `--search <text>`; `--page-token <token>` | Runtime warnings and errors from the environment's functions |
| `db tables` | `--project`/`--target` or `--environment` | Tables and columns, with row estimates |
| `db migrations` | same | Applied migrations (`schema_migrations`) |
| `db query <sql>` | same; `--write` to change data; `@file` reads the SQL from a file | One statement, 10-second limit, 500 rows, audit-logged |
| `environments list` (`envs`) | `--project <id>` | Development and production environments: id, name, target, URL, status |
| `environments keep-warm [production]` | `--functions <a,b>` with `--confirm-charge <usd>`; `--off`; `--project <id>`; `--no-wait`; `--timeout <min>` | Always-on: keep up to 2 production functions of a published project at one running instance (no cold start; billed per function a month on the subscription, the amount stated before any charge; owner or admin; applied by the next production deploy). With no card on file it prints one card link and waits. No flags: show the setting and the price |
| `secrets list` | `--project <id>` | Per environment: set or not, source (its own, its class, all), fingerprint (keyed hash), updated; never values |
| `secrets set <NAME>` | `--project <id>`; value on stdin (or `--value <v>`); `--environment <id\|development\|production\|all...>` (development / production: every environment of that class, now and later; default: all once published, else development); `--no-trim`; `--deploy` | Sets the value on what is named only, byte for byte (edge whitespace trimmed unless `--no-trim`); prints what changed and whether a redeploy is needed |
| `secrets unset <NAME>` | `--project <id>`; `--environment <...>` (default: everywhere, deleting the name) | Unsets on those environments only |
| `secrets delete <NAME>` | `--project <id>` | Environments stop receiving it on their next deploy |
| `secrets doctor` | `--project <id>` | Declared (env.manifest.json) but missing, per environment; same or different values; exit 1 when missing |
| `app signin` | `--project <id>`; `--persona <name>` (from `spaceboy.verify.json`; default `test-user`); `--file <path>`; `--environment <id>`; or `--email <you>` with `--send-code` then `--code <code>` | Mints a 15-minute **test session** for a declared test persona on the development app (no email; never production); with `--send-code`/`--code`, signs in through the app's own emailed code and keeps the session for `app request`; for a test address (`rider@example.com`) `--send-code` reads the code from the development test inbox and signs in at once |
| `mail mode [held\|redirect\|live]` | `--project <id>`; `--target` or `--environment`; `--to <member>` (redirect); `--confirm "send live mail"` (live) | Shows or sets the environment's mail mode. Development: held holds sign-in codes too; production (held by default) still sends them. See sign-in-and-users |
| `mail test-inbox` | `--project <id>`; `--email <test address>`; `--limit <n>`; `--show html\|text` | Development only: sign-in codes the app sent to reserved test addresses (example.com, .test …), kept on the platform for an hour instead of mailed; `--show` also prints the rendered email (read once) |
| `app signout` | `--project <id>` | Forgets the app sign-in kept for the project |
| `app request` | `--project <id>`; `--query <graphql or @file>`; `--variables <json or @file>`; `--persona <name>`; `--email`; `--test-identity`; `--environment <id>` | Calls the development app's GraphQL API as `--persona`, else the kept app user, else the `test-user` persona; retries for ~1 min while a fresh deploy's endpoint becomes reachable |
| `app verify` | `--project <id>`; `--env dev\|prod` (default dev); `--environment <id>`; `--file <path>`; `--step <text>` | Runs the smoke steps in `spaceboy.verify.json`, signing in as its test personas; PASS/FAIL per step (`--json` report); exit 0 all passed, 1 a step failed, 2 invalid file. Production rules follow the environment's real mode: only steps with no sign-in that are a single query or a GET/HEAD run |
| `app personas reset` | `--project <id>`; `--persona <name...>`; `--file <path>`; `--environment <id>` | Deletes the development app's persona users (and their data, where the app's seed says how) |
| `app test-sessions disable\|enable` | `--project <id>`; `--environment <id>` | Organisation owners and admins: stop or resume minting test sessions for the development environment |

`logs`, `db` and `secrets` need an organization owner or admin.

## iOS and Android

| Command | Options | What it does |
| --- | --- | --- |
| `build ios\|android` | `--project <id>`; `--kind testflight\|apk`; `--no-wait`; `--timeout <minutes>` (default 45) | Builds against the development environment: TestFlight for iOS, a signed APK for Android |
| `builds ios\|android` | `--project <id>`; `--limit <n>` | Recent builds |
| `build-cancel ios\|android` | `--build <buildId>` or `--project <id>` | Cancels an in-flight build |
| `integrations stripe connect` | `--project <id>` (default: the folder's link; without one the key becomes the organization default); `--label`; `--replace` (required without a terminal when it replaces the key production uses now; live deployments keep the old key until their next deploy); `--allow-test-key-in-production` (a test-mode key is refused otherwise: production checkout would take no real payments); `--development` (a test-mode key for development deploys only: live keys are refused, it is routed to the project's development posture, never becomes the organization default and can never be routed to production). The key comes from stdin (`printf %s "$KEY" \| spaceboy integrations stripe connect`) or a hidden prompt, never an option | Checks the key with Stripe, stores it, routes it to the project. Needed before a payments app (`PAYMENTS`) deploys to production. Development deploys simulate checkout, or, with a `--development` key, run real Stripe test-mode checkout (redeploy development to pick it up) |
| `integrations stripe status` | `--project <id>` | Connected or not, live or test mode, which key the project's production deploys use (`project.productionConnectionId`) and which its development deploys use (`project.developmentConnectionId`); `next` holds the connect command when none |
| `integrations stripe disconnect` | `--connection <id>` (when several); `--yes` (required) | Removes a stored Stripe key |
| `integrations elevenlabs connect` | `--key-file <path>` (or the key on stdin, or a hidden prompt; never an option); `--label` | Stores your own ElevenLabs key (format-checked; ElevenLabs offers no probe) and makes it the organization default. AI apps run speech on it from their next deploy instead of the platform's AI gateway |
| `integrations elevenlabs status` / `disconnect` | `disconnect`: `--connection <id>` (when several); `--yes` (required) | Connected or not and which key deploys use (`next` holds the connect command when none); removing a key sends speech back through the gateway on the next deploy |
| `integrations apple connect` | `--issuer-id <uuid>`; `--team-id <id>`; `--key-file <AuthKey_KEYID.p8 or ->`; `--key-id <id>` (default: from the file name); `--label` | Checks the App Store Connect API key with Apple, stores it, makes it the one iOS builds use. `error.code` on refusal: `INVALID_KEY`, `INSUFFICIENT_ACCESS`, `UNREADABLE_KEY`, `UNAVAILABLE` |
| `integrations apple-push connect` | `--team-id <id>`; `--key-file <path or ->`; `--key-id <id>` | Stores the APNs key for iOS push |
| `integrations firebase-push connect` | `--service-account-file <path or ->` | Stores the Firebase service account for Android push |
| `integrations apple\|apple-push\|firebase-push status` | `--verify` | Connected or not, which connection is in use |
| `integrations apple\|apple-push\|firebase-push disconnect` | `--connection <id>` (when several); `--yes` (required) | Removes a stored key |
| `store init` | `--dir <repo>` (default `.`); `--platform ios\|android\|both`; `--locale <code>` (default `en-US`) | Writes a `store/` skeleton |
| `store check` | `--dir <repo>` (default `.`) | Validates `store/` locally; lists what only a person can do in App Store Connect and Play Console |

Keys are read from a file or stdin, never from an argument, and never
printed. Connecting needs an organization owner or admin.

## Billing

| Command | Options | What it does |
| --- | --- | --- |
| `billing show` (or `billing`) | | What the organization pays for, and its prices |
| `billing publish` | `--project <id>`; `--confirm-charge <usd>`; `--wait`; `--timeout <minutes>` | Publishes a project. Prints a checkout link for a person when a card is needed; never charges a card on file without `--confirm-charge` |

$10 a month per published project. Need more room? Add capacity for $10 a month. Building and deploying to development are free; publishing to
production is the paid step. When a command needs a payment first, it exits
with code 4 and `error.action` names the next step.

## Older commands

The CLI still carries commands from Spaceboy's earlier product, where
Spaceboy's own agent wrote the code in a hosted workspace: `setup`, `task`,
`tasks`, `plan`, `agent`, `session`, `runs`, `preview`, `ask`, `confirm`,
`actions`, `theme`. Building with your own agent needs none of them.
