@atezer/figma-mcp-bridge 1.3.2 → 1.4.1

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 (49) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +4 -3
  3. package/dist/core/plugin-bridge-server.d.ts +16 -1
  4. package/dist/core/plugin-bridge-server.d.ts.map +1 -1
  5. package/dist/core/plugin-bridge-server.js +62 -2
  6. package/dist/core/plugin-bridge-server.js.map +1 -1
  7. package/dist/core/response-guard.d.ts +37 -0
  8. package/dist/core/response-guard.d.ts.map +1 -0
  9. package/dist/core/response-guard.js +166 -0
  10. package/dist/core/response-guard.js.map +1 -0
  11. package/dist/local-plugin-only.d.ts.map +1 -1
  12. package/dist/local-plugin-only.js +247 -1
  13. package/dist/local-plugin-only.js.map +1 -1
  14. package/dist/local.js +1 -1
  15. package/f-mcp-plugin/code.js +43 -0
  16. package/f-mcp-plugin/ui.html +186 -0
  17. package/package.json +10 -2
  18. package/dist/browser/base.d.ts +0 -50
  19. package/dist/browser/base.d.ts.map +0 -1
  20. package/dist/browser/base.js +0 -6
  21. package/dist/browser/base.js.map +0 -1
  22. package/dist/browser/local.d.ts +0 -81
  23. package/dist/browser/local.d.ts.map +0 -1
  24. package/dist/browser/local.js +0 -283
  25. package/dist/browser/local.js.map +0 -1
  26. package/dist/cloudflare/browser/base.js +0 -5
  27. package/dist/cloudflare/browser/cloudflare.js +0 -156
  28. package/dist/cloudflare/browser-manager.js +0 -157
  29. package/dist/cloudflare/core/audit-log.js +0 -62
  30. package/dist/cloudflare/core/config.js +0 -163
  31. package/dist/cloudflare/core/console-monitor.js +0 -427
  32. package/dist/cloudflare/core/design-system-manifest.js +0 -260
  33. package/dist/cloudflare/core/enrichment/enrichment-service.js +0 -272
  34. package/dist/cloudflare/core/enrichment/index.js +0 -7
  35. package/dist/cloudflare/core/enrichment/relationship-mapper.js +0 -351
  36. package/dist/cloudflare/core/enrichment/style-resolver.js +0 -326
  37. package/dist/cloudflare/core/figma-api.js +0 -273
  38. package/dist/cloudflare/core/figma-desktop-connector.js +0 -1041
  39. package/dist/cloudflare/core/figma-reconstruction-spec.js +0 -402
  40. package/dist/cloudflare/core/figma-tools.js +0 -2919
  41. package/dist/cloudflare/core/figma-url.js +0 -48
  42. package/dist/cloudflare/core/logger.js +0 -53
  43. package/dist/cloudflare/core/plugin-bridge-connector.js +0 -197
  44. package/dist/cloudflare/core/plugin-bridge-server.js +0 -375
  45. package/dist/cloudflare/core/snippet-injector.js +0 -96
  46. package/dist/cloudflare/core/types/enriched.js +0 -5
  47. package/dist/cloudflare/core/types/index.js +0 -4
  48. package/dist/cloudflare/index.js +0 -1061
  49. package/dist/cloudflare/test-browser.js +0 -88
@@ -1,96 +0,0 @@
1
- /**
2
- * Snippet Injector
3
- * Generates and manages console-based data extraction snippets for Figma
4
- */
5
- import { createChildLogger } from './logger.js';
6
- const logger = createChildLogger({ component: 'snippet-injector' });
7
- export class SnippetInjector {
8
- /**
9
- * Generate variables extraction snippet for Figma console
10
- */
11
- generateVariablesSnippet() {
12
- return `
13
- (async () => {
14
- try {
15
- const vars = await figma.variables.getLocalVariablesAsync();
16
- const collections = await figma.variables.getLocalVariableCollectionsAsync();
17
-
18
- const payload = {
19
- timestamp: Date.now(),
20
- variables: vars.map(v => ({
21
- id: v.id,
22
- name: v.name,
23
- key: v.key,
24
- resolvedType: v.resolvedType,
25
- valuesByMode: v.valuesByMode,
26
- variableCollectionId: v.variableCollectionId,
27
- scopes: v.scopes,
28
- description: v.description,
29
- hiddenFromPublishing: v.hiddenFromPublishing
30
- })),
31
- variableCollections: collections.map(c => ({
32
- id: c.id,
33
- name: c.name,
34
- key: c.key,
35
- modes: c.modes.map(m => ({ modeId: m.modeId, name: m.name })),
36
- defaultModeId: c.defaultModeId,
37
- variableIds: c.variableIds
38
- }))
39
- };
40
-
41
- console.log('[MCP_VARIABLES]', JSON.stringify(payload), '[MCP_VARIABLES_END]');
42
- console.log('✅ Variables data captured! Run figma_get_variables({ parseFromConsole: true }) in Claude to retrieve.');
43
-
44
- } catch (error) {
45
- console.error('[MCP_VARIABLES_ERROR]', error.message);
46
- console.log('❌ Make sure you\\'re running this in a Figma file with variables.');
47
- }
48
- })();
49
- `.trim();
50
- }
51
- /**
52
- * Parse variables from console log entry
53
- */
54
- parseVariablesFromLog(logEntry) {
55
- try {
56
- // Check for marker
57
- if (!logEntry.message.includes('[MCP_VARIABLES]')) {
58
- return null;
59
- }
60
- // Extract JSON from args
61
- // The snippet logs: console.log('[MCP_VARIABLES]', JSON.stringify(payload), '[MCP_VARIABLES_END]')
62
- // So args[0] is the marker, args[1] is the JSON string
63
- const jsonStr = logEntry.args[1] || logEntry.args[0];
64
- if (!jsonStr) {
65
- throw new Error('No data found in console log');
66
- }
67
- const data = typeof jsonStr === 'string' ? JSON.parse(jsonStr) : jsonStr;
68
- logger.info({
69
- variableCount: data.variables?.length || 0,
70
- collectionCount: data.variableCollections?.length || 0,
71
- }, 'Successfully parsed variables from console log');
72
- return {
73
- variables: data.variables || [],
74
- variableCollections: data.variableCollections || [],
75
- timestamp: data.timestamp || Date.now(),
76
- };
77
- }
78
- catch (error) {
79
- logger.error({ error }, 'Failed to parse variables from console log');
80
- throw new Error(`Failed to parse variables from console log: ${error instanceof Error ? error.message : String(error)}`);
81
- }
82
- }
83
- /**
84
- * Find the most recent variables log entry
85
- */
86
- findVariablesLog(logs) {
87
- // Search in reverse (most recent first)
88
- for (let i = logs.length - 1; i >= 0; i--) {
89
- const log = logs[i];
90
- if (log.message.includes('[MCP_VARIABLES]')) {
91
- return log;
92
- }
93
- }
94
- return null;
95
- }
96
- }
@@ -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 F-MCP ATezer (Figma MCP Bridge)
3
- */
4
- export {};