@dannote/figma-use 0.1.4 → 0.2.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/SKILL.md ADDED
@@ -0,0 +1,173 @@
1
+ ---
2
+ name: figma-use
3
+ description: Control Figma via CLI — create shapes, frames, text, components, set styles, layout, variables, export images. Use when asked to create/modify Figma designs or automate design tasks.
4
+ ---
5
+
6
+ # Figma Use
7
+
8
+ Full control over Figma from the command line.
9
+
10
+ ## Setup
11
+
12
+ ```bash
13
+ bun install -g @dannote/figma-use
14
+ figma-use plugin # Install plugin (quit Figma first!)
15
+ figma-use proxy # Start proxy server
16
+ # Open Figma → Plugins → Development → Figma Use
17
+ ```
18
+
19
+ ## Quick Reference
20
+
21
+ ### Create Shapes
22
+
23
+ ```bash
24
+ figma-use create rect --x 0 --y 0 --width 100 --height 50 --fill "#FF0000" --radius 8
25
+ figma-use create ellipse --x 0 --y 0 --width 80 --height 80 --fill "#00FF00"
26
+ figma-use create line --x 0 --y 0 --length 100 --stroke "#000"
27
+ figma-use create polygon --x 0 --y 0 --size 60 --sides 6 --fill "#F59E0B"
28
+ figma-use create star --x 0 --y 0 --size 60 --points 5 --fill "#EF4444"
29
+ ```
30
+
31
+ ### Create Frames (with auto-layout)
32
+
33
+ ```bash
34
+ figma-use create frame --x 0 --y 0 --width 400 --height 300 \
35
+ --fill "#FFF" --radius 12 --name "Card" \
36
+ --layout VERTICAL --gap 16 --padding "24,24,24,24"
37
+
38
+ figma-use create frame --x 0 --y 0 --width 200 --height 48 \
39
+ --fill "#3B82F6" --radius 8 --name "Button" \
40
+ --layout HORIZONTAL --gap 8 --padding "12,24,12,24"
41
+ ```
42
+
43
+ ### Create Text
44
+
45
+ ```bash
46
+ figma-use create text --x 0 --y 0 --text "Hello" \
47
+ --fontSize 24 --fontFamily "Inter" --fontStyle "Bold" --fill "#000"
48
+ ```
49
+
50
+ ### Node Operations
51
+
52
+ ```bash
53
+ figma-use node get <id> # Get properties
54
+ figma-use node tree [id] # Get formatted tree (see structure at a glance)
55
+ figma-use node tree --depth 2 # Limit tree depth
56
+ figma-use node tree -i # Only interactive elements
57
+ figma-use node children <id> # List children
58
+ figma-use node move <id> --x 100 --y 200
59
+ figma-use node resize <id> --width 300 --height 200
60
+ figma-use node rename <id> "New Name"
61
+ figma-use node clone <id>
62
+ figma-use node delete <id>
63
+ ```
64
+
65
+ `tree` output example:
66
+ ```
67
+ [0] frame "Card" (1:23)
68
+ 400×300 at (0, 0) | fill: #FFFFFF | layout: col gap=16
69
+ [0] text "Title" (1:24)
70
+ 200×32 at (24, 24) | "Hello World" | font: 24px Inter
71
+ ```
72
+
73
+ ### Set Properties
74
+
75
+ ```bash
76
+ figma-use set fill <id> "#FF0000"
77
+ figma-use set stroke <id> "#000" --weight 2
78
+ figma-use set radius <id> --radius 12
79
+ figma-use set radius <id> --topLeft 16 --bottomRight 16
80
+ figma-use set opacity <id> 0.8
81
+ figma-use set rotation <id> 45
82
+ figma-use set text <id> "Updated text"
83
+ figma-use set font <id> --family "Inter" --style "Bold" --size 20
84
+ figma-use set layout <id> --mode HORIZONTAL --gap 8 --padding 16
85
+ figma-use set effect <id> --type DROP_SHADOW --radius 10 --offsetY 4 --color "#00000040"
86
+ ```
87
+
88
+ ### Variables (Design Tokens)
89
+
90
+ ```bash
91
+ figma-use collection list
92
+ figma-use collection create "Colors"
93
+
94
+ figma-use variable list --type COLOR
95
+ figma-use variable create "Primary" --collection <collectionId> --type COLOR --value "#3B82F6"
96
+ figma-use variable set <varId> --mode <modeId> --value "#1D4ED8"
97
+ figma-use variable bind --node <nodeId> --field fills --variable <varId>
98
+ ```
99
+
100
+ ### Styles
101
+
102
+ ```bash
103
+ figma-use style list
104
+ figma-use style create-paint "Brand/Primary" --color "#E11D48"
105
+ figma-use style create-text "Heading/H1" --family "Inter" --style "Bold" --size 32
106
+ ```
107
+
108
+ ### Export
109
+
110
+ ```bash
111
+ figma-use export node <id> --format PNG --scale 2 --output design.png
112
+ figma-use export screenshot --output viewport.png
113
+ figma-use export selection --output selection.png
114
+ ```
115
+
116
+ Heavy ops support `--timeout` (seconds):
117
+ ```bash
118
+ figma-use export node <id> --timeout 300
119
+ ```
120
+
121
+ ### Selection & Navigation
122
+
123
+ ```bash
124
+ figma-use selection get
125
+ figma-use selection set "1:2,1:3"
126
+ figma-use page list
127
+ figma-use page set "Page Name"
128
+ figma-use viewport zoom-to-fit <ids...>
129
+ ```
130
+
131
+ ### Find
132
+
133
+ ```bash
134
+ figma-use find --name "Button"
135
+ figma-use find --type FRAME
136
+ figma-use get components
137
+ ```
138
+
139
+ ### Boolean & Group
140
+
141
+ ```bash
142
+ figma-use boolean union "1:2,1:3"
143
+ figma-use boolean subtract "1:2,1:3"
144
+ figma-use group create "1:2,1:3"
145
+ figma-use group ungroup <id>
146
+ ```
147
+
148
+ ### Eval (Arbitrary Code)
149
+
150
+ ```bash
151
+ figma-use eval "return figma.currentPage.name"
152
+ figma-use eval "const r = figma.createRectangle(); r.resize(100, 100); return r.id"
153
+ ```
154
+
155
+ ## Output
156
+
157
+ Human-readable by default. Add `--json` for machine parsing:
158
+ ```bash
159
+ figma-use node get <id> --json
160
+ ```
161
+
162
+ ## Colors
163
+
164
+ Hex format: `#RGB`, `#RRGGBB`, or `#RRGGBBAA`
165
+
166
+ ## Node IDs
167
+
168
+ Format: `pageIndex:nodeIndex` (e.g., `1:2`, `45:123`)
169
+
170
+ Get IDs from:
171
+ - `figma-use selection get`
172
+ - `figma-use node children <parentId>`
173
+ - Figma → right-click → Copy link → ID in URL