@akesson/figma-explorer 0.2.2 → 0.2.3

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,109 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.3] - 2026-09-23
11
+
12
+ ### Fixed
13
+
14
+ - **`cache prefetch` now backfills a missing `.full.json.gz` sidecar.** A file
15
+ first cached by opening it via URL (`ls <url>`, `node-info <url>`, …) has a
16
+ payload but no full sidecar, and prefetch used to count it as up to date
17
+ forever — so `node-info --cache-only` never worked offline for it. Prefetch
18
+ now refetches an unchanged file whose full sidecar is missing or stamped
19
+ with another schema version (unless `--no-full`).
20
+ - **Root `ls` no longer lists folders with no cached files.** A folder dropped
21
+ from `FIGMA_PROJECTS_IDS` keeps its `proj:N` id (synthetic ids are stable),
22
+ and root `ls` rendered it as an empty project named by its raw folder id
23
+ (e.g. `proj:3 "571382610"`). Such folders are now omitted; `ls proj:N` still
24
+ works, and `cache prefetch --folder-ids <id>` brings a folder back with its
25
+ real name.
26
+ - **`cache prefetch`, root `ls` refresh and `ls proj:N` refresh no longer 403
27
+ with a Figma token created after 2026-08-03.** Figma renamed projects to
28
+ folders; new personal access tokens carry `folders:read` instead of
29
+ `projects:read`, and the deprecated `GET /v1/projects/{id}/files` rejects
30
+ them (`Invalid scope … requires the file_read or files:read or projects:read
31
+ scope`). Listings now use `GET /v2/folders/{id}/files`. Folder ids are the
32
+ old project ids, so `FIGMA_PROJECTS_IDS`, `proj:N` and existing cache metas
33
+ are unchanged; `--project-ids` gained a `--folder-ids` alias. A 403 from v2
34
+ falls back to v1 once (pre-rename tokens are documented to keep working
35
+ there) and prints a hint to regenerate the token. `figma-api` was
36
+ regenerated from the 2026-08-11 upstream spec, which adds `folders_api`;
37
+ `figma-get` gained `folder-files`, `folder-folders`, `folder-meta` and
38
+ `team-folders`, and marks `project-files` / `team-projects` deprecated.
39
+
40
+ ### Changed
41
+
42
+ - **`node-info` output is ~4–5× smaller with nothing implementation-relevant
43
+ dropped.** Measured on a 475-node screen: 634 KB → 141 KB YAML. What changed
44
+ in the curated view (`--raw` is untouched):
45
+ - Hidden (`visible: false`) children are pruned and listed on the parent as
46
+ `hidden_children: [{id, name, type}]` — they were 65% of the output and,
47
+ worse, their descendants were indistinguishable from visible nodes.
48
+ `--include-hidden` restores them; a hidden target is always rendered, and
49
+ so is a hidden layer inside a COMPONENT definition whose visibility is
50
+ wired to a BOOLEAN property (its `property_refs` are the wiring an
51
+ implementer needs). A comment anchored to a pruned node is tagged
52
+ `anchor_rendered: false`.
53
+ - Defaults are elided: `constraints: LEFT/TOP`, `layout.wrap: NO_WRAP`,
54
+ axis `sizing: AUTO` / `align: MIN`, text alignment LEFT/TOP,
55
+ `line_height_unit: PIXELS`.
56
+ - `bounds` is parent-relative on descendants; flow children of an
57
+ auto-layout parent carry only `width`/`height`. A CANVAS has no box, so
58
+ a page's children are relative to the canvas origin (Figma's absolute
59
+ coordinates). `size` appears only when it differs from the bounding box
60
+ (rotation).
61
+ - Colors are `hex` only; the float channels are gone from fills, strokes,
62
+ gradient stops and effects.
63
+ - Text style drops `font_post_script_name`, `line_height_percent`,
64
+ `line_height_percent_font_size` (all restate other fields).
65
+ - `layout_child.sizing` is one `"H/V"` string; padding is one number when
66
+ uniform, else `[top, right, bottom, left]`.
67
+ - `component.component_properties` is split into `variants` and
68
+ `properties` with plain scalar values and Figma's `#n:m` name suffixes
69
+ stripped (kept when stripping would collide). An INSTANCE_SWAP prop keeps
70
+ its allowed swap targets as `preferred`. `property_refs` is emitted on
71
+ the target and inside component definitions only.
72
+ - Geometry leaves below the target (VECTOR, BOOLEAN_OPERATION, STAR, LINE,
73
+ REGULAR_POLYGON) drop only the layout block that cannot apply to them —
74
+ `constraints` when they are flow children of an auto-layout parent,
75
+ `layout_child` when the parent has no auto-layout — so a FILL-width
76
+ divider LINE keeps its sizing; fills and strokes stay so icon color
77
+ tokens remain visible.
78
+ - Bound variables are referenced by short handles (`v1`, `v2`, … in
79
+ first-seen order). The top-level `variables` block is keyed by handle and
80
+ always carries the raw `id`, plus name/values when the Variables sidecar
81
+ is available. The 60-character `VariableID:` strings no longer repeat
82
+ per use.
83
+ - Node-level `bound_variables` no longer repeats `fills[i]`/`strokes[i]`
84
+ entries that the paint itself already carries as `bound_variable` (half
85
+ of the map on a real screen). Entries the paints don't mirror are kept.
86
+ - Floats are rounded to 3 decimals (`14.40007495880127` → `14.4`): Figma
87
+ stores f32 and the REST API prints it as f64. The top-level `variables`
88
+ block gets the same treatment.
89
+ - `--no-variables` once again omits the `variables` block entirely; when a
90
+ sidecar is present but some handles point at library-owned variables, a
91
+ `variables_note` says how many could not be resolved locally.
92
+ - **YAML output uses flow style for leaf containers** (`bounds: {width: 24,
93
+ height: 24}`, `padding: [0, 12, 0, 12]`, one record per row in lists)
94
+ instead of `serde_yaml`'s all-block rendering, via the new `yaml_out`
95
+ printer. Still standard YAML; a `node-info` view goes from 4,564 to 2,464
96
+ lines and 31.3k to 27.8k tokens. Non-ASCII keys are no longer escaped
97
+ (`💠 Before Icon`, not `\u{1f4a0} Before Icon`) and integral floats print
98
+ as `12`, not `12.0`. Multi-line text renders as a `|-` literal block.
99
+ Quoting is conservative enough for YAML 1.1 parsers (PyYAML, Psych):
100
+ `687:45` and `10:5` are quoted (base 60 would read them as integers),
101
+ `1,000` and `2026-9-5` too, large floats print as `1.5e+20`, a leading
102
+ `:`/`?` is quoted inside `{}`/`[]`, and U+2028/U+2029, NEL, DEL and the C1
103
+ range are `\uXXXX`-escaped rather than written raw (libyaml refuses the
104
+ whole document otherwise — Shift+Enter in a Figma text layer produces
105
+ U+2028). Applies to every command's YAML output.
106
+ - **`--json` is compact**, not pretty-printed. Pretty JSON was the most
107
+ token-expensive rendering of all (37% more than the YAML default on the
108
+ same view); `jq` does not care.
109
+ - `scripts/node_info_lossless.py` — checks a curated view against `--raw` for
110
+ the same target (node set, hidden listing, bounds reconstruction, paints,
111
+ layout, text, component props, variable handles).
112
+
10
113
  ## [0.2.2] - 2026-08-22
