Skip to content

Rename the style guard to check:colour-literals - #23

Merged
betterthanclay merged 1 commit into
mainfrom
ns-a482d119-cd6c-4e6d-ad29-2c8357f39115
Sep 26, 2026
Merged

betterthanclay merged 1 commit into
mainfrom
ns-a482d119-cd6c-4e6d-ad29-2c8357f39115

Conversation

@betterthanclay

Copy link
Copy Markdown
Contributor

Summary

  • Rename check:style-literals to check:colour-literals (script, test, task, messages) so the name matches its colour-only coverage.
  • Detection is unchanged: colour literals in ts/src/**/*.svelte style blocks still fail, with the same transparent / currentColor / inherit exceptions.
  • Styling contract and front door now use the new name; plan item 2 is removed because that outcome is now true.

Test plan

  • git grep -n "style-literals\|style literal" finds only CHANGELOG.md history
  • Colour-literal tests pass, including a planted #ff0000 and the token-count assertion against the styling contract
  • check:colour-literals passes at HEAD
  • effigy qa passes at the pushed head

Made with Cursor

The old name implied radii, spacing and fonts were covered. Detection is unchanged: colour literals in component style blocks still fail, with the same exceptions.

Co-authored-by: Cursor <cursoragent@cursor.com>
@betterthanclay

Copy link
Copy Markdown
Contributor Author

Review — Rename the style guard to check:colour-literals

Verdict: ready_to_merge. Head a173afc (matches PR #23, branch ns-a482d119-cd6c-4e6d-ad29-2c8357f39115). Diff base 8c4574b.

What the diff does

Rename-only, 10 files, 16 insertions / 14 deletions. Two real edits, the rest path/name updates:

  • ts/scripts/check-style-literals.ts -> ts/scripts/check-colour-literals.ts, with only the pass message changed (style literal proof passed -> colour literal proof passed). Detection regexes, named-colour table, NON_COLOUR_KEYWORDS (transparent, currentcolor, inherit), DECLARATION, styleBlocks, colourLiterals, checkRepository are byte-identical.
  • ts/tests/nightfire/style-literals.test.ts -> colour-literals.test.ts, with only the import path and the describe label (nightfire/colour literals) changed. Every assertion is unchanged, including the planted #ff0000/rgb(15 23 42)/rebeccapurple bite, the keyword acceptance case, and the (\d+) --nightfire-* values token-count cross-check against styling.md.
  • effigy.toml: task key check:style-literals -> check:colour-literals, command path updated, and the health list entry updated. Still in health, so still under validate/qa.
  • Docs: styling.md Proof, working-rules.md, review-oracle.md, docs/README.md, questions.md Q-002 and plan.md all now say colour. plan.md item 2 is removed because its outcome is now true (remaining item renumbered). No CHANGELOG history lines were rewritten.

Acceptance checks (run at head)

  • git grep -n "style-literals\|style literal" returns only CHANGELOG.md:16 (new [Unreleased] Changed entry naming the old name) and CHANGELOG.md:26 (pre-existing [Unreleased] Fixed entry). CHANGELOG is the explicitly exempted file, so acceptance holds. A wider git grep -in "style.literal" returns the same two lines: no stale singular references anywhere else.
  • Guard passes at head: bun ts/scripts/check-colour-literals.ts -> "colour literal proof passed: no colour literal in any ts/src/**/*.svelte style block", exit 0.
  • Guard still bites on a planted literal: calling colourLiterals on a style block with color: #ff0000 returns [{path:"planted.svelte", line:3, property:"color", value:"#ff0000", literal:"#ff0000"}].
  • ts/tests/nightfire/colour-literals.test.ts passes under the new name: 8 pass / 0 fail, 60 assertions, including the token-count assertion (stylesheet still declares 25 --nightfire-* values, styling.md still states 25).
  • effigy qa exits 0 at the pushed head, including the Git-consumer proofs, which report success at a173afc. No version bump, no release/tag, no consumer change.
  • .github/workflows/ci.yml and release.yml contain no reference to the task, so the rename breaks no CI surface; no consumer references the internal task name. Neither stop-and-report condition in the brief is met.
  • Working tree left clean at a173afc after all validation; no tracked file modified, no branch switch.

Constraints

  • No radii/spacing/font coverage added; no --nightfire-* token added; exception list untouched; guard still in health. All held.
  • The script's existing doc comment already said "This check guards colours only" and named the radii/spacing/font blind spot, so the code was honest before the rename; the rename aligns the task, files, label and messages with it.

Non-blocking observations (no change required)

  1. docs/knowledge/questions.md Q-002's heading was reworded from "Should the style-literal guard cover radii, spacing and fonts, or only say it covers colours?" to "Should the colour-literal guard cover radii, spacing and fonts, or only colours?". This was not needed for the grep acceptance (the singular hyphenated form never matched) and it mildly rewrites the historical question. It is consistent with the settled answer line ("colours only, named honestly") and keeps Q-002 findable under the new name, so I would not block on it; a stricter reading would keep the original question text and rely on the answer to state the new name.
  2. CHANGELOG's [Unreleased] block now carries both the new Changed line ("check:style-literals is now check:colour-literals") and the pre-existing Fixed line ("effigy health now runs check:style-literals"). Both land in the same release, so release notes chain the old name. The brief said to leave existing CHANGELOG lines as written and exempts CHANGELOG from the grep, so this is in scope; a future cleanup could drop the stale name from the unreleased Fixed line.

No defects found. Recommend merge.

@betterthanclay
betterthanclay merged commit 4553deb into main Sep 26, 2026
1 check passed
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