@nodii/dev 0.6.8 → 0.6.9

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/README.md CHANGED
@@ -146,6 +146,8 @@ nodii-dev figma apply CHANGE_SET --figma-version VERSION
146
146
  nodii-dev figma published CHANGE_SET --figma-version VERSION
147
147
  nodii-dev figma abandon CHANGE_SET
148
148
  nodii-dev figma withdraw CHANGE_SET # take back a submit before anything is decided
149
+ nodii-dev figma resubmit CHANGE_SET PAYLOAD.json # round 2: re-submit every rejected item
150
+ nodii-dev figma changeset show CHANGE_SET # items, variants, round, decision, comment
149
151
  nodii-dev figma release FILE_KEY
150
152
 
151
153
  ```
@@ -168,7 +170,42 @@ an unregistered file prints the `figma file add` command to run.
168
170
  aren't its holder or an operator (`WITHDRAW_NOT_ALLOWED`), or an item is
169
171
  already decided (`CHANGE_SET_HAS_DECISIONS`: ask the reviewer to request
170
172
  changes instead). The CLI prints each refusal in plain words and keeps the
171
- code.
173
+ code. Withdrawing an undecided re-submit returns the set to `applying`.
174
+
175
+ `figma changeset show` lists a Figma change set's current items (the latest
176
+ round of each): each one's decision, its comment (a rejection always has one), its
177
+ round, the previous round's decision and comment when it was re-submitted,
178
+ and its variants. It reads Dev's `getDesignChangeSet`; `--json` also gives the
179
+ replaced rows (`previousRounds`) and the write log. Guideline change sets are
180
+ `design changeset show`.
181
+
182
+ `figma resubmit` is round 2 inside the same change set (Dev's
183
+ `resubmitDesignChangeSet`). When every item is decided and some were
184
+ rejected, the set is `applying`: rework the rejected items in Figma (the lock
185
+ check allows writes in `applying`, and refuses them only while a submit is
186
+ `in_review`), then re-submit them. The payload names every rejected item, by
187
+ `itemId` or `figmaNodeId`, with its new variants, exported at 2x as for
188
+ `figma submit`:
189
+
190
+ ```json
191
+ {
192
+ "figmaVersion": "VERSION",
193
+ "items": [
194
+ { "figmaNodeId": "36:531", "variants": [{ "nodeId": "36:532", "afterPngBase64": "..." }] }
195
+ ]
196
+ }
197
+ ```
198
+
199
+ A variant without a PNG is rendered from Figma, and a variant keeps the
200
+ "before" image from its earlier round. Each item goes back to review with its
201
+ round + 1; approved items keep their decisions; the set goes `in_review`.
202
+ `figma apply` runs once, when every item is approved. Dev refuses when you
203
+ aren't the holder (`CHANGE_SET_HOLDER_REQUIRED`), the set isn't `applying`
204
+ (`INVALID_CHANGE_SET_STATE`), nothing is rejected
205
+ (`CHANGE_SET_HAS_NO_REJECTIONS`), a rejected item is missing (`REJECTED_ITEMS_MISSING`:
206
+ the CLI lists each one with its comment), or the payload names an item that
207
+ isn't rejected (`CHANGE_ITEM_NOT_REJECTED`); images go through the same
208
+ style check as a submit (`CHANGE_SET_IMAGE_STYLE`).
172
209
 
173
210
  ```bash
174
211
  nodii-dev hook claude-figma-pre # reads Claude Code hook JSON on stdin
