figma-local 1.8.0 → 1.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figma-local",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Control Figma Desktop with Claude Code. Smart read, write, and AI-prompt export. No API key required.",
5
5
  "author": "elvke",
6
6
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: figma-library
3
3
  description: |
4
- Use this skill when the user wants to access, browse, import, or use components and variables from a Figma team library or external Figma file. Triggers on: "library components", "import component", "library variables", "team library", "use components from another file", "get the button from the library", "what components are available", "design system components", "import from library", "library collections". Also use when building UI and the user references a design system or component library in another Figma file.
4
+ Use this skill when the user wants to access, browse, import, or use components and variables from a Figma team library or external Figma file. Triggers on: "library components", "import component", "library variables", "team library", "use components from another file", "get the button from the library", "what components are available", "design system components", "import from library", "library collections", "index the library", "scan components", "search for a component". Also use when building UI and the user references a design system or component library in another Figma file.
5
5
  allowed-tools:
6
6
  - Bash(fig library *)
7
7
  - Bash(fig library)
@@ -11,7 +11,7 @@ allowed-tools:
11
11
 
12
12
  # Figma Library
13
13
 
14
- Access team library components and variables from other Figma files. Import components by key and browse available design tokens.
14
+ Access team library components and variables from other Figma files. Index libraries, search components by name, import by key, and browse design tokens.
15
15
 
16
16
  ## Prerequisites
17
17
 
@@ -19,53 +19,58 @@ Access team library components and variables from other Figma files. Import comp
19
19
  - The Figma plugin must have `teamlibrary` permission in its manifest. If library commands fail with a permission error, re-import the plugin in Figma (Plugins → Development → Import from manifest).
20
20
  - Libraries must be enabled in the current Figma file (check Assets panel → team library icon).
21
21
 
22
+ ## IMPORTANT: How to access library components
23
+
24
+ Figma's plugin API does **not** allow browsing library components directly. To work with library components, you must **index** them first:
25
+
26
+ 1. Open the **library file** in Figma (the file that contains the components)
27
+ 2. Run `fig library index` — this scans all pages and saves every component with its key
28
+ 3. Switch to your **working file**
29
+ 4. Run `fig library search --name "button"` — finds components from indexed libraries
30
+ 5. Run `fig library import --key "<key>"` — imports the component
31
+
22
32
  ## Usage
23
33
 
24
- ### List library variable collections
34
+ ### Index a library (run in the library file)
25
35
 
26
- See what variable collections are available from linked libraries:
36
+ Open the library/design system file in Figma, then:
27
37
 
28
38
  ```bash
29
- fig library collections
39
+ fig library index
30
40
  ```
31
41
 
32
- Returns: collection name, library name, and collection key for each.
33
-
34
- ### List library variables
42
+ This scans ALL pages in the file and saves every component (name, key, description, page, size, component set) to `~/.figma-local/libraries/<filename>.json`.
35
43
 
36
- Browse all variables across all linked library collections:
44
+ Re-run this command after the library is updated to refresh the index.
37
45
 
38
- ```bash
39
- fig library variables
40
- ```
46
+ ### Search indexed libraries
41
47
 
42
- Filter by name:
48
+ Search across all indexed libraries by component name:
43
49
 
44
50
  ```bash
45
- fig library variables --name "color"
46
- fig library variables --name "spacing"
47
- fig library variables --name "radius"
51
+ fig library search --name "button"
52
+ fig library search --name "input"
53
+ fig library search --name "card"
54
+ fig library search --name "checkbox"
48
55
  ```
49
56
 
50
- Returns: variable name, type (COLOR, FLOAT, STRING), key, collection, and library name.
57
+ Returns: component name, key (for importing), component set, page, size, and library name.
51
58
 
52
- ### List library components
53
-
54
- Find library components that are already used on the current page:
59
+ Use `--json` for structured output:
55
60
 
56
61
  ```bash
57
- fig library components
62
+ fig library search --name "button" --json
58
63
  ```
59
64
 
60
- Filter by name:
65
+ ### List indexed libraries
66
+
67
+ See what libraries have been indexed:
61
68
 
62
69
  ```bash
63
- fig library components --name "button"
64
- fig library components --name "input"
65
- fig library components --name "card"
70
+ fig library list
66
71
  ```
67
72
 
68
- Returns: component name, component set, key, description, and whether it's remote (library) or local.
73
+ Returns: library name, component count, page count, and when it was indexed.
69
74
 
