@nodii/dev 0.6.106 → 0.6.108

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/dist/cli.js CHANGED
@@ -187,7 +187,7 @@ Usage: nodii-dev <command> [options] [--json]
187
187
  # --all --fetch skips and reports a Surface that is not published;
188
188
  # --post-scoreboard comments the per-module scoreboard on the issue;
189
189
  # a 429 stops the read, and --fetch --write --resume keeps what is saved
190
- figma lock FILE_KEY --title TEXT [--scope KIND:ID ...]
190
+ figma lock FILE_KEY --title TEXT [--scope KIND:ID ...] [--lane-reads FILE]
191
191
  # scopes: component:NODE page:NODE section:NODE foundations create:PAGE:NAME;
192
192
  # no --scope locks the whole file (DEC-0032)
193
193
  figma scope add CHANGE_SET --scope KIND:ID [--scope ...] # widen a held set's scopes
@@ -233,7 +233,11 @@ Usage: nodii-dev <command> [options] [--json]
233
233
  # change sets in dependency order (hub-260): each file's sets are actioned
234
234
  # in order; NEXT marks the ones an operator can act on now
235
235
  figma file add FILE_KEY --name TEXT --kind design-system|surfaces|prototype [--module M]
236
- # register a Figma file in Dev so it can be locked
236
+ # register a Figma file in Dev so it can be locked; on a registered
237
+ # key, staff or the hub's Steward correct its name, kind or module
238
+ figma file retire FILE_KEY --reason TEXT
239
+ # staff or the hub's Steward: not canonical. Closes its sets still editing
240
+ # or awaiting publish, and refuses new locks
237
241
  hook claude-figma-pre|claude-figma-post|safety-pre|safety-post|nudge-pre|nudge-stop|surface-gen-pre|session-start|session-kind|managed-dispatch|claude-managed-dispatch|print-settings
238
242
  # session-start and session-kind (first prompt) print the session's kind:
239
243
  # lane, coordinator, steward or operator assistant, with its contract (MW1-92)
@@ -712,6 +716,12 @@ const REGISTER_REFUSALS = {
712
716
  FIGMA_FILE_NOT_READABLE: (key) => `Dev's Figma account can't read ${key}; share the file with that account.`,
713
717
  };
714
718
 
