@biolab/talk-to-figma 0.4.0 → 0.5.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/README.md +10 -8
- package/dist/cli.cjs +61 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +61 -0
- package/dist/cli.js.map +1 -1
- package/dist/talk_to_figma_mcp/server.cjs +61 -0
- package/dist/talk_to_figma_mcp/server.cjs.map +1 -1
- package/dist/talk_to_figma_mcp/server.js +61 -0
- package/dist/talk_to_figma_mcp/server.js.map +1 -1
- package/figma-plugin/code.js +106 -0
- package/figma-plugin/figma-plugin.zip +0 -0
- package/figma-plugin/manifest.json +2 -2
- package/figma-plugin/ui.html +15 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -145,10 +145,18 @@ https://cdn.jsdelivr.net/npm/@biolab/talk-to-figma@latest/figma-plugin/figma-plu
|
|
|
145
145
|
bun install # Install dependencies
|
|
146
146
|
bun run build # Build MCP server + relay (tsup → dist/)
|
|
147
147
|
bun run dev # Build in watch mode
|
|
148
|
-
bun socket # Start WebSocket relay (Bun-native, dev only)
|
|
149
148
|
```
|
|
150
149
|
|
|
151
|
-
|
|
150
|
+
### Start the relay (pick one)
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
bun socket # Bun-native relay (dev only, uses src/socket.ts)
|
|
154
|
+
node dist/cli.js --relay # Node-compatible relay (same as npm package)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Both run on port 3055 by default (`PORT` env to override).
|
|
158
|
+
|
|
159
|
+
### Point MCP config to local build
|
|
152
160
|
|
|
153
161
|
```json
|
|
154
162
|
{
|
|
@@ -161,12 +169,6 @@ For local dev, point your MCP config to the built CLI:
|
|
|
161
169
|
}
|
|
162
170
|
```
|
|
163
171
|
|
|
164
|
-
Start the relay locally:
|
|
165
|
-
|
|
166
|
-
```bash
|
|
167
|
-
node dist/cli.js --relay
|
|
168
|
-
```
|
|
169
|
-
|
|
170
172
|
## Project Structure
|
|
171
173
|
|
|
172
174
|
- `src/cli.ts` - CLI entry point (routes `--relay` flag)
|
package/dist/cli.cjs
CHANGED
|
@@ -1510,6 +1510,67 @@ ${failedResults.map(
|
|
|
1510
1510
|
}
|
|
1511
1511
|
}
|
|
1512
1512
|
);
|
|
1513
|
+
server.tool(
|
|
1514
|
+
"create_component",
|
|
1515
|
+
"Convert an existing node (typically a frame) into a reusable Figma Component. The node must not be nested inside another component, component set, or instance.",
|
|
1516
|
+
{
|
|
1517
|
+
nodeId: import_zod.z.string().describe("ID of the node to convert into a component")
|
|
1518
|
+
},
|
|
1519
|
+
async ({ nodeId }) => {
|
|
1520
|
+
try {
|
|
1521
|
+
const result = await sendCommandToFigma("create_component", { nodeId });
|
|
1522
|
+
const typedResult = result;
|
|
1523
|
+
return {
|
|
1524
|
+
content: [
|
|
1525
|
+
{
|
|
1526
|
+
type: "text",
|
|
1527
|
+
text: `Created component "${typedResult.name}" with ID: ${typedResult.id}, key: ${typedResult.key}`
|
|
1528
|
+
}
|
|
1529
|
+
]
|
|
1530
|
+
};
|
|
1531
|
+
} catch (error) {
|
|
1532
|
+
return {
|
|
1533
|
+
content: [
|
|
1534
|
+
{
|
|
1535
|
+
type: "text",
|
|
1536
|
+
text: `Error creating component: ${error instanceof Error ? error.message : String(error)}`
|
|
1537
|
+
}
|
|
1538
|
+
]
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
);
|
|
1543
|
+
server.tool(
|
|
1544
|
+
"create_component_set",
|
|
1545
|
+
"Combine multiple Component nodes into a single ComponentSet (variant component). All provided nodes must already be Components (use create_component first). Components should use naming like 'property=value, property=value' for Figma to auto-detect variant properties.",
|
|
1546
|
+
{
|
|
1547
|
+
nodeIds: import_zod.z.array(import_zod.z.string()).min(1).describe("Array of Component node IDs to combine into a variant set"),
|
|
1548
|
+
parentId: import_zod.z.string().optional().describe("Optional parent node ID. Defaults to the first component's parent.")
|
|
1549
|
+
},
|
|
1550
|
+
async ({ nodeIds, parentId }) => {
|
|
1551
|
+
try {
|
|
1552
|
+
const result = await sendCommandToFigma("create_component_set", { nodeIds, parentId });
|
|
1553
|
+
const typedResult = result;
|
|
1554
|
+
return {
|
|
1555
|
+
content: [
|
|
1556
|
+
{
|
|
1557
|
+
type: "text",
|
|
1558
|
+
text: `Created component set "${typedResult.name}" with ID: ${typedResult.id}, containing ${typedResult.childCount} variants`
|
|
1559
|
+
}
|
|
1560
|
+
]
|
|
1561
|
+
};
|
|
1562
|
+
} catch (error) {
|
|
1563
|
+
return {
|
|
1564
|
+
content: [
|
|
1565
|
+
{
|
|
1566
|
+
type: "text",
|
|
1567
|
+
text: `Error creating component set: ${error instanceof Error ? error.message : String(error)}`
|
|
1568
|
+
}
|
|
1569
|
+
]
|
|
1570
|
+
};
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
);
|
|
1513
1574
|
server.tool(
|
|
1514
1575
|
"get_instance_overrides",
|
|
1515
1576
|
"Get all override properties from a selected component instance. These overrides can be applied to other instances, which will swap them to match the source component.",
|