Skip to content

CLI Reference

All commands: npx sbt <command> [options]

Run npx sbt help to list available commands (including installed plugins).

Core Commands

Docker

CommandDescription
startStart Supabase Docker stack
stopStop all services
restartRestart all services
statusShow service URLs, keys, and connection info

Database

CommandDescription
migrateApply SQL migrations from supabase/migrations/
snapshot [schema...] [all]Export DB objects (functions, views, triggers, policies, types, enums) to filesystem
watch [--scope migration]Watch DB/files and keep migration artifacts fresh (migration-audit --no-open)
dashboard [--port N]Start unified dashboard UI (React) with APIs for atlas data, live logs, and file browsing

migrate env vars:

  • MIGRATION_BASELINE=1 — record all migrations as applied without running them
  • MIGRATION_REAPPLY=1 — force reapply even if DB has existing tables

watch options:

  • --scope migration — phase-1 scope (default)
  • --debounce-ms N — debounce bursty events (default: 1500)
  • --no-db-hooks — skip DB trigger/event-trigger helper install
  • --verbose — print event payloads

Generation

CommandDescription
generate-atlasGenerate Backend Atlas data (.sbt/docs/backend-atlas-data.json by default)
initGenerate supabase-tools.config.json with defaults

Other

CommandDescription
help / -h / --helpShow all available commands

dashboard options:

  • --port N — listen on custom port (default: 3400)

dashboard API routes:

  • GET /api/atlas-data — Backend Atlas JSON
  • GET /api/dashboard-config — Combined dashboard section definitions (core + plugins)
  • GET /api/commands — All registered commands (core + plugin) with category metadata
  • GET /api/run/stream?command=... — SSE: spawn sbt <command> and stream stdout/stderr
  • GET /api/logs/services — Current Docker service statuses
  • GET /api/logs/stream?services=... — Live SSE log stream from Docker
  • GET /api/fs/list?scope=...&path=... — Safe file listing (snapshot, migrations, docs, project)
  • GET /api/fs/file?scope=...&path=... — Safe file content view in browser

Plugin Commands

plugin-db-test

CommandDescription
testRun pgTAP database tests against live DB
test --memRun tests in-memory using PGlite

Config: testsDir, migrationsDir

plugin-deno-functions

CommandDescription
edge-functionsList discovered edge functions
edge-functions --briefSummary table only
edge-functions --jsonRaw JSON output
edge-functions --openapiGenerate OpenAPI spec at docs/edge-functions-openapi.json

Config: baseUrl, configTomlPath

plugin-depgraph

CommandDescription
depgraphGenerate HTML + Mermaid dependency graph
depgraph --htmlHTML only
depgraph --mermaidMermaid only
depgraph --jsonRaw JSON to stdout
depgraph --no-openSkip opening in browser

Requires generate-atlas first. Config: typesFilePath

docs (core)

CommandDescription
docs / docs allStart all doc services
docs swaggerSwagger UI (port 8081)
docs redocReDoc (port 8082)
docs schemaspySchemaSpy (port 8083/schemaspy/)
docs stopStop all docs containers

plugin-erd

CommandDescription
generate-erdGenerate Mermaid ERD per public table

Config: erdOutput, displayColumns

plugin-frontend-usage

CommandDescription
frontend-usageScan frontend for Supabase SDK usage, generate HTML report
frontend-usage --jsonRaw JSON output
frontend-usage --no-openSkip opening in browser

Config: scanPaths

plugin-migration-audit

CommandDescription
migration-auditCompare disk migrations vs DB; CLI summary + HTML report + detail pages
migration-audit --jsonOutput raw audit JSON
migration-audit --htmlGenerate HTML only
migration-audit --no-openSkip opening browser

Produces migration.analysis artifact. Detail pages at {docsOutput}/migration-audit/<slug>.html.

plugin-migration-studio

CommandDescription
migration-studioStart schema-aware migration authoring UI at http://localhost:3335
migration-studio --port NUse custom port
migration-studio --restartKill existing process on port, then start (auto-retry on port conflict)

Requires DB for schema introspection (falls back to atlas-data/artifact when unreachable).

Brownfield Adoption

