Skip to content

CLI Reference ​

Run noorm from a script or CI job, read one JSON result, and branch on the exit code.

With one pending change, change ff writes a single JSON document to stdout and its log to stderr. The exit code matches success:

bash
noorm change ff --json > ff.json 2> ff.log; echo "exit $?"
jq -c '{success, status, executed, failed}' ff.json
text
exit 0
{"success":true,"status":"success","executed":1,"failed":0}

ui and sql repl open the TUI, and settings edit and settings secret need a terminal. init needs a terminal or --yes. Every other command runs headless.

How a command runs ​

Where do flags go? ​

Only -c/--cwd is read before the subcommand. Every other flag goes after it.

PositionFlagsEffect
Before the subcommand-c <path>, --cwd <path>, --cwd=<path>Run in <path> instead of walking up to the nearest .noorm/. A path that is not a directory exits 2
Anywhere--help, -hPrint help
As the only argument--version, -vPrint the version
After the subcommandall other flagsPer-command flags

Any other flag before the subcommand exits 2 and names where to move it.

bash
noorm -c packages/db run build     # --cwd: build inside packages/db
noorm run build -c staging         # --config: build against the staging config

These flags recur across commands. Each command section lists the ones it accepts:

FlagAliasEffect
--config <name>-cUse this stored config instead of the active one
--jsonPrint one JSON document on stdout
--dry-runPreview without writing. run and change commands render to tmp/. Creates no tracking tables, and treats a database without them as having nothing applied. Exits 1 when the tracking tables need a migration, with tracking tables are at schema version N and this version needs M. A dry run does not migrate them: run a command without --dry-run first, such as "noorm change history".
--force-frun and change: skip the checksum check. init, ci init, settings init, config create, config import, vault cp, identity init: overwrite what exists, subject to each command's confirmation and policy checks
--yes-yConfirm a command the config's role marks confirm. NOORM_YES does the same

Run noorm <command> --help for a command's flags and an EXAMPLES block. Shell completion is complete.

Which database does a command use? ​

A command resolves one config by name, or builds one from the environment when no name resolves:

The resolved config merges built-in defaults, matching stage defaults, the stored config, and NOORM_* environment variables, in that order. A later layer wins, except that NOORM_ACCESS_* never changes the access roles of a stored config. At policy-check time, a protected stage caps each effective permission against the original operator matrix for users or viewer matrix for agents without changing role assignments. See stage precedence.

NOORM_CONNECTION_HOST overrides the stored host. Execution commands select a config but do not expose connection-field flags. config create accepts connection overrides when saving a new config.

Environment-only mode ​

Set NOORM_CONNECTION_DIALECT and NOORM_CONNECTION_DATABASE and skip stored configs. The config is named __env__. Host defaults to localhost.

bash
export NOORM_CONNECTION_DIALECT=postgres
export NOORM_CONNECTION_HOST=db.example.com
export NOORM_CONNECTION_DATABASE=app
export NOORM_CONNECTION_USER=deploy
export NOORM_CONNECTION_PASSWORD=$DB_PASSWORD
noorm run build

Env-only mode applies only when no name resolves. A runner with an active stored config, such as one set up by ci init, uses that config and layers the variables over it. A clean checkout has no state.enc, so env-only mode needs no identity.

What does a command print? ​

StreamCarries
stdoutThe result: summary text, or with --json exactly one JSON document
stderrProgress lines, warnings, log events (JSON lines under --json), and error diagnostics
exit codeThe outcome. See Exit codes

Every --json payload is an object with a boolean success. Three rules hold for all commands:

  1. jq -e '.success' works on the --json output of every command except dev test-helpers, which prints a text report first.
  2. success is true if and only if the exit code is 0. A partial result is success: false with "status": "partial" and exit 3.
  3. A failed payload carries error as a message string, never a stack trace.
json
{"success":false,"error":"Template not found: db/sql/nope.sql.tmpl"}

A command with nothing to report still writes a result: change list on a project with no changes prints No changes found., or {"success":true,"changes":[],"pending":0} under --json. Lists sit under a named key (changes, tables, configs), never at the top level.

Exit codes ​

Defined in src/cli/_exit.ts. The split between 1 and 3 matters most in a CI pipeline.

CodeNameMeaningRemedy
0successEverything asked for happenedContinue
1failureThe operation ran and no unit of work succeeded, or it failed before starting: connection error, policy denial, missing --yes, unreadable stateRead error or stderr, fix the cause, retry
2usageA usage error the command checks for itself: an invalid flag value, a named target that does not exist (directory, glob, config, change, secret or vault key), a TTY-only command run without a terminal, or lock force with nothing to release. Nothing was attempted. A missing required flag (reported by the argument parser), run file on a missing file, and secret set on a missing config exit 1Fix the invocation. Retrying unchanged fails the same way
3partialSome units succeeded and some failed. The target is in a mixed stateDo not retry blindly. Inspect first with change list, change history-detail, or vault list, then repair or revert

Commands that can exit 3:

  • run build, run dir, run exec, run files
  • change ff, change next, change rewind
  • pipeline run: confirmed partial committed work. An unknown transaction outcome exits 1, since nothing confirms what committed
  • db transfer (database to database), ci secrets, vault propagate
  • dev test-helpers, dev test-workers

Policy denials normally exit 1. config create and config sync report their checked errors, including policy denials, as exit 2. They have no dedicated policy exit code.

Environment variables ​

Names after NOORM_ nest on underscores: NOORM_CONNECTION_HOST sets connection.host, while camelCase fields retain their spelling within a segment. See the environment field reference for conversion, SSL input, and schema validation rules. Overrides remain in memory rather than changing stored configs or settings.yml.

Other unreserved NOORM_* variables overlay matching settings keys in memory. Connection and identity namespaces are excluded from the settings overlay; NOORM_PATHS_SQL, for example, changes the resolved SQL directory without rewriting settings.yml.

