@akesson/figma-explorer 0.2.3 → 0.3.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,125 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.1] - 2026-11-07
11
+
12
+ ### Fixed
13
+
14
+ - **A newly configured folder shows up in `ls` before it's prefetched.** Root
15
+ `ls` used to list only folders with cached files, so after adding a folder
16
+ id to `FIGMA_PROJECTS_IDS` it looked as if the config hadn't been read. A
17
+ configured folder with nothing cached now gets its own row, named and
18
+ counted from the folder listing `ls` already makes:
19
+ `proj:3 "Mobile" (23 files on Figma, none cached — run `figma-explorer cache prefetch`)`.
20
+ If Figma refuses to list the folder, the row shows the error instead.
21
+ `ls` still doesn't fetch the files, and `--cache-only` shows the row from
22
+ the last listing without making requests.
23
+
24
+ - **`cache prefetch` retries transient failures.** A file whose fetch timed
25
+ out, hit a 429, or got a 5xx used to fail for the run, so finishing a large
26
+ folder took several reruns. Each file is now retried up to twice with
27
+ backoff (honoring `Retry-After`), and each retry is logged with how long
28
+ the failed attempt took. A 403/404 is not retried.
29
+
30
+ - **Reruns of `cache prefetch` are fast.** A rerun polled the comments of
31
+ every unchanged file, one request each — about a minute for 50 files even
32
+ with nothing to do. Comments checked in the last 5 minutes are now
33
+ skipped, the same window `comments` uses.
34
+
35
+ - **`ls` no longer calls retried files "added".** When a folder sync
36
+ re-fetched files whose earlier fetch had failed, stderr said they were
37
+ "added to Figma folders". It now says
38
+ `cache: retrying N files that failed to fetch earlier (…)`.
39
+
40
+ ## [0.3.0] - 2026-10-28
41
+
42
+ ### Added
43
+
44
+ - **Cached files are checked against Figma before they're served.** Designers
45
+ edit files while you work, and until now a cached file was served as-is
46
+ until the next `cache prefetch` — days out of date with no warning. Every
47
+ command that reads cached file data now compares the file's Figma `version`
48
+ (a ~1 KB `/meta` request) at most once every 5 minutes per file, and
49
+ refetches a changed file before answering; stderr says
50
+ `cache: N files changed on Figma (…) — refetching…`. Cross-file `find` and
51
+ `ls` at `--depth 2`+ check all the files they read. If the check or the
52
+ refetch fails, the cached copy is served with a note rather than an error.
53
+ `--cache-only` makes no requests and notes data past the 5-minute window.
54
+ The first run after upgrading refetches each file once, since older caches
55
+ don't record a version.
56
+
57
+ - **Comments are kept current too.** A new comment doesn't change a file's
58
+ Figma `version`, so the check above never saw it, and `comments` kept
59
+ serving whatever the last `cache prefetch` fetched. `comments` and
60
+ `node-info` (when its output includes comments) now re-fetch a file's
61
+ comments if they haven't been checked in the last 5 minutes. If that fails,
62
+ the cached comments are served with a note on stderr, and the next attempt
63
+ waits for the next 5-minute window. `find` and `ls` still read the cached
64
+ comments as-is, since they span every file.
65
+
66
+ - **Local variables are refreshed with the file.** On accounts with the
67
+ Variables REST API (Enterprise), the cached variables were only re-fetched
68
+ by `cache prefetch`, so after a designer's change `node-info` could pair
69
+ the new design with old variable values. A file that already has cached
70
+ variables now re-fetches them whenever the file itself is refetched. If
71
+ that fails, the old values are kept and `node-info` says on stderr that they
72
+ may be out of date. Files that never had variables (every file on other
73
+ plans) make no extra request.
74
+
75
+ - **New and deleted files show up without a prefetch.** The version check
76
+ only covers files already in the cache, so a file a designer added to a
77
+ folder never appeared in `ls` or `find` until the next `cache prefetch`, and
78
+ a deleted one kept showing. `ls` (root or a folder) and `find` without
79
+ `--in` now check each configured folder's file list at most once every 5
80
+ minutes (one request per folder). New files are fetched, files gone from
81
+ Figma are dropped, and renamed or moved files get their new name or folder.
82
+ stderr reports what changed. Only folders that already have cached files
83
+ get new files fetched automatically, so the first `ls` on an empty cache
84
+ doesn't quietly turn into a full prefetch. `--cache-only` skips the check.
85
+
86
+ - **`node-info file:N` now shows each named style's value.** Every entry in
87
+ the file summary's `styles` list carries a `value`: a FILL style's hex (or
88
+ its paint list for gradients and stacked paints), a TEXT style's font
89
+ family, weight, size, line height and letter spacing, an EFFECT style's
90
+ shadow list. Figma returns no values for styles, so each is read off the
91
+ first visible node applying it, offline from the full-file sidecar; a style
92
+ no visible node uses has no `value`. Library copies are flagged
93
+ `remote: true`, since one can share a name with a local style yet differ.
94
+ `node-info file:N --only styles` gives just this table.
95
+
96
+ ### Removed
97
+
98
+ - **`tokens` is gone.** Its output wasn't usable as design tokens: outside
99
+ `--scope file` it named colors after the layers they were found on
100
+ (`--color-rectangle-13`, `--color-vector`), and it read only fill and text
101
+ styles, so effect styles (shadows, focus rings) never appeared even with
102
+ `--only shadows`. Use instead:
103
+ - a file's named styles and their values → `node-info file:N --only styles`
104
+ (above), which covers effect styles too;
105
+ - the colors, type and effects a frame uses → `node-info file:N:x:y`, which
106
+ lists them with the named style each one comes from.
107
+ - **`context` is gone.** It bundled a tree, a screenshot, `tokens` output and
108
+ `assets` into one directory. Run the parts directly: `node-info` for the
109
+ structure, `screenshot --out` for the image, `assets --out-dir` for icons
110
+ and images.
111
+
112
+ ### Fixed
113
+
114
+ - **macOS binaries are now codesigned and notarized.** Downloading a release
115
+ tarball from GitHub in a browser previously produced "cannot be opened
116
+ because the developer cannot be verified" on first run. Binaries are now
117
+ signed with a Developer ID certificate under the hardened runtime and
118
+ notarized with Apple. Homebrew, npm, and the shell installer were never
119
+ affected (none of them set the quarantine attribute).
120
+ - **Region comments keep their region.** A comment pinned to a region of a
121
+ frame (rather than a point) lost its region size and pin corner, because
122
+ the generated client matched it to the point shape first. Cached comments
123
+ correct themselves on their next refresh.
124
+ - **`file:N` ids are assigned in the same order on every machine.** A fresh
125
+ `cache prefetch` numbered files in filesystem order, so `file:1` could name
126
+ different files on different machines. Files are now numbered by folder,
127
+ then name. Ids already assigned don't change.
128
+
10
129
  ## [0.2.3] - 2026-09-23
