jq recipes

smartspec audit -f json is designed to be piped. Below are the recipes that cover ~90% of post-processing needs.

All snippets assume:

smartspec audit https://example.com -f json -o audit.json

Just the critical findings

jq '.findings[] | select(.severity == "critical")' audit.json

Rule IDs only, deduplicated

jq -r '.findings[].rule' audit.json | sort -u

Findings per page

jq 'group_by(.url) | map({url: .[0].url, n: length})' \
   <(jq '.findings' audit.json)

Critical findings as a Markdown checklist

jq -r '.findings[] | select(.severity=="critical") |
  "- [ ] **\(.rule)** on `\(.url)` — \(.title)"' audit.json

Output:

- [ ] **mobile-viewport-missing** on `https://example.com/` — No viewport meta tag
- [ ] **page-noindex** on `https://example.com/pricing` — Page is set to noindex

Paste straight into a PR description or an issue.

CI gate — exit 1 on any critical

jq -e '[.findings[] | select(.severity=="critical")] | length == 0' audit.json

Score only

jq '.score' audit.json

Diff two audit runs

diff <(jq -r '.findings[].rule' audit-before.json | sort -u) \
     <(jq -r '.findings[].rule' audit-after.json  | sort -u)