VariableEffect
NOORM_CONNECTION_DIALECTpostgres, mysql, sqlite, or mssql. With NOORM_CONNECTION_DATABASE, the minimum for env-only mode
NOORM_CONNECTION_DATABASEDatabase name
NOORM_CONNECTION_HOST, _PORT, _USER, _PASSWORD, _FILENAMEServer, credentials, and the SQLite file
NOORM_CONFIGStored config to use. --config wins
NOORM_YESAny value except empty, 0, or false (case-insensitive) confirms policy confirm cells on the user channel. identity init --force, config create overwrites, and non-interactive config sync application require literal --yes. sql clear requires --yes or --json, not NOORM_YES
NOORM_CHANNELuser or agent. Forces the access channel. Other values are ignored
NOORM_IDENTITY_PRIVATE_KEYX25519 private key, hex PKCS8 DER, 96 characters
NOORM_IDENTITY_NAME, NOORM_IDENTITY_EMAILDisplay name and email. All three NOORM_IDENTITY_* variables must be valid or the CLI ignores them
NOORM_IDENTITYAudit identity as Name <email>. Used for change and build records when no NOORM_IDENTITY_* set is present and the config has no identity override. Falls back to the git user, then the system user
NOORM_CI_CONFIG_NAMEDefault config name for ci init. --name wins, then ci
NOORM_PATHS_SQL, NOORM_PATHS_CHANGESOverride paths.sql and paths.changes. Defaults are ./db/sql and ./db/changes
NOORM_INSECURESame as noorm update --insecure
NOORM_DEBUGTruthy enables event tracing and connection debug output
NOORM_DEVtrue raises the default log level from info to verbose
NOORM_AGENTMarks the session as an agent. See Which channel am I on?
NOORM_HEADLESS, NOORM_LOGGER_DEBUG, NOORM_JSONReserved. Excluded from config nesting. The logger reads the first two. Use --json for JSON output

Access roles ​

Each config carries access: { user, agent }. The user role governs a human at the CLI, TUI, or SDK. The agent role governs an AI agent over MCP or the CLI. Projects can override built-in roles and define custom roles; agent: false hides the config from agents. A config with no explicit access gets { user: admin, agent: viewer }. Legacy protected: true maps to { user: operator, agent: viewer }. A protected stage applies immutable per-permission ceilings from the original operator and viewer matrices without changing the assigned roles.

Which channel am I on? ​

noorm resolves the channel from who is driving, not from which binary ran:

  1. NOORM_CHANNEL, when set to exactly user or agent.
  2. A non-empty harness marker variable: CLAUDECODE, CLAUDE_CODE, CLAUDE_CODE_ENTRYPOINT (Claude Code), CODEX_SANDBOX (OpenAI Codex), CURSOR_AGENT (Cursor), GEMINI_CLI (Gemini CLI), AI_AGENT or NOORM_AGENT (any other agent). The channel is agent.
  3. Otherwise user.

noorm mcp serve is always agent. noorm info reports the detected harness and the marker variables that triggered it, which is the first place to look when a denial has no visible cause.

What happens when a command is gated? ​

Each command maps to a permission. The config's role for the channel picks a cell: allow, deny, or confirm.

Through the CLI, an agent channel confirm cell is a deny, so --yes never unlocks it. MCP can instead collect human approval through modern elicitation; see MCP approval. There is no --force override for a denied cell: --force only skips checksums. The TUI asks you to type yes-<config-name> for confirmation cells. The table below shows default roles; .noorm/settings.yml role definitions can override them or introduce custom roles.

PermissionCommandsvieweroperatoradmin
explore, sql:readdb explore, change history, pipeline history, pipeline show <run-id>, info object counts, db transfer --export without --tables, sql query with SELECT, or SHOW and DESCRIBE on MySQLallowallowallow
sql:writesql query with INSERT, UPDATE, DELETE, MERGEdenyallowallow
sql:ddlsql query with any other statementdenydenyallow
change:run, change:revertchange run, ff, next, revert, rewinddenyconfirmallow
run:build, run:file, run:dirrun build, file, dir, exec, files, and inspect, preview against a resolved configdenyconfirmallow
pipeline:runpipeline run <slug>denyconfirmallow
db:create, db:resetdb create, db reset, db transfer --to, db transfer --importdenyconfirmallow
db:truncatedb truncatedenyconfirmconfirm
db:teardowndb teardowndenydenyconfirm
db:destroydb dropdenydenyconfirm
change:rmchange rmdenyconfirmconfirm
config:rm, config:writeconfig rm, config set-password, overwrites with config import or config create, config syncdenyconfirmconfirm
vault:read, secret:readvault list, secret list, config exportdenyallowallow
vault:write, secret:writevault init, set, rm, cp, and secret set, rmdenyconfirmallow
vault:propagatevault propagate, ci identity enrolldenyconfirmconfirm
transfer:plandb transfer --to --dry-rundenyallowallow
lock:acquirelock acquire, lock releasedenyallowallow
lock:forcelock forcedenyconfirmconfirm

explore and sql:read are gated on the agent channel only; a person at the keyboard always passes. Commands not listed have no role gate.

A role denied every command that records to noorm's tracking tables, such as viewer, never creates or migrates them. On the agent channel a confirm cell counts as denied here, because an agent cannot confirm. db create and db teardown record to the tables, so a role that holds either one can create and migrate them. A role that cannot write gets these results:

Database stateResult
No tracking tablesRead commands treat the database as empty: no changes applied, no lock, no pipeline runs
Tables that need a migrationExit 1 until a role that can write runs a command
config useActivates the config, creates and migrates nothing, and registers no identity in the database

The TUI follows the same rule.

On a config with isTest: true, every role on both channels reads the admin column, even on a protected stage, and the db:create, db:reset, db:truncate, db:teardown, and db:destroy rows read allow. An agent can run run build, change run and db reset on it; admin's other confirm rows still need a human. The same cells gate db transfer destinations. Where the flag counts is in access roles.

Vault set, propagation, copy, and identity enrollment also require vault:read when they unseal an existing vault key. Fresh vault initialization can use write-only access; secret writes do not require secret:read.

sql query checks every permission represented by the statement batch, including nested writes. EXPLAIN inherits the class of what it wraps, and unrecognized statements require sql:ddl. Classification is a guardrail, not a sandbox; use database permissions for isolation.

Roles catch mistakes such as a teardown against the wrong database. They do not stop someone who holds the credentials and connects with another client.

Commands ​

These commands never connect to a database:

  • identity, settings, secret, version, mcp init
  • ci init, ci secrets, ci identity new
  • change add, change edit, change rm
  • sql history, sql clear
  • config, except use and validate

run inspect and run preview try one short connection to read vault secrets.

Project ​

init ​

Create .noorm/, settings.yml, and a # noorm block in .gitignore. The encrypted state.enc is written when the first config is saved. On the default layout, also create db/sql/, db/changes/, db/AGENTS.md, and db/CLAUDE.md. Create an identity first when none exists.

noorm init [--force] [--yes] [--here]
FlagEffect
--force, -fReinitialize a directory that already has .noorm/. Without it, exit 1. Existing paths in settings.yml are kept, so a project on ./sql and ./changes gets no db/ folder. Existing db/AGENTS.md and db/CLAUDE.md are not overwritten
--yes, -ySkip prompts. Needs an identity at ~/.noorm/identity.{key,pub,json}, else exit 2
--hereInitialize in the directory you launched from, ignoring a parent .noorm/
bash
noorm identity init --name "CI Bot" --email ci@example.com
noorm init --yes

