wildcrane-runner 0.6.107 → 0.6.109

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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // ai4kanban 0.11.87 — built by runner/scripts/build.mjs. Do not edit.
2
+ // ai4kanban 0.11.89 — built by runner/scripts/build.mjs. Do not edit.
3
3
  import { createRequire as __ai4kanbanRequire } from 'node:module'
4
4
  const require = __ai4kanbanRequire(import.meta.url)
5
5
  var __create = Object.create;
@@ -339,11 +339,11 @@ function setBoard(kanban, root2, flag) {
339
339
  }
340
340
  function setBoardRoot(root2, named2 = false) {
341
341
  const project2 = path2.resolve(root2);
342
- return setBoard(path2.join(project2, "docs", "kanban"), project2, named2 ? ` --dir ${project2}` : "");
342
+ return setBoard(path2.join(project2, "docs", "kanban"), project2, named2 ? ` --dir ${shellWord(project2)}` : "");
343
343
  }
344
344
  function setBoardDir(board2, root2) {
345
345
  const folder2 = path2.resolve(board2);
346
- return setBoard(folder2, root2 ?? projectRootOf(folder2), ` --board ${folder2}`);
346
+ return setBoard(folder2, root2 ?? projectRootOf(folder2), ` --board ${shellWord(folder2)}`);
347
347
  }
