CLI Reference
The binary is sovereign-guard. It has three commands: scan, verify and evidence. The scan flags compose. A scan that replaces raw colours for one theme is sovereign-guard scan src --fix --tenant light. Run any command with --help to print its options.
sovereign-guard scan src --fix --tenant lightCommands
| Command | Behavior |
|---|---|
| scan <target> | Scan source for raw colours, physical layout, component size and text contrast. Needs no theme. |
| verify [dir] | Run the governance check suite on a project that declares a CONTRACT.json. |
| evidence diff <older> <newer> | Compare two evidence reports written by scan --evidence. |
scan options
| Flag | Behavior |
|---|---|
| --check | Report without writing any source. Add --output-path to write sovereign-report.sarif. |
| --fix | Replace raw colours with the matching token where one is unambiguous. Script files only; layout is never rewritten. |
| --fix-inline-styles | Move static inline styles into a class in the stylesheet named by fix.styles.target in sovereign.config.json. Opt-in, never implied by --fix. With --check or --suggest it writes a patch and a manifest instead (needs --output-path). |
| --suggest | Write sovereign-suggestions.json and leave source untouched. |
| --summary | Write sovereign-impact.md when used with --fix or --check. |
| --evidence | Also write sovereign-evidence.json and sovereign-evidence.md: a dated record of what the scan looked at and found, mapped to WCAG 2.1 and EN 301 549. Needs --output-path with --check. |
| --third-parties | With --evidence: add a register of the hosts the source code names. Reads source only and fetches nothing. |
| --output-path <dir> | Directory for the reports and suggestions. |
| --tenant <id> | The theme the scanned files belong to. Otherwise the tenants map in sovereign.config.json decides. |
| --ignore <glob> | Skip files matching this glob, relative to the target. Repeatable. |
| --skip-generated <glob> | Skip minified or generated files matching this glob. Repeatable. Nothing is skipped without it. |
| --no-default-ignores | Scan stories, tests, declaration files, build output and vendored code too. |
| --require <gate> | Exit 2 if this gate has nothing to test: contrast, budget, tokens or markup. Repeatable. |
| --baseline <file> | Accept the findings recorded in the file and fail only on new ones. Create it with --write-baseline. |
| --write-baseline <file> | Record the current findings as accepted in this file and exit 0. |
| --max-file-size <kb> | Do not parse script files larger than this (default 1024). They are counted and reported. |
| --budget <lines> | Maximum logical lines of code per file (default 200). |
| --complexity <score> | Maximum cyclomatic complexity (default 10). |
| --fail-on <level> | Lowest severity that fails the run: error (default), warning, note or none (report only). |
scan reads .ts, .tsx, .jsx, .js, .mjs, .cjs, .mts, .cts, .css and .scss files, and the style and script blocks of .vue, .svelte, .astro and .html files. Files it does not read are counted and reported, never silently skipped. Without a sovereign.config.json it runs in zero-config mode.
verify options
| Flag | Behavior |
|---|---|
| --list | List the available checks and exit. |
| --check <name> | Run only this check. Repeatable. |
| --policy <path> | RBAC policy file. Requires --role. |
| --role <role> | Role to authorise against the policy. Requires --policy. |
| --payload <file> | Token payload for the RBAC gate. Default styles/tokens/tokens.json. |
evidence diff options
| Flag | Behavior |
|---|---|
| --output-path <dir> | Write sovereign-evidence-diff.json and sovereign-evidence-diff.md here. Without it the summary is printed and nothing is written. |
| --fail-on-new | Exit 1 when the second report has findings the first does not. By default a comparison exits 0. |
Exit codes
The process status is the contract. Scripts branch on the code, not on log text.
scan
- 0 — Clean. No findings at or above --fail-on.
- 1 — Findings remain, or a file failed to parse.
- 2 — Tool, config or IO failure, or a required gate had nothing to test. Outranks 1.
verify
- 0 — Every selected check passed.
- 1 — A check found a defect.
- 2 — A check could not run, the invocation was invalid, or no check applies to the project. A check that does not apply is listed as not applicable and is never counted as passed.
evidence diff
- 0 — Compared. This includes a comparison that found new findings, unless --fail-on-new is set.
- 1 — --fail-on-new is set and the second report has new findings.
- 2 — A file is missing, is not an evidence report this version reads, or cannot be written.