roast-my-design-system 5.5.2 → 5.5.4
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.5.
|
|
3
|
+
"version": "5.5.4",
|
|
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, writes rules for Claude, Cursor, Copilot and Windsurf with --apply, and runs as a local MCP server with --mcp.",
|
|
6
6
|
"keywords": [
|
|
@@ -43,8 +43,5 @@
|
|
|
43
43
|
],
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": ">=18"
|
|
46
|
-
},
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"checkmcp": "^0.1.2"
|
|
49
46
|
}
|
|
50
47
|
}
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* Kept deliberately narrow: learn what the repo's system is, scan a piece of
|
|
10
10
|
* text for styling, and say which on-system value a stray most resembles.
|
|
11
11
|
*/
|
|
12
|
-
import { extname } from 'node:path';
|
|
12
|
+
import { extname, join } from 'node:path';
|
|
13
|
+
import { readFileSync } from 'node:fs';
|
|
13
14
|
import { walkRepo } from '../harvest/walk.mjs';
|
|
14
15
|
import { harvestTokens, extractStyling, normalizeHex, isGrey } from '../harvest/tokens.mjs';
|
|
15
16
|
import { loadExclusions } from './exclusions.mjs';
|
|
@@ -33,7 +34,11 @@ export const isStyleFile = (p) => STYLE_EXTS.has(extname(p));
|
|
|
33
34
|
* tokenFile, // the file defining the most --vars, or null
|
|
34
35
|
* colors, // [{ value, count, isToken, files }] every colour seen
|
|
35
36
|
* tokens, // shorthand: just the token colour values
|
|
37
|
+
* tokenNames, // { normalizedValue: '--var-name' } for every --var definition
|
|
36
38
|
* spacing, // [{ value, count, files }] every length seen
|
|
39
|
+
* radii, // [{ value, count, files }] every border-radius declared
|
|
40
|
+
* fontSizes, // [{ value, count, files }] every font-size declared
|
|
41
|
+
* shadows, // [{ value, count, files }] every box-shadow declared
|
|
37
42
|
* fontFamilies, // [{ value, count, files }] every family declared
|
|
38
43
|
* tailwind, // { colors, spacing, radii, textSizes, arbitrary }
|
|
39
44
|
* files, // { styles: n, code: n } — how much was read
|
|
@@ -43,11 +48,30 @@ export function learnSystem(repoRoot, { exclude = [] } = {}) {
|
|
|
43
48
|
const exclusions = loadExclusions(repoRoot, exclude);
|
|
44
49
|
const files = walkRepo(repoRoot, 14, exclusions);
|
|
45
50
|
const t = harvestTokens(repoRoot, files.styles, files.code);
|
|
51
|
+
|
|
52
|
+
// Every --var definition, as normalizedValue → name, so a guard can say
|
|
53
|
+
// "use var(--blue-500)" instead of leaving the reader to hunt the hex.
|
|
54
|
+
// First definition wins; later duplicates are aliases, not the canon.
|
|
55
|
+
const tokenNames = {};
|
|
56
|
+
const HEX = /#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})\b/;
|
|
57
|
+
for (const f of files.styles) {
|
|
58
|
+
let text; try { text = readFileSync(join(repoRoot, f), 'utf8'); } catch { continue; }
|
|
59
|
+
for (const m of text.matchAll(/(--[\w-]+)\s*:\s*([^;{}]+)[;}]/g)) {
|
|
60
|
+
const hex = HEX.exec(m[2]);
|
|
61
|
+
const value = hex ? normalizeHex(hex[0]) : m[2].trim().replace(/\s+/g, ' ').toLowerCase();
|
|
62
|
+
if (!(value in tokenNames)) tokenNames[value] = m[1];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
46
66
|
return {
|
|
47
67
|
tokenFile: t.tokenFile,
|
|
48
68
|
colors: t.colors,
|
|
49
69
|
tokens: t.colors.filter((c) => c.isToken).map((c) => c.value),
|
|
70
|
+
tokenNames,
|
|
50
71
|
spacing: t.spacing,
|
|
72
|
+
radii: t.radii,
|
|
73
|
+
fontSizes: t.fontSizes,
|
|
74
|
+
shadows: t.shadows,
|
|
51
75
|
fontFamilies: t.fontFamilies,
|
|
52
76
|
tailwind: t.tailwind,
|
|
53
77
|
files: { styles: files.styles.length, code: files.code.length },
|