348
348
  function die(msg, kind) {
349
349
  throw new BoardError(msg, typeof kind === "string" ? { kind } : kind);
@@ -368,7 +368,7 @@ function useProjectState() {
368
368
  ensureAkbDir();
369
369
  return ensureProjectState(KANBAN, REPO_ROOT);
370
370
  }
371
- var REPO_ROOT, KANBAN, TODO, ARCHIVE, REJECTIONS_TO_REVIEW, ARCHIVE_MD, README, MODULES_MD, CONFIG, KANBAN_GITIGNORE, RELEASES, RELEASE_SUMMARIES, AGENTS, STUDIOS, ASSETS, BOARD_STATE, MEMORY, AGENT_MEMORY, PROJECT_MD, LOCK, UI_CONFIG, ENV_FILE, SESSIONS, SESSIONS_DIR, SESSIONS_LOCK2, INDEX_LOCK2, DELIVERIES, PLANS, PLANS_ARCHIVE, RULES, TRIAGE, SIGNALS_ARCHIVED, SIGNALS_DISMISSED, SIGNALS_FILES, SIGNALS_OLD_INBOX, SIGNALS_OLD_HANDLED, AKB_DIR, ROOT_GITIGNORE, AKB_IGNORE_LINE, BOARD_FLAG, rel, BOARD_PATH_IN_TEXT, ASSETS_PATH_IN_TEXT, BOARD_STATE_IN_TEXT;
371
+ var REPO_ROOT, KANBAN, TODO, ARCHIVE, REJECTIONS_TO_REVIEW, ARCHIVE_MD, README, MODULES_MD, CONFIG, KANBAN_GITIGNORE, RELEASES, RELEASE_SUMMARIES, AGENTS, STUDIOS, ASSETS, BOARD_STATE, MEMORY, AGENT_MEMORY, PROJECT_MD, LOCK, UI_CONFIG, ENV_FILE, SESSIONS, SESSIONS_DIR, SESSIONS_LOCK2, INDEX_LOCK2, DELIVERIES, PLANS, PLANS_ARCHIVE, RULES, TRIAGE, SIGNALS_ARCHIVED, SIGNALS_DISMISSED, SIGNALS_FILES, SIGNALS_OLD_INBOX, SIGNALS_OLD_HANDLED, AKB_DIR, ROOT_GITIGNORE, AKB_IGNORE_LINE, shellWord, BOARD_FLAG, rel, BOARD_PATH_IN_TEXT, ASSETS_PATH_IN_TEXT, BOARD_STATE_IN_TEXT;
372
372
  var init_paths = __esm({
373
373
  "../cli/src/lib/paths.ts"() {
374
374
  "use strict";
@@ -413,6 +413,7 @@ var init_paths = __esm({
413
413
  AKB_DIR = "";
414
414
  ROOT_GITIGNORE = "";
415
415
  AKB_IGNORE_LINE = ".akb/";
416
+ shellWord = (value) => /^[\w./:@=-]+$/.test(value) ? value : `"${value.replace(/["`$\\]/g, "\\$&")}"`;
416
417
  BOARD_FLAG = "";
417
418
  setBoardRoot(process.cwd());
418
419
  rel = (p) => {
@@ -593,9 +594,9 @@ function floatSafeRemainder(val, step) {
593
594
  return 0;
594
595
  return ratio - roundedRatio;
595
596
  }
596
- function defineLazy(object3, key, getter) {
597
+ function defineLazy(object2, key, getter) {
597
598
  let value = void 0;
598
- Object.defineProperty(object3, key, {
599
+ Object.defineProperty(object2, key, {
599
600
  get() {
600
601
  if (value === EVALUATING) {
601
602
  return void 0;
@@ -607,7 +608,7 @@ function defineLazy(object3, key, getter) {
607
608
  return value;
608
609
  },
609
610
  set(v) {
610
- Object.defineProperty(object3, key, {
611
+ Object.defineProperty(object2, key, {
611
612
  value: v
612
613
  // configurable: true,
613
614
  });
@@ -687,10 +688,10 @@ function mergeDefs(...defs) {
687
688
  function cloneDef(schema) {
688
689
  return mergeDefs(schema._zod.def);
689
690
  }
690
- function getElementAtPath(obj3, path88) {
691
- if (!path88)
691
+ function getElementAtPath(obj3, path87) {
692
+ if (!path87)
692
693
  return obj3;
693
- return path88.reduce((acc, key) => acc?.[key], obj3);
694
+ return path87.reduce((acc, key) => acc?.[key], obj3);
694
695
  }
695
696
  function promiseAllObject(promisesObj) {
696
697
  const keys = Object.keys(promisesObj);
@@ -949,11 +950,11 @@ function explicitlyAborted(x, startIndex = 0) {
949
950
  }
950
951
  return false;
951
952
  }
952
- function prefixIssues(path88, issues) {
953
+ function prefixIssues(path87, issues) {
953
954
  return issues.map((iss) => {
954
955
  var _a3;
955
956
  (_a3 = iss).path ?? (_a3.path = []);
956
- iss.path.unshift(path88);
957
+ iss.path.unshift(path87);
957
958
  return iss;
958
959
  });
959
960
  }
@@ -1486,16 +1487,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
1486
1487
  }
1487
1488
  function formatError(error62, mapper = (issue2) => issue2.message) {
1488
1489
  const fieldErrors = { _errors: [] };
1489
- const processError = (error63, path88 = []) => {
1490
+ const processError = (error63, path87 = []) => {
1490
1491
  for (const issue2 of error63.issues) {
1491
1492
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1492
- issue2.errors.map((issues) => processError({ issues }, [...path88, ...issue2.path]));
1493
+ issue2.errors.map((issues) => processError({ issues }, [...path87, ...issue2.path]));
1493
1494
  } else if (issue2.code === "invalid_key") {
1494
- processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
1495
+ processError({ issues: issue2.issues }, [...path87, ...issue2.path]);
1495
1496
  } else if (issue2.code === "invalid_element") {
1496
- processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
1497
+ processError({ issues: issue2.issues }, [...path87, ...issue2.path]);
1497
1498
  } else {
1498
- const fullpath = [...path88, ...issue2.path];
1499
+ const fullpath = [...path87, ...issue2.path];
1499
1500
  if (fullpath.length === 0) {
1500
1501
  fieldErrors._errors.push(mapper(issue2));
1501
1502
  } else {
@@ -1534,17 +1535,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
1534
1535
  }
1535
1536
  function treeifyError(error62, mapper = (issue2) => issue2.message) {
1536
1537
  const result = { errors: [] };
1537
- const processError = (error63, path88 = []) => {
1538
+ const processError = (error63, path87 = []) => {
1538
1539
  var _a3;
1539
1540
  for (const issue2 of error63.issues) {
1540
1541
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1541
- issue2.errors.map((issues) => processError({ issues }, [...path88, ...issue2.path]));
1542
+ issue2.errors.map((issues) => processError({ issues }, [...path87, ...issue2.path]));
1542
1543
  } else if (issue2.code === "invalid_key") {
1543
- processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
1544
+ processError({ issues: issue2.issues }, [...path87, ...issue2.path]);
1544
1545
  } else if (issue2.code === "invalid_element") {
1545
- processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
1546
+ processError({ issues: issue2.issues }, [...path87, ...issue2.path]);
1546
1547
  } else {
1547
- const fullpath = [...path88, ...issue2.path];
1548
+ const fullpath = [...path87, ...issue2.path];
1548
1549
  if (fullpath.length === 0) {
1549
1550
  result.errors.push(mapper(issue2));
1550
1551
  continue;
@@ -1583,8 +1584,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
1583
1584
  }
1584
1585
  function toDotPath(_path) {
1585
1586
  const segs = [];
1586
- const path88 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1587
- for (const seg of path88) {
1587
+ const path87 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1588
+ for (const seg of path87) {
1588
1589
  if (typeof seg === "number")
1589
1590
  segs.push(`[${seg}]`);
1590
1591
  else if (typeof seg === "symbol")
@@ -16269,8 +16270,8 @@ function foldObjects(members2) {
16269
16270
  }
16270
16271
  const properties = {};
16271
16272
  const required2 = /* @__PURE__ */ new Set();
16272
- for (const object3 of objects) {
16273
- for (const key in object3.properties) {
16273
+ for (const object2 of objects) {
16274
+ for (const key in object2.properties) {
16274
16275
  if (Object.prototype.hasOwnProperty.call(properties, key))
16275
16276
  continue;
16276
16277
  const parts = [];
@@ -16284,18 +16285,18 @@ function foldObjects(members2) {
16284
16285
  const merged = parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts };
16285
16286
  assignProp(properties, key, merged);
16286
16287
  }
16287
- for (const key of object3.required ?? [])
16288
+ for (const key of object2.required ?? [])
16288
16289
  required2.add(key);
16289
16290
  }
16290
16291
  const folded = { type: "object", properties };
16291
16292
  if (required2.size)
16292
16293
  folded.required = [...required2];
16293
- if (objects.every((object3) => object3.additionalProperties === false)) {
16294
+ if (objects.every((object2) => object2.additionalProperties === false)) {
16294
16295
  folded.additionalProperties = false;
16295
16296
  } else {
16296
16297
  const constraints = [];
16297
- for (const object3 of objects) {
16298
- const constraint = undeclaredConstraint(object3);
16298
+ for (const object2 of objects) {
16299
+ const constraint = undeclaredConstraint(object2);
16299
16300
  if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint)))
16300
16301
  constraints.push(constraint);
16301
16302
  }
@@ -16691,12 +16692,12 @@ function toJSONSchema(input2, params) {
16691
16692
  processSchema(schema, ctx2);
16692
16693
  }
16693
16694
  const schemas = {};
16694
- const external2 = {
16695
+ const external = {
16695
16696
  registry: registry2,
16696
16697
  uri: params?.uri,
16697
16698
  defs
16698
16699
  };
16699
- ctx2.external = external2;
16700
+ ctx2.external = external;
16700
16701
  for (const entry of registry2._idmap.entries()) {
16701
16702
  const [key, schema] = entry;
16702
16703
  extractDefs(ctx2, schema);
@@ -19616,13 +19617,13 @@ function resolveRef(ref, ctx) {
19616
19617
  if (!ref.startsWith("#")) {
19617
19618
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
19618
19619
  }
19619
- const path88 = ref.slice(1).split("/").filter(Boolean);
19620
- if (path88.length === 0) {
19620
+ const path87 = ref.slice(1).split("/").filter(Boolean);
19621
+ if (path87.length === 0) {
19621
19622
  return ctx.rootSchema;
19622
19623
  }
19623
19624
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
19624
- if (path88[0] === defsKey) {
19625
- 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]);
19626
19627
  if (!key || !ctx.defs[key]) {
19627
19628
  throw new Error(`Reference not found: ${ref}`);
19628
19629
  }
@@ -22831,8 +22832,9 @@ var init_package = __esm({
22831
22832
  "../cli/package.json"() {
22832
22833
  package_default = {
22833
22834
  name: "wildcrane",
22834
- version: "0.11.87",
22835
+ version: "0.11.89",
22835
22836
  akbContract: 29,
22837
+ canonicalCommands: true,
22836
22838
  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.",
22837
22839
  keywords: [
22838
22840
  "kanban",
@@ -25248,10 +25250,10 @@ function findRollout(threadId) {
25248
25250
  }
25249
25251
  for (const name of names2) {
25250
25252
  if (!name.startsWith("rollout-") || !name.endsWith(tail)) continue;
25251
- const path88 = join2(dir, name);
25253
+ const path87 = join2(dir, name);
25252
25254
  try {
25253
- const at = statSync2(path88).mtimeMs;
25254
- if (!newest2 || at > newest2.at) newest2 = { path: path88, at };
25255
+ const at = statSync2(path87).mtimeMs;
25256
+ if (!newest2 || at > newest2.at) newest2 = { path: path87, at };
25255
25257
  } catch {
25256
25258
  }
25257
25259
  }
@@ -25259,11 +25261,11 @@ function findRollout(threadId) {
25259
25261
  return newest2?.path;
25260
25262
  }
25261
25263
  function readCodexRunFacts(threadId) {
25262
- const path88 = findRollout(threadId);
25263
- if (!path88) return void 0;
25264
+ const path87 = findRollout(threadId);
25265
+ if (!path87) return void 0;
25264
25266
  let raw;
25265
25267
  try {
25266
- raw = readFileSync2(path88, "utf8");
25268
+ raw = readFileSync2(path87, "utf8");
25267
25269
  } catch {
25268
25270
  return void 0;
25269
25271
  }
@@ -25389,8 +25391,8 @@ function renderCompleted(item) {
25389
25391
  const changes = Array.isArray(item.changes) ? item.changes : [];
25390
25392
  return changes.map((raw) => {
25391
25393
  const change2 = obj2(raw);
25392
- const path88 = str2(change2.path);
25393
- return path88 ? `\u23FA ${str2(change2.kind) || "change"}(${path88})
25394
+ const path87 = str2(change2.path);
25395
+ return path87 ? `\u23FA ${str2(change2.kind) || "change"}(${path87})
25394
25396
  ` : "";
25395
25397
  }).join("");
25396
25398
  }
@@ -25728,10 +25730,10 @@ function readKimiRunFacts(sessionId) {
25728
25730
  const total = { input: 0, cacheCreation: 0, cacheRead: 0, output: 0 };
25729
25731
  let model;
25730
25732
  let holding = 0;
25731
- for (const { path: path88, main } of wireFiles(entry.sessionDir)) {
25733
+ for (const { path: path87, main } of wireFiles(entry.sessionDir)) {
25732
25734
  let raw;
25733
25735
  try {
25734
- raw = readFileSync3(path88, "utf8");
25736
+ raw = readFileSync3(path87, "utf8");
25735
25737
  } catch {
25736
25738
  continue;
25737
25739
  }
@@ -26108,8 +26110,8 @@ var init_tail = __esm({
26108
26110
  import fs22 from "node:fs";
26109
26111
  function whereHint(update2, title) {
26110
26112
  const locations = Array.isArray(update2.locations) ? update2.locations : [];
26111
- const path88 = str2(obj2(locations[0]).path);
26112
- return path88 && !title.includes(path88) ? hint(path88) : "";
26113
+ const path87 = str2(obj2(locations[0]).path);
26114
+ return path87 && !title.includes(path87) ? hint(path87) : "";
26113
26115
  }
26114
26116
  function saidBy(update2) {
26115
26117
  const content = Array.isArray(update2.content) ? update2.content : [];
@@ -27304,7 +27306,7 @@ async function run(io, options, count3) {
27304
27306
  startupTimer = setTimeout(() => {
27305
27307
  if (!started) io.event?.({ kind: "log", data: { text: "[conversation] start_unconfirmed" } });
27306
27308
  }, 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) => {
27309
+ 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
27310
  if (!started) throw error62;
27309
27311
  });
27310
27312
  };
@@ -29091,7 +29093,7 @@ var init_types3 = __esm({
29091
29093
  isRetired = (action) => RETIRED.has(action);
29092
29094
  refusal = (reason, error62, args2) => args2 ? { error: error62, reason, args: args2 } : { error: error62, reason };
29093
29095
  NOT_COMPLETED = "The delivery has not recorded completion.";
29094
- notCompletedWhy = (deliveryId) => `${NOT_COMPLETED} Finish its unchecked todos, then run akb raw delivery complete ${deliveryId}, with --commit <sha> --branch <name> in a git project.`;
29096
+ notCompletedWhy = (deliveryId, command = "akb") => `${NOT_COMPLETED} Finish its unchecked todos, then run ${command} delivery complete ${deliveryId}, with --commit <sha> --branch <name> in a git project.`;
29095
29097
  }
29096
29098
  });
29097
29099
 
@@ -29608,7 +29610,7 @@ before proposing so you don't re-suggest them.
29608
29610
  // Only a header: `describe-project` writes the body, and runs while there is none (#1268).
29609
29611
  "project.md": `# Project
29610
29612
 
29611
- What the project is today, from its users' side. Rewritten whole by \`akb raw describe-project\`;
29613
+ What the project is today, from its users' side. Rewritten whole by \`akb memory describe-project\`;
29612
29614
  edits here do not last.
29613
29615
  `
29614
29616
  };
@@ -29647,18 +29649,18 @@ var init_file_limits = __esm({
29647
29649
  });
29648
29650
 
29649
29651
  // ../cli/src/lib/shared/board-files.ts
29650
- function isBoardPath(path88) {
29651
- if (!path88 || path88.length > 500 || path88.startsWith("/") || path88.includes("\\") || path88.includes("\0")) return false;
29652
- if (path88.split("/").some((part) => !part || part === "." || part === "..")) return false;
29653
- if (path88 === "todo/README.md" || path88.split("/").includes(".sync")) return false;
29654
- if (path88.startsWith("studios/")) return true;
29655
- if (SETTINGS.includes(path88)) return true;
29656
- if (path88.startsWith("rules/")) return isSettingsPath(path88);
29657
- if (path88.startsWith("assets/")) return taskOfAssets(path88) !== null;
29658
- return ROOTS.some((root2) => path88.startsWith(root2)) && path88.endsWith(".md");
29659
- }
29660
- function numberOfCard(path88) {
29661
- const n = ROOT.exec(path88)?.[1] ?? CARD.exec(path88)?.[1];
29652
+ function isBoardPath(path87) {
29653
+ if (!path87 || path87.length > 500 || path87.startsWith("/") || path87.includes("\\") || path87.includes("\0")) return false;
29654
+ if (path87.split("/").some((part) => !part || part === "." || part === "..")) return false;
29655
+ if (path87 === "todo/README.md" || path87.split("/").includes(".sync")) return false;
29656
+ if (path87.startsWith("studios/")) return true;
29657
+ if (SETTINGS.includes(path87)) return true;
29658
+ if (path87.startsWith("rules/")) return isSettingsPath(path87);
29659
+ if (path87.startsWith("assets/")) return taskOfAssets(path87) !== null;
29660
+ return ROOTS.some((root2) => path87.startsWith(root2)) && path87.endsWith(".md");
29661
+ }
29662
+ function numberOfCard(path87) {
29663
+ const n = ROOT.exec(path87)?.[1] ?? CARD.exec(path87)?.[1];
29662
29664
  return n ? Number(n) : null;
29663
29665
  }
29664
29666
  var ROOTS, SETTINGS, isSettingsPath, CARD, ROOT, assetsFile, taskOfAssets, studioFolder, studioName;
@@ -29668,11 +29670,11 @@ var init_board_files = __esm({
29668
29670
  init_file_limits();
29669
29671
  ROOTS = ["todo/", ".archive/", "memory/", "studios/", "triage/", "assets/", "rules/"];
29670
29672
  SETTINGS = ["modules.md", "config.md"];
29671
- isSettingsPath = (path88) => SETTINGS.includes(path88) || /^rules\/(?:studios\/[^/]+|proposer|project-writer|dismissal-reviewer|memory-pruner)\.md$/.test(path88);
29673
+ isSettingsPath = (path87) => SETTINGS.includes(path87) || /^rules\/(?:studios\/[^/]+|proposer|project-writer|dismissal-reviewer|memory-pruner)\.md$/.test(path87);
29672
29674
  CARD = /^(?:todo|\.archive)\/(?:[^/]+\/)*(\d+)-[^/]*\.md$/;
29673
29675
  ROOT = /^(?:todo|\.archive)\/(?:[^/]+\/)*(\d+)-[^/]+\/root\.md$/;
29674
29676
  assetsFile = (task) => `assets/${task}.json`;
29675
- taskOfAssets = (path88) => /^assets\/(task_[0-9a-f]+)\.json$/.exec(path88)?.[1] ?? null;
29677
+ taskOfAssets = (path87) => /^assets\/(task_[0-9a-f]+)\.json$/.exec(path87)?.[1] ?? null;
29676
29678
  studioFolder = (id2) => id2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
29677
29679
  studioName = (id2) => id2.startsWith("wf_builtin_") ? id2.slice("wf_builtin_".length).replace(/_/g, "-") : studioFolder(id2);
29678
29680
  }
@@ -32895,8 +32897,8 @@ var require_utils = __commonJS({
32895
32897
  }
32896
32898
  return ind;
32897
32899
  }
32898
- function removeDotSegments(path88) {
32899
- let input2 = path88;
32900
+ function removeDotSegments(path87) {
32901
+ let input2 = path87;
32900
32902
  const output2 = [];
32901
32903
  let nextSlash = -1;
32902
32904
  let len = 0;
@@ -32970,11 +32972,11 @@ var require_utils = __commonJS({
32970
32972
  }
32971
32973
  return output2.join("");
32972
32974
  }
32973
- function removeDotSegmentsRelative(path88) {
32974
- if (path88 === "" || path88[0] === "/") {
32975
- return removeDotSegments(path88);
32975
+ function removeDotSegmentsRelative(path87) {
32976
+ if (path87 === "" || path87[0] === "/") {
32977
+ return removeDotSegments(path87);
32976
32978
  }
32977
- const segments = path88.split("/");
32979
+ const segments = path87.split("/");
32978
32980
  const last = segments.length - 1;
32979
32981
  const output2 = [];
32980
32982
  let trailingDirectory = false;
@@ -33337,8 +33339,8 @@ var require_schemes = __commonJS({
33337
33339
  }
33338
33340
  if (wsComponent.resourceName) {
33339
33341
  const queryIndex = wsComponent.resourceName.indexOf("?");
33340
- const path88 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
33341
- wsComponent.path = path88 && path88 !== "/" ? path88 : void 0;
33342
+ const path87 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
33343
+ wsComponent.path = path87 && path87 !== "/" ? path87 : void 0;
33342
33344
  wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
33343
33345
  wsComponent.resourceName = void 0;
33344
33346
  }
@@ -36498,17 +36500,17 @@ var require_visit = __commonJS({
36498
36500
  visit2.BREAK = BREAK;
36499
36501
  visit2.SKIP = SKIP;
36500
36502
  visit2.REMOVE = REMOVE;
36501
- function visit_(key, node2, visitor, path88) {
36502
- const ctrl = callVisitor(key, node2, visitor, path88);
36503
+ function visit_(key, node2, visitor, path87) {
36504
+ const ctrl = callVisitor(key, node2, visitor, path87);
36503
36505
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
36504
- replaceNode(key, path88, ctrl);
36505
- return visit_(key, ctrl, visitor, path88);
36506
+ replaceNode(key, path87, ctrl);
36507
+ return visit_(key, ctrl, visitor, path87);
36506
36508
  }
36507
36509
  if (typeof ctrl !== "symbol") {
36508
36510
  if (identity.isCollection(node2)) {
36509
- path88 = Object.freeze(path88.concat(node2));
36511
+ path87 = Object.freeze(path87.concat(node2));
36510
36512
  for (let i = 0; i < node2.items.length; ++i) {
36511
- const ci = visit_(i, node2.items[i], visitor, path88);
36513
+ const ci = visit_(i, node2.items[i], visitor, path87);
36512
36514
  if (typeof ci === "number")
36513
36515
  i = ci - 1;
36514
36516
  else if (ci === BREAK)
@@ -36519,13 +36521,13 @@ var require_visit = __commonJS({
36519
36521
  }
36520
36522
  }
36521
36523
  } else if (identity.isPair(node2)) {
36522
- path88 = Object.freeze(path88.concat(node2));
36523
- const ck = visit_("key", node2.key, visitor, path88);
36524
+ path87 = Object.freeze(path87.concat(node2));
36525
+ const ck = visit_("key", node2.key, visitor, path87);
36524
36526
  if (ck === BREAK)
36525
36527
  return BREAK;
36526
36528
  else if (ck === REMOVE)
36527
36529
  node2.key = null;
36528
- const cv = visit_("value", node2.value, visitor, path88);
36530
+ const cv = visit_("value", node2.value, visitor, path87);
36529
36531
  if (cv === BREAK)
36530
36532
  return BREAK;
36531
36533
  else if (cv === REMOVE)
@@ -36546,17 +36548,17 @@ var require_visit = __commonJS({
36546
36548
  visitAsync.BREAK = BREAK;
36547
36549
  visitAsync.SKIP = SKIP;
36548
36550
  visitAsync.REMOVE = REMOVE;
36549
- async function visitAsync_(key, node2, visitor, path88) {
36550
- const ctrl = await callVisitor(key, node2, visitor, path88);
36551
+ async function visitAsync_(key, node2, visitor, path87) {
36552
+ const ctrl = await callVisitor(key, node2, visitor, path87);
36551
36553
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
36552
- replaceNode(key, path88, ctrl);
36553
- return visitAsync_(key, ctrl, visitor, path88);
36554
+ replaceNode(key, path87, ctrl);
36555
+ return visitAsync_(key, ctrl, visitor, path87);
36554
36556
  }
36555
36557
  if (typeof ctrl !== "symbol") {
36556
36558
  if (identity.isCollection(node2)) {
36557
- path88 = Object.freeze(path88.concat(node2));
36559
+ path87 = Object.freeze(path87.concat(node2));
36558
36560
  for (let i = 0; i < node2.items.length; ++i) {
36559
- const ci = await visitAsync_(i, node2.items[i], visitor, path88);
36561
+ const ci = await visitAsync_(i, node2.items[i], visitor, path87);
36560
36562
  if (typeof ci === "number")
36561
36563
  i = ci - 1;
36562
36564
  else if (ci === BREAK)
@@ -36567,13 +36569,13 @@ var require_visit = __commonJS({
36567
36569
  }
36568
36570
  }
36569
36571
  } else if (identity.isPair(node2)) {
36570
- path88 = Object.freeze(path88.concat(node2));
36571
- const ck = await visitAsync_("key", node2.key, visitor, path88);
36572
+ path87 = Object.freeze(path87.concat(node2));
36573
+ const ck = await visitAsync_("key", node2.key, visitor, path87);
36572
36574
  if (ck === BREAK)
36573
36575
  return BREAK;
36574
36576
  else if (ck === REMOVE)
36575
36577
  node2.key = null;
36576
- const cv = await visitAsync_("value", node2.value, visitor, path88);
36578
+ const cv = await visitAsync_("value", node2.value, visitor, path87);
36577
36579
  if (cv === BREAK)
36578
36580
  return BREAK;
36579
36581
  else if (cv === REMOVE)
@@ -36600,23 +36602,23 @@ var require_visit = __commonJS({
36600
36602
  }
36601
36603
  return visitor;
36602
36604
  }
36603
- function callVisitor(key, node2, visitor, path88) {
36605
+ function callVisitor(key, node2, visitor, path87) {
36604
36606
  if (typeof visitor === "function")
36605
- return visitor(key, node2, path88);
36607
+ return visitor(key, node2, path87);
36606
36608
  if (identity.isMap(node2))
36607
- return visitor.Map?.(key, node2, path88);
36609
+ return visitor.Map?.(key, node2, path87);
36608
36610
  if (identity.isSeq(node2))
36609
- return visitor.Seq?.(key, node2, path88);
36611
+ return visitor.Seq?.(key, node2, path87);
36610
36612
  if (identity.isPair(node2))
36611
- return visitor.Pair?.(key, node2, path88);
36613
+ return visitor.Pair?.(key, node2, path87);
36612
36614
  if (identity.isScalar(node2))
36613
- return visitor.Scalar?.(key, node2, path88);
36615
+ return visitor.Scalar?.(key, node2, path87);
36614
36616
  if (identity.isAlias(node2))
36615
- return visitor.Alias?.(key, node2, path88);
36617
+ return visitor.Alias?.(key, node2, path87);
36616
36618
  return void 0;
36617
36619
  }
36618
- function replaceNode(key, path88, node2) {
36619
- const parent = path88[path88.length - 1];
36620
+ function replaceNode(key, path87, node2) {
36621
+ const parent = path87[path87.length - 1];
36620
36622
  if (identity.isCollection(parent)) {
36621
36623
  parent.items[key] = node2;
36622
36624
  } else if (identity.isPair(parent)) {
@@ -37228,10 +37230,10 @@ var require_Collection = __commonJS({
37228
37230
  var createNode = require_createNode();
37229
37231
  var identity = require_identity();
37230
37232
  var Node = require_Node();
37231
- function collectionFromPath(schema, path88, value) {
37233
+ function collectionFromPath(schema, path87, value) {
37232
37234
  let v = value;
37233
- for (let i = path88.length - 1; i >= 0; --i) {
37234
- const k = path88[i];
37235
+ for (let i = path87.length - 1; i >= 0; --i) {
37236
+ const k = path87[i];
37235
37237
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
37236
37238
  const a = [];
37237
37239
  a[k] = v;
@@ -37250,7 +37252,7 @@ var require_Collection = __commonJS({
37250
37252
  sourceObjects: /* @__PURE__ */ new Map()
37251
37253
  });
37252
37254
  }
37253
- var isEmptyPath = (path88) => path88 == null || typeof path88 === "object" && !!path88[Symbol.iterator]().next().done;
37255
+ var isEmptyPath = (path87) => path87 == null || typeof path87 === "object" && !!path87[Symbol.iterator]().next().done;
37254
37256
  var Collection = class extends Node.NodeBase {
37255
37257
  constructor(type, schema) {
37256
37258
  super(type);
@@ -37280,11 +37282,11 @@ var require_Collection = __commonJS({
37280
37282
  * be a Pair instance or a `{ key, value }` object, which may not have a key
37281
37283
  * that already exists in the map.
37282
37284
  */
37283
- addIn(path88, value) {
37284
- if (isEmptyPath(path88))
37285
+ addIn(path87, value) {
37286
+ if (isEmptyPath(path87))
37285
37287
  this.add(value);
37286
37288
  else {
37287
- const [key, ...rest] = path88;
37289
+ const [key, ...rest] = path87;
37288
37290
  const node2 = this.get(key, true);
37289
37291
  if (identity.isCollection(node2))
37290
37292
  node2.addIn(rest, value);
@@ -37298,8 +37300,8 @@ var require_Collection = __commonJS({
37298
37300
  * Removes a value from the collection.
37299
37301
  * @returns `true` if the item was found and removed.
37300
37302
  */
37301
- deleteIn(path88) {
37302
- const [key, ...rest] = path88;
37303
+ deleteIn(path87) {
37304
+ const [key, ...rest] = path87;
37303
37305
  if (rest.length === 0)
37304
37306
  return this.delete(key);
37305
37307
  const node2 = this.get(key, true);
@@ -37313,8 +37315,8 @@ var require_Collection = __commonJS({
37313
37315
  * scalar values from their surrounding node; to disable set `keepScalar` to
37314
37316
  * `true` (collections are always returned intact).
37315
37317
  */
37316
- getIn(path88, keepScalar) {
37317
- const [key, ...rest] = path88;
37318
+ getIn(path87, keepScalar) {
37319
+ const [key, ...rest] = path87;
37318
37320
  const node2 = this.get(key, true);
37319
37321
  if (rest.length === 0)
37320
37322
  return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
@@ -37332,8 +37334,8 @@ var require_Collection = __commonJS({
37332
37334
  /**
37333
37335
  * Checks if the collection includes a value with the key `key`.
37334
37336
  */
37335
- hasIn(path88) {
37336
- const [key, ...rest] = path88;
37337
+ hasIn(path87) {
37338
+ const [key, ...rest] = path87;
37337
37339
  if (rest.length === 0)
37338
37340
  return this.has(key);
37339
37341
  const node2 = this.get(key, true);
@@ -37343,8 +37345,8 @@ var require_Collection = __commonJS({
37343
37345
  * Sets a value in this collection. For `!!set`, `value` needs to be a
37344
37346
  * boolean to add/remove the item from the set.
37345
37347
  */
37346
- setIn(path88, value) {
37347
- const [key, ...rest] = path88;
37348
+ setIn(path87, value) {
37349
+ const [key, ...rest] = path87;
37348
37350
  if (rest.length === 0) {
37349
37351
  this.set(key, value);
37350
37352
  } else {
@@ -39859,9 +39861,9 @@ var require_Document = __commonJS({
39859
39861
  this.contents.add(value);
39860
39862
  }
39861
39863
  /** Adds a value to the document. */
39862
- addIn(path88, value) {
39864
+ addIn(path87, value) {
39863
39865
  if (assertCollection(this.contents))
39864
- this.contents.addIn(path88, value);
39866
+ this.contents.addIn(path87, value);
39865
39867
  }
39866
39868
  /**
39867
39869
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -39936,14 +39938,14 @@ var require_Document = __commonJS({
39936
39938
  * Removes a value from the document.
39937
39939
  * @returns `true` if the item was found and removed.
39938
39940
  */
39939
- deleteIn(path88) {
39940
- if (Collection.isEmptyPath(path88)) {
39941
+ deleteIn(path87) {
39942
+ if (Collection.isEmptyPath(path87)) {
39941
39943
  if (this.contents == null)
39942
39944
  return false;
39943
39945
  this.contents = null;
39944
39946
  return true;
39945
39947
  }
39946
- return assertCollection(this.contents) ? this.contents.deleteIn(path88) : false;
39948
+ return assertCollection(this.contents) ? this.contents.deleteIn(path87) : false;
39947
39949
  }
39948
39950
  /**
39949
39951
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -39958,10 +39960,10 @@ var require_Document = __commonJS({
39958
39960
  * scalar values from their surrounding node; to disable set `keepScalar` to
39959
39961
  * `true` (collections are always returned intact).
39960
39962
  */
39961
- getIn(path88, keepScalar) {
39962
- if (Collection.isEmptyPath(path88))
39963
+ getIn(path87, keepScalar) {
39964
+ if (Collection.isEmptyPath(path87))
39963
39965
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
39964
- return identity.isCollection(this.contents) ? this.contents.getIn(path88, keepScalar) : void 0;
39966
+ return identity.isCollection(this.contents) ? this.contents.getIn(path87, keepScalar) : void 0;
39965
39967
  }
39966
39968
  /**
39967
39969
  * Checks if the document includes a value with the key `key`.
@@ -39972,10 +39974,10 @@ var require_Document = __commonJS({
39972
39974
  /**
39973
39975
  * Checks if the document includes a value at `path`.
39974
39976
  */
39975
- hasIn(path88) {
39976
- if (Collection.isEmptyPath(path88))
39977
+ hasIn(path87) {
39978
+ if (Collection.isEmptyPath(path87))
39977
39979
  return this.contents !== void 0;
39978
- return identity.isCollection(this.contents) ? this.contents.hasIn(path88) : false;
39980
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path87) : false;
39979
39981
  }
39980
39982
  /**
39981
39983
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -39992,13 +39994,13 @@ var require_Document = __commonJS({
39992
39994
  * Sets a value in this document. For `!!set`, `value` needs to be a
39993
39995
  * boolean to add/remove the item from the set.
39994
39996
  */
39995
- setIn(path88, value) {
39996
- if (Collection.isEmptyPath(path88)) {
39997
+ setIn(path87, value) {
39998
+ if (Collection.isEmptyPath(path87)) {
39997
39999
  this.contents = value;
39998
40000
  } else if (this.contents == null) {
39999
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path88), value);
40001
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path87), value);
40000
40002
  } else if (assertCollection(this.contents)) {
40001
- this.contents.setIn(path88, value);
40003
+ this.contents.setIn(path87, value);
40002
40004
  }
40003
40005
  }
40004
40006
  /**
@@ -41959,9 +41961,9 @@ var require_cst_visit = __commonJS({
41959
41961
  visit2.BREAK = BREAK;
41960
41962
  visit2.SKIP = SKIP;
41961
41963
  visit2.REMOVE = REMOVE;
41962
- visit2.itemAtPath = (cst, path88) => {
41964
+ visit2.itemAtPath = (cst, path87) => {
41963
41965
  let item = cst;
41964
- for (const [field2, index] of path88) {
41966
+ for (const [field2, index] of path87) {
41965
41967
  const tok = item?.[field2];
41966
41968
  if (tok && "items" in tok) {
41967
41969
  item = tok.items[index];
@@ -41970,23 +41972,23 @@ var require_cst_visit = __commonJS({
41970
41972
  }
41971
41973
  return item;
41972
41974
  };
41973
- visit2.parentCollection = (cst, path88) => {
41974
- const parent = visit2.itemAtPath(cst, path88.slice(0, -1));
41975
- const field2 = path88[path88.length - 1][0];
41975
+ visit2.parentCollection = (cst, path87) => {
41976
+ const parent = visit2.itemAtPath(cst, path87.slice(0, -1));
41977
+ const field2 = path87[path87.length - 1][0];
41976
41978
  const coll = parent?.[field2];
41977
41979
  if (coll && "items" in coll)
41978
41980
  return coll;
41979
41981
  throw new Error("Parent collection not found");
41980
41982
  };
41981
- function _visit(path88, item, visitor) {
41982
- let ctrl = visitor(item, path88);
41983
+ function _visit(path87, item, visitor) {
41984
+ let ctrl = visitor(item, path87);
41983
41985
  if (typeof ctrl === "symbol")
41984
41986
  return ctrl;
41985
41987
  for (const field2 of ["key", "value"]) {
41986
41988
  const token2 = item[field2];
41987
41989
  if (token2 && "items" in token2) {
41988
41990
  for (let i = 0; i < token2.items.length; ++i) {
41989
- const ci = _visit(Object.freeze(path88.concat([[field2, i]])), token2.items[i], visitor);
41991
+ const ci = _visit(Object.freeze(path87.concat([[field2, i]])), token2.items[i], visitor);
41990
41992
  if (typeof ci === "number")
41991
41993
  i = ci - 1;
41992
41994
  else if (ci === BREAK)
@@ -41997,10 +41999,10 @@ var require_cst_visit = __commonJS({
41997
41999
  }
41998
42000
  }
41999
42001
  if (typeof ctrl === "function" && field2 === "key")
42000
- ctrl = ctrl(item, path88);
42002
+ ctrl = ctrl(item, path87);
42001
42003
  }
42002
42004
  }
42003
- return typeof ctrl === "function" ? ctrl(item, path88) : ctrl;
42005
+ return typeof ctrl === "function" ? ctrl(item, path87) : ctrl;
42004
42006
  }
42005
42007
  exports.visit = visit2;
42006
42008
  }
@@ -43862,7 +43864,7 @@ function landSections(body, previews) {
43862
43864
  }
43863
43865
  function parseStudioFile(id2, source2, from, { requirePreviewCopy = false, requireLand = false } = {}) {
43864
43866
  const problems = [];
43865
- const fail = (offset, path88, code, message, hint2) => problems.push({ file: from, ...sourcePosition(source2, offset), path: path88, code, message, hint: hint2 });
43867
+ const fail = (offset, path87, code, message, hint2) => problems.push({ file: from, ...sourcePosition(source2, offset), path: path87, code, message, hint: hint2 });
43866
43868
  const result = () => ({ problem: problems.map((p) => `${p.file}:${p.line}:${p.column} ${p.path}: ${p.code} \u2014 ${p.message}. ${p.hint}`).join("\n"), problems });
43867
43869
  if (!STUDIO_ID.test(id2)) fail(0, "id", "studio-schema", `Invalid Studio ID ${id2}`, "Use lowercase letters, digits and dashes.");
43868
43870
  const front = /^---\r?\n([^]*?)\r?\n---(?:\r?\n|$)/.exec(source2);
@@ -43933,6 +43935,8 @@ function parseStudioFile(id2, source2, from, { requirePreviewCopy = false, requi
43933
43935
  ...raw.names ? { names: raw.names } : {},
43934
43936
  description: raw.description ?? "",
43935
43937
  needsArtifact: raw.needsArtifact ?? false,
43938
+ ...raw.summaries ? { summaries: raw.summaries } : {},
43939
+ ...raw.entrypoints ? { entrypoints: raw.entrypoints } : {},
43936
43940
  ...raw.icon ? { icon: raw.icon } : {},
43937
43941
  previews: parsed.blocks.map((b) => ({ id: b.id, instructions: b.instructions, ...map3[b.id] })),
43938
43942
  rules: rules.trim()
@@ -43967,6 +43971,8 @@ var init_studio_def = __esm({
43967
43971
  name: { type: "string", minLength: 1, pattern: "\\S" },
43968
43972
  names: titles,
43969
43973
  description: { type: "string" },
43974
+ summaries: titles,
43975
+ entrypoints: { type: "array", minItems: 1, maxItems: 10, uniqueItems: true, items: { type: "string", pattern: PREVIEW_ID.source } },
43970
43976
  needsArtifact: { type: "boolean" },
43971
43977
  icon,
43972
43978
  previews: { type: "object", propertyNames: { pattern: PREVIEW_ID.source }, additionalProperties: {
@@ -44543,10 +44549,10 @@ var init_flows = __esm({
44543
44549
  description: "the runtime to run on, for this run only (default: the flow's own agent's)"
44544
44550
  };
44545
44551
  CARRY_OPTIONS = [
44546
- { flags: "--new-session", description: "start planning in a new session" },
44547
- { flags: "--session <id>", description: "the agent session to carry on, over the card's own" },
44548
- { flags: "--fork", description: "with --session: start from a copy of it" },
44549
- { flags: "--transcript <file>", description: "the discussion the card came from, read when no session is carried on" }
44552
+ { internal: true, flags: "--new-session", description: "start planning in a new session" },
44553
+ { internal: true, flags: "--session <id>", description: "the agent session to carry on, over the card's own" },
44554
+ { internal: true, flags: "--fork", description: "with --session: start from a copy of it" },
44555
+ { internal: true, flags: "--transcript <file>", description: "the discussion the card came from, read when no session is carried on" }
44550
44556
  ];
44551
44557
  FLOWS = [
44552
44558
  {
@@ -44802,7 +44808,7 @@ var init_roles = __esm({
44802
44808
  value: "auto",
44803
44809
  label: "Just do them",
44804
44810
  cost: "For speed over quality",
44805
- prompt: `${SMALL_FIX} Do each one instead of proposing it: create it with \`akb raw create --studio <studio> --source "#<finished card id>"\`, its Scope and Todo written per \`akb guide writing\`, then \`akb raw update <id> --status ready\` so it waits only for the user to approve the build.`
44811
+ prompt: `${SMALL_FIX} Do each one instead of proposing it: create it with \`akb task create --title "<title>" --studio <studio> --source "#<finished card id>"\`, its Scope and Todo written per \`akb guide writing\`, then \`akb task update <id> --status ready\` so it waits only for the user to approve the build.`
44806
44812
  },
44807
44813
  { value: "propose", label: "Ask me first", cost: "For balancing speed and quality" },
44808
44814
  {
@@ -45354,27 +45360,18 @@ var init_launch = __esm({
45354
45360
  // ../cli/src/lib/agent/command.ts
45355
45361
  import fs36 from "node:fs";
45356
45362
  import path39 from "node:path";
45357
- function selfCommand() {
45358
- const bin = path39.resolve(path39.dirname(SELF), "..", "bin", "ai4kanban.mjs");
45359
- const file2 = fs36.existsSync(bin) ? bin : SELF;
45360
- const inside2 = rel(file2);
45361
- const shortHop = !inside2.startsWith("..") && !path39.isAbsolute(inside2) && inside2.split(/[\\/]/).length <= 3;
45362
- return `node ${shortHop ? inside2 : file2}`;
45363
- }
45364
45363
  function boardCommand() {
45365
- return pathLookup()("akb") ? "akb" : selfCommand();
45366
- }
45367
- function boardCommandFor(_cardId) {
45368
- const command = pathLookup()("akb") ? "akb" : `node ${absoluteSelf()}`;
45369
- return `${command}${BOARD_FLAG || ` --dir ${REPO_ROOT}`}`;
45370
- }
45371
- function absoluteSelf() {
45364
+ const configured = process.env.AI4KANBAN_COMMAND?.trim();
45365
+ const entry = path39.basename(process.argv[1] ?? "");
45366
+ const byPath2 = entry === "kanban.mjs" || entry === "ai4kanban.mjs";
45372
45367
  const bin = path39.resolve(path39.dirname(SELF), "..", "bin", "ai4kanban.mjs");
45373
- return fs36.existsSync(bin) ? bin : SELF;
45368
+ const file2 = fs36.existsSync(bin) ? bin : SELF;
45369
+ const program2 = configured || (!byPath2 && pathLookup()("akb") ? "akb" : `node ${shellWord(file2)}`);
45370
+ return program2 + (BOARD_FLAG || ` --dir ${shellWord(REPO_ROOT)}`);
45374
45371
  }
45375
45372
  function commandNote(command) {
45376
- if (command === "akb") return "";
45377
- return `In the guides, \`akb\` means \`${command}\` here.`;
45373
+ if (command === "akb") return "Find commands with `akb help`, then read the matching subcommand\u2019s `--help`.";
45374
+ return `Find commands with \`${command} help\`, then read the matching subcommand\u2019s \`--help\`. In guides, use \`${command}\` for \`akb\`.`;
45378
45375
  }
45379
45376
  var init_command = __esm({
45380
45377
  "../cli/src/lib/agent/command.ts"() {
@@ -46153,7 +46150,7 @@ var init_pause = __esm({
46153
46150
  count2 = (n) => `${n} open question${n === 1 ? "" : "s"}`;
46154
46151
  upper = (text5) => text5 ? text5[0].toUpperCase() + text5.slice(1) : text5;
46155
46152
  end = (text5) => /[.!?)]$/.test(text5) ? text5 : `${text5}.`;
46156
- cancelCommand = (delivery) => `${boardCommand()} raw delivery cancel ${delivery.deliveryId}`;
46153
+ cancelCommand = (delivery) => `${boardCommand()} delivery cancel ${delivery.deliveryId}`;
46157
46154
  backInMotion = (delivery) => `\`${cancelCommand(delivery)}\` ends it and leaves the branch.`;
46158
46155
  }
46159
46156
  });
@@ -46346,10 +46343,8 @@ function landedDeliveries(filter = {}) {
46346
46343
  for (const audit of allAudits()) {
46347
46344
  const landing = audit.landing;
46348
46345
  if (typeof audit.cardId !== "number" || landing?.status !== "landed" || !landing.commit) continue;
46349
- const studio = audit.studio?.id || "coding";
46350
46346
  if (filter.since !== void 0 && !(landing.at > filter.since)) continue;
46351
- if (filter.studio !== void 0 && studio !== filter.studio) continue;
46352
- out.push({ cardId: audit.cardId, title: audit.title, studio, at: landing.at, commit: landing.commit });
46347
+ out.push({ cardId: audit.cardId, title: audit.title, studio: audit.studio?.id ?? null, at: landing.at, commit: landing.commit });
46353
46348
  }
46354
46349
  return out.sort((a, b) => a.at - b.at);
46355
46350
  }
@@ -46429,7 +46424,7 @@ function resumeRefusal(delivery, store) {
46429
46424
  const live = store ?? readStore();
46430
46425
  const holder = activeIn(live, delivery.cardId);
46431
46426
  if (holder && holder.deliveryId !== id2) {
46432
- const command = `${boardCommand()} raw delivery cancel ${holder.deliveryId}`;
46427
+ const command = `${boardCommand()} delivery cancel ${holder.deliveryId}`;
46433
46428
  return refusal(
46434
46429
  "deliveryHeld",
46435
46430
  `delivery ${holder.deliveryId} is building #${card} now \u2014 end that one first with \`${command}\`.`,
@@ -46637,9 +46632,9 @@ function heldByDelivery(cardId2, program2) {
46637
46632
  if (insideDelivery(cardId2)) return void 0;
46638
46633
  const cmd = program2 ?? boardCommand();
46639
46634
  const state = deliveryState(delivery, openQuestions(cardId2));
46640
- const answer2 = `Answer it with \`${cmd} raw card resolve ${cardId2}\`.`;
46635
+ const answer2 = `Answer it with \`${cmd} task resolve ${cardId2}\`.`;
46641
46636
  const doing = state.paused ? `is waiting on you on #${cardId2} \u2014 ${state.line} \u2014 so the board won't change the card. ${answer2} Or take the card back with ` : `is in flight on #${cardId2} \u2014 it is building the card as it was approved when it started, so the board won't change it. Take the card back with `;
46642
- return `delivery ${delivery.deliveryId} ${doing}Discard on the card page, or \`${cmd} raw delivery cancel ${delivery.deliveryId}\` to end it here.`;
46637
+ return `delivery ${delivery.deliveryId} ${doing}Discard on the card page, or \`${cmd} delivery cancel ${delivery.deliveryId}\` to end it here.`;
46643
46638
  }
46644
46639
  var auditPath, activeAudits, auditRow, lastSessionRunning, localAudit, unknownDelivery, isResumable, cardStatus, openQuestions, activeIn, listDeliveries, withStudio;
46645
46640
  var init_deliveries = __esm({
@@ -47462,7 +47457,7 @@ var init_Storyboard = __esm({
47462
47457
  var Studio_default;
47463
47458
  var init_Studio = __esm({
47464
47459
  "../cli/src/components/Studio.md"() {
47465
- Studio_default = '# Studio\n\nShow STUDIO.md and its real differences with `<Studio src=".assets/<card id>/studio-review/review.json" />` alone in a paragraph. Inline and fenced examples remain text.\n\n- **Freeze**: `akb raw studio preview <card id> --folder <draft> --base <baseline>` freezes the complete draft and prints its Studio and attachment tags; use `--base empty` for a new Studio.\n- **Files**: put the attachment tags in the files Preview when present. Three or more changed files use a Set; paired file and diff Assets share a label.\n- **Results**: show trial results as ordinary Preview Components beside the Studio, without a separate manifest or Agent assignment.\n- **Refresh**: rerun after changing the draft; publish only the approved fingerprint. See [the contract](https://github.com/wildcrane-ai/wildcrane/blob/main/docs/api/studio-review.md).\n';
47460
+ Studio_default = '# Studio\n\nShow STUDIO.md and its real differences with `<Studio src=".assets/<card id>/studio-review/review.json" />` alone in a paragraph. Inline and fenced examples remain text.\n\n- **Freeze**: `akb studio preview <card id> --folder <draft> --base <baseline>` freezes the complete draft and prints its Studio and attachment tags; use `--base empty` for a new Studio.\n- **Files**: put the attachment tags in the files Preview when present. Three or more changed files use a Set; paired file and diff Assets share a label.\n- **Results**: show trial results as ordinary Preview Components beside the Studio, without a separate manifest or Agent assignment.\n- **Refresh**: rerun after changing the draft; publish only the approved fingerprint. See [the contract](https://github.com/wildcrane-ai/wildcrane/blob/main/docs/api/studio-review.md).\n';
47466
47461
  }
47467
47462
  });
47468
47463
 
@@ -47582,7 +47577,6 @@ var init_studio_shared = __esm({
47582
47577
  init_memory();
47583
47578
  init_paths();
47584
47579
  init_studio_files();
47585
- init_command();
47586
47580
  init_cloud_studios();
47587
47581
  }
47588
47582
  });
@@ -47597,7 +47591,7 @@ function stopReason(deliveryId) {
47597
47591
  const ids = new Set(delivery.sessions);
47598
47592
  const last = readRuns().filter((r) => ids.has(r.sessionId) && r.action === "implement" && r.status !== "running").at(-1);
47599
47593
  if (!last) return void 0;
47600
- if (last.status === "done" && delivery.status === "active") return notCompletedWhy(deliveryId);
47594
+ if (last.status === "done" && delivery.status === "active") return notCompletedWhy(deliveryId, boardCommand());
47601
47595
  if (last.status === "error" || last.status === "interrupted") return firstLine(last.error);
47602
47596
  return void 0;
47603
47597
  }
@@ -47607,7 +47601,7 @@ function resumePrompt(deliveryId, action) {
47607
47601
  }
47608
47602
  function deliveryRequirements(deliveryId, cardId2) {
47609
47603
  if (cardId2 !== null) {
47610
- return DELIVERY_RESUME_CARD.replace("%c", `${boardCommandFor(cardId2)} raw card implement ${cardId2} --print`);
47604
+ return DELIVERY_RESUME_CARD.replace("%c", `${boardCommand()} task implement ${cardId2} --print`);
47611
47605
  }
47612
47606
  const delivery = findDelivery(deliveryId);
47613
47607
  const approved = delivery?.approved.trim();
@@ -47624,6 +47618,7 @@ function restartPrompt(req, deliveryId) {
47624
47618
  if (deliveryId && req.action === "implement") return [
47625
47619
  RESTART_LEAD,
47626
47620
  `Continue delivery ${deliveryId}. ${deliveryRequirements(deliveryId, req.id ?? null)}`.trim(),
47621
+ commandNote(boardCommand()),
47627
47622
  studioRulesBlock({ ...req, deliveryId })
47628
47623
  ].filter(Boolean).join("\n\n");
47629
47624
  if (!RESTARTABLE.has(req.action)) return void 0;
@@ -47631,7 +47626,7 @@ function restartPrompt(req, deliveryId) {
47631
47626
  }
47632
47627
  function buildAsk(rawReq, notes = []) {
47633
47628
  const req = withStudio(rawReq);
47634
- const command = DELIVERY_FLOWS.has(req.action) ? boardCommandFor(req.id) : boardCommand();
47629
+ const command = boardCommand();
47635
47630
  const ask2 = [actionPrompt(req, command, notes), pictureNote(req), commandNote(command)].filter(Boolean).join(" ");
47636
47631
  return realPaths(boardText([ask2, componentsBlock(req)].filter(Boolean).join("\n\n")), req);
47637
47632
  }
@@ -47731,7 +47726,7 @@ function buildRun(req) {
47731
47726
  function answeredNote(cardId2, command) {
47732
47727
  const delivery = cardId2 === void 0 ? void 0 : activeDelivery(cardId2);
47733
47728
  if (!delivery) return "";
47734
- return `Delivery ${delivery.deliveryId} is already building this card. Once your answers are on it, say what they did to what it was approved to build: \`${command} raw delivery answered ${delivery.deliveryId} --changed|--unchanged "<why>"\`, before you drop the questions. Judge the meaning, not the words \u2014 say nothing and the board carries the build on as unchanged.`;
47729
+ return `Record how the answers affect delivery ${delivery.deliveryId} before closing the questions. Run \`${command} delivery answered ${delivery.deliveryId} --changed "<why>"\` if the approved requirements changed, or \`${command} delivery answered ${delivery.deliveryId} --unchanged "<why>"\` otherwise.`;
47735
47730
  }
47736
47731
  function carriedNote(req) {
47737
47732
  if (req.action === "implement") {
@@ -47802,7 +47797,7 @@ function actionPrompt(req, command, notes) {
47802
47797
  case "review-memory":
47803
47798
  return [
47804
47799
  `Review what this board's conversations settled and write it into memory, following \`akb guide review-memory\`.`,
47805
- req.tasks?.length ? `The conversations are the ones \`${command} raw memory review --task ${req.tasks.join(" ")} --print\` prints.` : ""
47800
+ req.tasks?.length ? `The conversations are the ones \`${command} memory review --task ${req.tasks.join(" ")} --print\` prints.` : ""
47806
47801
  ].filter(Boolean).join(" ");
47807
47802
  // The dismissal review (#929). The flow lists the dismissals and restored ids; the guide
47808
47803
  // holds every rule.
@@ -47866,7 +47861,6 @@ var init_prompts = __esm({
47866
47861
  init_facts();
47867
47862
  init_outputs();
47868
47863
  init_archive();
47869
- init_flows();
47870
47864
  init_resolve();
47871
47865
  init_runner();
47872
47866
  init_studio_shared();
@@ -50101,7 +50095,7 @@ function kindOf2(ext) {
50101
50095
  if (type.startsWith("image/")) return "image";
50102
50096
  return type.startsWith("video/") || type.startsWith("audio/") ? "video" : "asset";
50103
50097
  }
50104
- var STORYBOARD, STUDIO, ARRANGED, ASSET, isObject2, TAG3, bodyComponentTags, bodySources, TYPES;
50098
+ var STORYBOARD, STUDIO, ARRANGED, ASSET, isObject2, TAG3, bodySources, TYPES;
50105
50099
  var init_references = __esm({
50106
50100
  "../artifact-sdk/src/internal/references.ts"() {
50107
50101
  "use strict";
@@ -50111,7 +50105,6 @@ var init_references = __esm({
50111
50105
  ASSET = ["spritesheet", "asset"];
50112
50106
  isObject2 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
50113
50107
  TAG3 = /<(Asset|Mockup|Compare|Storyboard|Studio)\b([^<>]*?)\/>/g;
50114
- bodyComponentTags = (body) => componentTags(visibleBody(body));
50115
50108
  bodySources = (body) => [...new Set(bodyReferences(body).map((r) => r.src))];
50116
50109
  TYPES = {
50117
50110
  ".png": "image/png",
@@ -50261,14 +50254,6 @@ function splitFileReference(src) {
50261
50254
  const end2 = src.search(/[?#]/);
50262
50255
  return end2 < 0 ? [src, ""] : [src.slice(0, end2), src.slice(end2)];
50263
50256
  }
50264
- function relativeFileReference(src, owner) {
50265
- const parts = owner.split("/").slice(0, -1);
50266
- for (const part of src.split("/")) {
50267
- if (part === ".." && parts.length && parts.at(-1) !== "..") parts.pop();
50268
- else if (part && part !== ".") parts.push(part);
50269
- }
50270
- return parts.join("/");
50271
- }
50272
50257
  var CSS, fileManifest;
50273
50258
  var init_file_references = __esm({
50274
50259
  "../artifact-sdk/src/internal/file-references.ts"() {
@@ -50296,14 +50281,14 @@ function collectSources(sources2, card, host2) {
50296
50281
  const active3 = /* @__PURE__ */ new Set();
50297
50282
  const out = [];
50298
50283
  const visit2 = (src, types, owner, partial2 = false) => {
50299
- const [path88] = splitFileReference(src);
50284
+ const [path87] = splitFileReference(src);
50300
50285
  let resolved;
50301
50286
  try {
50302
- resolved = host2.resolve(path88, owner);
50287
+ resolved = host2.resolve(path87, owner);
50303
50288
  } catch (error62) {
50304
50289
  if (owner !== card) return { key: null, error: why(error62) };
50305
50290
  if (!nodes.has(src)) {
50306
- const node3 = { key: src, file: null, kind: kindAt(path88, types), error: why(error62), problems: [], dependencies: /* @__PURE__ */ new Map(), aliases: /* @__PURE__ */ new Set([src]) };
50291
+ const node3 = { key: src, file: null, kind: kindAt(path87, types), error: why(error62), problems: [], dependencies: /* @__PURE__ */ new Map(), aliases: /* @__PURE__ */ new Set([src]) };
50307
50292
  nodes.set(src, node3);
50308
50293
  out.push(node3);
50309
50294
  }
@@ -50552,12 +50537,12 @@ function validateSpec(file2, text5, id2) {
50552
50537
  if (!fields2.has(key)) add2(1, "missing-field", `Missing ${key}: in frontmatter. Restore it with the board's metadata commands.`);
50553
50538
  }
50554
50539
  const { meta: meta3 } = parseFrontmatter(text5);
50555
- if (typeof meta3?.title !== "string" || !meta3.title.trim()) add2(fields2.get("title")?.line ?? 1, "title", "The title is empty. Set a non-empty title with akb raw update.");
50540
+ if (typeof meta3?.title !== "string" || !meta3.title.trim()) add2(fields2.get("title")?.line ?? 1, "title", "The title is empty. Set a non-empty title with akb task update.");
50556
50541
  for (const key of ["priority", "status"]) {
50557
50542
  const allowed2 = key === "status" ? STATUSES : LEVELS;
50558
50543
  const value = fields2.get(key);
50559
50544
  if (value && !allowed2.includes(value.value.replace(/^['"]|['"]$/g, ""))) {
50560
- add2(value.line, key, `Invalid ${key} ${JSON.stringify(value.value)}. Expected ${allowed2.join(", ")}; use akb raw update.`);
50545
+ add2(value.line, key, `Invalid ${key} ${JSON.stringify(value.value)}. Expected ${allowed2.join(", ")}; use akb task update.`);
50561
50546
  }
50562
50547
  }
50563
50548
  const approved = fields2.get("preview_approved");
@@ -50584,12 +50569,12 @@ function validateSpec(file2, text5, id2) {
50584
50569
  if (key === "blocked_by") {
50585
50570
  const groups = enclosingGroups(file2);
50586
50571
  for (const g of groups.filter((g2) => values.includes(String(g2)))) {
50587
- add2(field2.line, "dependency-cycle", `blocked_by names #${g}, a group this card is in; the group waits for this card, so neither can finish. Remove it with akb raw update.`);
50572
+ add2(field2.line, "dependency-cycle", `blocked_by names #${g}, a group this card is in; the group waits for this card, so neither can finish. Remove it with akb task update.`);
50588
50573
  }
50589
50574
  if (id2 !== void 0 && groups.length) {
50590
50575
  for (const dep of values.filter((v) => /^\d+$/.test(v) && !groups.includes(Number(v))).map(Number)) {
50591
50576
  const cycle = dependencyCycle(id2, dep);
50592
- if (cycle) add2(field2.line, "dependency-cycle", `blocked_by #${dep} makes a cycle: ${cycle.map((n) => `#${n}`).join(" \u2192 ")}. Drop one link with akb raw update <id> --blocked-by.`);
50577
+ if (cycle) add2(field2.line, "dependency-cycle", `blocked_by #${dep} makes a cycle: ${cycle.map((n) => `#${n}`).join(" \u2192 ")}. Set the remaining blockers with akb task update <id> --blocked-by <ids>.`);
50593
50578
  }
50594
50579
  }
50595
50580
  }
@@ -50789,7 +50774,7 @@ function validateStoryboards(file2, id2, text5) {
50789
50774
  const dir = path55.join(ASSETS, String(id2));
50790
50775
  for (const [tag, tagOf, rule, fix] of [
50791
50776
  ["Storyboard", storyboardTag, "storyboard-src", "Write the JSON there or fix the path."],
50792
- ["Studio", studioTag, "studio-src", "Write it with `akb raw studio diagram <studio id> <card id>` or fix the path."]
50777
+ ["Studio", studioTag, "studio-src", "Fix the path or freeze the draft with `akb studio preview <card> --folder <draft> --base <baseline>` and use the returned Studio tag."]
50793
50778
  ]) {
50794
50779
  for (const marker of storyboardMarkers(text5, tagOf)) {
50795
50780
  const named2 = assetName(marker.src, id2, ["json"]);
@@ -51013,7 +50998,7 @@ function validateCreate(opts) {
51013
50998
  }
51014
50999
  function cmdCreate(opts) {
51015
51000
  const { title, priority, blocked_by, related, modules, triage, studio, previews, source: source2, questions, written } = validateCreate(opts);
51016
- if (opts.id === void 0) die("\u8BF7\u901A\u8FC7 `akb raw create` \u521B\u5EFA\u5361\u7247\uFF0C\u7531 Cloud \u5206\u914D\u7F16\u53F7", { kind: "needs-cloud" });
51001
+ if (opts.id === void 0) die('\u8BF7\u901A\u8FC7 `akb task create --title "<title>"` \u521B\u5EFA\u5361\u7247\uFF0C\u7531 Cloud \u5206\u914D\u7F16\u53F7', { kind: "needs-cloud" });
51017
51002
  const start = opts.id;
51018
51003
  const slug = slugify2(opts.slug !== void 0 ? opts.slug : title);
51019
51004
  const fileRel = `${start}-${slug}.md`;
@@ -51084,7 +51069,7 @@ function cmdUpdate(id2, flags) {
51084
51069
  if (!found2) die(`no task with id ${id2} under ${rel(TODO)}`, { kind: "card-not-found", id: id2 });
51085
51070
  const file2 = found2.kind === "group" ? path57.join(found2.target, "root.md") : found2.target;
51086
51071
  const { meta: meta3, body } = parseFrontmatter(fs53.readFileSync(file2, "utf8"));
51087
- if (!meta3) die(`${rel(file2)} has no frontmatter \u2014 recreate it with \`akb raw create\``);
51072
+ if (!meta3) die(`${rel(file2)} has no frontmatter \u2014 restore this card from its last valid version`);
51088
51073
  if (flags.blockedBy !== void 0 && flags.addBlockedBy !== void 0) die("--blocked-by replaces the list and --add-blocked-by appends to it \u2014 pass one");
51089
51074
  if (flags.related !== void 0 && flags.addRelated !== void 0) die("--related replaces the list and --add-related appends to it \u2014 pass one");
51090
51075
  if (flags.source !== void 0 && flags.addSource !== void 0) die("--source replaces the list and --add-source appends to it \u2014 pass one");
@@ -51184,7 +51169,7 @@ function updateCardQuestions(id2, ops, compatibility = false) {
51184
51169
  if (!found2) die(`no task with id ${id2} under ${rel(TODO)}`, { kind: "card-not-found", id: id2 });
51185
51170
  const file2 = found2.kind === "group" ? path57.join(found2.target, "root.md") : found2.target;
51186
51171
  const { meta: meta3, body } = parseFrontmatter(fs53.readFileSync(file2, "utf8"));
51187
- if (!meta3) die(`${rel(file2)} has no frontmatter \u2014 recreate it with \`akb raw create\``);
51172
+ if (!meta3) die(`${rel(file2)} has no frontmatter \u2014 restore this card from its last valid version`);
51188
51173
  for (const op of ops) {
51189
51174
  if (!compatibility || !op.question?.agent) continue;
51190
51175
  const agent = findSpecAgent(op.question.agent);
@@ -51243,7 +51228,7 @@ var init_card = __esm({
51243
51228
  var config_default;
51244
51229
  var init_config2 = __esm({
51245
51230
  "../cli/src/templates/config.md"() {
51246
- config_default = "# Configuration\n\nThis file holds your board's settings. `akb raw init` seeds it at `docs/kanban/config.md`,\nand an update never touches it.\n\n- **Stale after** \u2014 30 days\n _(how long a card may sit untouched before `akb raw list --stale` calls it stuck.)_\n";
51231
+ config_default = "# Configuration\n\nThis file holds your board's settings. `akb update` restores it if it is missing.\n\n- **Stale after** \u2014 30 days\n _(how long a card may sit untouched before `akb board list --stale` calls it stuck.)_\n";
51247
51232
  }
51248
51233
  });
51249
51234
 
@@ -51554,14 +51539,12 @@ function cmdArchived(opts) {
51554
51539
  const studio = opts.studio === void 0 ? null : knownStudio(opts.studio);
51555
51540
  const open4 = boardCardIds();
51556
51541
  const files = archivedFiles();
51557
- const cards = landedDeliveries({ since: since?.getTime(), studio: studio ?? void 0 }).filter((d) => !open4.has(d.cardId)).map((d) => ({
51558
- id: d.cardId,
51559
- title: d.title,
51560
- studio: d.studio,
51561
- landedAt: formatStamp(new Date(d.at)),
51562
- commit: d.commit,
51563
- file: files.has(d.cardId) ? rel(files.get(d.cardId)) : ""
51564
- }));
51542
+ const cards = landedDeliveries({ since: since?.getTime() }).filter((d) => !open4.has(d.cardId)).flatMap((d) => {
51543
+ const file2 = files.get(d.cardId);
51544
+ const recorded = d.studio ?? (file2 ? parseFrontmatter(fs56.readFileSync(file2, "utf8")).meta?.studio || null : null);
51545
+ if (studio && studio !== recorded) return [];
51546
+ return [{ id: d.cardId, title: d.title, studio: recorded, landedAt: formatStamp(new Date(d.at)), commit: d.commit, file: file2 ? rel(file2) : "" }];
51547
+ });
51565
51548
  const result = { cards, since: since ? formatStamp(since) : null, studio };
51566
51549
  const scope = [studio ? `on studio \`${studio}\`` : "", since ? `since ${formatStamp(since)}` : ""].filter(Boolean).join(" ");
51567
51550
  if (!cards.length) {
@@ -51572,7 +51555,7 @@ function cmdArchived(opts) {
51572
51555
  for (const c of cards) {
51573
51556
  say("");
51574
51557
  say(`#${c.id} ${c.title}${c.file ? ` (${c.file})` : ""}`);
51575
- say(` ${c.studio} \xB7 landed ${c.landedAt} \xB7 commit ${c.commit}`);
51558
+ say(` ${c.studio ? `${c.studio} \xB7 ` : ""}landed ${c.landedAt} \xB7 commit ${c.commit}`);
51576
51559
  }
51577
51560
  return result;
51578
51561
  }
@@ -53987,7 +53970,7 @@ var require_command = __commonJS({
53987
53970
  "../cli/node_modules/commander/lib/command.js"(exports) {
53988
53971
  var EventEmitter = __require("node:events").EventEmitter;
53989
53972
  var childProcess = __require("node:child_process");
53990
- var path88 = __require("node:path");
53973
+ var path87 = __require("node:path");
53991
53974
  var fs91 = __require("node:fs");
53992
53975
  var process2 = __require("node:process");
53993
53976
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -54987,9 +54970,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
54987
54970
  let launchWithNode = false;
54988
54971
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
54989
54972
  function findFile(baseDir, baseName) {
54990
- const localBin = path88.resolve(baseDir, baseName);
54973
+ const localBin = path87.resolve(baseDir, baseName);
54991
54974
  if (fs91.existsSync(localBin)) return localBin;
54992
- if (sourceExt.includes(path88.extname(baseName))) return void 0;
54975
+ if (sourceExt.includes(path87.extname(baseName))) return void 0;
54993
54976
  const foundExt = sourceExt.find(
54994
54977
  (ext) => fs91.existsSync(`${localBin}${ext}`)
54995
54978
  );
@@ -55007,17 +54990,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
55007
54990
  } catch {
55008
54991
  resolvedScriptPath = this._scriptPath;
55009
54992
  }
55010
- executableDir = path88.resolve(
55011
- path88.dirname(resolvedScriptPath),
54993
+ executableDir = path87.resolve(
54994
+ path87.dirname(resolvedScriptPath),
55012
54995
  executableDir
55013
54996
  );
55014
54997
  }
55015
54998
  if (executableDir) {
55016
54999
  let localFile = findFile(executableDir, executableFile);
55017
55000
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
55018
- const legacyName = path88.basename(
55001
+ const legacyName = path87.basename(
55019
55002
  this._scriptPath,
55020
- path88.extname(this._scriptPath)
55003
+ path87.extname(this._scriptPath)
55021
55004
  );
55022
55005
  if (legacyName !== this._name) {
55023
55006
  localFile = findFile(
@@ -55028,7 +55011,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
55028
55011
  }
55029
55012
  executableFile = localFile || executableFile;
55030
55013
  }
55031
- launchWithNode = sourceExt.includes(path88.extname(executableFile));
55014
+ launchWithNode = sourceExt.includes(path87.extname(executableFile));
55032
55015
  let proc;
55033
55016
  if (process2.platform !== "win32") {
55034
55017
  if (launchWithNode) {
@@ -55875,7 +55858,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
55875
55858
  * @return {Command}
55876
55859
  */
55877
55860
  nameFromFilename(filename) {
55878
- this._name = path88.basename(filename, path88.extname(filename));
55861
+ this._name = path87.basename(filename, path87.extname(filename));
55879
55862
  return this;
55880
55863
  }
55881
55864
  /**
@@ -55889,9 +55872,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
55889
55872
  * @param {string} [path]
55890
55873
  * @return {(string|null|Command)}
55891
55874
  */
55892
- executableDir(path89) {
55893
- if (path89 === void 0) return this._executableDir;
55894
- this._executableDir = path89;
55875
+ executableDir(path88) {
55876
+ if (path88 === void 0) return this._executableDir;
55877
+ this._executableDir = path88;
55895
55878
  return this;
55896
55879
  }
55897
55880
  /**
@@ -56201,23 +56184,27 @@ function movedTo(word, program2) {
56201
56184
  function unknownWord(message) {
56202
56185
  return /unknown command '([^']+)'/.exec(message)?.[1] ?? "";
56203
56186
  }
56204
- var RAW_GROUPS, MOVED;
56187
+ var MOVED;
56205
56188
  var init_moved = __esm({
56206
56189
  "../cli/src/lib/cli/moved.ts"() {
56207
56190
  "use strict";
56208
- init_flows();
56209
- RAW_GROUPS = ["card", "delivery", "run", "triage", "previews", "components", "agent", "review-dismissals", "describe-project", "reflect"];
56210
56191
  MOVED = {
56211
- ...Object.fromEntries(FLOWS.filter((flow) => !flow.internal).map((flow) => [flow.command, `raw ${flowPath(flow)}`])),
56212
- ...Object.fromEntries(RAW_GROUPS.map((word) => [word, `raw ${word}`])),
56213
- create: "raw create",
56214
- runs: "raw run list",
56215
- log: "raw run log",
56216
- stop: "raw run stop",
56217
- resume: "raw run resume",
56218
- cancel: "raw delivery cancel",
56219
- discard: "raw delivery cancel",
56220
- board: "raw",
56192
+ card: "task --help",
56193
+ create: "task create",
56194
+ refine: "task refine",
56195
+ revise: "task revise",
56196
+ resolve: "task resolve",
56197
+ implement: "task implement",
56198
+ approve: "task approve",
56199
+ previews: "studio previews",
56200
+ "review-memory": "memory review",
56201
+ "describe-project": "memory describe-project",
56202
+ runs: "run list",
56203
+ log: "run log",
56204
+ stop: "run stop",
56205
+ resume: "run resume",
56206
+ cancel: "delivery cancel",
56207
+ discard: "delivery cancel",
56221
56208
  version: "--version"
56222
56209
  };
56223
56210
  }
@@ -56476,7 +56463,7 @@ function conflictPrompt(board2, work = "Continue the original work from its save
56476
56463
  const records = conflictList(board2);
56477
56464
  return records.length ? [
56478
56465
  "Resolve these saved board content conflicts using `akb guide resolve-conflict` before continuing.",
56479
- ...records.map((r) => `${r.id}: ${r.paths.join(", ")}; read with akb raw conflict show ${r.id}.`),
56466
+ ...records.map((r) => `${r.id}: ${r.paths.join(", ")}; read with akb board conflict show ${r.id}.`),
56480
56467
  work
56481
56468
  ].join("\n") : "";
56482
56469
  }
@@ -56495,7 +56482,7 @@ async function withSyncLock(board2, work) {
56495
56482
  }
56496
56483
  }
56497
56484
  function refuse(record2, message, kind = "conflict") {
56498
- throw new BoardError(message, { kind, id: record2.id, read: `akb raw conflict show ${record2.id}` });
56485
+ throw new BoardError(message, { kind, id: record2.id, read: `akb board conflict show ${record2.id}` });
56499
56486
  }
56500
56487
  function resolutionOf(record2, value) {
56501
56488
  if (!value || typeof value !== "object" || Object.keys(value).join() !== "files" || !Array.isArray(value.files)) refuse(record2, 'Expected {"files":[{"path":"...","content":"..."}]} .', "invalid-usage");
@@ -56736,7 +56723,10 @@ var init_question_options = __esm({
56736
56723
  // ../cli/src/lib/cli/board.ts
56737
56724
  var board_exports = {};
56738
56725
  __export(board_exports, {
56739
- buildBoardProgram: () => buildBoardProgram
56726
+ buildBoardProgram: () => buildBoardProgram,
56727
+ createBoardCard: () => createBoardCard,
56728
+ declareBoardMoves: () => declareBoardMoves,
56729
+ withCreateOptions: () => withCreateOptions
56740
56730
  });
56741
56731
  import crypto5 from "node:crypto";
56742
56732
  import fs66 from "node:fs";
@@ -56851,13 +56841,16 @@ function unwrap(res) {
56851
56841
  if (res.ok) return res.data;
56852
56842
  throw new BoardError(res.error, res.kind === "conflict" ? { kind: "conflict" } : { kind: "refused" });
56853
56843
  }
56854
- function buildBoardProgram(cli) {
56855
- const program2 = withShared(newCommand(cli.program));
56856
- program2.description(
56857
- "the local board and the commands an agent uses inside a run; a person never has to type one. They own a card's frontmatter \u2014 write and edit only a card's body."
56858
- ).helpCommand("help [move]", "this list, or one move in full");
56859
- const move = (name) => withShared(program2.command(name));
56860
- const conflict = move("conflict").summary("read and explicitly resolve saved board content conflicts");
56844
+ function withCreateOptions(command, legacy = false) {
56845
+ return command.addOption(new Option("--title <title>", "write a local card with a Cloud-assigned number").makeOptionMandatory(legacy)).option("--studio <id>", "the Studio from `akb studio list`").option("--priority <level>", `how much it matters: ${LEVELS.join(" | ")} (default: med)`, oneOf(LEVELS)).option("--blocked-by <ids>", "ids of open cards this one waits on", collectList).option("--related <ids>", "ids of open cards this one relates to", collectList).option("--modules <names>", "the parts of the project it touches, validated against modules.md", collectList).option("--slug <slug>", "the filename to write it under (default: from the title)").option("--triage <source-id>", "the triage item this card is made of").option("--source <ref>", "where it came from: a plan's path, plan:<id>, #<id> or a URL. Repeatable", collect2);
56846
+ }
56847
+ async function createBoardCard(command, cli, asked = []) {
56848
+ refuseRecurring(command);
56849
+ await dispatch("create", command, [], { ...command.opts(), asked }, cli);
56850
+ }
56851
+ function declareBoardMoves(program2, cli, groups) {
56852
+ const move = (name, parent = program2) => withShared(parent.command(name));
56853
+ const conflict = move("conflict", groups?.board).summary("read and explicitly resolve saved board content conflicts");
56861
56854
  withShared(conflict.command("list")).summary("list pending local conflicts without contacting Cloud").action(async function() {
56862
56855
  await dispatch("conflict-list", this, [], this.opts(), cli);
56863
56856
  });
@@ -56867,42 +56860,28 @@ function buildBoardProgram(cli) {
56867
56860
  withShared(conflict.command("resolve <id>")).summary("submit explicit results for the entire original batch").requiredOption("--expect <revision>", "the credential just returned by conflict show").requiredOption("--file <path>", "UTF-8 JSON with each conflicting path and final content; null deletes").action(async function(id2) {
56868
56861
  await dispatch("conflict-resolve", this, [id2], this.opts(), cli);
56869
56862
  });
56870
- const asked = [];
56871
- const inOrder = ordered(asked);
56872
- move("create").summary("write exactly one card \u2014 its fields, its body template and its index entry").description(
56873
- 'Write exactly ONE card: allocate its id, write its frontmatter and a body template, and index it. There is no separate id-reservation mode. --blocked-by and --related take ids of existing open cards; for a group, create the root first, then create each subtask related to its id (see "Group tasks" in `akb guide add-task`). The script owns the frontmatter and writes the body scaffold; fill only the body by hand. Without --id, Cloud assigns the number in the linked project (no source task required). A failed local write can resume the same creation without making another Cloud task. Missing or invalid project links and denied access exit with code 1 using the existing error envelope. --body-file accepts a short draft or full card body. Invalid bodies fail before allocating a task or writing a card, with repair instructions. Cloud moves the card on by itself once it reaches the board: do not refine it here. Example: akb raw create --title "Add a delete command" --studio coding --body-file /tmp/delete-command.md'
56874
- ).requiredOption("--title <title>", "what the card is called").addOption(new Option("--recurring").hideHelp()).option("--priority <level>", `how much it matters: ${LEVELS.join(" | ")} (default: med)`, oneOf(LEVELS)).option("--blocked-by <ids>", "ids of open cards this one waits on", collectList).option("--related <ids>", "ids of open cards this one relates to", collectList).option("--modules <names>", "the parts of the project it touches, validated against modules.md", collectList).option("--question <text>", "an open question; needs its --option choices. Repeatable; follow `akb guide update-questions`", inOrder("question")).option("--option <text>", "a choice for the --question before it", inOrder("option")).option("--recommended-option <text>", "a choice for the --question before it, ticked to start", inOrder("recommended-option")).option("--mode <mode>", "how many choices the --question before it takes: single | multi", inOrder("mode")).option("--slug <slug>", "the filename to write it under (default: from the title)").option("--no-body", "write the frontmatter and no body template").option("--body-file <path>", "a short draft or full card body, written to a file first").addOption(new Option("--cadence <cadence>").hideHelp()).option("--studio <id>", "the studio it runs through (`akb studio list`). Required when the board has more than one, except inside a task run, which uses the task's own").option("--previews <ids>", 'the Preview IDs chosen from its Studio; "" chooses none', collectList).addOption(new Option("--id <n>", "the number Cloud gave this card's task; for the Runner").argParser(cardId).hideHelp()).option("--triage <source-id>", "the triage item this card is made of, so the item is never carded twice").option("--source <ref>", "where it came from: a plan's path, plan:<id>, #<id> or a URL. Repeatable", collect2).action(async function() {
56875
- refuseRecurring(this);
56876
- await dispatch("create", this, [], { ...this.opts(), asked }, cli);
56877
- });
56878
- move("update").argument("<id>", ID, cardId).summary("rewrite a card's fields").description(
56863
+ const update2 = move("update", groups?.task).argument("<id>", ID, cardId).summary("rewrite a card's fields").description(
56879
56864
  "Rewrite a card's frontmatter fields. --slug renames it. Body and questions are left untouched \u2014 those have their own moves."
56880
- ).option("--title <title>", "what the card is called").option("--priority <level>", LEVELS.join(" | "), oneOf(LEVELS)).option("--status <status>", STATUSES.join(" | "), oneOf(STATUSES)).option("--blocked-by <ids>", "ids of open cards this one waits on", collectList).option("--related <ids>", "ids of open cards this one relates to", collectList).option("--add-blocked-by <ids>", "append ids to blocked_by, keeping the ids already there", collectList).option("--add-related <ids>", "append ids to related, keeping the ids already there", collectList).option("--modules <names>", "the parts of the project it touches", collectList).option("--source <ref>", `where it came from: a plan's path, plan:<id>, #<id> or a URL. Repeatable; "" clears the list`, collect2).option("--add-source <ref>", "append one source, keeping the ones already there. Repeatable", collect2).option("--previews <ids>", 'the Preview IDs chosen from its Studio; "" chooses none', collectList).option("--slug <slug>", "rename the file").option("--studio <id>", "the studio it runs through. The card goes back to todo and is re-planned").addOption(new Option("--cadence <cadence>").hideHelp()).action(async function(id2) {
56865
+ ).option("--title <title>", "what the card is called").option("--priority <level>", LEVELS.join(" | "), oneOf(LEVELS)).option("--status <status>", STATUSES.join(" | "), oneOf(STATUSES)).option("--blocked-by <ids>", "ids of open cards this one waits on", collectList).option("--related <ids>", "ids of open cards this one relates to", collectList).option("--add-blocked-by <ids>", "append ids to blocked_by, keeping the ids already there", collectList).option("--add-related <ids>", "append ids to related, keeping the ids already there", collectList).option("--modules <names>", "the parts of the project it touches", collectList).option("--source <ref>", `where it came from: a plan's path, plan:<id>, #<id> or a URL. Repeatable; "" clears the list`, collect2).option("--add-source <ref>", "append one source, keeping the ones already there. Repeatable", collect2).option("--slug <slug>", "rename the file").option("--studio <id>", "the studio it runs through. The card goes back to todo and is re-planned").addOption(new Option("--cadence <cadence>").hideHelp()).action(async function(id2) {
56881
56866
  refuseRecurring(this);
56882
56867
  await dispatch("update", this, [String(id2)], this.opts(), cli);
56883
56868
  });
56884
- const questionOps = [];
56885
- withQuestionOptions(withShared(program2.command("update-questions", { hidden: true })).argument("<id>", ID, cardId).summary("edit open questions on a local card (compatibility)").description("For older Runner instructions. Use akb task update-questions.\nSee akb guide update-questions."), questionOps).action(async function(id2) {
56886
- await dispatch("update-questions", this, [String(id2)], { ops: questionOps }, cli);
56887
- });
56888
- move("inspect").argument("<id>", ID, cardId).summary("read task facts, saved work and execution references").action(async function(id2) {
56869
+ if (!groups) update2.option("--previews <ids>", 'the Preview IDs chosen from its Studio; "" chooses none', collectList);
56870
+ move("inspect", groups?.task).argument("<id>", ID, cardId).summary("read task facts, saved work and execution references").action(async function(id2) {
56889
56871
  await dispatch("inspect", this, [String(id2)], this.opts(), cli);
56890
56872
  });
56891
- move("validate").argument("[id]", ID, cardId).summary("validate card format and report file, line, and repair instructions").description("Check one card, or every open card when no id is given. Reads only; exits non-zero with detailed errors until the format is valid.").action(async function(id2) {
56873
+ move("validate", groups?.task).argument("[id]", ID, cardId).summary("validate card format and report file, line, and repair instructions").description("Check one card, or every open card when no id is given. Reads only; exits non-zero with detailed errors until the format is valid.").action(async function(id2) {
56892
56874
  await dispatch("validate", this, id2 === void 0 ? [] : [String(id2)], this.opts(), cli);
56893
56875
  });
56894
- move("file").argument("<studio>", "the studio, e.g. blog-post").argument("<path>", "the path inside the Studio folder").summary("print one file of a studio").description("In a task's run, reads the version the task is pinned to; otherwise the current one.").action(async function(studio, file2) {
56876
+ move("file", groups?.studio).argument("<studio>", "the studio, e.g. blog-post").argument("<path>", "the path inside the Studio folder").summary("print one file of a studio").description("In a task's run, reads the version the task is pinned to; otherwise the current one.").action(async function(studio, file2) {
56895
56877
  await dispatch("file", this, [studio, file2], this.opts(), cli);
56896
56878
  });
56897
- withShared(program2.command("agent-file", { hidden: true })).argument("<agent>").argument("<path>").action(async function(agent, file2) {
56898
- await dispatch("agent-file", this, [agent, file2], this.opts(), cli);
56899
- });
56900
- move("memory-file").argument("<name>", "the global memory").summary("print one global memory's rules, its MEMORY.md").description(
56879
+ move(groups ? "file" : "memory-file", groups?.memory).argument("<name>", "the global memory").summary("print one global memory's rules, its MEMORY.md").description(
56901
56880
  "A run is told which global memories its agent keeps and reads one's rules when the work calls for it. A built-in memory's rules ship inside the command, so this is the only way to open them."
56902
56881
  ).action(async function(name) {
56903
56882
  await dispatch("memory-file", this, [name], this.opts(), cli);
56904
56883
  });
56905
- move("list").summary("the open cards: id, title, meta, summary, path \u2014 or, with --archived, the cards that landed").description(
56884
+ move("list", groups?.board).summary("the open cards: id, title, meta, summary, path \u2014 or, with --archived, the cards that landed").description(
56906
56885
  "The open cards at a glance \u2014 one block per card with its id, title, meta (status, priority, blockers, open questions), summary line and file path.\n\n`--stale` asks the other question: which cards have sat untouched past the board's **Stale after** setting (config.md, 30 days by default), stalest first, each with the days it has sat and what is holding it \u2014 a blocker, an unanswered question, or a build. Age is the date git last saw the card's file; group roots and cards git cannot date are left out.\n\n`--archived` answers \"which cards landed in this period\": one block per landing, oldest first, with the card id, title, studio, landing time, landed commit and the archived card file (blank when the file is no longer in .archive/, e.g. deleted by hand; a card the daily cleanup deletes goes with its finished delivery and is not listed). Only cards the board landed are listed \u2014 a card archived by hand, committed by hand, or built by a studio that leaves files instead of a commit is not among them."
56907
56886
  ).option("-m, --module <name>", "only the cards tagged with that module, validated against modules.md").option("--stale", "only the cards untouched past the threshold, stalest first, with the days each has sat").option("--archived", "the cards that landed and were archived, oldest first, each with its landed commit").option(
56908
56887
  "--since <time>",
@@ -56910,6 +56889,28 @@ function buildBoardProgram(cli) {
56910
56889
  ).option("--studio <id>", "with --archived: only the cards of that studio").action(async function() {
56911
56890
  await dispatch("list", this, [], this.opts(), cli);
56912
56891
  });
56892
+ }
56893
+ function buildBoardProgram(cli) {
56894
+ const program2 = withShared(newCommand(cli.program));
56895
+ program2.description(
56896
+ "the local board and the commands an agent uses inside a run; a person never has to type one. They own a card's frontmatter \u2014 write and edit only a card's body."
56897
+ ).helpCommand("help [move]", "this list, or one move in full");
56898
+ const move = (name) => withShared(program2.command(name));
56899
+ declareBoardMoves(program2, cli);
56900
+ const asked = [];
56901
+ const inOrder = ordered(asked);
56902
+ withCreateOptions(move("create"), true).summary("write exactly one card \u2014 its fields, its body template and its index entry").description(
56903
+ 'Write exactly ONE card: allocate its id, write its frontmatter and a body template, and index it. There is no separate id-reservation mode. --blocked-by and --related take ids of existing open cards; for a group, create the root first, then create each subtask related to its id (see "Group tasks" in `akb guide add-task`). The script owns the frontmatter and writes the body scaffold; fill only the body by hand. Without --id, Cloud assigns the number in the linked project (no source task required). A failed local write can resume the same creation without making another Cloud task. Missing or invalid project links and denied access exit with code 1 using the existing error envelope. --body-file accepts a short draft or full card body. Invalid bodies fail before allocating a task or writing a card, with repair instructions. Cloud moves the card on by itself once it reaches the board: do not refine it here. Example: akb raw create --title "Add a delete command" --studio coding --body-file /tmp/delete-command.md'
56904
+ ).addOption(new Option("--recurring").hideHelp()).addOption(new Option("--cadence <cadence>").hideHelp()).option("--question <text>", "an open question; needs its --option choices", inOrder("question")).option("--option <text>", "a choice for the preceding --question", inOrder("option")).option("--recommended-option <text>", "a choice ticked to start", inOrder("recommended-option")).option("--mode <mode>", "single or multi", inOrder("mode")).option("--no-body", "write only the frontmatter").option("--body-file <path>", "read a draft or full card body from a file").option("--previews <ids>", "the Preview IDs from its Studio", collectList).addOption(new Option("--id <n>", "the number Cloud gave this card's task; for the Runner").argParser(cardId).hideHelp()).action(async function() {
56905
+ await createBoardCard(this, cli, asked);
56906
+ });
56907
+ const questionOps = [];
56908
+ withQuestionOptions(withShared(program2.command("update-questions", { hidden: true })).argument("<id>", ID, cardId).summary("edit open questions on a local card (compatibility)").description("For older Runner instructions. Use akb task update-questions.\nSee akb guide update-questions."), questionOps).action(async function(id2) {
56909
+ await dispatch("update-questions", this, [String(id2)], { ops: questionOps }, cli);
56910
+ });
56911
+ withShared(program2.command("agent-file", { hidden: true })).argument("<agent>").argument("<path>").action(async function(agent, file2) {
56912
+ await dispatch("agent-file", this, [agent, file2], this.opts(), cli);
56913
+ });
56913
56914
  move("reject").argument("<id>", ID, cardId).summary("legacy local removal; use task remove").description("Use akb task remove to remove the current task or a Cloud task. This compatibility command always removes a card from the local board.").option("--discard", "just drop it: nothing learns from it").option("--reason <text>", "why, kept on the archived card as `rejected_reason` and shown on its page").action(async function(id2) {
56914
56915
  await dispatch("reject", this, [String(id2)], this.opts(), cli);
56915
56916
  });
@@ -57063,16 +57064,19 @@ async function runBoard(argv, options = {}) {
57063
57064
  const { runProgram: runProgram2 } = await Promise.resolve().then(() => (init_shared2(), shared_exports));
57064
57065
  return runProgram2(buildBoardProgram2({ program: program2, cwd, installHint, version: version2, onAnswer }), argv, program2);
57065
57066
  }
57066
- function rawArgv(argv) {
57067
- const shared = [];
57067
+ function commandIndex(argv) {
57068
57068
  let i = 0;
57069
57069
  for (; i < argv.length; i++) {
57070
57070
  const arg = argv[i];
57071
- if (arg === "--json" || /^--(board|dir)=/.test(arg)) shared.push(arg);
57072
- else if ((arg === "--board" || arg === "--dir") && i + 1 < argv.length) shared.push(arg, argv[++i]);
57071
+ if (arg === "--json" || /^--(board|dir)=/.test(arg)) continue;
57072
+ if ((arg === "--board" || arg === "--dir") && i + 1 < argv.length) i++;
57073
57073
  else break;
57074
57074
  }
57075
- return argv[i] === "raw" ? [...shared, ...argv.slice(i + 1)] : null;
57075
+ return i;
57076
+ }
57077
+ function rawArgv(argv) {
57078
+ const i = commandIndex(argv);
57079
+ return argv[i] === "raw" ? [...argv.slice(0, i), ...argv.slice(i + 1)] : null;
57076
57080
  }
57077
57081
  function prose(box) {
57078
57082
  if (!box) return {};
@@ -57081,8 +57085,8 @@ function prose(box) {
57081
57085
  if (box.warnings.length) out.warnings = box.warnings;
57082
57086
  return out;
57083
57087
  }
57084
- function answer(object3) {
57085
- process.stdout.write(JSON.stringify(object3) + "\n");
57088
+ function answer(object2) {
57089
+ process.stdout.write(JSON.stringify(object2) + "\n");
57086
57090
  }
57087
57091
  function report(err, { program: program2, json: json2, box = null }) {
57088
57092
  if (!(err instanceof BoardError)) {
@@ -57100,7 +57104,7 @@ function report(err, { program: program2, json: json2, box = null }) {
57100
57104
  }
57101
57105
  return err.exitCode;
57102
57106
  }
57103
- var MAKES_A_BOARD, hasBoard, isBoardDir, boardFromEnv;
57107
+ var MAKES_A_BOARD, hasBoard, isBoardDir, boardFromEnv, commandWord;
57104
57108
  var init_board_cli = __esm({
57105
57109
  "../cli/src/lib/board-cli.ts"() {
57106
57110
  "use strict";
@@ -57114,6 +57118,7 @@ var init_board_cli = __esm({
57114
57118
  const named2 = process.env.AI4KANBAN_BOARD?.trim();
57115
57119
  return named2 ? named2 : null;
57116
57120
  };
57121
+ commandWord = (argv) => argv[commandIndex(argv)] ?? "";
57117
57122
  }
57118
57123
  });
57119
57124
 
@@ -58387,13 +58392,11 @@ var init_goal_cloud = __esm({
58387
58392
  });
58388
58393
 
58389
58394
  // ../cli/src/lib/agent/manual.ts
58390
- var HELP_AFTER;
58395
+ var PRINT_FLOW_HELP, HELP_AFTER;
58391
58396
  var init_manual = __esm({
58392
58397
  "../cli/src/lib/agent/manual.ts"() {
58393
58398
  "use strict";
58394
- HELP_AFTER = {
58395
- /** Under every flow: print it, or run it. The one choice each of them has. */
58396
- flow: `
58399
+ PRINT_FLOW_HELP = `
58397
58400
  Print it, or run it
58398
58401
  --print print the flow to follow in the current session, filled in for this board:
58399
58402
  the card's own path, the steps it has left, the memory file its modules point
@@ -58402,7 +58405,8 @@ Print it, or run it
58402
58405
  (no flag) start a separate session with its own context.
58403
58406
 
58404
58407
  Inside a task session, board actions print their flows. Prepare requested Previews there.
58405
- `,
58408
+ `;
58409
+ HELP_AFTER = {
58406
58410
  /** Under `delivery`: what one is, which no verb of it says on its own. */
58407
58411
  deliveries: (program2) => `
58408
58412
  What a delivery is
@@ -63078,7 +63082,7 @@ var init_add_task = __esm({
63078
63082
  var archive_default;
63079
63083
  var init_archive2 = __esm({
63080
63084
  "../cli/src/guide/archive.md"() {
63081
- archive_default = "# Finish a task\n\n## Record the outcome\n\nRecord the delivered outcome and verification on the task. Do not write independent memory.\n\n## Archive the card\n\nVerify the approved requirements and outputs. Leave unmet work unchecked and handle blockers\nthrough `akb guide implement`.\n\nFor an active delivery, run `akb raw delivery complete <id>` and follow the handoff. For Git\nprojects, supply `--commit <full-sha> --branch <target>`. If interrupted, inspect the recorded\nresult and retry the same completion.\n\nOutside an active delivery, use `akb task archive <task>`. The current Runner task archives\nlocally and synchronizes afterward. Other tasks archive in Cloud before the command returns.\nUse `akb task remove <task> [reason...]` to remove a task.\n";
63085
+ archive_default = "# Finish a task\n\n## Record the outcome\n\nRecord the delivered outcome and verification on the task. Do not write independent memory.\n\n## Archive the card\n\nVerify the approved requirements and outputs. Leave unmet work unchecked and handle blockers\nthrough `akb guide implement`.\n\nFor an active delivery, run `akb delivery complete <id>` and follow the handoff. For Git\nprojects, supply `--commit <full-sha> --branch <target>`. If interrupted, inspect the recorded\nresult and retry the same completion.\n\nOutside an active delivery, use `akb task archive <task>`. The current Runner task archives\nlocally and synchronizes afterward. Other tasks archive in Cloud before the command returns.\nUse `akb task remove <task> [reason...]` to remove a task.\n";
63082
63086
  }
63083
63087
  });
63084
63088
 
@@ -63086,7 +63090,7 @@ var init_archive2 = __esm({
63086
63090
  var board_default;
63087
63091
  var init_board3 = __esm({
63088
63092
  "../cli/src/guide/board.md"() {
63089
- board_default = "# How this board works\n\nThese rules apply to every card studio. Read them once; each studio's guide covers\nthe remaining details.\n\n## Layout\n\n```\ndocs/kanban/\n\u251C\u2500\u2500 todo/ open tasks\n\u2502 \u251C\u2500\u2500 README.md the index \u2014 read it first\n\u2502 \u2514\u2500\u2500 <id>-<slug>.md\n\u2502 one card per file; a group keeps its cards in one folder\n\u251C\u2500\u2500 rules/ `studios/<studio>.md` \u2014 Studio notes, set with `akb studio rule`\n\u2502 `<agent>.md` \u2014 project background-task instructions, set with\n\u2502 `akb studio instructions`\n\u251C\u2500\u2500 triage/ items waiting to be sorted, one file each \u2014 not cards. Only\n\u2502 \u2502 Cloud's sort or Refine idea on the web's Triage page turns one\n\u2502 \u2502 into a card; `akb raw triage check <source-id>` finds an existing one\n\u2502 \u251C\u2500\u2500 archived/ items a card was made of\n\u2502 \u251C\u2500\u2500 dismissed/ items ignored, with the reason\n\u2502 \u2514\u2500\u2500 files/ dropped-in files\n\u2514\u2500\u2500 modules.md one line per module \u2014 `akb guide module-map` writes it\n```\n\n## Task ID\n\nEvery task's id is the number at the front of its filename (`04-plan-cap-enforcement.md` \u2192\nid 4): its Cloud task's number (`WC-4`). Only Cloud assigns one.\n\n## Never hand-write a card's frontmatter\n\n`akb raw update`, `akb task update-questions` and `akb raw conflict resolve` manage a card's frontmatter,\nincluding its `previews`. Edit only the card's **body** by hand. `akb raw help`\nlists all operations; `akb raw help <move>` explains one operation.\n\n## Content conflicts\n\nFor synchronization conflicts, follow `akb guide resolve-conflict`.\n\n## Inside a board run\n\nA board run carries `KANBAN_RUN` in its environment. Never unset or bypass it (for example\n`env -u KANBAN_RUN`): when a command only prints a flow, follow the printed flow.\n\n## Group task\n\nA group lives in `todo/<id>-<slug>/`: `root.md` tracks the whole job and each subtask is its\nown card beside it; `akb guide add-task` says how to build one. The root's `## Todo` lists the\nsubtasks, one line each ending in `#<subid>`: archiving a subtask ticks its line, rejecting\none strikes it through, and resolving the last line archives the root in the same run, with\nany open question or unticked todo of its own. A board a Runner keeps leaves that close to\nCloud, which waits for the root to be queued with no step on it. A root listing no subtasks is\nonly closed by hand.\n\n## Task context\n\nContinue from the task's saved discussion, results and approved requirements. Follow explicit\nproject and Studio rules. Read relevant memory on demand; do not write memory in task runs.\n";
63093
+ board_default = "# How this board works\n\nThese rules apply to every card studio. Read them once; each studio's guide covers\nthe remaining details.\n\n## Layout\n\n```\ndocs/kanban/\n\u251C\u2500\u2500 todo/ open tasks\n\u2502 \u251C\u2500\u2500 README.md the index \u2014 read it first\n\u2502 \u2514\u2500\u2500 <id>-<slug>.md\n\u2502 one card per file; a group keeps its cards in one folder\n\u251C\u2500\u2500 rules/ `studios/<studio>.md` \u2014 Studio notes, set with `akb studio rule`\n\u2502 `<agent>.md` \u2014 project background-task instructions, set with\n\u2502 `akb studio instructions`\n\u251C\u2500\u2500 triage/ items waiting to be sorted, one file each \u2014 not cards. Only\n\u2502 \u2502 Cloud's sort or Refine idea on the web's Triage page turns one\n\u2502 \u2502 into a card; `akb triage check <source-id>` finds an existing one\n\u2502 \u251C\u2500\u2500 archived/ items a card was made of\n\u2502 \u251C\u2500\u2500 dismissed/ items ignored, with the reason\n\u2502 \u2514\u2500\u2500 files/ dropped-in files\n\u2514\u2500\u2500 modules.md one line per module \u2014 `akb guide module-map` writes it\n```\n\n## Task ID\n\nEvery task's id is the number at the front of its filename (`04-plan-cap-enforcement.md` \u2192\nid 4): its Cloud task's number (`WC-4`). Only Cloud assigns one.\n\n## Never hand-write a card's frontmatter\n\nEdit the card body directly. Use `akb task update` for card fields,\n`akb task update-questions` for questions, and `akb task review` for the review plan.\n\nFind commands with `akb help`, then read the matching subcommand's `--help`.\n\n## Content conflicts\n\nFor synchronization conflicts, follow `akb guide resolve-conflict`.\n\n## Inside a board run\n\nA board run carries `KANBAN_RUN` in its environment. Never unset or bypass it (for example\n`env -u KANBAN_RUN`): when a command only prints a flow, follow the printed flow.\n\n## Group task\n\nA group lives in `todo/<id>-<slug>/`: `root.md` tracks the whole job and each subtask is its\nown card beside it; `akb guide add-task` says how to build one. The root's `## Todo` lists the\nsubtasks, one line each ending in `#<subid>`: archiving a subtask ticks its line, rejecting\none strikes it through, and resolving the last line archives the root in the same run, with\nany open question or unticked todo of its own. A board a Runner keeps leaves that close to\nCloud, which waits for the root to be queued with no step on it. A root listing no subtasks is\nonly closed by hand.\n\n## Task context\n\nContinue from the task's saved discussion, results and approved requirements. Follow explicit\nproject and Studio rules. Read relevant memory on demand; do not write memory in task runs.\n";
63090
63094
  }
63091
63095
  });
63092
63096
 
@@ -63094,7 +63098,7 @@ var init_board3 = __esm({
63094
63098
  var card_chat_default;
63095
63099
  var init_card_chat = __esm({
63096
63100
  "../cli/src/guide/card-chat.md"() {
63097
- card_chat_default = '# Answer a card\'s conversation\n\nRead the task\u2019s review plan and work only on unlocked stages. An empty plan needs no extra approval; an undecided plan allows planning only.\n\n- **Where the task stands**: read `akb task show <id>` and `akb task review <id>`.\n- **Button labels**: name actions by their labels on the page, in the user\'s language: "Approve" or "Approve, start \u2026" (\u6279\u51C6 / \u6279\u51C6\uFF0C\u5F00\u59CB\u2026), "Resume" (\u7EED\u8DD1), "Start again" (\u91CD\u65B0\u53D1\u8D77).\n\n- **Change requirements or drafts**: when the user changes the scope, expected behavior, or draft, use `akb raw card revise <id> --print "<change>"`.\n- **Record an answer**: when the user answers an open question on the card, use `akb raw card resolve <id> --print`.\n- **Manage open questions**: when a decision needs the user\'s input, follow `akb guide update-questions` and use `akb task update-questions <task>` to edit the question list.\n- **Change card fields**: when the user changes metadata such as priority, modules, or dependencies, use `akb raw update <id>`.\n- **Previews**: prepare or revise only requested outputs, using the task-bound Studio\u2019s Preview instructions and supplied component documentation. Before changing approved output, invalidate its stage with `akb task review <id> --revise-from <stage> --revision <n>`. Preserve unrelated work.\n- **Create a separate task**: when the user asks to capture work unrelated to this card, follow `akb guide add-task`.\n- **Split this card**: when the user asks to break this card\'s outcome into subtasks, follow the group procedure in `akb guide add-task`.\n- **Change a studio**: use `akb guide update-studio` for shared Studio instructions; a correction to this card\'s draft alone stays on this card.\n- **Check card edits**: after writing a card, run `akb raw validate <id>` and fix what it reports.\n- **Anything else**: for a request this guide does not cover, read `akb help` once, then the matching command\'s `--help`.\n\nReply in plain, natural language. Do not write memory, including through any flow this conversation starts.\n\n- **Approve**: only on an explicit request, use `akb task approve <id> --stage <stage> --revision <reviewed revision>`. In a reply this commits after successful synchronization. Finish the reply without further edits or waiting. Never substitute the latest revision for the one reviewed.\n- **Change the plan**: submit a complete replacement with `akb task review <id> --file <json> --revision <n>`. It takes effect immediately. Answers to questions never approve work.\n';
63101
+ card_chat_default = '# Answer a card\'s conversation\n\nRead the task\u2019s review plan and work only on unlocked stages. An empty plan needs no extra approval; an undecided plan allows planning only.\n\n- **Where the task stands**: read `akb task show <id>` and `akb task review <id>`.\n- **Button labels**: name actions by their labels on the page, in the user\'s language: "Approve" or "Approve, start \u2026" (\u6279\u51C6 / \u6279\u51C6\uFF0C\u5F00\u59CB\u2026), "Resume" (\u7EED\u8DD1), "Start again" (\u91CD\u65B0\u53D1\u8D77).\n\n- **Change requirements or drafts**: when the user changes the scope, expected behavior, or draft, use `akb task revise <id> "<change>" --print`.\n- **Record an answer**: when the user answers an open question on the card, use `akb task resolve <id> --print`.\n- **Manage open questions**: when a decision needs the user\'s input, follow `akb guide update-questions` and use `akb task update-questions <task>` to edit the question list.\n- **Change card fields**: when the user changes metadata such as priority, modules, or dependencies, use `akb task update <id>`.\n- **Previews**: prepare or revise only requested outputs, using the task-bound Studio\u2019s Preview instructions and supplied component documentation. Before changing approved output, invalidate its stage with `akb task review <id> --revise-from <stage> --revision <n>`. Preserve unrelated work.\n- **Create a separate task**: when the user asks to capture work unrelated to this card, follow `akb guide add-task`.\n- **Split this card**: when the user asks to break this card\'s outcome into subtasks, follow the group procedure in `akb guide add-task`.\n- **Change a studio**: use `akb guide update-studio` for shared Studio instructions; a correction to this card\'s draft alone stays on this card.\n- **Check card edits**: after writing a card, run `akb task validate <id>` and fix what it reports.\n- **Anything else**: for a request this guide does not cover, read `akb help` once, then the matching command\'s `--help`.\n\nReply in plain, natural language. Do not write memory, including through any flow this conversation starts.\n\n- **Approve**: only on an explicit request, use `akb task approve <id> --stage <stage> --revision <reviewed revision>`. In a reply this commits after successful synchronization. Finish the reply without further edits or waiting. Never substitute the latest revision for the one reviewed.\n- **Change the plan**: submit a complete replacement with `akb task review <id> --file <json> --revision <n>`. It takes effect immediately. Answers to questions never approve work.\n';
63098
63102
  }
63099
63103
  });
63100
63104
 
@@ -63118,7 +63122,7 @@ var init_describe_project = __esm({
63118
63122
  var discuss_goal_default;
63119
63123
  var init_discuss_goal = __esm({
63120
63124
  "../cli/src/guide/discuss-goal.md"() {
63121
- discuss_goal_default = '# Discuss a goal\n\nResearch how the requested outcome can be achieved before defining a Goal. Explain viable approaches and key tradeoffs in the discussion, then save the requested outcome and acceptance criteria.\n\n- **Investigations**: finish checks and diagnosis here; save a change only when findings establish it. Report unverified work plainly.\n- **Goals**: save independent deliverables separately. Update existing goals rather than duplicate them.\n- **Studio**: choose the fitting installed Studio, preferring the user\'s choice; read its Additional Notes with `akb studio rule <studio>` and honor their scope.\n- **Select Previews**: read the chosen Studio\'s `STUDIO.md` with `akb raw file <studio> STUDIO.md` and linked Studio files as needed with `akb raw file <studio> <path>`. Match deliverables that need review to Studio Previews. Define a Goal Preview for a result that needs review and lacks a Studio Preview.\n- **Review** independent Previews in parallel by default. Use Studio or Goal Preview names, e.g. `--review \'Tech choices + UI design\'`. Add `->` when the next group needs the previous group\'s approvals. Verify the saved plan.\n- **Review state**: pass `--review \'\'` for no extra approval, leave the plan undecided while a decision is missing, and omit the option when keeping a saved plan.\n- **Decisions**: ask only about choices the user must make, and recommend an option.\n- **Save**: in a web discussion, use `akb goal` in the current session, including on retry. Say the goal is ready to save when the reply ends. If the command still fails, say it was not saved.\n- **Start**: the user starts each Goal from the page; its effective review arrangement governs output approval. Confirm changes to task-specific Preview definitions before making the affected output.\n- **Communication**: the remote user sees tasks and previews. Use plain words and button labels, omitting internal paths, commands and tools.\n\n## Goal format\n\nUse exactly these three fields on create and update. Include only what the user requested or confirmed.\n\nPass the one-line title separately with `--title`. Use this template for `--body-file`:\n\n```markdown\n<The requested outcome in at most 150 words.>\n\n## Done when\n\n- <A verifiable condition for the requested outcome.>\n```\n\n\n## Custom Preview definitions\n\nPass a JSON array with `--preview-definitions-file`. Use a stable ID, English and Chinese titles, and concise requirements. Omit the file to keep definitions, or pass `[]` to clear them.\n\n```json\n[{\n "id": "accessibility-report",\n "title": {"en": "Accessibility report", "zh": "\u65E0\u969C\u788D\u68C0\u67E5\u62A5\u544A"},\n "instructions": "Check keyboard navigation, visible focus and contrast. Include steps to reproduce issues."\n}]\n```\n\nUse the title in a Flow such as `--review \'UI design -> Accessibility report\'` when preparation requires an earlier approval.\n';
63125
+ discuss_goal_default = '# Discuss a goal\n\nResearch how the requested outcome can be achieved before defining a Goal. Explain viable approaches and key tradeoffs in the discussion, then save the requested outcome and acceptance criteria.\n\n- **Investigations**: finish checks and diagnosis here; save a change only when findings establish it. Report unverified work plainly.\n- **Goals**: save independent deliverables separately. Update existing goals rather than duplicate them.\n- **Studio**: choose the fitting installed Studio, preferring the user\'s choice; read its Additional Notes with `akb studio rule <studio>` and honor their scope.\n- **Select Previews**: read the chosen Studio\'s `STUDIO.md` with `akb studio file <studio> STUDIO.md` and linked Studio files as needed with `akb studio file <studio> <path>`. Match deliverables that need review to Studio Previews. Define a Goal Preview for a result that needs review and lacks a Studio Preview.\n- **Review** independent Previews in parallel by default. Use Studio or Goal Preview names, e.g. `--review \'Tech choices + UI design\'`. Add `->` when the next group needs the previous group\'s approvals. Verify the saved plan.\n- **Review state**: pass `--review \'\'` for no extra approval, leave the plan undecided while a decision is missing, and omit the option when keeping a saved plan.\n- **Decisions**: ask only about choices the user must make, and recommend an option.\n- **Save**: in a web discussion, use `akb goal` in the current session, including on retry. Say the goal is ready to save when the reply ends. If the command still fails, say it was not saved.\n- **Start**: the user starts each Goal from the page; its effective review arrangement governs output approval. Confirm changes to task-specific Preview definitions before making the affected output.\n- **Communication**: the remote user sees tasks and previews. Use plain words and button labels, omitting internal paths, commands and tools.\n\n## Goal format\n\nUse exactly these three fields on create and update. Include only what the user requested or confirmed.\n\nPass the one-line title separately with `--title`. Use this template for `--body-file`:\n\n```markdown\n<The requested outcome in at most 150 words.>\n\n## Done when\n\n- <A verifiable condition for the requested outcome.>\n```\n\n\n## Custom Preview definitions\n\nPass a JSON array with `--preview-definitions-file`. Use a stable ID, English and Chinese titles, and concise requirements. Omit the file to keep definitions, or pass `[]` to clear them.\n\n```json\n[{\n "id": "accessibility-report",\n "title": {"en": "Accessibility report", "zh": "\u65E0\u969C\u788D\u68C0\u67E5\u62A5\u544A"},\n "instructions": "Check keyboard navigation, visible focus and contrast. Include steps to reproduce issues."\n}]\n```\n\nUse the title in a Flow such as `--review \'UI design -> Accessibility report\'` when preparation requires an earlier approval.\n';
63122
63126
  }
63123
63127
  });
63124
63128
 
@@ -63126,7 +63130,7 @@ var init_discuss_goal = __esm({
63126
63130
  var follow_up_default;
63127
63131
  var init_follow_up = __esm({
63128
63132
  "../cli/src/guide/follow-up.md"() {
63129
- follow_up_default = '# Handle follow-up work\n\nUse when planning or implementation discovers additional work.\n\n- **Current task**: finish required work on this card; queue independent follow-ups in triage, then resume the original task.\n- **Drop what was turned down**: queue nothing that\n `docs/kanban/memory/agents/planner/rejected.md` or\n `docs/kanban/memory/agents/planner/*/rejected.md` turns down.\n- **Existing card**: when only another open card needs changing, run `akb raw card revise <id> "<the change and why>"`.\n- **Queue it**: use the command below; skip an item the command reports as already there.\n- **Studio**: use the source card\'s `studio:`, or the id from `akb studio list` that fits the work when it has none.\n\n```text\nakb raw triage add --title "<one line>" --slug <short-english-slug> --source "#<id>" --studio <studio> --text "<body>"\n```\n\n## Write the item\n\nWrite each item\'s title and body in the **Goal format** of `akb guide discuss-goal`.\n';
63133
+ follow_up_default = '# Handle follow-up work\n\nUse when planning or implementation discovers additional work.\n\n- **Current task**: finish required work on this card; queue independent follow-ups in triage, then resume the original task.\n- **Drop what was turned down**: queue nothing that\n `docs/kanban/memory/agents/planner/rejected.md` or\n `docs/kanban/memory/agents/planner/*/rejected.md` turns down.\n- **Existing card**: when only another open card needs changing, run `akb task revise <id> "<the change and why>"`.\n- **Queue it**: use the command below; skip an item the command reports as already there.\n- **Studio**: use the source card\'s `studio:`, or the id from `akb studio list` that fits the work when it has none.\n\n```text\nakb triage add --title "<one line>" --slug <short-english-slug> --source "#<id>" --studio <studio> --text "<body>"\n```\n\n## Write the item\n\nWrite each item\'s title and body in the **Goal format** of `akb guide discuss-goal`.\n';
63130
63134
  }
63131
63135
  });
63132
63136
 
@@ -63142,7 +63146,7 @@ var init_implement = __esm({
63142
63146
  var module_map_default;
63143
63147
  var init_module_map = __esm({
63144
63148
  "../cli/src/guide/module-map.md"() {
63145
- module_map_default = "# The module map\n\nWrite and repair `docs/kanban/modules.md` \u2014 a plain list of the project's modules.\n\nA module is a part of the project developed independently of other parts. Modules may\nshare folders. Keep a single-purpose project as one module; before code exists, define\nseparate modules only for parts the plan explicitly treats as independent.\n\n## Examples\n\nA repo with `server/`, `packages/core/`, `web/`, `cli/`, and `docs/` might map to:\n\n```\n- **api** \u2014 the backend server and its shared core. `server/`, `packages/core/`.\n- **web-app** \u2014 the browser app users sign into. `web/`.\n- **cli** \u2014 the command-line client. `cli/`.\n- **docs** \u2014 the public documentation site. `docs/`.\n```\n\nThe server and core change together, so they share one module.\n\n## Repair\n\n- **Update the map**: Correct outdated entries. Split a module when the code or plans show\n that it now contains independently developed parts, even if its description still covers\n them. If the user reports an incorrect map, rebuild it from the current code and plans.\n- **Update cards and memory**: After changing modules, update affected open cards with\n `akb raw update <id> --modules <names>`. Follow the section below when splitting memory.\n\n## Split module memory\n\nA module's planning memory is its folder, `docs/kanban/memory/agents/planner/<module>/`. Create\nthe new module's folder and move into each of its files the entries that belong to it. Split\nentries that cover both; keep shared rules with the module responsible for them. Rename the\nfolder when a module is renamed, and fold its files into the folder that inherits the work when\none is removed. A module may not be named `decisions`, `rejected` or `redesign`.\n";
63149
+ module_map_default = "# The module map\n\nWrite and repair `docs/kanban/modules.md` \u2014 a plain list of the project's modules.\n\nA module is a part of the project developed independently of other parts. Modules may\nshare folders. Keep a single-purpose project as one module; before code exists, define\nseparate modules only for parts the plan explicitly treats as independent.\n\n## Examples\n\nA repo with `server/`, `packages/core/`, `web/`, `cli/`, and `docs/` might map to:\n\n```\n- **api** \u2014 the backend server and its shared core. `server/`, `packages/core/`.\n- **web-app** \u2014 the browser app users sign into. `web/`.\n- **cli** \u2014 the command-line client. `cli/`.\n- **docs** \u2014 the public documentation site. `docs/`.\n```\n\nThe server and core change together, so they share one module.\n\n## Repair\n\n- **Update the map**: Correct outdated entries. Split a module when the code or plans show\n that it now contains independently developed parts, even if its description still covers\n them. If the user reports an incorrect map, rebuild it from the current code and plans.\n- **Update cards and memory**: After changing modules, update affected open cards with\n `akb task update <id> --modules <names>`. Follow the section below when splitting memory.\n\n## Split module memory\n\nA module's planning memory is its folder, `docs/kanban/memory/agents/planner/<module>/`. Create\nthe new module's folder and move into each of its files the entries that belong to it. Split\nentries that cover both; keep shared rules with the module responsible for them. Rename the\nfolder when a module is renamed, and fold its files into the folder that inherits the work when\none is removed. A module may not be named `decisions`, `rejected` or `redesign`.\n";
63146
63150
  }
63147
63151
  });
63148
63152
 
@@ -63158,7 +63162,7 @@ var init_prune_memory = __esm({
63158
63162
  var review_memory_default;
63159
63163
  var init_review_memory = __esm({
63160
63164
  "../cli/src/guide/review-memory.md"() {
63161
- review_memory_default = "# Review what the conversations settled\n\nRead each conversation given to you right through, then write what it settled into memory.\n\nChats and planning flows write no memory themselves. One turn cannot see where an exchange\nis going, so a \"what if\" thrown out and taken back three turns later used to land as a\ndecision. You read the whole exchange, so you can tell a decision from a passing thought \u2014\nand that judgement is the whole job.\n\n- **Read what you are given**: each card comes in its own `<conversation>` block: its summary,\n its `Worth noting` and `Overruled by the user` lines, then its chat and the comments the user\n left reviewing it, when it had any, the user's words as written and the agent's replies,\n oldest first. The card is archived, so it is complete and reviewed this once; open no card or\n transcript file.\n- **Keep them apart**: judge each block by itself; what one conversation settled never\n becomes a note for another's card or Studio.\n- **Keep a high bar**: a conversation that settled nothing earns no note, and most do not;\n writing nothing is a complete result.\n- **Only what the user settled**: a durable preference, constraint, decision or correction\n they stated. Your own proposal is not their decision, and neither is a question, a \"what\n if\", or a direction the conversation then moved off.\n- **Take the last word**: where they said one thing and then another, the later one stands.\n Where a note already in the file says what they have since overturned, rewrite that note in\n place \u2014 never leave both and never add a second.\n- **Honour \"don't record this\"**: told in the conversation not to record something, write no\n note for it. If one is already there from an earlier review, delete it now.\n- **Where it goes**: a durable choice goes in the planner's `decisions.md` as one\n `**<key>**: <call>` line under the topic that fits, without its rationale; a design lesson\n goes in its `redesign.md` under the relevant topic as\n `- \u274C **<mistake>** \u2192 \u2705 <what the design should be instead, one line>.`, written as guidance\n for future tasks, not a history of the fix. Both go in the folder of the module each\n conversation is listed with. Each conversation names its `studio` and\n involved `previews`. Read `akb raw file <studio> STUDIO.md`; when it has a memory policy,\n follow it for settled feedback on the affected Previews, preserving its scopes. Without a\n Preview memory policy, create no Preview memory; retain planner/module memory duties.\n Distill settled feedback into reusable preferences (dos) and corrections (don'ts), retaining\n their scope; never copy raw reviews.\n- **What the card settled**: the summary says what the card was about and earns no note. A\n `Worth noting` line is a decision the user approved, by answering it or letting it stand, so\n it can be a choice but never a correction, and it earns a planner note only where the user's\n own words in the conversation back it; a line under\n `Overruled by the user` is a call the user reversed, so it goes in `redesign.md`: the relevant\n Preview's when its Studio policy provides for it, otherwise the planner's.\n- **Change nothing else**: no card, no open question, no code. The memory\n files are the whole of what this run writes.\n- **Say what you wrote**: finish by reporting each conversation you read, and for each the\n notes you added, rewrote, deleted, or that you wrote none.\n";
63165
+ review_memory_default = "# Review what the conversations settled\n\nRead each conversation given to you right through, then write what it settled into memory.\n\nChats and planning flows write no memory themselves. One turn cannot see where an exchange\nis going, so a \"what if\" thrown out and taken back three turns later used to land as a\ndecision. You read the whole exchange, so you can tell a decision from a passing thought \u2014\nand that judgement is the whole job.\n\n- **Read what you are given**: each card comes in its own `<conversation>` block: its summary,\n its `Worth noting` and `Overruled by the user` lines, then its chat and the comments the user\n left reviewing it, when it had any, the user's words as written and the agent's replies,\n oldest first. The card is archived, so it is complete and reviewed this once; open no card or\n transcript file.\n- **Keep them apart**: judge each block by itself; what one conversation settled never\n becomes a note for another's card or Studio.\n- **Keep a high bar**: a conversation that settled nothing earns no note, and most do not;\n writing nothing is a complete result.\n- **Only what the user settled**: a durable preference, constraint, decision or correction\n they stated. Your own proposal is not their decision, and neither is a question, a \"what\n if\", or a direction the conversation then moved off.\n- **Take the last word**: where they said one thing and then another, the later one stands.\n Where a note already in the file says what they have since overturned, rewrite that note in\n place \u2014 never leave both and never add a second.\n- **Honour \"don't record this\"**: told in the conversation not to record something, write no\n note for it. If one is already there from an earlier review, delete it now.\n- **Where it goes**: a durable choice goes in the planner's `decisions.md` as one\n `**<key>**: <call>` line under the topic that fits, without its rationale; a design lesson\n goes in its `redesign.md` under the relevant topic as\n `- \u274C **<mistake>** \u2192 \u2705 <what the design should be instead, one line>.`, written as guidance\n for future tasks, not a history of the fix. Both go in the folder of the module each\n conversation is listed with. Each conversation names its `studio` and\n involved `previews`. Read `akb studio file <studio> STUDIO.md`; when it has a memory policy,\n follow it for settled feedback on the affected Previews, preserving its scopes. Without a\n Preview memory policy, create no Preview memory; retain planner/module memory duties.\n Distill settled feedback into reusable preferences (dos) and corrections (don'ts), retaining\n their scope; never copy raw reviews.\n- **What the card settled**: the summary says what the card was about and earns no note. A\n `Worth noting` line is a decision the user approved, by answering it or letting it stand, so\n it can be a choice but never a correction, and it earns a planner note only where the user's\n own words in the conversation back it; a line under\n `Overruled by the user` is a call the user reversed, so it goes in `redesign.md`: the relevant\n Preview's when its Studio policy provides for it, otherwise the planner's.\n- **Change nothing else**: no card, no open question, no code. The memory\n files are the whole of what this run writes.\n- **Say what you wrote**: finish by reporting each conversation you read, and for each the\n notes you added, rewrote, deleted, or that you wrote none.\n";
63162
63166
  }
63163
63167
  });
63164
63168
 
@@ -63174,7 +63178,7 @@ var init_review_rejections = __esm({
63174
63178
  var refine_default;
63175
63179
  var init_refine = __esm({
63176
63180
  "../cli/src/guide/refine.md"() {
63177
- refine_default = "# Refine a card\n\nPlan one card until it is buildable.\n\n- **Unchecked cards**: check cards with `triage:` and empty `## Scope` against the project, rejecting obsolete or completed work with `akb task remove <id> \"<evidence>\"` and stopping.\n- **Other obsolete or completed cards**: ask whether to discard, run no previews, and stop.\n- **Groups**: preserve subtask coverage and progress, fill gaps without duplication, and do not mark the parent ready merely because its split is complete.\n- **Verification**: plan representative checks for the outcome, project rules and material risks, confirm prerequisites, and keep optional coverage optional.\n- **Review**: read `akb task review <id>`. If undecided, submit `--review <flow>` with Preview names or `--file <json>` with Preview IDs, plus `--revision <n>`. Use `--review ''` when no extra review is needed. Work only on dispatched, unlocked nodes and continue independent work during review.\n- **Preview selection**: choose Studio Previews for drafts or results that need review. For a requested result the Studio lacks, attach its definition with `--preview-definitions-file`. Keep task context in the card body.\n- **Previews**: prepare only the unlocked nodes\u2019 outputs per the Studio\u2019s `<Preview>` blocks. Before revising an approved output, use `--revise-from <stage> --revision <n>`; preserve unrelated outputs and approvals.\n- **Submit**: synchronize body and assets, then report `--stage <id> --status done --revision <n>`. Re-read after conflicts; obtain output approval at the required stages.\n- **Delivery**: the Studio's delivery flow handles separate implementation and its checks.\n- **References**: rewrite mentions of cards no longer on the board.\n- **Decisions**: settle choices supported by evidence and ask only as `akb guide update-questions` allows.\n- **Card**: follow studio rules and `akb guide writing`, fixing all errors from `akb raw validate <id>`.\n- **Ready**: when validated and buildable with prerequisites settled, run `akb raw update <id> --status ready`; otherwise leave blockers as open questions.\n\nFollow the printed closing steps. Wait only for required approvals; completion still requires Studio delivery checks.\n";
63181
+ refine_default = "# Refine a card\n\nPlan one card until it is buildable.\n\n- **Unchecked cards**: check cards with `triage:` and empty `## Scope` against the project, rejecting obsolete or completed work with `akb task remove <id> \"<evidence>\"` and stopping.\n- **Other obsolete or completed cards**: ask whether to discard, run no previews, and stop.\n- **Groups**: preserve subtask coverage and progress, fill gaps without duplication, and do not mark the parent ready merely because its split is complete.\n- **Verification**: plan representative checks for the outcome, project rules and material risks, confirm prerequisites, and keep optional coverage optional.\n- **Review**: read `akb task review <id>`. If undecided, submit `--review <flow>` with Preview names or `--file <json>` with Preview IDs, plus `--revision <n>`. Use `--review ''` when no extra review is needed. Work only on dispatched, unlocked nodes and continue independent work during review.\n- **Preview selection**: choose Studio Previews for drafts or results that need review. For a requested result the Studio lacks, attach its definition with `--preview-definitions-file`. Keep task context in the card body.\n- **Previews**: prepare only the unlocked nodes\u2019 outputs per the Studio\u2019s `<Preview>` blocks. Before revising an approved output, use `--revise-from <stage> --revision <n>`; preserve unrelated outputs and approvals.\n- **Submit**: synchronize body and assets, then report `--stage <id> --status done --revision <n>`. Re-read after conflicts; obtain output approval at the required stages.\n- **Delivery**: the Studio's delivery flow handles separate implementation and its checks.\n- **References**: rewrite mentions of cards no longer on the board.\n- **Decisions**: settle choices supported by evidence and ask only as `akb guide update-questions` allows.\n- **Card**: follow studio rules and `akb guide writing`, fixing all errors from `akb task validate <id>`.\n- **Ready**: when validated and buildable with prerequisites settled, run `akb task update <id> --status ready`; otherwise leave blockers as open questions.\n\nFollow the printed closing steps. Wait only for required approvals; completion still requires Studio delivery checks.\n";
63178
63182
  }
63179
63183
  });
63180
63184
 
@@ -63182,7 +63186,7 @@ var init_refine = __esm({
63182
63186
  var reflect_default;
63183
63187
  var init_reflect = __esm({
63184
63188
  "../cli/src/guide/reflect.md"() {
63185
- reflect_default = '# Reflect on completed cards\n\n## Read\n\nRead each given `<card>` in full and check its own `shipped` content; keep cards separate.\nFind needs the work left behind or revealed, and verify them in the project. Proposing nothing is fine.\n\n## Filter\n\n- **Duplicates**: check `akb raw list` and `akb raw triage check <source-id>`; propose shared work only once.\n- **Exclude**: skip unsupported guesses, work rejected in `docs/kanban/memory/agents/planner/rejected.md` or its module folders, and calls the user reversed, in any `redesign.md` under `docs/kanban/memory/agents/` or under a card\'s `Overruled by the user`.\n- **Existing cards**: when shipped work invalidates an open card\'s plan, run `akb raw card revise <id> "<the change and why>"` instead of proposing an item.\n\n## Write\n\nWrite each item\'s title and body in the **Goal format** of `akb guide discuss-goal`; write the body to a temporary Markdown file and end it with the source card\'s archive path.\nWrite one triage item per proposal. Exploratory ideas are welcome; identify small chores as such.\nUse the source card\'s `studio:`, or the id from `akb studio list` that fits the work when it has none.\n\n```text\nakb raw triage add --title "<one line>" --slug <short-english-slug> --source "#<id>" --studio <studio> --file <body.md>\n```\n\nBriefly report what you proposed and what you skipped, with reasons.\n';
63189
+ reflect_default = '# Reflect on completed cards\n\n## Read\n\nRead each given `<card>` in full and check its own `shipped` content; keep cards separate.\nFind needs the work left behind or revealed, and verify them in the project. Proposing nothing is fine.\n\n## Filter\n\n- **Duplicates**: check `akb board list` and `akb triage check <source-id>`; propose shared work only once.\n- **Exclude**: skip unsupported guesses, work rejected in `docs/kanban/memory/agents/planner/rejected.md` or its module folders, and calls the user reversed, in any `redesign.md` under `docs/kanban/memory/agents/` or under a card\'s `Overruled by the user`.\n- **Existing cards**: when shipped work invalidates an open card\'s plan, run `akb task revise <id> "<the change and why>"` instead of proposing an item.\n\n## Write\n\nWrite each item\'s title and body in the **Goal format** of `akb guide discuss-goal`; write the body to a temporary Markdown file and end it with the source card\'s archive path.\nWrite one triage item per proposal. Exploratory ideas are welcome; identify small chores as such.\nUse the source card\'s `studio:`, or the id from `akb studio list` that fits the work when it has none.\n\n```text\nakb triage add --title "<one line>" --slug <short-english-slug> --source "#<id>" --studio <studio> --file <body.md>\n```\n\nBriefly report what you proposed and what you skipped, with reasons.\n';
63186
63190
  }
63187
63191
  });
63188
63192
 
@@ -63190,7 +63194,7 @@ var init_reflect = __esm({
63190
63194
  var resolve_default;
63191
63195
  var init_resolve2 = __esm({
63192
63196
  "../cli/src/guide/resolve.md"() {
63193
- resolve_default = '# Resolve questions\n\nApply the answers the user supplied to existing open questions. Leave every unanswered\nquestion unchanged. While applying answers, do not research, choose for the user, raise\nanother question, or change project code.\n\n## Apply each answer\n\n1. Match each supplied answer to its open question. If the answer is missing or unclear,\n leave that question open.\n2. Follow `akb guide writing`. Merge the answer into the existing decision, keep only the\n selected choice, remove obsolete or contradictory text, preserve completed work, and add\n newly required work as unchecked todos. When the answer changes an agent\'s section, read\n that agent\'s rules first, as "Preview ownership" there says.\n\nWhen an answer accepts a step the user was asked to review and asks for no changes, tick that\nstep\'s review todo; an answer asking for changes leaves it unticked.\n\nWhen an answer chooses to discard the card, first run `akb raw delivery cancel <delivery>` if a\ndelivery is in flight, then `akb task remove <id> "<why>" --discard`, and stop. Skip every\nremaining step of this guide.\n\nWhen an answer sends an agent\'s (`agent:`) section back for rework that the user must confirm\nagain, keep or `--update` the question instead of dropping it. Once no question is left for\nthat agent, request each matching agent listed below it whose section is missing or says it\nis waiting.\n\nWhen an answer selects one of several options in a Preview block, remove the rejected\noptions and their spec-tmp files.\n\n## Say what the answers did to a build in flight\n\nA delivery builds the card as it was approved when it started, and applying answers is the\nonly thing that rewrites that card underneath it. You read the question and you wrote the\nanswer, so you are the only one who can tell a confirmation from a change \u2014 the board reads\nyour conclusion and never the card\'s text.\n\n```text\nakb raw delivery answered <delivery> --unchanged "<why>"\nakb raw delivery answered <delivery> --changed "<why>"\n```\n\n- **Record it before you drop the questions**: dropping the last one is what puts the board\n back in motion, and until the conclusion is written the build does not land.\n- **Judge the meaning, not the words**: confirming an option that is already built, writing\n down a decision the card already carries, and tidying prose are all `--unchanged`.\n Adding, dropping or changing a requirement is `--changed`.\n- **A wrong implementation confirmed is still a change**: an answer that blesses work\n contradicting the approved copy is `--changed`, however finished that work is.\n- **One conclusion per round**: it covers every answer you applied in this session. The\n delivery a `--changed` reopens starts on the card as it then reads, with none of its own.\n\n`akb raw card implement <id> --print` prints the delivery\'s id and the copy it is building.\nNothing to record when no delivery is in flight.\n\n## Curate the human half\n\nPut each answer `akb guide writing` places in `Worth noting` in that section; put other\nnecessary lasting decisions below the boundary.\n\nRe-read the whole human half against the same rule. Remove or move down entries that\nfail it, repeat scope, or overlap another entry. Merge entries governed by one decision. One to\nthree independent items is normal; every additional item needs distinct user-facing stakes.\n\n## Close the answered questions\n\nSave the body and any delivery conclusion first. Drop only the questions whose answers\nare fully applied. Runner synchronizes the updated body and question list together.\n\n```text\nakb task update-questions <task> --drop <n[,n...]>\n```\n\n## Refine\n\nIf any question remains open, stop and leave the card waiting. When a delivery is in flight,\nnever refine \u2014 even if `--changed` updated requirements, execution resumes directly from the\nupdated card.\n\nOnce no question is left and no delivery is building the card, refine it in this session by\n`akb guide refine`, which decides readiness:\n\n- **Partial**: when the card was refined before, revisit only what the answers changed.\n- **Full**: when the answers reshape the card or its `## Scope` is still the creation scaffold.\n';
63197
+ resolve_default = '# Resolve questions\n\nApply the answers the user supplied to existing open questions. Leave every unanswered\nquestion unchanged. While applying answers, do not research, choose for the user, raise\nanother question, or change project code.\n\n## Apply each answer\n\n1. Match each supplied answer to its open question. If the answer is missing or unclear,\n leave that question open.\n2. Follow `akb guide writing`. Merge the answer into the existing decision, keep only the\n selected choice, remove obsolete or contradictory text, preserve completed work, and add\n newly required work as unchecked todos. When the answer changes an agent\'s section, read\n that agent\'s rules first, as "Preview ownership" there says.\n\nWhen an answer accepts a step the user was asked to review and asks for no changes, tick that\nstep\'s review todo; an answer asking for changes leaves it unticked.\n\nWhen an answer chooses to discard the card, first run `akb delivery cancel <delivery>` if a\ndelivery is in flight, then `akb task remove <id> "<why>" --discard`, and stop. Skip every\nremaining step of this guide.\n\nWhen an answer sends an agent\'s (`agent:`) section back for rework that the user must confirm\nagain, keep or `--update` the question instead of dropping it. Once no question is left for\nthat agent, request each matching agent listed below it whose section is missing or says it\nis waiting.\n\nWhen an answer selects one of several options in a Preview block, remove the rejected\noptions and their spec-tmp files.\n\n## Say what the answers did to a build in flight\n\nA delivery builds the card as it was approved when it started, and applying answers is the\nonly thing that rewrites that card underneath it. You read the question and you wrote the\nanswer, so you are the only one who can tell a confirmation from a change \u2014 the board reads\nyour conclusion and never the card\'s text.\n\n```text\nakb delivery answered <delivery> --unchanged "<why>"\nakb delivery answered <delivery> --changed "<why>"\n```\n\n- **Record it before you drop the questions**: dropping the last one is what puts the board\n back in motion, and until the conclusion is written the build does not land.\n- **Judge the meaning, not the words**: confirming an option that is already built, writing\n down a decision the card already carries, and tidying prose are all `--unchanged`.\n Adding, dropping or changing a requirement is `--changed`.\n- **A wrong implementation confirmed is still a change**: an answer that blesses work\n contradicting the approved copy is `--changed`, however finished that work is.\n- **One conclusion per round**: it covers every answer you applied in this session. The\n delivery a `--changed` reopens starts on the card as it then reads, with none of its own.\n\n`akb task implement <id> --print` prints the delivery\'s id and the copy it is building.\nNothing to record when no delivery is in flight.\n\n## Curate the human half\n\nPut each answer `akb guide writing` places in `Worth noting` in that section; put other\nnecessary lasting decisions below the boundary.\n\nRe-read the whole human half against the same rule. Remove or move down entries that\nfail it, repeat scope, or overlap another entry. Merge entries governed by one decision. One to\nthree independent items is normal; every additional item needs distinct user-facing stakes.\n\n## Close the answered questions\n\nSave the body and any delivery conclusion first. Drop only the questions whose answers\nare fully applied. Runner synchronizes the updated body and question list together.\n\n```text\nakb task update-questions <task> --drop <n[,n...]>\n```\n\n## Refine\n\nIf any question remains open, stop and leave the card waiting. When a delivery is in flight,\nnever refine \u2014 even if `--changed` updated requirements, execution resumes directly from the\nupdated card.\n\nOnce no question is left and no delivery is building the card, refine it in this session by\n`akb guide refine`, which decides readiness:\n\n- **Partial**: when the card was refined before, revisit only what the answers changed.\n- **Full**: when the answers reshape the card or its `## Scope` is still the creation scaffold.\n';
63194
63198
  }
63195
63199
  });
63196
63200
 
@@ -63198,7 +63202,7 @@ var init_resolve2 = __esm({
63198
63202
  var resolve_conflict_default;
63199
63203
  var init_resolve_conflict = __esm({
63200
63204
  "../cli/src/guide/resolve-conflict.md"() {
63201
- resolve_conflict_default = "# Resolve board content conflicts\n\n- **Read**: use `akb raw conflict list`, then `akb raw conflict show <id>` to read the saved three-way versions, current local work and affected batch; follow the files' ownership rules.\n- **Decide**: reconcile the intended meaning using the task and relevant decisions; use `akb guide update-questions` only for a material choice the evidence cannot settle.\n- **Submit**: write a temporary JSON resolution with one `path` and final `content` for each conflicting file, using `null` for deletion, then run `akb raw conflict resolve <id> --expect <revision> --file <path>` with the revision just read.\n- **Changed facts**: if the command reports changed versions, read the conflict again and reconsider the result; do not refresh away local work or blindly repeat the old resolution.\n- **Continue**: after confirmed synchronization, continue the original work.\n- **Blocked**: when you cannot resolve a conflict or confirm its submission, preserve the content, draft, ID, reason and next check; report the obstacle without claiming success, and honor a user stop.\n";
63205
+ resolve_conflict_default = "# Resolve board content conflicts\n\n- **Read**: use `akb board conflict list`, then `akb board conflict show <id>` to read the saved three-way versions, current local work and affected batch; follow the files' ownership rules.\n- **Decide**: reconcile the intended meaning using the task and relevant decisions; use `akb guide update-questions` only for a material choice the evidence cannot settle.\n- **Submit**: write a temporary JSON resolution with one `path` and final `content` for each conflicting file, using `null` for deletion, then run `akb board conflict resolve <id> --expect <revision> --file <path>` with the revision just read.\n- **Changed facts**: if the command reports changed versions, read the conflict again and reconsider the result; do not refresh away local work or blindly repeat the old resolution.\n- **Continue**: after confirmed synchronization, continue the original work.\n- **Blocked**: when you cannot resolve a conflict or confirm its submission, preserve the content, draft, ID, reason and next check; report the obstacle without claiming success, and honor a user stop.\n";
63202
63206
  }
63203
63207
  });
63204
63208
 
@@ -63230,7 +63234,7 @@ var init_troubleshoot = __esm({
63230
63234
  var write_agent_default;
63231
63235
  var init_write_agent = __esm({
63232
63236
  "../cli/src/guide/write-agent.md"() {
63233
- write_agent_default = "# Studio instructions\n\nDefine Studio work in `STUDIO.md`, with optional Preview blocks and matching display metadata.\nRead `akb guide update-studio` to create or revise a Studio. Studio outputs have no `AGENT.md`\nor separate role configuration. Validate the complete folder with `akb raw studio validate`.\n";
63237
+ write_agent_default = "# Studio instructions\n\nDefine Studio work in `STUDIO.md`, with optional Preview blocks and matching display metadata.\nRead `akb guide update-studio` to create or revise a Studio. Studio outputs have no `AGENT.md`\nor separate role configuration. Validate the complete folder with `akb studio validate <folder>`.\n";
63234
63238
  }
63235
63239
  });
63236
63240
 
@@ -63246,7 +63250,7 @@ var init_write_prompt = __esm({
63246
63250
  var writing_default;
63247
63251
  var init_writing = __esm({
63248
63252
  "../cli/src/guide/writing.md"() {
63249
- writing_default = '# Write a card\n\nA card has a **human half** for review and a folded **agent half** for implementation.\nUse this order and keep the English section titles and empty scaffold sections:\n\n```text\n<One short paragraph: the problem and the intended result.>\n\n## Worth noting <- user\'s answers first, then material decisions; empty if none\n- **<decision>**: <chosen behavior and main cost in one sentence>\n\n## Worth noting after implementation\n- **<decision>**: <chosen behavior and main cost in one sentence>\n <- settled by the build; omit when empty; no logs or open questions\n\n<Preview id="<id>"> <- requested deliverable\n<result Markdown and assets>\n</Preview>\n\n<!-- agent --> <- folded content starts here\n\n## Scope <- requirements, not rationale\n### Done when <- acceptance checklist, when supplied\n- [ ] <observable result>\n\n## Todo <- implementation only; finish planning before writing steps\n- [ ] <one build step>\n\n## Decided by the agent <- other decisions and non-obvious findings the build needs\n- **<decision>**: <answer and required action>\n### Overruled by the user <- superseded decisions, always last\n```\n\n- **Decisions**: use the material-decision test in `akb guide update-questions` for Worth noting;\n merge entries governed by one policy and keep only the decision and its main cost.\n- **Delivery boundary**: Worth noting after implementation never changes approved scope or\n blocks an ongoing delivery; the build must fix deviations or refer them to the user.\n- **Preview sections**: use matching Preview tags and a stable Studio ID; keep the ID when revising.\n The app supplies localized titles and icons. Group files of one deliverable with Set.\n- **Previews**: read the relevant Studio `<Preview>` block and needed references before revising\n its section and assets in place.\n- **Preview presentation**: at every review point, show the deliverable directly; omit surrounding\n introductions, summaries and notes unless requested or needed for review, keeping necessary\n context brief and stating it once.\n- **Preserve work**: leave checked todos and supplied Done when checklists unchanged; append a\n todo to reverse completed work, and move user-overruled decisions to Overruled by the user\n until the card leaves no room to repeat them.\n- **Writing**: write clear behavior and necessary tradeoffs for a fresh reader, keep the human\n half self-contained, and state each fact once.\n- **Agent half**: keep only implementation-critical information not stated elsewhere; omit\n process logs and routine implementation planning, and leave unneeded sections empty.\n- **Frontmatter**: never edit frontmatter by hand; use `akb raw update` or `akb task update-questions`.\n- **Validate**: run `akb raw validate <id>` after edits and fix every reported file and line.\n';
63253
+ writing_default = '# Write a card\n\nA card has a **human half** for review and a folded **agent half** for implementation.\nUse this order and keep the English section titles and empty scaffold sections:\n\n```text\n<One short paragraph: the problem and the intended result.>\n\n## Worth noting <- user\'s answers first, then material decisions; empty if none\n- **<decision>**: <chosen behavior and main cost in one sentence>\n\n## Worth noting after implementation\n- **<decision>**: <chosen behavior and main cost in one sentence>\n <- settled by the build; omit when empty; no logs or open questions\n\n<Preview id="<id>"> <- requested deliverable\n<result Markdown and assets>\n</Preview>\n\n<!-- agent --> <- folded content starts here\n\n## Scope <- requirements, not rationale\n### Done when <- acceptance checklist, when supplied\n- [ ] <observable result>\n\n## Todo <- implementation only; finish planning before writing steps\n- [ ] <one build step>\n\n## Decided by the agent <- other decisions and non-obvious findings the build needs\n- **<decision>**: <answer and required action>\n### Overruled by the user <- superseded decisions, always last\n```\n\n- **Decisions**: use the material-decision test in `akb guide update-questions` for Worth noting;\n merge entries governed by one policy and keep only the decision and its main cost.\n- **Delivery boundary**: Worth noting after implementation never changes approved scope or\n blocks an ongoing delivery; the build must fix deviations or refer them to the user.\n- **Preview sections**: use matching Preview tags and a stable Studio ID; keep the ID when revising.\n The app supplies localized titles and icons. Group files of one deliverable with Set.\n- **Previews**: read the relevant Studio `<Preview>` block and needed references before revising\n its section and assets in place.\n- **Preview presentation**: at every review point, show the deliverable directly; omit surrounding\n introductions, summaries and notes unless requested or needed for review, keeping necessary\n context brief and stating it once.\n- **Preserve work**: leave checked todos and supplied Done when checklists unchanged; append a\n todo to reverse completed work, and move user-overruled decisions to Overruled by the user\n until the card leaves no room to repeat them.\n- **Writing**: write clear behavior and necessary tradeoffs for a fresh reader, keep the human\n half self-contained, and state each fact once.\n- **Agent half**: keep only implementation-critical information not stated elsewhere; omit\n process logs and routine implementation planning, and leave unneeded sections empty.\n- **Frontmatter**: never edit frontmatter by hand; use `akb task update` or `akb task update-questions`.\n- **Validate**: run `akb task validate <id>` after edits and fix every reported file and line.\n';
63250
63254
  }
63251
63255
  });
63252
63256
 
@@ -63375,7 +63379,7 @@ function cmdStudioList() {
63375
63379
  return result;
63376
63380
  }
63377
63381
  function cmdStudioDiagram(_id, _card, _folder) {
63378
- die("Studios have no agent graph. Read STUDIO.md for instructions and Preview outputs.", "bad-args");
63382
+ die("Freeze a Studio draft with akb studio preview <card> --folder <draft> --base <baseline>.", "bad-args");
63379
63383
  }
63380
63384
  function cmdStudioValidate(folder2) {
63381
63385
  const dir = path76.resolve(folder2);
@@ -63424,6 +63428,11 @@ function publicationFiles(dir) {
63424
63428
  return checked.files;
63425
63429
  }
63426
63430
  async function publishFolder(dir, route2, body, requestId) {
63431
+ const context = taskReviewContext();
63432
+ const task = workspaceTask();
63433
+ if (task && context && reviewAllows(reviewAuthorization(context.review, context.assigned), "implement")) {
63434
+ body = { ...body, source_task: task };
63435
+ }
63427
63436
  const pendingFile = path76.join(dir, ".publication.json");
63428
63437
  const hash3 = crypto7.createHash("sha256").update(JSON.stringify({ route: route2, files: body.files, workspace: body.workspace })).digest("hex");
63429
63438
  let held4;
@@ -63576,6 +63585,8 @@ var init_studio3 = __esm({
63576
63585
  init_board_files();
63577
63586
  init_tasks();
63578
63587
  init_response();
63588
+ init_env();
63589
+ init_review_plan();
63579
63590
  found = (id2) => {
63580
63591
  const flow = studioById(id2);
63581
63592
  if (!flow) {
@@ -64071,7 +64082,7 @@ function readCard2(id2, home3 = "board") {
64071
64082
  const found2 = home3 === "archive" ? locateArchived(id2) : locate(id2) ?? (pending ? locateArchived(id2) : null);
64072
64083
  if (!found2) {
64073
64084
  die(
64074
- home3 === "archive" ? `no card #${id2} in ${rel(ARCHIVE)}. A reflection reads the card the archive holds.` : `no card #${id2} on this board. \`akb raw list\` says what is open.`,
64085
+ home3 === "archive" ? `no card #${id2} in ${rel(ARCHIVE)}. A reflection reads the card the archive holds.` : `no card #${id2} on this board. \`akb board list\` says what is open.`,
64075
64086
  { kind: "card-not-found", id: id2 }
64076
64087
  );
64077
64088
  }
@@ -64084,7 +64095,7 @@ function readCard2(id2, home3 = "board") {
64084
64095
  }
64085
64096
  const { meta: meta3, body } = parseFrontmatter(text5);
64086
64097
  if (!meta3) {
64087
- die(`${rel(file2)} has no frontmatter \u2014 recreate it with \`akb raw create\` before working on it.`, {
64098
+ die(`${rel(file2)} has no frontmatter \u2014 restore this card from its last valid version before retrying.`, {
64088
64099
  kind: "card-unreadable",
64089
64100
  id: id2
64090
64101
  });
@@ -64160,7 +64171,7 @@ function approvedField(delivery) {
64160
64171
  }
64161
64172
  function workspaceField(delivery) {
64162
64173
  return field("workspace", [
64163
- `authorized project: ${REPO_ROOT}; board: ${boardCommandFor()}.`,
64174
+ `authorized project: ${REPO_ROOT}; board: ${boardCommand()}.`,
64164
64175
  ...delivery ? [
64165
64176
  `delivery ${delivery.deliveryId}; target branch: ${delivery.targetBranch ?? "inspect the project"}.`,
64166
64177
  `existing context: ${JSON.stringify({ worktree: delivery.worktree, branch: delivery.branch, base: delivery.base, landing: delivery.landing, completions: delivery.completions })}`,
@@ -64170,7 +64181,7 @@ function workspaceField(delivery) {
64170
64181
  }
64171
64182
  function answeringField(delivery, self) {
64172
64183
  const approved = delivery.approved.trim();
64173
- const say2 = (flag) => ` ${self} raw delivery answered ${delivery.deliveryId} ${flag}`;
64184
+ const say2 = (flag) => ` ${self} delivery answered ${delivery.deliveryId} ${flag}`;
64174
64185
  return [
64175
64186
  ...field("delivery", [
64176
64187
  `${delivery.deliveryId} is already building this card, from the copy below \u2014 frozen when it started.`,
@@ -64180,8 +64191,7 @@ function answeringField(delivery, self) {
64180
64191
  `judge the MEANING, not the words. Confirming an option that is already built, writing down a decision`,
64181
64192
  `the card already carries and tidying prose are all --unchanged. Adding, dropping or changing a`,
64182
64193
  `requirement is --changed \u2014 and so is confirming an implementation that contradicts the copy below,`,
64183
- `however finished it is.`,
64184
- `say nothing and the board carries on as --unchanged.`
64194
+ `however finished it is.`
64185
64195
  ]),
64186
64196
  ...field(
64187
64197
  "approved",
@@ -64237,8 +64247,7 @@ function conversationBlock(chat) {
64237
64247
  }
64238
64248
  function buildFlow(req, program2) {
64239
64249
  const delivery = deliveryFor(req);
64240
- const self = delivery?.worktree ? boardCommandFor(req.id) : `${program2}${BOARD_FLAG}`;
64241
- const raw = `${self} raw`;
64250
+ const self = boardCommand();
64242
64251
  const facts = [];
64243
64252
  const close = [];
64244
64253
  const next = [];
@@ -64267,11 +64276,11 @@ function buildFlow(req, program2) {
64267
64276
  ...settled ? ["honour the notes above as requirements \u2014 they are decisions already settled on this card, and nothing here reopens them"] : [],
64268
64277
  "tick each box in ## Todo as you finish it \u2014 they are the record of what was built",
64269
64278
  `record the delivered outcome and verification on the task \u2014 \`akb guide archive\``,
64270
- delivery ? `${self} raw delivery complete ${delivery.deliveryId} \u2014 finish your step and follow its handoff; software steps in a git project supply --commit <full-sha> --branch <target>` : `${self} task archive ${req.id} \u2014 once every box is ticked and the card's goal is met`
64279
+ delivery ? `${self} delivery complete ${delivery.deliveryId} \u2014 finish your step and follow its handoff; software steps in a git project supply --commit <full-sha> --branch <target>` : `${self} task archive ${req.id} \u2014 once every box is ticked and the card's goal is met`
64271
64280
  );
64272
64281
  if (card.meta.questions.length) {
64273
64282
  next.push(
64274
- `${self} raw card resolve ${req.id} --print \u2014 first: the card has open questions, and building on a guess is what they are there to stop`
64283
+ `${self} task resolve ${req.id} --print \u2014 first: the card has open questions, and building on a guess is what they are there to stop`
64275
64284
  );
64276
64285
  }
64277
64286
  break;
@@ -64280,7 +64289,7 @@ function buildFlow(req, program2) {
64280
64289
  facts.push(...stepsField(card), ...questionsField(card.meta));
64281
64290
  close.push(
64282
64291
  "settle and write the card as `akb guide refine` says",
64283
- `${raw} update ${req.id} --status ready \u2014 once the card validates`
64292
+ `${self} task update ${req.id} --status ready \u2014 once the card validates`
64284
64293
  );
64285
64294
  break;
64286
64295
  }
@@ -64291,7 +64300,7 @@ function buildFlow(req, program2) {
64291
64300
  facts.push(...answeringField(building, self));
64292
64301
  facts.push(...notesField(card));
64293
64302
  close.push(
64294
- answeredClose(building, self),
64303
+ "record the effect with one of the delivery answer commands above before closing the questions",
64295
64304
  "do not run `refine` while a delivery is in flight \u2014 even if requirements changed, the build carries on in execution once all questions are dropped"
64296
64305
  );
64297
64306
  } else {
@@ -64301,7 +64310,7 @@ function buildFlow(req, program2) {
64301
64310
  break;
64302
64311
  }
64303
64312
  case "approve": {
64304
- close.push(`${raw} update ${req.id} --status ready \u2014 once the card validates`);
64313
+ close.push(`${self} task update ${req.id} --status ready \u2014 once the card validates`);
64305
64314
  break;
64306
64315
  }
64307
64316
  case "edit": {
@@ -64312,7 +64321,7 @@ function buildFlow(req, program2) {
64312
64321
  ])
64313
64322
  );
64314
64323
  close.push(
64315
- `${raw} update ${req.id} [${EDITABLE_FIELDS}] \u2014 the fields are the command's, never hand-written`,
64324
+ `${self} task update --help \u2014 see the available card fields and edit the body separately`,
64316
64325
  ...bodyScaffoldClose()
64317
64326
  );
64318
64327
  break;
@@ -64396,7 +64405,7 @@ function buildFlow(req, program2) {
64396
64405
  case "reflect": {
64397
64406
  for (const id2 of reflectedCards(req)) readCard2(id2, "archive");
64398
64407
  close.push(
64399
- `${self} raw triage add --title ".." --slug <short-english-slug> --source "#<id>" --studio <that card's studio> --text ".." \u2014 one call per proposal, each naming the archived file of the card it traces to`,
64408
+ `${self} triage add --title ".." --slug <short-english-slug> --source "#<id>" --studio <studio-id> --text ".." \u2014 one call per proposal, each naming the archived file of the card it traces to`,
64400
64409
  "propose nothing at all when nothing follows: that is a complete result, and most batches are it",
64401
64410
  "change nothing else \u2014 no card is created, edited or archived, and no memory file is written"
64402
64411
  );
@@ -64426,10 +64435,6 @@ function printFlow(rawReq, program2 = "akb") {
64426
64435
  });
64427
64436
  if (flow.next.length) sections.push({ head: "handing over \u2014 the action to reach for, and when:", lines: flow.next });
64428
64437
  say(flow.lead);
64429
- if (program2 !== "akb") {
64430
- say("");
64431
- say(`there is no \`akb\` on this machine \u2014 every \`akb\` below, in the flows too, is \`${program2}\` here.`);
64432
- }
64433
64438
  for (const section of sections) {
64434
64439
  say("");
64435
64440
  say(section.head);
@@ -64470,7 +64475,7 @@ function printFlow(rawReq, program2 = "akb") {
64470
64475
  ...rule ? { rule } : {}
64471
64476
  };
64472
64477
  }
64473
- var MAX_STEPS, indent, EDITABLE_FIELDS, bodyScaffoldClose, answeredClose, GUIDES_FOR, guidesFor;
64478
+ var MAX_STEPS, indent, bodyScaffoldClose, GUIDES_FOR, guidesFor;
64474
64479
  var init_flow = __esm({
64475
64480
  "../cli/src/lib/agent/flow.ts"() {
64476
64481
  "use strict";
@@ -64492,9 +64497,7 @@ var init_flow = __esm({
64492
64497
  init_env();
64493
64498
  MAX_STEPS = 12;
64494
64499
  indent = (line) => line.split("\n").map((l) => l.trim() ? ` ${l}` : "").join("\n");
64495
- EDITABLE_FIELDS = "--title|--priority|--modules|--blocked-by|--related";
64496
64500
  bodyScaffoldClose = (lead = "fill the existing") => [`${lead} body scaffold; do not rename or translate its section titles, and leave empty scaffold sections in place`];
64497
- answeredClose = (delivery, self) => `${self} raw delivery answered ${delivery.deliveryId} --changed|--unchanged "<why>" \u2014 before you drop the questions; dropping the last one with nothing said carries the build on as --unchanged`;
64498
64501
  GUIDES_FOR = {
64499
64502
  implement: ["board", "archive", "implement"],
64500
64503
  sub: [],
@@ -64694,170 +64697,6 @@ var init_refine2 = __esm({
64694
64697
  }
64695
64698
  });
64696
64699
 
64697
- // ../artifact-sdk/src/internal/tags.ts
64698
- function variantsOf(raw, src) {
64699
- if (!raw) return [];
64700
- let parsed;
64701
- try {
64702
- parsed = JSON.parse(raw);
64703
- } catch {
64704
- return [];
64705
- }
64706
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return [];
64707
- const list3 = Object.entries(parsed).filter((e) => typeof e[1] === "string" && !!e[1]);
64708
- if (list3.length < 2 || !list3.some(([, s]) => s === src)) return [];
64709
- return list3.map(([label2, s]) => ({ label: label2, src: s }));
64710
- }
64711
- var init_tags = __esm({
64712
- "../artifact-sdk/src/internal/tags.ts"() {
64713
- "use strict";
64714
- }
64715
- });
64716
-
64717
- // ../cli/src/lib/shared/coding-previews.ts
64718
- var CODING_PREVIEWS;
64719
- var init_coding_previews = __esm({
64720
- "../cli/src/lib/shared/coding-previews.ts"() {
64721
- "use strict";
64722
- CODING_PREVIEWS = {
64723
- "tech-stack-advisor": "tech-choices",
64724
- "email-planner": "emails",
64725
- "ui-designer": "ui-design",
64726
- "api-designer": "api-docs",
64727
- "schema-designer": "schema",
64728
- "prompt-writer": "prompts",
64729
- "competitor-research": "competitor-research"
64730
- };
64731
- }
64732
- });
64733
-
64734
- // ../cli/src/lib/agent/approved-ui.ts
64735
- import path81 from "node:path";
64736
- function approvedUiSource(pins, src, owner) {
64737
- const [ref] = splitFileReference(src);
64738
- if (artifactId.test(ref)) {
64739
- const version2 = approvedUiPin(pins, ref).version;
64740
- const names2 = Object.keys(pins).filter((name) => {
64741
- const pin = approvedUiPin(pins, name);
64742
- return pin.artifact === ref && (version2 === void 0 || pin.version === version2);
64743
- });
64744
- return names2.find((name) => !artifactId.test(name)) ?? names2[0] ?? ref;
64745
- }
64746
- const local = owner && !ref.startsWith(".assets/") ? relativeFileReference(ref, owner) : ref;
64747
- return [local, src, ref, path81.posix.normalize(local)].find((key) => Object.hasOwn(pins, key)) ?? local;
64748
- }
64749
- function approvedUiPin(pins, source2) {
64750
- return object2(Object.hasOwn(pins, source2) ? pins[source2] : void 0);
64751
- }
64752
- function validUiPin(pin) {
64753
- 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;
64754
- }
64755
- function approvedUiPreviews(review) {
64756
- if (reviewAuthorization(review).kind !== "delivery") return [];
64757
- const result = [];
64758
- for (const [index, node2] of (review.plan ?? []).entries()) {
64759
- const stage = review.stages.find((stage2) => stage2.id === node2.id);
64760
- const snapshot2 = stage?.snapshot;
64761
- if (node2.kind === "work" || !stage || !snapshot2) continue;
64762
- const evidence = object2(snapshot2.evidence);
64763
- const content = object2(evidence.content);
64764
- const frozenPreviews = Array.isArray(snapshot2.previews) ? snapshot2.previews.filter(isObject2) : [];
64765
- for (const id2 of node2.previews.filter((id3) => id3 === UI_PREVIEW || historicalUiIds.includes(id3))) {
64766
- const preview = object2(content[id2]);
64767
- const body = typeof preview.body === "string" ? preview.body : typeof snapshot2.body === "string" ? parsePreviewBlocks(snapshot2.body).blocks.find((block) => block.id === id2)?.instructions : void 0;
64768
- if (!body) continue;
64769
- const pins = { ...object2(evidence.dependencies), ...object2(frozenPreviews.find((preview2) => preview2.id === id2)?.assets), ...object2(evidence.assets) };
64770
- const files = /* @__PURE__ */ new Map();
64771
- const add2 = (src, label2, device, required2 = true) => {
64772
- if (external.test(src)) return;
64773
- const source2 = approvedUiSource(pins, src);
64774
- if (!required2 && !Object.hasOwn(pins, source2) && !/\.(?:html?|tsx)$/i.test(source2)) return;
64775
- const name = label2.trim() || path81.posix.basename(src);
64776
- const key = JSON.stringify([src, name]);
64777
- let file2 = files.get(key);
64778
- if (!file2) {
64779
- file2 = { src, source: source2, label: name, devices: /* @__PURE__ */ new Set() };
64780
- files.set(key, file2);
64781
- }
64782
- file2.devices.add(device === "mobile" ? "Mobile" : device === "desktop" ? "Desktop" : "Device unspecified");
64783
- };
64784
- for (const { name, attrs } of bodyComponentTags(body)) {
64785
- const label2 = attrs.label ?? "";
64786
- if (name === "Compare" && attrs.a && attrs.b) {
64787
- add2(attrs.a, attrs["a-label"] || label2);
64788
- add2(attrs.b, attrs["b-label"] || label2);
64789
- } else if (attrs.src) {
64790
- const variants = variantsOf(attrs.variants, attrs.src);
64791
- if (variants.length) {
64792
- for (const variant of variants) add2(variant.src, label2 ? `${label2} (${variant.label})` : variant.label, attrs.device);
64793
- } else {
64794
- add2(attrs.src, label2, attrs.device);
64795
- }
64796
- }
64797
- }
64798
- const listed = new Set([...files.values()].map((file2) => file2.src));
64799
- for (const src of bodySources(body)) if (!listed.has(src)) add2(src, "", void 0, false);
64800
- if (files.size) result.push({
64801
- id: id2,
64802
- revision: stage.revision,
64803
- directory: `review-${stage.revision}-${index}/${id2}`,
64804
- body,
64805
- pins,
64806
- files: [...files.values()]
64807
- });
64808
- }
64809
- }
64810
- return result;
64811
- }
64812
- function approvedUiFile(directory, preview, source2) {
64813
- const parts = path81.posix.normalize(splitFileReference(source2)[0]).split("/");
64814
- let parents = 0;
64815
- while (parts[0] === "..") {
64816
- parts.shift();
64817
- parents++;
64818
- }
64819
- const rendered = /\.tsx$/i.test(parts.at(-1) ?? "");
64820
- if (rendered) parts[parts.length - 1] = parts.at(-1).replace(/\.tsx$/i, ".html");
64821
- const safe2 = parts.map((part) => !part || part === "." ? "%00" : part.replace(/[\\:*?"<>|%\x00-\x1f]/g, (char) => `%${char.charCodeAt(0).toString(16).padStart(2, "0")}`));
64822
- return path81.join(directory, preview.directory, `${rendered ? "rendered" : "files"}-${parents}`, ...safe2);
64823
- }
64824
- function approvedUiPrompt(review, directory, includeBody = false) {
64825
- const previews = approvedUiPreviews(review);
64826
- if (!previews.length) return "";
64827
- return [
64828
- "Approved UI previews",
64829
- APPROVED_UI_RULE,
64830
- ...previews.flatMap((preview) => [
64831
- ...includeBody ? [preview.body] : [],
64832
- preview.files.flatMap((file2) => {
64833
- const pin = approvedUiPin(preview.pins, file2.source);
64834
- if (!validUiPin(pin)) return [];
64835
- const ref = directory ? `frozen file: \`${approvedUiFile(directory, preview, file2.source)}\`` : `artifact ${pin.artifact}, version ${pin.version}`;
64836
- return [`- ${file2.label} \xB7 ${[...file2.devices].join(" / ")} \xB7 Review revision ${preview.revision} \xB7 ${file2.src} \xB7 ${ref}`];
64837
- }).join("\n")
64838
- ])
64839
- ].join("\n\n");
64840
- }
64841
- var APPROVED_UI_DIR_ENV, APPROVED_UI_RULE, UI_PREVIEW, historicalUiIds, object2, artifactId, external;
64842
- var init_approved_ui = __esm({
64843
- "../cli/src/lib/agent/approved-ui.ts"() {
64844
- "use strict";
64845
- init_file_references();
64846
- init_references();
64847
- init_tags();
64848
- init_coding_previews();
64849
- init_preview_blocks();
64850
- init_review_plan();
64851
- APPROVED_UI_DIR_ENV = "AI4KANBAN_APPROVED_UI_DIR";
64852
- APPROVED_UI_RULE = "Open the approved mockups and follow the Coding Studio delivery requirements for matching the task's intended UI changes.";
64853
- UI_PREVIEW = "ui-design";
64854
- historicalUiIds = Object.keys(CODING_PREVIEWS).filter((id2) => id2 !== UI_PREVIEW && CODING_PREVIEWS[id2] === UI_PREVIEW);
64855
- object2 = (value) => isObject2(value) ? value : {};
64856
- artifactId = /^art_[a-z0-9]+$/i;
64857
- external = /^(?:[a-z][\w+.-]*:|\/|#)/i;
64858
- }
64859
- });
64860
-
64861
64700
  // ../cli/src/lib/agent/follow.ts
64862
64701
  function refineRunsAfter(asks) {
64863
64702
  return asks.flatMap((ask2) => {
@@ -65018,15 +64857,9 @@ async function watchRun(sessionId, resume = startResume, retryBackoff = backoffM
65018
64857
  const savedPreviews = record2.action === "implement" && process.env[SAVED_PREVIEW_FILE_ENV];
65019
64858
  const review = reviewContext?.review;
65020
64859
  const boundary = review && reviewBoundary(savedPreviews ? { ...review, stages: review.stages.map((stage) => ({ ...stage, snapshot: null })) } : review, reviewContext.assigned);
65021
- const coding = record2.action === "implement" && studioForRun({ id: record2.cardId ?? void 0, deliveryId: record2.deliveryId }) === "coding";
65022
- const uiDirectory = process.env[APPROVED_UI_DIR_ENV];
65023
- const approvedUi = review && coding && (!savedPreviews || uiDirectory) ? approvedUiPrompt(review, uiDirectory, !!savedPreviews) : "";
65024
- const savedPrompt = savedPreviews ? [
65025
- `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.`,
65026
- ...coding && !approvedUi && review?.plan?.some((node2) => node2.previews.includes("ui-design")) ? [APPROVED_UI_RULE] : []
65027
- ].join("\n") : "";
64860
+ const savedPrompt = savedPreviews ? `Use the task inputs and pinned files listed in \`${savedPreviews}\`. Follow the task's delivery instructions.` : "";
65028
64861
  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.` : "";
65029
- 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");
64862
+ 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");
65030
64863
  const before = markBoard();
65031
64864
  const takes = active3.images;
65032
64865
  active3.renderer?.setRequiredImages?.(record2.pictures ?? []);
@@ -65609,8 +65442,6 @@ var STOP_GRACE_MS, STOP_CLOSE_MS, STOP_FINISH_MS, silenceSaid, joinNotes;
65609
65442
  var init_watch = __esm({
65610
65443
  "../cli/src/lib/agent/watch.ts"() {
65611
65444
  "use strict";
65612
- init_approved_ui();
65613
- init_runner();
65614
65445
  init_review_plan();
65615
65446
  init_env();
65616
65447
  init_connection_process();
@@ -65650,7 +65481,7 @@ var init_watch = __esm({
65650
65481
 
65651
65482
  // ../cli/src/commands/run.ts
65652
65483
  import fs83 from "node:fs";
65653
- import path82 from "node:path";
65484
+ import path81 from "node:path";
65654
65485
  async function cmdStartRun(action, args2, opts, program2 = "akb") {
65655
65486
  const { req, follow: follow2, print } = readRequest(action, args2, opts);
65656
65487
  if (!print && (action === "approve" || action === "implement")) {
@@ -65696,8 +65527,8 @@ async function cmdStartRun(action, args2, opts, program2 = "akb") {
65696
65527
  const { run: run3, spawned } = started;
65697
65528
  if (!spawned) die(`couldn't start a process for run ${run3.sessionId}`, { kind: "spawn-failed" });
65698
65529
  say(`${action} \u2014 run ${run3.sessionId}${run3.deliveryId ? ` in delivery ${run3.deliveryId}` : ""}`);
65699
- say(` follow it: ${program2} raw run log ${short(run3.sessionId)} --follow${BOARD_FLAG}`);
65700
- say(` stop it: ${program2} raw run stop ${short(run3.sessionId)}${BOARD_FLAG}`);
65530
+ say(` follow it: ${boardCommand()} run log ${short(run3.sessionId)} --follow`);
65531
+ say(` stop it: ${boardCommand()} run stop ${short(run3.sessionId)}`);
65701
65532
  if (follow2) return await followStarted(run3.sessionId, program2, opts.events === true);
65702
65533
  return { sessionId: run3.sessionId, action, cardId: run3.cardId };
65703
65534
  }
@@ -65747,7 +65578,7 @@ function sayBeforeStart(req, program2) {
65747
65578
  const asked = card?.questions.length ?? 0;
65748
65579
  if (req.action === "implement" && asked) {
65749
65580
  say(
65750
- `#${req.id} has ${asked} open question${asked === 1 ? "" : "s"} \u2014 it is built, then holds at landing until ${asked === 1 ? "it is" : "they are"} answered. Answer first with \`${program2} raw card resolve ${req.id}\`.`
65581
+ `#${req.id} has ${asked} open question${asked === 1 ? "" : "s"} \u2014 it is built, then holds at landing until ${asked === 1 ? "it is" : "they are"} answered. Answer first with \`${boardCommand()} task resolve ${req.id}\`.`
65751
65582
  );
65752
65583
  }
65753
65584
  }
@@ -65876,7 +65707,7 @@ async function cmdSubStart(words, opts) {
65876
65707
  let prompt = words.join(" ");
65877
65708
  if (opts.file) {
65878
65709
  try {
65879
- prompt = fs83.readFileSync(path82.resolve(opts.file), "utf8");
65710
+ prompt = fs83.readFileSync(path81.resolve(opts.file), "utf8");
65880
65711
  } catch {
65881
65712
  die(`--file: cannot read ${opts.file}`, { kind: "run-refused" });
65882
65713
  }
@@ -65914,7 +65745,7 @@ async function cmdSubWait(ids, waitMs = WAIT_MS2) {
65914
65745
  say("");
65915
65746
  }
65916
65747
  if (running.length) {
65917
- say(`still running: ${running.map((r) => short(r.sessionId)).join(", ")} \u2014 run \`run wait\` again.`);
65748
+ say(`still running: ${running.map((r) => short(r.sessionId)).join(", ")} \u2014 run \`${boardCommand()} run wait${ids.length ? ` ${ids.join(" ")}` : ""}\` again.`);
65918
65749
  }
65919
65750
  return {
65920
65751
  ended: ended.map((r) => ({ sessionId: r.sessionId, status: r.status, result: r.result })),
@@ -65939,7 +65770,7 @@ async function cmdRuns(opts, program2 = "akb") {
65939
65770
  }
65940
65771
  if (live.length) say("");
65941
65772
  say(
65942
- live.length ? `${live.length} running. Follow one with \`${program2} raw run log <id> --follow${BOARD_FLAG}\`.` : "nothing running."
65773
+ live.length ? `${live.length} running. Follow one with \`${boardCommand()} run log <id> --follow\`.` : "nothing running."
65943
65774
  );
65944
65775
  return { runs: shown };
65945
65776
  }
@@ -66134,8 +65965,8 @@ function runLine(r, program2 = "akb", indent2 = "") {
66134
65965
  if (r.durationMs !== void 0) bits.push(`in ${ago(r.durationMs)}`);
66135
65966
  if (r.model) bits.push(r.model);
66136
65967
  if (r.costUsd !== void 0) bits.push(`$${r.costUsd.toFixed(4)}`);
66137
- if (r.canResume) bits.push(`\u2014 continue it with \`${program2} raw run resume ${short(r.sessionId)}${BOARD_FLAG}\``);
66138
- if (r.canRetry) bits.push(`\u2014 try it again with \`${program2} raw run resume ${short(r.sessionId)}${BOARD_FLAG}\``);
65968
+ if (r.canResume) bits.push(`\u2014 continue it with \`${boardCommand()} run resume ${short(r.sessionId)}\``);
65969
+ if (r.canRetry) bits.push(`\u2014 try it again with \`${boardCommand()} run resume ${short(r.sessionId)}\``);
66139
65970
  const line = bits.join(" ");
66140
65971
  const under = [
66141
65972
  r.input && firstLine2(r.input),
@@ -66181,6 +66012,7 @@ var init_run = __esm({
66181
66012
  init_answers();
66182
66013
  init_deliveries();
66183
66014
  init_pause();
66015
+ init_command();
66184
66016
  init_flow();
66185
66017
  init_env();
66186
66018
  init_memory_review();
@@ -66226,7 +66058,7 @@ var init_config3 = __esm({
66226
66058
 
66227
66059
  // ../cli/src/lib/signals/migrate.ts
66228
66060
  import fs84 from "node:fs";
66229
- import path83 from "node:path";
66061
+ import path82 from "node:path";
66230
66062
  function readHandled() {
66231
66063
  let text5;
66232
66064
  try {
@@ -66248,7 +66080,7 @@ function readHandled() {
66248
66080
  }
66249
66081
  function lift(from, into) {
66250
66082
  fs84.mkdirSync(into, { recursive: true });
66251
- fs84.renameSync(from, path83.join(into, freeName(into, path83.basename(from))));
66083
+ fs84.renameSync(from, path82.join(into, freeName(into, path82.basename(from))));
66252
66084
  }
66253
66085
  function repoint(dir, from, into) {
66254
66086
  let entries2;
@@ -66259,7 +66091,7 @@ function repoint(dir, from, into) {
66259
66091
  }
66260
66092
  for (const entry of entries2) {
66261
66093
  if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
66262
- const file2 = path83.join(dir, entry.name);
66094
+ const file2 = path82.join(dir, entry.name);
66263
66095
  const text5 = fs84.readFileSync(file2, "utf8");
66264
66096
  if (text5.includes(from)) fs84.writeFileSync(file2, text5.split(from).join(into));
66265
66097
  }
@@ -66272,17 +66104,17 @@ function dropIfEmpty(dir) {
66272
66104
  }
66273
66105
  function liftInbox() {
66274
66106
  if (!fs84.existsSync(SIGNALS_OLD_INBOX)) return;
66275
- const oldFiles = path83.join(SIGNALS_OLD_INBOX, "files");
66107
+ const oldFiles = path82.join(SIGNALS_OLD_INBOX, "files");
66276
66108
  if (fs84.existsSync(oldFiles)) {
66277
66109
  for (const entry of fs84.readdirSync(oldFiles, { withFileTypes: true })) {
66278
- if (entry.isFile()) lift(path83.join(oldFiles, entry.name), SIGNALS_FILES);
66110
+ if (entry.isFile()) lift(path82.join(oldFiles, entry.name), SIGNALS_FILES);
66279
66111
  }
66280
66112
  dropIfEmpty(oldFiles);
66281
66113
  }
66282
66114
  const held4 = new Set(readFolder(TRIAGE).map((signal2) => signal2.sourceId));
66283
66115
  for (const entry of fs84.readdirSync(SIGNALS_OLD_INBOX, { withFileTypes: true })) {
66284
66116
  if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
66285
- const from = path83.join(SIGNALS_OLD_INBOX, entry.name);
66117
+ const from = path82.join(SIGNALS_OLD_INBOX, entry.name);
66286
66118
  const item = parse3(from);
66287
66119
  if (item && held4.has(item.sourceId)) {
66288
66120
  fs84.rmSync(from, { force: true });
@@ -66291,7 +66123,7 @@ function liftInbox() {
66291
66123
  if (item) held4.add(item.sourceId);
66292
66124
  lift(from, TRIAGE);
66293
66125
  }
66294
- const wasAt = asWritten(path83.join(SIGNALS_OLD_INBOX, "files"));
66126
+ const wasAt = asWritten(path82.join(SIGNALS_OLD_INBOX, "files"));
66295
66127
  const nowAt = asWritten(SIGNALS_FILES);
66296
66128
  for (const dir of [TRIAGE, SIGNALS_ARCHIVED, SIGNALS_DISMISSED]) repoint(dir, wasAt, nowAt);
66297
66129
  dropIfEmpty(SIGNALS_OLD_INBOX);
@@ -66317,7 +66149,7 @@ function liftHandled() {
66317
66149
  "---",
66318
66150
  ""
66319
66151
  ];
66320
- fs84.writeFileSync(path83.join(SIGNALS_DISMISSED, name), `${front.join("\n")}
66152
+ fs84.writeFileSync(path82.join(SIGNALS_DISMISSED, name), `${front.join("\n")}
66321
66153
  `);
66322
66154
  }
66323
66155
  fs84.rmSync(SIGNALS_OLD_HANDLED, { force: true });
@@ -66338,7 +66170,7 @@ var init_migrate = __esm({
66338
66170
  init_yaml();
66339
66171
  init_inbox();
66340
66172
  HANDLED_LINE = /^-\s+(.+?)\s+—\s+(.+)$/;
66341
- asWritten = (dir) => `${rel(dir).split(path83.sep).join("/")}/`;
66173
+ asWritten = (dir) => `${rel(dir).split(path82.sep).join("/")}/`;
66342
66174
  }
66343
66175
  });
66344
66176
 
@@ -66392,7 +66224,7 @@ var init_identity2 = __esm({
66392
66224
 
66393
66225
  // ../cli/src/lib/signals/add.ts
66394
66226
  import fs85 from "node:fs";
66395
- import path84 from "node:path";
66227
+ import path83 from "node:path";
66396
66228
  import { createHash as createHash8 } from "node:crypto";
66397
66229
  function linkTitle(url2) {
66398
66230
  let at;
@@ -66405,7 +66237,7 @@ function linkTitle(url2) {
66405
66237
  return oneLine(where) || url2.slice(0, TITLE_MAX);
66406
66238
  }
66407
66239
  function asText(file2) {
66408
- const ext = path84.extname(file2.name).toLowerCase();
66240
+ const ext = path83.extname(file2.name).toLowerCase();
66409
66241
  if (!file2.type.startsWith("text/") && file2.type !== "application/json" && !TEXT_EXTENSIONS.has(ext)) return null;
66410
66242
  try {
66411
66243
  const text5 = new TextDecoder("utf-8", { fatal: true }).decode(file2.data);
@@ -66415,9 +66247,9 @@ function asText(file2) {
66415
66247
  }
66416
66248
  }
66417
66249
  function fileName2(name, data) {
66418
- const base = path84.basename(name);
66419
- const ext = path84.extname(base).toLowerCase().slice(0, 12);
66420
- const word = path84.basename(base, path84.extname(base)).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 40) || "file";
66250
+ const base = path83.basename(name);
66251
+ const ext = path83.extname(base).toLowerCase().slice(0, 12);
66252
+ const word = path83.basename(base, path83.extname(base)).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 40) || "file";
66421
66253
  const hash3 = createHash8("sha256").update(data).digest("hex").slice(0, 8);
66422
66254
  return `${word}-${hash3}${ext}`;
66423
66255
  }
@@ -66426,9 +66258,9 @@ function addToInbox(drop) {
66426
66258
  const typed = (drop.text ?? "").trim();
66427
66259
  const file2 = drop.file;
66428
66260
  if (!typed && !file2) return { ok: false, error: "nothing to add \u2014 paste a link or some text, or drop a file." };
66429
- if (file2 && file2.data.length === 0) return { ok: false, error: `${path84.basename(file2.name)} is empty.` };
66261
+ if (file2 && file2.data.length === 0) return { ok: false, error: `${path83.basename(file2.name)} is empty.` };
66430
66262
  if (file2 && file2.data.length > MAX_BYTES3) {
66431
- return { ok: false, error: `${path84.basename(file2.name)} is over ${MAX_BYTES3 / 1024 / 1024} MB \u2014 too big for the board.` };
66263
+ return { ok: false, error: `${path83.basename(file2.name)} is over ${MAX_BYTES3 / 1024 / 1024} MB \u2014 too big for the board.` };
66432
66264
  }
66433
66265
  const read5 = describe3(typed, file2);
66434
66266
  const keep2 = read5.keep;
@@ -66465,7 +66297,7 @@ function describe3(typed, file2) {
66465
66297
  return only ? [only] : [];
66466
66298
  };
66467
66299
  if (file2) {
66468
- const name = path84.basename(file2.name);
66300
+ const name = path83.basename(file2.name);
66469
66301
  const text5 = asText(file2);
66470
66302
  const note = typed ? `
66471
66303
 
@@ -66477,7 +66309,7 @@ ${typed}` : "";
66477
66309
  const at = keepAt(file2);
66478
66310
  return {
66479
66311
  incoming: {
66480
- title: path84.basename(name, path84.extname(name)) || name,
66312
+ title: path83.basename(name, path83.extname(name)) || name,
66481
66313
  summary: `${name} \u2014 ${boardRel2(at)}${note}`,
66482
66314
  ...named2
66483
66315
  },
@@ -66515,13 +66347,13 @@ var init_add = __esm({
66515
66347
  MAX_BYTES3 = 25 * 1024 * 1024;
66516
66348
  TITLE_MAX = 120;
66517
66349
  TEXT_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".markdown", ".txt", ".text", ".csv", ".json", ".yml", ".yaml", ".log"]);
66518
- boardRel2 = (file2) => rel(file2).split(path84.sep).join("/");
66350
+ boardRel2 = (file2) => rel(file2).split(path83.sep).join("/");
66519
66351
  oneLine = (text5) => {
66520
66352
  const first = text5.split("\n").find((line) => line.trim()) ?? "";
66521
66353
  const clean = first.replace(/^#+\s*/, "").trim();
66522
66354
  return clean.length > TITLE_MAX ? `${clean.slice(0, TITLE_MAX - 1).trimEnd()}\u2026` : clean;
66523
66355
  };
66524
- keepAt = (file2) => path84.join(SIGNALS_FILES, fileName2(file2.name, file2.data));
66356
+ keepAt = (file2) => path83.join(SIGNALS_FILES, fileName2(file2.name, file2.data));
66525
66357
  }
66526
66358
  });
66527
66359
 
@@ -66627,7 +66459,7 @@ var init_previews = __esm({
66627
66459
 
66628
66460
  // ../cli/src/commands/studio-preview.ts
66629
66461
  import fs87 from "node:fs";
66630
- import path85 from "node:path";
66462
+ import path84 from "node:path";
66631
66463
  import { createHash as createHash9, randomUUID as randomUUID9 } from "node:crypto";
66632
66464
  import { spawnSync as spawnSync7 } from "node:child_process";
66633
66465
  function readFolder2(folder2, baseline = false) {
@@ -66636,7 +66468,7 @@ function readFolder2(folder2, baseline = false) {
66636
66468
  const scan = (dir) => {
66637
66469
  for (const e of fs87.readdirSync(dir, { withFileTypes: true })) {
66638
66470
  if (e.name.startsWith(".")) continue;
66639
- const file2 = path85.join(dir, e.name);
66471
+ const file2 = path84.join(dir, e.name);
66640
66472
  if (e.isSymbolicLink()) throw Error(`${file2}: symbolic links are not allowed`);
66641
66473
  if (e.isDirectory()) scan(file2);
66642
66474
  else {
@@ -66653,7 +66485,7 @@ function readFolder2(folder2, baseline = false) {
66653
66485
  return { files, def: checked.def, fingerprint };
66654
66486
  }
66655
66487
  function unified(before, after2, file2, folder2) {
66656
- const a = path85.join(folder2, "a"), b = path85.join(folder2, "b");
66488
+ const a = path84.join(folder2, "a"), b = path84.join(folder2, "b");
66657
66489
  fs87.writeFileSync(a, before ?? "");
66658
66490
  fs87.writeFileSync(b, after2 ?? "");
66659
66491
  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 });
@@ -66665,17 +66497,17 @@ ${start < 0 ? "" : lines.slice(start + 2).join("\n")}`;
66665
66497
  }
66666
66498
  async function cmdStudioPreview(id2, opts) {
66667
66499
  if (!locate(id2)) die(`no card ${id2}`, "no-such-card");
66668
- const destination = path85.join(ASSETS, String(id2), "studio-review"), staging = `${destination}.${randomUUID9()}.tmp`, backup = `${destination}.${randomUUID9()}.previous`;
66500
+ const destination = path84.join(ASSETS, String(id2), "studio-review"), staging = `${destination}.${randomUUID9()}.tmp`, backup = `${destination}.${randomUUID9()}.previous`;
66669
66501
  let moved = false;
66670
66502
  try {
66671
- const draft = readFolder2(path85.resolve(opts.folder)), base = opts.base === "empty" ? null : readFolder2(path85.resolve(opts.base), true);
66503
+ const draft = readFolder2(path84.resolve(opts.folder)), base = opts.base === "empty" ? null : readFolder2(path84.resolve(opts.base), true);
66672
66504
  const version2 = readVersion2(draft.files), baseVersion = base && readVersion2(base.files);
66673
66505
  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");
66674
66506
  fs87.mkdirSync(staging, { recursive: true });
66675
66507
  const review = { version: 2, base: base && baseVersion ? { ...baseVersion, fingerprint: base.fingerprint } : null, fingerprint: draft.fingerprint, files: [] };
66676
66508
  const save3 = (file2, bytes2) => {
66677
- const target = path85.join(staging, file2);
66678
- fs87.mkdirSync(path85.dirname(target), { recursive: true });
66509
+ const target = path84.join(staging, file2);
66510
+ fs87.mkdirSync(path84.dirname(target), { recursive: true });
66679
66511
  fs87.writeFileSync(target, bytes2);
66680
66512
  return file2;
66681
66513
  };
@@ -66684,10 +66516,10 @@ async function cmdStudioPreview(id2, opts) {
66684
66516
  const before = base?.files[file2] ?? null, after2 = draft.files[file2] ?? null;
66685
66517
  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)) } : {} });
66686
66518
  }
66687
- for (const p of ["a", "b"]) fs87.rmSync(path85.join(staging, p), { force: true });
66519
+ for (const p of ["a", "b"]) fs87.rmSync(path84.join(staging, p), { force: true });
66688
66520
  if (!parseReview(review)) throw Error("generated review is invalid");
66689
66521
  save3("review.json", JSON.stringify(review, null, 2) + "\n");
66690
- fs87.mkdirSync(path85.dirname(destination), { recursive: true });
66522
+ fs87.mkdirSync(path84.dirname(destination), { recursive: true });
66691
66523
  if (fs87.existsSync(destination)) {
66692
66524
  fs87.renameSync(destination, backup);
66693
66525
  moved = true;
@@ -66705,7 +66537,7 @@ ${items}
66705
66537
 
66706
66538
  </Set>` : items;
66707
66539
  say([tag, files].filter(Boolean).join("\n\n"));
66708
- return { file: path85.join(destination, "review.json"), tag, files };
66540
+ return { file: path84.join(destination, "review.json"), tag, files };
66709
66541
  } catch (error62) {
66710
66542
  if (moved && !fs87.existsSync(destination)) fs87.renameSync(backup, destination);
66711
66543
  if (error62 && typeof error62 === "object" && "kind" in error62) throw error62;
@@ -66851,13 +66683,16 @@ function nounOf(program2, name, summary2, description) {
66851
66683
  });
66852
66684
  }
66853
66685
  function declareRaw(program2, cli) {
66854
- const raw = `${cli.program} raw`;
66686
+ declareLocalRuns(program2, cli);
66687
+ }
66688
+ function declareLocalRuns(program2, cli, canonical) {
66689
+ const command = canonical ? cli.program : `${cli.program} raw`;
66855
66690
  const noun = (name, summary2, description) => nounOf(program2, name, summary2, description);
66856
66691
  const groups = {
66857
- card: noun(
66692
+ card: canonical?.task ?? noun(
66858
66693
  "card",
66859
66694
  "one card: build it, sharpen it, change it, finish it",
66860
- `Every verb here takes the card\u2019s id. A card with a delivery in flight refuses all of them but \`implement\` \u2014 \`${raw} delivery cancel\` is what hands it back.`
66695
+ `Every verb here takes the card\u2019s id. A card with a delivery in flight refuses all of them but \`implement\` \u2014 \`${command} delivery cancel\` is what hands it back.`
66861
66696
  ),
66862
66697
  delivery: noun(
66863
66698
  "delivery",
@@ -66867,9 +66702,9 @@ function declareRaw(program2, cli) {
66867
66702
  run: noun(
66868
66703
  "run",
66869
66704
  "the agent processes \u2014 what is going, and what went",
66870
- `A run is one agent working once. A delivery is made of several, so ending a run leaves the delivery in flight \u2014 \`${raw} delivery cancel\` is what ends that.`
66705
+ `A run is one agent working once. A delivery is made of several, so ending a run leaves the delivery in flight \u2014 \`${command} delivery cancel\` is what ends that.`
66871
66706
  ),
66872
- memory: noun("memory", "squeeze or review the memory the planning flows read"),
66707
+ memory: noun("memory", "read and maintain project memory"),
66873
66708
  // What is waiting to be sorted (#453, #499).
66874
66709
  triage: noun(
66875
66710
  "triage",
@@ -66877,11 +66712,18 @@ function declareRaw(program2, cli) {
66877
66712
  "What is in triage is not a task: it never enters the card list, is never scheduled, and counts towards nothing. Triage is `docs/kanban/triage/`, one file each, with `archived/` for what became a card and `dismissed/` for what was ignored. The board UI is where items are read, made into cards, ignored and restored."
66878
66713
  )
66879
66714
  };
66880
- for (const flow of FLOWS) if (!flow.internal) declareFlow(flow.group ? groups[flow.group] : program2, flow, cli);
66881
- declareRunning(groups.run, cli);
66882
- declareDelivery(groups.delivery, cli);
66715
+ for (const flow of FLOWS) {
66716
+ if (flow.internal) continue;
66717
+ if (canonical && flow.action === "describe-project") {
66718
+ declareFlow(groups.memory, flow, cli, true);
66719
+ } else if (!canonical || flow.group === "card" && flow.action !== "approve" || flow.action === "review-memory" || flow.action === "prune-memory") {
66720
+ declareFlow(flow.group ? groups[flow.group] : program2, flow, cli, !!canonical);
66721
+ }
66722
+ }
66723
+ declareRunning(groups.run, cli, !!canonical);
66724
+ declareDelivery(groups.delivery, cli, !!canonical);
66883
66725
  groups.delivery.addHelpText("after", HELP_AFTER.deliveries(cli.program));
66884
- withShared(program2.command("previews")).allowExcessArguments().summary("list Preview output IDs and instructions").addOption(new Option("-f, --follow").hideHelp()).addOption(new Option("--notes <text>").hideHelp()).addOption(new Option("--print").hideHelp()).option("--triggers", "query Studio Previews for a Goal").option("--studio <id>", "Preview outputs of this Studio").option("--workspace <id>", "the workspace whose studios to query").action(async function() {
66726
+ withShared((canonical?.studio ?? program2).command("previews")).allowExcessArguments().summary("list Preview output IDs and instructions").addOption(new Option("-f, --follow").hideHelp()).addOption(new Option("--notes <text>").hideHelp()).addOption(new Option("--print").hideHelp()).addOption(new Option("--triggers", "query Studio Previews for a Goal").hideHelp(!!canonical)).option("--studio <id>", "Preview outputs of this Studio").addOption(new Option("--workspace <id>", "the workspace whose studios to query").hideHelp(!!canonical)).action(async function() {
66885
66727
  const opts = this.opts();
66886
66728
  if (this.args.length || opts.follow || opts.notes !== void 0) {
66887
66729
  return boardless(this, cli, () => die("Prepare Preview outputs in the task session using STUDIO.md.", "bad-args"));
@@ -66893,7 +66735,6 @@ function declareRaw(program2, cli) {
66893
66735
  });
66894
66736
  } else await onBoard(this, cli, () => listPreviews(opts.studio));
66895
66737
  });
66896
- declareAgent(program2, cli);
66897
66738
  const triage = groups.triage;
66898
66739
  withShared(triage.command("add")).summary("write one item into triage").description(
66899
66740
  "One item, from words you already have \u2014 no endpoint, and nothing is pulled. The body is `--text` for a line or two, `--file <path>` when it is longer. `--source` says where it came from, and a reflection puts the card that prompted it there. It is not a task: it waits in triage until somebody sorts it. One already waiting, or already made into a card, is refused and told where it is; one only ignored is taken, and its `dismissed/` record is left alone."
@@ -66905,25 +66746,30 @@ function declareRaw(program2, cli) {
66905
66746
  ).argument("<source-id>", "the id to look for").action(async function(sourceId) {
66906
66747
  await onBoard(this, cli, () => cmdTriageCheck(sourceId));
66907
66748
  });
66908
- withShared(program2.command("components")).summary("list an agent or studio\u2019s Preview Components and their usage").option("--studio <id>", "all components used by a studio").option("--docs", "include component usage documentation").action(async function() {
66909
- const ctx = ctxOf(this, cli.program);
66910
- useBoard(resolveBoard("components", { board: ctx.board, dir: ctx.dir, cwd: cli.cwd, installHint: cli.installHint }), ctx.dir !== null);
66911
- await boardless(this, cli, () => cmdComponents(this.opts()));
66912
- });
66913
- const studio = noun("studio", "check a studio folder or draw its diagram");
66749
+ const studio = canonical?.studio ?? noun("studio", "check a Studio folder");
66914
66750
  withShared(studio.command("validate")).argument("<folder>", "a studio folder containing STUDIO.md").summary("validate the complete Studio definition and its references").action(async function(folder2) {
66915
66751
  await onBoard(this, cli, () => cmdStudioValidate(folder2));
66916
66752
  });
66917
66753
  withShared(studio.command("preview")).argument("<card>", "the card to review the Studio on", cardId).requiredOption("--folder <draft>", "the complete draft Studio folder").requiredOption("--base <baseline>", "the baseline folder, or empty for a new Studio").summary("freeze Studio files and print Studio and attachment previews").action(async function(card) {
66918
66754
  await onBoard(this, cli, () => cmdStudioPreview(card, this.opts()));
66919
66755
  });
66920
- withShared(studio.command("diagram")).argument("<id-or-card>", "studio id, or card number with --folder").argument("[card]", "the card whose asset folder gets studio.json").option("--folder <folder>", "read a local studio folder").summary("write the studio's diagram to .assets/<card>/studio.json and print the <Studio> tag that shows it").action(async function(id2, card) {
66756
+ if (canonical) {
66757
+ const board2 = noun("board", "list local cards and resolve board conflicts");
66758
+ declareBoardMoves(program2, cli, { ...canonical, board: board2, memory: groups.memory });
66759
+ return;
66760
+ }
66761
+ declareAgent(program2, cli);
66762
+ withShared(program2.command("components")).summary("list an agent or studio\u2019s Preview Components and their usage").option("--studio <id>", "all components used by a studio").option("--docs", "include component usage documentation").action(async function() {
66763
+ const ctx = ctxOf(this, cli.program);
66764
+ useBoard(resolveBoard("components", { board: ctx.board, dir: ctx.dir, cwd: cli.cwd, installHint: cli.installHint }), ctx.dir !== null);
66765
+ await boardless(this, cli, () => cmdComponents(this.opts()));
66766
+ });
66767
+ withShared(studio.command("diagram", { hidden: true })).argument("<id-or-card>", "studio id, or card number with --folder").argument("[card]", "the card whose asset folder gets studio.json").option("--folder <folder>", "read a local studio folder").summary("write the studio's diagram to .assets/<card>/studio.json and print the <Studio> tag that shows it").action(async function(id2, card) {
66921
66768
  await onBoard(this, cli, () => cmdStudioDiagram(id2, this.opts().folder ? id2 : card, this.opts().folder));
66922
66769
  });
66923
66770
  }
66924
66771
  function declareRuns(program2, cli) {
66925
- const ON_WEB = "Reads and writes WildCrane Cloud as the signed-in account; changes show on the web at once.";
66926
- const task = withShared(program2.command("task")).summary("see where WildCrane tasks stand; list, create, approve, stop, resume, remove and restore them").description(`${ON_WEB} <task> is WC-12, task_\u2026, or just 12 in a linked folder.`).action(function() {
66772
+ const task = withShared(program2.command("task")).summary("manage Cloud tasks and work on local cards").description("Manage tasks. Check subcommand help for whether it works on this board or in Cloud.").action(function() {
66927
66773
  this.help();
66928
66774
  });
66929
66775
  withShared(task.command("list")).summary("list tasks").option("--project <id>", "the project; default: this folder\u2019s linked one").option("--workspace <id>", "every project of a workspace").option("--status <status>", "queued, running, waiting_review, done, failed, cancelled or stopped").action(async function() {
@@ -66932,8 +66778,19 @@ function declareRuns(program2, cli) {
66932
66778
  withShared(task.command("show")).argument("<task>").summary("a task and its card").action(async function(id2) {
66933
66779
  await boardless(this, cli, (_, location) => taskShow(id2, location));
66934
66780
  });
66935
- withShared(task.command("create")).argument("<request...>", "what the task should do").summary("create a task and prepare its card asynchronously").option("--project <id>", "the project; default: this folder\u2019s linked one").option("--studio <id>", "required: a name `akb studio list` shows").action(async function(request2) {
66936
- await boardless(this, cli, (_, location) => taskCreate(request2.join(" "), this.opts(), location));
66781
+ withCreateOptions(withShared(task.command("create"))).argument("[request...]", "what the task should do").summary("prepare a task from a request or write a local card from a title").description("Pass a request to prepare a Cloud task asynchronously. Use --title to allocate a number in Cloud and immediately write a card and its index entry to this board. Use --studio with a request. Card fields apply to --title and --project applies to a request. Edit the saved body separately.").option("--project <id>", "for a request: the project; default: this folder\u2019s linked one").action(async function(request2) {
66782
+ const opts = this.opts();
66783
+ if (opts.title !== void 0) {
66784
+ if (request2.length || opts.project !== void 0) {
66785
+ die("Use --title with the local board, or pass a request and optionally --project.", "bad-args");
66786
+ }
66787
+ return createBoardCard(this, cli);
66788
+ }
66789
+ if (["priority", "blockedBy", "related", "modules", "slug", "triage", "source"].some((key) => opts[key] !== void 0)) {
66790
+ die("Card fields require --title.", "bad-args");
66791
+ }
66792
+ if (!request2.length) this.error("missing required argument 'request' or option '--title'", { code: "commander.missingArgument" });
66793
+ await boardless(this, cli, (_, location) => taskCreate(request2.join(" "), opts, location));
66937
66794
  });
66938
66795
  withShared(task.command("approve")).argument("<task>").summary("approve the current review point").option("--stage <id>", "the reviewed node").requiredOption("--revision <n>", "the stage version you reviewed").option("--comment <text>", "a note with the approval").action(async function(id2) {
66939
66796
  await boardless(this, cli, (_, location) => taskApprove(id2, this.opts().comment, this.opts(), location));
@@ -67044,7 +66901,7 @@ function declareRuns(program2, cli) {
67044
66901
  const tools = withShared(program2.command("agent")).summary("the AI tools on this MACHINE");
67045
66902
  tools.allowExcessArguments().allowUnknownOption().action(function() {
67046
66903
  if (!this.args.length) this.help();
67047
- this.error(movedTo("agent", cli.program), { code: "commander.unknownCommand" });
66904
+ this.error(`unknown command '${this.args[0]}'`, { code: "commander.unknownCommand" });
67048
66905
  });
67049
66906
  withShared(tools.command("check")).summary("whether WildCrane can run an agent here, and what is missing; exits 1 until it can").argument("<agent>", HARNESSES.map((h) => h.name).join(", ")).action(async function(agent) {
67050
66907
  await boardless(this, cli, () => cmdAgentCheck(agent));
@@ -67066,7 +66923,7 @@ function declareRuns(program2, cli) {
67066
66923
  ).allowExcessArguments().allowUnknownOption().action(async function() {
67067
66924
  const word = this.args[0];
67068
66925
  if (word === "diagram") {
67069
- this.error(`\`${cli.program} studio ${word}\` is now \`${cli.program} raw studio ${word}\`.`, { code: "commander.unknownCommand" });
66926
+ this.error(`Freeze a Studio draft with \`${cli.program} studio preview <card> --folder <draft> --base <baseline>\`.`, { code: "commander.unknownCommand" });
67070
66927
  }
67071
66928
  if (word) this.error(`unknown command '${word}'`, { code: "commander.unknownCommand" });
67072
66929
  await studioList(this, cli);
@@ -67106,6 +66963,7 @@ function declareRuns(program2, cli) {
67106
66963
  }
67107
66964
  await boardless(this, cli, (p) => cmdGuide(topic, p));
67108
66965
  });
66966
+ declareLocalRuns(program2, cli, { task, studio });
67109
66967
  program2.command("__watch", { hidden: true }).argument("<sessionId>").action(async function(sessionId) {
67110
66968
  const ctx = ctxOf(this, cli.program);
67111
66969
  const found2 = resolveBoard("runs", { board: ctx.board, dir: ctx.dir, cwd: cli.cwd, installHint: cli.installHint });
@@ -67114,7 +66972,7 @@ function declareRuns(program2, cli) {
67114
66972
  if (code !== 0) throw new BoardError(`the watcher for ${sessionId} ended with ${code}`, { kind: "watch-failed" });
67115
66973
  });
67116
66974
  }
67117
- function declareRunning(run3, cli) {
66975
+ function declareRunning(run3, cli, canonical) {
67118
66976
  const verb = (name) => withShared(run3.command(name));
67119
66977
  verb("list").summary("what is running, and what ran lately").description("A creation run with no card fails even if the agent exits with code 0. Failure reason, triage source and cost are kept. In JSON the run reports status: error and ok: false; the outer ok describes this query. A successful query exits with code 0.").option("-c, --card <id>", "only the runs on that card", cardId).option("-a, --all", "every run this board has kept, not just the last ten").action(async function() {
67120
66978
  await onBoard(this, cli, (p) => cmdRuns(this.opts(), p));
@@ -67129,7 +66987,7 @@ function declareRunning(run3, cli) {
67129
66987
  const [ids] = positional(vals);
67130
66988
  await onBoard(this, cli, () => cmdSubWait(ids ?? []));
67131
66989
  });
67132
- verb("log").argument("[id]", RUN_ID, String).summary("one run's log").description("Shows the failure reason, any triage source and recorded cost. A creation run with no card fails even if the agent exits with code 0. Non-following queries exit with code 0; following a failed run exits with code 1. Example: akb raw run log abc12345 --follow").option("-f, --follow", "keep printing it until the run ends").option("--events", "with --follow: print its structured events, one JSON object per line").option("--full", "all of it, rather than the tail").action(async function(...vals) {
66990
+ verb("log").argument("[id]", RUN_ID, String).summary("one run's log").description("Shows the failure reason, any triage source and recorded cost. A creation run with no card fails even if the agent exits with code 0. Non-following queries exit with code 0; following a failed run exits with code 1. Example: akb run log abc12345 --follow").option("-f, --follow", "keep printing it until the run ends").option("--events", "with --follow: print its structured events, one JSON object per line").option("--full", "all of it, rather than the tail").action(async function(...vals) {
67133
66991
  const [id2] = positional(vals);
67134
66992
  await onBoard(this, cli, (p) => cmdLog(id2, this.opts(), p));
67135
66993
  });
@@ -67137,13 +66995,13 @@ function declareRunning(run3, cli) {
67137
66995
  const [id2] = positional(vals);
67138
66996
  await onBoard(this, cli, () => cmdStop(id2));
67139
66997
  });
67140
- verb("resume").argument("[id]", RUN_ID, String).summary("continue a run from its saved work").description("Continue the saved session. Use --fresh to explicitly take over saved work when the original session is unavailable.").option("-f, --follow", "watch its log instead of returning").option("--events", "with --follow: print its structured events, one JSON object per line").option("--fresh", "explicitly take over saved work in a new session").option("--require-session", "require the original session").action(async function(...vals) {
66998
+ verb("resume").argument("[id]", RUN_ID, String).summary("continue a run from its saved work").description("Continue the saved session. Use --fresh to explicitly take over saved work when the original session is unavailable.").option("-f, --follow", "watch its log instead of returning").option("--events", "with --follow: print its structured events, one JSON object per line").option("--fresh", "explicitly take over saved work in a new session").addOption(new Option("--require-session", "require the original session").hideHelp(canonical)).action(async function(...vals) {
67141
66999
  const [id2] = positional(vals);
67142
67000
  await onBoard(this, cli, () => cmdResume(id2, this.opts()));
67143
67001
  });
67144
67002
  }
67145
- function declareDelivery(delivery, cli) {
67146
- const verb = (name) => withShared(delivery.command(name));
67003
+ function declareDelivery(delivery, cli, canonical) {
67004
+ const verb = (name, internal = false) => withShared(delivery.command(name, { hidden: canonical && internal }));
67147
67005
  verb("complete").argument("<delivery>", DELIVERY).summary("record the current step result and finish its handoff").option("--commit <sha>", "the full landed commit hash").option("--branch <name>", "the target branch containing that commit").action(async function(named2) {
67148
67006
  await onBoard(this, cli, () => cmdCompleteDelivery(named2, this.opts()));
67149
67007
  });
@@ -67169,25 +67027,26 @@ function declareDelivery(delivery, cli) {
67169
67027
  const [named2] = positional(vals);
67170
67028
  await onBoard(this, cli, () => cmdResumeDelivery(named2));
67171
67029
  });
67172
- verb("reconcile").argument("<card>", "card number", cardId).summary("reconcile local delivery state for a card before recovery").action(async function(...vals) {
67030
+ verb("reconcile", true).argument("<card>", "card number", cardId).summary("reconcile local delivery state for a card before recovery").action(async function(...vals) {
67173
67031
  const [id2] = positional(vals);
67174
67032
  await onBoard(this, cli, () => cmdReconcileDelivery(id2));
67175
67033
  });
67176
- verb("release").argument("<card>", "card number", cardId).summary("safely release an active delivery write lock while preserving saved work").action(async function(...vals) {
67034
+ verb("release", true).argument("<card>", "card number", cardId).summary("safely release an active delivery write lock while preserving saved work").action(async function(...vals) {
67177
67035
  const [id2] = positional(vals);
67178
67036
  await onBoard(this, cli, () => cmdReleaseDelivery(id2));
67179
67037
  });
67180
67038
  }
67181
- function declareFlow(parent, flow, cli) {
67039
+ function declareFlow(parent, flow, cli, canonical) {
67182
67040
  const byDelivery = flow.group === "delivery";
67183
- const cmd = withShared(parent.command(flowVerb(flow)));
67041
+ const cmd = withShared(parent.command(flowVerb(flow), { hidden: canonical && flow.action === "prune-memory" }));
67184
67042
  for (const arg of splitArgs(flow.argument)) {
67185
67043
  cmd.argument(arg, argNote(arg, flow), arg.startsWith("<id") ? byDelivery ? String : cardId : void 0);
67186
67044
  }
67187
67045
  cmd.summary(flow.gloss);
67188
67046
  if (flow.more?.length) cmd.description(`${sentence(flow.gloss)} ${flow.more.join(" ")}`);
67189
- for (const option of flow.options ?? []) addFlowOption(cmd, option);
67190
- cmd.addOption(new Option("-p, --print", "say what to do and start nothing").conflicts("follow")).option("-f, --follow", "watch the log instead of returning").option("--events", "with --follow: print its structured events, one JSON object per line").addHelpText("after", HELP_AFTER.flow).action(async function(...vals) {
67047
+ for (const option of flow.options ?? []) addFlowOption(cmd, option, canonical && option.internal === true);
67048
+ const showPrint = !canonical || flow.group === "card";
67049
+ cmd.addOption(new Option("-p, --print", "say what to do and start nothing").conflicts("follow").hideHelp(!showPrint)).addOption(new Option("-f, --follow", "watch the log instead of returning").hideHelp(canonical)).addOption(new Option("--events", "with --follow: print its structured events, one JSON object per line").hideHelp(canonical)).addHelpText("after", showPrint ? PRINT_FLOW_HELP : "").action(async function(...vals) {
67191
67050
  const args2 = positional(vals);
67192
67051
  await onBoard(
67193
67052
  this,
@@ -67201,8 +67060,8 @@ function deliveryOf(named2) {
67201
67060
  if (!delivery) throw new BoardError(`no delivery here answers to "${named2}"`, { kind: "unknown-delivery" });
67202
67061
  return delivery;
67203
67062
  }
67204
- function addFlowOption(cmd, option) {
67205
- const declared = new Option(option.flags, option.description);
67063
+ function addFlowOption(cmd, option, hidden) {
67064
+ const declared = new Option(option.flags, option.description).hideHelp(hidden);
67206
67065
  if (option.choices) declared.argParser(oneOf(option.choices));
67207
67066
  if (option.range) declared.argParser(intInRange(option.range[0], option.range[1]));
67208
67067
  cmd.addOption(declared);
@@ -67277,7 +67136,7 @@ var init_agent2 = __esm({
67277
67136
  init_telemetry2();
67278
67137
  init_agent_check();
67279
67138
  init_harnesses();
67280
- init_moved();
67139
+ init_board2();
67281
67140
  init_question_options();
67282
67141
  init_shared2();
67283
67142
  REVIEW_FLOW_HELP = `
@@ -67304,7 +67163,7 @@ init_agent2();
67304
67163
 
67305
67164
  // ../cli/src/lib/cli/setup.ts
67306
67165
  import fs89 from "node:fs";
67307
- import path87 from "node:path";
67166
+ import path86 from "node:path";
67308
67167
  import { fileURLToPath as fileURLToPath3 } from "node:url";
67309
67168
 
67310
67169
  // ../cli/src/commands/update.ts
@@ -67313,7 +67172,7 @@ init_config_template();
67313
67172
  init_io();
67314
67173
  init_version();
67315
67174
  import fs88 from "node:fs";
67316
- import path86 from "node:path";
67175
+ import path85 from "node:path";
67317
67176
  import { spawnSync as spawnSync9 } from "node:child_process";
67318
67177
  var NAME = "wildcrane";
67319
67178
  var REPO = "https://github.com/wildcrane-ai/wildcrane";
@@ -67355,8 +67214,8 @@ async function cmdUpdate2(ctx) {
67355
67214
  return { updated: ctx.dir, from, to: SKILL_VERSION };
67356
67215
  }
67357
67216
  async function repairBoard(root2, report3, named2) {
67358
- const legacy = path86.join(root2, "docs", "kanban");
67359
- const kept2 = path86.join(root2, ".akb", "kanban");
67217
+ const legacy = path85.join(root2, "docs", "kanban");
67218
+ const kept2 = path85.join(root2, ".akb", "kanban");
67360
67219
  const board2 = named2 ?? (fs88.existsSync(legacy) ? legacy : kept2);
67361
67220
  if (!fs88.existsSync(board2)) {
67362
67221
  report3.notes.push("\u672A\u627E\u5230\u770B\u677F\uFF0C\u8BF7\u901A\u8FC7\u63D2\u4EF6\u8FDE\u63A5\u4E91\u7AEF\u9879\u76EE\u3002");
@@ -67369,7 +67228,7 @@ async function repairBoard(root2, report3, named2) {
67369
67228
  return true;
67370
67229
  }
67371
67230
  function checkConfig(board2, report3) {
67372
- const current = read4(path86.join(board2, "config.md"));
67231
+ const current = read4(path85.join(board2, "config.md"));
67373
67232
  if (!current) return;
67374
67233
  const added = missingConfigKeys(current);
67375
67234
  if (added.length) {
@@ -67379,7 +67238,7 @@ function checkConfig(board2, report3) {
67379
67238
  }
67380
67239
  }
67381
67240
  function checkModules(board2, report3) {
67382
- const map3 = read4(path86.join(board2, "modules.md"));
67241
+ const map3 = read4(path85.join(board2, "modules.md"));
67383
67242
  if (map3 && map3.includes(UNFILLED)) {
67384
67243
  report3.notes.push(
67385
67244
  "docs/kanban/modules.md is still blank \u2014 write it from the repo (`akb guide module-map`)"
@@ -67433,14 +67292,14 @@ function declareSetup(program2, cli) {
67433
67292
  program2.version(SKILL_VERSION, "-v, --version", "print this version").addHelpText("beforeAll", spelled(cli.program));
67434
67293
  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");
67435
67294
  const where = (cmd) => {
67436
- const dir = path87.resolve(String(cmd.optsWithGlobals().dir ?? cli.cwd));
67295
+ const dir = path86.resolve(String(cmd.optsWithGlobals().dir ?? cli.cwd));
67437
67296
  if (!fs89.existsSync(dir)) throw new BoardError(`no such folder: ${dir}`, { kind: "no-such-folder", dir });
67438
67297
  return dir;
67439
67298
  };
67440
67299
  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() {
67441
67300
  const dir = where(this);
67442
67301
  const named2 = this.optsWithGlobals().board ?? process.env.AI4KANBAN_BOARD?.trim();
67443
- const board2 = named2 ? path87.resolve(cli.cwd, named2) : null;
67302
+ const board2 = named2 ? path86.resolve(cli.cwd, named2) : null;
67444
67303
  await runAction(ctxOf(this, cli.program), {}, () => cmdUpdate2({ dir, program: cli.program, board: board2 }));
67445
67304
  });
67446
67305
  program2.command("__rules", { hidden: true }).action(function() {
@@ -67449,18 +67308,12 @@ function declareSetup(program2, cli) {
67449
67308
  }
67450
67309
 
67451
67310
  // ../cli/src/lib/cli/akb.ts
67452
- init_io();
67453
67311
  init_shared2();
67454
67312
  function buildAkbProgram(cli) {
67455
67313
  const program2 = withShared(newCommand(cli.program));
67456
67314
  program2.description("set up a board, and put an agent to work on it.").helpCommand("help [command]", "this list, or one command in full");
67457
67315
  declareSetup(program2, cli);
67458
67316
  declareRuns(program2, cli);
67459
- program2.command("raw").argument("[move...]").summary("the local board, and the commands an agent uses inside a run").description(`Every move: \`${cli.program} raw help\`. A person never has to type one.`).action(function() {
67460
- throw new BoardError(`\`${cli.program} raw\` is a tree of its own \u2014 this command line never reached it.`, {
67461
- kind: "unreachable"
67462
- });
67463
- });
67464
67317
  return program2;
67465
67318
  }
67466
67319
 
@@ -67479,6 +67332,7 @@ async function runAgent2(argv, options = {}) {
67479
67332
 
67480
67333
  // ../cli/src/kanban.ts
67481
67334
  init_board_cli();
67335
+ init_paths();
67482
67336
  init_version();
67483
67337
  var SELF2 = fileURLToPath4(import.meta.url);
67484
67338
  function invokedDirectly() {
@@ -67492,32 +67346,32 @@ function invokedDirectly() {
67492
67346
  }
67493
67347
  if (invokedDirectly()) {
67494
67348
  const argv = process.argv.slice(2);
67495
- const raw = rawArgv(argv);
67496
- if (argv[0] === "__watch") {
67497
- void runAgent2(argv, { program: "akb" }).then((code) => {
67498
- process.exitCode = code;
67499
- });
67500
- } else if (raw || argv[0] === "guide") {
67501
- if (argv[0] === "guide") {
67502
- void runAgent2(argv, { program: `node ${SELF2}` }).then((code) => {
67503
- process.exitCode = code;
67504
- });
67505
- } else {
67506
- void runBoard(raw ?? [], {
67507
- program: `node ${SELF2} raw`,
67508
- version: `wildcrane ${SKILL_VERSION}`
67509
- }).then((code) => {
67510
- process.exitCode = code;
67511
- });
67512
- }
67513
- } else {
67514
- void runBoard(argv, {
67515
- program: `node ${SELF2}`,
67516
- version: `wildcrane ${SKILL_VERSION}`
67517
- }).then((code) => {
67518
- process.exitCode = code;
67519
- });
67520
- }
67349
+ const program2 = `node ${shellWord(SELF2)}`;
67350
+ const word = commandWord(argv);
67351
+ const legacy = /* @__PURE__ */ new Set([
67352
+ "create",
67353
+ "update-questions",
67354
+ "conflict",
67355
+ "list",
67356
+ "inspect",
67357
+ "validate",
67358
+ "file",
67359
+ "agent-file",
67360
+ "memory-file",
67361
+ "reject",
67362
+ "init",
67363
+ "card",
67364
+ "previews",
67365
+ "components",
67366
+ "reflect",
67367
+ "review-dismissals",
67368
+ "describe-project",
67369
+ "version"
67370
+ ]);
67371
+ const result = legacy.has(word) ? runBoard(argv, { program: program2, version: `wildcrane ${SKILL_VERSION}` }) : runAgent2(argv, { program: program2 });
67372
+ void result.then((code) => {
67373
+ process.exitCode = code;
67374
+ });
67521
67375
  }
67522
67376
  export {
67523
67377
  rawArgv,