Without a terminal and without --yes or NOORM_YES, init exits 2. Ephemeral runners use ci init instead. See noorm init.

ui ​

Open the TUI at the home screen. Takes no flags.

bash
noorm ui

Config ​

Local state in .noorm/state/state.enc. config use also registers your identity in that config's database when it can connect and the role can write there.

config list ​

List stored configs.

bash
noorm config list --json

JSON: configs[] with name, type, isTest, access, isActive, dialect, database, and, when policy resolution succeeds, effectivePermissions for both channels. This field is best-effort and can be absent. Configs whose access.agent is false are omitted on the agent channel.

config use <name> ​

Set the active config. An unknown name exits 2. On the agent channel, a config with agent: false exits 1 with Config "<name>" is not accessible on the agent channel. and stays inactive. JSON: activeConfig.

The command then connects to the config's database, when it can, to register your identity. A failed connection does not fail the command. A role that cannot write to the tracking tables registers nothing.

bash
noorm config use staging

config create ​

Save configs from stages without connecting or prompting. An identity key is required to encrypt state.

bash
noorm config create --stage staging --name review --host db.example.com
noorm config create --all
FlagEffect
--stage <stage>Materialize this stage. Required unless using --all
--name <name>Save under this name instead of the stage name. Protected stages require the stage name
--dialect, --host, --port, --database, --userOverride stage and environment connection values for a single stage
--password <value>Explicitly persist this password for a single stage. Avoid leaving secrets in shell history or process arguments
--allCreate one config per stage using stage defaults only. Cannot combine with stage/name/connection overrides
--force, --yesBoth literal flags are required to replace existing configs
--jsonReturn { success: true, names: [...] }

Single-stage connection precedence is stage defaults, environment connection fields, then flags. --name or the stage name fixes the destination; NOORM_NAME cannot redirect it. Host defaults to localhost, database to the stage name, and the resulting config must pass schema validation.

ConditionBehavior
Password in stage settings or environmentOmitted from persisted state, unless the single-stage invocation supplies --password
Bulk creationOmits passwords from every source, including when replacing an existing config
Existing destinationRequires --force --yes and the destination's config:write policy. NOORM_YES cannot substitute for the literal overwrite flag
One bulk destination collides or fails validationPreflights every candidate before saving, so these failures cause no writes
Protected stageRequires a destination name matching the stage; caps effective permission cells at policy-check time without changing created role assignments
Invalid invocation, unknown stage, denied overwrite, or caught save errorExit 2

Create does not persist a stage association. A name matching a stage still uses the normal name-based stage lookup. Stages explains the different TUI seeding behavior.

config sync ​

Preview current stage defaults against an existing config, then explicitly apply them.

bash
noorm config sync --stage staging --name review --json
noorm config sync --stage staging --name review --yes
FlagEffect
--stage <stage>Required source stage
--name <name>Existing target config, defaulting to the stage name. Protected stages require the stage name
--yes, -yApply changed fields without a prompt
--jsonReturn stage, name, changes[] (field, before, after), and applied, with the normal success field

Without --yes, a terminal asks for confirmation after the preview. JSON and non-terminal invocations only preview. Cancellation and no changes leave state unchanged; applied is false. There is no --dry-run flag.

Sync requires the target's config:write permission. It preserves passwords and fields absent from the current defaults, refuses a different dialect, and can tighten but never widen access. It does not consume connection environment overrides or store a stage association. A checked error exits 2.

config add ​

Wizard only. Exits 1 with a pointer to noorm ui and config import.

config edit [name] ​

Wizard only. Exits 1 with a pointer to noorm ui and config import <file> --force --yes.

config repair-access <name> ​

Repair malformed access, or access referencing a role no longer defined in project settings, without deleting the config or its secrets:

bash
noorm config repair-access staging --user admin --agent false --yes

Both replacement assignments are required and must name current built-in or project roles; --agent false disables agent access. The user channel must explicitly pass --yes; agents cannot repair access even with confirmation. When the user role is still valid, its config:write permission applies, so an unknown agent role cannot bypass a user-role denial. Valid access cannot be edited through this command. No role is automatically substituted.

config set-password <name> [value] ​

Replace the database password of a stored config, for rotation jobs that issue a new password and need it saved without the TUI:

bash
echo "$NEW_PASSWORD" | noorm config set-password prod --stdin --yes
FlagEffect
[value]The new password. Visible in the process table and shell history, so prefer --stdin
--stdinRead the password from stdin. One trailing newline is stripped
--yes, -yConfirm the config:write policy cell. NOORM_YES works too
--jsonReturn { success: true, name }. The password is never printed

Only connection.password changes. Other connection fields, access, and the config's secrets stay as they were. The command does not connect: run noorm config validate <name> afterwards to check the new password. It requires the config's config:write permission, so a viewer config is refused. SQLite configs are refused because SQLite has no password. An empty password is refused, so a rotation script whose variable came back empty cannot wipe the stored one. An unknown config name or a config with malformed access exits 2. A missing or empty value, a denied policy, or a missing confirmation exits 1. Every refusal leaves state unchanged.

A stage's locked: true does not block this command; it only blocks deletion.

config rm <name> ​

Delete a stored config and its config-scoped secrets. Malformed access is preserved for diagnosis; removal is an available recovery path.

bash
noorm config rm staging --yes
ConditionResult
No --yes and no NOORM_YESExit 1. There is no confirmation prompt
Unknown nameExit 2
Config linked to a locked stageExit 1 until the stage is unlocked
Role denies config:rmExit 1

JSON: name, deleted.

config cp <src> <dest> ​

Copy a config under a new name. The source access is checked and its protected-stage ceiling is retained. Unknown <src> exits 2. An existing <dest> exits 1, and there is no --force. JSON: src, dest.

bash
noorm config cp dev staging

config export <name> ​

Write a config as JSON, password included.

bash
noorm config export dev > dev.json
noorm config export dev --output ./dev.json
FlagEffect
--output, -oWrite to a file with mode 0600 instead of stdout

File-form certificate settings (ssl.caFile, ssl.certFile, ssl.keyFile) export as their paths, and the files are not read. Inline ca, cert and key export as the stored PEM, private key included. Plain output is the bare config object that config import reads, so redirecting round-trips. --json wraps it as {success, name, config}, which config import does not accept. Gated by secret:read.

config import <path> ​

Create a config from JSON on the user channel. Unreadable or invalid JSON, or a missing name or connection, exits 2.