CommandDescription
studio-introspectQuery live DB → studio.schema.snapshot artifact
studio-sql-parseParse migration files → studio.sql.ast artifact
studio-adoptFull adoption workflow (introspect → sql-parse → review → intent-sync → approve → intent-init)
studio-catalog [--audience <backend-dev|business|mixed>] [--mode <managed|assisted|loose>] [--type <tools|workflows|all>]List discovered tools/workflows from catalog with persona/control-mode filters
studio-intent-patch --entity <id> --action <exclude|set-status> [--status <managed|assisted>]Mutate a single entity's managed-status in the intent graph
studio-endpoint-mapDerive PostgREST EndpointNode declarations for all managed entities/functions

Scaffold Tools (Generate Layer)

CommandDescription
studio-create-table --schema <s> --name <n> [--columns <json>] [--no-rls]Generate CREATE TABLE migration
studio-add-column --entity <schema.table> --name <col> --type <type> [--nullable] [--default <val>]Generate ALTER TABLE ... ADD COLUMN migration (requires intent graph)
studio-add-rls-policy --entity <id> --name <n> --command <SELECT|INSERT|...> --roles <r>Generate CREATE POLICY migration
studio-add-index --entity <id> --name <n> --columns <cols> [--unique] [--method <btree|...>]Generate CREATE INDEX migration
studio-add-constraint --entity <id> --name <n> --type <fk|unique|check> [--options...]Generate ALTER TABLE ... ADD CONSTRAINT migration
studio-add-function --schema <s> --name <n> --returns <type> --language <sql|plpgsql> --body-file <path>Generate CREATE OR REPLACE FUNCTION migration
studio-create-rpc --name <n> --returns <type> --language <sql|plpgsql> --body-file <path>Same as add-function, forces schema: public
studio-create-view --schema <s> --name <n> --query "SELECT ..."Generate CREATE OR REPLACE VIEW migration
studio-greenfield-initInitialize an empty intent graph for a new project (no DB introspection needed)

Validation Tools (Validate Layer)

CommandDescription
studio-rls-checkRLS coverage check — gap analysis per managed entity → studio.rls.plan + studio.rls.report
studio-rpc-lintFunction security audit (DEFINER/search_path/exposure) → studio.rpc.plan
studio-migration-planIntent graph diff → ordered SQL change plan → studio.migration.plan
studio-lintMigration file lint (destructive ops, naming, lock safety) → studio.migration.lint
studio-migration-lintAlias for studio-lint
studio-release-gateAggregate RLS/RPC/lint findings → pass/fail → studio.release.gate
studio-release-checkOne-shot: runs full release-check workflow (no server needed). Exits 0 on pass, 1 on fail. --json for raw output.
mcp [--cwd <path>]Start the MCP stdio server — exposes all 21 studio tools + 3 resources to Claude Desktop, Cursor, and VS Code Copilot

plugin-logs

CommandDescription
logsTail all running services
logs <service>Tail specific service
logs --listList services with running/stopped status
logs --tail NNumber of historical lines (default: 100)
logs --no-colorDisable ANSI colors
logs --timestampsShow Docker timestamps
logs pg-statsQuery performance stats
logs pg-stats --slowTop 20 by mean execution time
logs pg-stats --frequentTop 20 by call count
logs pg-stats --resetReset pg_stat_statements
logs pg-stats --jsonRaw JSON output
logs viewerStart HTML log viewer (default port 3333)
logs viewer --port NCustom viewer port

Config: viewerPort, tailLines, dbContainer

plugin-scaffold

CommandDescription
scaffold-plugin <name>Create internal plugin in packages/
scaffold-plugin <name> --externalCreate external plugin at project root
scaffold-plugin <name> --hooksInclude Atlas/status/OpenAPI hook stubs

plugin-typegen

CommandDescription
generate-typesGenerate TypeScript types from running DB

Config: typesOutput. Env: SUPABASE_TYPES_SCHEMAS (comma-separated schemas).

Environment Variables

Database connection (checked in order):

  1. DATABASE_URL
  2. SUPABASE_DB_URL
  3. POSTGRES_URL
  4. Falls back to db.url in config

Debug mode:

  • SBT_DEBUG=1 — verbose output for diagnosing issues