figma-console-mcp 0.1.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.
Files changed (118) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +328 -0
  3. package/dist/browser/base.d.ts +50 -0
  4. package/dist/browser/base.d.ts.map +1 -0
  5. package/dist/browser/base.js +6 -0
  6. package/dist/browser/base.js.map +1 -0
  7. package/dist/browser/local.d.ts +66 -0
  8. package/dist/browser/local.d.ts.map +1 -0
  9. package/dist/browser/local.js +223 -0
  10. package/dist/browser/local.js.map +1 -0
  11. package/dist/cloudflare/browser/base.js +5 -0
  12. package/dist/cloudflare/browser/cloudflare.js +156 -0
  13. package/dist/cloudflare/browser-manager.js +157 -0
  14. package/dist/cloudflare/core/config.js +161 -0
  15. package/dist/cloudflare/core/console-monitor.js +382 -0
  16. package/dist/cloudflare/core/enrichment/enrichment-service.js +272 -0
  17. package/dist/cloudflare/core/enrichment/index.js +7 -0
  18. package/dist/cloudflare/core/enrichment/relationship-mapper.js +351 -0
  19. package/dist/cloudflare/core/enrichment/style-resolver.js +326 -0
  20. package/dist/cloudflare/core/figma-api.js +273 -0
  21. package/dist/cloudflare/core/figma-desktop-connector.js +383 -0
  22. package/dist/cloudflare/core/figma-style-extractor.js +311 -0
  23. package/dist/cloudflare/core/figma-tools.js +2299 -0
  24. package/dist/cloudflare/core/logger.js +53 -0
  25. package/dist/cloudflare/core/snippet-injector.js +96 -0
  26. package/dist/cloudflare/core/types/enriched.js +5 -0
  27. package/dist/cloudflare/core/types/index.js +4 -0
  28. package/dist/cloudflare/index.js +1059 -0
  29. package/dist/cloudflare/test-browser.js +88 -0
  30. package/dist/config.d.ts +17 -0
  31. package/dist/config.d.ts.map +1 -0
  32. package/dist/config.js +141 -0
  33. package/dist/config.js.map +1 -0
  34. package/dist/core/config.d.ts +17 -0
  35. package/dist/core/config.d.ts.map +1 -0
  36. package/dist/core/config.js +162 -0
  37. package/dist/core/config.js.map +1 -0
  38. package/dist/core/console-monitor.d.ts +81 -0
  39. package/dist/core/console-monitor.d.ts.map +1 -0
  40. package/dist/core/console-monitor.js +383 -0
  41. package/dist/core/console-monitor.js.map +1 -0
  42. package/dist/core/enrichment/enrichment-service.d.ts +52 -0
  43. package/dist/core/enrichment/enrichment-service.d.ts.map +1 -0
  44. package/dist/core/enrichment/enrichment-service.js +273 -0
  45. package/dist/core/enrichment/enrichment-service.js.map +1 -0
  46. package/dist/core/enrichment/index.d.ts +8 -0
  47. package/dist/core/enrichment/index.d.ts.map +1 -0
  48. package/dist/core/enrichment/index.js +8 -0
  49. package/dist/core/enrichment/index.js.map +1 -0
  50. package/dist/core/enrichment/relationship-mapper.d.ts +106 -0
  51. package/dist/core/enrichment/relationship-mapper.d.ts.map +1 -0
  52. package/dist/core/enrichment/relationship-mapper.js +352 -0
  53. package/dist/core/enrichment/relationship-mapper.js.map +1 -0
  54. package/dist/core/enrichment/style-resolver.d.ts +80 -0
  55. package/dist/core/enrichment/style-resolver.d.ts.map +1 -0
  56. package/dist/core/enrichment/style-resolver.js +327 -0
  57. package/dist/core/enrichment/style-resolver.js.map +1 -0
  58. package/dist/core/figma-api.d.ts +137 -0
  59. package/dist/core/figma-api.d.ts.map +1 -0
  60. package/dist/core/figma-api.js +274 -0
  61. package/dist/core/figma-api.js.map +1 -0
  62. package/dist/core/figma-desktop-connector.d.ts +52 -0
  63. package/dist/core/figma-desktop-connector.d.ts.map +1 -0
  64. package/dist/core/figma-desktop-connector.js +384 -0
  65. package/dist/core/figma-desktop-connector.js.map +1 -0
  66. package/dist/core/figma-style-extractor.d.ts +76 -0
  67. package/dist/core/figma-style-extractor.d.ts.map +1 -0
  68. package/dist/core/figma-style-extractor.js +312 -0
  69. package/dist/core/figma-style-extractor.js.map +1 -0
  70. package/dist/core/figma-tools.d.ts +15 -0
  71. package/dist/core/figma-tools.d.ts.map +1 -0
  72. package/dist/core/figma-tools.js +2300 -0
  73. package/dist/core/figma-tools.js.map +1 -0
  74. package/dist/core/logger.d.ts +22 -0
  75. package/dist/core/logger.d.ts.map +1 -0
  76. package/dist/core/logger.js +54 -0
  77. package/dist/core/logger.js.map +1 -0
  78. package/dist/core/snippet-injector.d.ts +24 -0
  79. package/dist/core/snippet-injector.d.ts.map +1 -0
  80. package/dist/core/snippet-injector.js +97 -0
  81. package/dist/core/snippet-injector.js.map +1 -0
  82. package/dist/core/types/enriched.d.ts +213 -0
  83. package/dist/core/types/enriched.d.ts.map +1 -0
  84. package/dist/core/types/enriched.js +6 -0
  85. package/dist/core/types/enriched.js.map +1 -0
  86. package/dist/core/types/index.d.ts +112 -0
  87. package/dist/core/types/index.d.ts.map +1 -0
  88. package/dist/core/types/index.js +5 -0
  89. package/dist/core/types/index.js.map +1 -0
  90. package/dist/index.d.ts +8 -0
  91. package/dist/index.d.ts.map +1 -0
  92. package/dist/index.js +72 -0
  93. package/dist/index.js.map +1 -0
  94. package/dist/local.d.ts +57 -0
  95. package/dist/local.d.ts.map +1 -0
  96. package/dist/local.js +668 -0
  97. package/dist/local.js.map +1 -0
  98. package/dist/logger.d.ts +22 -0
  99. package/dist/logger.d.ts.map +1 -0
  100. package/dist/logger.js +45 -0
  101. package/dist/logger.js.map +1 -0
  102. package/dist/server.d.ts +40 -0
  103. package/dist/server.d.ts.map +1 -0
  104. package/dist/server.js +99 -0
  105. package/dist/server.js.map +1 -0
  106. package/dist/tools/index.d.ts +15 -0
  107. package/dist/tools/index.d.ts.map +1 -0
  108. package/dist/tools/index.js +184 -0
  109. package/dist/tools/index.js.map +1 -0
  110. package/dist/types/index.d.ts +102 -0
  111. package/dist/types/index.d.ts.map +1 -0
  112. package/dist/types/index.js +6 -0
  113. package/dist/types/index.js.map +1 -0
  114. package/figma-desktop-bridge/README.md +232 -0
  115. package/figma-desktop-bridge/code.js +133 -0
  116. package/figma-desktop-bridge/manifest.json +13 -0
  117. package/figma-desktop-bridge/ui.html +200 -0
  118. package/package.json +77 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Figma Console MCP Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,328 @@
