CLI reference
The sitecmd command-line tool, which scans a site and audits your project's code with no account: where to get it, and its commands, flags and exit codes.
The sitecmd CLI scans a site, or audits a checkout of your project's code, on your own computer or in a CI job. It needs no account, and what it finds stays where it ran: in your terminal, in the files it writes and in your CI job's output. Its source is in SiteCMD's public repository, under the Apache License 2.0.
The CLI is separate from SiteCMD's hosted service, which What is SiteCMD explains.
Installation
With npm
If your project already uses Node, add the CLI as a development dependency and run it with npx:
npm install --save-dev @sitecmd/cli
npx sitecmd audit .
npm installs only the package for your computer: macOS, Linux on x86_64 or arm64, or Windows on x86_64. The packages run no script when they install, and npm records where each was built (npm provenance).
With the install script
On macOS and on Linux on x86_64, install Minisign first (brew install minisign on macOS, or your Linux package manager), then run:
curl -fsSL https://sitecmd.com/install.sh | sh
The script downloads the latest release from releases.sitecmd.com, checks its SHA-256 checksum and its minisign signature, confirms the binary reports the version it asked for, and installs sitecmd to /usr/local/bin when it can write there, otherwise ~/.local/bin. If that directory is not on your PATH, the script prints the export PATH=... command to run in your shell. Set SITECMD_INSTALL_DIR to choose another directory, or SITECMD_VERSION to install a specific version. It refuses to replace an installed sitecmd with an older version unless SITECMD_VERSION names it.
On Windows
Download the zip and put sitecmd.exe in a directory on your PATH:
https://releases.sitecmd.com/v<version>/sitecmd-cli_<version>_windows-x86_64.zip
https://releases.sitecmd.com/ reports the latest version. Every platform's download follows the same pattern (darwin-universal.tar.gz, linux-x86_64.tar.gz, windows-x86_64.zip), with a .sha256 checksum and a .sig minisign signature beside it.
sitecmd --version prints the version you have.
Commands
| Command | What it does |
|---|---|
scan |
Scan a site, and write the results to .sitecmd/. |
audit <path> |
Audit a checkout of your project's code. |
init [url] |
Create a .sitecmd/ config in the current directory. |
check |
Fail a git push when the site's score is below your floor. |
watch |
Scan a site again at an interval. |
fix |
Print the fix for an issue the last scan found. |
autofix apply |
Apply the CLI's template fixes to a checkout. |
Run sitecmd <command> --help for every flag a command takes.
sitecmd scan
Scans a site from the computer it runs on.
sitecmd scan --url https://example.com
| Flag | What it does |
|---|---|
--url <URL> |
The site to scan. Falls back to .sitecmd/config.json when left out. |
--diff |
Compare with the last scan and show what changed. It can't be combined with --categories. |
--env <NAME> |
Scan a named environment's URL from the config. |
--fail-under <N> |
Exit 1 if the score is below N. |
--fail-on <SEV> |
Exit 1 if a failing issue is at or above critical, high, medium or low. |
--json |
Write JSON to standard output, and write nothing to .sitecmd/. |
--output json |
The same as --json. |
--timeout <SECS> |
The timeout for each request. The default is 30 seconds. |
--categories <LIST> |
Scan only these categories, comma-separated: security, domain_https, email, seo, ai_visibility, performance, accessibility, privacy, polish or reliability. An unknown name is an error. |
Hosted scans open each page in a browser to run axe-core's rules, capture JavaScript errors as pages load, and measure Largest Contentful Paint and layout shift. How a scan works explains what the browser adds. The released CLI reads pages as your server sends them. The --cwv and --no-browser flags work only in a build made with the optional browser feature.
In a project with a .sitecmd/ directory, which sitecmd init creates, a scan also writes last-scan.json (what --diff compares with), issues.md and issues.json (each failing check with its fix) and rules.md (rules for your code drawn from what failed).
Exit codes
| Code | Meaning |
|---|---|
0 |
The scan passed, or no threshold was set. |
1 |
The score is below --fail-under, a failing issue is at or above --fail-on, or --diff found a new critical issue. |
2 |
The scan could not run, such as for a network error or an invalid URL. |
# Fail the build if the security score is below 90
sitecmd scan --categories security --fail-under 90
# Fail the build on any high or critical issue
sitecmd scan --fail-on high
# Save the results for another tool
sitecmd scan --json > results.json
sitecmd audit
Audits a checkout of your project's code on the computer it runs on, with no account.
sitecmd audit .
sitecmd audit . --format review --output sitecmd-review.md
sitecmd audit . --format github --fail-on high
| Flag | What it does |
|---|---|
<path> |
The checkout to audit. Required. |
--format <FORMAT> |
summary (the default), json, markdown, review, GitHub annotations with github, or sarif. |
--fail-on <SEVERITY> |
Exit 1 when a critical, high, medium or low finding meets that floor. |
--output <PATH> |
Write the report to a file instead of standard output. |
--baseline <PATH> |
A previous --format json report. A finding whose fingerprint it lists never trips --fail-on. |
--inspect-local-databases |
For this run only, read local dotenv values to find a database, and read the schema of a SQLite file inside the checkout or a PostgreSQL database on this computer, read-only and never a table's rows. A database on another host is refused. |
Without --inspect-local-databases, audit reads no value from a local dotenv file and opens no database.
| Code | Meaning |
|---|---|
0 |
The audit finished, and no finding met --fail-on. |
1 |
A finding met --fail-on. |
2 |
The audit could not run, or its report could not be written. |
Findings you have reviewed
Record a finding you have reviewed in .sitecmd/config.json, so every audit, on your computer and in CI, applies the same decision. A suppression matches a rule, a path in the checkout (with gitignore patterns), a fingerprint from the JSON report, or a combination, which must all match. Each one needs a reason, and expires takes a date as YYYY-MM-DD.
{
"version": 1,
"url": "https://example.com",
"name": "Example",
"code_scan": {
"suppressions": [
{
"match": {
"path": "examples/**",
"rule": "code_scan.tls-verification-disabled"
},
"reason": "The insecure client is an instructional fixture."
}
]
}
}
A suppressed finding does not count toward --fail-on, and the report still lists it. A suppression that matches nothing is reported as stale. A suppression whose expiry date has passed is reported as expired.
sitecmd init
Creates a .sitecmd/ directory in the current directory. It refuses to run where one already exists.
sitecmd init https://example.com --yes
| Flag | What it does |
|---|---|
[url] |
The site this project scans. |
--name <NAME> |
The project's name. The default is package.json's name, then the directory's name. |
--yes, -y |
Use the detected values without asking. |
init writes config.json, with the site's URL and the project's name, and a .gitignore that keeps everything but config.json and itself out of git. Commit config.json so your computer and CI share the same settings. To arm sitecmd check, add a fail_under score to it.
sitecmd check
A check for a git hook: it fails when the site's score is below your floor.
sitecmd check --install
| Flag | What it does |
|---|---|
--install |
Install sitecmd check as the repository's git pre-push hook. |
--strict |
Also fail on any check that was not failing in the last scan. Always scans again. |
--fail-under <N> |
The lowest score that passes. The default is fail_under in the config. |
check reuses last-scan.json when it is less than 24 hours old, so a push right after a scan does not scan again. With no floor set, it passes and says so. Run --install from the repository's root. It replaces any pre-push hook the repository already has, and the hook it writes skips the check when sitecmd is not on the PATH.
check exits 1 when the score is below the floor, or with --strict when a check newly fails, and 2 when it could not run.
sitecmd watch
Scans a site again at an interval, and prints how the score changed each time. Stop it with Ctrl+C.
sitecmd watch --url https://staging.example.com --interval 600
| Flag | What it does |
|---|---|
--url <URL> |
The site to scan. |
--interval <SECS> |
How long to wait between scans. The default is 300 seconds. |
--env <NAME> |
Scan a named environment's URL from the config. |
sitecmd fix
Prints the fix for an issue the last scan found: by default the one to fix first, with how many more there are.
| Flag | What it does |
|---|---|
--all |
Print every matching issue's fix. |
--id <CHECK_ID> |
Print the fix for one check. |
--type <TYPE> |
Only issues of this type. |
--category <KEY> |
Only issues in this category, named by one of the keys scan --categories takes. |
sitecmd autofix apply
Applies the CLI's template fixes to a checkout. It has one: for a Vercel project, it sets X-Content-Type-Options: nosniff on every route in vercel.json.
sitecmd autofix apply --dry-run
| Flag | What it does |
|---|---|
--only <CHECK_ID> |
Apply one check's fix. Repeat it for more. |
--dry-run |
Print the changes without writing them. |
--path <PATH> |
The checkout to change. The default is the current directory. |
It exits 0 when it finished, including when the checkout has nothing it can fix, and 2 when it could not run.
What the CLI can reach
The CLI runs with your computer's network, so a target you can already reach is one it can scan, such as a site on localhost or a development server on your own network. A page never earns more reach than the origin you asked for: a redirect, a stylesheet or a sitemap entry it names is checked against the site you named, so a public site cannot steer a scan into your network. Link-local addresses and cloud metadata endpoints, such as 169.254.169.254, are refused everywhere.
What the CLI sends
The commands on this page send nothing to SiteCMD. scan, check and watch request your site's pages and some of the files and links they name, including links to other websites, look up the site's DNS records through your computer's resolver, ask rdap.org when its domain registration expires, and send the names and versions of front-end libraries found in its script addresses to the OSV vulnerability database (api.osv.dev). audit and autofix apply send nothing over the network.