Park the design-comparison tooling for a decision - #58
Draft
pbking wants to merge 1 commit into
Draft
Conversation
Two scripts for "does what I built match the design I was copying?", written after a whole-site rebuild where that was checked by eye and four separate transcription errors survived to the end — a button line-height of `inherit` where the original said `1.1`, core's default button padding against `0.9rem/1.6rem`, a 24px block gap against 20px, and the layout widths. `compare-design-system.mjs` needs no browser and nothing installed. It pulls the `global-styles-inline-css` block out of two pages and diffs it rule by rule, which is the design system exactly as the browser sees it: a difference there is a difference in what was installed rather than in how a pattern used it. All four of those errors are in its first screen of output. Values are compared as CSS means them — `#17120E` and `#17120e` are not a finding — and a property one side simply lacks is counted rather than listed, because that is usually a deliberate difference between two themes and it otherwise buries the differences that are mistakes. `compare-render.mjs` is the second pass, once the design system agrees: it loads both pages and compares the computed style of every element carrying text, matched on the text itself, which works because when you are reproducing a design the copy is identical by construction. **Parked deliberately, and referenced by nothing.** The `pattern-author` skill reaches agents through the abilities, which are JSON in and JSON out; shipping scripts through that surface is a separate decision from writing guidance, so nothing in `guides/` points at these and `.distignore` keeps `tools/` out of the wp.org build. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Fr6uocsyi8N5b5YejYjcs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Parked for you to look at later, as discussed — nothing in
guides/references these and.distignorekeepstools/out of the wp.org build. Thepattern-authorskill reaches agents through the abilities, which are JSON in and JSON out; whether scripts should travel that way is a separate decision from writing guidance, and this branch exists so the tooling isn't lost while that's open.What they are
Two scripts for "does what I built match the design I was copying?", written after a four-page rebuild where that got checked by eye at the very end and four transcription errors survived to it:
elements.buttonline-heightinheritwhere the source said1.1, core's default button padding against0.9rem/1.6rem, a 24px block gap against 20px, and the layout widths.compare-design-system.mjs— no browser, nothing to install. Pulls theglobal-styles-inline-cssblock out of two pages and diffs it rule by rule. That stylesheet is the design system exactly as the browser sees it, so a difference there is a difference in what was installed rather than in how a pattern used it. All four errors above are in its first screen of output.Two things make the output usable rather than a wall:
#17120Eand#17120eis not a finding.Run against the site that prompted this, it reduces two 100KB stylesheets to one finding:
Which is correct — those widths are genuinely still wrong on that site, because
set-layoutdidn't exist when it was built.compare-render.mjs— the second pass, once the design system agrees. Loads both pages in Playwright and compares the computed style of every element carrying text, matched on the text itself. That works because when you're reproducing a design the copy is identical by construction, so nothing has to guess which element corresponds to which. Reports per-property differences, then where the two documents drift apart vertically.If you'd rather they lived somewhere else
The obvious alternatives, in rough order of how much they'd change:
get-design-system-diffability that takes a URL and diffs that page's stylesheet against this site's. Server-side PHP, no script shipped; the cost is an outbound fetch to a caller-supplied URL, which is a security question worth its own conversation.I'd lean 2 for the design-system half — it's genuinely useful over the wire and needs no browser — and 1 or 3 for the render half, which can't escape needing Chromium.
🤖 Generated with Claude Code
https://claude.ai/code/session_017Fr6uocsyi8N5b5YejYjcs
Generated by Claude Code