11
130
 
12
131
  ### Fixed
package/README.md CHANGED
@@ -5,14 +5,12 @@ A command-line tool for navigating, inspecting, and exporting from Figma files v
5
5
  ## What it does
6
6
 
7
7
  - **`ls`** / **`find`** — navigate projects, files, and node trees by name or visible text without copy-pasting node ids. `find` speaks web-search syntax: `"exact phrases"`, uppercase `OR`, `-exclusion`.
8
- - **`node-info`** — single-target view with layout, fills, strokes, effects, text, bound variables, comments, and a ready-made figma.com `url:`. Hidden subtrees are pruned (listed as `hidden_children`), defaults elided, and variables referenced by short handles, so a full screen is a few dozen KB rather than hundreds. Designed to be pasted into an agent prompt.
8
+ - **`node-info`** — single-target view with layout, fills, strokes, effects, text, bound variables, comments, and a ready-made figma.com `url:`. Hidden subtrees are pruned (listed as `hidden_children`), defaults elided, and variables referenced by short handles, so a full screen is a few dozen KB rather than hundreds. Designed to be pasted into an agent prompt. On a file (`node-info file:N --only styles`) it lists the file's named styles with their values — fill hex, text font, shadow effects.
9
9
  - **`comments`** — list a file's comment threads (replies inline, newest first), threads under a node, or a single thread; filter with `--unresolved` / `--since` / `--grep`.
10
10
  - **`mark`** — curated keyword→node bookmarks (`mark add key file:N:x:y --alias …`); `find` and `library search` surface matching marks ahead of their own hits, and `mark:key` resolves anywhere an id is accepted.
11
11
  - **`library search`** — fuzzy search across a team's published component library (components, component sets, styles).
12
12
  - **`screenshot`** — export a node as PNG / JPG / SVG / PDF.
13
- - **`tokens`** — extract design tokens (colors, fonts, sizes, spacing).
14
- - **`assets`** — bulk-export every icon/image below a node.
15
- - **`context`** — aggregate: tree + screenshot + tokens + assets for a node.
13
+ - **`assets`** — bulk-export every icon (SVG) and image (PNG) below a node, with a manifest.
16
14
  - **`cache prefetch`** / **`cache status`** — pre-warm a local cache so subsequent commands are offline-fast, and report what it holds (per-file age, sidecars, catalog) without touching the network.