11
114
 
12
115
  ### Fixed
package/README.md CHANGED
@@ -5,7 +5,7 @@ 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:`. 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.
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).
@@ -59,7 +59,7 @@ export FIGMA_TOKEN=figd_...
59
59
 
60
60
  Optional environment variables:
61
61
 
62
- - `FIGMA_PROJECTS_IDS` — comma-separated project ids; needed by `cache prefetch`.
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`.
63
63
  - `FIGMA_TEAM_ID` — needed by `library search` and for the catalog warm in `cache prefetch`.
64
64
  - `FIGMA_EXPLORER_CACHE_DIR` — override the cache location (default: OS cache dir).
65
65
 
@@ -99,7 +99,7 @@ figma-explorer cache prefetch
99
99
 
100
100
  ## Output
101
101
 
102
- YAML by default (terse, agent-friendly). Pass `--json` for full pretty JSON suitable for `jq` pipelines.
102
+ YAML by default (terse, agent-friendly: block style for the tree, flow style `{k: v}` for leaf maps and short lists). Pass `--json` for compact JSON suitable for `jq` pipelines.
103
103
 
104
104
  ## Cache
105
105
 
@@ -19,7 +19,7 @@
19
19
  "hasInstallScript": true,
20
20
  "license": "MIT",
21
21
  "name": "@akesson/figma-explorer",
22
- "version": "0.2.2"
22
+ "version": "0.2.3"
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.2"
51
+ "version": "0.2.3"
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.2"
3
+ "https://github.com/akesson/figma-explorer/releases/download/v0.2.3"
4
4
  ],
5
5
  "bin": {
6
6
  "figma-explorer": "run-figma-explorer.js"
@@ -95,7 +95,7 @@
95
95
  "zipExt": ".tar.xz"
96
96
  }
97
97
  },
98
- "version": "0.2.2",
98
+ "version": "0.2.3",
99
99
  "volta": {
100
100
  "node": "18.14.1",
101
101
  "npm": "9.5.0"