# Sonjoo CLI command reference

> Find Sonjoo audit, crawl, report, and configuration commands with their main arguments, defaults, and examples.

Canonical documentation: <https://sajaddehshiri.ir/sonjoo-seo-audit/cli/commands/>

Run `sonjoo --help` to list commands and `sonjoo <command> --help` to check the flags supported by your installed version. [Install Sonjoo](https://sajaddehshiri.ir/sonjoo-seo-audit/start/install/) to get the CLI.

## Audit

`sonjoo audit [options] <url>` fetches the starting page and evaluates audit rules. Use an absolute `http://` or `https://` URL without embedded credentials.

```sh
sonjoo audit https://example.com/ --categories core --no-save --format json
```

| Option                                       | Behavior                                                                                                                                                                                                       |
| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--crawl`, `--max-pages N`                   | Follow internal links. The flag accepts 1–1,000 pages. With the flag omitted, `crawler.max_pages` can set up to 10,000 pages and defaults to 10.                                                               |
| `--concurrency N`, `--timeout MS`            | Set crawler concurrency (default 3, range 1–20) and request timeout (default 30,000 ms, flag range 1,000–120,000 ms). Without `--timeout`, the TOML setting `crawler.timeout_ms` can be as high as 300,000 ms. |
| `--max-duration SECONDS`                     | Set a crawl collection budget of 1–86,400 seconds. The default CLI configuration has no duration limit.                                                                                                        |
| `--categories ID,ID`                         | Select categories by comma-separated ID. If omitted, select all categories, subject to the effective rule configuration.                                                                                       |
| `--render`, `--cwv`                          | Use Chromium for rendering and lab measurements.                                                                                                                                                               |
| `--mobile`, `--simulate-interaction`         | Enable rendering. The mobile profile and interaction simulation apply to single-page audits.                                                                                                                   |
| `--question TEXT`                            | Look for an answer passage on the entry page with local text matching. The CLI trims leading and trailing whitespace and requires 1–500 characters.                                                            |
| `--format FORMAT`, `--json`, `--output FILE` | Select and write an [export](https://sajaddehshiri.ir/sonjoo-seo-audit/cli/exports/).                                                                                                                          |
| `--no-save`, `--save`                        | Override the effective `[output].save` setting. The default saves completed audits, including reports that fail a gate. `--no-save` takes precedence if you pass both flags.                                   |
| `--config FILE`                              | Load a specific [TOML configuration](https://sajaddehshiri.ir/sonjoo-seo-audit/cli/configuration/).                                                                                                            |
| `--fail-under N`, `--min-coverage N`         | Set [CI thresholds](https://sajaddehshiri.ir/sonjoo-seo-audit/guides/ci-gates/) between 0 and 100. The coverage flag requires `--crawl`.                                                                       |
| `--verbose`                                  | Show additional progress and diagnostics.                                                                                                                                                                      |

`--refresh` bypasses the outgoing link cache where supported. Use `--staging` on an authorized staging site to skip robots restrictions and crawl delays in link discovery and waive the entry-page robots and noindex score caps. Sonjoo still checks and reports the observed directives. `--ignore-crawl-delay` skips the delay directive while retaining the configured access and pacing settings.

## Crawl and analyze

* `sonjoo crawl <url> [--max-pages N] [--output DIRECTORY]` fetches and stores snapshots for up to 10,000 pages. `--output` selects a directory, and the command prints a crawl ID.
* `sonjoo crawl --resume <crawl-id> [--max-pages N] [--output DIRECTORY]` continues fetching with the saved settings. The optional page limit can stay the same or increase.
* `sonjoo analyze <crawl-id>` or `sonjoo analyze --latest` evaluates saved snapshots from the working directory. Use `--json` for machine output, `--save` or `--no-save` to override history, `--categories` and `--config` to select checks, or `--fail-under` and `--staging` to configure the score gate and staging caps. See [snapshot limitations](https://sajaddehshiri.ir/sonjoo-seo-audit/guides/audit-and-crawl/#rerun-rules-on-the-latest-snapshot).

Follow [Resume a crawl](https://sajaddehshiri.ir/sonjoo-seo-audit/guides/audit-and-crawl/#resume-a-crawl) for a complete example with a custom output directory.

## Init and config

* `sonjoo init --yes` creates `sonjoo.toml` with defaults. Use `--name` for a project name or `--preset` to choose `default`, `blog`, `ecommerce`, or `ci`.
* `sonjoo config show --json` prints the effective configuration.
* `sonjoo config validate --config ./sonjoo.toml` checks a configuration file.
* `sonjoo config --list` lists effective settings. `sonjoo config path` shows candidate files. Use `sonjoo config <key>` to read one dotted setting, or add a value and use `--local` (the default) or `--global` to set an override.

See [Configure Sonjoo](https://sajaddehshiri.ir/sonjoo-seo-audit/cli/configuration/) for precedence and a validated configuration example.

## Report and compare

* `sonjoo report --list --format json` returns up to 100 saved audit summaries, newest first. Use `--project` or `--since` (a date such as `2026-01-01` or an RFC 3339 timestamp) to filter the list.
* `sonjoo report <audit-id> --format json` returns a saved report envelope with the audit under `result`. The default `table` format displays a table for the list and a console report for a single audit.
* `sonjoo compare <domain> --json` compares the latest completed saved audit with its predecessor. Use `--against <audit-id>` to name the baseline or `--trend` to view up to 20 saved scores.
* `sonjoo compare <domain> --fail-on-regression` exits 1 on a comparable score drop or rule regression. Inspect result comparability before attributing a change to the site.

See [report formats and JSON shapes](https://sajaddehshiri.ir/sonjoo-seo-audit/cli/exports/) and [how to read a comparison](https://sajaddehshiri.ir/sonjoo-seo-audit/guides/reports-and-coverage/#compare-saved-reports).

## Explain rules

```sh
sonjoo explain core-title-present
sonjoo explain core-title-present --json
sonjoo explain --list core
```

The rule detail includes its stable ID, category, weight, description and fix guidance. Use `--list` by itself to list the catalog, or add a category ID to narrow it.

## Serve, MCP, and diagnostics

| Command                                                          | Purpose                                                                                                                                                                                  |
| ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sonjoo serve --no-open --port 7360`                             | Start the local dashboard and API on loopback. The default port is 7360. Use `--port 0` to select a free port.                                                                           |
| `sonjoo serve --audit URL`                                       | Start the server with a website audit. Combine with `--crawl`, `--max-pages`, `--categories`, `--cwv`, `--mobile`, or `--simulate-interaction` as needed. These flags require `--audit`. |
| `sonjoo desktop`, `sonjoo desktop status`, `sonjoo desktop stop` | Open the dashboard in the default browser, show the desktop server's URL, or stop the server started by the desktop launcher.                                                            |
| `sonjoo mcp`                                                     | Run the [MCP server](https://sajaddehshiri.ir/sonjoo-seo-audit/ai/mcp/) as a subprocess started by a local agent client over standard input and output.                                  |
| `sonjoo self doctor`                                             | Check the engine, local history database, and Chromium availability.                                                                                                                     |
| `sonjoo db stats --verbose`                                      | Inspect local data location, database size, and available history counts.                                                                                                                |
| `sonjoo donate`                                                  | View optional project support instructions.                                                                                                                                              |