70
75
  ### Import a component by key
71
76
 
@@ -83,63 +88,75 @@ fig library import --key "abc123def456..." --name "PrimaryButton"
83
88
 
84
89
  The imported component instance is placed at the viewport center and selected.
85
90
 
86
- ### JSON output
91
+ ### List library variable collections
87
92
 
88
- All commands support `--json` for structured output:
93
+ See what variable collections are available from linked libraries:
89
94
 
90
95
  ```bash
91
- fig library collections --json
92
- fig library variables --json
93
- fig library variables --name "color" --json
94
- fig library components --json
96
+ fig library collections
95
97
  ```
96
98
 
97
- ## Workflow: Building with library components
99
+ ### List library variables
98
100
 
99
- 1. **Discover** what's available:
100
- ```bash
101
- fig library collections
102
- fig library variables --name "color"
103
- fig library components --name "button"
104
- ```
101
+ Browse all variables across all linked library collections:
105
102
 
106
- 2. **Import** the components you need:
107
- ```bash
108
- fig library import --key "<key-from-step-1>"
109
- ```
103
+ ```bash
104
+ fig library variables
105
+ fig library variables --name "color"
106
+ fig library variables --name "spacing"
107
+ ```
110
108
 
111
- 3. **Inspect** the imported component to get its specs:
112
- ```bash
113
- fig inspect --deep
114
- ```
109
+ ### List components on current page
110
+
111
+ Find library components that are already used on the current page:
115
112
 
116
- 4. **Read** variables to get token values:
113
+ ```bash
114
+ fig library components
115
+ fig library components --name "button"
116
+ ```
117
+
118
+ ### JSON output
119
+
120
+ All commands support `--json` for structured output.
121
+
122
+ ## Workflow: Building UI with library components
123
+
124
+ 1. **Index** the library (one-time, in the library file):
117
125
  ```bash
118
- fig library variables --name "primary" --json
126
+ fig library index
119
127
  ```
120
128
 
121
- 5. **Replicate** in code using the exact specs and token values.
129
+ 2. **Switch** to your working file in Figma.
122
130
 
123
- ## Workflow: Extracting a design system
131
+ 3. **Search** for the components you need:
132
+ ```bash
133
+ fig library search --name "button"
134
+ fig library search --name "input"
135
+ ```
124
136
 
125
- 1. List all variable collections:
137
+ 4. **Import** each component by key:
126
138
  ```bash
127
- fig library collections --json
139
+ fig library import --key "<key-from-search>"
128
140
  ```
129
141
 
130
- 2. Export all variables grouped by type:
142
+ 5. **Inspect** the imported component to get its full specs:
131
143
  ```bash
132
- fig library variables --name "color" --json > colors.json
133
- fig library variables --name "spacing" --json > spacing.json
134
- fig library variables --name "radius" --json > radii.json
144
+ fig inspect --deep
135
145
  ```
136
146
 
137
- 3. Find key components:
147
+ 6. **Get variables** for design tokens:
138
148
  ```bash
139
- fig library components --json
149
+ fig library variables --name "primary" --json
140
150
  ```
141
151
 
142
- 4. Import and document each:
152
+ 7. **Replicate** in code using the exact specs and token values.
153
+
154
+ ## Workflow: Extracting a full design system
155
+
156
+ 1. Open the design system file → `fig library index`
157
+ 2. Get all components: `fig library search --name "" --json`
158
+ 3. Get all variables: `fig library variables --json`
159
+ 4. Import key components one by one and document them:
143
160
  ```bash
144
161
  fig library import --key "<key>"
145
162
  fig document --json
@@ -147,7 +164,9 @@ fig library components --json
147
164
 
148
165
  ## Tips
149
166
 
150
- - If `fig library components` returns empty, drag some components from the Assets panel onto the page first the command scans instances on the current page.
151
- - Use `fig library variables --json` and pipe to `jq` for filtering: `fig library variables --json | jq '.[] | select(.resolvedType == "COLOR")'`
167
+ - **Index once, search many times** the index is saved locally and persists across sessions.
168
+ - Re-index when the library is updated: open the library file `fig library index`.
169
+ - `fig library components` only finds components already on the current page. Use `search` for the full library.
152
170
  - After importing a component, use `fig inspect --deep` to get full specs including variable bindings.
153
171
  - Component keys are stable across file versions — save them for repeated imports.
172
+ - Use `fig library search --name "button" --json | jq '.[].key'` to extract just the keys.