@dannote/figma-use 0.5.9 → 0.6.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.6.1] - 2026-01-19
11
+
12
+ ### Fixed
13
+
14
+ - `--timeout` now applies to single commands (e.g., `eval`) via proxy `/command`
15
+ - CLI now works after global install ([#1](https://github.com/dannote/figma-use/issues/1))
16
+ - Move `kiwi-schema` to devDependencies (already bundled into dist)
17
+
18
+ ## [0.6.0] - 2026-01-18
19
+
20
+ ### Added
21
+
22
+ - **`node bounds`** — get node position, size, center point, edges
23
+ - **`path` commands** — vector path manipulation:
24
+ - `path get <id>` — read SVG path data
25
+ - `path set <id> "M..."` — replace path data
26
+ - `path move <id> --dx --dy` — translate all points
27
+ - `path scale <id> --factor` — scale from center
28
+ - `path flip <id> --axis x|y` — mirror horizontally/vertically
29
+ - Uses [svgpath](https://github.com/fontello/svgpath) library for path transformations
30
+ - Path command tests
31
+
10
32
  ## [0.5.9] - 2026-01-18
11
33
 
12
34
  ### Changed
package/README.md CHANGED
@@ -12,11 +12,24 @@ No JSON schemas, no MCP protocol overhead — just JSX that any LLM can write.
12
12
 
13
13
  📄 **Includes [SKILL.md](./SKILL.md)** — drop-in reference for Claude Code and other AI agents.
14
14
 
15
+ ## Demo
16
+
17
+ <table>
18
+ <tr>
19
+ <td width="50%">
15
20
  <a href="https://youtu.be/9eSYVZRle7o">
16
- <img src="https://img.youtube.com/vi/9eSYVZRle7o/maxresdefault.jpg" alt="Watch demo on YouTube" width="100%">
21
+ <img src="https://img.youtube.com/vi/9eSYVZRle7o/maxresdefault.jpg" alt="Button components demo" width="100%">
17
22
  </a>
18
-
19
- **▶️ [Watch the demo](https://youtu.be/9eSYVZRle7o)** — AI builds a button component set in Figma in seconds.
23
+ <p align="center"><b>▶️ Button components</b></p>
24
+ </td>
25
+ <td width="50%">
26
+ <a href="https://youtu.be/efJWp2Drzb4">
27
+ <img src="https://img.youtube.com/vi/efJWp2Drzb4/maxresdefault.jpg" alt="Calendar demo" width="100%">
28
+ </a>
29
+ <p align="center"><b>▶️ Tailwind UI calendar</b></p>
30
+ </td>
31
+ </tr>
32
+ </table>
20
33
 
21
34
  ## Why CLI over MCP?
22
35
 
@@ -230,11 +243,23 @@ figma-use set effect <id> --type DROP_SHADOW --radius 10 --color "#00000040"
230
243
  figma-use node get <id> # Get node properties
231
244
  figma-use node tree # Page structure as readable tree
232
245
  figma-use node children <id> # List children
246
+ figma-use node bounds <id> # Position, size, center point
233
247
  figma-use find --name "Button" # Find by name
234
248
  figma-use find --type FRAME # Find by type
235
249
  figma-use selection get # Current selection
236
250
  ```
237
251
 
252
+ ### Vector Paths
253
+
254
+ ```bash
255
+ figma-use create vector --x 0 --y 0 --path "M 0 0 L 100 50 L 0 100 Z" --fill "#F00"
256
+ figma-use path get <id> # Read path data
257
+ figma-use path set <id> "M 0 0 ..." # Replace path
258
+ figma-use path move <id> --dx 10 --dy -5 # Translate points
259
+ figma-use path scale <id> --factor 1.5 # Scale from center
260
+ figma-use path flip <id> --axis x # Mirror horizontally
261
+ ```
262
+
238
263
  ### Export
239
264
 
240
265
  ```bash
package/SKILL.md CHANGED
@@ -34,6 +34,61 @@ figma-use plugin install
34
34
 
35
35
  ---
36
36
 
37
+ ## ⚠️ Incremental Updates (CRITICAL)
38
+
39
+ **After initial render, NEVER re-render the full JSX tree.**
40
+
41
+ When modifying an existing design:
42
+ 1. Save node IDs from the initial render (`--json` output)
43
+ 2. Use targeted CLI commands to modify individual nodes
44
+ 3. Only re-render if the structure fundamentally changes (>50% new elements)
45
+
46
+ ### Modify properties by ID
47
+ ```bash
48
+ figma-use set fill <id> "#FF0000" # Change color
49
+ figma-use set opacity <id> 0.5 # Change opacity
50
+ figma-use set radius <id> 12 # Change corner radius
51
+ figma-use node resize <id> --width 300 --height 200
52
+ figma-use node move <id> --x 100 --y 200
53
+ figma-use node rename <id> "New Name"
54
+ ```
55
+
56
+ ### Add new elements to existing parent
57
+ ```bash
58
+ figma-use create rect --parent <parent-id> --width 50 --height 50 --fill "#00F"
59
+ figma-use create text --parent <parent-id> --text "Label" --fontSize 14
60
+ ```
61
+
62
+ ### Delete elements
63
+ ```bash
64
+ figma-use node delete <id>
65
+ ```
66
+
67
+ ### Example: Fixing transparency issues
68
+ ```bash
69
+ # BAD: Re-rendering 60 elements to fix one opacity
70
+ cat <<'EOF' | figma-use render --stdin
71
+ <Frame>... 60 elements ...</Frame>
72
+ EOF
73
+
74
+ # GOOD: Fix the specific node
75
+ figma-use set opacity 123:456 1.0
76
+ ```
77
+
78
+ ### Example: Adjusting colors after critique
79
+ ```bash
80
+ # Change shadow color from black to warm orange
81
+ figma-use set fill 123:789 "#D97706"
82
+
83
+ # Move misaligned element
84
+ figma-use node move 123:790 --x 240 --y 100
85
+
86
+ # Resize tail to better proportions
87
+ figma-use node resize 123:791 --width 120 --height 30
88
+ ```
89
+
90
+ ---
91
+
37
92
  ## JSX Rendering (Fastest Way)
38
93
 
39
94
  Use `render --stdin` with **pure JSX only**. No variables, no functions, no imports — just JSX tags:
@@ -315,3 +370,76 @@ figma-use set text "I123:456;789:10" "New text" # Modify text inside instance
315
370
  figma-use find --type FRAME 2>&1 | grep "stroke: #EF4444" # Red border
316
371
  figma-use find --type TEXT 2>&1 | grep "Bold" # Bold text
317
372
  ```
373
+
374
+ ---
375
+
376
+ ## Vector Drawing
377
+
378
+ Work iteratively: bounds → draw → screenshot → adjust → repeat.
379
+
380
+ ### Path Commands
381
+
382
+ ```bash
383
+ figma-use node bounds <id> # Position, size, center
384
+ figma-use create vector --path "M 0 0 L 100 50 Z" --fill "#F00"
385
+ figma-use path get <id> # Read path data
386
+ figma-use path set <id> "M 0 0 L 100 100 Z" # Replace path
387
+ figma-use path move <id> --dx 10 --dy -5 # Translate points
388
+ figma-use path scale <id> --factor 1.5 # Scale from center
389
+ figma-use path flip <id> --axis x # Mirror horizontally
390
+ figma-use path flip <id> --axis y # Mirror vertically
391
+ ```
392
+
393
+ ### SVG Path Syntax
394
+
395
+ ```
396
+ M x y Move to L x y Line to
397
+ H x Horizontal to V y Vertical to
398
+ C x1 y1 x2 y2 x y Cubic Bezier Q x1 y1 x y Quadratic Bezier
399
+ Z Close path
400
+ ```
401
+
402
+ ### Iterative Workflow
403
+
404
+ ```bash
405
+ # 1. Create canvas, get bounds
406
+ figma-use create frame --width 300 --height 300 --fill "#F0F4FF" --name "Drawing"
407
+ figma-use node bounds 123:456
408
+
409
+ # 2. Draw shape with Bezier curves
410
+ figma-use create vector --path "M 80 180 C 50 180 50 140 80 140 C 180 130 200 150 180 195 Z" --fill "#FFD700" --parent 123:456
411
+
412
+ # 3. Screenshot to verify
413
+ figma-use export node 123:456 --output /tmp/check.png
414
+
415
+ # 4. Adjust if needed
416
+ figma-use path scale 123:457 --factor 0.9
417
+ figma-use path move 123:457 --dx 20 --dy 0
418
+
419
+ # 5. Get bounds of first shape, position next relative to it
420
+ figma-use node bounds 123:457
421
+ ```
422
+
423
+ ### Common Shapes
424
+
425
+ ```bash
426
+ # Triangle
427
+ figma-use create vector --path "M 50 0 L 100 100 L 0 100 Z" --fill "#F00"
428
+
429
+ # Star
430
+ figma-use create vector --path "M 50 0 L 61 35 L 98 35 L 68 57 L 79 91 L 50 70 L 21 91 L 32 57 L 2 35 L 39 35 Z" --fill "#FFD700"
431
+
432
+ # Heart
433
+ figma-use create vector --path "M 50 90 C 20 60 0 30 25 10 C 40 0 50 10 50 25 C 50 10 60 0 75 10 C 100 30 80 60 50 90 Z" --fill "#E11D48"
434
+
435
+ # Arrow right
436
+ figma-use create vector --path "M 0 20 L 60 20 L 60 10 L 80 25 L 60 40 L 60 30 L 0 30 Z" --fill "#000"
437
+ ```
438
+
439
+ ### Complex Illustrations
440
+
441
+ For intricate artwork, import SVG instead:
442
+
443
+ ```bash
444
+ figma-use import --svg "$(cat icon.svg)"
445
+ ```
package/bin/figma-use.js CHANGED
@@ -4,10 +4,7 @@ import { fileURLToPath } from 'url'
4
4
  import { dirname, join } from 'path'
5
5
 
6
6
  const __dirname = dirname(fileURLToPath(import.meta.url))
7
-
8
- // Use source files directly (Bun handles TypeScript)
9
- // This ensures defineComponent registry is shared with imported .figma.tsx files
10
- const cliPath = join(__dirname, '..', 'packages', 'cli', 'src', 'index.ts')
7
+ const cliPath = join(__dirname, '..', 'dist', 'cli', 'index.js')
11
8
 
12
9
  const child = spawn('bun', ['run', cliPath, ...process.argv.slice(2)], { stdio: 'inherit' })
13
10
  child.on('exit', (code) => process.exit(code || 0))