bash
noorm config import ./staging.json
noorm config import ./staging.json --force --yes
FlagEffect
--force, -fOverwrite an existing config of the same name. Without it, exit 1
--yes, -yConfirm the overwrite. An overwrite rewrites access, so it is a config:write confirm cell

JSON: name, overwritten.

config import saves a certificate path without checking that the file exists. A missing file fails when the config connects, and config validate reports it.

config validate <name> ​

Test that the effective config connects after stage and environment merging, without saving overrides.

bash
noorm config validate prod --json

Exit 0 when valid, 1 when a check fails, 2 for an unknown name. JSON: config, valid, checks[] with label, status, detail.

Identity ​

Your keypair lives at ~/.noorm/identity.{key,pub,json}. It signs change history, owns locks, and encrypts state and the vault.

identity init ​

Create an X25519 keypair, or complete an identity around an existing identity.key.

bash
noorm identity init --name "Ana Ruiz" --email ana@example.com
FlagEffect
--nameDisplay name. Default: git config user.name, then the OS username
--emailEmail address. Default: git config user.email. Exits 1 asking for --email when neither is set
--forceReplace an existing identity. Needs --yes
--yes, -yConfirm the replacement. Only the literal flag counts, so an ambient NOORM_YES does not

A complete identity (identity.key, identity.pub and identity.json) without --force exits 1. JSON: name, email, fingerprint, publicKey, completedExistingKey: true when an existing key was kept, and on replacement backedUpTo and warning.

DANGER

Replacing an identity re-keys state encryption. Every state.enc on the machine becomes unreadable: configs, secrets, and database passwords. Nothing re-encrypts them under the new key. The old keypair is backed up first, and restoring identity.key from backedUpTo is the only way back.

A restored identity.key with no identity.pub or identity.json is kept as it is. identity init without --force, and identity setup in the TUI and in noorm init, derive identity.pub from it and write identity.json; they do not generate a new keypair. A key file that is unreadable, corrupted, or readable by other users exits 1 with the reason and is never replaced.

With NOORM_IDENTITY_PRIVATE_KEY set and no identity.key on disk, identity init exits 1 and writes nothing. The variable already supplies the identity, and the command would otherwise write a public key with no key file beside it. Unset the variable to create a key file.

identity edit ​

Change the display name or email. At least one is required, else exit 2. No identity exits 2.

bash
noorm identity edit --email ana@newjob.com

The fingerprint derives from name and email, so editing changes it. Vault access was granted to the old fingerprint, and a teammate with access must run vault propagate again. JSON: name, email, fingerprint, publicKey, previousFingerprint, fingerprintChanged.

identity export ​

Print your public key and fingerprint for a teammate.

bash
noorm identity export --json

No identity exits 2. JSON: name, email, fingerprint, publicKey.

identity list ​

List users discovered from database syncs.

bash
noorm identity list --json

JSON: users[] with name, email, identityHash, machine, source, lastSeen.

Settings ​

Project settings in .noorm/settings.yml.

settings init ​

Write settings.yml with defaults. An existing file exits 1 unless you pass --force. JSON: path.

bash
noorm settings init --force

--force keeps the paths already in the file.

settings build ​

Reload and re-save settings.yml to apply missing defaults and normalize formatting. JSON: path.

bash
noorm settings build

settings edit ​

Interactive editor for paths, build, strict, logging, stages, rules, and teardown. Exits 2 with a pointer to editing the file directly when you pass --yes or NOORM_YES, or when stdin is not a terminal. Run noorm settings build to validate a hand edit. See settings edit.

settings secret ​

Interactive editor for the secret requirements each stage declares, not their values. Exits 2 under --yes or without a terminal. Edit the secrets: section of settings.yml directly and set values with secret set. See settings secret.

Secrets ​

Config-scoped secrets, encrypted in your state.enc and never shared. A template reads $.secrets.KEY from the first match of: this config's secret, a global secret, then the vault.

All three take --config and --json, and set and rm take --yes. With no --config, they use the active config. An unknown config exits 1.

secret list ​

List key names, never values. JSON: configName, keys.

bash
noorm secret list --config prod

secret set <key> [value] ​

Set a secret. --stdin reads the value from stdin so it stays out of the process table, shell history, and set -x traces. Pass the value or --stdin, not both.

bash
printf %s "$KEY" | noorm secret set PAYMENT_GATEWAY_KEY --stdin

An operator role needs --yes. JSON: configName, key.

secret rm <key> ​

Delete a secret. --yes or NOORM_YES is required. An unknown key exits 2. JSON: configName, key.

bash
noorm secret rm OLD_KEY --yes --config prod

CI provisioning ​

A CI runner starts with no .noorm/ and no identity on disk. ci bridges that. The full pipelines are in CI/CD automation.

ci init ​

Build state.enc from NOORM_IDENTITY_* and NOORM_CONNECTION_*, create a config with default access, and make it active.

noorm ci init [--name <name>] [--type <local|remote>] [--stage <stage>] [--force] [--test] [--yes] [--json]
FlagEffect
--nameConfig name. Defaults to $NOORM_CI_CONFIG_NAME, then ci
--force, -fReplace an existing state.enc. The old one is copied to state.enc.bak-<timestamp> first
--testMark the config isTest: true, which satisfies the SDK's requireTest guard. Refused on the agent channel with the usage exit code; a human creates isTest configs
--type <local|remote>Config type, independent of --test. Wins over the stage's type
--stage <stage>Inherit only defaults.type from this stage. Does not inherit connection settings or isTest
--yes, -yNeeded with --force on a terminal. Without a terminal, --force alone is enough

Type precedence is --type, the explicitly selected stage's defaults.type, then remote. Invalid types and unknown stages exit 2.

bash
noorm ci init --name prod
ConditionResult
Missing or invalid NOORM_IDENTITY_*, missing dialect or databaseExit 2
state.enc exists without --forceExit 1

JSON: identity (name, email, publicKey, identityHash, source), config (name, dialect, database, isTest), stateFile, and backedUpTo after a replacement.

ci secrets ​

Load a dotenv file into the config's secrets. Run it after ci init.

bash
noorm ci secrets --file ./ci-secrets.env --overwrite
FlagEffect
--fileDotenv file. Required
--configTarget config. Defaults to the active one
--overwriteReplace keys that exist. Without it, existing keys are skipped

The file takes KEY=value lines. Blank lines and # lines are ignored, the line splits on the first =, one matched pair of quotes is stripped, and keys match [A-Za-z_][A-Za-z0-9_]*.

ExitMeaning
0Every key loaded or skipped
1State unreadable, or every write failed
2No active config, unknown config, or an unreadable or malformed file
3Some keys set, some failed

