Skip to content
SOVEREIGN

Guard CLI beta guide

This beta is for lead engineers running sovereign-guard scan against a product repository. The binary returns one exit code for CI and writes a SARIF report. Beta software is provided for evaluation under the agreement you were given.

Installation

Install the Guard and run a first scan by following Getting Started. This guide covers what the Guard checks, then configuration, scan options, exit codes, network use and markup checks.

What the Guard checks

The Guard is a command-line tool, in private beta, and it's proprietary rather than open source. This page describes version 1.8.0, released on 25 November 2026. It checks:

  • Raw colours. Colours typed straight into code instead of coming from a token.
  • Physical layout. Layout pinned to left and right, which breaks in languages read right to left.
  • Oversized components. Components that have grown past their size limit.
  • Contrast failures across brands. Text that misses the contrast floor in any brand's theme: WCAG AA, 4.5:1 for text.
  • Page markup. Six common accessibility problems in your page source, reported as warnings. See Markup checks below.
  • Non-text contrast. A restyled form control whose border and fill both sit under 3:1 against what's around it (WCAG 1.4.11). A warning.
  • Keyboard focus. An element whose focus rules strip the outline and draw nothing in its place, or draw an indicator under 3:1 (WCAG 2.4.7 and 1.4.11). A warning or a note.

If you use Tailwind, the non-text contrast and keyboard focus checks also read the utility classes on your form controls, and the colour names in your Tailwind setup. The Tailwind 3 config file is read as text, and the Guard never runs it. From 1.8.0 it also reads @apply, cn() and cva() calls and component tags. Whatever it still can't read gets counted in the summary. It doesn't guess. Findings that come from classes are warnings.

By default the Guard just reports a typed colour. It can also write the fix to a file and leave your code alone, or swap in the token itself, in .ts and .tsx files, when exactly one token matches. For each text contrast failure, scan --suggest works out the nearest colour that reaches the floor and writes it to a file. It never edits your code. If the file is generated, the suggestion says so.

Values pass down one chain: primitive, alias, semantic. A component may read the last two. Type a raw colour into one and the check fails. The Compiler page explains the tiers. Fixing is phase 2 of 4. Today the Guard can suggest token fixes, and apply them, with a person in the loop. A button on the pull request (phase 3) and a check that the page looks the same afterwards (phase 4) aren't built yet.

Configuration (sovereign.config.json)

A configuration file is optional. Without one, scan runs in zero-config mode and checks raw colours, physical layout properties, component size and text contrast read from your own stylesheets. To judge design tokens per tenant and to use --fix, place sovereign.config.json at the repository root. tokenPrefix defaults to --semantic-.

{
  "themes": {
    "directory": "./themes",
    "pattern": "*.resolved.json"
  },
  "tokenPrefix": "--semantic-"
}

Paths in themes.directory resolve from the config file. With a config file, a gate that has nothing to test is a failure rather than a pass, and the run exits 2 with the reason.

Running Scans

Run the scan from the repository root. The target is a file or directory. On large Tailwind projects 1.8.0 scans more slowly than 1.7.0 did: shadcn/ui took 24.2 s against 8.2 s. The figures and their limits are on the tested page.

npx sovereign-guard scan src

--check reports without writing source. --fix replaces raw colours in script files with the matching token. It never rewrites layout. --suggest writes sovereign-suggestions.json and leaves source untouched. Pass --output-path to write sovereign-report.sarif.

npx sovereign-guard scan src --check --output-path ./reports

Add --evidence to also write a record of the run. --third-parties adds the third-party hosts your pages load, using the thirdParties settings in the configuration file. sovereign-guard evidence diff compares two records. Every command and option is listed in the CLI reference.

CI/CD Exit Codes

Treat a non-zero exit as a failed check.

  • 0 — clean: no findings at or above --fail-on.
  • 1 — findings remain, or a file failed to parse.
  • 2 — tool, config or IO failure: bad usage or config, a missing target, an unreadable file, or a required gate with nothing to test. It outranks 1.
npx sovereign-guard scan src --check --output-path ./reports
echo "exit code: $?"

Network use

In our tests, scan and verify made no network connection. We cut the network entirely and the results were identical. Tested on Linux only. macOS and Windows are not tested yet. scan --fix-inline-styles is not covered. The method and the other limits are on the tested page.

Markup checks

scan also reads page markup and reports six kinds of common accessibility problem as warnings: missing image alt text, unlabelled form fields, links and buttons with no name, a missing page language, empty or skipped headings, and a missing title or main landmark. A normal scan does not fail the build unless you pass --fail-on warning. These checks apply from the 26 October 2026 build. The Guard reads source, not the rendered page, so it can't see content built by components, added by scripts or hidden by CSS. It doesn't certify WCAG or EAA compliance. Treat findings as leads to check, not a full audit. The rules may become errors later, but only once they hold up on projects outside our test set. The limits are also on the Guard page, and accuracy figures are on the tested page.

Beta Feedback

Send the beta lead four artifacts from the same run: the output of npx sovereign-guard --version, the exact scan command, the process exit code, and sovereign-report.sarif.