@layoutdesign/context 0.4.0 → 0.6.0
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/dist/bin/cli.js +37 -0
- package/dist/bin/cli.js.map +1 -1
- package/dist/src/cli/diff.d.ts +4 -0
- package/dist/src/cli/diff.d.ts.map +1 -0
- package/dist/src/cli/diff.js +53 -0
- package/dist/src/cli/diff.js.map +1 -0
- package/dist/src/cli/import-tokens-json.d.ts +5 -0
- package/dist/src/cli/import-tokens-json.d.ts.map +1 -0
- package/dist/src/cli/import-tokens-json.js +174 -0
- package/dist/src/cli/import-tokens-json.js.map +1 -0
- package/dist/src/cli/lint.d.ts +7 -0
- package/dist/src/cli/lint.d.ts.map +1 -0
- package/dist/src/cli/lint.js +80 -0
- package/dist/src/cli/lint.js.map +1 -0
- package/dist/src/cli/scan.d.ts +8 -0
- package/dist/src/cli/scan.d.ts.map +1 -0
- package/dist/src/cli/scan.js +143 -0
- package/dist/src/cli/scan.js.map +1 -0
- package/dist/src/integrations/codebase-scan.d.ts +46 -0
- package/dist/src/integrations/codebase-scan.d.ts.map +1 -0
- package/dist/src/integrations/codebase-scan.js +231 -0
- package/dist/src/integrations/codebase-scan.js.map +1 -0
- package/dist/src/integrations/storybook.d.ts +36 -0
- package/dist/src/integrations/storybook.d.ts.map +1 -0
- package/dist/src/integrations/storybook.js +124 -0
- package/dist/src/integrations/storybook.js.map +1 -0
- package/dist/src/kit/stage.d.ts +19 -0
- package/dist/src/kit/stage.d.ts.map +1 -0
- package/dist/src/kit/stage.js +30 -0
- package/dist/src/kit/stage.js.map +1 -0
- package/dist/src/lint/diff.d.ts +23 -0
- package/dist/src/lint/diff.d.ts.map +1 -0
- package/dist/src/lint/diff.js +62 -0
- package/dist/src/lint/diff.js.map +1 -0
- package/dist/src/lint/layout-md.d.ts +21 -0
- package/dist/src/lint/layout-md.d.ts.map +1 -0
- package/dist/src/lint/layout-md.js +376 -0
- package/dist/src/lint/layout-md.js.map +1 -0
- package/dist/src/mcp/server.d.ts.map +1 -1
- package/dist/src/mcp/server.js +17 -2
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/mcp/tools/list-components.d.ts +2 -1
- package/dist/src/mcp/tools/list-components.d.ts.map +1 -1
- package/dist/src/mcp/tools/list-components.js +50 -24
- package/dist/src/mcp/tools/list-components.js.map +1 -1
- package/dist/src/mcp/tools/scan-project.d.ts +30 -0
- package/dist/src/mcp/tools/scan-project.d.ts.map +1 -0
- package/dist/src/mcp/tools/scan-project.js +97 -0
- package/dist/src/mcp/tools/scan-project.js.map +1 -0
- package/package.json +2 -1
- package/skills/layout-md/SKILL.md +135 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
// Linter for the layout.md format. Runs over a loaded Kit (layout.md + the
|
|
2
|
+
// companion tokens.css / tokens.json) and reports issues. Callers get either
|
|
3
|
+
// a structured array (for JSON output + CI integration) or a human-readable
|
|
4
|
+
// pretty-printed summary.
|
|
5
|
+
//
|
|
6
|
+
// The seven rules mirror the checks Google's design.md CLI ships with, plus
|
|
7
|
+
// the specifics our three-tier token system wants to enforce.
|
|
8
|
+
const CANONICAL_SECTIONS = [
|
|
9
|
+
"Quick Reference",
|
|
10
|
+
"Design Direction",
|
|
11
|
+
"Colour System",
|
|
12
|
+
"Typography System",
|
|
13
|
+
"Spacing",
|
|
14
|
+
"Components",
|
|
15
|
+
"Elevation",
|
|
16
|
+
"Motion",
|
|
17
|
+
"Anti-Patterns",
|
|
18
|
+
];
|
|
19
|
+
// Parses `--name: value;` declarations out of a CSS string using matchAll
|
|
20
|
+
// rather than stateful regex iteration.
|
|
21
|
+
function parseCssDeclarations(css) {
|
|
22
|
+
const pattern = /^\s*(--[a-zA-Z0-9_-]+)\s*:\s*([^;\n]+);/gm;
|
|
23
|
+
const out = [];
|
|
24
|
+
for (const match of css.matchAll(pattern)) {
|
|
25
|
+
const name = match[1];
|
|
26
|
+
const value = match[2];
|
|
27
|
+
if (name && value)
|
|
28
|
+
out.push({ name, value: value.trim(), index: match.index ?? 0 });
|
|
29
|
+
}
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
// ── Rule 1 ─────────────────────────────────────────────────────────────────
|
|
33
|
+
// broken-token-ref: every var(--name) in layout.md must resolve to a token
|
|
34
|
+
// defined in tokens.css.
|
|
35
|
+
function ruleBrokenTokenRef(kit) {
|
|
36
|
+
const issues = [];
|
|
37
|
+
const defined = new Set();
|
|
38
|
+
if (kit.tokensCss) {
|
|
39
|
+
for (const decl of parseCssDeclarations(kit.tokensCss))
|
|
40
|
+
defined.add(decl.name);
|
|
41
|
+
}
|
|
42
|
+
const pattern = /var\((--[a-zA-Z0-9_-]+)\)/g;
|
|
43
|
+
const seen = new Set();
|
|
44
|
+
for (const match of kit.layoutMd.matchAll(pattern)) {
|
|
45
|
+
const name = match[1];
|
|
46
|
+
if (!name)
|
|
47
|
+
continue;
|
|
48
|
+
if (defined.size > 0 && !defined.has(name) && !seen.has(name)) {
|
|
49
|
+
seen.add(name);
|
|
50
|
+
issues.push({
|
|
51
|
+
ruleId: "broken-token-ref",
|
|
52
|
+
severity: "warning",
|
|
53
|
+
message: `layout.md references var(${name}) but no definition exists in tokens.css.`,
|
|
54
|
+
file: "layout.md",
|
|
55
|
+
line: lineNumberOf(kit.layoutMd, match.index ?? 0),
|
|
56
|
+
detail: { token: name },
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return issues;
|
|
61
|
+
}
|
|
62
|
+
// ── Rule 2 ─────────────────────────────────────────────────────────────────
|
|
63
|
+
// orphaned-tokens: tokens defined in tokens.css but never referenced anywhere
|
|
64
|
+
// in layout.md.
|
|
65
|
+
function ruleOrphanedTokens(kit) {
|
|
66
|
+
if (!kit.tokensCss)
|
|
67
|
+
return [];
|
|
68
|
+
const issues = [];
|
|
69
|
+
const declarations = parseCssDeclarations(kit.tokensCss);
|
|
70
|
+
const referenced = new Set();
|
|
71
|
+
for (const match of kit.layoutMd.matchAll(/var\((--[a-zA-Z0-9_-]+)\)/g)) {
|
|
72
|
+
if (match[1])
|
|
73
|
+
referenced.add(match[1]);
|
|
74
|
+
}
|
|
75
|
+
for (const decl of declarations) {
|
|
76
|
+
if (!referenced.has(decl.name)) {
|
|
77
|
+
issues.push({
|
|
78
|
+
ruleId: "orphaned-tokens",
|
|
79
|
+
severity: "info",
|
|
80
|
+
message: `Token ${decl.name} is defined in tokens.css but never referenced in layout.md.`,
|
|
81
|
+
file: "tokens.css",
|
|
82
|
+
detail: { token: decl.name },
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return issues;
|
|
87
|
+
}
|
|
88
|
+
// ── Rule 3 ─────────────────────────────────────────────────────────────────
|
|
89
|
+
// wcag-aa-contrast: detectable colour pairs must clear 4.5:1 contrast.
|
|
90
|
+
function ruleWcagAaContrast(kit) {
|
|
91
|
+
if (!kit.tokensCss)
|
|
92
|
+
return [];
|
|
93
|
+
const issues = [];
|
|
94
|
+
const colours = parseCssColourTokens(kit.tokensCss);
|
|
95
|
+
const pairs = [];
|
|
96
|
+
for (const [name] of colours) {
|
|
97
|
+
if (name === "--color-primary") {
|
|
98
|
+
const onName = "--color-on-primary";
|
|
99
|
+
if (colours.has(onName))
|
|
100
|
+
pairs.push({ fg: onName, bg: name, context: "on-primary" });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
for (const [txtName] of colours) {
|
|
104
|
+
if (!txtName.startsWith("--text-") && !txtName.startsWith("--color-on-"))
|
|
105
|
+
continue;
|
|
106
|
+
for (const [bgName] of colours) {
|
|
107
|
+
if (!bgName.startsWith("--bg-") && !bgName.startsWith("--color-bg-"))
|
|
108
|
+
continue;
|
|
109
|
+
if (txtName === "--text-primary" && bgName === "--bg-app") {
|
|
110
|
+
pairs.push({ fg: txtName, bg: bgName, context: "body text on app background" });
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
for (const pair of pairs) {
|
|
115
|
+
const fg = colours.get(pair.fg);
|
|
116
|
+
const bg = colours.get(pair.bg);
|
|
117
|
+
if (!fg || !bg)
|
|
118
|
+
continue;
|
|
119
|
+
const ratio = contrastRatio(fg, bg);
|
|
120
|
+
if (ratio === null)
|
|
121
|
+
continue;
|
|
122
|
+
if (ratio < 4.5) {
|
|
123
|
+
issues.push({
|
|
124
|
+
ruleId: "wcag-aa-contrast",
|
|
125
|
+
severity: "warning",
|
|
126
|
+
message: `Contrast between ${pair.fg} and ${pair.bg} is ${ratio.toFixed(2)}:1, below WCAG AA threshold (4.5:1) for ${pair.context}.`,
|
|
127
|
+
file: "tokens.css",
|
|
128
|
+
detail: { fg: pair.fg, bg: pair.bg, ratio },
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return issues;
|
|
133
|
+
}
|
|
134
|
+
// ── Rule 4 ─────────────────────────────────────────────────────────────────
|
|
135
|
+
// section-ordering: canonical order enforced when sections are present.
|
|
136
|
+
function ruleSectionOrdering(kit) {
|
|
137
|
+
const positions = [];
|
|
138
|
+
for (const canonical of CANONICAL_SECTIONS) {
|
|
139
|
+
const pattern = new RegExp(`^##\\s+.*${escapeRegex(canonical)}`, "mi");
|
|
140
|
+
const match = kit.layoutMd.match(pattern);
|
|
141
|
+
if (match && match.index !== undefined)
|
|
142
|
+
positions.push({ name: canonical, idx: match.index });
|
|
143
|
+
}
|
|
144
|
+
const issues = [];
|
|
145
|
+
for (let i = 1; i < positions.length; i++) {
|
|
146
|
+
const current = positions[i];
|
|
147
|
+
const previous = positions[i - 1];
|
|
148
|
+
if (current.idx < previous.idx) {
|
|
149
|
+
issues.push({
|
|
150
|
+
ruleId: "section-ordering",
|
|
151
|
+
severity: "info",
|
|
152
|
+
message: `Section "${current.name}" appears before "${previous.name}" in layout.md. Canonical order: Quick Reference, Design Direction, Colour System, Typography, Spacing, Components, Elevation, Motion, Anti-Patterns.`,
|
|
153
|
+
file: "layout.md",
|
|
154
|
+
line: lineNumberOf(kit.layoutMd, current.idx),
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return issues;
|
|
159
|
+
}
|
|
160
|
+
// ── Rule 5 ─────────────────────────────────────────────────────────────────
|
|
161
|
+
// missing-primary: layout.md carries at least one primary/accent colour.
|
|
162
|
+
function ruleMissingPrimary(kit) {
|
|
163
|
+
if (!kit.tokensCss)
|
|
164
|
+
return [];
|
|
165
|
+
const defined = parseCssDeclarations(kit.tokensCss).map((d) => d.name);
|
|
166
|
+
// Accept any token whose basename ends in -primary, -accent, -brand, or
|
|
167
|
+
// matches the bare names. This tolerates prefixed kits like --linear-accent,
|
|
168
|
+
// --stripe-primary, --acme-brand.
|
|
169
|
+
const hasAny = defined.some((name) => /(?:^|-)(primary|accent|brand)$/.test(name));
|
|
170
|
+
if (hasAny)
|
|
171
|
+
return [];
|
|
172
|
+
return [
|
|
173
|
+
{
|
|
174
|
+
ruleId: "missing-primary",
|
|
175
|
+
severity: "error",
|
|
176
|
+
message: `No primary/accent/brand colour token found. Expected any token whose name ends in -primary, -accent, or -brand (e.g. --color-primary, --linear-accent, --acme-brand).`,
|
|
177
|
+
file: "tokens.css",
|
|
178
|
+
},
|
|
179
|
+
];
|
|
180
|
+
}
|
|
181
|
+
// ── Rule 6 ─────────────────────────────────────────────────────────────────
|
|
182
|
+
// circular-alias: --a: var(--b); --b: var(--a).
|
|
183
|
+
function ruleCircularAlias(kit) {
|
|
184
|
+
if (!kit.tokensCss)
|
|
185
|
+
return [];
|
|
186
|
+
const issues = [];
|
|
187
|
+
const aliases = new Map();
|
|
188
|
+
for (const match of kit.tokensCss.matchAll(/^\s*(--[a-zA-Z0-9_-]+)\s*:\s*var\((--[a-zA-Z0-9_-]+)\)\s*;/gm)) {
|
|
189
|
+
const from = match[1];
|
|
190
|
+
const to = match[2];
|
|
191
|
+
if (from && to)
|
|
192
|
+
aliases.set(from, to);
|
|
193
|
+
}
|
|
194
|
+
const seen = new Set();
|
|
195
|
+
for (const [from] of aliases) {
|
|
196
|
+
if (seen.has(from))
|
|
197
|
+
continue;
|
|
198
|
+
const chain = [from];
|
|
199
|
+
let current = from;
|
|
200
|
+
while (aliases.has(current)) {
|
|
201
|
+
const next = aliases.get(current);
|
|
202
|
+
if (!next)
|
|
203
|
+
break;
|
|
204
|
+
if (chain.includes(next)) {
|
|
205
|
+
chain.push(next);
|
|
206
|
+
issues.push({
|
|
207
|
+
ruleId: "circular-alias",
|
|
208
|
+
severity: "error",
|
|
209
|
+
message: `Circular token alias: ${chain.join(" -> ")}.`,
|
|
210
|
+
file: "tokens.css",
|
|
211
|
+
detail: { chain },
|
|
212
|
+
});
|
|
213
|
+
chain.forEach((c) => seen.add(c));
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
chain.push(next);
|
|
217
|
+
current = next;
|
|
218
|
+
if (chain.length > 32)
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
seen.add(from);
|
|
222
|
+
}
|
|
223
|
+
return issues;
|
|
224
|
+
}
|
|
225
|
+
// ── Rule 7 ─────────────────────────────────────────────────────────────────
|
|
226
|
+
// unknown-property: tokens.json entries whose $type is outside the W3C DTCG
|
|
227
|
+
// set Layout's exporters produce.
|
|
228
|
+
function ruleUnknownProperty(kit) {
|
|
229
|
+
if (!kit.tokensJson)
|
|
230
|
+
return [];
|
|
231
|
+
const issues = [];
|
|
232
|
+
let parsed;
|
|
233
|
+
try {
|
|
234
|
+
parsed = JSON.parse(kit.tokensJson);
|
|
235
|
+
}
|
|
236
|
+
catch {
|
|
237
|
+
return [
|
|
238
|
+
{
|
|
239
|
+
ruleId: "unknown-property",
|
|
240
|
+
severity: "error",
|
|
241
|
+
message: "tokens.json is not valid JSON.",
|
|
242
|
+
file: "tokens.json",
|
|
243
|
+
},
|
|
244
|
+
];
|
|
245
|
+
}
|
|
246
|
+
const allowed = new Set([
|
|
247
|
+
"color",
|
|
248
|
+
"dimension",
|
|
249
|
+
"fontFamily",
|
|
250
|
+
"fontWeight",
|
|
251
|
+
"fontSize",
|
|
252
|
+
"lineHeight",
|
|
253
|
+
"letterSpacing",
|
|
254
|
+
"typography",
|
|
255
|
+
"shadow",
|
|
256
|
+
"border",
|
|
257
|
+
"duration",
|
|
258
|
+
"cubicBezier",
|
|
259
|
+
"motion",
|
|
260
|
+
"number",
|
|
261
|
+
"string",
|
|
262
|
+
]);
|
|
263
|
+
walkTokens(parsed, (path, value) => {
|
|
264
|
+
if (value && typeof value === "object" && "$type" in value) {
|
|
265
|
+
const t = value.$type;
|
|
266
|
+
if (typeof t === "string" && !allowed.has(t)) {
|
|
267
|
+
issues.push({
|
|
268
|
+
ruleId: "unknown-property",
|
|
269
|
+
severity: "info",
|
|
270
|
+
message: `Token ${path} declares $type "${t}" which is not in the W3C DTCG vocabulary Layout emits.`,
|
|
271
|
+
file: "tokens.json",
|
|
272
|
+
detail: { path, type: t },
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
return issues;
|
|
278
|
+
}
|
|
279
|
+
// Helpers ────────────────────────────────────────────────────────────────
|
|
280
|
+
function escapeRegex(s) {
|
|
281
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
282
|
+
}
|
|
283
|
+
function lineNumberOf(text, index) {
|
|
284
|
+
return text.slice(0, index).split("\n").length;
|
|
285
|
+
}
|
|
286
|
+
function walkTokens(obj, visit, prefix = "") {
|
|
287
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
288
|
+
const next = prefix ? `${prefix}.${key}` : key;
|
|
289
|
+
if (value && typeof value === "object") {
|
|
290
|
+
if ("$value" in value) {
|
|
291
|
+
visit(next, value);
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
walkTokens(value, visit, next);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function parseCssColourTokens(css) {
|
|
300
|
+
const map = new Map();
|
|
301
|
+
for (const decl of parseCssDeclarations(css)) {
|
|
302
|
+
if (isColourValue(decl.value))
|
|
303
|
+
map.set(decl.name, decl.value);
|
|
304
|
+
}
|
|
305
|
+
return map;
|
|
306
|
+
}
|
|
307
|
+
function isColourValue(v) {
|
|
308
|
+
return /^#([0-9a-fA-F]{3,8})$/.test(v) || /^rgb\(/i.test(v) || /^rgba\(/i.test(v);
|
|
309
|
+
}
|
|
310
|
+
function parseHex(value) {
|
|
311
|
+
const match = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.exec(value.trim());
|
|
312
|
+
if (!match || !match[1])
|
|
313
|
+
return null;
|
|
314
|
+
let hex = match[1];
|
|
315
|
+
if (hex.length === 3)
|
|
316
|
+
hex = hex.split("").map((c) => c + c).join("");
|
|
317
|
+
const r = parseInt(hex.slice(0, 2), 16);
|
|
318
|
+
const g = parseInt(hex.slice(2, 4), 16);
|
|
319
|
+
const b = parseInt(hex.slice(4, 6), 16);
|
|
320
|
+
const a = hex.length >= 8 ? parseInt(hex.slice(6, 8), 16) / 255 : 1;
|
|
321
|
+
return [r, g, b, a];
|
|
322
|
+
}
|
|
323
|
+
function parseRgb(value) {
|
|
324
|
+
const match = /^rgba?\(\s*([^)]+)\)\s*$/i.exec(value.trim());
|
|
325
|
+
if (!match || !match[1])
|
|
326
|
+
return null;
|
|
327
|
+
const parts = match[1].split(",").map((p) => p.trim());
|
|
328
|
+
if (parts.length < 3)
|
|
329
|
+
return null;
|
|
330
|
+
const r = Number.parseFloat(parts[0]);
|
|
331
|
+
const g = Number.parseFloat(parts[1]);
|
|
332
|
+
const b = Number.parseFloat(parts[2]);
|
|
333
|
+
const a = parts[3] !== undefined ? Number.parseFloat(parts[3]) : 1;
|
|
334
|
+
if ([r, g, b].some((n) => Number.isNaN(n)))
|
|
335
|
+
return null;
|
|
336
|
+
return [r, g, b, a];
|
|
337
|
+
}
|
|
338
|
+
function channel(c) {
|
|
339
|
+
const v = c / 255;
|
|
340
|
+
return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
|
|
341
|
+
}
|
|
342
|
+
function relativeLuminance(rgb) {
|
|
343
|
+
const [r, g, b] = rgb;
|
|
344
|
+
return 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);
|
|
345
|
+
}
|
|
346
|
+
function contrastRatio(fg, bg) {
|
|
347
|
+
const fgRgb = parseHex(fg) ?? parseRgb(fg);
|
|
348
|
+
const bgRgb = parseHex(bg) ?? parseRgb(bg);
|
|
349
|
+
if (!fgRgb || !bgRgb)
|
|
350
|
+
return null;
|
|
351
|
+
const l1 = relativeLuminance([fgRgb[0], fgRgb[1], fgRgb[2]]);
|
|
352
|
+
const l2 = relativeLuminance([bgRgb[0], bgRgb[1], bgRgb[2]]);
|
|
353
|
+
const [lighter, darker] = l1 > l2 ? [l1, l2] : [l2, l1];
|
|
354
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
355
|
+
}
|
|
356
|
+
// ── Public API ─────────────────────────────────────────────────────────────
|
|
357
|
+
export function lintKit(kit) {
|
|
358
|
+
const rules = [
|
|
359
|
+
ruleBrokenTokenRef,
|
|
360
|
+
ruleOrphanedTokens,
|
|
361
|
+
ruleWcagAaContrast,
|
|
362
|
+
ruleSectionOrdering,
|
|
363
|
+
ruleMissingPrimary,
|
|
364
|
+
ruleCircularAlias,
|
|
365
|
+
ruleUnknownProperty,
|
|
366
|
+
];
|
|
367
|
+
const issues = rules.flatMap((r) => r(kit));
|
|
368
|
+
const errors = issues.filter((i) => i.severity === "error").length;
|
|
369
|
+
const warnings = issues.filter((i) => i.severity === "warning").length;
|
|
370
|
+
const info = issues.filter((i) => i.severity === "info").length;
|
|
371
|
+
return {
|
|
372
|
+
issues,
|
|
373
|
+
summary: { errors, warnings, info, passed: errors === 0 },
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
//# sourceMappingURL=layout-md.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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9B,MAAM,KAAK,GAAG;QACZ,kBAAkB;QAClB,kBAAkB;QAClB,kBAAkB;QAClB,mBAAmB;QACnB,kBAAkB;QAClB,iBAAiB;QACjB,mBAAmB;KACpB,CAAC;IACF,MAAM,MAAM,GAAgB,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,MAAM,CAAC;IACnE,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC;IACvE,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC;IAChE,OAAO;QACL,MAAM;QACN,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC,EAAE;KAC1D,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/mcp/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/mcp/server.ts"],"names":[],"mappings":"AA+BA;;;GAGG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAoMjD"}
|
package/dist/src/mcp/server.js
CHANGED
|
@@ -2,6 +2,7 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { loadKit } from "../kit/loader.js";
|
|
5
|
+
import { scanCodebase } from "../integrations/codebase-scan.js";
|
|
5
6
|
import { startPreviewServer } from "../preview/server.js";
|
|
6
7
|
import { setPreviewServer } from "../preview/ensure.js";
|
|
7
8
|
import { checkMcpRegistration, addFigmaMcpServer, addPlaywrightMcpServer, fixGlobalClaudeJson } from "../cli/setup-utils.js";
|
|
@@ -22,12 +23,25 @@ import * as updateTokens from "./tools/update-tokens.js";
|
|
|
22
23
|
import * as getScreenshots from "./tools/get-screenshots.js";
|
|
23
24
|
import * as checkSetup from "./tools/check-setup.js";
|
|
24
25
|
import * as pushTokensToFigma from "./tools/push-tokens-to-figma.js";
|
|
26
|
+
import * as scanProject from "./tools/scan-project.js";
|
|
25
27
|
/**
|
|
26
28
|
* Start the Layout Context MCP server.
|
|
27
29
|
* Loads the kit from the current working directory and registers all tools.
|
|
28
30
|
*/
|
|
29
31
|
export async function startServer() {
|
|
30
32
|
const kit = loadKit();
|
|
33
|
+
// Auto-scan current directory for React components and Storybook stories
|
|
34
|
+
let scanResult = null;
|
|
35
|
+
try {
|
|
36
|
+
scanResult = await scanCodebase(process.cwd());
|
|
37
|
+
if (scanResult.components.length > 0) {
|
|
38
|
+
console.error(`[layout-context] Codebase: ${scanResult.components.length} components` +
|
|
39
|
+
(scanResult.storybookStories.length > 0 ? ` (${scanResult.storybookStories.length} stories)` : ""));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// Non-fatal — continue without codebase scan
|
|
44
|
+
}
|
|
31
45
|
const kitName = kit?.manifest.displayName ?? "none";
|
|
32
46
|
const componentCount = kit?.components.length ?? 0;
|
|
33
47
|
// Log to stderr so it doesn't interfere with stdio transport
|
|
@@ -102,11 +116,11 @@ export async function startServer() {
|
|
|
102
116
|
name: "layout-context",
|
|
103
117
|
version: pkg.version,
|
|
104
118
|
});
|
|
105
|
-
// Register all
|
|
119
|
+
// Register all 14 tools
|
|
106
120
|
server.tool(getDesignSystem.name, getDesignSystem.description, getDesignSystem.inputSchema, getDesignSystem.handler(kit));
|
|
107
121
|
server.tool(getTokens.name, getTokens.description, getTokens.inputSchema, getTokens.handler(kit));
|
|
108
122
|
server.tool(getComponent.name, getComponent.description, getComponent.inputSchema, getComponent.handler(kit));
|
|
109
|
-
server.tool(listComponents.name, listComponents.description, listComponents.inputSchema, listComponents.handler(kit));
|
|
123
|
+
server.tool(listComponents.name, listComponents.description, listComponents.inputSchema, listComponents.handler(kit, scanResult));
|
|
110
124
|
server.tool(checkCompliance.name, checkCompliance.description, checkCompliance.inputSchema, checkCompliance.handler(kit));
|
|
111
125
|
server.tool(preview.name, preview.description, preview.inputSchema, preview.handler(kit));
|
|
112
126
|
server.tool(pushToFigma.name, pushToFigma.description, pushToFigma.inputSchema, pushToFigma.handler(kit));
|
|
@@ -116,6 +130,7 @@ export async function startServer() {
|
|
|
116
130
|
server.tool(getScreenshots.name, getScreenshots.description, getScreenshots.inputSchema, getScreenshots.handler());
|
|
117
131
|
server.tool(checkSetup.name, checkSetup.description, checkSetup.inputSchema, checkSetup.handler());
|
|
118
132
|
server.tool(pushTokensToFigma.name, pushTokensToFigma.description, pushTokensToFigma.inputSchema, pushTokensToFigma.handler(kit));
|
|
133
|
+
server.tool(scanProject.name, scanProject.description, scanProject.inputSchema, scanProject.handler());
|
|
119
134
|
// Connect via stdio
|
|
120
135
|
const transport = new StdioServerTransport();
|
|
121
136
|
await server.connect(transport);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,kB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ACT,UAAU,CAAC,IAAI,EACf,UAAU,CAAC,WAAW,EACtB,UAAU,CAAC,WAAW,EACtB,UAAU,CAAC,OAAO,EAAE,CACrB,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,iBAAiB,CAAC,IAAI,EACtB,iBAAiB,CAAC,WAAW,EAC7B,iBAAiB,CAAC,WAAW,EAC7B,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,CAC/B,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,WAAW,CAAC,IAAI,EAChB,WAAW,CAAC,WAAW,EACvB,WAAW,CAAC,WAAW,EACvB,WAAW,CAAC,OAAO,EAAE,CACtB,CAAC;IAEF,oBAAoB;IACpB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Kit } from "../../kit/types.js";
|
|
2
|
+
import type { ScanResult } from "../../integrations/codebase-scan.js";
|
|
2
3
|
export declare const name = "list-components";
|
|
3
4
|
export declare const description: string;
|
|
4
5
|
export declare const inputSchema: {};
|
|
5
|
-
export declare function handler(kit: Kit | null): () => Promise<{
|
|
6
|
+
export declare function handler(kit: Kit | null, scanResult: ScanResult | null): () => Promise<{
|
|
6
7
|
content: {
|
|
7
8
|
type: "text";
|
|
8
9
|
text: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-components.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/list-components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"list-components.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/list-components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEtE,eAAO,MAAM,IAAI,oBAAoB,CAAC;AAEtC,eAAO,MAAM,WAAW,QAG4C,CAAC;AAErE,eAAO,MAAM,WAAW,IAAK,CAAC;AAE9B,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI;;;;;GAmDrE"}
|
|
@@ -1,38 +1,64 @@
|
|
|
1
1
|
export const name = "list-components";
|
|
2
|
-
export const description = "Lists all available components
|
|
3
|
-
"
|
|
2
|
+
export const description = "Lists all available components: design system components from layout.md, " +
|
|
3
|
+
"auto-detected React components from the codebase, and Storybook stories. " +
|
|
4
|
+
"Use this to discover existing components before building new UI.";
|
|
4
5
|
export const inputSchema = {};
|
|
5
|
-
export function handler(kit) {
|
|
6
|
+
export function handler(kit, scanResult) {
|
|
6
7
|
return async () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
text: "No design system kit found. Run `npx @layoutdesign/context init` to set one up.",
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
};
|
|
8
|
+
const sections = [];
|
|
9
|
+
// 1. Design system components from layout.md
|
|
10
|
+
if (kit && kit.components.length > 0) {
|
|
11
|
+
const lines = kit.components.map((c) => `- **${c.name}** — ${c.description || "No description"}`);
|
|
12
|
+
sections.push(`## Design System (from layout.md)\n\n${lines.join("\n")}`);
|
|
16
13
|
}
|
|
17
|
-
|
|
14
|
+
// 2. Codebase components (auto-scanned)
|
|
15
|
+
if (scanResult && scanResult.components.length > 0) {
|
|
16
|
+
const lines = scanResult.components
|
|
17
|
+
.slice(0, 100) // cap for context budget
|
|
18
|
+
.map((c) => {
|
|
19
|
+
const propsStr = c.props.length > 0
|
|
20
|
+
? ` props: ${c.props.map(p => p.name).join(", ")}`
|
|
21
|
+
: "";
|
|
22
|
+
const storyStr = c.storybook
|
|
23
|
+
? ` [Storybook: ${c.storybook.stories.map(s => s.name).join(", ")}]`
|
|
24
|
+
: "";
|
|
25
|
+
const refStr = c.usesForwardRef ? " (forwardRef)" : "";
|
|
26
|
+
const importPath = buildImportPath(c.filePath);
|
|
27
|
+
const importStatement = c.exportType === "default"
|
|
28
|
+
? `import ${c.name} from '${importPath}'`
|
|
29
|
+
: `import { ${c.name} } from '${importPath}'`;
|
|
30
|
+
return `- **${c.name}** (${c.filePath})${propsStr}${refStr}${storyStr}\n Import: \`${importStatement}\``;
|
|
31
|
+
});
|
|
32
|
+
sections.push(`## Your Codebase (auto-detected)\n\n${lines.join("\n")}`);
|
|
33
|
+
}
|
|
34
|
+
if (sections.length === 0) {
|
|
18
35
|
return {
|
|
19
|
-
content: [
|
|
20
|
-
{
|
|
36
|
+
content: [{
|
|
21
37
|
type: "text",
|
|
22
|
-
text: "No components
|
|
23
|
-
},
|
|
24
|
-
],
|
|
38
|
+
text: "No components found. Set up a design system with `npx @layoutdesign/context init` or create React components in this project.",
|
|
39
|
+
}],
|
|
25
40
|
};
|
|
26
41
|
}
|
|
27
|
-
const
|
|
42
|
+
const total = (kit?.components.length ?? 0) + (scanResult?.components.length ?? 0);
|
|
28
43
|
return {
|
|
29
|
-
content: [
|
|
30
|
-
{
|
|
44
|
+
content: [{
|
|
31
45
|
type: "text",
|
|
32
|
-
text: `# Components (${
|
|
33
|
-
},
|
|
34
|
-
],
|
|
46
|
+
text: `# Components (${total})\n\n${sections.join("\n\n")}\n\n---\n**IMPORTANT:** When building UI, reuse existing components listed above. Import from the paths shown. Do NOT generate a new Button/Card/Input if one already exists.`,
|
|
47
|
+
}],
|
|
35
48
|
};
|
|
36
49
|
};
|
|
37
50
|
}
|
|
51
|
+
function buildImportPath(filePath) {
|
|
52
|
+
// Convert file path to import path: src/components/ui/button.tsx -> @/components/ui/button
|
|
53
|
+
let importPath = filePath
|
|
54
|
+
.replace(/\.(tsx?|jsx?)$/, "")
|
|
55
|
+
.replace(/\/index$/, "");
|
|
56
|
+
if (importPath.startsWith("src/")) {
|
|
57
|
+
importPath = "@/" + importPath.slice(4);
|
|
58
|
+
}
|
|
59
|
+
else if (!importPath.startsWith(".") && !importPath.startsWith("@")) {
|
|
60
|
+
importPath = "./" + importPath;
|
|
61
|
+
}
|
|
62
|
+
return importPath;
|
|
63
|
+
}
|
|
38
64
|
//# sourceMappingURL=list-components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-components.js","sourceRoot":"","sources":["../../../../src/mcp/tools/list-components.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list-components.js","sourceRoot":"","sources":["../../../../src/mcp/tools/list-components.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAEtC,MAAM,CAAC,MAAM,WAAW,GACtB,2EAA2E;IAC3E,2EAA2E;IAC3E,kEAAkE,CAAC;AAErE,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAE9B,MAAM,UAAU,OAAO,CAAC,GAAe,EAAE,UAA6B;IACpE,OAAO,KAAK,IAAI,EAAE;QAChB,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,6CAA6C;QAC7C,IAAI,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrC,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAC9B,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,WAAW,IAAI,gBAAgB,EAAE,CAChE,CAAC;YACF,QAAQ,CAAC,IAAI,CAAC,wCAAwC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5E,CAAC;QAED,wCAAwC;QACxC,IAAI,UAAU,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnD,MAAM,KAAK,GAAG,UAAU,CAAC,UAAU;iBAChC,KAAK,CAAC,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OAAO;gBACL,OAAO,EAAE,CAAC;wBACR,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,+HAA+H;qBACtI,CAAC;aACH,CAAC;QACJ,CAAC;QAED,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;QAEnF,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,iBAAiB,KAAK,QAAQ,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,+KAA+K;iBACzO,CAAC;SACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,QAAgB;IACvC,2FAA2F;IAC3F,IAAI,UAAU,GAAG,QAAQ;SACtB,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC;SAC7B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAE3B,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,UAAU,GAAG,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;SAAM,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACtE,UAAU,GAAG,IAAI,GAAG,UAAU,CAAC;IACjC,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const name = "scan-project";
|
|
3
|
+
export declare const description: string;
|
|
4
|
+
export declare const inputSchema: {
|
|
5
|
+
path: z.ZodOptional<z.ZodString>;
|
|
6
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
7
|
+
both: "both";
|
|
8
|
+
storybook: "storybook";
|
|
9
|
+
codebase: "codebase";
|
|
10
|
+
}>>;
|
|
11
|
+
};
|
|
12
|
+
type Input = {
|
|
13
|
+
path?: string;
|
|
14
|
+
type?: "both" | "storybook" | "codebase";
|
|
15
|
+
};
|
|
16
|
+
export declare function handler(): (input: Input) => Promise<{
|
|
17
|
+
content: {
|
|
18
|
+
type: "text";
|
|
19
|
+
text: string;
|
|
20
|
+
}[];
|
|
21
|
+
isError?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
content: {
|
|
24
|
+
type: "text";
|
|
25
|
+
text: string;
|
|
26
|
+
}[];
|
|
27
|
+
isError: boolean;
|
|
28
|
+
}>;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=scan-project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan-project.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/scan-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,IAAI,iBAAiB,CAAC;AAEnC,eAAO,MAAM,WAAW,QAG8F,CAAC;AAEvH,eAAO,MAAM,WAAW;;;;;;;CAavB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,CAAC;CAC1C,CAAC;AAEF,wBAAgB,OAAO,KACP,OAAO,KAAK;;;;;;;;;;;;GA8F3B"}
|