JSON: config, set, skipped, errors, and the first five errorDetails.

ci identity new ​

Generate a CI keypair locally. No database contact and nothing written to disk.

bash
noorm ci identity new --name "CI Bot" --email ci@example.com

--name and --email are required. The private key prints once. JSON: name, email, publicKey, identityHash, privateKey, envBlock.

ci identity enroll ​

Register a CI identity in a config's database and grant it vault access. A developer with vault access runs it once per config.

bash
noorm ci identity enroll --config prod --name "CI Bot" --email ci@example.com --yes
FlagEffect
--config, -cTarget config. Required
--name, --emailIdentity to enroll. Required
--public-keyHex X25519 public key from ci identity new, 88 characters. Without it, enroll mints a keypair and prints the private key once
--yes, -yNeeded to grant access, which cannot be undone. Skipped when the identity already holds access

Re-running is safe for the same key. An identity already registered under the same hash with a different public key is refused. JSON: name, email, publicKey, identityHash, enrolledIn, alreadyEnrolled, and privateKey and envBlock when it minted the keypair.

Schema runs ​

Executes SQL files against the database. A file whose checksum is unchanged is skipped unless --force. Every run command accepts --config and --json, and all but inspect and preview accept --force and --dry-run. --dry-run renders to tmp/ and writes nothing to the database.

run build ​

Execute every SQL file under paths.sql, filtered by build.include and build.exclude.

noorm run build [--config <name>] [--dry-run] [--force] [--json]
bash
noorm run build --dry-run
ExitMeaning
0Every file ran or was skipped as unchanged
1No file succeeded
3Some files ran, some failed

JSON: status, files[] (filepath, checksum, status, durationMs, outputPath on a dry run), filesRun, filesSkipped, filesFailed, durationMs, unmatchedInclude, unmatchedExclude. An include or exclude entry that matches nothing warns and does not fail. Entries are relative to paths.sql, so write 01_tables, not db/sql/01_tables.

run file <path> ​

Execute one .sql or .sql.tmpl file. JSON is the file result: filepath, status, checksum, durationMs.

bash
noorm run file db/sql/01_tables/02_sales_order.sql

run dir <path> ​

Execute every SQL file in a directory in path order.

bash
noorm run dir db/sql/01_tables/

A missing directory, or one with no SQL files, exits 2. A directory with nothing in it is a mistyped path, not a successful no-op.

run exec <path> ​

Execute the files a glob or directory matches. A glob keeps only .sql and .sql.tmpl files, sorted. No matches exits 2.

bash
noorm run exec "db/sql/**/*.sql" --dry-run

run files --paths <path,...> ​

Execute specific files in the order given. An empty list exits 1.

bash
noorm run files --paths db/sql/01_tables/01_party.sql,db/sql/01_tables/02_sales_order.sql

run inspect <path> ​

Show what a .sql.tmpl file can see, without running it: data files, helpers, built-ins, config keys, and secret counts.

bash
noorm run inspect db/sql/09_seeds/01_products.sql.tmpl --json

JSON: filepath, context (dataFiles, helpers, helperErrors, builtins, configKeys, secretCount, globalSecretCount). A missing template exits 2. Building the context executes the template's helper scripts, so a resolved config must allow run:file.

run preview <path> ​

Render a .sql.tmpl file and print the SQL without running it. It tries a short, no-retry connection to read vault secrets. When the database is unreachable it renders with local secrets only and says so: stderr in text mode, vaultProbeFailed and notice in JSON.

bash
noorm run preview db/sql/09_seeds/01_products.sql.tmpl > rendered.sql

Text mode writes only the SQL to stdout, so redirecting works. JSON: filepath, sql, durationMs. A missing template exits 2. A render error exits 1. The output contains resolved secrets in plaintext, so it needs run:file like inspect.

SQL pipelines ​

noorm pipeline run <slug> runs a named workflow fresh, with independent pipeline history. Use noorm pipeline history <slug> and noorm pipeline show <run-id> to inspect the selected config. Put --cwd before pipeline and operation flags after the slug or subcommand.

bash
noorm --cwd /path/to/project pipeline run close-period --input '{"period":"2026-10"}' --dry-run
noorm pipeline history close-period --limit 20 --json

See the pipeline CLI reference for generated input flags and exit codes, the pipeline guide for transaction and history behavior, and recovery for a retained guard.

Changes ​

Bare noorm change prints help and does not connect. Every change command that connects accepts --config and --json.

When you omit the name on a terminal, these commands open a picker. Without a terminal they exit 1 and ask for the name.

CommandPicker lists
change runpending, reverted, and stale changes, and never-run changes that cannot be parsed. Not orphaned ones
change revert, change rewindapplied changes
change edit, change rmevery directory under paths.changes
change history-detailevery change with an execution record
change addprompts for a description

change list ​

List every known change and its status: pending, success, failed, reverted, or stale, plus orphaned when the folder is gone.

bash
noorm change list --json

JSON: changes[] and pending. An unreadable change that never ran shows as failed, with the parse message after it in text and in errorMessage under --json.

Retired entries retain their execution status, include retired: true in JSON, and do not count toward pending.

change ff ​

Apply every pending change in order.

noorm change ff [--config <name>] [--dry-run] [--force] [--json]
FlagTypeEffect
--config, -cstringConfig to run against. Defaults to the active config
--dry-runbooleanRender the changes to tmp/ without writing to the database
--force, -fbooleanSkip the checksum check and run every file of each pending change
--jsonbooleanPrint the result as JSON
bash
noorm change ff
noorm change ff -c staging --json
noorm change ff --dry-run
Exit codeMeaning
0Every pending change applied, or none were pending
1A change failed, or the command could not run
3Partial: some changes applied before one failed

JSON fields:

FieldMeaning
success, statusstatus is success, partial, or failed
executed, skipped, failedChange counts
durationMsTotal time
changes[]Per change: name, direction, status, files[], durationMs, error
warnings[]Non-fatal problems, such as a missing db/changes/ directory
errorWhy the batch failed before any change ran
dryRuntrue under --dry-run

A missing db/changes/ directory is a warning, not a failure. If a pending change's forward files cannot be read, ff reports failed (exit 1) before running any pending SQL. The per-change error identifies the problem. An unreadable forward change that was already applied keeps its status and produces a warning.

In a human terminal, ff can offer to retire changes with missing forward files. CI, agent, non-TTY, NOORM_YES, --json, and --dry-run invocations do not prompt or write the retirement file. All invocations skip names already listed in .noorm/retired.yml.

A folder with neither change/ nor revert/ is not a change and is ignored. On a database built from db/sql/, the first ff runs every change, so write changes that are safe to run twice. See Add a column.

