feat: detect inconsistent line-height values in CSS audit#42
Open
fracergu wants to merge 1 commit into
Open
Conversation
Extend the audit pipeline to collect, cluster, and score line-height values from legacy CSS. - Add LineHeightAudit interface (found, suggestedScale, unitlessMix) - Add STEP 4 to audit prompt: collects line-height declarations and font/.../<lh> shorthands, clusters near-duplicates against a canonical scale (tight/snug/normal/relaxed/loose), flags unitless-vs-px mixing - Track unitlessMix in chaos score (+1 when true) - Wire lineHeights through UserDecisions and defaultDecisions so the resolve step receives audited data as a starting point - Update playground UI (AuditView) to pass lineHeights on resolve - Add test coverage for all new prompt content and fixture shapes
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.
Summary
line-heightdeclaration andfont: …/<lh>shorthand, clusters near-duplicates against a canonical scale, and flags unitless-vs-px mixinglineHeightsinAuditReport(found,suggestedScale,unitlessMix)UserDecisions→buildResolvePromptso the resolve step uses audited line-heights as a starting pointunitlessMixis trueBefore vs After — AuditReport shape
Before
{ "brand": "", "chaosScore": 1, "summary": "...", "colorClusters": [...], "fonts": [...], "spacing": { "found": [...], "suggestedScale": {...}, "nonScaleValues": [...] } }After
{ "brand": "", "chaosScore": 1, "summary": "...", "colorClusters": [...], "fonts": [...], "spacing": { "found": [...], "suggestedScale": {...}, "nonScaleValues": [...] }, "lineHeights": { "found": [1.2, 1.25, 1.5, 1.75], "suggestedScale": { "tight": 1.2, "snug": 1.25, "normal": 1.5, "relaxed": 1.75 }, "unitlessMix": true } }Real-world validation
The full pipeline was validated end-to-end against a real LLM (DeepSeek V4 Flash) using
DEEPSEEK_API_KEY. Sample CSS with mixed unitless line-heights produced:How to test
line-heightdeclarations into the playground or runnpx mint-ds audit ./pathlineHeightstypography.lineHeightsappears inmint-ds.tokens.jsonChecklist
npx tsc --noEmitpasses with no errors