@atezer/figma-mcp-bridge 1.4.0 → 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 (34) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/package.json +10 -2
  3. package/dist/browser/base.d.ts +0 -50
  4. package/dist/browser/base.d.ts.map +0 -1
  5. package/dist/browser/base.js +0 -6
  6. package/dist/browser/base.js.map +0 -1
  7. package/dist/browser/local.d.ts +0 -81
  8. package/dist/browser/local.d.ts.map +0 -1
  9. package/dist/browser/local.js +0 -283
  10. package/dist/browser/local.js.map +0 -1
  11. package/dist/cloudflare/browser/base.js +0 -5
  12. package/dist/cloudflare/browser/cloudflare.js +0 -156
  13. package/dist/cloudflare/browser-manager.js +0 -157
  14. package/dist/cloudflare/core/audit-log.js +0 -62
  15. package/dist/cloudflare/core/config.js +0 -163
  16. package/dist/cloudflare/core/console-monitor.js +0 -427
  17. package/dist/cloudflare/core/design-system-manifest.js +0 -260
  18. package/dist/cloudflare/core/enrichment/enrichment-service.js +0 -272
  19. package/dist/cloudflare/core/enrichment/index.js +0 -7
  20. package/dist/cloudflare/core/enrichment/relationship-mapper.js +0 -351
  21. package/dist/cloudflare/core/enrichment/style-resolver.js +0 -326
  22. package/dist/cloudflare/core/figma-api.js +0 -273
  23. package/dist/cloudflare/core/figma-desktop-connector.js +0 -1041
  24. package/dist/cloudflare/core/figma-reconstruction-spec.js +0 -402
  25. package/dist/cloudflare/core/figma-tools.js +0 -2919
  26. package/dist/cloudflare/core/figma-url.js +0 -48
  27. package/dist/cloudflare/core/logger.js +0 -53
  28. package/dist/cloudflare/core/plugin-bridge-connector.js +0 -197
  29. package/dist/cloudflare/core/plugin-bridge-server.js +0 -375
  30. package/dist/cloudflare/core/snippet-injector.js +0 -96
  31. package/dist/cloudflare/core/types/enriched.js +0 -5
  32. package/dist/cloudflare/core/types/index.js +0 -4
  33. package/dist/cloudflare/index.js +0 -1061
  34. 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 {};