1
+ # Figma Console MCP Server
2
+
3
+ [![MCP](https://img.shields.io/badge/MCP-Compatible-blue)](https://modelcontextprotocol.io/)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ > **Model Context Protocol server** that provides AI assistants with **real-time console access, visual debugging, and design system extraction** for Figma.
7
+
8
+ ## What is this?
9
+
10
+ Figma Console MCP connects AI assistants (like Claude) to Figma, enabling:
11
+
12
+ - **🐛 Plugin debugging** - Capture console logs, errors, and stack traces
13
+ - **📸 Visual debugging** - Take screenshots for context
14
+ - **🎨 Design system extraction** - Pull variables, components, and styles
15
+ - **⚡ Real-time monitoring** - Watch logs as plugins execute
16
+ - **🔄 Two modes** - Remote (zero setup) or Local (plugin development)
17
+
18
+ ---
19
+
20
+ ## ⚡ Quick Start
21
+
22
+ Choose the setup that fits your needs:
23
+
24
+ ### For Most Users: Remote Mode (Zero Setup)
25
+
26
+ Perfect for design system extraction and basic debugging. No installation required!
27
+
28
+ #### Claude Desktop (Recommended)
29
+
30
+ **Latest Method - No Config Files!**
31
+
32
+ 1. Open Claude Desktop → **Settings** → **Connectors**
33
+ 2. Click **"Add Custom Connector"**
34
+ 3. Enter:
35
+ - **Name:** `Figma Console`
36
+ - **URL:** `https://figma-console-mcp.southleft.com/sse`
37
+ 4. Click **"Add"**
38
+ 5. Done! ✅
39
+
40
+ **What you get:**
41
+ - ✅ All 14 Figma tools available immediately
42
+ - ✅ OAuth authentication (automatic when you first use API tools)
43
+ - ✅ Design system extraction (variables*, components, styles)
44
+ - ✅ Console debugging and screenshots
45
+ - ❌ Desktop Bridge plugin NOT available (use Local Mode for that)
46
+
47
+ *Variables API requires Figma Enterprise plan OR use Local Mode + Desktop Bridge plugin
48
+
49
+ ---
50
+
51
+ #### Claude Code
52
+
53
+ One-line install:
54
+
55
+ ```bash
56
+ claude mcp add --transport sse figma-console https://figma-console-mcp.southleft.com/sse
57
+ ```
58
+
59
+ Verify: `/mcp` should show "figma-console: connected"
60
+
61
+ ---
62
+
63
+ #### Cursor
64
+
65
+ Add to `.cursor/mcp.json`:
66
+
67
+ ```json
68
+ {
69
+ "mcpServers": {
70
+ "figma-console": {
71
+ "command": "npx",
72
+ "args": ["-y", "mcp-remote", "https://figma-console-mcp.southleft.com/sse"]
73
+ }
74
+ }
75
+ }
76
+ ```
77
+
78
+ Restart Cursor after saving.
79
+
80
+ ---
81
+
82
+ <details>
83
+ <summary><b>Other MCP Clients (Windsurf, Zed, etc.)</b></summary>
84
+
85
+ Consult your client's MCP documentation for the config file location, then add:
86
+
87
+ ```json
88
+ {
89
+ "mcpServers": {
90
+ "figma-console": {
91
+ "command": "npx",
92
+ "args": ["-y", "mcp-remote", "https://figma-console-mcp.southleft.com/sse"]
93
+ }
94
+ }
95
+ }
96
+ ```
97
+
98
+ </details>
99
+
100
+ ---
101
+
102
+ ### For Plugin Developers: Local Mode
103
+
104
+ **Use Local Mode if you:**
105
+ - ✅ Are developing Figma plugins (need zero-latency console debugging)
106
+ - ✅ Need variables WITHOUT Enterprise plan (via Desktop Bridge plugin)
107
+ - ✅ Need reliable component descriptions (Figma API has bugs, plugin bypasses them)
108
+ - ✅ Want direct access to Figma Desktop state
109
+
110
+ **⚠️ Important:** The **Desktop Bridge plugin ONLY works in Local Mode**. Remote mode cannot access it because the plugin requires direct connection to Figma Desktop via `localhost:9222`.
111
+
112
+ **Setup time:** 10-15 minutes
113
+
114
+ **Prerequisites:**
115
+ - Node.js 18+
116
+ - Figma Desktop installed
117
+ - Terminal access
118
+
119
+ **[📖 See Local Mode Setup Guide](docs/CLAUDE_DESKTOP_SETUP_UPDATED.md#local-mode-setup-advanced)**
120
+
121
+ ---
122
+
123
+ ## 📊 Remote vs Local: Which Should I Use?
124
+
125
+ | Feature | Remote Mode | Local Mode |
126
+ |---------|-------------|------------|
127
+ | **Setup** | 2 minutes | 10-15 minutes |
128
+ | **Prerequisites** | None | Node.js, Figma restart |
129
+ | **Console logs** | ✅ | ✅ (lower latency) |
130
+ | **API access** | ✅ | ✅ |
131
+ | **OAuth auth** | ✅ (automatic) | ❌ (manual PAT) |
132
+ | **Desktop Bridge plugin** | ❌ | ✅ |
133
+ | **Variables (no Enterprise)** | ❌ | ✅ (via plugin) |
134
+ | **Reliable component descriptions** | ⚠️ (API bugs) | ✅ (via plugin) |
135
+
136
+ **📖 [Complete Feature Comparison](docs/MODE_COMPARISON.md)**
137
+
138
+ ---
139
+
140
+ ## 🎯 Test Your Connection
141
+
142
+ After setup, try these prompts:
143
+
144
+ **Basic test (both modes):**
145
+ ```
146
+ Navigate to https://www.figma.com and check status
147
+ ```
148
+
149
+ **Design system test (requires auth):**
150
+ ```
151
+ Get design variables from [your Figma file URL]
152
+ ```
153
+
154
+ **Plugin test (Local Mode only):**
155
+ ```
156
+ Show me the primary font for [your theme name]
157
+ ```
158
+
159
+ ---
160
+
161
+ ## 🔐 Authentication
162
+
163
+ ### Remote Mode - OAuth (Automatic)
164
+
165
+ When you first use design system tools:
166
+ 1. Browser opens automatically to Figma authorization page
167
+ 2. Click "Allow" to authorize (one-time)
168
+ 3. Token stored securely and refreshed automatically
169
+ 4. Works with Free, Pro, and Enterprise Figma plans
170
+
171
+ ### Local Mode - Personal Access Token (Manual)
172
+
173
+ 1. Visit https://www.figma.com/developers/api#access-tokens
174
+ 2. Generate token
175
+ 3. Add to MCP config as `FIGMA_ACCESS_TOKEN` environment variable
176
+
177
+ ---
178
+
179
+ ## 🛠️ Available Tools
180
+
181
+ All 14 tools work in both Remote and Local modes:
182
+
183
+ ### Navigation & Status
184
+ - `figma_navigate` - Open Figma URLs
185
+ - `figma_get_status` - Check connection status
186
+
187
+ ### Console Debugging
188
+ - `figma_get_console_logs` - Retrieve console logs
189
+ - `figma_watch_console` - Real-time log streaming
190
+ - `figma_clear_console` - Clear log buffer
191
+ - `figma_reload_plugin` - Reload current page
192
+
193
+ ### Visual Debugging
194
+ - `figma_take_screenshot` - Capture UI screenshots
195
+
196
+ ### Design System Extraction
197
+ - `figma_get_variables` - Extract design tokens/variables
198
+ - `figma_get_component` - Get component data
199
+ - `figma_get_component_for_development` - Component + image
200
+ - `figma_get_component_image` - Just the image
201
+ - `figma_get_styles` - Color, text, effect styles
202
+ - `figma_get_file_data` - Full file structure
203
+ - `figma_get_file_for_plugin` - Optimized file data
204
+
205
+ **📖 [Detailed Tool Documentation](docs/TOOLS.md)**
206
+
207
+ ---
208
+
209
+ ## 📖 Example Prompts
210
+
211
+ ### Plugin Debugging
212
+ ```
213
+ Navigate to my Figma plugin and show me any console errors
214
+ Watch the console for 30 seconds while I test my plugin
215
+ Get the last 20 console logs
216
+ ```
217
+
218
+ ### Design System Extraction
219
+ ```
220
+ Get all design variables from https://figma.com/design/abc123
221
+ Extract color styles and show me the CSS exports
222
+ Get the Button component with a visual reference image
223
+ ```
224
+
225
+ ### Visual Debugging
226
+ ```
227
+ Take a screenshot of the current Figma canvas
228
+ Navigate to this file and capture what's on screen
229
+ ```
230
+
231
+ **📖 [More Use Cases & Examples](docs/USE_CASES.md)**
232
+
233
+ ---
234
+
235
+ ## 🎨 Desktop Bridge Plugin (Local Mode Only)
236
+
237
+ The **Figma Desktop Bridge** plugin enables:
238
+ - ✅ Variables without Enterprise API
239
+ - ✅ Reliable component descriptions (bypasses API bugs)
240
+ - ✅ Multi-mode support (Light/Dark/Brand variants)
241
+
242
+ **⚠️ Plugin Limitation:** Only works in Local Mode. Remote mode cannot access it.
243
+
244
+ **Setup:**
245
+ 1. Install Local Mode MCP
246
+ 2. Download plugin from [Releases](https://github.com/southleft/figma-console-mcp/releases/latest)
247
+ 3. Import plugin: Figma Desktop → Plugins → Development → Import plugin from manifest
248
+ 4. Run plugin in your Figma file
249
+ 5. Ask Claude: "Show me the primary font for [your theme]"
250
+
251
+ **📖 [Desktop Bridge Documentation](figma-desktop-bridge/README.md)**
252
+
253
+ ---
254
+
255
+ ## 🚀 Advanced Topics
256
+
257
+ - **[Local Mode Setup](docs/CLAUDE_DESKTOP_SETUP_UPDATED.md)** - Complete local installation guide
258
+ - **[Self-Hosting](docs/SELF_HOSTING.md)** - Deploy your own instance on Cloudflare
259
+ - **[Architecture](docs/ARCHITECTURE.md)** - How it works under the hood
260
+ - **[OAuth Setup](docs/OAUTH_SETUP.md)** - Configure OAuth for self-hosted deployments
261
+ - **[Troubleshooting](docs/TROUBLESHOOTING.md)** - Common issues and solutions
262
+
263
+ ---
264
+
265
+ ## 🤝 vs. Figma Official MCP
266
+
267
+ **Figma Console MCP (This Project)** - Debugging & data extraction
268
+ - ✅ Real-time console logs from Figma plugins
269
+ - ✅ Screenshot capture and visual debugging
270
+ - ✅ Error stack traces and runtime monitoring
271
+ - ✅ Raw design data extraction (JSON)
272
+ - ✅ Works remotely or locally
273
+
274
+ **Figma Official Dev Mode MCP** - Code generation
275
+ - ✅ Generates React/HTML code from designs
276
+ - ✅ Tailwind/CSS class generation
277
+ - ✅ Component boilerplate scaffolding
278
+
279
+ **Use both together** for the complete workflow: generate code with Official MCP, then debug and extract data with Console MCP.
280
+
281
+ ---
282
+
283
+ ## 🛤️ Roadmap
284
+
285
+ - [ ] **Real-time collaboration** - Multi-user debugging sessions
286
+ - [ ] **Component screenshot diffs** - Visual regression testing
287
+ - [ ] **Batch operations** - Process multiple files at once
288
+ - [ ] **Design linting** - Automated compliance checks
289
+ - [ ] **Plugin template generation** - Generate plugin boilerplate
290
+
291
+ **📖 [Full Roadmap](docs/ROADMAP.md)**
292
+
293
+ ---
294
+
295
+ ## 💻 Development
296
+
297
+ ```bash
298
+ git clone https://github.com/southleft/figma-console-mcp.git
299
+ cd figma-console-mcp
300
+ npm install
301
+
302
+ # Local mode development
303
+ npm run dev:local
304
+
305
+ # Cloud mode development
306
+ npm run dev
307
+
308
+ # Build
309
+ npm run build
310
+ ```
311
+
312
+ **📖 [Development Guide](docs/ARCHITECTURE.md)**
313
+
314
+ ---
315
+
316
+ ## 📄 License
317
+
318
+ MIT - See [LICENSE](LICENSE) file for details.
319
+
320
+ ---
321
+
322
+ ## 🔗 Links
323
+
324
+ - 📖 [Full Documentation](docs/)
325
+ - 🐛 [Report Issues](https://github.com/southleft/figma-console-mcp/issues)
326
+ - 💬 [Discussions](https://github.com/southleft/figma-console-mcp/discussions)
327
+ - 🌐 [Model Context Protocol](https://modelcontextprotocol.io/)
328
+ - 🎨 [Figma API](https://www.figma.com/developers/api)
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Browser Manager Interface
3
+ * Abstract interface for browser automation across different runtimes
4
+ */
5
+ /**
6
+ * Browser Manager Interface
7
+ * Provides unified API for browser automation regardless of runtime (Cloudflare/Local)
8
+ *
9
+ * Note: Uses 'any' for Page type to support both puppeteer-core and @cloudflare/puppeteer
10
+ * implementations which have incompatible type definitions but compatible runtime behavior
11
+ */
12
+ export interface IBrowserManager {
13
+ /**
14
+ * Launch or connect to browser instance
15
+ */
16
+ launch(): Promise<void>;
17
+ /**
18
+ * Get active page instance
19
+ */
20
+ getPage(): Promise<any>;
21
+ /**
22
+ * Navigate to Figma URL
23
+ */
24
+ navigateToFigma(url?: string): Promise<any>;
25
+ /**
26
+ * Reload current page
27
+ */
28
+ reload(hardReload?: boolean): Promise<void>;
29
+ /**
30
+ * Evaluate JavaScript in page context
31
+ */
32
+ evaluate<T>(fn: () => T): Promise<T>;
33
+ /**
34
+ * Check if browser is running
35
+ */
36
+ isRunning(): boolean;
37
+ /**
38
+ * Close browser instance
39
+ */
40
+ close(): Promise<void>;
41
+ /**
42
+ * Get current URL
43
+ */
44
+ getCurrentUrl(): string | null;
45
+ /**
46
+ * Wait for navigation to complete
47
+ */
48
+ waitForNavigation(timeout?: number): Promise<void>;
49
+ }
50
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/browser/base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAExB;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;IAExB;;OAEG;IACH,eAAe,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAE5C;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5C;;OAEG;IACH,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAKrC;;OAEG;IACH,SAAS,IAAI,OAAO,CAAC;IAErB;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;OAEG;IACH,aAAa,IAAI,MAAM,GAAG,IAAI,CAAC;IAE/B;;OAEG;IACH,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Browser Manager Interface
3
+ * Abstract interface for browser automation across different runtimes
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/browser/base.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Local Browser Manager
3
+ * Connects to Figma Desktop via Chrome Remote Debugging Protocol
4
+ */
5
+ import { type Page } from 'puppeteer-core';
6
+ import type { IBrowserManager } from './base.js';
7
+ /**
8
+ * Local browser configuration
9
+ */
10
+ export interface LocalBrowserConfig {
11
+ debugPort: number;
12
+ debugHost: string;
13
+ }
14
+ /**
15
+ * Local Browser Manager
16
+ * Connects to existing Figma Desktop instance via remote debugging port
17
+ */
18
+ export declare class LocalBrowserManager implements IBrowserManager {
19
+ private browser;
20
+ private page;
21
+ private config;
22
+ constructor(config: LocalBrowserConfig);
23
+ /**
24
+ * Connect to Figma Desktop via remote debugging port
25
+ */
26
+ launch(): Promise<void>;
27
+ /**
28
+ * Find the best page for plugin debugging
29
+ * Actively searches for pages with workers across ALL tabs
30
+ */
31
+ private findBestPage;
32
+ /**
33
+ * Get active Figma page or create new one
34
+ * Prefers pages with active plugin workers for plugin debugging
35
+ */
36
+ getPage(): Promise<Page>;
37
+ /**
38
+ * Navigate to Figma URL
39
+ */
40
+ navigateToFigma(figmaUrl?: string): Promise<Page>;
41
+ /**
42
+ * Reload current page
43
+ */
44
+ reload(hardReload?: boolean): Promise<void>;
45
+ /**
46
+ * Execute JavaScript in page context
47
+ */
48
+ evaluate<T>(fn: () => T): Promise<T>;
49
+ /**
50
+ * Check if browser is connected
51
+ */
52
+ isRunning(): boolean;
53
+ /**
54
+ * Disconnect from browser (doesn't close Figma Desktop)
55
+ */
56
+ close(): Promise<void>;
57
+ /**
58
+ * Get current page URL
59
+ */
60
+ getCurrentUrl(): string | null;
61
+ /**
62
+ * Wait for navigation
63
+ */
64
+ waitForNavigation(timeout?: number): Promise<void>;
65
+ }
66
+ //# sourceMappingURL=local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../src/browser/local.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAkB,EAAgB,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAIjD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,qBAAa,mBAAoB,YAAW,eAAe;IAC1D,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,MAAM,CAAqB;gBAEvB,MAAM,EAAE,kBAAkB;IAItC;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IA2C7B;;;OAGG;YACW,YAAY;IA4C1B;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAkC9B;;OAEG;IACG,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBvD;;OAEG;IACG,MAAM,CAAC,UAAU,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB/C;;OAEG;IACG,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAQ1C;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB5B;;OAEG;IACH,aAAa,IAAI,MAAM,GAAG,IAAI;IAQ9B;;OAEG;IACG,iBAAiB,CAAC,OAAO,SAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAUvD"}