@muloka/figma-console-mcp 0.5.0 → 0.5.2

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.
Files changed (111) hide show
  1. package/README.md +3 -1
  2. package/dist/core/port-discovery.d.ts +9 -0
  3. package/dist/core/port-discovery.d.ts.map +1 -1
  4. package/dist/core/port-discovery.js +40 -14
  5. package/dist/core/port-discovery.js.map +1 -1
  6. package/dist/core/websocket-connector.d.ts +2 -1
  7. package/dist/core/websocket-connector.d.ts.map +1 -1
  8. package/dist/core/websocket-connector.js +17 -2
  9. package/dist/core/websocket-connector.js.map +1 -1
  10. package/dist/core/websocket-server.d.ts +8 -1
  11. package/dist/core/websocket-server.d.ts.map +1 -1
  12. package/dist/core/websocket-server.js +18 -2
  13. package/dist/core/websocket-server.js.map +1 -1
  14. package/dist/core/write-tools.d.ts +3 -1
  15. package/dist/core/write-tools.d.ts.map +1 -1
  16. package/dist/core/write-tools.js +34 -14
  17. package/dist/core/write-tools.js.map +1 -1
  18. package/dist/local.d.ts +2 -1
  19. package/dist/local.d.ts.map +1 -1
  20. package/dist/local.js +10 -14
  21. package/dist/local.js.map +1 -1
  22. package/package.json +1 -1
  23. package/dist/apps/design-system-dashboard/mcp-app.html +0 -521
  24. package/dist/apps/token-browser/mcp-app.html +0 -410
  25. package/dist/cloudflare/apps/design-system-dashboard/scoring/accessibility.js +0 -277
  26. package/dist/cloudflare/apps/design-system-dashboard/scoring/component-metadata.js +0 -357
  27. package/dist/cloudflare/apps/design-system-dashboard/scoring/consistency.js +0 -341
  28. package/dist/cloudflare/apps/design-system-dashboard/scoring/coverage.js +0 -230
  29. package/dist/cloudflare/apps/design-system-dashboard/scoring/engine.js +0 -92
  30. package/dist/cloudflare/apps/design-system-dashboard/scoring/naming-semantics.js +0 -308
  31. package/dist/cloudflare/apps/design-system-dashboard/scoring/token-architecture.js +0 -349
  32. package/dist/cloudflare/apps/design-system-dashboard/scoring/types.js +0 -40
  33. package/dist/cloudflare/apps/design-system-dashboard/server.js +0 -159
  34. package/dist/cloudflare/apps/token-browser/server.js +0 -136
  35. package/dist/cloudflare/browser-manager.js +0 -157
  36. package/dist/cloudflare/core/accessibility-tools.js +0 -361
  37. package/dist/cloudflare/core/annotation-tools.js +0 -230
  38. package/dist/cloudflare/core/cloud-websocket-connector.js +0 -419
  39. package/dist/cloudflare/core/cloud-websocket-relay.js +0 -198
  40. package/dist/cloudflare/core/comment-tools.js +0 -292
  41. package/dist/cloudflare/core/config.js +0 -153
  42. package/dist/cloudflare/core/console-monitor.js +0 -427
  43. package/dist/cloudflare/core/deep-component-tools.js +0 -128
  44. package/dist/cloudflare/core/design-code-tools.js +0 -2793
  45. package/dist/cloudflare/core/design-system-manifest.js +0 -265
  46. package/dist/cloudflare/core/design-system-tools.js +0 -882
  47. package/dist/cloudflare/core/diagnose-tool.js +0 -100
  48. package/dist/cloudflare/core/diff/changelog-formatter.js +0 -275
  49. package/dist/cloudflare/core/diff/diff-engine.js +0 -334
  50. package/dist/cloudflare/core/diff/property-compare.js +0 -36
  51. package/dist/cloudflare/core/diff/version-cache.js +0 -74
  52. package/dist/cloudflare/core/enrichment/enrichment-service.js +0 -374
  53. package/dist/cloudflare/core/enrichment/index.js +0 -7
  54. package/dist/cloudflare/core/enrichment/relationship-mapper.js +0 -351
  55. package/dist/cloudflare/core/enrichment/style-resolver.js +0 -346
  56. package/dist/cloudflare/core/figjam-tools.js +0 -547
  57. package/dist/cloudflare/core/figma-api.js +0 -509
  58. package/dist/cloudflare/core/figma-connector.js +0 -7
  59. package/dist/cloudflare/core/figma-reconstruction-spec.js +0 -402
  60. package/dist/cloudflare/core/figma-style-extractor.js +0 -311
  61. package/dist/cloudflare/core/figma-tools.js +0 -3353
  62. package/dist/cloudflare/core/identity.js +0 -96
  63. package/dist/cloudflare/core/library-tools.js +0 -580
  64. package/dist/cloudflare/core/logger.js +0 -53
  65. package/dist/cloudflare/core/port-discovery.js +0 -935
  66. package/dist/cloudflare/core/resolve-package-root.js +0 -11
  67. package/dist/cloudflare/core/slides-tools.js +0 -714
  68. package/dist/cloudflare/core/slot-tools.js +0 -334
  69. package/dist/cloudflare/core/snippet-injector.js +0 -96
  70. package/dist/cloudflare/core/tokens/alias-resolver.js +0 -205
  71. package/dist/cloudflare/core/tokens/config.js +0 -294
  72. package/dist/cloudflare/core/tokens/dialect.js +0 -232
  73. package/dist/cloudflare/core/tokens/figma-converter.js +0 -323
  74. package/dist/cloudflare/core/tokens/formatters/css-vars.js +0 -338
  75. package/dist/cloudflare/core/tokens/formatters/dtcg.js +0 -376
  76. package/dist/cloudflare/core/tokens/formatters/index.js +0 -45
  77. package/dist/cloudflare/core/tokens/formatters/json.js +0 -205
  78. package/dist/cloudflare/core/tokens/formatters/less.js +0 -4
  79. package/dist/cloudflare/core/tokens/formatters/scss.js +0 -258
  80. package/dist/cloudflare/core/tokens/formatters/stubs.js +0 -13
  81. package/dist/cloudflare/core/tokens/formatters/style-dictionary-v3.js +0 -213
  82. package/dist/cloudflare/core/tokens/formatters/tailwind-v3.js +0 -237
  83. package/dist/cloudflare/core/tokens/formatters/tailwind-v4.js +0 -335
  84. package/dist/cloudflare/core/tokens/formatters/tokens-studio.js +0 -256
  85. package/dist/cloudflare/core/tokens/formatters/ts-module.js +0 -198
  86. package/dist/cloudflare/core/tokens/index.js +0 -16
  87. package/dist/cloudflare/core/tokens/parsers/css-vars.js +0 -4
  88. package/dist/cloudflare/core/tokens/parsers/dtcg.js +0 -280
  89. package/dist/cloudflare/core/tokens/parsers/index.js +0 -138
  90. package/dist/cloudflare/core/tokens/parsers/json.js +0 -7
  91. package/dist/cloudflare/core/tokens/parsers/scss.js +0 -4
  92. package/dist/cloudflare/core/tokens/parsers/stubs.js +0 -20
  93. package/dist/cloudflare/core/tokens/parsers/style-dictionary-v3.js +0 -4
  94. package/dist/cloudflare/core/tokens/parsers/tailwind-v3.js +0 -4
  95. package/dist/cloudflare/core/tokens/parsers/tailwind-v4.js +0 -4
  96. package/dist/cloudflare/core/tokens/parsers/tokens-studio.js +0 -4
  97. package/dist/cloudflare/core/tokens/schemas.js +0 -152
  98. package/dist/cloudflare/core/tokens/transforms/color.js +0 -12
  99. package/dist/cloudflare/core/tokens/transforms/index.js +0 -29
  100. package/dist/cloudflare/core/tokens/transforms/size.js +0 -7
  101. package/dist/cloudflare/core/tokens/types.js +0 -18
  102. package/dist/cloudflare/core/tokens-tools.js +0 -1788
  103. package/dist/cloudflare/core/types/design-code.js +0 -4
  104. package/dist/cloudflare/core/types/enriched.js +0 -5
  105. package/dist/cloudflare/core/types/index.js +0 -4
  106. package/dist/cloudflare/core/variable-resolver.js +0 -85
  107. package/dist/cloudflare/core/version-tools.js +0 -1199
  108. package/dist/cloudflare/core/websocket-connector.js +0 -436
  109. package/dist/cloudflare/core/websocket-server.js +0 -1009
  110. package/dist/cloudflare/core/write-tools.js +0 -2506
  111. package/dist/cloudflare/index.js +0 -3010
