CLI Usage

Basic Commands

bash
# Audit single URL
npx ps-guard --url https://example.com
# Audit with preset
npx ps-guard --url https://example.com --preset nextjs
# Audit sitemap
npx ps-guard --sitemap https://example.com/sitemap.xml
# Generate HTML report
npx ps-guard --url https://example.com --html --report ./reports/
# JSON output for CI
npx ps-guard --url https://example.com --json --ci
# Desktop emulation
npx ps-guard --url https://example.com --device desktop

CLI Options

FlagDefaultDescription
--url <url>Single URL to audit
--sitemap <url>Sitemap URL for multi-page audit
--max-urls <n>50Max URLs to audit from sitemap
--preset <name>Use built-in preset (nextjs, landing-page, marketing-site)
--device <type>mobileEmulation device (mobile or desktop)
--htmlfalseGenerate HTML report
--report <dir>./ps-guard-reportReport output directory
--jsonfalseJSON output mode
--cifalseCI mode (no colors, machine-readable)
--retries <n>1Retry attempts per URL
--helpShow help message

Exit Codes

CodeMeaningDescription
0PassAll metrics within thresholds
1FailOne or more metrics exceeded thresholds
2ErrorConfiguration 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 failed
Sitemap mode reuses a single Chrome instance for all URLs, which is significantly faster than launching Chrome per audit.