17
15
 
18
16
  All commands share a tagged-id grammar — `proj:N`, `file:N`, `file:N:x:y`, or a full `figma.com` URL — so you never paste raw node identifiers by hand.
@@ -57,6 +55,8 @@ Get a personal access token at https://www.figma.com/developers/api#access-token
57
55
  export FIGMA_TOKEN=figd_...
58
56
  ```
59
57
 
58
+ Give the token the **File content** (`file_content:read`) and **File metadata** (`file_metadata:read`) read scopes. The metadata scope powers the cheap freshness check (`/v1/files/{key}/meta`); without it, checks fall back to a slower depth-limited file request.
59
+
60
60
  Optional environment variables:
61
61
 
62
62
  - `FIGMA_PROJECTS_IDS` — comma-separated Figma folder ids (Figma renamed "projects" to "folders" in August 2026; the numeric ids are unchanged, so existing values keep working); needed by `cache prefetch`.
@@ -90,8 +90,8 @@ figma-explorer node-info file:2:1094:66591
90
90
  # Search the team component library
91
91
  figma-explorer library search "icon arrow"
92
92
 
93
- # Export everything below a node as PNGs
94
- figma-explorer assets file:2:1094:66591 ./out/
93
+ # Export every icon and image below a node
94
+ figma-explorer assets file:2:1094:66591 --out-dir ./out/
95
95
 
96
96
  # Pre-warm the cache so subsequent reads are offline
97
97
  figma-explorer cache prefetch
@@ -105,6 +105,8 @@ YAML by default (terse, agent-friendly: block style for the tree, flow style `{k
105
105
 
106
106
  A local rkyv cache lives at `$FIGMA_EXPLORER_CACHE_DIR` or the OS cache dir. It is **per-machine** — rkyv archives are not endianness-portable, so don't sync the cache directory across architectures. `cache clear` removes everything; `cache prefetch` warms it from `FIGMA_PROJECTS_IDS`.
107
107
 
108
+ Designers edit files live, so cached data is checked against Figma before it is served: at most once every 5 minutes per file, a ~1 KB `GET /v1/files/{key}/meta` compares Figma's `version` with the cached one, and a changed file is refetched (payload and `node-info` sidecar together) before the command answers. If the check or refetch fails, the cached copy is served with a note on stderr. `--cache-only` never checks; it notes data older than the window instead.
109
+
108
110
  ## License
109
111
 
110
112
  MIT. See `LICENSE-MIT`.
@@ -19,7 +19,7 @@
19
19
  "hasInstallScript": true,
20
20
  "license": "MIT",
21
21
  "name": "@akesson/figma-explorer",
22
- "version": "0.2.3"
22
+ "version": "0.3.1"
23
23
  },
24
24
  "node_modules/detect-libc": {
25
25
  "engines": {
@@ -48,5 +48,5 @@
48
48
  }
49
49
  },
50
50
  "requires": true,
51
- "version": "0.2.3"
51
+ "version": "0.3.1"
52
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "artifactDownloadUrls": [
3
- "https://github.com/akesson/figma-explorer/releases/download/v0.2.3"
3
+ "https://github.com/akesson/figma-explorer/releases/download/v0.3.1"
4
4
  ],
5
5
  "bin": {
6
6
  "figma-explorer": "run-figma-explorer.js"
@@ -8,7 +8,7 @@
8
8
  "dependencies": {
9
9
  "detect-libc": "^2.1.2"
10
10
  },
11
- "description": "High-level CLI on top of the Figma REST API: name-based navigation, asset extraction, design tokens, and bundled context export.",
11
+ "description": "High-level CLI on top of the Figma REST API: name-based navigation, implementation-ready node views, comments, screenshots, and asset export.",
12
12
  "devDependencies": {
13
13
  "prettier": "^3.8.3"
14
14
  },
@@ -26,7 +26,7 @@
26
26
  "figma",
27
27
  "cli",
28
28
  "design",
29
- "design-tokens"
29
+ "design-to-code"
30
30
  ],
31
31
  "license": "MIT",
32
32
  "name": "@akesson/figma-explorer",
@@ -95,7 +95,7 @@
95
95
  "zipExt": ".tar.xz"
96
96
  }
97
97
  },
98
- "version": "0.2.3",
98
+ "version": "0.3.1",
99
99
  "volta": {
100
100
  "node": "18.14.1",
101
101
  "npm": "9.5.0"