change next ​

Apply the next pending change, or the next n with a positional count.

bash
noorm change next 3 --dry-run

Accepts --config, --force, --dry-run, and --json. A count that is not a positive integer exits 1. Failed and unreadable changes behave as in ff. JSON matches ff.

change run [name] ​

Apply one change by name. Without a name on a terminal, pick from the list.

bash
noorm change run 2026-10-20-order-status --json

Accepts --config, --force, --dry-run, and --json. A change whose folder cannot be parsed reports the parse error instead of "Change not found". JSON: name, direction, status, files[] (filepath, checksum, status, durationMs), durationMs. direction is change or revert.

change revert [name] ​

Run one applied change's revert/ scripts.

bash
noorm change revert 2026-10-20-order-status

Accepts --config, --force, --dry-run, and --json. A change that was never applied exits 1 with Cannot revert '<name>': not applied, with --dry-run too.

change rewind [name] ​

Revert the named change and every change applied after it, newest first. A bare integer reverts the last n instead.

bash
noorm change rewind 2026-10-20-order-status
noorm change rewind 3

Accepts --config, --force, --dry-run, and --json. A name that matches no applied change fails with error set.

change add [description] ​

Scaffold <paths.changes>/<YYYY-MM-DD>-<slug>/ with change/ and revert/, each holding 001_<slug>.sql, plus changelog.md. No database connection.

bash
noorm change add order-status --json

JSON: name, path. The stub files hold one comment each, so running the change before you edit them fails with "Files are empty or contain only template placeholders". An existing folder of the same name fails.

change edit [name] ​

Open a change folder in $EDITOR, then $VISUAL, then code. The command exits with the editor's exit code. An unknown change exits 2. Takes no flags besides the name.

bash
EDITOR=vim noorm change edit 2026-10-20-order-status

change rm [name] ​

Delete a change folder from disk. The database is untouched. The role gate applies when a config resolves, and --yes or NOORM_YES confirms. With no config at all, confirmation is required. An unknown change exits 2.

bash
noorm change rm 2026-10-20-order-status --yes

JSON: name, deleted.

change history ​

Show execution records.

bash
noorm change history --count 50 --json
FlagEffect
--countLast N records. Default 20

JSON: history[] with id, name, direction, status, executedAt, executedBy, durationMs, errorMessage, checksum.

change history-detail [name] ​

Show per-file results for each operation on one change.

bash
noorm change history-detail 2026-10-20-order-status --count 5
FlagEffect
--countLast N operations. Default 10

JSON: name and operations[], each with the history record and its files[].

Database ​

db create ​

Create the database if it does not exist and bootstrap noorm's tracking tables. It connects to the dialect's system database to issue the statement. An existing, initialized database reports alreadyExists and exits 0.

bash
noorm db create --config dev --yes

Accepts --config, --yes, and --json. The role gate runs before any probe, so a denied role never gets a SQLite file created as a side effect. JSON: config, database, created, trackingInitialized.

db drop ​

Drop the whole database.

bash
noorm db drop --config dev --yes

Accepts --config, --yes, and --json. When NOORM_CONNECTION_* points the config at another database than the one it stores, stderr warns before the drop, and JSON adds targetOverridden and storedDatabase. JSON: config, database, dropped.

db reset ​

Tear down every user object, then build from db/sql/. --yes or NOORM_YES is required up front, else exit 1.

bash
noorm db reset --config dev --yes

Accepts --config, --yes, and --json. JSON: reset.

db explore ​

Overview counts, with a subcommand per object type.

bash
noorm db explore
noorm db explore tables detail sales_order
noorm db explore fks --schema public
SubcommandListsJSON key
tablestables. tables detail <name> describes onetables
views [name]views, or one viewviews
procedures [name]stored procedures, or oneprocedures
functions [name]functions, or onefunctions
types [name]custom types, or onetypes
indexesindexesindexes
fksforeign keysforeignKeys
triggers [name]triggers, or onetriggers

Every subcommand accepts --config and --json, plus --schema <name> to restrict the listing or name the schema of the object you describe. A name that matches nothing exits 2. The overview JSON has tables, views, procedures, functions, types, indexes, foreignKeys, triggers, locks, and connections. locks and connections are runtime state, so only --json shows them.

db truncate ​

Delete all rows from application tables. Schema and noorm tracking tables stay.

bash
noorm db truncate --preserve party_type,product --yes
FlagEffect
--preserveComma-separated tables to leave untouched
--onlyComma-separated tables to truncate, and no others
--dry-runList the statements without running them
--yes, -yConfirm

Also accepts --config and --json. JSON: truncated, preserved, count, and under --dry-run dryRun and statements.

db teardown ​

Drop all database objects.

bash
noorm db teardown --preserve-schemas app_private --yes
FlagEffect
--preserve-schemasComma-separated schemas to leave untouched. Teardown otherwise reaches every non-system schema
--dry-runReport what would drop
--yes, -yConfirm

Also accepts --config and --json. JSON: dropped (tables, views, functions, types), count, postScriptResult, dryRun. A post-teardown script that fails exits 1 even though the objects are gone, so a half-finished teardown does not report success.

db transfer ​

Move data between configs, or to and from .dt files. Exactly one of --to, --export, and --import; none or several exit 2. On the agent channel, --export without --tables needs explore because it lists tables first.

bash
noorm db transfer --to backup --tables party,sales_order --on-conflict update
noorm db transfer --export ./backup/ --compress
noorm db transfer --import ./backup/party.dtz --on-conflict skip
FlagApplies toEffect
--to <config>database to databaseDestination config. Unknown config exits 2
--export <path>exportA file for one table, or a directory for several
--import <path>importA .dt, .dtz, or .dtzx file
--compressexportWrite .dtz. Any other mode exits 2
--passphrase <text>export, importEncrypt to .dtzx, or decrypt one. Export needs at least 12 characters. Omit it on a terminal for a masked prompt. In a non-interactive session or under --json, omitting it exits 2
--tables <a,b>database to database, exportComma-separated tables. Default all
--on-conflict <s>database to database, importfail, skip, update, or replace. Default fail
--batch-size <n>allRows per batch. Default 1000
--truncatedatabase to database, importTruncate destination tables first
--no-fkdatabase to databaseLeave foreign key checks enforced. By default they are disabled during the transfer
--no-identitydatabase to databaseLet the destination assign identity values. By default they are preserved
--dry-rundatabase to databasePrint the plan and exit 0

--config selects the source, and --json is accepted. The export extension follows --passphrase (.dtzx), then --compress (.dtz), then .dt.

