@clovis500c/figma-bridge 0.0.0-stage → 1.8.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Clovis500c
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 CHANGED
@@ -1,3 +1,172 @@
1
- # Temporary Holding Version
1
+ # Figma Bridge
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![CI](https://github.com/Clovis500c/figma-bridge/actions/workflows/ci.yml/badge.svg)](https://github.com/Clovis500c/figma-bridge/actions/workflows/ci.yml)
4
+
5
+ **Let any AI agent design in the Figma desktop app, with no rate limits.**
6
+
7
+ Figma Bridge is a local [MCP](https://modelcontextprotocol.io) server plus a Figma plugin. Your agent gets full read and
8
+ write access to the open file through the Plugin API, not the web API: no tokens, no quotas.
9
+
10
+ Works with **Claude Code**, **Claude Desktop**, **Codex**, **Antigravity**, **Gemini CLI**, **Cursor**, **Windsurf**
11
+ and any other MCP client.
12
+
13
+ <p align="center"><img src="docs/plugin.jpg" alt="Figma Bridge plugin" width="620"></p>
14
+
15
+ ## Features
16
+
17
+ - **Build whole layouts in one call** from a JSON spec: auto-layout and grid, rich text, icons, images, component sets with variants and properties, prototype links.
18
+ - **Import any website or HTML** as editable auto-layout frames, one per viewport ([details](docs/import-web.md)).
19
+ - **Round-trip the design system**: write variables with Light/Dark modes and styles from JSON, W3C tokens or Tailwind; export them to DTCG, CSS, Tailwind v3/v4, SCSS or TypeScript ([details](docs/design-system.md)).
20
+ - **Score and fix design system health**: token coverage, contrast, text styles, detached instances, duplicates, naming, with safe automatic fixes.
21
+ - **Read existing designs** compactly, search every page, and reuse the file's design system.
22
+ - **Check its own work** with screenshots, a design audit, and a pixel diff against a mockup.
23
+ - **Hand off to your codebase**: export a frame into your project with its own components, tokens and stack (React, Next, Vue, Svelte, React Native; Tailwind, CSS modules, styled-components; shadcn, MUI, Chakra) ([details](docs/export-code.md)), plus Dev Mode annotations.
24
+ - **200 000+ icons** through Iconify, checkpoints to roll back, and a library of reusable scripts.
25
+ - **Zero-friction connection**: the plugin connects and reconnects on its own. Each AI command is one Ctrl+Z step, and you can cancel it from the plugin.
26
+
27
+ ## Installation
28
+
29
+ Requires [Node.js](https://nodejs.org) 20+ and the Figma **desktop** app.
30
+
31
+ 1. Run:
32
+
33
+ ```bash
34
+ npx @clovis500c/figma-bridge setup
35
+ ```
36
+
37
+ It adds Figma Bridge to every AI client installed on your machine (originals are backed up), copies the Figma
38
+ plugin to `~/.figma-bridge/plugin` and prints the path of its manifest.
39
+
40
+ 2. In Figma: **Plugins → Development → Import plugin from manifest…** and select that `manifest.json`.
41
+
42
+ 3. Restart your AI client, open a Figma file and run **Plugins → Development → Figma Bridge**. A green **Live** badge means it's connected.
43
+
44
+ To update the plugin later, run `npx @clovis500c/figma-bridge plugin` and reopen it in Figma.
45
+
46
+ <details>
47
+ <summary>With Bun instead of npm</summary>
48
+
49
+ Download the [latest release](https://github.com/Clovis500c/figma-bridge/releases/latest), unzip it, and run in that folder:
50
+
51
+ ```bash
52
+ bun install
53
+ bun run setup
54
+ ```
55
+
56
+ Then import `plugin/manifest.json` in Figma as in step 2.
57
+
58
+ </details>
59
+
60
+ <details>
61
+ <summary>Manual configuration</summary>
62
+
63
+ `npx @clovis500c/figma-bridge setup --print` prints these snippets. To target one client: `setup --client codex`.
64
+
65
+ Most clients (`mcpServers` in their JSON config):
66
+
67
+ ```json
68
+ {
69
+ "mcpServers": {
70
+ "FigmaBridge": {
71
+ "command": "npx",
72
+ "args": ["-y", "@clovis500c/figma-bridge"]
73
+ }
74
+ }
75
+ }
76
+ ```
77
+
78
+ On Windows, use `"command": "cmd"` and `"args": ["/c", "npx", "-y", "@clovis500c/figma-bridge"]`.
79
+
80
+ Codex (`~/.codex/config.toml`):
81
+
82
+ ```toml
83
+ [mcp_servers.FigmaBridge]
84
+ command = 'npx'
85
+ args = ['-y', '@clovis500c/figma-bridge']
86
+ startup_timeout_sec = 60
87
+ ```
88
+
89
+ | Client | Config file |
90
+ |---|---|
91
+ | Claude Code | `~/.claude.json` |
92
+ | Claude Desktop | `%APPDATA%\Claude\claude_desktop_config.json` |
93
+ | Codex | `~/.codex/config.toml` |
94
+ | Antigravity | `~/.gemini/antigravity/mcp_config.json` (or **Manage MCP Servers → View raw config**) |
95
+ | Gemini CLI | `~/.gemini/settings.json` |
96
+ | Cursor | `~/.cursor/mcp.json` |
97
+ | Windsurf | `~/.codeium/windsurf/mcp_config.json` |
98
+
99
+ </details>
100
+
101
+ ## Usage
102
+
103
+ Keep the plugin open (the **—** button collapses it to a thin bar) and ask your agent, for example:
104
+
105
+ > Design a mobile sign-in screen from scratch on a new page: logo, email and password fields, a primary button and a "Forgot password?" link.
106
+
107
+ > Create our design system from `tokens.json` (Light and Dark modes), then rebuild the selected screen with those variables and show it in Dark mode.
108
+
109
+ > Import https://example.com/pricing at desktop and mobile widths, then rename the layers and swap the fonts for ours.
110
+
111
+ > Reproduce `C:\mockups\dashboard.png` as an editable frame with auto-layout, compare it with the screenshot and fix the differences.
112
+
113
+ When your agent needs you to point at something, the plugin shows **Your agent is waiting** until you select it.
114
+ A running command has a **Cancel** button: `build` stops at the next layer, but a script cannot be interrupted and
115
+ finishes in the background.
116
+
117
+ To reopen the plugin later, use **Ctrl+Alt+P** or the **Figma Bridge** button in the right panel.
118
+
119
+ ## Tools
120
+
121
+ | Tool | Purpose |
122
+ |---|---|
123
+ | `build` | Create a layout from a JSON spec in one call: grid, rich text, variants, reactions |
124
+ | `import_web` | Rebuild a website or HTML as editable layers, one frame per viewport |
125
+ | `run_script` | Run any Figma Plugin API code |
126
+ | `describe` | Compact outline of existing layers |
127
+ | `find` | Search layers on every page by name, text, type, style or component |
128
+ | `get_design_system` | Local styles, variables and components |
129
+ | `design_tokens` | Write variables (with modes) and styles from JSON, W3C tokens or Tailwind; export them to DTCG, CSS, Tailwind, SCSS or TS |
130
+ | `audit` | Lint layers, score the design system's health, and apply safe fixes |
131
+ | `screenshot` | Export a layer to an image (optionally shown to the agent) |
132
+ | `compare` | Pixel-diff a layer against a reference image, with a heatmap |
133
+ | `wait_for_selection` | Ask the user to select layers and wait for it |
134
+ | `prototype` | Link frames (click, hover, transitions) and set flow starting points |
135
+ | `annotate` | Add, list or clear Dev Mode annotations |
136
+ | `export_code` | Export a frame to code; with `projectPath`, code that uses the project's components and tokens |
137
+ | `insert_icon` · `search_icons` | Iconify icons as editable vectors |
138
+ | `place_image` · `import_svg` | Images from disk or URL, SVG as vectors |
139
+ | `checkpoint` | Save layers and restore them later |
140
+ | `snippets` | Reusable script functions (`lib.name()` in scripts) |
141
+ | `get_context` · `get_css` · `list_fonts` | File info, generated CSS, installed fonts |
142
+ | `list_sessions` · `select_session` | Choose a file when several are open |
143
+
144
+ Each tool describes its parameters to the agent, which needs no extra instructions.
145
+
146
+ ## Troubleshooting
147
+
148
+ | Plugin status | Fix |
149
+ |---|---|
150
+ | **Offline** | The MCP server isn't running: start or restart your AI client and check that `FigmaBridge` is enabled. |
151
+ | **Port busy** | Another program uses port 3055. Close it; the plugin reconnects. |
152
+ | **Version mismatch** | The plugin and the server come from different releases: reopen the plugin, or update both. |
153
+
154
+ Logs, screenshots, comparison heatmaps and exported code are written to `%TEMP%\figma-bridge`.
155
+ `import_web` uses your installed Chrome or Edge; set `FIGMA_BRIDGE_BROWSER` to use another Chromium-based browser.
156
+
157
+ ## Development
158
+
159
+ ```bash
160
+ bun install # also builds the plugin and dist/server.js
161
+ bun run build # plugin/code.ts → plugin/code.js, src/cli.ts → dist/server.js (Node)
162
+ bun run check # type-check server and plugin, reject syntax Figma cannot run
163
+ bun test # unit tests (bridge, setup, schemas, tokens, code generation, web import)
164
+ bun run test # end-to-end test against an open Figma file
165
+ ```
166
+
167
+ To release, change `version` in `package.json`, then run **Actions → Release → Run workflow** on `main`: it publishes to
168
+ npm and creates the GitHub release.
169
+
170
+ Options: `FIGMA_BRIDGE_PORT` (default `3055`), `FIGMA_BRIDGE_CHANNEL`, `FIGMA_BRIDGE_OUT`, `FIGMA_BRIDGE_SNIPPETS`,
171
+ `FIGMA_BRIDGE_BROWSER`.
172
+ The server listens on `127.0.0.1` only, and browsers can't send it commands.