Stanza

CLI

Look up every command and flag, and how they combine.

Usage

Usage: stanza (--fix | --check) [--changed [--hunks] | --stdin <path> | [--] <paths...>] [--json] [--braces | --no-braces]
       stanza --check --staged [--hunks] [--json] [--braces | --no-braces]
       stanza explain [--no-braces] [--] <file>:<line>
       stanza hook [--braces | --no-braces] [--hunks]

Flags

The flags, as stanza --help prints them:

flagwhat it does
--fixapply every deterministic rule in place
--checkreport only, change nothing
--changedfiles from git diff --name-only HEAD plus untracked files
--hunkswith --changed or --staged, only gaps and blocks touching changed lines
--stagedthe staged content of staged files, for pre-commit
--stdin <path>source on stdin; --fix: fixed text on stdout, findings on stderr; --check: findings on stdout
--jsonfindings as a JSON array
--bracesturn on the braces rule even when lint config turns it off or cannot be read
--no-bracesturn off the braces rule, keep the blank line rules
explain <file>:<line>which rule decides the gap or braced body at that line, and why
hookStop and SubagentStop; PostToolUse on Edit, MultiEdit and Codex apply_patch; PreToolUse on Write; reads JSON on stdin
--helpusage, flags and the rule catalog
--versionthe version, and for a built binary the commit it was built from

-h is the same as --help. --help and --version take no other arguments.

Environment

AGENT_HOOKS=0 turns the hook off.

STANZA_WORKERS sets the worker thread count. It accepts only digits representing an unsigned integer from 0 to 64 inclusive. 0 runs serially on the main thread, without worker threads. Any accepted value applies at any file count, even below 64 files.

Invalid or out-of-range values are ignored. Without an accepted value, a run of fewer than 64 files is serial and a run of 64 files or more uses one worker thread fewer than the available parallelism, up to eight.

Only runs over path arguments or --changed can use worker threads. --staged, --stdin and hook runs never do.

Combining Flags

combinationwhat happens
neither --fix nor --check, or bothusage error
none of paths, --changed, --staged and --stdinusage error, nothing to format
more than one of paths, --changed, --staged and --stdinusage error
--staged with --fixusage error, --staged works only with --check
--hunks without --changed or --stagedusage error
both --braces and --no-bracesusage error
the same flag twiceusage error
a path that starts with -put -- before it; everything after -- is a path

A usage error prints the problem and the usage on stderr and exits 2. stanza hook checks its own arguments and exits 1 instead, see Hook Protocol.

On this page