Skip to main content
Introducing packages.sweber.dev
Documentation menuCLI

CLI

Check a whole site from the command line.

npx surjection check [urls...] [options]
npx surjection statement --config statement.json --out erklaerung.md

Which pages

Pass absolute URLs, paths with --base-url, or a sitemap:

npx surjection check --base-url https://preview.example.ch / /shop /kontakt
npx surjection check --sitemap https://example.ch/sitemap.xml --max-pages 100

Sitemap indexes are followed one level deep. --max-pages (default 50) keeps large shops manageable.

Options

OptionDefaultMeaning
--config <file>surjection.config.json if presentRead options from a file, see Configuration
--standard <id>wcag22aawcag2a, wcag2aa, wcag21aa or wcag22aa
--fail-on <impact>minorLowest impact that fails the run: minor, moderate, serious, critical
--locale <locale>enLanguage of messages and reports: de, de-CH, fr, it, en
--exclude <selector>Skip elements you do not control, e.g. a third-party chat widget. Repeatable
--baseline <file>surjection-baseline.jsonAccepted findings, see Baseline
--update-baselineWrite all current findings into the baseline and exit with 0
--best-practiceAlso run axe-core rules that are not WCAG criteria
--out-md <file>Markdown report
--out-json <file>All results as JSON, input for Surjection Pro
--project <name>Project name in reports

Exit codes

CodeMeaning
0No failing issues
1Issues remain after baseline and --fail-on
2Usage or runtime error, e.g. Playwright missing

Browser

The CLI starts Chromium through Playwright. Set SURJECTION_CHROMIUM_PATH to use a browser that is already installed.