@@ -1,4 +0,0 @@
1
- /**
2
- * TypeScript types for Design-Code Parity Checker & Documentation Generator
3
- */
4
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * TypeScript types for enriched Figma data responses
3
- * Phase 5: Enriched Data Extraction & Design System Auditing
4
- */
5
- export {};
@@ -1,4 +0,0 @@
1
- /**
2
- * Type definitions for Figma Console MCP
3
- */
4
- export {};
@@ -1,85 +0,0 @@
1
- /**
2
- * Bridge-first variable resolution.
3
- *
4
- * Figma's Variables REST API (`/files/:key/variables/local`) is **Enterprise-only**
5
- * and returns 403 for the majority of users (Starter/Pro/Org). The Desktop Bridge
6
- * and cloud relay read variables through the Plugin API
7
- * (`figma.variables.getLocalVariablesAsync`), which works on **every** Figma plan.
8
- *
9
- * Orchestration tools (e.g. `figma_get_design_system_kit`) historically called the
10
- * REST API directly and dead-ended on a 403 for non-Enterprise users — even when a
11
- * bridge was connected. This helper mirrors `figma_get_variables`' resolution order
12
- * so every variable-reading tool behaves consistently:
13
- *
14
- * 1. Desktop Bridge / cloud relay (any plan) ← preferred
15
- * 2. REST Variables API (Enterprise only) ← fallback
16
- *
17
- * It returns the same normalized shape as `formatVariables()`.
18
- */
19
- import { formatVariables, withTimeout } from "./figma-api.js";
20
- import { createChildLogger } from "./logger.js";
21
- const logger = createChildLogger({ component: "variable-resolver" });
22
- /**
23
- * The Desktop Bridge returns variables/collections as **arrays**, while
24
- * `formatVariables()` expects **objects keyed by id** (the REST shape). Convert so
25
- * the same formatter handles both transports.
26
- */
27
- function bridgeArraysToFormatInput(data) {
28
- const variables = {};
29
- for (const v of data.variables || []) {
30
- if (v && v.id)
31
- variables[v.id] = v;
32
- }
33
- const variableCollections = {};
34
- for (const c of data.variableCollections || []) {
35
- if (c && c.id)
36
- variableCollections[c.id] = c;
37
- }
38
- return { variables, variableCollections };
39
- }
40
- /**
41
- * Resolve + format local variables, preferring the Desktop Bridge / cloud relay and
42
- * falling back to the Enterprise-only REST API only when no bridge is connected.
43
- *
44
- * @throws a bridge-pointing error when the bridge is unavailable AND the REST API
45
- * fails (e.g. 403 without Enterprise), so callers/LLMs retry via the bridge
46
- * instead of treating variables as inaccessible.
47
- */
48
- export async function resolveFormattedVariables(opts) {
49
- const { getDesktopConnector, getFigmaAPI, fileKey } = opts;
50
- const timeoutMs = opts.timeoutMs ?? 30000;
51
- // 1. Desktop Bridge / cloud relay — works on ANY plan. Preferred.
52
- if (getDesktopConnector) {
53
- try {
54
- const connector = await getDesktopConnector();
55
- const raw = await withTimeout(connector.getVariables(fileKey), timeoutMs, "Desktop Bridge variables");
56
- // EXECUTE_CODE responses nest the return value under `result`; unwrap so
57
- // both the live and cached plugin paths produce a uniform shape. See #68.
58
- const data = raw?.result?.variables ? raw.result : raw;
59
- if (data?.success && Array.isArray(data.variables)) {
60
- const formatted = formatVariables(bridgeArraysToFormatInput(data));
61
- logger.info({ source: "desktop_bridge", variableCount: formatted.variables.length }, "Resolved variables via Desktop Bridge");
62
- return { ...formatted, source: "desktop_bridge" };
63
- }
64
- logger.warn({ fileKey, error: data?.error }, "Desktop Bridge returned no variables; falling back to REST API");
65
- }
66
- catch (err) {
67
- logger.warn({ fileKey, error: err instanceof Error ? err.message : String(err) }, "Desktop Bridge variable fetch failed; falling back to REST API");
68
- }
69
- }
70
- // 2. REST Variables API — Enterprise only. Last resort.
71
- const api = await getFigmaAPI();
72
- try {
73
- const local = await withTimeout(api.getLocalVariables(fileKey), timeoutMs, "getLocalVariables");
74
- const formatted = formatVariables(local);
75
- logger.info({ source: "rest_api", variableCount: formatted.variables.length }, "Resolved variables via REST API");
76
- return { ...formatted, source: "rest_api" };
77
- }
78
- catch (restErr) {
79
- const msg = restErr instanceof Error ? restErr.message : String(restErr);
80
- throw new Error(`[figma-console-mcp] Could not read variables. The Figma Variables REST API ` +
81
- `is unavailable for this file (${msg}) — it requires an Enterprise plan. ` +
82
- `Connect the Figma Console MCP Desktop Bridge plugin (or pair it via Cloud Mode) ` +
83
- `to read variables on ANY plan, then retry.`);
84
- }
85
- }