Skip to content

fix: purge safety, CLI and a11y fixes with new test guards - #7

Merged
KelpHect merged 46 commits into
mainfrom
KelpHect/audit-fixes
Nov 11, 2026
Merged

KelpHect merged 46 commits into
mainfrom
KelpHect/audit-fixes

Conversation

@KelpHect

@KelpHect KelpHect commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

What and why

Fixes from a full audit of the compiler, the integrations, the CSS source and the test setup. Four branches, reviewed one by one, then merged and tested together.

Purge and CLI (scripts/lib/compiler, scripts/cli.ts)

  • Safelist regexes with g or y no longer give order-dependent answers, and @pico { safelist } keeps a regex with spaces, commas or {n,m} as one token.
  • build --purge with content that reads no file now fails (exit 1, nothing written) instead of writing a near-empty stylesheet. A folder as content reads every file under it, and unreadable files are reported.
  • Purge keeps tbody and colgroup rules when the content has table, tr or col.
  • Custom themes reject NaN, infinite and out-of-range hue or chroma (an infinite chroma used to hang the build).
  • Gzip and brotli sizes are computed on first read, not on every compile.
  • --help works after build, purge and matrix; matrix no longer takes a flag as its output folder; paths inside a --config file resolve against that file.
  • The orphan token pass runs to a fixed point and keeps tokens the prebuilt extras read.

Integrations (scripts/lib/integrations, scripts/integrations)

  • pico-reforged purge stays inside the output folder (real paths, no node_modules, no invalid UTF-8), computes every file before writing any, and writes through a temp file and a rename.
  • The scanner reports files and folders it could not read instead of dropping them silently.
  • Build marker files no longer hide subfolders in purge mode, @source reads .svg, the PostCSS project-folder exclusion works with a relative base, the CSS statement scanner handles backslash escapes, and a keyframe used from another stylesheet or an inline style is kept.

CSS (src/)

  • Reset inputs in a group get the button focus ring.
  • Forced colors: focus and checked states for fields, checkboxes, radios, switches, dropdowns, groups and the stepper.
  • RTL: dropdown menu and chevron follow an ancestor dir, nav date inputs use a logical padding.
  • app-shell.css nests three levels at most (minified output is byte-identical), badge solid colors are tokens.

Tests and tooling

  • New guards: generated sources are current, every built-in theme compiles and only changes its tokens, gzip size budget (2% over test/size/baseline.json), popover and the 11 extras are in the visual gate.
  • New scripts: test:contrast, test:scope, test:size:update. prepublishOnly runs the checks.
  • CI gets a visual job (visual gate, extras with axe, contrast).
  • pnpm test builds the matrix once and no longer rewrites dist/.
  • Removed a stray review report, two unused scripts and the release age exclusions.

Docs: size numbers now come from the current build (the README claimed 3% smaller raw than v2.1.1; it is 1% larger raw and 7% larger gzipped), plus corrections to the testing and integration notes.

Behavior changes worth a release note: the purge failure on empty content, config-relative paths, exit code 2 for bad flags, six new --pico-badge-*-solid-* tokens.

AI use

Written by Claude Opus 5.5 subagents in Claude Code, planned and reviewed by Claude Fable 5.2 in Claude Code.

Checks

  • pnpm check, pnpm test and pnpm test:api pass
  • CSS changes: pnpm build and pnpm test:visual pass, and I looked at the report
  • Color changes: the contrast probe passes (see AGENTS.md)
  • User-facing changes: the matching page in docs/ is updated, and the website docs in rusticstack/pico-reforged-website have an issue or pull request
  • I edited src/ or scripts/data/, not the generated files or css/

See it in action
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@KelpHect
KelpHect merged commit 1c24378 into main Nov 11, 2026
3 checks passed
@KelpHect
KelpHect deleted the KelpHect/audit-fixes branch November 11, 2026 20:02
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.

1 participant