# CLI reference

> Every snoozestack CLI command.

[HTML version](https://snoozestack.com/docs/cli/) · [Docs index](https://snoozestack.com/llms.txt)

snoozestack CLI v1.56.0 · [Install or upgrade](https://snoozestack.com/docs/installation.md)

The core loop is five commands — `init`, `dev`, `check`, `preview`, `publish` — over the committed `snoozestack/` folder: a preview runs your checkout in your own temporary copy of the project, and a publish ships it to production as a new release (see [Releases & previews](https://snoozestack.com/docs/releases.md)). Project-scoped commands use the `[project] name` declared in `snoozestack/project.toml` (written by `snoozestack link`), or an explicit `--project <ref>`. Most resource groups accept `--dev` / `--preview <name>` to scope an operation to that namespace. Add `--help` to any command for the full detail.

Nearly every command below has a counterpart tool on the project's [MCP endpoint](https://snoozestack.com/docs/mcp.md), so an AI client can do this work directly instead of shelling out to the CLI on your behalf.

```bash title="the project lifecycle"
snoozestack init [name]                # scaffold project.toml + a starter function + schema.mjs
snoozestack check                      # validate the manifest — file and line on failure
snoozestack dev [--port <n>]           # run the whole runtime natively; prints the dashboard link
snoozestack dev reset                  # throw away local state, rebuild + reseed

snoozestack preview                    # run this checkout in your own preview (preview-@<handle>)
snoozestack preview status             # its URL, health, seed outcome, schema plan, expiry
snoozestack preview outbox             # mail it tried to send — captured, never delivered
snoozestack preview delete             # clean it up now (it expires 30 minutes after it last came up)

snoozestack publish                    # ship this checkout to production as a new release
snoozestack publish --yes              # same, answering the "this release drops data" prompt
snoozestack publish --release r11      # deploy release 11 again — a rollback (code, not data)
snoozestack releases                   # every release, newest first: live? who? what it dropped
snoozestack releases show r12          # the full package: artifacts, checksums, schema plan, drops
snoozestack releases deployments       # every publish and rollback, who, and how production answered
```

```bash title="account, linking & projects"
snoozestack user login                 # opens your browser to sign in (password or Google); stores a token
snoozestack user                       # who this machine is signed in as
snoozestack user token                 # print that token, for scripts calling the management API
snoozestack user logout                # forget + revoke the stored token
snoozestack link --project my-app      # record the project in snoozestack/project.toml

snoozestack projects list
snoozestack projects create <name>     # provision a hosted project (refused at the plan's project limit)
snoozestack projects rename <name>     # change the display name; the ref (hostname, database) never changes
snoozestack projects stop <ref>        # pause it: runtime stops, API and sites answer "paused", nothing deleted
snoozestack projects start <ref>       # resume it (needs a free slot under the plan's allowance)
snoozestack projects keys [<ref>]      # SNOOZESTACK_URL + API keys
snoozestack projects tokens create <name>   # project-scoped credential for CI
snoozestack projects tokens list | revoke <id> | rotate <id>
snoozestack projects delete <ref> [--yes]
```

```bash title="schema"
snoozestack schema build               # schema.mjs → snoozestack/schema.json (offline); publish ships it
```

```bash title="functions"
snoozestack functions list                   # the declared functions, as the project runs them
snoozestack functions create <name> [--mcp]  # scaffold snoozestack/functions/<name>/index.ts + its [[functions]] entry
snoozestack functions schedules list | create <name> --function <fn> --cron "<expr>" [--payload <json>]
snoozestack functions schedules enable <name> | disable <name> | delete <name> [--yes]
snoozestack functions schedules run <name>   # fire it now through the scheduler; prints the row, exits 1 unless it ran ok
snoozestack mcp list                         # the MCP endpoints you declared, with their client URLs
```

```bash title="secrets"
snoozestack secrets set KEY=value            # hosted default — running runtimes pick it up
snoozestack secrets set KEY=value --dev      # local-only override for snoozestack dev
snoozestack secrets set KEY=value --preview ada   # override for one preview (name from preview status)
snoozestack secrets list                     # names + which namespaces override; never values
snoozestack secrets unset KEY
```

```bash title="storage"
snoozestack storage list               # buckets are their [[storage]] entries; publish applies them
```

```bash title="data"
snoozestack data tables                      # every table, with row and column counts
snoozestack data rows <table>                # one page of rows (100), tab-separated
snoozestack data rows <table> --all          # every page
snoozestack data rows <table> --offset 100 --json
snoozestack data rows <table> --preview ada  # that preview's own database
# read-only, and a management credential — never the project's anon/service key
```

```bash title="queues, triggers & webhooks"
snoozestack queues list                      # messages / in flight / delayed per queue
snoozestack queues create <name> [--max-receives <n>]
snoozestack queues send <name> <message>     # enqueue a test message
snoozestack queues dead-letters <name>       # what exhausted its retries
snoozestack queues delete <name> [--yes]

snoozestack triggers create <name> --queue <q> --function <fn> [--notify <service>]
snoozestack triggers list | enable <name> | disable <name> | delete <name>

snoozestack webhooks create <name> --queue <q>
# → https://<ref>.snzzz.com/api/webhooks/<name>/<token>
snoozestack webhooks list | delete <name> [--yes]
```

```bash title="push notifications"
snoozestack notifications enable [<name>]    # imperative shortcut
snoozestack notifications list | delete <name> [--yes]
snoozestack notifications devices            # registered device tokens
snoozestack notifications register-device --token <hex>   # let dev send to a real device
snoozestack notifications test --service <name> --device <id> --title … --body …
```

```bash title="sites & domains"
snoozestack sites versions <name>            # version history + preview URLs
snoozestack sites primary <name>             # serve this one at the project host root
snoozestack sites list | delete <name> [--yes]

snoozestack domains claim <domain>           # start connecting (idempotent)
snoozestack domains status [<domain>]        # the setup checklist
snoozestack domains primary platform|custom  # which URL generated links use
snoozestack domains records list|add|delete <domain> …
snoozestack domains list | retry <domain> | delete <domain> [--yes]
```

```bash title="auth"
snoozestack auth pull [--force]        # write the email/page templates into the project as files
```

```bash title="observe"
snoozestack signals                        # hosted event stream, newest first
snoozestack signals --range 24h --event page_view --lines 100
snoozestack signals tail [--type log]      # the LOCAL dev store, live
snoozestack signals query | clear          # read / empty the local store

snoozestack logs runtime --lines 100       # the runtime's log — auth, functions and storage are one process
snoozestack logs runtime --preview         # your preview's runtime instead of production's
snoozestack logs queues | sites             # queue and website activity

snoozestack audit                          # who changed what — console, CLI, and MCP
snoozestack audit --area auth --actor mcp
```

Function code lives at `./snoozestack/functions/<name>/index.ts` and table definitions in `./snoozestack/schema.mjs`. The login token is stored in `~/.snoozestack/config.json` (`APP_CONFIG_DIR` overrides it); CI should skip login entirely and pass a project token via `--token` or `APP_SERVICE_TOKEN`. `snoozestack update` upgrades the CLI in place.