ModeExitJSON
Database to database0 success, 1 failed, 3 partialstatus, tables[], totalRows, durationMs, fkChecksRestored
--dry-run0sameServer, tableCount, estimatedRows, tables[], warnings[]
Export0, or 1 on errormode: "export", tables[], totalRows, totalBytes, and filepath or directory
Import0, or 1 on errormode: "import", filepath, rowsImported, rowsSkipped

When foreign key checks are not restored on the destination, stderr warns and fkChecksRestored is false.

Locks ​

Tool-level mutual exclusion between noorm runs against one config. change run, ff, next, revert, and rewind take and release their own lock around each change.

lock status ​

Show whether the config is locked, and by whom.

bash
noorm lock status --json

JSON: isLocked and lock (lockedBy, lockedAt, expiresAt), or lock: null.

lock status has no role gate, but it exits 1 on a config hidden from the agent channel (agent: false). It deletes an expired lock only for a role with lock:acquire; for any other role it reports the expired lock as unlocked and leaves the row.

lock acquire ​

Take the config's lock so other noorm runs against it fail until you release it or it expires. Needs the lock:acquire permission, as lock release does.

bash
noorm lock acquire --timeout 600000 --reason "nightly migration"
FlagEffect
--timeoutMilliseconds before the lock expires. Default 300000. A non-positive or non-numeric value exits 2
--reasonText shown to anyone this lock blocks

Another holder fails the command with exit 1. The same identity extends its own lock. JSON: acquired, lockedBy, expiresAt, reason.

lock release ​

Release your own lock. A lock held by someone else, or no lock, exits 1. JSON: released.

bash
noorm lock release

lock force ​

Release any holder's lock. Needs --yes or NOORM_YES.

bash
noorm lock force --yes

Exit 0 when a lock was broken and 2 when there was none, so a script can tell an eviction from a no-op. JSON: success (whether a lock was broken), released, holder, forced. Breaking a lock can corrupt data if the holder is still running.

Vault ​

Team-shared secrets, encrypted in the config's own database. Vault commands load your identity first and exit 1 when it is missing. See Vault.

All but cp accept --config, --json, and --yes.

vault init ​

Create the vault and seal its key to your identity.

bash
noorm vault init
text
Vault initialized successfully

An initialized vault you can read reports success. One you cannot read exits 1 and asks for a propagate. An operator role needs --yes.

vault set <key> [value] ​

Create or update a secret. --stdin reads the value from stdin. Pass the value or --stdin, not both.

bash
printf %s "$KEY" | noorm vault set PAYMENT_GATEWAY_KEY --stdin

An operator role needs --yes. Without vault access, exit 1. JSON: key, action.

vault list ​

List keys, who set them, and when. Never values.

bash
noorm vault list --json

JSON: secrets[] (key, setBy, updatedAt) and status (usersWithAccess, usersWithoutAccess).

vault rm <key> ​

Delete a secret. --yes or NOORM_YES is required, because the vault keeps no history and this destroys the team's only copy. A key that was never in the vault exits 2.

bash
noorm vault rm OLD_API_KEY --yes

JSON: key, deleted.

vault cp <key> <source> <destination> ​

Copy one secret from one config's vault to another's. All three arguments are positional.

bash
noorm vault cp PAYMENT_GATEWAY_KEY staging production --dry-run
FlagEffect
--force, -fOverwrite the key if the destination has it. Without it, the key is skipped
--dry-runRun the same checks, write nothing

Unknown source or destination exits 2. --config is accepted and ignored. JSON: dryRun, copied, skipped, errors.

vault propagate ​

Grant vault access to identities waiting for it. A grant cannot be revoked, so a bare propagate only lists who is waiting and exits 1.

Recipient review is a separate safety requirement even when a custom role allows vault:propagate. A human must use --yes (or NOORM_YES) to approve a grant; the agent channel cannot self-confirm this review, even when its role allows propagation. Policy denial still applies.

The granting invocation selects the identities then awaiting access, narrowed by --to when supplied. A previous preview does not carry its snapshot or approval into a later invocation: review again if the list may have changed. During the grant, each selected identity hash and public key must still match its pending row; changed or missing rows fail rather than receive a key, and identities arriving after selection are excluded.

bash
noorm vault propagate                      # list who is waiting
noorm vault propagate --to 4a5c14af… --yes # grant one identity
noorm vault propagate --yes                # grant everyone waiting
FlagEffect
--toComma-separated identity hashes. Default: everyone waiting. A hash that is not waiting fails
--yes, -yPerform the grant

JSON: granted, propagatedTo[] (hashes), alreadyHadAccess, failed[], pending[] (identityHash, name, email). A grant that lands for some identities and fails for others exits 3.

SQL ​

sql query [sql] ​

Run one statement. The statement can be positional or read from a file.

bash
noorm sql query "SELECT party_id, name FROM party ORDER BY party_id"
text
Columns: party_id, name
{"party_id":1,"name":"Meridian Analytics"}
{"party_id":2,"name":"Ada Lovelace"}
2 rows returned (3ms)
FlagEffect
--file, -fRead the SQL from a file. It replaces a positional statement
--config, -cConfig to run against
--jsonPrint the result as JSON

No statement, or an unreadable file, exits 2. A failed statement exits 1. A write prints Rows affected: n in place of the row count. JSON: columns, rows, durationMs. rowsAffected replaces the rows for a write and is absent on a SELECT. The role gate classifies the statement.

noorm sql "SELECT 1" works because the entry point rewrites it to sql query when the first non-flag token starts with a SQL verb, such as SELECT, INSERT, WITH, CREATE, or DROP. noorm sql -f q.sql and noorm sql -c prod "SELECT 1" print help, because a flag's value sits in that position. Spell out query there. See noorm sql.

sql query records no history, so a build agent never persists query text or rows.

sql repl ​

Open the TUI at the SQL Terminal. Exits 2 under --yes or NOORM_YES, or without a terminal. --config makes that config the active one before it starts.

bash
noorm sql repl --config dev

See sql repl.

sql history ​

Show history recorded by the interactive terminal for one config.

bash
noorm sql history -n 20 --json
FlagEffect
--limit, -nMaximum entries. Default 50. A non-positive value exits 2
--config, -cConfig whose history to read. Defaults to NOORM_CONFIG, then the active config. None resolved exits 2

JSON: configName and entries[] (id, query, executedAt, durationMs, success, errorMessage, rowCount).

sql clear ​

Delete recorded history and its result files.

bash
noorm sql clear --older-than 3 --yes
FlagEffect
--older-thanOnly entries older than N months. Must be a positive integer, else exit 2
--yes, -yConfirm. Without it, and without --json, the command reports what it would clear and exits 0

