wildcrane 0.11.86 → 0.11.88

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.
Files changed (2) hide show
  1. package/dist/kanban.mjs +227 -392
  2. package/package.json +1 -1
package/dist/kanban.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // ai4kanban 0.11.86 — built from the CLI's TypeScript sources by cli/scripts/build.mjs.
2
+ // ai4kanban 0.11.88 — built from the CLI's TypeScript sources by cli/scripts/build.mjs.
3
3
  // Do not edit: every change belongs in cli/src/, and a build overwrites this file.
4
4
  import { createRequire as __ai4kanbanRequire } from 'node:module'
5
5
  const require = __ai4kanbanRequire(import.meta.url)
@@ -594,9 +594,9 @@ function floatSafeRemainder(val, step) {
594
594
  return 0;
595
595
  return ratio - roundedRatio;
596
596
  }
597
- function defineLazy(object3, key, getter) {
597
+ function defineLazy(object2, key, getter) {
598
598
  let value = void 0;
599
- Object.defineProperty(object3, key, {
599
+ Object.defineProperty(object2, key, {
600
600
  get() {
601
601
  if (value === EVALUATING) {
602
602
  return void 0;
@@ -608,7 +608,7 @@ function defineLazy(object3, key, getter) {
608
608
  return value;
609
609
  },
610
610
  set(v) {
611
- Object.defineProperty(object3, key, {
611
+ Object.defineProperty(object2, key, {
612
612
  value: v
613
613
  // configurable: true,
614
614
  });
@@ -688,10 +688,10 @@ function mergeDefs(...defs) {
688
688
  function cloneDef(schema) {
689
689
  return mergeDefs(schema._zod.def);
690
690
  }
691
- function getElementAtPath(obj3, path88) {
692
- if (!path88)
691
+ function getElementAtPath(obj3, path87) {
692
+ if (!path87)
693
693
  return obj3;
694
- return path88.reduce((acc, key) => acc?.[key], obj3);
694
+ return path87.reduce((acc, key) => acc?.[key], obj3);
695
695
  }
696
696
  function promiseAllObject(promisesObj) {
697
697
  const keys = Object.keys(promisesObj);
@@ -950,11 +950,11 @@ function explicitlyAborted(x, startIndex = 0) {
950
950
  }
951
951
  return false;
952
952
  }
953
- function prefixIssues(path88, issues) {
953
+ function prefixIssues(path87, issues) {
954
954
  return issues.map((iss) => {
955
955
  var _a3;
956
956
  (_a3 = iss).path ?? (_a3.path = []);
957
- iss.path.unshift(path88);
957
+ iss.path.unshift(path87);
958
958
  return iss;
959
959
  });
960
960
  }
@@ -1487,16 +1487,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
1487
1487
  }
1488
1488
  function formatError(error62, mapper = (issue2) => issue2.message) {
1489
1489
  const fieldErrors = { _errors: [] };
1490
- const processError = (error63, path88 = []) => {
1490
+ const processError = (error63, path87 = []) => {
1491
1491
  for (const issue2 of error63.issues) {
1492
1492
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1493
- issue2.errors.map((issues) => processError({ issues }, [...path88, ...issue2.path]));
1493
+ issue2.errors.map((issues) => processError({ issues }, [...path87, ...issue2.path]));
1494
1494
  } else if (issue2.code === "invalid_key") {
1495
- processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
1495
+ processError({ issues: issue2.issues }, [...path87, ...issue2.path]);
1496
1496
  } else if (issue2.code === "invalid_element") {
1497
- processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
1497
+ processError({ issues: issue2.issues }, [...path87, ...issue2.path]);
1498
1498
  } else {
1499
- const fullpath = [...path88, ...issue2.path];
1499
+ const fullpath = [...path87, ...issue2.path];
1500
1500
  if (fullpath.length === 0) {
1501
1501
  fieldErrors._errors.push(mapper(issue2));
1502
1502
  } else {
@@ -1535,17 +1535,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
1535
1535
  }
1536
1536
  function treeifyError(error62, mapper = (issue2) => issue2.message) {
1537
1537
  const result = { errors: [] };
1538
- const processError = (error63, path88 = []) => {
1538
+ const processError = (error63, path87 = []) => {
1539
1539
  var _a3;
1540
1540
  for (const issue2 of error63.issues) {
1541
1541
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1542
- issue2.errors.map((issues) => processError({ issues }, [...path88, ...issue2.path]));
1542
+ issue2.errors.map((issues) => processError({ issues }, [...path87, ...issue2.path]));
1543
1543
  } else if (issue2.code === "invalid_key") {
1544
- processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
1544
+ processError({ issues: issue2.issues }, [...path87, ...issue2.path]);
1545
1545
  } else if (issue2.code === "invalid_element") {
1546
- processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
1546
+ processError({ issues: issue2.issues }, [...path87, ...issue2.path]);
1547
1547
  } else {
1548
- const fullpath = [...path88, ...issue2.path];
1548
+ const fullpath = [...path87, ...issue2.path];
1549
1549
  if (fullpath.length === 0) {
1550
1550
  result.errors.push(mapper(issue2));
1551
1551
  continue;
@@ -1584,8 +1584,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
1584
1584
  }
1585
1585
  function toDotPath(_path) {
1586
1586
  const segs = [];
1587
- const path88 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1588
- for (const seg of path88) {
1587
+ const path87 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1588
+ for (const seg of path87) {
1589
1589
  if (typeof seg === "number")
1590
1590
  segs.push(`[${seg}]`);
1591
1591
  else if (typeof seg === "symbol")
@@ -16270,8 +16270,8 @@ function foldObjects(members2) {
16270
16270
  }
16271
16271
  const properties = {};
16272
16272
  const required2 = /* @__PURE__ */ new Set();
16273
- for (const object3 of objects) {
16274
- for (const key in object3.properties) {
16273
+ for (const object2 of objects) {
16274
+ for (const key in object2.properties) {
16275
16275
  if (Object.prototype.hasOwnProperty.call(properties, key))
16276
16276
  continue;
16277
16277
  const parts = [];
@@ -16285,18 +16285,18 @@ function foldObjects(members2) {
16285
16285
  const merged = parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts };
16286
16286
  assignProp(properties, key, merged);
16287
16287
  }
16288
- for (const key of object3.required ?? [])
16288
+ for (const key of object2.required ?? [])
16289
16289
  required2.add(key);
16290
16290
  }
16291
16291
  const folded = { type: "object", properties };
16292
16292
  if (required2.size)
16293
16293
  folded.required = [...required2];
16294
- if (objects.every((object3) => object3.additionalProperties === false)) {
16294
+ if (objects.every((object2) => object2.additionalProperties === false)) {
16295
16295
  folded.additionalProperties = false;
16296
16296
  } else {
16297
16297
  const constraints = [];
16298
- for (const object3 of objects) {
16299
- const constraint = undeclaredConstraint(object3);
16298
+ for (const object2 of objects) {
16299
+ const constraint = undeclaredConstraint(object2);
16300
16300
  if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint)))
16301
16301
  constraints.push(constraint);
16302
16302
  }
@@ -16692,12 +16692,12 @@ function toJSONSchema(input2, params) {
16692
16692
  processSchema(schema, ctx2);
16693
16693
  }
16694
16694
  const schemas = {};
16695
- const external2 = {
16695
+ const external = {
16696
16696
  registry: registry2,
16697
16697
  uri: params?.uri,
16698
16698
  defs
16699
16699
  };
16700
- ctx2.external = external2;
16700
+ ctx2.external = external;
16701
16701
  for (const entry of registry2._idmap.entries()) {
16702
16702
  const [key, schema] = entry;
16703
16703
  extractDefs(ctx2, schema);
@@ -19617,13 +19617,13 @@ function resolveRef(ref, ctx) {
19617
19617
  if (!ref.startsWith("#")) {
19618
19618
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
19619
19619
  }
19620
- const path88 = ref.slice(1).split("/").filter(Boolean);
19621
- if (path88.length === 0) {
19620
+ const path87 = ref.slice(1).split("/").filter(Boolean);
19621
+ if (path87.length === 0) {
19622
19622
  return ctx.rootSchema;
19623
19623
  }
19624
19624
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
19625
- if (path88[0] === defsKey) {
19626
- const key = path88[1] === void 0 ? void 0 : decodeJSONPointerSegment(path88[1]);
19625
+ if (path87[0] === defsKey) {
19626
+ const key = path87[1] === void 0 ? void 0 : decodeJSONPointerSegment(path87[1]);
19627
19627
  if (!key || !ctx.defs[key]) {
19628
19628
  throw new Error(`Reference not found: ${ref}`);
19629
19629
  }
@@ -22832,7 +22832,7 @@ var init_package = __esm({
22832
22832
  "package.json"() {
22833
22833
  package_default = {
22834
22834
  name: "wildcrane",
22835
- version: "0.11.86",
22835
+ version: "0.11.88",
22836
22836
  akbContract: 29,
22837
22837
  description: "WildCrane's `akb` command \u2014 scaffold the Markdown board under docs/kanban/, put an agent on a card, and carry the flows the agent works by.",
22838
22838
  keywords: [
@@ -25249,10 +25249,10 @@ function findRollout(threadId) {
25249
25249
  }
25250
25250
  for (const name of names2) {
25251
25251
  if (!name.startsWith("rollout-") || !name.endsWith(tail)) continue;
25252
- const path88 = join2(dir, name);
25252
+ const path87 = join2(dir, name);
25253
25253
  try {
25254
- const at = statSync2(path88).mtimeMs;
25255
- if (!newest2 || at > newest2.at) newest2 = { path: path88, at };
25254
+ const at = statSync2(path87).mtimeMs;
25255
+ if (!newest2 || at > newest2.at) newest2 = { path: path87, at };
25256
25256
  } catch {
25257
25257
  }
25258
25258
  }
@@ -25260,11 +25260,11 @@ function findRollout(threadId) {
25260
25260
  return newest2?.path;
25261
25261
  }
25262
25262
  function readCodexRunFacts(threadId) {
25263
- const path88 = findRollout(threadId);
25264
- if (!path88) return void 0;
25263
+ const path87 = findRollout(threadId);
25264
+ if (!path87) return void 0;
25265
25265
  let raw;
25266
25266
  try {
25267
- raw = readFileSync2(path88, "utf8");
25267
+ raw = readFileSync2(path87, "utf8");
25268
25268
  } catch {
25269
25269
  return void 0;
25270
25270
  }
@@ -25390,8 +25390,8 @@ function renderCompleted(item) {
25390
25390
  const changes = Array.isArray(item.changes) ? item.changes : [];
25391
25391
  return changes.map((raw) => {
25392
25392
  const change2 = obj2(raw);
25393
- const path88 = str2(change2.path);
25394
- return path88 ? `\u23FA ${str2(change2.kind) || "change"}(${path88})
25393
+ const path87 = str2(change2.path);
25394
+ return path87 ? `\u23FA ${str2(change2.kind) || "change"}(${path87})
25395
25395
  ` : "";
25396
25396
  }).join("");
25397
25397
  }
@@ -25729,10 +25729,10 @@ function readKimiRunFacts(sessionId) {
25729
25729
  const total = { input: 0, cacheCreation: 0, cacheRead: 0, output: 0 };
25730
25730
  let model;
25731
25731
  let holding = 0;
25732
- for (const { path: path88, main } of wireFiles(entry.sessionDir)) {
25732
+ for (const { path: path87, main } of wireFiles(entry.sessionDir)) {
25733
25733
  let raw;
25734
25734
  try {
25735
- raw = readFileSync3(path88, "utf8");
25735
+ raw = readFileSync3(path87, "utf8");
25736
25736
  } catch {
25737
25737
  continue;
25738
25738
  }
@@ -26109,8 +26109,8 @@ var init_tail = __esm({
26109
26109
  import fs22 from "node:fs";
26110
26110
  function whereHint(update2, title) {
26111
26111
  const locations = Array.isArray(update2.locations) ? update2.locations : [];
26112
- const path88 = str2(obj2(locations[0]).path);
26113
- return path88 && !title.includes(path88) ? hint(path88) : "";
26112
+ const path87 = str2(obj2(locations[0]).path);
26113
+ return path87 && !title.includes(path87) ? hint(path87) : "";
26114
26114
  }
26115
26115
  function saidBy(update2) {
26116
26116
  const content = Array.isArray(update2.content) ? update2.content : [];
@@ -27146,6 +27146,7 @@ async function run(io, options, count3) {
27146
27146
  const execution = randomUUID4();
27147
27147
  let host2 = {};
27148
27148
  let cleanup = { status: "confirmed", execution, kept: [] };
27149
+ let hostCleanup;
27149
27150
  let settlement;
27150
27151
  let replySnapshots = /* @__PURE__ */ new Map();
27151
27152
  const visible = /* @__PURE__ */ new Set();
@@ -27202,11 +27203,11 @@ async function run(io, options, count3) {
27202
27203
  };
27203
27204
  const closed2 = () => {
27204
27205
  const reason = "Codex connection closed before all work and results finished.";
27205
- if (work.work().some((w) => ["running", "unknown"].includes(w.status))) note("Connection lost; managed cleanup is unconfirmed.");
27206
+ if (hostCleanup !== "confirmed" && work.work().some((w) => ["running", "unknown"].includes(w.status))) note("Connection lost; managed cleanup is unconfirmed.");
27206
27207
  end2(reason, makeFailure("runtime", reason, { code: "connection_lost", detail: reason }));
27207
27208
  };
27208
27209
  const inputFailed = (e) => {
27209
- if (work.work().some((w) => ["running", "unknown"].includes(w.status))) note("Connection input failed; managed cleanup is unconfirmed.");
27210
+ if (hostCleanup !== "confirmed" && work.work().some((w) => ["running", "unknown"].includes(w.status))) note("Connection input failed; managed cleanup is unconfirmed.");
27210
27211
  end2(e.message, executionFailure(e));
27211
27212
  };
27212
27213
  io.stdout.once("close", closed2);
@@ -27304,7 +27305,7 @@ async function run(io, options, count3) {
27304
27305
  startupTimer = setTimeout(() => {
27305
27306
  if (!started) io.event?.({ kind: "log", data: { text: "[conversation] start_unconfirmed" } });
27306
27307
  }, CONVERSATION_MS.start);
27307
- await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text5 }, ...images.map((path88) => ({ type: "localImage", path: path88 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error62) => {
27308
+ await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text5 }, ...images.map((path87) => ({ type: "localImage", path: path87 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error62) => {
27308
27309
  if (!started) throw error62;
27309
27310
  });
27310
27311
  };
@@ -27429,6 +27430,14 @@ async function run(io, options, count3) {
27429
27430
  return;
27430
27431
  }
27431
27432
  const p = obj2(msg.params);
27433
+ if (msg.method === "wildcrane/cleanup") {
27434
+ if (p.status === "confirmed") hostCleanup = "confirmed";
27435
+ else if (p.status === "unconfirmed") {
27436
+ hostCleanup = "unconfirmed";
27437
+ note(str2(p.diagnostic) || "Codex cleanup is unconfirmed.");
27438
+ }
27439
+ return;
27440
+ }
27432
27441
  const source2 = str2(p.threadId);
27433
27442
  if (!work.own(source2)) return;
27434
27443
  if (msg.method === "item/commandExecution/terminalInteraction") {
@@ -29639,18 +29648,18 @@ var init_file_limits = __esm({
29639
29648
  });
29640
29649
 
29641
29650
  // src/lib/shared/board-files.ts
29642
- function isBoardPath(path88) {
29643
- if (!path88 || path88.length > 500 || path88.startsWith("/") || path88.includes("\\") || path88.includes("\0")) return false;
29644
- if (path88.split("/").some((part) => !part || part === "." || part === "..")) return false;
29645
- if (path88 === "todo/README.md" || path88.split("/").includes(".sync")) return false;
29646
- if (path88.startsWith("studios/")) return true;
29647
- if (SETTINGS.includes(path88)) return true;
29648
- if (path88.startsWith("rules/")) return isSettingsPath(path88);
29649
- if (path88.startsWith("assets/")) return taskOfAssets(path88) !== null;
29650
- return ROOTS.some((root2) => path88.startsWith(root2)) && path88.endsWith(".md");
29651
- }
29652
- function numberOfCard(path88) {
29653
- const n = ROOT.exec(path88)?.[1] ?? CARD.exec(path88)?.[1];
29651
+ function isBoardPath(path87) {
29652
+ if (!path87 || path87.length > 500 || path87.startsWith("/") || path87.includes("\\") || path87.includes("\0")) return false;
29653
+ if (path87.split("/").some((part) => !part || part === "." || part === "..")) return false;
29654
+ if (path87 === "todo/README.md" || path87.split("/").includes(".sync")) return false;
29655
+ if (path87.startsWith("studios/")) return true;
29656
+ if (SETTINGS.includes(path87)) return true;
29657
+ if (path87.startsWith("rules/")) return isSettingsPath(path87);
29658
+ if (path87.startsWith("assets/")) return taskOfAssets(path87) !== null;
29659
+ return ROOTS.some((root2) => path87.startsWith(root2)) && path87.endsWith(".md");
29660
+ }
29661
+ function numberOfCard(path87) {
29662
+ const n = ROOT.exec(path87)?.[1] ?? CARD.exec(path87)?.[1];
29654
29663
  return n ? Number(n) : null;
29655
29664
  }
29656
29665
  var ROOTS, SETTINGS, isSettingsPath, CARD, ROOT, assetsFile, taskOfAssets, studioFolder, studioName;
@@ -29660,11 +29669,11 @@ var init_board_files = __esm({
29660
29669
  init_file_limits();
29661
29670
  ROOTS = ["todo/", ".archive/", "memory/", "studios/", "triage/", "assets/", "rules/"];
29662
29671
  SETTINGS = ["modules.md", "config.md"];
29663
- isSettingsPath = (path88) => SETTINGS.includes(path88) || /^rules\/(?:studios\/[^/]+|proposer|project-writer|dismissal-reviewer|memory-pruner)\.md$/.test(path88);
29672
+ isSettingsPath = (path87) => SETTINGS.includes(path87) || /^rules\/(?:studios\/[^/]+|proposer|project-writer|dismissal-reviewer|memory-pruner)\.md$/.test(path87);
29664
29673
  CARD = /^(?:todo|\.archive)\/(?:[^/]+\/)*(\d+)-[^/]*\.md$/;
29665
29674
  ROOT = /^(?:todo|\.archive)\/(?:[^/]+\/)*(\d+)-[^/]+\/root\.md$/;
29666
29675
  assetsFile = (task) => `assets/${task}.json`;
29667
- taskOfAssets = (path88) => /^assets\/(task_[0-9a-f]+)\.json$/.exec(path88)?.[1] ?? null;
29676
+ taskOfAssets = (path87) => /^assets\/(task_[0-9a-f]+)\.json$/.exec(path87)?.[1] ?? null;
29668
29677
  studioFolder = (id2) => id2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
29669
29678
  studioName = (id2) => id2.startsWith("wf_builtin_") ? id2.slice("wf_builtin_".length).replace(/_/g, "-") : studioFolder(id2);
29670
29679
  }
@@ -32887,8 +32896,8 @@ var require_utils = __commonJS({
32887
32896
  }
32888
32897
  return ind;
32889
32898
  }
32890
- function removeDotSegments(path88) {
32891
- let input2 = path88;
32899
+ function removeDotSegments(path87) {
32900
+ let input2 = path87;
32892
32901
  const output2 = [];
32893
32902
  let nextSlash = -1;
32894
32903
  let len = 0;
@@ -32962,11 +32971,11 @@ var require_utils = __commonJS({
32962
32971
  }
32963
32972
  return output2.join("");
32964
32973
  }
32965
- function removeDotSegmentsRelative(path88) {
32966
- if (path88 === "" || path88[0] === "/") {
32967
- return removeDotSegments(path88);
32974
+ function removeDotSegmentsRelative(path87) {
32975
+ if (path87 === "" || path87[0] === "/") {
32976
+ return removeDotSegments(path87);
32968
32977
  }
32969
- const segments = path88.split("/");
32978
+ const segments = path87.split("/");
32970
32979
  const last = segments.length - 1;
32971
32980
  const output2 = [];
32972
32981
  let trailingDirectory = false;
@@ -33329,8 +33338,8 @@ var require_schemes = __commonJS({
33329
33338
  }
33330
33339
  if (wsComponent.resourceName) {
33331
33340
  const queryIndex = wsComponent.resourceName.indexOf("?");
33332
- const path88 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
33333
- wsComponent.path = path88 && path88 !== "/" ? path88 : void 0;
33341
+ const path87 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
33342
+ wsComponent.path = path87 && path87 !== "/" ? path87 : void 0;
33334
33343
  wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
33335
33344
  wsComponent.resourceName = void 0;
33336
33345
  }
@@ -36490,17 +36499,17 @@ var require_visit = __commonJS({
36490
36499
  visit2.BREAK = BREAK;
36491
36500
  visit2.SKIP = SKIP;
36492
36501
  visit2.REMOVE = REMOVE;
36493
- function visit_(key, node2, visitor, path88) {
36494
- const ctrl = callVisitor(key, node2, visitor, path88);
36502
+ function visit_(key, node2, visitor, path87) {
36503
+ const ctrl = callVisitor(key, node2, visitor, path87);
36495
36504
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
36496
- replaceNode(key, path88, ctrl);
36497
- return visit_(key, ctrl, visitor, path88);
36505
+ replaceNode(key, path87, ctrl);
36506
+ return visit_(key, ctrl, visitor, path87);
36498
36507
  }
36499
36508
  if (typeof ctrl !== "symbol") {
36500
36509
  if (identity.isCollection(node2)) {
36501
- path88 = Object.freeze(path88.concat(node2));
36510
+ path87 = Object.freeze(path87.concat(node2));
36502
36511
  for (let i = 0; i < node2.items.length; ++i) {
36503
- const ci = visit_(i, node2.items[i], visitor, path88);
36512
+ const ci = visit_(i, node2.items[i], visitor, path87);
36504
36513
  if (typeof ci === "number")
36505
36514
  i = ci - 1;
36506
36515
  else if (ci === BREAK)
@@ -36511,13 +36520,13 @@ var require_visit = __commonJS({
36511
36520
  }
36512
36521
  }
36513
36522
  } else if (identity.isPair(node2)) {
36514
- path88 = Object.freeze(path88.concat(node2));
36515
- const ck = visit_("key", node2.key, visitor, path88);
36523
+ path87 = Object.freeze(path87.concat(node2));
36524
+ const ck = visit_("key", node2.key, visitor, path87);
36516
36525
  if (ck === BREAK)
36517
36526
  return BREAK;
36518
36527
  else if (ck === REMOVE)
36519
36528
  node2.key = null;
36520
- const cv = visit_("value", node2.value, visitor, path88);
36529
+ const cv = visit_("value", node2.value, visitor, path87);
36521
36530
  if (cv === BREAK)
36522
36531
  return BREAK;
36523
36532
  else if (cv === REMOVE)
@@ -36538,17 +36547,17 @@ var require_visit = __commonJS({
36538
36547
  visitAsync.BREAK = BREAK;
36539
36548
  visitAsync.SKIP = SKIP;
36540
36549
  visitAsync.REMOVE = REMOVE;
36541
- async function visitAsync_(key, node2, visitor, path88) {
36542
- const ctrl = await callVisitor(key, node2, visitor, path88);
36550
+ async function visitAsync_(key, node2, visitor, path87) {
36551
+ const ctrl = await callVisitor(key, node2, visitor, path87);
36543
36552
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
36544
- replaceNode(key, path88, ctrl);
36545
- return visitAsync_(key, ctrl, visitor, path88);
36553
+ replaceNode(key, path87, ctrl);
36554
+ return visitAsync_(key, ctrl, visitor, path87);
36546
36555
  }
36547
36556
  if (typeof ctrl !== "symbol") {
36548
36557
  if (identity.isCollection(node2)) {
36549
- path88 = Object.freeze(path88.concat(node2));
36558
+ path87 = Object.freeze(path87.concat(node2));
36550
36559
  for (let i = 0; i < node2.items.length; ++i) {
36551
- const ci = await visitAsync_(i, node2.items[i], visitor, path88);
36560
+ const ci = await visitAsync_(i, node2.items[i], visitor, path87);
36552
36561
  if (typeof ci === "number")
36553
36562
  i = ci - 1;
36554
36563
  else if (ci === BREAK)
@@ -36559,13 +36568,13 @@ var require_visit = __commonJS({
36559
36568
  }
36560
36569
  }
36561
36570
  } else if (identity.isPair(node2)) {
36562
- path88 = Object.freeze(path88.concat(node2));
36563
- const ck = await visitAsync_("key", node2.key, visitor, path88);
36571
+ path87 = Object.freeze(path87.concat(node2));
36572
+ const ck = await visitAsync_("key", node2.key, visitor, path87);
36564
36573
  if (ck === BREAK)
36565
36574
  return BREAK;
36566
36575
  else if (ck === REMOVE)
36567
36576
  node2.key = null;
36568
- const cv = await visitAsync_("value", node2.value, visitor, path88);
36577
+ const cv = await visitAsync_("value", node2.value, visitor, path87);
36569
36578
  if (cv === BREAK)
36570
36579
  return BREAK;
36571
36580
  else if (cv === REMOVE)
@@ -36592,23 +36601,23 @@ var require_visit = __commonJS({
36592
36601
  }
36593
36602
  return visitor;
36594
36603
  }
36595
- function callVisitor(key, node2, visitor, path88) {
36604
+ function callVisitor(key, node2, visitor, path87) {
36596
36605
  if (typeof visitor === "function")
36597
- return visitor(key, node2, path88);
36606
+ return visitor(key, node2, path87);
36598
36607
  if (identity.isMap(node2))
36599
- return visitor.Map?.(key, node2, path88);
36608
+ return visitor.Map?.(key, node2, path87);
36600
36609
  if (identity.isSeq(node2))
36601
- return visitor.Seq?.(key, node2, path88);
36610
+ return visitor.Seq?.(key, node2, path87);
36602
36611
  if (identity.isPair(node2))
36603
- return visitor.Pair?.(key, node2, path88);
36612
+ return visitor.Pair?.(key, node2, path87);
36604
36613
  if (identity.isScalar(node2))
36605
- return visitor.Scalar?.(key, node2, path88);
36614
+ return visitor.Scalar?.(key, node2, path87);
36606
36615
  if (identity.isAlias(node2))
36607
- return visitor.Alias?.(key, node2, path88);
36616
+ return visitor.Alias?.(key, node2, path87);
36608
36617
  return void 0;
36609
36618
  }
36610
- function replaceNode(key, path88, node2) {
36611
- const parent = path88[path88.length - 1];
36619
+ function replaceNode(key, path87, node2) {
36620
+ const parent = path87[path87.length - 1];
36612
36621
  if (identity.isCollection(parent)) {
36613
36622
  parent.items[key] = node2;
36614
36623
  } else if (identity.isPair(parent)) {
@@ -37220,10 +37229,10 @@ var require_Collection = __commonJS({
37220
37229
  var createNode = require_createNode();
37221
37230
  var identity = require_identity();
37222
37231
  var Node = require_Node();
37223
- function collectionFromPath(schema, path88, value) {
37232
+ function collectionFromPath(schema, path87, value) {
37224
37233
  let v = value;
37225
- for (let i = path88.length - 1; i >= 0; --i) {
37226
- const k = path88[i];
37234
+ for (let i = path87.length - 1; i >= 0; --i) {
37235
+ const k = path87[i];
37227
37236
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
37228
37237
  const a = [];
37229
37238
  a[k] = v;
@@ -37242,7 +37251,7 @@ var require_Collection = __commonJS({
37242
37251
  sourceObjects: /* @__PURE__ */ new Map()
37243
37252
  });
37244
37253
  }
37245
- var isEmptyPath = (path88) => path88 == null || typeof path88 === "object" && !!path88[Symbol.iterator]().next().done;
37254
+ var isEmptyPath = (path87) => path87 == null || typeof path87 === "object" && !!path87[Symbol.iterator]().next().done;
37246
37255
  var Collection = class extends Node.NodeBase {
37247
37256
  constructor(type, schema) {
37248
37257
  super(type);
@@ -37272,11 +37281,11 @@ var require_Collection = __commonJS({
37272
37281
  * be a Pair instance or a `{ key, value }` object, which may not have a key
37273
37282
  * that already exists in the map.
37274
37283
  */
37275
- addIn(path88, value) {
37276
- if (isEmptyPath(path88))
37284
+ addIn(path87, value) {
37285
+ if (isEmptyPath(path87))
37277
37286
  this.add(value);
37278
37287
  else {
37279
- const [key, ...rest] = path88;
37288
+ const [key, ...rest] = path87;
37280
37289
  const node2 = this.get(key, true);
37281
37290
  if (identity.isCollection(node2))
37282
37291
  node2.addIn(rest, value);
@@ -37290,8 +37299,8 @@ var require_Collection = __commonJS({
37290
37299
  * Removes a value from the collection.
37291
37300
  * @returns `true` if the item was found and removed.
37292
37301
  */
37293
- deleteIn(path88) {
37294
- const [key, ...rest] = path88;
37302
+ deleteIn(path87) {
37303
+ const [key, ...rest] = path87;
37295
37304
  if (rest.length === 0)
37296
37305
  return this.delete(key);
37297
37306
  const node2 = this.get(key, true);
@@ -37305,8 +37314,8 @@ var require_Collection = __commonJS({
37305
37314
  * scalar values from their surrounding node; to disable set `keepScalar` to
37306
37315
  * `true` (collections are always returned intact).
37307
37316
  */
37308
- getIn(path88, keepScalar) {
37309
- const [key, ...rest] = path88;
37317
+ getIn(path87, keepScalar) {
37318
+ const [key, ...rest] = path87;
37310
37319
  const node2 = this.get(key, true);
37311
37320
  if (rest.length === 0)
37312
37321
  return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
@@ -37324,8 +37333,8 @@ var require_Collection = __commonJS({
37324
37333
  /**
37325
37334
  * Checks if the collection includes a value with the key `key`.
37326
37335
  */
37327
- hasIn(path88) {
37328
- const [key, ...rest] = path88;
37336
+ hasIn(path87) {
37337
+ const [key, ...rest] = path87;
37329
37338
  if (rest.length === 0)
37330
37339
  return this.has(key);
37331
37340
  const node2 = this.get(key, true);
@@ -37335,8 +37344,8 @@ var require_Collection = __commonJS({
37335
37344
  * Sets a value in this collection. For `!!set`, `value` needs to be a
37336
37345
  * boolean to add/remove the item from the set.
37337
37346
  */
37338
- setIn(path88, value) {
37339
- const [key, ...rest] = path88;
37347
+ setIn(path87, value) {
37348
+ const [key, ...rest] = path87;
37340
37349
  if (rest.length === 0) {
37341
37350
  this.set(key, value);
37342
37351
  } else {
@@ -39851,9 +39860,9 @@ var require_Document = __commonJS({
39851
39860
  this.contents.add(value);
39852
39861
  }
39853
39862
  /** Adds a value to the document. */
39854
- addIn(path88, value) {
39863
+ addIn(path87, value) {
39855
39864
  if (assertCollection(this.contents))
39856
- this.contents.addIn(path88, value);
39865
+ this.contents.addIn(path87, value);
39857
39866
  }
39858
39867
  /**
39859
39868
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -39928,14 +39937,14 @@ var require_Document = __commonJS({
39928
39937
  * Removes a value from the document.
39929
39938
  * @returns `true` if the item was found and removed.
39930
39939
  */
39931
- deleteIn(path88) {
39932
- if (Collection.isEmptyPath(path88)) {
39940
+ deleteIn(path87) {
39941
+ if (Collection.isEmptyPath(path87)) {
39933
39942
  if (this.contents == null)
39934
39943
  return false;
39935
39944
  this.contents = null;
39936
39945
  return true;
39937
39946
  }
39938
- return assertCollection(this.contents) ? this.contents.deleteIn(path88) : false;
39947
+ return assertCollection(this.contents) ? this.contents.deleteIn(path87) : false;
39939
39948
  }
39940
39949
  /**
39941
39950
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -39950,10 +39959,10 @@ var require_Document = __commonJS({
39950
39959
  * scalar values from their surrounding node; to disable set `keepScalar` to
39951
39960
  * `true` (collections are always returned intact).
39952
39961
  */
39953
- getIn(path88, keepScalar) {
39954
- if (Collection.isEmptyPath(path88))
39962
+ getIn(path87, keepScalar) {
39963
+ if (Collection.isEmptyPath(path87))
39955
39964
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
39956
- return identity.isCollection(this.contents) ? this.contents.getIn(path88, keepScalar) : void 0;
39965
+ return identity.isCollection(this.contents) ? this.contents.getIn(path87, keepScalar) : void 0;
39957
39966
  }
39958
39967
  /**
39959
39968
  * Checks if the document includes a value with the key `key`.
@@ -39964,10 +39973,10 @@ var require_Document = __commonJS({
39964
39973
  /**
39965
39974
  * Checks if the document includes a value at `path`.
39966
39975
  */
39967
- hasIn(path88) {
39968
- if (Collection.isEmptyPath(path88))
39976
+ hasIn(path87) {
39977
+ if (Collection.isEmptyPath(path87))
39969
39978
  return this.contents !== void 0;
39970
- return identity.isCollection(this.contents) ? this.contents.hasIn(path88) : false;
39979
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path87) : false;
39971
39980
  }
39972
39981
  /**
39973
39982
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -39984,13 +39993,13 @@ var require_Document = __commonJS({
39984
39993
  * Sets a value in this document. For `!!set`, `value` needs to be a
39985
39994
  * boolean to add/remove the item from the set.
39986
39995
  */
39987
- setIn(path88, value) {
39988
- if (Collection.isEmptyPath(path88)) {
39996
+ setIn(path87, value) {
39997
+ if (Collection.isEmptyPath(path87)) {
39989
39998
  this.contents = value;
39990
39999
  } else if (this.contents == null) {
39991
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path88), value);
40000
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path87), value);
39992
40001
  } else if (assertCollection(this.contents)) {
39993
- this.contents.setIn(path88, value);
40002
+ this.contents.setIn(path87, value);
39994
40003
  }
39995
40004
  }
39996
40005
  /**
@@ -41951,9 +41960,9 @@ var require_cst_visit = __commonJS({
41951
41960
  visit2.BREAK = BREAK;
41952
41961
  visit2.SKIP = SKIP;
41953
41962
  visit2.REMOVE = REMOVE;
41954
- visit2.itemAtPath = (cst, path88) => {
41963
+ visit2.itemAtPath = (cst, path87) => {
41955
41964
  let item = cst;
41956
- for (const [field2, index] of path88) {
41965
+ for (const [field2, index] of path87) {
41957
41966
  const tok = item?.[field2];
41958
41967
  if (tok && "items" in tok) {
41959
41968
  item = tok.items[index];
@@ -41962,23 +41971,23 @@ var require_cst_visit = __commonJS({
41962
41971
  }
41963
41972
  return item;
41964
41973
  };
41965
- visit2.parentCollection = (cst, path88) => {
41966
- const parent = visit2.itemAtPath(cst, path88.slice(0, -1));
41967
- const field2 = path88[path88.length - 1][0];
41974
+ visit2.parentCollection = (cst, path87) => {
41975
+ const parent = visit2.itemAtPath(cst, path87.slice(0, -1));
41976
+ const field2 = path87[path87.length - 1][0];
41968
41977
  const coll = parent?.[field2];
41969
41978
  if (coll && "items" in coll)
41970
41979
  return coll;
41971
41980
  throw new Error("Parent collection not found");
41972
41981
  };
41973
- function _visit(path88, item, visitor) {
41974
- let ctrl = visitor(item, path88);
41982
+ function _visit(path87, item, visitor) {
41983
+ let ctrl = visitor(item, path87);
41975
41984
  if (typeof ctrl === "symbol")
41976
41985
  return ctrl;
41977
41986
  for (const field2 of ["key", "value"]) {
41978
41987
  const token2 = item[field2];
41979
41988
  if (token2 && "items" in token2) {
41980
41989
  for (let i = 0; i < token2.items.length; ++i) {
41981
- const ci = _visit(Object.freeze(path88.concat([[field2, i]])), token2.items[i], visitor);
41990
+ const ci = _visit(Object.freeze(path87.concat([[field2, i]])), token2.items[i], visitor);
41982
41991
  if (typeof ci === "number")
41983
41992
  i = ci - 1;
41984
41993
  else if (ci === BREAK)
@@ -41989,10 +41998,10 @@ var require_cst_visit = __commonJS({
41989
41998
  }
41990
41999
  }
41991
42000
  if (typeof ctrl === "function" && field2 === "key")
41992
- ctrl = ctrl(item, path88);
42001
+ ctrl = ctrl(item, path87);
41993
42002
  }
41994
42003
  }
41995
- return typeof ctrl === "function" ? ctrl(item, path88) : ctrl;
42004
+ return typeof ctrl === "function" ? ctrl(item, path87) : ctrl;
41996
42005
  }
41997
42006
  exports.visit = visit2;
41998
42007
  }
@@ -43854,7 +43863,7 @@ function landSections(body, previews) {
43854
43863
  }
43855
43864
  function parseStudioFile(id2, source2, from, { requirePreviewCopy = false, requireLand = false } = {}) {
43856
43865
  const problems = [];
43857
- const fail = (offset, path88, code, message, hint2) => problems.push({ file: from, ...sourcePosition(source2, offset), path: path88, code, message, hint: hint2 });
43866
+ const fail = (offset, path87, code, message, hint2) => problems.push({ file: from, ...sourcePosition(source2, offset), path: path87, code, message, hint: hint2 });
43858
43867
  const result = () => ({ problem: problems.map((p) => `${p.file}:${p.line}:${p.column} ${p.path}: ${p.code} \u2014 ${p.message}. ${p.hint}`).join("\n"), problems });
43859
43868
  if (!STUDIO_ID.test(id2)) fail(0, "id", "studio-schema", `Invalid Studio ID ${id2}`, "Use lowercase letters, digits and dashes.");
43860
43869
  const front = /^---\r?\n([^]*?)\r?\n---(?:\r?\n|$)/.exec(source2);
@@ -43925,6 +43934,8 @@ function parseStudioFile(id2, source2, from, { requirePreviewCopy = false, requi
43925
43934
  ...raw.names ? { names: raw.names } : {},
43926
43935
  description: raw.description ?? "",
43927
43936
  needsArtifact: raw.needsArtifact ?? false,
43937
+ ...raw.summaries ? { summaries: raw.summaries } : {},
43938
+ ...raw.entrypoints ? { entrypoints: raw.entrypoints } : {},
43928
43939
  ...raw.icon ? { icon: raw.icon } : {},
43929
43940
  previews: parsed.blocks.map((b) => ({ id: b.id, instructions: b.instructions, ...map3[b.id] })),
43930
43941
  rules: rules.trim()
@@ -43959,6 +43970,8 @@ var init_studio_def = __esm({
43959
43970
  name: { type: "string", minLength: 1, pattern: "\\S" },
43960
43971
  names: titles,
43961
43972
  description: { type: "string" },
43973
+ summaries: titles,
43974
+ entrypoints: { type: "array", minItems: 1, maxItems: 10, uniqueItems: true, items: { type: "string", pattern: PREVIEW_ID.source } },
43962
43975
  needsArtifact: { type: "boolean" },
43963
43976
  icon,
43964
43977
  previews: { type: "object", propertyNames: { pattern: PREVIEW_ID.source }, additionalProperties: {
@@ -46338,10 +46351,8 @@ function landedDeliveries(filter = {}) {
46338
46351
  for (const audit of allAudits()) {
46339
46352
  const landing = audit.landing;
46340
46353
  if (typeof audit.cardId !== "number" || landing?.status !== "landed" || !landing.commit) continue;
46341
- const studio = audit.studio?.id || "coding";
46342
46354
  if (filter.since !== void 0 && !(landing.at > filter.since)) continue;
46343
- if (filter.studio !== void 0 && studio !== filter.studio) continue;
46344
- out.push({ cardId: audit.cardId, title: audit.title, studio, at: landing.at, commit: landing.commit });
46355
+ out.push({ cardId: audit.cardId, title: audit.title, studio: audit.studio?.id ?? null, at: landing.at, commit: landing.commit });
46345
46356
  }
46346
46357
  return out.sort((a, b) => a.at - b.at);
46347
46358
  }
@@ -50093,7 +50104,7 @@ function kindOf2(ext) {
50093
50104
  if (type.startsWith("image/")) return "image";
50094
50105
  return type.startsWith("video/") || type.startsWith("audio/") ? "video" : "asset";
50095
50106
  }
50096
- var STORYBOARD, STUDIO, ARRANGED, ASSET, isObject2, TAG3, bodyComponentTags, bodySources, TYPES;
50107
+ var STORYBOARD, STUDIO, ARRANGED, ASSET, isObject2, TAG3, bodySources, TYPES;
50097
50108
  var init_references = __esm({
50098
50109
  "../artifact-sdk/src/internal/references.ts"() {
50099
50110
  "use strict";
@@ -50103,7 +50114,6 @@ var init_references = __esm({
50103
50114
  ASSET = ["spritesheet", "asset"];
50104
50115
  isObject2 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
50105
50116
  TAG3 = /<(Asset|Mockup|Compare|Storyboard|Studio)\b([^<>]*?)\/>/g;
50106
- bodyComponentTags = (body) => componentTags(visibleBody(body));
50107
50117
  bodySources = (body) => [...new Set(bodyReferences(body).map((r) => r.src))];
50108
50118
  TYPES = {
50109
50119
  ".png": "image/png",
@@ -50253,14 +50263,6 @@ function splitFileReference(src) {
50253
50263
  const end2 = src.search(/[?#]/);
50254
50264
  return end2 < 0 ? [src, ""] : [src.slice(0, end2), src.slice(end2)];
50255
50265
  }
50256
- function relativeFileReference(src, owner) {
50257
- const parts = owner.split("/").slice(0, -1);
50258
- for (const part of src.split("/")) {
50259
- if (part === ".." && parts.length && parts.at(-1) !== "..") parts.pop();
50260
- else if (part && part !== ".") parts.push(part);
50261
- }
50262
- return parts.join("/");
50263
- }
50264
50266
  var CSS, fileManifest;
50265
50267
  var init_file_references = __esm({
50266
50268
  "../artifact-sdk/src/internal/file-references.ts"() {
@@ -50288,14 +50290,14 @@ function collectSources(sources2, card, host2) {
50288
50290
  const active3 = /* @__PURE__ */ new Set();
50289
50291
  const out = [];
50290
50292
  const visit2 = (src, types, owner, partial2 = false) => {
50291
- const [path88] = splitFileReference(src);
50293
+ const [path87] = splitFileReference(src);
50292
50294
  let resolved;
50293
50295
  try {
50294
- resolved = host2.resolve(path88, owner);
50296
+ resolved = host2.resolve(path87, owner);
50295
50297
  } catch (error62) {
50296
50298
  if (owner !== card) return { key: null, error: why(error62) };
50297
50299
  if (!nodes.has(src)) {
50298
- const node3 = { key: src, file: null, kind: kindAt(path88, types), error: why(error62), problems: [], dependencies: /* @__PURE__ */ new Map(), aliases: /* @__PURE__ */ new Set([src]) };
50300
+ const node3 = { key: src, file: null, kind: kindAt(path87, types), error: why(error62), problems: [], dependencies: /* @__PURE__ */ new Map(), aliases: /* @__PURE__ */ new Set([src]) };
50299
50301
  nodes.set(src, node3);
50300
50302
  out.push(node3);
50301
50303
  }
@@ -51546,14 +51548,12 @@ function cmdArchived(opts) {
51546
51548
  const studio = opts.studio === void 0 ? null : knownStudio(opts.studio);
51547
51549
  const open4 = boardCardIds();
51548
51550
  const files = archivedFiles();
51549
- const cards = landedDeliveries({ since: since?.getTime(), studio: studio ?? void 0 }).filter((d) => !open4.has(d.cardId)).map((d) => ({
51550
- id: d.cardId,
51551
- title: d.title,
51552
- studio: d.studio,
51553
- landedAt: formatStamp(new Date(d.at)),
51554
- commit: d.commit,
51555
- file: files.has(d.cardId) ? rel(files.get(d.cardId)) : ""
51556
- }));
51551
+ const cards = landedDeliveries({ since: since?.getTime() }).filter((d) => !open4.has(d.cardId)).flatMap((d) => {
51552
+ const file2 = files.get(d.cardId);
51553
+ const recorded = d.studio ?? (file2 ? parseFrontmatter(fs56.readFileSync(file2, "utf8")).meta?.studio || null : null);
51554
+ if (studio && studio !== recorded) return [];
51555
+ return [{ id: d.cardId, title: d.title, studio: recorded, landedAt: formatStamp(new Date(d.at)), commit: d.commit, file: file2 ? rel(file2) : "" }];
51556
+ });
51557
51557
  const result = { cards, since: since ? formatStamp(since) : null, studio };
51558
51558
  const scope = [studio ? `on studio \`${studio}\`` : "", since ? `since ${formatStamp(since)}` : ""].filter(Boolean).join(" ");
51559
51559
  if (!cards.length) {
@@ -51564,7 +51564,7 @@ function cmdArchived(opts) {
51564
51564
  for (const c of cards) {
51565
51565
  say("");
51566
51566
  say(`#${c.id} ${c.title}${c.file ? ` (${c.file})` : ""}`);
51567
- say(` ${c.studio} \xB7 landed ${c.landedAt} \xB7 commit ${c.commit}`);
51567
+ say(` ${c.studio ? `${c.studio} \xB7 ` : ""}landed ${c.landedAt} \xB7 commit ${c.commit}`);
51568
51568
  }
51569
51569
  return result;
51570
51570
  }
@@ -53979,7 +53979,7 @@ var require_command = __commonJS({
53979
53979
  "node_modules/commander/lib/command.js"(exports) {
53980
53980
  var EventEmitter = __require("node:events").EventEmitter;
53981
53981
  var childProcess = __require("node:child_process");
53982
- var path88 = __require("node:path");
53982
+ var path87 = __require("node:path");
53983
53983
  var fs91 = __require("node:fs");
53984
53984
  var process2 = __require("node:process");
53985
53985
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -54979,9 +54979,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
54979
54979
  let launchWithNode = false;
54980
54980
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
54981
54981
  function findFile(baseDir, baseName) {
54982
- const localBin = path88.resolve(baseDir, baseName);
54982
+ const localBin = path87.resolve(baseDir, baseName);
54983
54983
  if (fs91.existsSync(localBin)) return localBin;
54984
- if (sourceExt.includes(path88.extname(baseName))) return void 0;
54984
+ if (sourceExt.includes(path87.extname(baseName))) return void 0;
54985
54985
  const foundExt = sourceExt.find(
54986
54986
  (ext) => fs91.existsSync(`${localBin}${ext}`)
54987
54987
  );
@@ -54999,17 +54999,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
54999
54999
  } catch {
55000
55000
  resolvedScriptPath = this._scriptPath;
55001
55001
  }
55002
- executableDir = path88.resolve(
55003
- path88.dirname(resolvedScriptPath),
55002
+ executableDir = path87.resolve(
55003
+ path87.dirname(resolvedScriptPath),
55004
55004
  executableDir
55005
55005
  );
55006
55006
  }
55007
55007
  if (executableDir) {
55008
55008
  let localFile = findFile(executableDir, executableFile);
55009
55009
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
55010
- const legacyName = path88.basename(
55010
+ const legacyName = path87.basename(
55011
55011
  this._scriptPath,
55012
- path88.extname(this._scriptPath)
55012
+ path87.extname(this._scriptPath)
55013
55013
  );
55014
55014
  if (legacyName !== this._name) {
55015
55015
  localFile = findFile(
@@ -55020,7 +55020,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
55020
55020
  }
55021
55021
  executableFile = localFile || executableFile;
55022
55022
  }
55023
- launchWithNode = sourceExt.includes(path88.extname(executableFile));
55023
+ launchWithNode = sourceExt.includes(path87.extname(executableFile));
55024
55024
  let proc;
55025
55025
  if (process2.platform !== "win32") {
55026
55026
  if (launchWithNode) {
@@ -55867,7 +55867,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
55867
55867
  * @return {Command}
55868
55868
  */
55869
55869
  nameFromFilename(filename) {
55870
- this._name = path88.basename(filename, path88.extname(filename));
55870
+ this._name = path87.basename(filename, path87.extname(filename));
55871
55871
  return this;
55872
55872
  }
55873
55873
  /**
@@ -55881,9 +55881,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
55881
55881
  * @param {string} [path]
55882
55882
  * @return {(string|null|Command)}
55883
55883
  */
55884
- executableDir(path89) {
55885
- if (path89 === void 0) return this._executableDir;
55886
- this._executableDir = path89;
55884
+ executableDir(path88) {
55885
+ if (path88 === void 0) return this._executableDir;
55886
+ this._executableDir = path88;
55887
55887
  return this;
55888
55888
  }
55889
55889
  /**
@@ -57073,8 +57073,8 @@ function prose(box) {
57073
57073
  if (box.warnings.length) out.warnings = box.warnings;
57074
57074
  return out;
57075
57075
  }
57076
- function answer(object3) {
57077
- process.stdout.write(JSON.stringify(object3) + "\n");
57076
+ function answer(object2) {
57077
+ process.stdout.write(JSON.stringify(object2) + "\n");
57078
57078
  }
57079
57079
  function report(err, { program: program2, json: json2, box = null }) {
57080
57080
  if (!(err instanceof BoardError)) {
@@ -63416,6 +63416,11 @@ function publicationFiles(dir) {
63416
63416
  return checked.files;
63417
63417
  }
63418
63418
  async function publishFolder(dir, route2, body, requestId) {
63419
+ const context = taskReviewContext();
63420
+ const task = workspaceTask();
63421
+ if (task && context && reviewAllows(reviewAuthorization(context.review, context.assigned), "implement")) {
63422
+ body = { ...body, source_task: task };
63423
+ }
63419
63424
  const pendingFile = path76.join(dir, ".publication.json");
63420
63425
  const hash3 = crypto7.createHash("sha256").update(JSON.stringify({ route: route2, files: body.files, workspace: body.workspace })).digest("hex");
63421
63426
  let held4;
@@ -63568,6 +63573,8 @@ var init_studio3 = __esm({
63568
63573
  init_board_files();
63569
63574
  init_tasks();
63570
63575
  init_response();
63576
+ init_env();
63577
+ init_review_plan();
63571
63578
  found = (id2) => {
63572
63579
  const flow = studioById(id2);
63573
63580
  if (!flow) {
@@ -64686,170 +64693,6 @@ var init_refine2 = __esm({
64686
64693
  }
64687
64694
  });
64688
64695
 
64689
- // ../artifact-sdk/src/internal/tags.ts
64690
- function variantsOf(raw, src) {
64691
- if (!raw) return [];
64692
- let parsed;
64693
- try {
64694
- parsed = JSON.parse(raw);
64695
- } catch {
64696
- return [];
64697
- }
64698
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return [];
64699
- const list3 = Object.entries(parsed).filter((e) => typeof e[1] === "string" && !!e[1]);
64700
- if (list3.length < 2 || !list3.some(([, s]) => s === src)) return [];
64701
- return list3.map(([label2, s]) => ({ label: label2, src: s }));
64702
- }
64703
- var init_tags = __esm({
64704
- "../artifact-sdk/src/internal/tags.ts"() {
64705
- "use strict";
64706
- }
64707
- });
64708
-
64709
- // src/lib/shared/coding-previews.ts
64710
- var CODING_PREVIEWS;
64711
- var init_coding_previews = __esm({
64712
- "src/lib/shared/coding-previews.ts"() {
64713
- "use strict";
64714
- CODING_PREVIEWS = {
64715
- "tech-stack-advisor": "tech-choices",
64716
- "email-planner": "emails",
64717
- "ui-designer": "ui-design",
64718
- "api-designer": "api-docs",
64719
- "schema-designer": "schema",
64720
- "prompt-writer": "prompts",
64721
- "competitor-research": "competitor-research"
64722
- };
64723
- }
64724
- });
64725
-
64726
- // src/lib/agent/approved-ui.ts
64727
- import path81 from "node:path";
64728
- function approvedUiSource(pins, src, owner) {
64729
- const [ref] = splitFileReference(src);
64730
- if (artifactId.test(ref)) {
64731
- const version2 = approvedUiPin(pins, ref).version;
64732
- const names2 = Object.keys(pins).filter((name) => {
64733
- const pin = approvedUiPin(pins, name);
64734
- return pin.artifact === ref && (version2 === void 0 || pin.version === version2);
64735
- });
64736
- return names2.find((name) => !artifactId.test(name)) ?? names2[0] ?? ref;
64737
- }
64738
- const local = owner && !ref.startsWith(".assets/") ? relativeFileReference(ref, owner) : ref;
64739
- return [local, src, ref, path81.posix.normalize(local)].find((key) => Object.hasOwn(pins, key)) ?? local;
64740
- }
64741
- function approvedUiPin(pins, source2) {
64742
- return object2(Object.hasOwn(pins, source2) ? pins[source2] : void 0);
64743
- }
64744
- function validUiPin(pin) {
64745
- return !pin.error && pin.status !== "pending" && pin.status !== "failed" && typeof pin.artifact === "string" && artifactId.test(pin.artifact) && typeof pin.version === "number" && Number.isSafeInteger(pin.version) && pin.version > 0;
64746
- }
64747
- function approvedUiPreviews(review) {
64748
- if (reviewAuthorization(review).kind !== "delivery") return [];
64749
- const result = [];
64750
- for (const [index, node2] of (review.plan ?? []).entries()) {
64751
- const stage = review.stages.find((stage2) => stage2.id === node2.id);
64752
- const snapshot2 = stage?.snapshot;
64753
- if (node2.kind === "work" || !stage || !snapshot2) continue;
64754
- const evidence = object2(snapshot2.evidence);
64755
- const content = object2(evidence.content);
64756
- const frozenPreviews = Array.isArray(snapshot2.previews) ? snapshot2.previews.filter(isObject2) : [];
64757
- for (const id2 of node2.previews.filter((id3) => id3 === UI_PREVIEW || historicalUiIds.includes(id3))) {
64758
- const preview = object2(content[id2]);
64759
- const body = typeof preview.body === "string" ? preview.body : typeof snapshot2.body === "string" ? parsePreviewBlocks(snapshot2.body).blocks.find((block) => block.id === id2)?.instructions : void 0;
64760
- if (!body) continue;
64761
- const pins = { ...object2(evidence.dependencies), ...object2(frozenPreviews.find((preview2) => preview2.id === id2)?.assets), ...object2(evidence.assets) };
64762
- const files = /* @__PURE__ */ new Map();
64763
- const add2 = (src, label2, device, required2 = true) => {
64764
- if (external.test(src)) return;
64765
- const source2 = approvedUiSource(pins, src);
64766
- if (!required2 && !Object.hasOwn(pins, source2) && !/\.(?:html?|tsx)$/i.test(source2)) return;
64767
- const name = label2.trim() || path81.posix.basename(src);
64768
- const key = JSON.stringify([src, name]);
64769
- let file2 = files.get(key);
64770
- if (!file2) {
64771
- file2 = { src, source: source2, label: name, devices: /* @__PURE__ */ new Set() };
64772
- files.set(key, file2);
64773
- }
64774
- file2.devices.add(device === "mobile" ? "Mobile" : device === "desktop" ? "Desktop" : "Device unspecified");
64775
- };
64776
- for (const { name, attrs } of bodyComponentTags(body)) {
64777
- const label2 = attrs.label ?? "";
64778
- if (name === "Compare" && attrs.a && attrs.b) {
64779
- add2(attrs.a, attrs["a-label"] || label2);
64780
- add2(attrs.b, attrs["b-label"] || label2);
64781
- } else if (attrs.src) {
64782
- const variants = variantsOf(attrs.variants, attrs.src);
64783
- if (variants.length) {
64784
- for (const variant of variants) add2(variant.src, label2 ? `${label2} (${variant.label})` : variant.label, attrs.device);
64785
- } else {
64786
- add2(attrs.src, label2, attrs.device);
64787
- }
64788
- }
64789
- }
64790
- const listed = new Set([...files.values()].map((file2) => file2.src));
64791
- for (const src of bodySources(body)) if (!listed.has(src)) add2(src, "", void 0, false);
64792
- if (files.size) result.push({
64793
- id: id2,
64794
- revision: stage.revision,
64795
- directory: `review-${stage.revision}-${index}/${id2}`,
64796
- body,
64797
- pins,
64798
- files: [...files.values()]
64799
- });
64800
- }
64801
- }
64802
- return result;
64803
- }
64804
- function approvedUiFile(directory, preview, source2) {
64805
- const parts = path81.posix.normalize(splitFileReference(source2)[0]).split("/");
64806
- let parents = 0;
64807
- while (parts[0] === "..") {
64808
- parts.shift();
64809
- parents++;
64810
- }
64811
- const rendered = /\.tsx$/i.test(parts.at(-1) ?? "");
64812
- if (rendered) parts[parts.length - 1] = parts.at(-1).replace(/\.tsx$/i, ".html");
64813
- const safe2 = parts.map((part) => !part || part === "." ? "%00" : part.replace(/[\\:*?"<>|%\x00-\x1f]/g, (char) => `%${char.charCodeAt(0).toString(16).padStart(2, "0")}`));
64814
- return path81.join(directory, preview.directory, `${rendered ? "rendered" : "files"}-${parents}`, ...safe2);
64815
- }
64816
- function approvedUiPrompt(review, directory, includeBody = false) {
64817
- const previews = approvedUiPreviews(review);
64818
- if (!previews.length) return "";
64819
- return [
64820
- "Approved UI previews",
64821
- APPROVED_UI_RULE,
64822
- ...previews.flatMap((preview) => [
64823
- ...includeBody ? [preview.body] : [],
64824
- preview.files.flatMap((file2) => {
64825
- const pin = approvedUiPin(preview.pins, file2.source);
64826
- if (!validUiPin(pin)) return [];
64827
- const ref = directory ? `frozen file: \`${approvedUiFile(directory, preview, file2.source)}\`` : `artifact ${pin.artifact}, version ${pin.version}`;
64828
- return [`- ${file2.label} \xB7 ${[...file2.devices].join(" / ")} \xB7 Review revision ${preview.revision} \xB7 ${file2.src} \xB7 ${ref}`];
64829
- }).join("\n")
64830
- ])
64831
- ].join("\n\n");
64832
- }
64833
- var APPROVED_UI_DIR_ENV, APPROVED_UI_RULE, UI_PREVIEW, historicalUiIds, object2, artifactId, external;
64834
- var init_approved_ui = __esm({
64835
- "src/lib/agent/approved-ui.ts"() {
64836
- "use strict";
64837
- init_file_references();
64838
- init_references();
64839
- init_tags();
64840
- init_coding_previews();
64841
- init_preview_blocks();
64842
- init_review_plan();
64843
- APPROVED_UI_DIR_ENV = "AI4KANBAN_APPROVED_UI_DIR";
64844
- APPROVED_UI_RULE = "Open the approved mockups and follow the Coding Studio delivery requirements for matching the task's intended UI changes.";
64845
- UI_PREVIEW = "ui-design";
64846
- historicalUiIds = Object.keys(CODING_PREVIEWS).filter((id2) => id2 !== UI_PREVIEW && CODING_PREVIEWS[id2] === UI_PREVIEW);
64847
- object2 = (value) => isObject2(value) ? value : {};
64848
- artifactId = /^art_[a-z0-9]+$/i;
64849
- external = /^(?:[a-z][\w+.-]*:|\/|#)/i;
64850
- }
64851
- });
64852
-
64853
64696
  // src/lib/agent/follow.ts
64854
64697
  function refineRunsAfter(asks) {
64855
64698
  return asks.flatMap((ask2) => {
@@ -65010,15 +64853,9 @@ async function watchRun(sessionId, resume = startResume, retryBackoff = backoffM
65010
64853
  const savedPreviews = record2.action === "implement" && process.env[SAVED_PREVIEW_FILE_ENV];
65011
64854
  const review = reviewContext?.review;
65012
64855
  const boundary = review && reviewBoundary(savedPreviews ? { ...review, stages: review.stages.map((stage) => ({ ...stage, snapshot: null })) } : review, reviewContext.assigned);
65013
- const coding = record2.action === "implement" && studioForRun({ id: record2.cardId ?? void 0, deliveryId: record2.deliveryId }) === "coding";
65014
- const uiDirectory = process.env[APPROVED_UI_DIR_ENV];
65015
- const approvedUi = review && coding && (!savedPreviews || uiDirectory) ? approvedUiPrompt(review, uiDirectory, !!savedPreviews) : "";
65016
- const savedPrompt = savedPreviews ? [
65017
- `Read the saved task Previews and their pinned files in \`${savedPreviews}\`. Use these saved versions for the requirements they cover and verify the delivery against them.`,
65018
- ...coding && !approvedUi && review?.plan?.some((node2) => node2.previews.includes("ui-design")) ? [APPROVED_UI_RULE] : []
65019
- ].join("\n") : "";
64856
+ const savedPrompt = savedPreviews ? `Use the task inputs and pinned files listed in \`${savedPreviews}\`. Follow the task's delivery instructions.` : "";
65020
64857
  const retryDiag = record2.retry ? record2.failure ? retryContinuePrompt(record2.failure, record2.retry.attempt, record2.retry.of) : `Previous execution failed: ${record2.retry.reason}. Check existing results before continuing; do not repeat completed operations.` : "";
65021
- const prompt = [process.env.AI4KANBAN_SYNC_DIAGNOSTIC ? syncRepairPrompt(process.env.AI4KANBAN_SYNC_DIAGNOSTIC) : "", retryDiag, conflictPrompt(KANBAN), boundary, basePrompt, resumedStudio, savedPrompt, approvedUi, recoveryPrompt2, discardedCardsPrompt(record2.discardedCards)].filter(Boolean).join("\n\n");
64858
+ const prompt = [process.env.AI4KANBAN_SYNC_DIAGNOSTIC ? syncRepairPrompt(process.env.AI4KANBAN_SYNC_DIAGNOSTIC) : "", retryDiag, conflictPrompt(KANBAN), boundary, basePrompt, resumedStudio, savedPrompt, recoveryPrompt2, discardedCardsPrompt(record2.discardedCards)].filter(Boolean).join("\n\n");
65022
64859
  const before = markBoard();
65023
64860
  const takes = active3.images;
65024
64861
  active3.renderer?.setRequiredImages?.(record2.pictures ?? []);
@@ -65601,8 +65438,6 @@ var STOP_GRACE_MS, STOP_CLOSE_MS, STOP_FINISH_MS, silenceSaid, joinNotes;
65601
65438
  var init_watch = __esm({
65602
65439
  "src/lib/agent/watch.ts"() {
65603
65440
  "use strict";
65604
- init_approved_ui();
65605
- init_runner();
65606
65441
  init_review_plan();
65607
65442
  init_env();
65608
65443
  init_connection_process();
@@ -65642,7 +65477,7 @@ var init_watch = __esm({
65642
65477
 
65643
65478
  // src/commands/run.ts
65644
65479
  import fs83 from "node:fs";
65645
- import path82 from "node:path";
65480
+ import path81 from "node:path";
65646
65481
  async function cmdStartRun(action, args2, opts, program2 = "akb") {
65647
65482
  const { req, follow: follow2, print } = readRequest(action, args2, opts);
65648
65483
  if (!print && (action === "approve" || action === "implement")) {
@@ -65868,7 +65703,7 @@ async function cmdSubStart(words, opts) {
65868
65703
  let prompt = words.join(" ");
65869
65704
  if (opts.file) {
65870
65705
  try {
65871
- prompt = fs83.readFileSync(path82.resolve(opts.file), "utf8");
65706
+ prompt = fs83.readFileSync(path81.resolve(opts.file), "utf8");
65872
65707
  } catch {
65873
65708
  die(`--file: cannot read ${opts.file}`, { kind: "run-refused" });
65874
65709
  }
@@ -66218,7 +66053,7 @@ var init_config3 = __esm({
66218
66053
 
66219
66054
  // src/lib/signals/migrate.ts
66220
66055
  import fs84 from "node:fs";
66221
- import path83 from "node:path";
66056
+ import path82 from "node:path";
66222
66057
  function readHandled() {
66223
66058
  let text5;
66224
66059
  try {
@@ -66240,7 +66075,7 @@ function readHandled() {
66240
66075
  }
66241
66076
  function lift(from, into) {
66242
66077
  fs84.mkdirSync(into, { recursive: true });
66243
- fs84.renameSync(from, path83.join(into, freeName(into, path83.basename(from))));
66078
+ fs84.renameSync(from, path82.join(into, freeName(into, path82.basename(from))));
66244
66079
  }
66245
66080
  function repoint(dir, from, into) {
66246
66081
  let entries2;
@@ -66251,7 +66086,7 @@ function repoint(dir, from, into) {
66251
66086
  }
66252
66087
  for (const entry of entries2) {
66253
66088
  if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
66254
- const file2 = path83.join(dir, entry.name);
66089
+ const file2 = path82.join(dir, entry.name);
66255
66090
  const text5 = fs84.readFileSync(file2, "utf8");
66256
66091
  if (text5.includes(from)) fs84.writeFileSync(file2, text5.split(from).join(into));
66257
66092
  }
@@ -66264,17 +66099,17 @@ function dropIfEmpty(dir) {
66264
66099
  }
66265
66100
  function liftInbox() {
66266
66101
  if (!fs84.existsSync(SIGNALS_OLD_INBOX)) return;
66267
- const oldFiles = path83.join(SIGNALS_OLD_INBOX, "files");
66102
+ const oldFiles = path82.join(SIGNALS_OLD_INBOX, "files");
66268
66103
  if (fs84.existsSync(oldFiles)) {
66269
66104
  for (const entry of fs84.readdirSync(oldFiles, { withFileTypes: true })) {
66270
- if (entry.isFile()) lift(path83.join(oldFiles, entry.name), SIGNALS_FILES);
66105
+ if (entry.isFile()) lift(path82.join(oldFiles, entry.name), SIGNALS_FILES);
66271
66106
  }
66272
66107
  dropIfEmpty(oldFiles);
66273
66108
  }
66274
66109
  const held4 = new Set(readFolder(TRIAGE).map((signal2) => signal2.sourceId));
66275
66110
  for (const entry of fs84.readdirSync(SIGNALS_OLD_INBOX, { withFileTypes: true })) {
66276
66111
  if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
66277
- const from = path83.join(SIGNALS_OLD_INBOX, entry.name);
66112
+ const from = path82.join(SIGNALS_OLD_INBOX, entry.name);
66278
66113
  const item = parse3(from);
66279
66114
  if (item && held4.has(item.sourceId)) {
66280
66115
  fs84.rmSync(from, { force: true });
@@ -66283,7 +66118,7 @@ function liftInbox() {
66283
66118
  if (item) held4.add(item.sourceId);
66284
66119
  lift(from, TRIAGE);
66285
66120
  }
66286
- const wasAt = asWritten(path83.join(SIGNALS_OLD_INBOX, "files"));
66121
+ const wasAt = asWritten(path82.join(SIGNALS_OLD_INBOX, "files"));
66287
66122
  const nowAt = asWritten(SIGNALS_FILES);
66288
66123
  for (const dir of [TRIAGE, SIGNALS_ARCHIVED, SIGNALS_DISMISSED]) repoint(dir, wasAt, nowAt);
66289
66124
  dropIfEmpty(SIGNALS_OLD_INBOX);
@@ -66309,7 +66144,7 @@ function liftHandled() {
66309
66144
  "---",
66310
66145
  ""
66311
66146
  ];
66312
- fs84.writeFileSync(path83.join(SIGNALS_DISMISSED, name), `${front.join("\n")}
66147
+ fs84.writeFileSync(path82.join(SIGNALS_DISMISSED, name), `${front.join("\n")}
66313
66148
  `);
66314
66149
  }
66315
66150
  fs84.rmSync(SIGNALS_OLD_HANDLED, { force: true });
@@ -66330,7 +66165,7 @@ var init_migrate = __esm({
66330
66165
  init_yaml();
66331
66166
  init_inbox();
66332
66167
  HANDLED_LINE = /^-\s+(.+?)\s+—\s+(.+)$/;
66333
- asWritten = (dir) => `${rel(dir).split(path83.sep).join("/")}/`;
66168
+ asWritten = (dir) => `${rel(dir).split(path82.sep).join("/")}/`;
66334
66169
  }
66335
66170
  });
66336
66171
 
@@ -66384,7 +66219,7 @@ var init_identity2 = __esm({
66384
66219
 
66385
66220
  // src/lib/signals/add.ts
66386
66221
  import fs85 from "node:fs";
66387
- import path84 from "node:path";
66222
+ import path83 from "node:path";
66388
66223
  import { createHash as createHash8 } from "node:crypto";
66389
66224
  function linkTitle(url2) {
66390
66225
  let at;
@@ -66397,7 +66232,7 @@ function linkTitle(url2) {
66397
66232
  return oneLine(where) || url2.slice(0, TITLE_MAX);
66398
66233
  }
66399
66234
  function asText(file2) {
66400
- const ext = path84.extname(file2.name).toLowerCase();
66235
+ const ext = path83.extname(file2.name).toLowerCase();
66401
66236
  if (!file2.type.startsWith("text/") && file2.type !== "application/json" && !TEXT_EXTENSIONS.has(ext)) return null;
66402
66237
  try {
66403
66238
  const text5 = new TextDecoder("utf-8", { fatal: true }).decode(file2.data);
@@ -66407,9 +66242,9 @@ function asText(file2) {
66407
66242
  }
66408
66243
  }
66409
66244
  function fileName2(name, data) {
66410
- const base = path84.basename(name);
66411
- const ext = path84.extname(base).toLowerCase().slice(0, 12);
66412
- const word = path84.basename(base, path84.extname(base)).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 40) || "file";
66245
+ const base = path83.basename(name);
66246
+ const ext = path83.extname(base).toLowerCase().slice(0, 12);
66247
+ const word = path83.basename(base, path83.extname(base)).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 40) || "file";
66413
66248
  const hash3 = createHash8("sha256").update(data).digest("hex").slice(0, 8);
66414
66249
  return `${word}-${hash3}${ext}`;
66415
66250
  }
@@ -66418,9 +66253,9 @@ function addToInbox(drop) {
66418
66253
  const typed = (drop.text ?? "").trim();
66419
66254
  const file2 = drop.file;
66420
66255
  if (!typed && !file2) return { ok: false, error: "nothing to add \u2014 paste a link or some text, or drop a file." };
66421
- if (file2 && file2.data.length === 0) return { ok: false, error: `${path84.basename(file2.name)} is empty.` };
66256
+ if (file2 && file2.data.length === 0) return { ok: false, error: `${path83.basename(file2.name)} is empty.` };
66422
66257
  if (file2 && file2.data.length > MAX_BYTES3) {
66423
- return { ok: false, error: `${path84.basename(file2.name)} is over ${MAX_BYTES3 / 1024 / 1024} MB \u2014 too big for the board.` };
66258
+ return { ok: false, error: `${path83.basename(file2.name)} is over ${MAX_BYTES3 / 1024 / 1024} MB \u2014 too big for the board.` };
66424
66259
  }
66425
66260
  const read5 = describe3(typed, file2);
66426
66261
  const keep2 = read5.keep;
@@ -66457,7 +66292,7 @@ function describe3(typed, file2) {
66457
66292
  return only ? [only] : [];
66458
66293
  };
66459
66294
  if (file2) {
66460
- const name = path84.basename(file2.name);
66295
+ const name = path83.basename(file2.name);
66461
66296
  const text5 = asText(file2);
66462
66297
  const note = typed ? `
66463
66298
 
@@ -66469,7 +66304,7 @@ ${typed}` : "";
66469
66304
  const at = keepAt(file2);
66470
66305
  return {
66471
66306
  incoming: {
66472
- title: path84.basename(name, path84.extname(name)) || name,
66307
+ title: path83.basename(name, path83.extname(name)) || name,
66473
66308
  summary: `${name} \u2014 ${boardRel2(at)}${note}`,
66474
66309
  ...named2
66475
66310
  },
@@ -66507,13 +66342,13 @@ var init_add = __esm({
66507
66342
  MAX_BYTES3 = 25 * 1024 * 1024;
66508
66343
  TITLE_MAX = 120;
66509
66344
  TEXT_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".markdown", ".txt", ".text", ".csv", ".json", ".yml", ".yaml", ".log"]);
66510
- boardRel2 = (file2) => rel(file2).split(path84.sep).join("/");
66345
+ boardRel2 = (file2) => rel(file2).split(path83.sep).join("/");
66511
66346
  oneLine = (text5) => {
66512
66347
  const first = text5.split("\n").find((line) => line.trim()) ?? "";
66513
66348
  const clean = first.replace(/^#+\s*/, "").trim();
66514
66349
  return clean.length > TITLE_MAX ? `${clean.slice(0, TITLE_MAX - 1).trimEnd()}\u2026` : clean;
66515
66350
  };
66516
- keepAt = (file2) => path84.join(SIGNALS_FILES, fileName2(file2.name, file2.data));
66351
+ keepAt = (file2) => path83.join(SIGNALS_FILES, fileName2(file2.name, file2.data));
66517
66352
  }
66518
66353
  });
66519
66354
 
@@ -66619,7 +66454,7 @@ var init_previews = __esm({
66619
66454
 
66620
66455
  // src/commands/studio-preview.ts
66621
66456
  import fs87 from "node:fs";
66622
- import path85 from "node:path";
66457
+ import path84 from "node:path";
66623
66458
  import { createHash as createHash9, randomUUID as randomUUID9 } from "node:crypto";
66624
66459
  import { spawnSync as spawnSync7 } from "node:child_process";
66625
66460
  function readFolder2(folder2, baseline = false) {
@@ -66628,7 +66463,7 @@ function readFolder2(folder2, baseline = false) {
66628
66463
  const scan = (dir) => {
66629
66464
  for (const e of fs87.readdirSync(dir, { withFileTypes: true })) {
66630
66465
  if (e.name.startsWith(".")) continue;
66631
- const file2 = path85.join(dir, e.name);
66466
+ const file2 = path84.join(dir, e.name);
66632
66467
  if (e.isSymbolicLink()) throw Error(`${file2}: symbolic links are not allowed`);
66633
66468
  if (e.isDirectory()) scan(file2);
66634
66469
  else {
@@ -66645,7 +66480,7 @@ function readFolder2(folder2, baseline = false) {
66645
66480
  return { files, def: checked.def, fingerprint };
66646
66481
  }
66647
66482
  function unified(before, after2, file2, folder2) {
66648
- const a = path85.join(folder2, "a"), b = path85.join(folder2, "b");
66483
+ const a = path84.join(folder2, "a"), b = path84.join(folder2, "b");
66649
66484
  fs87.writeFileSync(a, before ?? "");
66650
66485
  fs87.writeFileSync(b, after2 ?? "");
66651
66486
  const result = spawnSync7("git", ["diff", "--no-index", "--text", "--no-ext-diff", "--no-color", "--unified=3", before === null ? "/dev/null" : a, after2 === null ? "/dev/null" : b], { encoding: "utf8", maxBuffer: 16 * 1024 * 1024 });
@@ -66657,17 +66492,17 @@ ${start < 0 ? "" : lines.slice(start + 2).join("\n")}`;
66657
66492
  }
66658
66493
  async function cmdStudioPreview(id2, opts) {
66659
66494
  if (!locate(id2)) die(`no card ${id2}`, "no-such-card");
66660
- const destination = path85.join(ASSETS, String(id2), "studio-review"), staging = `${destination}.${randomUUID9()}.tmp`, backup = `${destination}.${randomUUID9()}.previous`;
66495
+ const destination = path84.join(ASSETS, String(id2), "studio-review"), staging = `${destination}.${randomUUID9()}.tmp`, backup = `${destination}.${randomUUID9()}.previous`;
66661
66496
  let moved = false;
66662
66497
  try {
66663
- const draft = readFolder2(path85.resolve(opts.folder)), base = opts.base === "empty" ? null : readFolder2(path85.resolve(opts.base), true);
66498
+ const draft = readFolder2(path84.resolve(opts.folder)), base = opts.base === "empty" ? null : readFolder2(path84.resolve(opts.base), true);
66664
66499
  const version2 = readVersion2(draft.files), baseVersion = base && readVersion2(base.files);
66665
66500
  if (base ? !version2 || !baseVersion || JSON.stringify(version2) !== JSON.stringify(baseVersion) : version2 !== null) throw Error("version.json: existing Studios need matching baseline and draft versions; use --base empty only for a new Studio without version.json");
66666
66501
  fs87.mkdirSync(staging, { recursive: true });
66667
66502
  const review = { version: 2, base: base && baseVersion ? { ...baseVersion, fingerprint: base.fingerprint } : null, fingerprint: draft.fingerprint, files: [] };
66668
66503
  const save3 = (file2, bytes2) => {
66669
- const target = path85.join(staging, file2);
66670
- fs87.mkdirSync(path85.dirname(target), { recursive: true });
66504
+ const target = path84.join(staging, file2);
66505
+ fs87.mkdirSync(path84.dirname(target), { recursive: true });
66671
66506
  fs87.writeFileSync(target, bytes2);
66672
66507
  return file2;
66673
66508
  };
@@ -66676,10 +66511,10 @@ async function cmdStudioPreview(id2, opts) {
66676
66511
  const before = base?.files[file2] ?? null, after2 = draft.files[file2] ?? null;
66677
66512
  review.files.push({ path: file2, before: before === null ? null : save3(`files/${i}/before.txt`, before), after: after2 === null ? null : save3(`files/${i}/after.txt`, after2), ...before !== after2 ? { diff: save3(`files/${i}/change.diff`, unified(before, after2, file2, staging)) } : {} });
66678
66513
  }
66679
- for (const p of ["a", "b"]) fs87.rmSync(path85.join(staging, p), { force: true });
66514
+ for (const p of ["a", "b"]) fs87.rmSync(path84.join(staging, p), { force: true });
66680
66515
  if (!parseReview(review)) throw Error("generated review is invalid");
66681
66516
  save3("review.json", JSON.stringify(review, null, 2) + "\n");
66682
- fs87.mkdirSync(path85.dirname(destination), { recursive: true });
66517
+ fs87.mkdirSync(path84.dirname(destination), { recursive: true });
66683
66518
  if (fs87.existsSync(destination)) {
66684
66519
  fs87.renameSync(destination, backup);
66685
66520
  moved = true;
@@ -66697,7 +66532,7 @@ ${items}
66697
66532
 
66698
66533
  </Set>` : items;
66699
66534
  say([tag, files].filter(Boolean).join("\n\n"));
66700
- return { file: path85.join(destination, "review.json"), tag, files };
66535
+ return { file: path84.join(destination, "review.json"), tag, files };
66701
66536
  } catch (error62) {
66702
66537
  if (moved && !fs87.existsSync(destination)) fs87.renameSync(backup, destination);
66703
66538
  if (error62 && typeof error62 === "object" && "kind" in error62) throw error62;
@@ -67296,7 +67131,7 @@ init_agent2();
67296
67131
 
67297
67132
  // src/lib/cli/setup.ts
67298
67133
  import fs89 from "node:fs";
67299
- import path87 from "node:path";
67134
+ import path86 from "node:path";
67300
67135
  import { fileURLToPath as fileURLToPath3 } from "node:url";
67301
67136
 
67302
67137
  // src/commands/update.ts
@@ -67305,7 +67140,7 @@ init_config_template();
67305
67140
  init_io();
67306
67141
  init_version();
67307
67142
  import fs88 from "node:fs";
67308
- import path86 from "node:path";
67143
+ import path85 from "node:path";
67309
67144
  import { spawnSync as spawnSync9 } from "node:child_process";
67310
67145
  var NAME = "wildcrane";
67311
67146
  var REPO = "https://github.com/wildcrane-ai/wildcrane";
@@ -67347,8 +67182,8 @@ async function cmdUpdate2(ctx) {
67347
67182
  return { updated: ctx.dir, from, to: SKILL_VERSION };
67348
67183
  }
67349
67184
  async function repairBoard(root2, report3, named2) {
67350
- const legacy = path86.join(root2, "docs", "kanban");
67351
- const kept2 = path86.join(root2, ".akb", "kanban");
67185
+ const legacy = path85.join(root2, "docs", "kanban");
67186
+ const kept2 = path85.join(root2, ".akb", "kanban");
67352
67187
  const board2 = named2 ?? (fs88.existsSync(legacy) ? legacy : kept2);
67353
67188
  if (!fs88.existsSync(board2)) {
67354
67189
  report3.notes.push("\u672A\u627E\u5230\u770B\u677F\uFF0C\u8BF7\u901A\u8FC7\u63D2\u4EF6\u8FDE\u63A5\u4E91\u7AEF\u9879\u76EE\u3002");
@@ -67361,7 +67196,7 @@ async function repairBoard(root2, report3, named2) {
67361
67196
  return true;
67362
67197
  }
67363
67198
  function checkConfig(board2, report3) {
67364
- const current = read4(path86.join(board2, "config.md"));
67199
+ const current = read4(path85.join(board2, "config.md"));
67365
67200
  if (!current) return;
67366
67201
  const added = missingConfigKeys(current);
67367
67202
  if (added.length) {
@@ -67371,7 +67206,7 @@ function checkConfig(board2, report3) {
67371
67206
  }
67372
67207
  }
67373
67208
  function checkModules(board2, report3) {
67374
- const map3 = read4(path86.join(board2, "modules.md"));
67209
+ const map3 = read4(path85.join(board2, "modules.md"));
67375
67210
  if (map3 && map3.includes(UNFILLED)) {
67376
67211
  report3.notes.push(
67377
67212
  "docs/kanban/modules.md is still blank \u2014 write it from the repo (`akb guide module-map`)"
@@ -67425,14 +67260,14 @@ function declareSetup(program2, cli) {
67425
67260
  program2.version(SKILL_VERSION, "-v, --version", "print this version").addHelpText("beforeAll", spelled(cli.program));
67426
67261
  const dirOption = (cmd) => cmd.option("--dir <path>", "the project to work on (default: the current folder)").option("--json", "answer as one JSON object instead of prose");
67427
67262
  const where = (cmd) => {
67428
- const dir = path87.resolve(String(cmd.optsWithGlobals().dir ?? cli.cwd));
67263
+ const dir = path86.resolve(String(cmd.optsWithGlobals().dir ?? cli.cwd));
67429
67264
  if (!fs89.existsSync(dir)) throw new BoardError(`no such folder: ${dir}`, { kind: "no-such-folder", dir });
67430
67265
  return dir;
67431
67266
  };
67432
67267
  dirOption(program2.command("update")).summary("\u4FEE\u590D\u5DF2\u6709\u770B\u677F\u5E76\u68C0\u67E5 CLI \u65B0\u7248\u672C").description("\u4FEE\u590D\u5DF2\u6709\u770B\u677F\u5E76\u63D0\u793A CLI \u5347\u7EA7\u547D\u4EE4\u3002\u6CA1\u6709\u770B\u677F\u65F6\uFF0C\u8BF7\u901A\u8FC7\u63D2\u4EF6\u8FDE\u63A5\u4E91\u7AEF\u9879\u76EE\u3002").action(async function() {
67433
67268
  const dir = where(this);
67434
67269
  const named2 = this.optsWithGlobals().board ?? process.env.AI4KANBAN_BOARD?.trim();
67435
- const board2 = named2 ? path87.resolve(cli.cwd, named2) : null;
67270
+ const board2 = named2 ? path86.resolve(cli.cwd, named2) : null;
67436
67271
  await runAction(ctxOf(this, cli.program), {}, () => cmdUpdate2({ dir, program: cli.program, board: board2 }));
67437
67272
  });
67438
67273
  program2.command("__rules", { hidden: true }).action(function() {