719
+ const FILE_RETIRE_USAGE = "figma file retire FILE_KEY --reason TEXT";
720
+ export async function figmaFileRetire(value, reason, { request = devRequest } = {}) {
721
+ if (!value || typeof reason !== "string" || !reason.trim()) throw new CliError("USAGE", FILE_RETIRE_USAGE, 2);
722
+ return request("POST", `/api/v1/design/files/${encode(figmaFileKey(value))}/retire`, { reason: reason.trim() });
723
+ }
724
+
715
725
  export async function figmaFileAdd(value, flags, { request = devRequest } = {}) {
716
726
  if (!value) throw new CliError("USAGE", "figma file add FILE_KEY --name TEXT --kind KIND [--module M]", 2);
717
727
  const key = figmaFileKey(value);
@@ -1292,7 +1302,7 @@ export async function main(argv = process.argv.slice(2)) {
1292
1302
  }
1293
1303
  if (command === "figma") {
1294
1304
  if (action === "lock")
1295
- return emit(await figmaLock(rest[0], requireFlag(f, "title"), { scopes: scopesFrom(f) }), json, (p) => figmaLockText(p.data));
1305
+ return emit(await figmaLock(rest[0], requireFlag(f, "title"), { scopes: scopesFrom(f), ...(f["lane-reads"] ? { laneReads: await readLaneReads(f["lane-reads"]) } : {}) }).catch((error) => { throw laneReadsRefusal(error); }), json, (p) => figmaLockText(p.data));
1296
1306
  if (action === "scope") {
1297
1307
  if (!["add", "set"].includes(rest[0]) || !rest[1] || rest.length > 2) throw new CliError("USAGE", "figma scope add|set CHANGE_SET --scope KIND:ID [--scope ...]", 2);
1298
1308
  if (rest[0] === "set") return emit(await figmaScopeSet(rest[1], scopesFrom(f)), json, (p) => figmaScopeSetText(rest[1], p.data));
@@ -1338,7 +1348,12 @@ export async function main(argv = process.argv.slice(2)) {
1338
1348
  [JSON.stringify(p.data, null, 2), ...conformanceLines({ warnings: p.warnings })].join("\n"));
1339
1349
  }
1340
1350
  if (action === "file") {
1341
- if (rest[0] !== "add") throw new CliError("USAGE", "figma file add FILE_KEY --name TEXT --kind KIND [--module M]", 2);
1351
+ if (rest[0] === "retire") {
1352
+ if (rest.length > 2) throw new CliError("USAGE", FILE_RETIRE_USAGE, 2);
1353
+ return emit(await figmaFileRetire(rest[1], f.reason), json, (p) =>
1354
+ `${p.data.fileKey} is retired: ${p.data.retiredReason}.${p.data.abandoned?.length ? ` Closed as abandoned: ${p.data.abandoned.join(", ")}.` : ""}`);
1355
+ }
1356
+ if (rest[0] !== "add") throw new CliError("USAGE", "figma file add FILE_KEY --name TEXT --kind KIND [--module M] | figma file retire FILE_KEY --reason TEXT", 2);
1342
1357
  return emit(await figmaFileAdd(rest[1], f), json, (p) =>
1343
1358
  `${p.data.fileKey} is registered in Dev: ${p.data.name} (${p.data.kind}${p.data.module ? `, ${p.data.module}` : ""}).`);
1344
1359
  }
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.106";
7
+ export const VERSION = "0.6.108";
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
@@ -642,13 +642,14 @@ export const holdsSet = (check) => Boolean(check?.changeSetId) && (check.allowed
642
642
 
643
643
  const isWholeFile = (scopes) => !scopes?.length || scopes.some((s) => s.kind === "file");
644
644
 
645
- export async function figmaLock(value, title, { scopes = [], request = devRequest, laneScope = currentLaneFigmaScope } = {}) {
645
+ export async function figmaLock(value, title, { scopes = [], request = devRequest, laneScope = currentLaneFigmaScope, laneReads } = {}) {
646
646
  const key = figmaFileKey(value);
647
647
  // The lane's Freeze bounds which files and component sets it may lock.
648
648
  await assertWithinLaneScope(await laneScope({}, { request }), key, scopes);
649
649
  const result = await fileCall(key, request)("POST", `/api/v1/design/files/${encode(key)}/lock`, {
650
650
  changeSetTitle: title,
651
651
  ...(scopes.length ? { scopes } : {}),
652
+ ...(laneReads ? { laneReads } : {}),
652
653
  });
653
654
  // A Dev that doesn't know scopes ignores them and locks the whole file,
654
655
  // which blocks every other lane: say so loudly instead of exiting 0.
@@ -1005,7 +1006,7 @@ export function laneReadsScript(nodes) {
1005
1006
  const ids = nodeIdList(nodes);
1006
1007
  if (!ids.length) throw new CliError("USAGE", "figma lane-reads-script --nodes ID[,ID]", 2);
1007
1008
  return `// Run through the Figma MCP's use_figma. It only reads. Set figmaVersion in the
1008
- // result to the version you read at (nodii-dev figma changeset show), and add
1009
+ // result to the version you read at (for a new claim, the file's newest version), and add
1009
1010
  // base: { atBase, offBase, how } if Dev asks for a base comparison.
1010
1011
  const ids = ${JSON.stringify(ids)};
1011
1012
  const nodes = [];
@@ -1036,6 +1037,7 @@ for (const id of ids) {
1036
1037
  topComponent: top ? { id: top.id, name: top.name } : null,
1037
1038
  });
1038
1039
  }
1039
- return { figmaVersion: "SET-ME", nodes, gone };
1040
+ const pages = figma.root.children.map((page) => ({ id: page.id, name: page.name }));
1041
+ return { figmaVersion: "SET-ME", pages, nodes, gone };
1040
1042
  `;
1041
1043
  }
package/dist/flags.js CHANGED
@@ -72,7 +72,7 @@ export const COMMAND_FLAGS = {
72
72
  // hub-260: list takes these; show takes none.
73
73
  "figma changeset": ["file", "actionable", "all", "limit"],
74
74
  "figma apply": ["file", "figma-version", "lane-reads"],
75
- "figma lock": ["title", "scope"],
75
+ "figma lock": ["title", "scope", "lane-reads"],
76
76
  "surface generate": ["write", "check", "fetch", "all", "module", "type", "figma-version", "report", "post-scoreboard", "resume"],
77
77
  };
78
78
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.106",
3
+ "version": "0.6.108",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {