CLI

CLI reference

For your agentCopy this and give it to the AI you're building with.
Use the cubek CLI for this project: run `cubek <command> --help` before a command you have not used, and add `--json` when you read its output.
On a 401 or 403, run `cubek whoami` and tell me what it says.

Every command takes --help and --json. [project] defaults to name in ./cubek.json.

Project

  • cubek init [name] [--empty]
    Create a project in ./<name> (--empty: no example to delete).
  • cubek init --workspace <name>
    A workspace of several apps (apps/<a>, cubek-workspace.json; --apps a,b names them).
  • cubek dev [dir] [--port 8787]
    Serve locally, recompile on save (http://127.0.0.1:8787).
  • cubek dev --workspace [dir]
    Every app of the workspace in one process, one port each.
  • cubek dev --stop [dir]
    Stop that project's (or workspace's) dev server only.
  • cubek task run <name> [json]
    Run a task now on the dev server, or deployed with --project P (task list: tasks and cron).
  • cubek task status <id> [--follow]
    A task run's state (--follow: until it ends, with its log lines).
  • cubek sql --dev "<SQL>" [--write]
    SQL on the dev database (also without --dev when not logged in).
  • cubek secrets --dev set|get|list|rm
    The dev secrets in .cubek/secrets.json.
  • cubek check [dir | file.ts]
    Compile and report errors with their canonical fix.
  • cubek check --workspace [dir]
    Check every app and the calls, events and bindings between them.
  • cubek schema [dir]
    The compiled schema: tables, columns, indexes, search.
  • cubek test [dir] [-- bun args]
    Run the project's *.test.ts with bun (needs bun).
  • cubek types [dir]
    (re)write the SDK into <dir>/.cubek/sdk.

Deploy and operate

  • cubek login [--url URL] [--provider github|google]
    Sign in with the browser.
  • cubek login [--url URL] --token T
    Headless: a personal token or a tenant API key.
  • cubek logout | whoami
    Whoami: user, organization and role.
  • cubek deploy [dir] [--prod] [--db copy|prod] [--public] [--side-effects] [--no-banner] [--allow-destructive] [-m msg] [--project P]
  • cubek deploy --workspace [dir] [--prod]
    Every app of the workspace whose build changed, in dependency order.
  • cubek deploy [dir] --dry-run
    What a deploy would upload and migrate; deploys nothing.
  • cubek diff [dir] [--rev N]
    Local files and schema against production (or revision N).
  • cubek revisions [project]
    List revisions (* = production).
  • cubek promote [project] <rev>
    Make a revision production.
  • cubek rollback [project] <rev> [--with-db]
  • cubek preview rm [project] <rev>
    Delete a preview and its database copy.
  • cubek preview url [project] <rev>
    A link that opens a private preview (1 hour).
  • cubek preview access [project] public|private
    Who may open the project's previews.
  • cubek project list
    Your projects: production revision, URL, domains.
  • cubek project create [name]
    An empty project, so secrets can be set before the first deploy.
  • cubek project delete <name> --yes
    Delete a project and all its data, irreversibly.
  • cubek logs [project] [--follow] [--level L] [--route R] [--since T] [--lines N]
  • cubek metrics [project] [--window 1h|24h|7d] [--by-route]
    Requests, errors, latency, CPU, DB time, storage.
  • cubek sql [project] "<SQL>" [--write] [--rev N]
  • cubek sql [project] -f file.sql [--write] [--no-transaction]
    A script (-f -: stdin), one transaction.
  • cubek secrets set|get|list|rm [project] ...
  • cubek domains add|verify|list|redirect [project] ...
  • cubek snapshots list|prune [project] [--dry-run]
  • cubek db restore [project] --to <instant> [--onto preview|production]
    Point-in-time recovery.
  • cubek db restore [project] --promote [--rev N] | db archive [project]
  • cubek db export [project] [--out F] [--at <instant> | --snapshot ID]
    The database as a SQLite file.
  • cubek db import [project] <file.sqlite|.csv|.ndjson|dir> [--table T] [--replace]
    Bulk rows, server-side.
  • cubek storage export [project] [--out DIR] [--prefix P]
    Download every storage object.
  • cubek backup [project] [--out F] [--at <instant>]
    Everything but your code in one .tar.gz: database, storage objects, settings.
  • cubek restore-backup <file> [--project P] [--force]
    A backup into a deployed project (db replaced, objects uploaded).
  • cubek org list | create <slug> | switch <slug> | delete <slug> --yes
  • cubek org members list | add-role <email> <role> | remove <email>
  • cubek org invite <email> --role R | invite accept <token> | invitations [revoke <id>]
  • cubek tokens list | create <name> [--scope S] | revoke <id> | print
  • cubek tenant keys list | create [name] | revoke <id>
    [--tenant T].
  • cubek move --near-me [--tenant T]
    Move the tenant's apps and data to the servers nearest to this machine.
  • cubek account delete --yes
    Delete your account and the organizations only you belong to.

Agents

  • cubek mcp
    MCP server on stdio for coding agents (cubek help mcp).
  • cubek skill [topic]
    Print the Skill (SKILL.md) for agents, or a sub-skill (skill/README.md).
  • cubek upgrade
    Install the latest cubek now (it also updates itself; CUBEK_NO_UPDATE=1: off).

Exit codes: 0 ok, 1 failed, 2 usage, 3 environment, 4 unavailable (retry later).