Repository navigation
Description
The CI leg of the always-on posture (private tracker squirrelscan/repo#3969). The private half is done: the comparison endpoint GET /v1/websites/{websiteId}/audits/compare takes fail_on=error|warning|info and returns a gate (status, newAtOrAbove, resolved, notCompared, reason) computed over every finding, plus comparison.newBySeverity. It is in the private PR (draft); a cloud API key (audits:read, audits:write) reaches it today.
This issue is the public half: let a CI job say "audit this deployed URL in the cloud as website X, wait, and fail if the audit has findings new since the previous completed audit of X at or above a severity".
Design (why)
No new server endpoint to start and wait. The CLI (and the action around it) uses the endpoints that exist: POST /v1/agent-runs (with websiteId), poll GET /v1/agent-runs/{id} to a terminal state, then GET /v1/websites/{websiteId}/audits/compare?head=<run>&fail_on=<sev>. The gate is evaluated server-side so every client (CLI, action, GitLab, plain curl) reads new-versus-previous the same way, with the comparison's own coverage honesty (not_crawled and not_checked are neither new nor resolved).
Ready material is in the private repo under plans/3969-ci-gate/ (ask the maintainer for a copy if you cannot read it): public-openapi-compare.patch (the OpenAPI path and the AuditComparison and CompareGate schemas, applied to docs/openapi.json; the private repo's guard needs docs/openapi.json byte-identical, so land this first) and ci-guide-section.mdx (the docs/guides/ci.mdx section, a curl and jq workflow that works without any CLI change).
Acceptance Criteria
-
docs/openapi.jsongainsGET /v1/websites/{websiteId}/audits/comparewithfail_on,head,base,includeandlimit, and theAuditComparisonandCompareGateschemas, from the patch;make validateindocs/passes. The monorepo'sapps/api/openapi.jsonis then synced to it (private PR, after this lands). -
docs/guides/ci.mdxhas an "audit after deploy and fail on new findings" section (the draft), no credentials in examples, and the page no longer says there is no baseline gating without pointing at this section. - A documented CLI command or action step (suggested:
squirrel audit --cloud <url> --website <id> --fail-on-new error, or asquirrel cicommand; implementer may choose and say why) starts the cloud audit with an org API key, waits, calls the compare endpoint withfail_on, and exits non-zero whengate.statusisfail. - The exit codes stay the existing distinct ones:
2for the new-findings gate failing,3blocked,5unreachable,1operational error. A blocked or unreachable site never exits2.gate.status: not_evaluatedis reported with itsreasonand is not a pass: the exit code is1. - Output lists each new finding (rule id, severity, page or item) and each resolved finding, the
gate.notComparedcounts, a link to the report, and the credits the run used (read fromGET /v1/creditsbefore and after, or the run's ledger entries). Resolved findings never fail the job. - The first audit of a website prints that there is no baseline and exits
0. - The run appears in the website's audit history in the dashboard (it is a cloud run, not a local CLI audit).
- Verified on
squirrelscan/nut-shop(nutshop.squirrelscan.com):bun run fault on broken-internal-link, deploy, run the step: the job fails and names the fault's finding;fault off, re-run: it passes and lists the finding as resolved. - Shell completions (
repo-public/apps/cli/src/self/completion.ts) and the CLI docs page are updated for any new command or flag; the PR says whether the squirrelscan agent skill needs a change.
Activity
docs(api): GET /v1/websites/{websiteId}/audits/compare and the CI gat…
feat(cli): squirrel ci audits a deployed URL in the cloud and fails o…
docs(api): the compare head names statusReasonCode when the audit is …
docs(changelog): the v0.0.181 bullets under a fresh [Unreleased] (#1775…
docs(api): GET /v1/websites/{websiteId}/audits/compare and the CI gat…
feat(cli): squirrel ci audits a deployed URL in the cloud and fails o…
docs(api): the compare head names statusReasonCode when the audit is …
docs(changelog): the v0.0.181 bullets under a fresh [Unreleased] (#1775…
docs(api): GET /v1/websites/{websiteId}/audits/compare and the CI gat…
feat(cli): squirrel ci audits a deployed URL in the cloud and fails o…
docs(api): the compare head names statusReasonCode when the audit is …
docs(changelog): the v0.0.181 bullets under a fresh [Unreleased] (#1775…
nc9 commentedon Nov 13, 2026
Shipped in squirrel v0.0.180 (https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.180): see the v0.0.180 section of CHANGELOG.md.