roast-my-design-system 5.10.2 → 5.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "roast-my-design-system",
|
|
3
|
-
"version": "5.10.
|
|
3
|
+
"version": "5.10.3",
|
|
4
4
|
"mcpName": "io.github.gregkozakiewicz/roast-my-design-system",
|
|
5
5
|
"description": "Your AI can write the UI. This makes sure it writes your UI. A deterministic scanner scores your design system 0-100 against 34 public repos, reads React and web components (Stencil, Lit), hands you a copy-paste fix prompt for each top finding, writes rules for Claude, Cursor, Copilot and Windsurf with --apply, and runs as a local MCP server with --mcp.",
|
|
6
6
|
"keywords": [
|
|
@@ -48,6 +48,14 @@ export const tripletToHsl = (v) => {
|
|
|
48
48
|
const m = HSL_TRIPLET_RE.exec(v);
|
|
49
49
|
return m ? `hsl(${m[1]} ${m[2]}% ${m[3]}%${m[4] ? ` / ${m[4]}` : ''})` : null;
|
|
50
50
|
};
|
|
51
|
+
// Loose hex in CODE (not in a style block, a class string or a stylesheet) is
|
|
52
|
+
// ambiguous: #RGBA shorthand is legal CSS but vanishingly rare in code, while
|
|
53
|
+
// #1042 as an order id, ticket or issue number is everyday. Read as a colour
|
|
54
|
+
// it expands to #11004422 and the review accuses an order id of being a
|
|
55
|
+
// hardcoded colour (found on the demo repo, 2026-09-07). In a colour context
|
|
56
|
+
// all four lengths still count; only the loose pass skips 4-digit.
|
|
57
|
+
const isIdentifierHex = (raw) => /^#[0-9a-f]{4}$/i.test(raw);
|
|
58
|
+
|
|
51
59
|
// hsl(var(--primary)) is a reference to a colour, never a colour, and
|
|
52
60
|
// oklch(0.35 0.08 ${hue}) is a template with a hole in it: neither may sit in
|
|
53
61
|
// the palette as its own value.
|
|
@@ -199,6 +207,7 @@ export function extractStyling(src, { css = false } = {}) {
|
|
|
199
207
|
// colour consts) — everything not already collected above
|
|
200
208
|
const seen = new Set(out.colors.map((c) => c.index));
|
|
201
209
|
for (const m of src.matchAll(HEX_RE)) {
|
|
210
|
+
if (isIdentifierHex(m[0])) continue;
|
|
202
211
|
if (![...seen].some((i) => Math.abs(i - m.index) < 4)) out.colors.push({ value: normalizeHex(m[0]), index: m.index });
|
|
203
212
|
}
|
|
204
213
|
for (const m of src.matchAll(/!\s*important/gi)) out.important.push({ index: m.index });
|
|
@@ -400,7 +409,10 @@ export function harvestTokens(root, styleFiles, codeFiles) {
|
|
|
400
409
|
// — cheap approximation: any hex in a .ts/.js file counts as a colour in code.
|
|
401
410
|
if (/\.(ts|js)$/.test(f)) {
|
|
402
411
|
for (const m of src.matchAll(HEX_RE)) {
|
|
403
|
-
//
|
|
412
|
+
// 4-digit shorthand in code is an identifier far more often than a
|
|
413
|
+
// colour (#1042 = an order id, not #11004422): same rule as the MCP
|
|
414
|
+
// validator, so both measure with one ruler.
|
|
415
|
+
if (isIdentifierHex(m[0])) continue;
|
|
404
416
|
colors.add(normalizeHex(m[0]), f);
|
|
405
417
|
}
|
|
406
418
|
}
|