NOORM_YES does not count here. JSON: configName, entriesRemoved, filesRemoved.

MCP ​

Expose noorm to AI coding agents over the Model Context Protocol. See MCP.

mcp init ​

Write or extend the agent's MCP config with a noorm server entry that runs noorm mcp serve. Other entries stay.

bash
noorm mcp init --agent cursor
FlagEffect
--agentclaude (default) writes .mcp.json. cursor writes .cursor/mcp.json. Other values write .mcp.json

JSON: path, created, extended.

mcp serve ​

Start the MCP 2026-07-28 server on stdio. It stays alive while stdin is open and always acts on the agent channel. Clients must support the modern protocol; legacy initialize handshakes are rejected. Discover individual tools with tools/list and call them with flat arguments; each database tool call requires an explicit config. The former run_noorm_cmd and noorm_help tools, and connect, disconnect, and session status, are not exposed. The server also provides user-selected prompt cookbooks, JSON exploration resources, and human approval through form elicitation. See the MCP guide.

bash
noorm mcp serve

Diagnostics and updates ​

info ​

Report versions, the active config and its connection, your identity, the detected agent harness, and object counts.

bash
noorm info --json

--config is accepted and ignored: info always reports the active config. An unreachable database still exits 0, with connection: null and connection_error set. JSON: cli_version, schema_version, state_version, settings_version, installed_at, upgraded_at, active_config, config_count, connection, identity, agent (id, name, markers), objects.

version ​

Report the CLI version, Node, platform, identity files, and project detection. No database connection. Exits 0.

bash
noorm version --json

JSON: version, node, platform, arch, identity, project.

update ​

Check for a newer release and replace the running binary.

bash
noorm update
FlagEffect
--insecureDowngrade an unreachable checksums.txt from a failure to a warning. A confirmed checksum mismatch always fails. NOORM_INSECURE does the same
--jsonPrint only the JSON document

On a terminal, status lines rewrite in place and the download ends on Downloaded X MB (100%). Piped output prints one line per step. A failed check or install exits 1. JSON: currentVersion, latestVersion, updateAvailable, installed, and error on failure.

After a successful update, update offers the agent skill through the first installer on PATH:

FoundCommand
npxnpx skills add noormdev/noorm/skills
gh, no npxgh skill install noormdev/noorm skills/noorm, which needs GitHub CLI 2.90 or newer
NeitherNothing runs. Both commands print, with where to get Node.js and the GitHub CLI

On a terminal it asks first and runs the command on yes. Piped output prints the command without asking, and --json skips the offer. A failed install prints both commands. A declined or failed skill install does not change the exit code.

complete ​

Print a shell completion script. Takes zsh, bash, fish, powershell, or fig.

bash
source <(noorm complete zsh)

fig prints a JSON spec. A bare noorm complete is the runtime hook the scripts call, and it exits 1 without --.

dev test-helpers <template> and dev test-workers ​

Diagnostics for $helpers resolution and worker threads in a compiled binary.

bash
noorm dev test-helpers db/sql/09_seeds/01_products.sql.tmpl
noorm dev test-workers --json

Both accept --json. Exit 0 when everything passes, 3 when some pass and some fail, 1 when none pass. test-helpers prints its text report to stdout even under --json, so its output is not a single JSON document.

How do I script a pipeline? ​

A developer enrolls the CI identity once. Every job then builds its own state from environment variables:

The same job as a script. || true covers the lock change ff already released:

bash
#!/bin/bash
set -e

export NOORM_IDENTITY_PRIVATE_KEY=$NOORM_CI_KEY
export NOORM_IDENTITY_NAME="CI Bot"
export NOORM_IDENTITY_EMAIL="ci@example.com"
export NOORM_CONNECTION_DIALECT=postgres
export NOORM_CONNECTION_HOST=$DB_HOST
export NOORM_CONNECTION_DATABASE=$DB_NAME
export NOORM_CONNECTION_USER=$DB_USER
export NOORM_CONNECTION_PASSWORD=$DB_PASSWORD

noorm ci init --name prod
noorm lock acquire --reason "deploy $GITHUB_SHA"
trap 'noorm lock release || true' EXIT
noorm change ff --json

GitHub Actions and GitLab versions are in CI/CD automation. Snippets for reading results:

bash
# Apply only when something is pending
[ "$(noorm change list --json | jq '.pending')" -gt 0 ] && noorm change ff

# One failure check for every command
noorm run build --json | jq -e '.success' > /dev/null || echo "build did not succeed"

# Preview pending vault recipients for a human to review
noorm vault propagate

# Render a template and pipe the SQL onward
noorm run preview db/sql/hotfix.sql.tmpl | psql -h localhost -d app

What bites ​

Mistake or symptomCauseFix
noorm -c prod run build fails: --cwd path is not a directoryBefore the subcommand, -c is --cwdnoorm run build -c prod
Unrecognized flag '--json' before the subcommand, exit 2Only -c/--cwd is read before the subcommandMove the flag after the subcommand
A script tests [ $? -eq 2 ] for "partially applied"Before noorm 1.0.0, 2 meant partial and total failure alike. Partial is 3 nowTest -eq 3. if ! noorm ... is unaffected
jq '.[]' on change list or db explore tables failsLists sit under a named key since 1.0.0jq '.changes[]', jq '.tables[]'
noorm init exits 2 in CINo terminal, and --yes needs an existing identitynoorm identity init --name ... --email ..., then noorm init --yes, or use ci init
A confirm command fails under an agent CLI even with --yesCLI agents cannot fulfill human confirmationUse an MCP client with modern form elicitation, or have a human run the operation. noorm info shows the detected channel/harness
noorm sql -c prod "SELECT 1" prints helpThe bare form rewrites only when the first non-flag token is SQLnoorm sql query -c prod "SELECT 1"
config add or config edit exits 1Both are wizard-onlynoorm ui, or config import <file> with --force --yes
noorm lock release exits 1 after change ffEach change takes and releases its own lock, so the lock from lock acquire is gone after the first changenoorm lock release || true
The SDK's requireTest guard rejects the config ci init madeci init sets isTest: true only with --testPass --test for a throwaway database, not for production. An agent session cannot: --test is refused on the agent channel
tmp/ holds secrets after run build --dry-runRendered files contain resolved secrets in plaintext, owner-only, and tmp/ is not gitignoredDelete tmp/, or add it to .gitignore
change ff fails on a freshly built database: object already existsrun build leaves no change records, so the first ff runs every changeWrite changes that are safe to run twice
dev test-helpers --json does not parseIt prints a text report before the documentUse run inspect --json for helper data

Next ​