CLI Usage
Basic Commands
bash
# Audit single URLnpx ps-guard --url https://example.com
# Audit with presetnpx ps-guard --url https://example.com --preset nextjs
# Audit sitemapnpx ps-guard --sitemap https://example.com/sitemap.xml
# Generate HTML reportnpx ps-guard --url https://example.com --html --report ./reports/
# JSON output for CInpx ps-guard --url https://example.com --json --ci
# Desktop emulationnpx ps-guard --url https://example.com --device desktopCLI Options
| Flag | Default | Description |
|---|---|---|
| --url <url> | — | Single URL to audit |
| --sitemap <url> | — | Sitemap URL for multi-page audit |
| --max-urls <n> | 50 | Max URLs to audit from sitemap |
| --preset <name> | — | Use built-in preset (nextjs, landing-page, marketing-site) |
| --device <type> | mobile | Emulation device (mobile or desktop) |
| --html | false | Generate HTML report |
| --report <dir> | ./ps-guard-report | Report output directory |
| --json | false | JSON output mode |
| --ci | false | CI mode (no colors, machine-readable) |
| --retries <n> | 1 | Retry attempts per URL |
| --help | — | Show help message |
Exit Codes
| Code | Meaning | Description |
|---|---|---|
| 0 | Pass | All metrics within thresholds |
| 1 | Fail | One or more metrics exceeded thresholds |
| 2 | Error | Configuration or runtime error |
Sitemap Mode
When using --sitemap, PS Guard fetches the sitemap.xml, resolves nested sitemap indexes (up to 2 levels), deduplicates URLs, and audits each page sequentially reusing a single Chrome instance:
bash
npx ps-guard --sitemap https://your-site.com/sitemap.xml --max-urls 30 --html
# Output:# [1/30] https://your-site.com/ Score: 94 ✓# [2/30] https://your-site.com/about Score: 91 ✓# [3/30] https://your-site.com/products Score: 78 ✗# ...# Summary: 28/30 passed, 2 failedSitemap mode reuses a single Chrome instance for all URLs, which is significantly faster than launching Chrome per audit.