CLI
Five command groups: migrate · recover · studio · db · schema. The same binary that ships the engine ships these.
Migrations
Generate, plan, verify, apply, roll back. Every operation is risk-classified and audited per step.
SHELLterminal
13 lineszanith migrate generate <name> # scaffold a migration [--from-diff] # auto-fill from live-DB driftzanith migrate plan [--json] # risk summary, no writes [--max-risk <n>] # CI gate (0–100)zanith migrate verify # apply on shadow + diffzanith migrate up [--to <id>] # apply pending [--shadow-verified] # honor-system gate [--allow-destructive] # opt in to drops [--max-risk <n>] [--dry-run]zanith migrate down [--steps <n>] # roll backzanith migrate status # applied / pending listzanith migrate diff [--out <file>] # bootstrap SQLzanith migrate history [--verbose] # per-step risk + snapshotsRecovery (Phase 2)
Every destructive op writes a row to _zanith_migration_artifacts. These commands walk that table.
SHELLterminal
10 lineszanith recover list # all reversible artifactszanith recover inspect <table[.col]> # row + recovery_sqlzanith recover restore-column <t.col> # re-add column [--pk <pkColumn>] # archive-restore join keyzanith recover restore-table <table> # re-add tablezanith recover export <table[.col]> # archive rows out [--format csv|json|jsonl] [--out <file>] [--limit <n>]zanith recover purge <artifact-id> # drop archive + delete rowzanith cleanup --older-than <Nd> # bulk purge by ageStudio
The bundled web UI — runs in-process with the engine. Three deployment modes via auth flags.
SHELLterminal
10 lineszanith studio # http://127.0.0.1:4321 [--port <n>] [--host <h>] [--allow-sql] # raw-SQL playground on [--auth-token <t>] # admin (full access) [--read-only-auth-token <t>] # viewer (safe GETs only) [--workspace-data-dir <path>] # default ~/.zanith [--project-root <path>] # zanith.config search root [--no-project] # skip declared schema [--activity-log] # NDJSON activity to disk [--audit-log [<path>]] # mutating-request auditSchema + DB
Read-side commands for inspecting the live database and checking for drift.
SHELLterminal
4 lineszanith db introspect # print live-DB summaryzanith schema check # diff declared vs live # exit 1 on driftzanith schema diff [--out <file>] # SQL to bring DB into syncConfiguration
The CLI reads zanith.config.{ts,mjs,js,cjs} in the current directory. The default export is the same object you pass to createZanith — adapter, schema, plus optional migrationsDir, safety, and shadow blocks.
| Field | What it controls |
|---|---|
adapter | Database connection (PgAdapter / SqliteAdapter / postgres.js) |
schema | The compiled schema graph |
migrationsDir | Where migration files live (default: migrations) |
safety.requireShadowDbInProduction | Refuse up without --shadow-verified in prod |
shadow.adapter | Throwaway Postgres for migrate verify |
shadow.resetShadow | Hook to wipe shadow before each verify |