This page documents all CLI options and shows practical examples. STAN’s CLI honors phase‑scoped defaults from your configuration (cliDefaults) when flags are omitted; see “Config‑driven defaults” below.
Related guides:
<query> is a valid relative path, switch to it.name in package.json found via pnpm-workspace.yaml or package.json workspaces (exact match).stan: switched context to <path>.Example:
stan -v
stan -w packages/core run
stan -w @my-org/lib snap
If you run stan with no subcommand and no config is found, STAN starts interactive init. Otherwise it prints the help (with a footer listing available run scripts).
By default (built‑ins), stan run:
Flags (presented in the same order as stan run --help):
-s, --scripts [keys...]
-S, --no-scripts
-x, --except-scripts <keys...>
-m, --prompt
auto (default), local, core, or a file <path>.auto: prefer a local prompt at <stanPath>/system/stan.system.md; fall back to the packaged core prompt.core: use the packaged baseline from @karmaniverous/stan-core.<path>: use the specified file (absolute or repo‑relative).stan.system.md in steady state for core/<path> sources (the full archive always contains the prompt for the run). When the effective prompt changes since the last stan snap, it appears exactly once in archive.diff.tar.-q, --sequential / -Q, --no-sequential
Facet overlay (selection view; defaults via stan-cli.cliDefaults.run.facets)
Notes:
-f, --facets enables the overlay only; it does not “activate all facets”. Per-facet activation still comes from <stanPath>/system/facet.state.json plus any --facets-on/--facets-off overrides.**/*.test.ts) are deny-list filters only; they are not implemented via anchors and must not cause matching files to appear inside structurally inactive subtrees.Examples:
stan run -f --facets-on docs
stan run -f --facets-off heavy
stan run -F
-a, --archive / -A, --no-archive
-b, --combine / -B, --no-combine
-c, --context / -C, --no-context
archive.meta.tar (thread opener) in addition to full/diff archives.-k, --keep / -K, --no-keep
-p, --plan
-P, --no-plan
Plan header contents:
The plan includes a prompt: line that reflects the resolved system prompt source for the run (for example, auto → local (.stan/system/stan.system.md) or @karmaniverous/stan-core@<version> when --prompt core is used).
This mirrors the effective prompt used during archiving and helps keep logs self‑describing.
-l, --live / -L, --no-live
--hang-warn
--hang-kill
--hang-kill-grace
Defaults (built‑in unless overridden by cliDefaults or flags):
Live UI status legend (TTY)
Notes:
Conflicts and special cases:
Examples:
# Default: run all scripts and write archives
stan run
# Plan only (no side effects)
stan run -p
# Execute without printing the plan first
stan run -P
# Run a subset
stan run -s test lint
# Run all except a subset
stan run -x test
# Sequential execution (preserves -s order)
stan run -q -s lint test
# Combine mode and plan
stan run -b -p # plan only; combine would include outputs in archives
# Keep outputs on disk even after runs
stan run -k
# Overlay view
stan run -f -p # plan shows “facet view” section
Snapshots help STAN compute diffs over time and maintain a bounded undo/redo history.
Main command:
stan snap
Flags:
Subcommands:
stan snap info — print the snapshot stack (newest → oldest) with the current index.stan snap undo — revert to the previous snapshot in history.stan snap redo — advance to the next snapshot in history.stan snap set <index> — jump to a specific snapshot index and restore it.History:
Patches must be plain unified diffs (git‑style headers) with LF line endings. STAN cleans and saves the diff to .stan/patch/.patch, then applies it safely (or validates with --check). On failure, it writes diagnostics and a FEEDBACK packet and (when possible) copies it to your clipboard.
Sources and precedence:
Flags (presented to match stan patch --help):
Behavior highlights:
On success:
On failure:
Examples:
# Clipboard (default)
stan patch
# Validate only
stan patch --check
# From a file
stan patch -f changes.patch
stan init scans your package.json, lets you pick scripts, writes stan.config.yml, ensures workspace folders and .gitignore entries, and writes docs metadata under .stan/system/.
Options:
Phase‑scoped defaults are read from your config when flags are omitted. Precedence: flags > stan-cli.cliDefaults > built‑ins.
Example:
stan-cli:
cliDefaults:
# Root
debug: false
boring: false
# Run defaults
run:
archive: true # -a / -A; combine implies archive=true
combine: false # -b / -B
keep: false # -k / -K
sequential: false # -q / -Q
plan: true # print the run plan header before execution when -p/-P not specified
live: true # -l / -L
hangWarn: 120
hangKill: 300
hangKillGrace: 10
# default script selection when neither -s nor -S is provided:
# true => all scripts,
# false => none,
# ["a","b"] => only these keys
scripts: true
# Note: facets controls whether the overlay is enabled by default.
# It does not implicitly activate all facets; per-facet activation still comes
# from <stanPath>/system/facet.state.json plus any per-run overrides.
facets: false
patch:
# default patch file when no argument/-f is provided, unless -F/--no-file is used
file: .stan/patch/last.patch
snap:
stash: false # -s / -S
Examples:
cliDefaults:
run:
scripts: true
archive: false
cliDefaults:
run:
sequential: true
patch:
file: .stan/patch/pending.patch
cliDefaults:
snap:
stash: true
# Typical loop
stan run # build & snapshot
stan snap # update baseline
stan patch -f fix.patch # apply unified diff
# Focused run
stan run -q -s lint test # sequential; run only lint and test
# Combine mode and plan
stan run -b -p # plan only; combine would include outputs in archives