Skip to content

feat(cli): squirrel pages -f html and --diff between two audits #701 - #1403

Closed
nc9 wants to merge 8 commits into
mainfrom
feat/pages-html-diff-701
Closed

nc9 wants to merge 8 commits into
mainfrom
feat/pages-html-diff-701

Conversation

@nc9

@nc9 nc9 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Part 2 of #701. Refs #701. Depends on #1400 (this branch is cut from it, so the diff shows its commits until #1400 merges; merge #1400 first, then this one rebases to just its own commit).

  • squirrel pages -f html: one standalone page, no network request, no CDN. The table sorts by any column and filters by text and by flag. The rows reach the page as JSON escaped for a <script> block (<, >, & and the JS line separators as \uXXXX) and reach the DOM only through textContent, never innerHTML; the site name is HTML-escaped. At most 5,000 rows are inlined and the page says when more matched, so the file stays bounded.
  • squirrel pages --diff: pages added, removed and changed between two audits of the same site, matched by URL. Changed fields are status, finalUrl, canonical, noindex, title, description, h1Count, schemaTypes and flags, each with before and after; counts that move with every crawl (links, word count, load time) are not compared, and a list compares as a set. Formats: markdown (default), json, csv. With no --crawl or one, the older side is the same site's previous audit (the store holds every project, so "the two newest" would often be two sites); two --crawl ids name both, in either order. Same shape as squirrel entities --diff.
  • --diff rejects --missing, --duplicate, --too-long and --orphan (a fixed page would stop matching on the newer side and read as removed) and any format but markdown, json, csv, as entities --diff does for --problem. --section and --page narrow both sides.
  • Completions (bash, zsh, fish) and docs/cli/pages.mdx updated.

Tests: packages/report/tests/page-map-diff-701.test.ts (14: added, removed, changed, unchanged, noisy fields excluded, set comparison, all three renderers including table-breaking and formula values, HTML escaping of titles and site name, the data script cannot be ended from a page, the row cap, no innerHTML), and 6 more e2e tests in apps/cli/tests/cli/pages-command-e2e.test.ts that audit a local site twice with a change between (a title added, a description added, a page taken down, a page added) and read the diff in all three formats, with one or two --crawl, in either order, plus the usage errors. Gates: tsgo in apps/cli and packages/report, cli format:check and lint, make validate, released-changelog guard.

Still open on #701: the hosted list_pages (private repo), the H1 text, heading count and @id columns (not stored per page), a replayed column, squirrel links. Skill: should list squirrel pages (see #1400).

nik

Security round: rebased on #1400 (which adds the sanitizing helpers). The diff (markdown, csv) and the HTML table clean every page-derived value the same way (control characters, C1, bidi overrides, line breaks removed; csv formulas prefixed; markdown escaped; html data cleaned and the site name escaped). Unit tests with hostile values for the diff renderers and the HTML data, and e2e checks that html and the diff output contain no control or bidi character from the hostile page.

Review round 2: rebased on #1400's round 2. Diff markdown URL cells are pipe-safe (urlCell), the diff JSON escapes C1, bidi and invisible characters, h1 and schemaIds are compared, a scope note (markdown) and scopeNote (JSON) appear when the audits crawled more than 20% different numbers of pages, a reclaimed previous audit gets its own message instead of "only one has been run", and a third --crawl is a usage error. Tests for each.

@nc9
nc9 force-pushed the feat/pages-html-diff-701 branch 2 times, most recently from 2678296 to d157da7 Compare October 31, 2026 02:14
Comment thread packages/report/src/page-map.ts Fixed
nc9 added 4 commits October 31, 2026 14:04
…e (json, csv, markdown, filters, flags) #701

Signed-off-by: Nik Cubrilovic <[email protected]>
…d bidi overrides, csv formula guard #701

Signed-off-by: Nik Cubrilovic <[email protected]>
…URL cells, json escapes C1 and bidi, h1/headings/@id columns, invisible chars, filters #701

Signed-off-by: Nik Cubrilovic <[email protected]>
…ters; code point sweep and escape fixpoint tests; json escape moves here #701

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the feat/pages-html-diff-701 branch from d157da7 to 1b9e465 Compare October 31, 2026 03:09
nc9 added 4 commits October 31, 2026 14:52
… via split/join, e2e covers query variants and a self link, CodeQL i flag #701

Signed-off-by: Nik Cubrilovic <[email protected]>
… overrides, csv formula guard #701

Signed-off-by: Nik Cubrilovic <[email protected]>
…, retired-previous message, h1 and schema ids compared #701

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the feat/pages-html-diff-701 branch from 1b9e465 to 187568c Compare October 31, 2026 03:54
@nc9 nc9 mentioned this pull request Oct 31, 2026
@nc9

nc9 commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

Landed in v0.0.149 as 4b56670b 7f3bb479 b77fbca1 (on top of the #1400 commits above) via #1432. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.149. Closing this original.

nik

@nc9 nc9 closed this Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants