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 +1 -1
- package/skills/figma-library/SKILL.md +81 -62
- package/src/.figma-client-1774014578401.9038.mjs +4198 -0
- package/src/index.js +184 -3
package/package.json
CHANGED
|
@@ -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.
|
|
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
|
-
###
|
|
34
|
+
### Index a library (run in the library file)
|
|
25
35
|
|
|
26
|
-
|
|
36
|
+
Open the library/design system file in Figma, then:
|
|
27
37
|
|
|
28
38
|
```bash
|
|
29
|
-
fig library
|
|
39
|
+
fig library index
|
|
30
40
|
```
|
|
31
41
|
|
|
32
|
-
|
|
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
|
-
|
|
44
|
+
Re-run this command after the library is updated to refresh the index.
|
|
37
45
|
|
|
38
|
-
|
|
39
|
-
fig library variables
|
|
40
|
-
```
|
|
46
|
+
### Search indexed libraries
|
|
41
47
|
|
|
42
|
-
|
|
48
|
+
Search across all indexed libraries by component name:
|
|
43
49
|
|
|
44
50
|
```bash
|
|
45
|
-
fig library
|
|
46
|
-
fig library
|
|
47
|
-
fig library
|
|
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:
|
|
57
|
+
Returns: component name, key (for importing), component set, page, size, and library name.
|
|
51
58
|
|
|
52
|
-
|
|
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
|
|
62
|
+
fig library search --name "button" --json
|
|
58
63
|
```
|
|
59
64
|
|
|
60
|
-
|
|
65
|
+
### List indexed libraries
|
|
66
|
+
|
|
67
|
+
See what libraries have been indexed:
|
|
61
68
|
|
|
62
69
|
```bash
|
|
63
|
-
fig library
|
|
64
|
-
fig library components --name "input"
|
|
65
|
-
fig library components --name "card"
|
|
70
|
+
fig library list
|
|
66
71
|
```
|
|
67
72
|
|
|
68
|
-
Returns:
|
|
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
|
-
###
|
|
91
|
+
### List library variable collections
|
|
87
92
|
|
|
88
|
-
|
|
93
|
+
See what variable collections are available from linked libraries:
|
|
89
94
|
|
|
90
95
|
```bash
|
|
91
|
-
fig library collections
|
|
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
|
-
|
|
99
|
+
### List library variables
|
|
98
100
|
|
|
99
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
```bash
|
|
104
|
+
fig library variables
|
|
105
|
+
fig library variables --name "color"
|
|
106
|
+
fig library variables --name "spacing"
|
|
107
|
+
```
|
|
110
108
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
```
|
|
109
|
+
### List components on current page
|
|
110
|
+
|
|
111
|
+
Find library components that are already used on the current page:
|
|
115
112
|
|
|
116
|
-
|
|
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
|
|
126
|
+
fig library index
|
|
119
127
|
```
|
|
120
128
|
|
|
121
|
-
|
|
129
|
+
2. **Switch** to your working file in Figma.
|
|
122
130
|
|
|
123
|
-
|
|
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
|
-
|
|
137
|
+
4. **Import** each component by key:
|
|
126
138
|
```bash
|
|
127
|
-
fig library
|
|
139
|
+
fig library import --key "<key-from-search>"
|
|
128
140
|
```
|
|
129
141
|
|
|
130
|
-
|
|
142
|
+
5. **Inspect** the imported component to get its full specs:
|
|
131
143
|
```bash
|
|
132
|
-
fig
|
|
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
|
-
|
|
147
|
+
6. **Get variables** for design tokens:
|
|
138
148
|
```bash
|
|
139
|
-
fig library
|
|
149
|
+
fig library variables --name "primary" --json
|
|
140
150
|
```
|
|
141
151
|
|
|
142
|
-
|
|
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
|
-
-
|
|
151
|
-
-
|
|
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.
|