@@ -439,7 +476,9 @@ surfaces, service edges, lanes, swaps, ideas, terminology, and the AD era: `rule
439
476
  `archive` (`archive resolve --ref pre:D1366`), and `harness methodology`. `api list` is the authoritative discovery view;
440
477
  `api OPERATION_ID` makes every operation callable even without an alias.
441
478
 
442
- `figma check` exits `0` when allowed and `3` when denied. The pre-hook permits
479
+ `figma check` exits `0` when allowed and `3` when denied. A held lock is
480
+ denied only while its change set is `in_review` (`change-set-not-editable`),
481
+ and `figma log-write` follows the same rule (`CHANGE_SET_NOT_EDITABLE`). The pre-hook permits
443
482
  non-Figma tools and allowlisted Figma reads, but defaults to denying every
444
483
  Figma write if the file key is absent, Dev cannot be reached, or the lock
445
484
  is denied. It exits `2`, which makes Claude Code block the call. The post-hook
package/dist/cli.js CHANGED
@@ -26,7 +26,7 @@ import { heartbeatCurrentLane, postHook, preHook, settingsSnippet, workflowSugge
26
26
  import { setupCommand } from "./setup.js";
27
27
  import { harnessCommand } from "./harness.js";
28
28
  import { doctorCommand } from "./doctor.js";
29
- import { figmaFileKey, notRegisteredHint } from "./figma.js";
29
+ import { figmaChangeSetShow, figmaChangeSetText, figmaFileKey, figmaResubmit, notRegisteredHint } from "./figma.js";
30
30
  import { docsCommand, rulebookCommand } from "./upload.js";
31
31
  import { changeSetCommand, guidelineCommand } from "./guidelines.js";
32
32
  import {
@@ -70,7 +70,10 @@ Usage: nodii-dev <command> [options] [--json]
70
70
  design guideline propose ENTRY --file FILE.md [--summary TEXT] [--dry-run]
71
71
  design changeset list [--entry KEY] [--state STATE] | show ID
72
72
  figma lock|check|log-write|submit|apply|published|abandon|release
73
- figma withdraw CHANGE_SET # holder takes back a submit: in_review -> editing
73
+ figma withdraw CHANGE_SET # holder takes back a submit: in_review -> editing (or a re-submit -> applying)
74
+ figma resubmit CHANGE_SET PAYLOAD.json
75
+ # holder re-submits every rejected item: applying -> in_review, round + 1
76
+ figma changeset show CHANGE_SET # items, variants, round, decision and comment (with the previous round's)
74
77
  figma file add FILE_KEY --name TEXT --kind design-system|surfaces|prototype [--module M]
75
78
  # register a Figma file in Dev so it can be locked
76
79
  hook claude-figma-pre|claude-figma-post|print-settings
@@ -630,7 +633,14 @@ export async function main(argv = process.argv.slice(2)) {
630
633
  );
631
634
  }
632
635
  if (action === "withdraw")
633
- return emit(await figmaWithdraw(rest[0]), json, `Withdrew ${rest[0]}; it is back in editing.`);
636
+ return emit(await figmaWithdraw(rest[0]), json, (p) => `Withdrew ${rest[0]}; it is back in ${p.data?.state ?? "editing"}.`);
637
+ if (action === "resubmit")
638
+ return emit(await figmaResubmit(rest[0], rest[1]), json, (p) =>
639
+ [`Re-submitted ${rest[0]}; it is ${p.data.state}.`, figmaChangeSetText(p.data)].join("\n"));
640
+ if (action === "changeset") {
641
+ if (rest[0] !== "show" || !rest[1] || rest.length > 2) throw new CliError("USAGE", "figma changeset show CHANGE_SET", 2);
642
+ return emit(await figmaChangeSetShow(rest[1]), json, (p) => figmaChangeSetText(p.data));
643
+ }
634
644
  if (action === "release")
635
645
  return emit(
636
646
  await devRequest(
package/dist/core.js CHANGED
@@ -4,7 +4,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
4
4
  import { homedir, platform } from "node:os";
5
5
  import { dirname, join } from "node:path";
6
6
 
7
- export const VERSION = "0.6.8";
7
+ export const VERSION = "0.6.9";
8
8
  export const configPath = () =>
9
9
  process.env.NODII_DEV_CONFIG_PATH ??
10
10
  join(homedir(), ".config/nodii-dev/config.json");