@nodii/dev 0.6.13 → 0.6.14

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/figma.js CHANGED
@@ -242,6 +242,41 @@ export async function figmaScopeAdd(id, scopes, { request = devRequest } = {}) {
242
242
  return changeSetCall(id, request)("POST", `/api/v1/design/change-sets/${encode(id)}/scopes`, { scopes });
243
243
  }
244
244
 
245
+ /**
246
+ * Narrows a held set to exactly these scopes (Dev issue 104,
247
+ * setDesignChangeSetScopes); the rest is released for other sets. Each must
248
+ * sit inside what the set holds: the whole file holds everything, a page its
249
+ * components and creates.
250
+ */
251
+ export async function figmaScopeSet(id, scopes, { request = devRequest } = {}) {
252
+ if (!id || !scopes.length) throw new CliError("USAGE", `figma scope set CHANGE_SET ${SCOPE_USAGE} [--scope ...]`, 2);
253
+ try {
254
+ return await request("PUT", `/api/v1/design/change-sets/${encode(id)}/scopes`, { scopes });
255
+ } catch (error) {
256
+ if (error?.code === "SCOPE_NOT_NARROWER")
257
+ throw new CliError(error.code, `${error.message}\nscope set only narrows; to claim more, run nodii-dev figma scope add ${id} --scope ...`, error.exitCode ?? 1, error.details);
258
+ if (error?.code === "WRITE_OUT_OF_SCOPE")
259
+ throw new CliError(
260
+ error.code,
261
+ [
262
+ error.message,
263
+ ...(error.details?.nodeIds?.length ? [`Would fall outside: ${error.details.nodeIds.join(", ")}`] : []),
264
+ `Keep a scope that holds them (styles and variables need --scope foundations), or revert those nodes to how they were at ${id}'s base version.`,
265
+ ].join("\n"),
266
+ error.exitCode ?? 1,
267
+ error.details,
268
+ );
269
+ throw scopeRefusal(error, id) ?? error;
270
+ }
271
+ }
272
+
273
+ /** What a narrowing left the set holding, and what it released. */
274
+ export const figmaScopeSetText = (id, data) =>
275
+ [
276
+ `${id} holds ${data?.scopes?.length ?? 0} scope(s): ${(data?.scopes ?? []).map(scopeText).join(", ") || "none"}`,
277
+ ...(data?.released?.length ? [`Released for other sets: ${data.released.map(scopeText).join(", ")}`] : []),
278
+ ].join("\n");
279
+
245
280
  export const figmaSubmit = (id, payload, { request = devRequest } = {}) =>
246
281
  changeSetCall(id, request)("POST", `/api/v1/design/change-sets/${encode(id)}/submit`, payload);
247
282
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.13",
3
+ "version": "0.6.14",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {