@layoutdesign/context 0.1.7
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/LICENSE +21 -0
- package/README.md +424 -0
- package/dist/bin/cli.d.ts +3 -0
- package/dist/bin/cli.d.ts.map +1 -0
- package/dist/bin/cli.js +57 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/src/cli/import-zip.d.ts +2 -0
- package/dist/src/cli/import-zip.d.ts.map +1 -0
- package/dist/src/cli/import-zip.js +156 -0
- package/dist/src/cli/import-zip.js.map +1 -0
- package/dist/src/cli/init.d.ts +4 -0
- package/dist/src/cli/init.d.ts.map +1 -0
- package/dist/src/cli/init.js +104 -0
- package/dist/src/cli/init.js.map +1 -0
- package/dist/src/cli/install.d.ts +5 -0
- package/dist/src/cli/install.d.ts.map +1 -0
- package/dist/src/cli/install.js +192 -0
- package/dist/src/cli/install.js.map +1 -0
- package/dist/src/cli/list.d.ts +2 -0
- package/dist/src/cli/list.d.ts.map +1 -0
- package/dist/src/cli/list.js +36 -0
- package/dist/src/cli/list.js.map +1 -0
- package/dist/src/cli/serve.d.ts +2 -0
- package/dist/src/cli/serve.d.ts.map +1 -0
- package/dist/src/cli/serve.js +9 -0
- package/dist/src/cli/serve.js.map +1 -0
- package/dist/src/cli/use.d.ts +2 -0
- package/dist/src/cli/use.d.ts.map +1 -0
- package/dist/src/cli/use.js +54 -0
- package/dist/src/cli/use.js.map +1 -0
- package/dist/src/compliance/checker.d.ts +23 -0
- package/dist/src/compliance/checker.d.ts.map +1 -0
- package/dist/src/compliance/checker.js +31 -0
- package/dist/src/compliance/checker.js.map +1 -0
- package/dist/src/compliance/rules.d.ts +11 -0
- package/dist/src/compliance/rules.d.ts.map +1 -0
- package/dist/src/compliance/rules.js +147 -0
- package/dist/src/compliance/rules.js.map +1 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/kit/loader.d.ts +16 -0
- package/dist/src/kit/loader.d.ts.map +1 -0
- package/dist/src/kit/loader.js +98 -0
- package/dist/src/kit/loader.js.map +1 -0
- package/dist/src/kit/parser.d.ts +21 -0
- package/dist/src/kit/parser.d.ts.map +1 -0
- package/dist/src/kit/parser.js +98 -0
- package/dist/src/kit/parser.js.map +1 -0
- package/dist/src/kit/registry.d.ts +4 -0
- package/dist/src/kit/registry.d.ts.map +1 -0
- package/dist/src/kit/registry.js +91 -0
- package/dist/src/kit/registry.js.map +1 -0
- package/dist/src/kit/types.d.ts +51 -0
- package/dist/src/kit/types.d.ts.map +1 -0
- package/dist/src/kit/types.js +11 -0
- package/dist/src/kit/types.js.map +1 -0
- package/dist/src/mcp/server.d.ts +6 -0
- package/dist/src/mcp/server.d.ts.map +1 -0
- package/dist/src/mcp/server.js +56 -0
- package/dist/src/mcp/server.js.map +1 -0
- package/dist/src/mcp/tools/check-compliance.d.ts +16 -0
- package/dist/src/mcp/tools/check-compliance.d.ts.map +1 -0
- package/dist/src/mcp/tools/check-compliance.js +44 -0
- package/dist/src/mcp/tools/check-compliance.js.map +1 -0
- package/dist/src/mcp/tools/design-in-figma.d.ts +24 -0
- package/dist/src/mcp/tools/design-in-figma.d.ts.map +1 -0
- package/dist/src/mcp/tools/design-in-figma.js +202 -0
- package/dist/src/mcp/tools/design-in-figma.js.map +1 -0
- package/dist/src/mcp/tools/get-component.d.ts +16 -0
- package/dist/src/mcp/tools/get-component.d.ts.map +1 -0
- package/dist/src/mcp/tools/get-component.js +52 -0
- package/dist/src/mcp/tools/get-component.js.map +1 -0
- package/dist/src/mcp/tools/get-design-system.d.ts +16 -0
- package/dist/src/mcp/tools/get-design-system.d.ts.map +1 -0
- package/dist/src/mcp/tools/get-design-system.js +51 -0
- package/dist/src/mcp/tools/get-design-system.js.map +1 -0
- package/dist/src/mcp/tools/get-screenshots.d.ts +23 -0
- package/dist/src/mcp/tools/get-screenshots.d.ts.map +1 -0
- package/dist/src/mcp/tools/get-screenshots.js +78 -0
- package/dist/src/mcp/tools/get-screenshots.js.map +1 -0
- package/dist/src/mcp/tools/get-tokens.d.ts +20 -0
- package/dist/src/mcp/tools/get-tokens.d.ts.map +1 -0
- package/dist/src/mcp/tools/get-tokens.js +50 -0
- package/dist/src/mcp/tools/get-tokens.js.map +1 -0
- package/dist/src/mcp/tools/list-components.d.ts +11 -0
- package/dist/src/mcp/tools/list-components.d.ts.map +1 -0
- package/dist/src/mcp/tools/list-components.js +38 -0
- package/dist/src/mcp/tools/list-components.js.map +1 -0
- package/dist/src/mcp/tools/preview.d.ts +21 -0
- package/dist/src/mcp/tools/preview.d.ts.map +1 -0
- package/dist/src/mcp/tools/preview.js +63 -0
- package/dist/src/mcp/tools/preview.js.map +1 -0
- package/dist/src/mcp/tools/push-to-figma.d.ts +24 -0
- package/dist/src/mcp/tools/push-to-figma.d.ts.map +1 -0
- package/dist/src/mcp/tools/push-to-figma.js +101 -0
- package/dist/src/mcp/tools/push-to-figma.js.map +1 -0
- package/dist/src/mcp/tools/update-tokens.d.ts +21 -0
- package/dist/src/mcp/tools/update-tokens.d.ts.map +1 -0
- package/dist/src/mcp/tools/update-tokens.js +187 -0
- package/dist/src/mcp/tools/update-tokens.js.map +1 -0
- package/dist/src/mcp/tools/url-to-figma.d.ts +29 -0
- package/dist/src/mcp/tools/url-to-figma.d.ts.map +1 -0
- package/dist/src/mcp/tools/url-to-figma.js +103 -0
- package/dist/src/mcp/tools/url-to-figma.js.map +1 -0
- package/dist/src/preview/server.d.ts +15 -0
- package/dist/src/preview/server.d.ts.map +1 -0
- package/dist/src/preview/server.js +146 -0
- package/dist/src/preview/server.js.map +1 -0
- package/dist/src/preview/static/index.html +493 -0
- package/dist/src/preview/transpile.d.ts +10 -0
- package/dist/src/preview/transpile.d.ts.map +1 -0
- package/dist/src/preview/transpile.js +40 -0
- package/dist/src/preview/transpile.js.map +1 -0
- package/dist/src/preview/ws.d.ts +17 -0
- package/dist/src/preview/ws.d.ts.map +1 -0
- package/dist/src/preview/ws.js +66 -0
- package/dist/src/preview/ws.js.map +1 -0
- package/kits/linear-lite/DESIGN.md +421 -0
- package/kits/linear-lite/kit.json +12 -0
- package/kits/linear-lite/tokens.css +46 -0
- package/kits/linear-lite/tokens.json +47 -0
- package/kits/notion-lite/DESIGN.md +528 -0
- package/kits/notion-lite/kit.json +12 -0
- package/kits/notion-lite/tokens.css +50 -0
- package/kits/notion-lite/tokens.json +51 -0
- package/kits/stripe-lite/DESIGN.md +539 -0
- package/kits/stripe-lite/kit.json +12 -0
- package/kits/stripe-lite/tokens.css +57 -0
- package/kits/stripe-lite/tokens.json +58 -0
- package/package.json +63 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { Kit } from "../../kit/types.js";
|
|
3
|
+
export declare const name = "get-tokens";
|
|
4
|
+
export declare const description: string;
|
|
5
|
+
export declare const inputSchema: {
|
|
6
|
+
format: z.ZodDefault<z.ZodEnum<{
|
|
7
|
+
css: "css";
|
|
8
|
+
json: "json";
|
|
9
|
+
tailwind: "tailwind";
|
|
10
|
+
}>>;
|
|
11
|
+
};
|
|
12
|
+
export declare function handler(kit: Kit | null): ({ format }: {
|
|
13
|
+
format: "css" | "json" | "tailwind";
|
|
14
|
+
}) => Promise<{
|
|
15
|
+
content: {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
}[];
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=get-tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-tokens.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/get-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAE9C,eAAO,MAAM,IAAI,eAAe,CAAC;AAEjC,eAAO,MAAM,WAAW,QAEmE,CAAC;AAE5F,eAAO,MAAM,WAAW;;;;;;CAKvB,CAAC;AAEF,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,IACvB,YAAY;IAAE,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,UAAU,CAAA;CAAE;;;;;GA0ClE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const name = "get-tokens";
|
|
3
|
+
export const description = "Returns design tokens in the requested format (CSS custom properties, W3C DTCG JSON, or Tailwind config). " +
|
|
4
|
+
"Use this when you need exact token values for colours, spacing, typography, or shadows.";
|
|
5
|
+
export const inputSchema = {
|
|
6
|
+
format: z
|
|
7
|
+
.enum(["css", "json", "tailwind"])
|
|
8
|
+
.default("css")
|
|
9
|
+
.describe("Token format: 'css' for CSS custom properties, 'json' for W3C DTCG tokens, 'tailwind' for tailwind.config.js"),
|
|
10
|
+
};
|
|
11
|
+
export function handler(kit) {
|
|
12
|
+
return async ({ format }) => {
|
|
13
|
+
if (!kit) {
|
|
14
|
+
return {
|
|
15
|
+
content: [
|
|
16
|
+
{
|
|
17
|
+
type: "text",
|
|
18
|
+
text: "No design system kit found. Run `npx @layoutdesign/context init` to set one up.",
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const formatMap = {
|
|
24
|
+
css: { data: kit.tokensCss, label: "tokens.css" },
|
|
25
|
+
json: { data: kit.tokensJson, label: "tokens.json" },
|
|
26
|
+
tailwind: { data: kit.tailwindConfig, label: "tailwind.config.js" },
|
|
27
|
+
};
|
|
28
|
+
const entry = formatMap[format];
|
|
29
|
+
if (!entry?.data) {
|
|
30
|
+
return {
|
|
31
|
+
content: [
|
|
32
|
+
{
|
|
33
|
+
type: "text",
|
|
34
|
+
text: `No ${entry?.label ?? format} file found in the kit. Available formats: ${[
|
|
35
|
+
kit.tokensCss ? "css" : null,
|
|
36
|
+
kit.tokensJson ? "json" : null,
|
|
37
|
+
kit.tailwindConfig ? "tailwind" : null,
|
|
38
|
+
]
|
|
39
|
+
.filter(Boolean)
|
|
40
|
+
.join(", ") || "none"}`,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
content: [{ type: "text", text: entry.data }],
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=get-tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-tokens.js","sourceRoot":"","sources":["../../../../src/mcp/tools/get-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,IAAI,GAAG,YAAY,CAAC;AAEjC,MAAM,CAAC,MAAM,WAAW,GACtB,4GAA4G;IAC5G,yFAAyF,CAAC;AAE5F,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM,EAAE,CAAC;SACN,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;SACjC,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CAAC,8GAA8G,CAAC;CAC5H,CAAC;AAEF,MAAM,UAAU,OAAO,CAAC,GAAe;IACrC,OAAO,KAAK,EAAE,EAAE,MAAM,EAA2C,EAAE,EAAE;QACnE,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,iFAAiF;qBACxF;iBACF;aACF,CAAC;QACJ,CAAC;QAED,MAAM,SAAS,GAAgE;YAC7E,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE;YACjD,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE;YACpD,QAAQ,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,cAAc,EAAE,KAAK,EAAE,oBAAoB,EAAE;SACpE,CAAC;QAEF,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC;YACjB,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,MAAM,KAAK,EAAE,KAAK,IAAI,MAAM,8CAChC;4BACE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;4BAC5B,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI;4BAC9B,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI;yBACvC;6BACE,MAAM,CAAC,OAAO,CAAC;6BACf,IAAI,CAAC,IAAI,CAAC,IAAI,MACnB,EAAE;qBACH;iBACF;aACF,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;SACvD,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Kit } from "../../kit/types.js";
|
|
2
|
+
export declare const name = "list-components";
|
|
3
|
+
export declare const description: string;
|
|
4
|
+
export declare const inputSchema: {};
|
|
5
|
+
export declare function handler(kit: Kit | null): () => Promise<{
|
|
6
|
+
content: {
|
|
7
|
+
type: "text";
|
|
8
|
+
text: string;
|
|
9
|
+
}[];
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=list-components.d.ts.map
|
|
@@ -0,0 +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;AAE9C,eAAO,MAAM,IAAI,oBAAoB,CAAC;AAEtC,eAAO,MAAM,WAAW,QAE2E,CAAC;AAEpG,eAAO,MAAM,WAAW,IAAK,CAAC;AAE9B,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI;;;;;GAqCtC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const name = "list-components";
|
|
2
|
+
export const description = "Lists all available components in the active design system kit with their names and descriptions. " +
|
|
3
|
+
"Use this to discover what components are available before requesting details on a specific one.";
|
|
4
|
+
export const inputSchema = {};
|
|
5
|
+
export function handler(kit) {
|
|
6
|
+
return async () => {
|
|
7
|
+
if (!kit) {
|
|
8
|
+
return {
|
|
9
|
+
content: [
|
|
10
|
+
{
|
|
11
|
+
type: "text",
|
|
12
|
+
text: "No design system kit found. Run `npx @layoutdesign/context init` to set one up.",
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (kit.components.length === 0) {
|
|
18
|
+
return {
|
|
19
|
+
content: [
|
|
20
|
+
{
|
|
21
|
+
type: "text",
|
|
22
|
+
text: "No components defined in this kit. Components are parsed from the ## Components section in DESIGN.md.",
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const lines = kit.components.map((c) => `- **${c.name}** — ${c.description || "No description"}`);
|
|
28
|
+
return {
|
|
29
|
+
content: [
|
|
30
|
+
{
|
|
31
|
+
type: "text",
|
|
32
|
+
text: `# Components (${kit.components.length})\n\n${lines.join("\n")}`,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=list-components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-components.js","sourceRoot":"","sources":["../../../../src/mcp/tools/list-components.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAEtC,MAAM,CAAC,MAAM,WAAW,GACtB,oGAAoG;IACpG,iGAAiG,CAAC;AAEpG,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAE9B,MAAM,UAAU,OAAO,CAAC,GAAe;IACrC,OAAO,KAAK,IAAI,EAAE;QAChB,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,iFAAiF;qBACxF;iBACF;aACF,CAAC;QACJ,CAAC;QAED,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,uGAAuG;qBAC9G;iBACF;aACF,CAAC;QACJ,CAAC;QAED,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;QAEF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,iBAAiB,GAAG,CAAC,UAAU,CAAC,MAAM,QAAQ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;iBACvE;aACF;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { Kit } from "../../kit/types.js";
|
|
3
|
+
export declare const name = "preview";
|
|
4
|
+
export declare const description: string;
|
|
5
|
+
export declare const inputSchema: {
|
|
6
|
+
code: z.ZodString;
|
|
7
|
+
language: z.ZodDefault<z.ZodEnum<{
|
|
8
|
+
tsx: "tsx";
|
|
9
|
+
html: "html";
|
|
10
|
+
}>>;
|
|
11
|
+
};
|
|
12
|
+
export declare function handler(_kit: Kit | null): ({ code, language }: {
|
|
13
|
+
code: string;
|
|
14
|
+
language: "tsx" | "html";
|
|
15
|
+
}) => Promise<{
|
|
16
|
+
content: {
|
|
17
|
+
type: "text";
|
|
18
|
+
text: string;
|
|
19
|
+
}[];
|
|
20
|
+
}>;
|
|
21
|
+
//# sourceMappingURL=preview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAG9C,eAAO,MAAM,IAAI,YAAY,CAAC;AAE9B,eAAO,MAAM,WAAW,QAG8C,CAAC;AAEvE,eAAO,MAAM,WAAW;;;;;;CAMvB,CAAC;AAEF,wBAAgB,OAAO,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IACxB,oBAAoB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,KAAK,GAAG,MAAM,CAAA;CAAE;;;;;GAuD7E"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PREVIEW_PORT } from "../../kit/types.js";
|
|
3
|
+
export const name = "preview";
|
|
4
|
+
export const description = "Renders a component code snippet in the local live preview canvas. " +
|
|
5
|
+
"The preview server must be running (`npx @layoutdesign/context serve`). " +
|
|
6
|
+
"Use this to visually verify a component matches the design system.";
|
|
7
|
+
export const inputSchema = {
|
|
8
|
+
code: z.string().describe("The component code to render in the preview canvas"),
|
|
9
|
+
language: z
|
|
10
|
+
.enum(["tsx", "html"])
|
|
11
|
+
.default("tsx")
|
|
12
|
+
.describe("Code language: 'tsx' for React/JSX or 'html' for raw HTML"),
|
|
13
|
+
};
|
|
14
|
+
export function handler(_kit) {
|
|
15
|
+
return async ({ code, language }) => {
|
|
16
|
+
try {
|
|
17
|
+
const { WebSocket } = await import("ws");
|
|
18
|
+
const ws = new WebSocket(`ws://localhost:${PREVIEW_PORT}/ws`);
|
|
19
|
+
const result = await new Promise((resolve, reject) => {
|
|
20
|
+
const timeout = setTimeout(() => {
|
|
21
|
+
ws.close();
|
|
22
|
+
reject(new Error("Preview server connection timed out"));
|
|
23
|
+
}, 5000);
|
|
24
|
+
ws.on("open", () => {
|
|
25
|
+
ws.send(JSON.stringify({
|
|
26
|
+
type: "preview",
|
|
27
|
+
code,
|
|
28
|
+
language,
|
|
29
|
+
}));
|
|
30
|
+
clearTimeout(timeout);
|
|
31
|
+
ws.close();
|
|
32
|
+
resolve(`Preview updated at http://localhost:${PREVIEW_PORT}`);
|
|
33
|
+
});
|
|
34
|
+
ws.on("error", (err) => {
|
|
35
|
+
clearTimeout(timeout);
|
|
36
|
+
reject(err);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
content: [{ type: "text", text: result }],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
const message = err instanceof Error ? err.message : "Unknown error connecting to preview server";
|
|
45
|
+
return {
|
|
46
|
+
content: [
|
|
47
|
+
{
|
|
48
|
+
type: "text",
|
|
49
|
+
text: [
|
|
50
|
+
`Could not connect to preview server: ${message}`,
|
|
51
|
+
"",
|
|
52
|
+
"Start the preview server first:",
|
|
53
|
+
" npx @layoutdesign/context serve",
|
|
54
|
+
"",
|
|
55
|
+
`Then the preview will be available at http://localhost:${PREVIEW_PORT}`,
|
|
56
|
+
].join("\n"),
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.js","sourceRoot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;wBACJ,QAAQ;qBACT,CAAC,CACH,CAAC;oBACF,YAAY,CAAC,OAAO,CAAC,CAAC;oBACtB,EAAE,CAAC,KAAK,EAAE,CAAC;oBACX,OAAO,CAAC,uCAAuC,YAAY,EAAE,CAAC,CAAC;gBACjE,CAAC,CAAC,CAAC;gBAEH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,EAAE,EAAE;oBAC5B,YAAY,CAAC,OAAO,CAAC,CAAC;oBACtB,MAAM,CAAC,GAAG,CAAC,CAAC;gBACd,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;aACnD,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GACX,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,4CAA4C,CAAC;YAEpF,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE;4BACJ,wCAAwC,OAAO,EAAE;4BACjD,EAAE;4BACF,iCAAiC;4BACjC,mCAAmC;4BACnC,EAAE;4BACF,0DAA0D,YAAY,EAAE;yBACzE,CAAC,IAAI,CAAC,IAAI,CAAC;qBACb;iBACF;aACF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { Kit } from "../../kit/types.js";
|
|
3
|
+
export declare const name = "push-to-figma";
|
|
4
|
+
export declare const description: string;
|
|
5
|
+
export declare const inputSchema: {
|
|
6
|
+
code: z.ZodString;
|
|
7
|
+
name: z.ZodOptional<z.ZodString>;
|
|
8
|
+
viewports: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
9
|
+
desktop: "desktop";
|
|
10
|
+
tablet: "tablet";
|
|
11
|
+
mobile: "mobile";
|
|
12
|
+
}>>>;
|
|
13
|
+
};
|
|
14
|
+
export declare function handler(kit: Kit | null): ({ code, name: frameName, viewports }: {
|
|
15
|
+
code: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
viewports?: string[];
|
|
18
|
+
}) => Promise<{
|
|
19
|
+
content: {
|
|
20
|
+
type: "text";
|
|
21
|
+
text: string;
|
|
22
|
+
}[];
|
|
23
|
+
}>;
|
|
24
|
+
//# sourceMappingURL=push-to-figma.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-to-figma.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/push-to-figma.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAG9C,eAAO,MAAM,IAAI,kBAAkB,CAAC;AAEpC,eAAO,MAAM,WAAW,QAI0B,CAAC;AAEnD,eAAO,MAAM,WAAW;;;;;;;;CAUvB,CAAC;AAEF,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,IACvB,sCAAsC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE;;;;;GAsF1G"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PREVIEW_PORT } from "../../kit/types.js";
|
|
3
|
+
export const name = "push-to-figma";
|
|
4
|
+
export const description = "Push a component to Figma as editable frames. Sends the code to the preview server, " +
|
|
5
|
+
"then returns step-by-step instructions for capturing it via Figma MCP's generate_figma_design. " +
|
|
6
|
+
"The component renders at localhost:4321/capture — no temp files or HTTP servers needed. " +
|
|
7
|
+
"Requires the Figma MCP server to be connected.";
|
|
8
|
+
export const inputSchema = {
|
|
9
|
+
code: z.string().describe("The component TSX/JSX code to push to Figma as an editable frame"),
|
|
10
|
+
name: z
|
|
11
|
+
.string()
|
|
12
|
+
.optional()
|
|
13
|
+
.describe("Optional frame name in Figma (defaults to 'Layout Component')"),
|
|
14
|
+
viewports: z
|
|
15
|
+
.array(z.enum(["desktop", "tablet", "mobile"]))
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("Viewports to capture (default: ['desktop']). Each gets a separate Figma frame."),
|
|
18
|
+
};
|
|
19
|
+
export function handler(kit) {
|
|
20
|
+
return async ({ code, name: frameName, viewports }) => {
|
|
21
|
+
const resolvedName = frameName ?? "Layout Component";
|
|
22
|
+
const resolvedViewports = viewports ?? ["desktop"];
|
|
23
|
+
const captureUrl = `http://localhost:${PREVIEW_PORT}/capture`;
|
|
24
|
+
// Step 1: Push code to the preview server so /capture has something to render
|
|
25
|
+
let pushStatus;
|
|
26
|
+
try {
|
|
27
|
+
const { WebSocket } = await import("ws");
|
|
28
|
+
const ws = new WebSocket(`ws://localhost:${PREVIEW_PORT}/ws`);
|
|
29
|
+
pushStatus = await new Promise((resolve, reject) => {
|
|
30
|
+
const timeout = setTimeout(() => {
|
|
31
|
+
ws.close();
|
|
32
|
+
reject(new Error("Preview server connection timed out"));
|
|
33
|
+
}, 5000);
|
|
34
|
+
ws.on("open", () => {
|
|
35
|
+
ws.send(JSON.stringify({ type: "preview", code, language: "tsx" }));
|
|
36
|
+
clearTimeout(timeout);
|
|
37
|
+
ws.close();
|
|
38
|
+
resolve("Component pushed to preview server");
|
|
39
|
+
});
|
|
40
|
+
ws.on("error", (err) => {
|
|
41
|
+
clearTimeout(timeout);
|
|
42
|
+
reject(err);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
48
|
+
return {
|
|
49
|
+
content: [
|
|
50
|
+
{
|
|
51
|
+
type: "text",
|
|
52
|
+
text: [
|
|
53
|
+
`Could not push to preview server: ${msg}`,
|
|
54
|
+
"",
|
|
55
|
+
"The preview server needs to be running. It starts automatically with the MCP server.",
|
|
56
|
+
"If it failed to start (e.g. port 4321 in use), stop the other process and restart.",
|
|
57
|
+
].join("\n"),
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
// Step 2: Build capture instructions for Figma MCP
|
|
63
|
+
const viewportUrls = resolvedViewports.map((vp) => {
|
|
64
|
+
const vpParam = vp === "desktop" ? "" : `?viewport=${vp}`;
|
|
65
|
+
return `- **${vp}:** ${captureUrl}${vpParam}`;
|
|
66
|
+
});
|
|
67
|
+
const response = [
|
|
68
|
+
"# Push to Figma",
|
|
69
|
+
"",
|
|
70
|
+
`${pushStatus}. The component is now rendering at \`${captureUrl}\`.`,
|
|
71
|
+
"",
|
|
72
|
+
"## Capture URLs",
|
|
73
|
+
"",
|
|
74
|
+
...viewportUrls,
|
|
75
|
+
"",
|
|
76
|
+
"## Next Steps",
|
|
77
|
+
"",
|
|
78
|
+
"For each viewport above, call `generate_figma_design` to capture it as a Figma frame:",
|
|
79
|
+
"",
|
|
80
|
+
"1. Call `generate_figma_design` with `outputMode: \"existingFile\"` or `\"newFile\"` → get a captureId",
|
|
81
|
+
"2. The instructions will tell you to open a URL — use the **capture URL above** (not a temp file)",
|
|
82
|
+
`3. Append the capture hash to the URL: \`${captureUrl}#figmacapture=<captureId>&figmaendpoint=...&figmadelay=3000\``,
|
|
83
|
+
"4. Poll `generate_figma_design` with `captureId` until completed",
|
|
84
|
+
"",
|
|
85
|
+
"**IMPORTANT:** Do NOT create temp HTML files or start a new HTTP server.",
|
|
86
|
+
`The component is already rendered and ready to capture at \`${captureUrl}\`.`,
|
|
87
|
+
"",
|
|
88
|
+
`**Frame name:** ${resolvedName}`,
|
|
89
|
+
"",
|
|
90
|
+
"## Setup (if Figma MCP is not connected)",
|
|
91
|
+
"",
|
|
92
|
+
"```bash",
|
|
93
|
+
"claude mcp add --transport http figma https://mcp.figma.com/mcp",
|
|
94
|
+
"```",
|
|
95
|
+
].join("\n");
|
|
96
|
+
return {
|
|
97
|
+
content: [{ type: "text", text: response }],
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=push-to-figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-to-figma.js","sourceRoot":"","sources":["../../../../src/mcp/tools/push-to-figma.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAC;AAEpC,MAAM,CAAC,MAAM,WAAW,GACtB,sFAAsF;IACtF,iGAAiG;IACjG,0FAA0F;IAC1F,gDAAgD,CAAC;AAEnD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kEAAkE,CAAC;IAC7F,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,+DAA+D,CAAC;IAC5E,SAAS,EAAE,CAAC;SACT,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;SAC9C,QAAQ,EAAE;SACV,QAAQ,CAAC,gFAAgF,CAAC;CAC9F,CAAC;AAEF,MAAM,UAAU,OAAO,CAAC,GAAe;IACrC,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAyD,EAAE,EAAE;QAC3G,MAAM,YAAY,GAAG,SAAS,IAAI,kBAAkB,CAAC;QACrD,MAAM,iBAAiB,GAAG,SAAS,IAAI,CAAC,SAAS,CAAC,CAAC;QACnD,MAAM,UAAU,GAAG,oBAAoB,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AAI,EAAE;4BACJ,qCAAqC,GAAG,EAAE;4BAC1C,EAAE;4BACF,sFAAsF;4BACtF,oFAAoF;yBACrF,CAAC,IAAI,CAAC,IAAI,CAAC;qBACb;iBACF;aACF,CAAC;QACJ,CAAC;QAED,mDAAmD;QACnD,MAAM,YAAY,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;YAChD,MAAM,OAAO,GAAG,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC;YAC1D,OAAO,OAAO,EAAE,OAAO,UAAU,GAAG,OAAO,EAAE,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG;YACf,iBAAiB;YACjB,EAAE;YACF,GAAG,UAAU,yCAAyC,UAAU,KAAK;YACrE,EAAE;YACF,iBAAiB;YACjB,EAAE;YACF,GAAG,YAAY;YACf,EAAE;YACF,eAAe;YACf,EAAE;YACF,uFAAuF;YACvF,EAAE;YACF,wGAAwG;YACxG,mGAAmG;YACnG,4CAA4C,UAAU,+DAA+D;YACrH,kEAAkE;YAClE,EAAE;YACF,0EAA0E;YAC1E,+DAA+D,UAAU,KAAK;YAC9E,EAAE;YACF,mBAAmB,YAAY,EAAE;YACjC,EAAE;YACF,0CAA0C;YAC1C,EAAE;YACF,SAAS;YACT,iEAAiE;YACjE,KAAK;SACN,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEb,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;SACrD,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const name = "update-tokens";
|
|
3
|
+
export declare const description: string;
|
|
4
|
+
export declare const inputSchema: {
|
|
5
|
+
updates: z.ZodArray<z.ZodObject<{
|
|
6
|
+
token: z.ZodString;
|
|
7
|
+
value: z.ZodString;
|
|
8
|
+
}, z.core.$strip>>;
|
|
9
|
+
};
|
|
10
|
+
export declare function handler(): ({ updates }: {
|
|
11
|
+
updates: Array<{
|
|
12
|
+
token: string;
|
|
13
|
+
value: string;
|
|
14
|
+
}>;
|
|
15
|
+
}) => Promise<{
|
|
16
|
+
content: {
|
|
17
|
+
type: "text";
|
|
18
|
+
text: string;
|
|
19
|
+
}[];
|
|
20
|
+
}>;
|
|
21
|
+
//# sourceMappingURL=update-tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-tokens.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/update-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,IAAI,kBAAkB,CAAC;AAEpC,eAAO,MAAM,WAAW,QAG0E,CAAC;AAEnG,eAAO,MAAM,WAAW;;;;;CASvB,CAAC;AAWF,wBAAgB,OAAO,KACP,aAAa;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;GAwJhF"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { readFileSync, writeFileSync, existsSync } from "node:fs";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
|
+
import { LAYOUT_DIR, TOKENS_CSS_FILE, TOKENS_JSON_FILE, DESIGN_MD_FILE } from "../../kit/types.js";
|
|
5
|
+
export const name = "update-tokens";
|
|
6
|
+
export const description = "Update design token values in the active kit. Changes are applied to tokens.css, tokens.json, " +
|
|
7
|
+
"and DESIGN.md simultaneously so the design system stays consistent. Use this when the user wants " +
|
|
8
|
+
"to tweak colours, spacing, typography, or other token values without re-extracting from Figma.";
|
|
9
|
+
export const inputSchema = {
|
|
10
|
+
updates: z
|
|
11
|
+
.array(z.object({
|
|
12
|
+
token: z.string().describe("CSS variable name, e.g. --color-action-primary"),
|
|
13
|
+
value: z.string().describe("New value, e.g. #FF0000 or 16px"),
|
|
14
|
+
}))
|
|
15
|
+
.describe("One or more token updates to apply"),
|
|
16
|
+
};
|
|
17
|
+
export function handler() {
|
|
18
|
+
return async ({ updates }) => {
|
|
19
|
+
const dir = resolve(process.cwd(), LAYOUT_DIR);
|
|
20
|
+
if (!existsSync(dir)) {
|
|
21
|
+
return {
|
|
22
|
+
content: [
|
|
23
|
+
{
|
|
24
|
+
type: "text",
|
|
25
|
+
text: "No .layout/ directory found. Run `npx @layoutdesign/context init` or import a Studio export first.",
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const cssPath = join(dir, TOKENS_CSS_FILE);
|
|
31
|
+
if (!existsSync(cssPath)) {
|
|
32
|
+
return {
|
|
33
|
+
content: [
|
|
34
|
+
{
|
|
35
|
+
type: "text",
|
|
36
|
+
text: "No tokens.css found in .layout/. Cannot update tokens without a CSS token file.",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
let css = readFileSync(cssPath, "utf-8");
|
|
42
|
+
const jsonPath = join(dir, TOKENS_JSON_FILE);
|
|
43
|
+
const mdPath = join(dir, DESIGN_MD_FILE);
|
|
44
|
+
let tokensJson = null;
|
|
45
|
+
if (existsSync(jsonPath)) {
|
|
46
|
+
try {
|
|
47
|
+
tokensJson = JSON.parse(readFileSync(jsonPath, "utf-8"));
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// Malformed JSON — skip
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
let designMd = null;
|
|
54
|
+
if (existsSync(mdPath)) {
|
|
55
|
+
designMd = readFileSync(mdPath, "utf-8");
|
|
56
|
+
}
|
|
57
|
+
const results = [];
|
|
58
|
+
const errors = [];
|
|
59
|
+
for (const { token, value: newValue } of updates) {
|
|
60
|
+
// Match the token in CSS: --token-name: <value>;
|
|
61
|
+
const escapedToken = escapeForRegex(token);
|
|
62
|
+
const pattern = new RegExp(`(${escapedToken}:\\s*)(.+?)(\\s*;)`, "g");
|
|
63
|
+
const match = pattern.exec(css);
|
|
64
|
+
if (!match) {
|
|
65
|
+
errors.push(`Token "${token}" not found in tokens.css`);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const oldValue = match[2].trim();
|
|
69
|
+
if (normalizeValue(oldValue) === normalizeValue(newValue)) {
|
|
70
|
+
errors.push(`Token "${token}" already has value "${newValue}"`);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
// Reset regex lastIndex and update CSS
|
|
74
|
+
pattern.lastIndex = 0;
|
|
75
|
+
css = css.replace(pattern, `$1${newValue}$3`);
|
|
76
|
+
// Update tokens.json
|
|
77
|
+
let jsonMatchPath = null;
|
|
78
|
+
if (tokensJson) {
|
|
79
|
+
jsonMatchPath = updateJsonToken(tokensJson, oldValue, newValue);
|
|
80
|
+
}
|
|
81
|
+
// Update DESIGN.md
|
|
82
|
+
let mdCount = 0;
|
|
83
|
+
if (designMd && oldValue !== newValue) {
|
|
84
|
+
const escapedOld = escapeForRegex(oldValue);
|
|
85
|
+
// For hex colours, ensure we don't match partial (e.g. #5E6AD2 inside #5E6AD2FF)
|
|
86
|
+
const mdPattern = isHexColour(oldValue)
|
|
87
|
+
? new RegExp(escapedOld + "(?![0-9a-fA-F])", "g")
|
|
88
|
+
: new RegExp(escapedOld, "g");
|
|
89
|
+
const matches = designMd.match(mdPattern);
|
|
90
|
+
mdCount = matches?.length ?? 0;
|
|
91
|
+
if (mdCount > 0) {
|
|
92
|
+
designMd = designMd.replace(mdPattern, newValue);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
results.push({
|
|
96
|
+
token,
|
|
97
|
+
oldValue,
|
|
98
|
+
newValue,
|
|
99
|
+
css: true,
|
|
100
|
+
json: jsonMatchPath,
|
|
101
|
+
mdCount,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
// Write files back
|
|
105
|
+
if (results.length > 0) {
|
|
106
|
+
writeFileSync(cssPath, css);
|
|
107
|
+
if (tokensJson) {
|
|
108
|
+
writeFileSync(jsonPath, JSON.stringify(tokensJson, null, 2) + "\n");
|
|
109
|
+
}
|
|
110
|
+
if (designMd) {
|
|
111
|
+
writeFileSync(mdPath, designMd);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// Build response
|
|
115
|
+
const lines = [];
|
|
116
|
+
if (results.length > 0) {
|
|
117
|
+
lines.push(`Updated ${results.length} token${results.length === 1 ? "" : "s"}:\n`);
|
|
118
|
+
for (const r of results) {
|
|
119
|
+
lines.push(` ${r.token}: ${r.oldValue} → ${r.newValue}`);
|
|
120
|
+
lines.push(` ✓ tokens.css`);
|
|
121
|
+
if (r.json) {
|
|
122
|
+
lines.push(` ✓ tokens.json (${r.json})`);
|
|
123
|
+
}
|
|
124
|
+
else if (tokensJson) {
|
|
125
|
+
lines.push(` ⚠ tokens.json (no matching $value found)`);
|
|
126
|
+
}
|
|
127
|
+
if (r.mdCount > 0) {
|
|
128
|
+
lines.push(` ✓ DESIGN.md (${r.mdCount} occurrence${r.mdCount === 1 ? "" : "s"})`);
|
|
129
|
+
}
|
|
130
|
+
else if (designMd) {
|
|
131
|
+
lines.push(` – DESIGN.md (old value not found in text)`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (errors.length > 0) {
|
|
136
|
+
if (lines.length > 0)
|
|
137
|
+
lines.push("");
|
|
138
|
+
lines.push("Skipped:");
|
|
139
|
+
for (const e of errors) {
|
|
140
|
+
lines.push(` ⚠ ${e}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (results.length === 0 && errors.length === 0) {
|
|
144
|
+
lines.push("No updates provided.");
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Walk the JSON tree looking for objects with `$value` matching oldValue.
|
|
153
|
+
* Returns the dot-path of the first match, or null.
|
|
154
|
+
*/
|
|
155
|
+
function updateJsonToken(obj, oldValue, newValue, pathParts = []) {
|
|
156
|
+
let foundPath = null;
|
|
157
|
+
for (const [key, val] of Object.entries(obj)) {
|
|
158
|
+
if (val && typeof val === "object" && !Array.isArray(val)) {
|
|
159
|
+
const record = val;
|
|
160
|
+
if ("$value" in record && typeof record["$value"] === "string") {
|
|
161
|
+
if (normalizeValue(record["$value"]) === normalizeValue(oldValue)) {
|
|
162
|
+
record["$value"] = newValue;
|
|
163
|
+
foundPath = [...pathParts, key].join(".");
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
else if ("$value" in record && Array.isArray(record["$value"])) {
|
|
167
|
+
// fontFamily arrays — skip value matching for arrays
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
const result = updateJsonToken(record, oldValue, newValue, [...pathParts, key]);
|
|
171
|
+
if (result && !foundPath)
|
|
172
|
+
foundPath = result;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return foundPath;
|
|
177
|
+
}
|
|
178
|
+
function escapeForRegex(str) {
|
|
179
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
180
|
+
}
|
|
181
|
+
function normalizeValue(val) {
|
|
182
|
+
return val.trim().replace(/\s+/g, " ").toLowerCase();
|
|
183
|
+
}
|
|
184
|
+
function isHexColour(val) {
|
|
185
|
+
return /^#[0-9a-fA-F]{3,8}$/.test(val.trim());
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=update-tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-tokens.js","sourceRoot":"","sources":["../../../../src/mcp/tools/update-tokens.ts"],"names":[],"mappings":"AA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AAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const name = "url-to-figma";
|
|
3
|
+
export declare const description: string;
|
|
4
|
+
export declare const inputSchema: {
|
|
5
|
+
url: z.ZodString;
|
|
6
|
+
viewports: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
7
|
+
desktop: "desktop";
|
|
8
|
+
tablet: "tablet";
|
|
9
|
+
mobile: "mobile";
|
|
10
|
+
}>>>;
|
|
11
|
+
outputMode: z.ZodOptional<z.ZodEnum<{
|
|
12
|
+
newFile: "newFile";
|
|
13
|
+
existingFile: "existingFile";
|
|
14
|
+
clipboard: "clipboard";
|
|
15
|
+
}>>;
|
|
16
|
+
fileKey: z.ZodOptional<z.ZodString>;
|
|
17
|
+
};
|
|
18
|
+
export declare function handler(): ({ url, viewports, outputMode, fileKey, }: {
|
|
19
|
+
url: string;
|
|
20
|
+
viewports?: string[];
|
|
21
|
+
outputMode?: string;
|
|
22
|
+
fileKey?: string;
|
|
23
|
+
}) => Promise<{
|
|
24
|
+
content: {
|
|
25
|
+
type: "text";
|
|
26
|
+
text: string;
|
|
27
|
+
}[];
|
|
28
|
+
}>;
|
|
29
|
+
//# sourceMappingURL=url-to-figma.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-to-figma.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/url-to-figma.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,IAAI,iBAAiB,CAAC;AAEnC,eAAO,MAAM,WAAW,QAG0D,CAAC;AAEnF,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAgBvB,CAAC;AAQF,wBAAgB,OAAO,KACP,0CAKX;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;;;;;GA8EF"}
|