@nodii/dev 0.6.51 → 0.6.52
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 +53 -9
- package/dist/cli.js +9 -3
- package/dist/core.js +1 -1
- package/dist/figma.js +132 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -283,26 +283,70 @@ already decided (`CHANGE_SET_HAS_DECISIONS`: ask the reviewer to request
|
|
|
283
283
|
changes instead). The CLI prints each refusal in plain words and keeps the
|
|
284
284
|
code. Withdrawing an undecided re-submit returns the set to `applying`.
|
|
285
285
|
|
|
286
|
-
`figma changeset show`
|
|
287
|
-
round of each): each one's decision, its comment (a rejection
|
|
288
|
-
round, the previous round's decision and comment when it was
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
`
|
|
286
|
+
`figma changeset show` prints a Figma change set's write-up and lists its current
|
|
287
|
+
items (the latest round of each): each one's decision, its comment (a rejection
|
|
288
|
+
always has one), its round, the previous round's decision and comment when it was
|
|
289
|
+
re-submitted, its context, and each variant's node id, name and context. A set
|
|
290
|
+
submitted before 31 Oct 2026 has none of these: the CLI says
|
|
291
|
+
`none (submitted before 31 Oct)` and shows the variant's node id with
|
|
292
|
+
`(no name: submitted before 31 Oct)`. An item with no variants is flagged
|
|
293
|
+
`Needs resubmit: no variants`, never hidden. It reads Dev's `getDesignChangeSet`;
|
|
294
|
+
`--json` also gives the replaced rows (`previousRounds`) and the write log.
|
|
295
|
+
Guideline change sets are `design changeset show`.
|
|
296
|
+
|
|
297
|
+
**Change-set context (DEC-0204).** A submit tells the reviewer what they are
|
|
298
|
+
looking at. `figma submit CHANGE_SET --file SUBMIT.json` takes:
|
|
299
|
+
|
|
300
|
+
```json
|
|
301
|
+
{
|
|
302
|
+
"figmaVersion": "VERSION",
|
|
303
|
+
"writeUp": "What the operator is looking at and why",
|
|
304
|
+
"items": [
|
|
305
|
+
{
|
|
306
|
+
"entryKey": "button",
|
|
307
|
+
"figmaNodeId": "1:2",
|
|
308
|
+
"change": "changed",
|
|
309
|
+
"context": "Button: used on every console form; this round adds the Tonal fill",
|
|
310
|
+
"variants": [
|
|
311
|
+
{ "nodeId": "1:3", "name": "Button / Tonal", "context": "The Tonal fill, for secondary actions", "afterPngBase64": "..." }
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
`writeUp` (up to 2000 characters), each item's `context` (500), and each
|
|
319
|
+
variant's `name` (120) and `context` (500) are required. Each is trimmed, and
|
|
320
|
+
none may be only a Figma node id (`1:3`, `I1:2;3:4`). Every item needs at least
|
|
321
|
+
one variant, each one the item's node or a direct child of it: split unrelated
|
|
322
|
+
components into separate items. The CLI checks the text rules before it calls
|
|
323
|
+
Dev and exits `2` with `CHANGE_SET_ITEM_NO_VARIANTS` or
|
|
324
|
+
`CHANGE_SET_CONTEXT_MISSING`, naming each item and variant and what it lacks,
|
|
325
|
+
for example `item 2 (1:40) variant 1:41: name is only a node id`. Dev refuses
|
|
326
|
+
the same with `422`, and `CHANGE_SET_MIXED_COMPONENTS` when a variant lies
|
|
327
|
+
outside its item (the CLI lists each item and the variants outside it). When
|
|
328
|
+
Figma can't answer that check, Dev refuses with `503 FIGMA_UNAVAILABLE`; the CLI
|
|
329
|
+
says when to retry (`details.retryAfter` seconds).
|
|
292
330
|
|
|
293
331
|
`figma resubmit` is round 2 inside the same change set (Dev's
|
|
294
332
|
`resubmitDesignChangeSet`). When every item is decided and some were
|
|
295
333
|
rejected, the set is `applying`: rework the rejected items in Figma (the lock
|
|
296
334
|
check allows writes in `applying`, and refuses them only while a submit is
|
|
297
335
|
`in_review`), then re-submit them. The payload names every rejected item, by
|
|
298
|
-
`itemId` or `figmaNodeId`, with its new variants
|
|
299
|
-
`figma submit
|
|
336
|
+
`itemId` or `figmaNodeId`, with its context and its new variants (each with a
|
|
337
|
+
name and context), exported at 2x as for `figma submit`. `writeUp` is optional:
|
|
338
|
+
sent, it replaces the set's write-up; left out, the set keeps its own. The same
|
|
339
|
+
context checks run before the CLI calls Dev:
|
|
300
340
|
|
|
301
341
|
```json
|
|
302
342
|
{
|
|
303
343
|
"figmaVersion": "VERSION",
|
|
304
344
|
"items": [
|
|
305
|
-
{
|
|
345
|
+
{
|
|
346
|
+
"figmaNodeId": "36:531",
|
|
347
|
+
"context": "Select field: errors read bluntly now",
|
|
348
|
+
"variants": [{ "nodeId": "36:532", "name": "Select / Error", "context": "The error state, reworded", "afterPngBase64": "..." }]
|
|
349
|
+
}
|
|
306
350
|
]
|
|
307
351
|
}
|
|
308
352
|
```
|
package/dist/cli.js
CHANGED
|
@@ -135,14 +135,20 @@ Usage: nodii-dev <command> [options] [--json]
|
|
|
135
135
|
figma published FILE_KEY|CHANGE_SET --figma-version V # a file key marks every awaiting set published
|
|
136
136
|
figma check|log-write|submit|apply|abandon|release
|
|
137
137
|
figma submit CHANGE_SET --file SUBMIT.json [--sync]
|
|
138
|
+
# SUBMIT.json: { figmaVersion, writeUp, items: [{ figmaNodeId, change, context,
|
|
139
|
+
# variants: [{ nodeId, name, context, afterPngBase64 }] }] } (DEC-0204);
|
|
140
|
+
# a missing writeUp, context or variant name, or an item with no variants,
|
|
141
|
+
# is refused before Dev is called (writeUp <= 2000, context <= 500, name <= 120;
|
|
142
|
+
# never a bare node id)
|
|
138
143
|
figma checked CHANGE_SET --unused-properties --stale-placeholders --dialog-body # the hand checks the submit nudge asks for
|
|
139
144
|
# submit, resubmit and design check --change-set run as a job in Dev
|
|
140
145
|
# and poll it (a large set outlasts the edge's timeout); --sync waits
|
|
141
146
|
# on one request instead. A 502/504 is checked against the set, never resent
|
|
142
147
|
figma withdraw CHANGE_SET # holder takes back a submit: in_review -> editing (or a re-submit -> applying)
|
|
143
148
|
figma resubmit CHANGE_SET PAYLOAD.json [--sync]
|
|
144
|
-
# holder re-submits every rejected item: applying -> in_review, round + 1
|
|
145
|
-
|
|
149
|
+
# holder re-submits every rejected item: applying -> in_review, round + 1;
|
|
150
|
+
# each item needs context, each variant name and context; writeUp optional
|
|
151
|
+
figma changeset show CHANGE_SET # write-up, items, context, variants, round, decision and comment (with the previous round's)
|
|
146
152
|
figma file add FILE_KEY --name TEXT --kind design-system|surfaces|prototype [--module M]
|
|
147
153
|
# register a Figma file in Dev so it can be locked
|
|
148
154
|
hook claude-figma-pre|claude-figma-post|safety-pre|safety-post|nudge-pre|nudge-stop|session-start|managed-dispatch|print-settings
|
|
@@ -963,7 +969,7 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
963
969
|
if (action === "submit") {
|
|
964
970
|
const payload = f.file ? JSON.parse(await readFile(f.file, "utf8")) : { figmaVersion: requireFlag(f, "figma-version") };
|
|
965
971
|
// A 200 carries top-level warnings (STALE_FIGMA_VERSION): print them.
|
|
966
|
-
return emit(await figmaSubmit(rest[0], payload, { sync: submitMode(f) }), json, (p) =>
|
|
972
|
+
return emit(await figmaSubmit(rest[0], payload, { sync: submitMode(f), file: f.file || "the submit (no --file)" }), json, (p) =>
|
|
967
973
|
[JSON.stringify(p.data, null, 2), ...conformanceLines({ warnings: p.warnings })].join("\n"));
|
|
968
974
|
}
|
|
969
975
|
if (action === "file") {
|
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.
|
|
7
|
+
export const VERSION = "0.6.52";
|
|
8
8
|
export const configPath = () =>
|
|
9
9
|
process.env.NODII_DEV_CONFIG_PATH ??
|
|
10
10
|
join(homedir(), ".config/nodii-dev/config.json");
|
package/dist/figma.js
CHANGED
|
@@ -35,7 +35,7 @@ const RESUBMIT_REFUSALS = {
|
|
|
35
35
|
CHANGE_SET_CHANGED: (id) => `${id} changed while re-submitting; read it with nodii-dev figma changeset show ${id} and try again.`,
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
/** A round-2 payload: { figmaVersion, items: [{ itemId | figmaNodeId, variants: [{ nodeId, beforePngBase64?, afterPngBase64? }] }] }. */
|
|
38
|
+
/** A round-2 payload: { figmaVersion, writeUp?, items: [{ itemId | figmaNodeId, context, variants: [{ nodeId, name, context, beforePngBase64?, afterPngBase64? }] }] }. */
|
|
39
39
|
export function resubmitPayload(text, file) {
|
|
40
40
|
let body;
|
|
41
41
|
try {
|
|
@@ -49,14 +49,116 @@ export function resubmitPayload(text, file) {
|
|
|
49
49
|
if (!Array.isArray(body.items) || body.items.length === 0) throw bad("items must list the rejected items");
|
|
50
50
|
body.items.forEach((item, n) => {
|
|
51
51
|
if (!item?.itemId && !item?.figmaNodeId) throw bad(`items[${n}] needs itemId or figmaNodeId`);
|
|
52
|
-
|
|
53
|
-
item.variants.forEach((v, m) => {
|
|
52
|
+
(Array.isArray(item.variants) ? item.variants : []).forEach((v, m) => {
|
|
54
53
|
if (!v?.nodeId) throw bad(`items[${n}].variants[${m}] needs nodeId`);
|
|
55
54
|
});
|
|
56
55
|
});
|
|
57
56
|
return body;
|
|
58
57
|
}
|
|
59
58
|
|
|
59
|
+
// Change-set context (DEC-0204, DEV-DSN-19 to DEV-DSN-21, DEV-DSN-27): the set's
|
|
60
|
+
// write-up, each item's context and each variant's name and context, checked
|
|
61
|
+
// with Dev's own text rules before anything is sent (DEV-DSN-25).
|
|
62
|
+
const CONTEXT_LIMITS = { writeUp: 2000, "item.context": 500, "variant.name": 120, "variant.context": 500 };
|
|
63
|
+
const BARE_NODE_ID = /^(?:\d+:\d+|I\d+:\d+(?:;\d+:\d+)*)$/;
|
|
64
|
+
|
|
65
|
+
/** Why Dev refuses a context text: "missing", "too_long", "node_id", or null when it passes. */
|
|
66
|
+
export function textProblem(value, limit) {
|
|
67
|
+
const text = typeof value === "string" ? value.trim() : "";
|
|
68
|
+
if (!text) return "missing";
|
|
69
|
+
if (text.length > limit) return "too_long";
|
|
70
|
+
return BARE_NODE_ID.test(text) ? "node_id" : null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Every item without a variant, and every context problem, in the shape of Dev's
|
|
75
|
+
* CHANGE_SET_ITEM_NO_VARIANTS and CHANGE_SET_CONTEXT_MISSING details. A re-submit
|
|
76
|
+
* may leave out writeUp (the set keeps its own); one it sends must pass.
|
|
77
|
+
*/
|
|
78
|
+
export function contextProblems(body, { resubmit = false } = {}) {
|
|
79
|
+
const items = [];
|
|
80
|
+
const problems = [];
|
|
81
|
+
const check = (field, value, where) => {
|
|
82
|
+
const problem = textProblem(value, CONTEXT_LIMITS[field]);
|
|
83
|
+
if (problem) problems.push({ field, problem, ...where });
|
|
84
|
+
};
|
|
85
|
+
if (!resubmit || body?.writeUp !== undefined) check("writeUp", body?.writeUp, {});
|
|
86
|
+
(Array.isArray(body?.items) ? body.items : []).forEach((item, itemIndex) => {
|
|
87
|
+
const at = { itemIndex, ...(item?.figmaNodeId ? { figmaNodeId: item.figmaNodeId } : {}), ...(item?.itemId ? { itemId: item.itemId } : {}) };
|
|
88
|
+
check("item.context", item?.context, at);
|
|
89
|
+
const variants = Array.isArray(item?.variants) ? item.variants : [];
|
|
90
|
+
if (!variants.length) items.push({ index: itemIndex, figmaNodeId: item?.figmaNodeId ?? item?.itemId ?? null });
|
|
91
|
+
for (const v of variants) {
|
|
92
|
+
check("variant.name", v?.name, { ...at, variantNodeId: v?.nodeId ?? null });
|
|
93
|
+
check("variant.context", v?.context, { ...at, variantNodeId: v?.nodeId ?? null });
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return { items, problems };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const itemLabel = (p) => `item ${(p.itemIndex ?? p.index ?? 0) + 1} (${p.figmaNodeId ?? p.itemId ?? "no node id"})`;
|
|
100
|
+
const FIELD_HINT = {
|
|
101
|
+
writeUp: ["writeUp", "say what the operator is looking at and why"],
|
|
102
|
+
"item.context": ["context", "say what the component is, where it is used and what this round changes"],
|
|
103
|
+
"variant.name": ["name", `give the variant's name, e.g. "Button / Tonal"`],
|
|
104
|
+
"variant.context": ["context", "say what changed for this variant and where it is used"],
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/** One plain-English line per context problem, naming the item and variant. */
|
|
108
|
+
export function contextProblemLines(problems = []) {
|
|
109
|
+
return problems.map((p) => {
|
|
110
|
+
const [name, hint] = FIELD_HINT[p.field] ?? [p.field, "fix it"];
|
|
111
|
+
const where =
|
|
112
|
+
p.field === "writeUp" ? "" : `${itemLabel(p)}${p.field.startsWith("variant.") ? ` variant ${p.variantNodeId ?? "with no nodeId"}` : ""}: `;
|
|
113
|
+
const what =
|
|
114
|
+
p.problem === "too_long" ? `is longer than ${CONTEXT_LIMITS[p.field] ?? "its limit of"} characters; shorten it`
|
|
115
|
+
: p.problem === "node_id" ? `is only a node id; ${hint}`
|
|
116
|
+
: `is missing; ${hint}`;
|
|
117
|
+
return ` ${where}${name} ${what}`;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const noVariantLines = (items = []) =>
|
|
122
|
+
items.map((i) => ` ${itemLabel(i)} has no variants; add at least one { nodeId, name, context } (an empty item reaches review with nothing to see)`);
|
|
123
|
+
|
|
124
|
+
/** Refuses, before any call to Dev, a submit or re-submit body that Dev would refuse for its context (DEV-DSN-25). */
|
|
125
|
+
export function assertContext(body, { resubmit = false, file = "the payload" } = {}) {
|
|
126
|
+
const { items, problems } = contextProblems(body, { resubmit });
|
|
127
|
+
if (items.length)
|
|
128
|
+
throw new CliError(
|
|
129
|
+
"CHANGE_SET_ITEM_NO_VARIANTS",
|
|
130
|
+
[`${file}: ${items.length} item(s) list no variants (DEV-DSN-27); nothing was sent:`, ...noVariantLines(items),
|
|
131
|
+
...(problems.length ? ["Also fix:", ...contextProblemLines(problems)] : [])].join("\n"),
|
|
132
|
+
2,
|
|
133
|
+
{ items, ...(problems.length ? { problems } : {}) },
|
|
134
|
+
);
|
|
135
|
+
if (problems.length)
|
|
136
|
+
throw new CliError(
|
|
137
|
+
"CHANGE_SET_CONTEXT_MISSING",
|
|
138
|
+
[`${file}: ${problems.length} context problem(s) (DEC-0204); nothing was sent:`, ...contextProblemLines(problems)].join("\n"),
|
|
139
|
+
2,
|
|
140
|
+
{ problems },
|
|
141
|
+
);
|
|
142
|
+
return body;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Dev's refusals of a submit or re-submit's context and component scope (DEC-0204), with what to do next.
|
|
146
|
+
const CONTEXT_REFUSALS = {
|
|
147
|
+
CHANGE_SET_ITEM_NO_VARIANTS: (message, details) => [message, ...noVariantLines(details?.items)].join("\n"),
|
|
148
|
+
CHANGE_SET_CONTEXT_MISSING: (message, details) => [message, ...contextProblemLines(details?.problems)].join("\n"),
|
|
149
|
+
CHANGE_SET_MIXED_COMPONENTS: (message, details) =>
|
|
150
|
+
[
|
|
151
|
+
message,
|
|
152
|
+
...(details?.items ?? []).map((i) => ` item ${i.figmaNodeId}: outside it ${(i.outside ?? []).join(", ") || "?"}`),
|
|
153
|
+
"Each variant must be its item's node or a direct child of it at the submitted version: split unrelated components into separate items, then submit again.",
|
|
154
|
+
].join("\n"),
|
|
155
|
+
FIGMA_UNAVAILABLE: (message, details) =>
|
|
156
|
+
[
|
|
157
|
+
message,
|
|
158
|
+
`Figma could not answer Dev's read (on a submit, the component check), so Dev refused and changed nothing. ${details?.retryAfter ? `Retry after ${details.retryAfter} seconds.` : "Retry in a few minutes."}`,
|
|
159
|
+
].join("\n"),
|
|
160
|
+
};
|
|
161
|
+
|
|
60
162
|
// Async submit, re-submit and dry run (`Prefer: respond-async`): a large set's
|
|
61
163
|
// gate outlasts the edge's 30 s timeout (CS-2470 got a 504 while Dev went on to
|
|
62
164
|
// answer 422), so Dev answers 202 with a job, polled here until it ends. A Dev
|
|
@@ -216,7 +318,7 @@ export async function figmaResubmit(id, file, { request = devRequest, read = (f)
|
|
|
216
318
|
} catch (error) {
|
|
217
319
|
throw new CliError("USAGE", `cannot read ${file}: ${error.message}`, 2);
|
|
218
320
|
}
|
|
219
|
-
const body = resubmitPayload(text, file);
|
|
321
|
+
const body = assertContext(resubmitPayload(text, file), { resubmit: true, file });
|
|
220
322
|
try {
|
|
221
323
|
return await submitCall(id, "resubmit", body, { request, ...options });
|
|
222
324
|
} catch (error) {
|
|
@@ -236,23 +338,32 @@ export async function figmaChangeSetShow(id, { request = devRequest } = {}) {
|
|
|
236
338
|
}
|
|
237
339
|
}
|
|
238
340
|
|
|
341
|
+
// A set submitted before 31 Oct 2026 has no write-up, context or variant names (null).
|
|
342
|
+
const BEFORE_CONTEXT = "submitted before 31 Oct";
|
|
239
343
|
const variantLine = (v) =>
|
|
240
|
-
|
|
344
|
+
` variant ${v.figmaNodeId} ${v.name ?? `(no name: ${BEFORE_CONTEXT})`} (${[v.beforeImageId && "before", v.afterImageId && "after"].filter(Boolean).join(", ") || "no images"})${v.context ? `: ${v.context}` : ""}`;
|
|
241
345
|
|
|
242
|
-
/**
|
|
346
|
+
/**
|
|
347
|
+
* One change set as lines: its write-up, and its items' round, decision, comment,
|
|
348
|
+
* the previous round's decision and comment, context and variants. An item with
|
|
349
|
+
* no variants needs a re-submit (DESIGN-SYSTEM-PARITY-4): it is flagged, never hidden.
|
|
350
|
+
*/
|
|
243
351
|
export function figmaChangeSetText(cs) {
|
|
244
352
|
const c = cs.itemCounts ?? {};
|
|
245
353
|
const lines = [
|
|
246
354
|
`${cs.id} ${cs.state} ${cs.title}`,
|
|
247
355
|
`file ${cs.file?.name ?? cs.fileKey} (${cs.fileKey}); holder ${cs.holder?.agent?.displayName ?? cs.holder?.agent?.id ?? "none"}`,
|
|
248
356
|
`${c.total ?? cs.items.length} items: ${c.approved ?? 0} approved, ${c.rejected ?? 0} rejected, ${c.pending ?? 0} pending`,
|
|
357
|
+
`write-up: ${cs.writeUp ?? (cs.state === "editing" ? "none yet" : `none (${BEFORE_CONTEXT})`)}`,
|
|
249
358
|
];
|
|
250
359
|
for (const item of cs.items ?? []) {
|
|
251
360
|
lines.push(`- ${item.decision} round ${item.round} ${item.figmaNodeId} ${item.entryKey ?? "(new)"} ${item.change} item ${item.id}`);
|
|
252
361
|
if (item.comment) lines.push(` comment: ${item.comment}`);
|
|
253
362
|
if (item.previousItemId)
|
|
254
363
|
lines.push(` round ${item.round - 1}: ${item.previousDecision ?? "?"}${item.previousComment ? `: ${item.previousComment}` : ""}`);
|
|
255
|
-
|
|
364
|
+
lines.push(` context: ${item.context ?? `none (${BEFORE_CONTEXT})`}`);
|
|
365
|
+
if (item.variants?.length) lines.push(...item.variants.map(variantLine));
|
|
366
|
+
else lines.push(" Needs resubmit: no variants");
|
|
256
367
|
}
|
|
257
368
|
if (cs.previousRounds?.length) lines.push(`${cs.previousRounds.length} earlier-round item(s) replaced by a re-submit; --json lists them.`);
|
|
258
369
|
return lines.join("\n");
|
|
@@ -374,6 +485,8 @@ function scopeRefusal(error, id) {
|
|
|
374
485
|
return new CliError(error.code, conflictText(error.message, error.details), error.exitCode ?? 1, error.details);
|
|
375
486
|
if (error?.code === "WRITE_OUT_OF_SCOPE")
|
|
376
487
|
return new CliError(error.code, outOfScopeText(error.message, error.details, id), error.exitCode ?? 1, error.details);
|
|
488
|
+
const say = CONTEXT_REFUSALS[error?.code];
|
|
489
|
+
if (say) return new CliError(error.code, say(error.message, error.details), error.exitCode ?? 1, error.details);
|
|
377
490
|
return null;
|
|
378
491
|
}
|
|
379
492
|
|
|
@@ -484,10 +597,19 @@ export const figmaScopeSetText = (id, data) =>
|
|
|
484
597
|
...(data?.released?.length ? [`Released for other sets: ${data.released.map(scopeText).join(", ")}`] : []),
|
|
485
598
|
].join("\n");
|
|
486
599
|
|
|
487
|
-
/**
|
|
488
|
-
|
|
489
|
-
|
|
600
|
+
/**
|
|
601
|
+
* A submit, async unless `sync` (options: sync, request, send, progress, sleep).
|
|
602
|
+
* A body without its context (writeUp, item context, variant name and context)
|
|
603
|
+
* is refused here, before any call to Dev (DEV-DSN-25).
|
|
604
|
+
*/
|
|
605
|
+
export async function figmaSubmit(id, payload, { request = devRequest, file = "the submit body", ...options } = {}) {
|
|
606
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) throw new CliError("USAGE", `${file}: expected a JSON object`, 2);
|
|
607
|
+
if (!Array.isArray(payload.items) || payload.items.length === 0)
|
|
608
|
+
throw new CliError("USAGE", `${file}: items must list the set's items, each with its context and variants (figma submit CHANGE_SET --file SUBMIT.json)`, 2);
|
|
609
|
+
assertContext(payload, { file });
|
|
610
|
+
return changeSetCall(id, (method, path, body) => submitCall(id, "submit", body, { request, ...options }))(
|
|
490
611
|
"POST", `/api/v1/design/change-sets/${encode(id)}/submit`, payload);
|
|
612
|
+
}
|
|
491
613
|
|
|
492
614
|
/** checkDesignConformance: the submit gate's dry run on a change set; changes no state. Body: { figmaVersion?, items? }. Async unless `sync`. */
|
|
493
615
|
export const figmaConformance = (id, body = {}, { request = devRequest, sync = false, ...options } = {}) =>
|