@mstrathman/figma 0.1.0 → 0.2.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 +4 -0
- package/README.md +126 -32
- package/dist/main.js +1892 -564
- package/dist/main.js.map +1 -1
- package/package.json +12 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.2.1] - 2026-01-18
|
|
9
|
+
|
|
10
|
+
## [0.2.0] - 2026-01-18
|
|
11
|
+
|
|
8
12
|
## [0.1.0] - 2025-01-17
|
|
9
13
|
|
|
10
14
|
### Added
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# figma
|
|
2
2
|
|
|
3
|
-
A command-line interface for the Figma API, inspired by GitHub's `gh` CLI. Built for design-to-code workflows.
|
|
3
|
+
A command-line interface for the Figma API, inspired by GitHub's `gh` CLI. Built for design-to-code workflows and agent-to-agent handoffs.
|
|
4
4
|
|
|
5
5
|
> **Note:** This is an unofficial tool and is not affiliated with or endorsed by Figma, Inc.
|
|
6
6
|
|
|
@@ -58,17 +58,54 @@ figma auth status
|
|
|
58
58
|
|
|
59
59
|
## Commands
|
|
60
60
|
|
|
61
|
+
All commands accept either a **Figma URL** or a **file key**:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Using full Figma URL (recommended)
|
|
65
|
+
figma file get "https://www.figma.com/file/ABC123xyz/My-Design"
|
|
66
|
+
|
|
67
|
+
# Using file key
|
|
68
|
+
figma file get ABC123xyz
|
|
69
|
+
```
|
|
70
|
+
|
|
61
71
|
### Files
|
|
62
72
|
|
|
63
73
|
```bash
|
|
64
|
-
# Get file structure
|
|
65
|
-
figma file get <
|
|
74
|
+
# Get file JSON structure
|
|
75
|
+
figma file get <url>
|
|
76
|
+
|
|
77
|
+
# Get simplified file structure (for understanding hierarchy)
|
|
78
|
+
figma file structure <url>
|
|
79
|
+
figma file structure <url> --depth 3 --format tree
|
|
66
80
|
|
|
67
81
|
# Get specific nodes
|
|
68
|
-
figma file nodes <
|
|
82
|
+
figma file nodes <url> --id "1:2,1:3"
|
|
83
|
+
|
|
84
|
+
# Export images from nodes
|
|
85
|
+
figma file images <url> --id "1:2" --format svg --output ./exports
|
|
86
|
+
|
|
87
|
+
# Use node-id from URL directly
|
|
88
|
+
figma file images "https://www.figma.com/file/ABC123xyz/Design?node-id=1-2" -o ./exports
|
|
89
|
+
|
|
90
|
+
# Naming strategies for exported images
|
|
91
|
+
figma file images <url> --id "1:2,1:3" --naming name -o ./icons # Uses node names
|
|
92
|
+
figma file images <url> --id "1:2,1:3" --naming path -o ./icons # Includes parent path
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Frames
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# List all frames in a file
|
|
99
|
+
figma frame list --file <url>
|
|
100
|
+
|
|
101
|
+
# Filter by page
|
|
102
|
+
figma frame list --file <url> --page "Components"
|
|
69
103
|
|
|
70
|
-
#
|
|
71
|
-
figma file
|
|
104
|
+
# Filter by type
|
|
105
|
+
figma frame list --file <url> --type component,component_set
|
|
106
|
+
|
|
107
|
+
# Only top-level frames
|
|
108
|
+
figma frame list --file <url> --top-level --format table
|
|
72
109
|
```
|
|
73
110
|
|
|
74
111
|
### Projects
|
|
@@ -85,7 +122,7 @@ figma project files <project-id>
|
|
|
85
122
|
|
|
86
123
|
```bash
|
|
87
124
|
# List components in a file
|
|
88
|
-
figma component list --file <
|
|
125
|
+
figma component list --file <url>
|
|
89
126
|
|
|
90
127
|
# List team components
|
|
91
128
|
figma component list --team <team-id>
|
|
@@ -98,7 +135,7 @@ figma component get <component-key>
|
|
|
98
135
|
|
|
99
136
|
```bash
|
|
100
137
|
# List styles in a file
|
|
101
|
-
figma style list --file <
|
|
138
|
+
figma style list --file <url>
|
|
102
139
|
|
|
103
140
|
# List team styles
|
|
104
141
|
figma style list --team <team-id>
|
|
@@ -111,27 +148,62 @@ figma style get <style-key>
|
|
|
111
148
|
|
|
112
149
|
```bash
|
|
113
150
|
# List variables
|
|
114
|
-
figma variable list <
|
|
151
|
+
figma variable list <url>
|
|
115
152
|
|
|
116
153
|
# Export as design tokens
|
|
117
|
-
figma variable export <
|
|
118
|
-
figma variable export <
|
|
154
|
+
figma variable export <url> --format css --output tokens.css
|
|
155
|
+
figma variable export <url> --format style-dictionary --output tokens.json
|
|
156
|
+
|
|
157
|
+
# Group by scope (colors, spacing, radius, etc.)
|
|
158
|
+
figma variable export <url> --categorize --format css
|
|
119
159
|
```
|
|
120
160
|
|
|
121
161
|
### Export (Design-to-Code)
|
|
122
162
|
|
|
123
163
|
```bash
|
|
124
|
-
# Export design tokens
|
|
125
|
-
figma export tokens <
|
|
126
|
-
figma export tokens <
|
|
127
|
-
figma export tokens <
|
|
128
|
-
figma export tokens <
|
|
164
|
+
# Export design tokens from styles
|
|
165
|
+
figma export tokens <url> --format css
|
|
166
|
+
figma export tokens <url> --format scss
|
|
167
|
+
figma export tokens <url> --format tailwind
|
|
168
|
+
figma export tokens <url> --format style-dictionary
|
|
129
169
|
|
|
130
170
|
# Export icons
|
|
131
|
-
figma export icons <
|
|
171
|
+
figma export icons <url> --frame "Icons" --format svg --output ./icons
|
|
172
|
+
|
|
173
|
+
# Handle icon variants
|
|
174
|
+
figma export icons <url> --variant-format suffix # icon-name--large.svg
|
|
175
|
+
figma export icons <url> --variant-format folder # icon-name/large.svg
|
|
132
176
|
|
|
133
177
|
# Export complete theme package
|
|
134
|
-
figma export theme <
|
|
178
|
+
figma export theme <url> --formats "css,json,tailwind" --output ./theme
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Handoff (All-in-One)
|
|
182
|
+
|
|
183
|
+
Export a complete design handoff package for developers or AI agents:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
# Export everything
|
|
187
|
+
figma handoff <url> --all --output ./design-handoff
|
|
188
|
+
|
|
189
|
+
# Customize what to export
|
|
190
|
+
figma handoff <url> --tokens css,scss --assets --structure --readme
|
|
191
|
+
|
|
192
|
+
# Just tokens and structure (no assets)
|
|
193
|
+
figma handoff <url> --tokens css,json --structure
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Output structure:
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
figma-handoff/
|
|
200
|
+
├── tokens/
|
|
201
|
+
│ ├── tokens.css
|
|
202
|
+
│ └── tokens.json
|
|
203
|
+
├── assets/
|
|
204
|
+
│ └── *.svg
|
|
205
|
+
├── structure.json
|
|
206
|
+
└── HANDOFF.md
|
|
135
207
|
```
|
|
136
208
|
|
|
137
209
|
### Raw API Access
|
|
@@ -155,7 +227,8 @@ Most commands support `--format` for output:
|
|
|
155
227
|
- `table` - Human-readable table format
|
|
156
228
|
|
|
157
229
|
```bash
|
|
158
|
-
figma component list --file <
|
|
230
|
+
figma component list --file <url> --format table
|
|
231
|
+
figma frame list --file <url> --format table
|
|
159
232
|
```
|
|
160
233
|
|
|
161
234
|
## Configuration
|
|
@@ -167,39 +240,60 @@ Configuration is loaded in this priority order:
|
|
|
167
240
|
3. Local config (`.figmarc` in current directory)
|
|
168
241
|
4. User config (`~/.config/figma/config.json`)
|
|
169
242
|
|
|
170
|
-
##
|
|
243
|
+
## Figma URLs
|
|
171
244
|
|
|
172
|
-
|
|
245
|
+
Commands accept full Figma URLs with automatic parsing:
|
|
173
246
|
|
|
174
247
|
```
|
|
175
|
-
https://www.figma.com/file/ABC123xyz/My-Design
|
|
176
|
-
^^^^^^^^^
|
|
177
|
-
|
|
248
|
+
https://www.figma.com/file/ABC123xyz/My-Design?node-id=1-2
|
|
249
|
+
^^^^^^^^^ ^^^
|
|
250
|
+
file key node ID (optional)
|
|
178
251
|
```
|
|
179
252
|
|
|
253
|
+
The CLI extracts the file key and node ID automatically. You can override the node ID with `--id`.
|
|
254
|
+
|
|
180
255
|
## Examples
|
|
181
256
|
|
|
182
257
|
### Export a design system
|
|
183
258
|
|
|
184
259
|
```bash
|
|
185
260
|
# Export tokens as CSS variables
|
|
186
|
-
figma export tokens ABC123xyz
|
|
261
|
+
figma export tokens "https://www.figma.com/file/ABC123xyz/Design-System" \
|
|
262
|
+
--format css --output ./src/styles/tokens.css
|
|
187
263
|
|
|
188
|
-
# Export all icons as SVGs
|
|
189
|
-
figma export icons ABC123xyz
|
|
264
|
+
# Export all icons as SVGs with semantic names
|
|
265
|
+
figma export icons "https://www.figma.com/file/ABC123xyz/Icons" \
|
|
266
|
+
--frame "Icons" --naming name --output ./src/assets/icons
|
|
190
267
|
|
|
191
|
-
#
|
|
192
|
-
figma
|
|
268
|
+
# Complete handoff package
|
|
269
|
+
figma handoff "https://www.figma.com/file/ABC123xyz/Design-System" \
|
|
270
|
+
--all --output ./design-handoff
|
|
193
271
|
```
|
|
194
272
|
|
|
195
273
|
### Automate with scripts
|
|
196
274
|
|
|
197
275
|
```bash
|
|
198
276
|
# Get all components and process with jq
|
|
199
|
-
figma component list --file
|
|
277
|
+
figma component list --file <url> | jq '.meta.components[].name'
|
|
278
|
+
|
|
279
|
+
# Export specific nodes as PNGs at 2x
|
|
280
|
+
figma file images <url> --id "1:2,1:3,1:4" --format png --scale 2 --output ./exports
|
|
281
|
+
|
|
282
|
+
# List all frames and their IDs
|
|
283
|
+
figma frame list --file <url> --format table
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Agent-to-agent workflows
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
# Get file structure for AI analysis
|
|
290
|
+
figma file structure <url> --depth 3 --format json > structure.json
|
|
291
|
+
|
|
292
|
+
# Export handoff for coding agent
|
|
293
|
+
figma handoff <url> --all --output ./handoff
|
|
200
294
|
|
|
201
|
-
#
|
|
202
|
-
|
|
295
|
+
# The HANDOFF.md contains structured info for LLMs
|
|
296
|
+
cat ./handoff/HANDOFF.md
|
|
203
297
|
```
|
|
204
298
|
|
|
205
299
|
## Tech Stack
|