@nodii/dev 0.6.211 → 0.6.213

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
@@ -388,14 +388,14 @@ nodii-dev figma scope set CHANGE_SET --scope KIND:ID [--scope ...]
388
388
  nodii-dev figma publish-plan FILE_KEY
389
389
  nodii-dev figma check FILE_KEY
390
390
  nodii-dev figma log-write CHANGE_SET --tool TOOL --nodes NODE[,NODE]
391
- nodii-dev figma submit CHANGE_SET --file SUBMISSION.json
391
+ nodii-dev figma submit CHANGE_SET --file SUBMISSION.json [--code-pr OWNER/REPO#N]
392
392
  nodii-dev figma apply CHANGE_SET --figma-version VERSION
393
393
  nodii-dev figma published FILE_KEY|CHANGE_SET --figma-version VERSION
394
394
  nodii-dev figma abandon CHANGE_SET
395
395
  nodii-dev figma withdraw CHANGE_SET # take back a submit before anything is decided
396
396
  nodii-dev figma split CHANGE_SET --nodes NODE[,NODE] --title TEXT # move written nodes to a new set
397
397
  nodii-dev figma restore CHANGE_SET --lane KEY|--holder AGENT_ID --reason TEXT # staff or Steward: undo a sweep's abandon (MW8-4.3)
398
- nodii-dev figma resubmit CHANGE_SET PAYLOAD.json # round 2: re-submit every rejected item
398
+ nodii-dev figma resubmit CHANGE_SET PAYLOAD.json [--code-pr OWNER/REPO#N] # round 2: re-submit every rejected item
399
399
  nodii-dev figma changeset show CHANGE_SET # items, variants, round, decision, comment
400
400
  nodii-dev figma release FILE_KEY
401
401
 
@@ -597,6 +597,32 @@ outside its item (the CLI lists each item and the variants outside it). When
597
597
  Figma can't answer that check, Dev refuses with `503 FIGMA_UNAVAILABLE`; the CLI
598
598
  says when to retry (`details.retryAfter` seconds).
599
599
 
600
+ **Images and the code PR (hub-558).** `figma submit`, `figma resubmit`
601
+ and `figma submit --dry-run` upload every variant's after and before PNG to the
602
+ set first (`POST /api/v1/design/change-sets/:id/images`, one PNG per request, 4 in
603
+ flight, each PNG sent once by its sha256) and send `afterImageId` /
604
+ `beforeImageId` in place of inline base64. A variant in the file carries either
605
+ `afterPngBase64` or `afterImageId` (likewise `beforePngBase64` or
606
+ `beforeImageId`); the CLI turns the first into the second, so a file may also
607
+ name images already uploaded. Each node's `afterSha256` stays in
608
+ `evidence.nodes`. All three commands take `--code-pr OWNER/REPO#N`, sent as
609
+ `codePr { repo, number }`; the flag wins over a `codePr` in the file, and the CLI
610
+ says so. A change set needs its code pull request, drafted and adoptable
611
+ (MW8-5.2, "No change set without adoptable code"). For example:
612
+
613
+ ```
614
+ nodii-dev figma submit CS-12 --file SUBMIT.json --code-pr nodii-ai/nodii-frontend#123
615
+ nodii-dev figma resubmit CS-12 PAYLOAD.json --code-pr nodii-ai/nodii-frontend#123
616
+ nodii-dev figma submit CS-12 --file SUBMIT.json --code-pr nodii-ai/nodii-frontend#123 --dry-run
617
+ ```
618
+
619
+ ```json
620
+ { "variants": [
621
+ { "nodeId": "1:3", "name": "Button / Tonal", "context": "The Tonal fill", "afterPngBase64": "..." },
622
+ { "nodeId": "1:4", "name": "Button / Ghost", "context": "The Ghost fill", "afterImageId": "IMG-ID" }
623
+ ] }
624
+ ```
625
+
600
626
  A change set changes only what was asked (MW6-22). Every removal of a
601
627
  control, action, data, role view, metric, section or page, and every component
602
628
  swap, is a line in `writeUp` or in the item's `context`, and quotes the
package/dist/cli.js CHANGED
@@ -260,7 +260,7 @@ Usage: nodii-dev <command> [options] [--json]
260
260
  figma lane-reads-script --nodes ID[,ID]
261
261
  # prints the read-only use_figma script that gathers the nodes for --lane-reads
262
262
  figma check|log-write|submit|apply|abandon|release
263
- figma submit CHANGE_SET --file SUBMIT.json [--sync] [--dry-run] [--lane-reads FILE]
263
+ figma submit CHANGE_SET --file SUBMIT.json [--sync] [--dry-run] [--lane-reads FILE] [--code-pr OWNER/REPO#N]
264
264
  # --dry-run (submit and resubmit) runs Dev's dry run of the
265
265
  # submit gate on the same body, as design check --change-set; never writes
266
266
  # --lane-reads (submit, resubmit, --dry-run): Dev runs the gate on your MCP and
@@ -268,8 +268,13 @@ Usage: nodii-dev <command> [options] [--json]
268
268
  # reads over 1 MB go up to the set in chunks first (hub-310), and a chunk
269
269
  # that drops is sent again; the dry run of a submit past 300 node ids
270
270
  # runs in parts and reports once
271
- # SUBMIT.json: { figmaVersion, writeUp, items: [{ figmaNodeId, change, context,
272
- # variants: [{ nodeId, name, context, afterPngBase64 }] }] } (DEC-0204);
271
+ # --code-pr OWNER/REPO#N: the code PR the change set ships with (MW8-5.2: no change set without adoptable code), sent as
272
+ # codePr { repo, number } (the flag wins over a codePr in the file)
273
+ # Images: each afterPngBase64 / beforePngBase64 is uploaded to the set one
274
+ # PNG per request first (hub-558) and the submit, resubmit and dry
275
+ # run send afterImageId / beforeImageId; a file may carry those ids itself
276
+ # SUBMIT.json: { figmaVersion, writeUp, codePr?: { repo, number }, items: [{ figmaNodeId, change, context,
277
+ # variants: [{ nodeId, name, context, afterPngBase64 | afterImageId, beforePngBase64? }] }] } (DEC-0204);
273
278
  # a missing writeUp, context or variant name, or an item with no variants,
274
279
  # is refused before Dev is called (writeUp <= 2000, context <= 500, name <= 120;
275
280
  # never a bare node id). Each removal or swap line in writeUp or an item's
@@ -305,7 +310,7 @@ Usage: nodii-dev <command> [options] [--json]
305
310
  # removedNodeIds); Dev takes each as gone when your reads list it in gone and
306
311
  # its /nodes entry is null or the empty ghost Figma answers for a deleted
307
312
  # component or variant
308
- figma resubmit CHANGE_SET PAYLOAD.json [--sync] [--dry-run] [--lane-reads FILE]
313
+ figma resubmit CHANGE_SET PAYLOAD.json [--sync] [--dry-run] [--lane-reads FILE] [--code-pr OWNER/REPO#N]
309
314
  # holder re-submits every rejected item: applying -> in_review, round + 1;
310
315
  # each item needs context, each variant name and context; writeUp optional
311
316
  figma changeset show CHANGE_SET # write-up, items, context, variants, round, decision and comment (with the previous round's)
@@ -1789,10 +1794,10 @@ export async function main(argv = process.argv.slice(2)) {
1789
1794
  return emit(await figmaFilePublished(rest[0], await publishedBody(f)).catch((error) => { throw laneReadsRefusal(error); }), json, (p) => figmaFilePublishedText(p.data));
1790
1795
  // --dry-run runs Dev's dry run of the submit gate (design check --change-set)
1791
1796
  // on the same body, and never writes (CLI-18).
1792
- const dryRun = async (id, text, file, { split = false } = {}) => {
1797
+ const dryRun = async (id, text, file, { split = false, command } = {}) => {
1793
1798
  const laneReads = f["lane-reads"] ? await readLaneReads(f["lane-reads"]) : undefined;
1794
1799
  const result = await designCheckChangeSet(undefined, { "change-set": id, ...(text ? { file } : {}), ...(f["figma-version"] ? { "figma-version": f["figma-version"] } : {}), ...(f.sync ? { sync: true } : {}), ...(f.async ? { async: true } : {}) },
1795
- { read: async () => text, split, ...(laneReads ? { laneReads } : {}) }).catch((error) => { throw laneReadsRefusal(error); });
1800
+ { read: async () => text, split, command, ...(laneReads ? { laneReads } : {}), ...(f["code-pr"] !== undefined ? { codePr: f["code-pr"] } : {}) }).catch((error) => { throw laneReadsRefusal(error); });
1796
1801
  emit(result.payload, json, result.human);
1797
1802
  if (result.exitCode) {
1798
1803
  if (!json) console.error(`DS_CONFORMANCE_FAILED: ${result.payload.data.findings.length} finding(s)`);
@@ -1804,19 +1809,19 @@ export async function main(argv = process.argv.slice(2)) {
1804
1809
  // The same body checks as the real submit, which needs --file.
1805
1810
  const text = f.file ? await readFile(f.file, "utf8") : null;
1806
1811
  checkSubmitPayload(text ? JSON.parse(text) : { figmaVersion: f["figma-version"] }, f.file || "the submit (no --file)");
1807
- return dryRun(rest[0], text, f.file, { split: true });
1812
+ return dryRun(rest[0], text, f.file, { split: true, command: "submit" });
1808
1813
  }
1809
1814
  if (action === "resubmit" && f["dry-run"]) {
1810
1815
  if (!rest[0] || !rest[1]) throw new CliError("USAGE", "figma resubmit CHANGE_SET PAYLOAD.json --dry-run", 2);
1811
1816
  const text = await readFile(rest[1], "utf8");
1812
1817
  assertContext(resubmitPayload(text, rest[1]), { resubmit: true, file: rest[1] });
1813
- return dryRun(rest[0], text, rest[1]);
1818
+ return dryRun(rest[0], text, rest[1], { command: "resubmit" });
1814
1819
  }
1815
1820
  if (action === "submit") {
1816
1821
  const payload = f.file ? JSON.parse(await readFile(f.file, "utf8")) : { figmaVersion: requireFlag(f, "figma-version") };
1817
1822
  // A 200 carries top-level warnings (STALE_FIGMA_VERSION): print them.
1818
1823
  const laneReads = f["lane-reads"] ? await readLaneReads(f["lane-reads"]) : undefined;
1819
- return emit(await figmaSubmit(rest[0], payload, { sync: submitMode(f), file: f.file || "the submit (no --file)", ...(laneReads ? { laneReads } : {}) }), json, (p) =>
1824
+ return emit(await figmaSubmit(rest[0], payload, { sync: submitMode(f), file: f.file || "the submit (no --file)", ...(laneReads ? { laneReads } : {}), ...(f["code-pr"] !== undefined ? { codePr: f["code-pr"] } : {}) }), json, (p) =>
1820
1825
  [JSON.stringify(p.data, null, 2), ...conformanceLines({ warnings: p.warnings })].join("\n"));
1821
1826
  }
1822
1827
  if (action === "file") {
@@ -1928,7 +1933,7 @@ export async function main(argv = process.argv.slice(2)) {
1928
1933
  );
1929
1934
  }
1930
1935
  if (action === "resubmit")
1931
- return emit(await figmaResubmit(rest[0], rest[1], { sync: submitMode(f), ...(f["lane-reads"] ? { laneReads: await readLaneReads(f["lane-reads"]) } : {}) }), json, (p) =>
1936
+ return emit(await figmaResubmit(rest[0], rest[1], { sync: submitMode(f), ...(f["code-pr"] !== undefined ? { codePr: f["code-pr"] } : {}), ...(f["lane-reads"] ? { laneReads: await readLaneReads(f["lane-reads"]) } : {}) }), json, (p) =>
1932
1937
  [`Re-submitted ${rest[0]}; it is ${p.data.state}.`, figmaChangeSetText(p.data), ...conformanceLines({ warnings: p.warnings })].join("\n"));
1933
1938
  if (action === "changeset") {
1934
1939
  if (rest[0] === "list") {
package/dist/core.js CHANGED
@@ -4,7 +4,7 @@ import { chmod, lstat, mkdir, readFile, rename, rm, writeFile } from "node:fs/pr
4
4
  import { homedir, platform } from "node:os";
5
5
  import { basename, dirname, join } from "node:path";
6
6
 
7
- export const VERSION = "0.6.211";
7
+ export const VERSION = "0.6.213";
8
8
  export const configPath = () =>
9
9
  process.env.NODII_DEV_CONFIG_PATH ??
10
10
  join(homedir(), ".config/nodii-dev/config.json");
package/dist/design.js CHANGED
@@ -9,7 +9,7 @@
9
9
  import { readFile } from "node:fs/promises";
10
10
  import { CliError, devRequest } from "./core.js";
11
11
  import { FIGMA_API, figmaRest } from "./figma-rest.js";
12
- import { conformanceLines, figmaConformance, figmaFileKey, laneReadsBody, submitMode, surfacesCheck } from "./figma.js";
12
+ import { conformanceLines, figmaConformance, figmaFileKey, laneReadsBody, submitMode, surfacesCheck, uploadSubmitImages, withCodePr } from "./figma.js";
13
13
  import { checkConformance, neededMains, VERSION as CHECK_VERSION } from "./vendor/ds-conformance.mjs";
14
14
 
15
15
  // The Figma nodes endpoint takes many ids per call; keep URLs well short of limits.
@@ -149,6 +149,20 @@ const PUBLISH_LABEL = "Components published";
149
149
  const VERSION_PAGES = 5;
150
150
  const KEY_LOOKUPS_AT_ONCE = 3;
151
151
 
152
+ async function versionHistoryReads(figmaGet, path) {
153
+ const reads = [];
154
+ let at = `/${path}?page_size=100`;
155
+ for (let page = 0; page < VERSION_PAGES && at; page++) {
156
+ const body = await figmaGet(at);
157
+ reads.push({ path: at.slice(1), body });
158
+ const older = body?.pagination?.prev_page;
159
+ if (typeof older !== "string" || !older.startsWith(`${FIGMA_API}/${path}`)) break;
160
+ const next = new URL(older);
161
+ at = next.origin === new URL(FIGMA_API).origin && next.pathname === `/v1/${path}` ? `${next.pathname.slice(3)}${next.search}` : null;
162
+ }
163
+ return reads;
164
+ }
165
+
152
166
  /**
153
167
  * A library's newest "Components published" version (DEC-0047): what a
154
168
  * consuming file can have. Null when none is in its recent history; its
@@ -468,7 +482,7 @@ function mergedReports(reports) {
468
482
  * plus the submit-time guards against the set's items: IMAGE_NOT_TRUECOLOR
469
483
  * refuses; STALE_FIGMA_VERSION is a warning. Changes no state.
470
484
  */
471
- export async function designCheckChangeSet(target, flags, { request = devRequest, send, progress, read = (f) => readFile(f, "utf8"), laneReads, split = false } = {}) {
485
+ export async function designCheckChangeSet(target, flags, { request = devRequest, send, progress, read = (f) => readFile(f, "utf8"), laneReads, split = false, codePr, command, env = process.env, figmaGet, laneReadsLimit } = {}) {
472
486
  const id = flags["change-set"];
473
487
  // On the lane's reads too Dev runs the dry run as a job (hub-448); --sync sends the plain call.
474
488
  const sync = submitMode(flags);
@@ -488,19 +502,44 @@ export async function designCheckChangeSet(target, flags, { request = devRequest
488
502
  if (!body || typeof body !== "object" || Array.isArray(body)) throw new CliError("USAGE", `${flags.file}: expected the submit body, a JSON object`, 2);
489
503
  }
490
504
  if (flags["figma-version"]) body = { ...body, figmaVersion: String(flags["figma-version"]) };
491
- // hub-310: large reads go up once, in chunks, and every run names them.
492
- if (laneReads) body = { ...body, ...(await laneReadsBody(id, laneReads, { request, ...(progress ? { progress } : {}) })) };
493
- // A submit body past the dry run's node limit runs in parts, each under it;
494
- // a re-submit's can't be split, since it must name every rejected item.
495
- const groups = split && Array.isArray(body.items) ? dryRunGroups(body.items) : [];
505
+ if (command) body = { ...body, command };
506
+ // hub-558: images go up one by one and the body names them; --code-pr rides in the body.
507
+ body = withCodePr(body, codePr, { ...(progress ? { progress } : {}) });
508
+ body = await uploadSubmitImages(id, body, { request, ...(progress ? { progress } : {}) });
509
+ // Upload a large read corpus once. A versions negotiation below keeps its
510
+ // readIds and adds only one small inline REST supplement.
511
+ const storedReads = laneReads
512
+ ? await laneReadsBody(id, laneReads, { request, ...(progress ? { progress } : {}), ...(laneReadsLimit ? { limit: laneReadsLimit } : {}) })
513
+ : {};
514
+ let versionReads = [];
515
+ const withReads = () => {
516
+ if (!versionReads.length) return { ...body, ...storedReads };
517
+ if (storedReads.laneReads)
518
+ return { ...body, laneReads: { ...storedReads.laneReads, rest: [...(storedReads.laneReads.rest ?? []).filter((entry) => !versionReads.some((read) => read.path === entry.path)), ...versionReads] } };
519
+ return { ...body, ...storedReads, laneReads: { figmaVersion: laneReads.figmaVersion, nodes: [], rest: versionReads } };
520
+ };
496
521
  let p;
497
522
  try {
498
- const run = (b) => figmaConformance(id, b, { request, sync, ...(send ? { send } : {}), ...(progress ? { progress } : {}) });
499
- if (groups.length > 1) {
523
+ const run = (sent) => figmaConformance(id, sent, { request, sync, ...(send ? { send } : {}), ...(progress ? { progress } : {}) });
524
+ const runAll = async () => {
525
+ const sent = withReads();
526
+ // A submit body past the dry run's node limit runs in parts, each under it;
527
+ // a re-submit's can't be split, since it must name every rejected item.
528
+ const groups = split && Array.isArray(sent.items) ? dryRunGroups(sent.items) : [];
529
+ if (groups.length <= 1) return run(sent);
500
530
  const reports = [];
501
- for (const items of groups) reports.push((await run({ ...body, items })).data ?? {});
502
- p = { data: mergedReports(reports) };
503
- } else p = await run(body);
531
+ for (const items of groups) reports.push((await run({ ...sent, items })).data ?? {});
532
+ return { data: mergedReports(reports) };
533
+ };
534
+ try {
535
+ p = await runAll();
536
+ } catch (error) {
537
+ const path = String(error?.details?.path ?? "").replace(/^\/+/, "");
538
+ if (!laneReads || error?.code !== "FIGMA_READS_NEEDED" || !/^files\/[^/]+\/versions$/.test(path)) throw error;
539
+ const get = figmaGet ?? figmaClient(figmaToken(env));
540
+ versionReads = await versionHistoryReads(get, path);
541
+ p = await runAll();
542
+ }
504
543
  } catch (error) {
505
544
  // A cold run reads every root and main from Figma and can outlast the
506
545
  // edge's gateway (504, an HTML page). Dev keeps the mains it read for 5
package/dist/figma.js CHANGED
@@ -392,6 +392,87 @@ export function submitEvidence(body, set) {
392
392
  };
393
393
  }
394
394
 
395
+ const IMAGE_UPLOAD_CONCURRENCY = 4;
396
+
397
+ /**
398
+ * Uploads every inline PNG of a submit or re-submit body to the set, one per
399
+ * request (POST /design/change-sets/:id/images), and returns a NEW body whose
400
+ * variants carry afterImageId / beforeImageId instead of the base64
401
+ * (hub-558: 392 inline 2x PNGs are ~65 MB, over Dev's body limit and
402
+ * the edge's timer). The same PNG (same sha256) uploads once. The submit's
403
+ * evidence declares each after image's hash, so the hash of every after PNG is
404
+ * put in evidence.nodes here, before the base64 is gone.
405
+ */
406
+ export async function uploadSubmitImages(id, body, { request = devRequest, progress = stderrLine, concurrency = IMAGE_UPLOAD_CONCURRENCY, wait = delay, attempts = 3 } = {}) {
407
+ const unique = new Map();
408
+ for (const item of body?.items ?? [])
409
+ for (const variant of item.variants ?? [])
410
+ for (const key of ["afterPngBase64", "beforePngBase64"])
411
+ if (variant[key]) {
412
+ const sha = pngSha256(variant[key]);
413
+ if (!unique.has(sha)) unique.set(sha, variant[key]);
414
+ }
415
+ if (unique.size === 0) return body;
416
+ const path = `/api/v1/design/change-sets/${encode(id)}/images`;
417
+ const ids = new Map();
418
+ const queue = [...unique.entries()];
419
+ let done = 0;
420
+ const send = async (pngBase64) => {
421
+ for (let attempt = 1; ; attempt += 1) {
422
+ try {
423
+ return await request("POST", path, { pngBase64 });
424
+ } catch (error) {
425
+ if (!TRANSIENT.has(error?.code) || attempt >= attempts) throw error;
426
+ await wait(attempt * 2_000);
427
+ }
428
+ }
429
+ };
430
+ const worker = async () => {
431
+ for (let next = queue.shift(); next; next = queue.shift()) {
432
+ const [sha, pngBase64] = next;
433
+ const imageId = (await send(pngBase64)).data?.id;
434
+ if (!imageId) throw new CliError("IMAGE_UPLOAD_FAILED", `Dev stored an image for ${id} but named no id for it`, 1);
435
+ ids.set(sha, imageId);
436
+ done += 1;
437
+ progress(`submit images: ${done} of ${unique.size} uploaded to ${id}`);
438
+ }
439
+ };
440
+ await Promise.all(Array.from({ length: Math.min(concurrency, unique.size) }, worker));
441
+ const declared = [];
442
+ const items = (body.items ?? []).map((item) => ({
443
+ ...item,
444
+ variants: (item.variants ?? []).map(({ afterPngBase64, beforePngBase64, ...variant }) => {
445
+ if (afterPngBase64) {
446
+ const sha = pngSha256(afterPngBase64);
447
+ declared.push({ nodeId: variant.nodeId, afterSha256: sha });
448
+ variant.afterImageId = ids.get(sha);
449
+ }
450
+ if (beforePngBase64) variant.beforeImageId = ids.get(pngSha256(beforePngBase64));
451
+ return variant;
452
+ }),
453
+ }));
454
+ return { ...body, items, evidence: { ...(body.evidence ?? {}), nodes: [...declared, ...(body.evidence?.nodes ?? [])] } };
455
+ }
456
+
457
+ // MW8-5.2: "No change set without adoptable code." A change set MUST NOT be submitted without its code pull
458
+ // request, drafted and adoptable (operator, 15 Nov 2026); --code-pr is how a submit names it.
459
+ /** `--code-pr owner/name#123` as Dev's codePr: { repo, number }; anything else is a USAGE error. */
460
+ export function parseCodePr(value) {
461
+ const match = typeof value === "string" ? /^([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+)#([1-9][0-9]*)$/.exec(value) : null;
462
+ if (!match) throw new CliError("USAGE", `--code-pr takes OWNER/REPO#NUMBER, e.g. --code-pr nodii-ai/nodii-frontend#123 (got ${value === true ? "no value" : JSON.stringify(value)})`, 2);
463
+ return { repo: match[1], number: Number(match[2]) };
464
+ }
465
+
466
+ /** The body with the --code-pr flag's value as codePr; the flag wins over the file's, and says so. */
467
+ export function withCodePr(body, flag, { progress = stderrLine } = {}) {
468
+ if (flag === undefined) return body;
469
+ const codePr = parseCodePr(flag);
470
+ const had = body?.codePr;
471
+ if (had && (had.repo !== codePr.repo || had.number !== codePr.number))
472
+ progress(`--code-pr ${codePr.repo}#${codePr.number} replaces the file's codePr ${had.repo}#${had.number}`);
473
+ return { ...body, codePr };
474
+ }
475
+
395
476
  /** A submit or re-submit, async unless `sync`; a gateway timeout is checked against the set, not resent. */
396
477
  async function submitCall(id, kind, body, { sync = false, request = devRequest, progress = stderrLine, ...job } = {}) {
397
478
  const path = `/api/v1/design/change-sets/${encode(id)}/${kind}`;
@@ -406,7 +487,7 @@ async function submitCall(id, kind, body, { sync = false, request = devRequest,
406
487
  }
407
488
  }
408
489
 
409
- export async function figmaResubmit(id, file, { request = devRequest, read = (f) => readFile(f, "utf8"), laneReads, ...options } = {}) {
490
+ export async function figmaResubmit(id, file, { request = devRequest, read = (f) => readFile(f, "utf8"), laneReads, codePr, ...options } = {}) {
410
491
  if (!id || !file) throw new CliError("USAGE", "figma resubmit CHANGE_SET PAYLOAD.json", 2);
411
492
  let text;
412
493
  try {
@@ -414,8 +495,10 @@ export async function figmaResubmit(id, file, { request = devRequest, read = (f)
414
495
  } catch (error) {
415
496
  throw new CliError("USAGE", `cannot read ${file}: ${error.message}`, 2);
416
497
  }
417
- const body = assertContext(resubmitPayload(text, file), { resubmit: true, file });
498
+ const checked = assertContext(resubmitPayload(text, file), { resubmit: true, file });
499
+ const flagged = withCodePr(checked, codePr, { ...(options.progress ? { progress: options.progress } : {}) });
418
500
  try {
501
+ const body = await uploadSubmitImages(id, flagged, { request, ...(options.progress ? { progress: options.progress } : {}) });
419
502
  // On the lane's reads Dev runs the gate as a submit job too (hub-448), so
420
503
  // they go async like any re-submit; --sync still sends the plain call.
421
504
  const reads = await laneReadsBody(id, laneReads, { request, ...(options.progress ? { progress: options.progress } : {}) });
@@ -801,13 +884,16 @@ export function checkSubmitPayload(payload, file = "the submit body") {
801
884
  return assertContext(payload, { file });
802
885
  }
803
886
 
804
- export async function figmaSubmit(id, payload, { request = devRequest, file = "the submit body", laneReads, progress, ...options } = {}) {
887
+ export async function figmaSubmit(id, payload, { request = devRequest, file = "the submit body", laneReads, codePr, progress, ...options } = {}) {
805
888
  checkSubmitPayload(payload, file);
889
+ const flagged = withCodePr(payload, codePr, { ...(progress ? { progress } : {}) });
806
890
  // On the lane's reads Dev runs the gate as a submit job too (hub-448), so
807
891
  // they go async like any submit; --sync still sends the plain call.
808
892
  const reads = await laneReadsBody(id, laneReads, { request, ...(progress ? { progress } : {}) });
893
+ // The images go up once, here: submitCall's gateway-timeout path never sends the body again.
894
+ const sent = await uploadSubmitImages(id, flagged, { request, ...(progress ? { progress } : {}) });
809
895
  return changeSetCall(id, (method, path, body) => submitCall(id, "submit", body, { request, ...options, ...(progress ? { progress } : {}) }))(
810
- "POST", `/api/v1/design/change-sets/${encode(id)}/submit`, { ...payload, ...reads }).catch((error) => {
896
+ "POST", `/api/v1/design/change-sets/${encode(id)}/submit`, { ...sent, ...reads }).catch((error) => {
811
897
  throw laneReadsRefusal(error);
812
898
  });
813
899
  }
package/dist/flags.js CHANGED
@@ -86,8 +86,8 @@ export const COMMAND_FLAGS = {
86
86
  "request file": ["from", "to", "kind", "summary", "spec", "spec-file", "required-capability", "target-artifact-type", "target-artifact-id"],
87
87
  "docs upload": ["class", "change-class", "pending", "decision", "meaning-unchanged", "conformance-ref", "base", "no-embed", ...WAIT],
88
88
  "docs ratify": ["domain", "decision", ...WAIT],
89
- "figma submit": ["file", "figma-version", ...SUBMIT_MODE, "dry-run", "lane-reads"],
90
- "figma resubmit": [...SUBMIT_MODE, "dry-run", "lane-reads"],
89
+ "figma submit": ["file", "figma-version", ...SUBMIT_MODE, "dry-run", "lane-reads", "code-pr"],
90
+ "figma resubmit": [...SUBMIT_MODE, "dry-run", "lane-reads", "code-pr"],
91
91
  "figma withdraw": ["items", "reason", "lane-reads", "removed-nodes"],
92
92
  "figma split": ["nodes", "title"],
93
93
  "figma restore": ["lane", "holder", "reason"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.211",
3
+ "version": "0.6.213",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {