@cleocode/cleo 2026.4.26 → 2026.4.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -38789,10 +38789,10 @@ async function readProjectMeta(projectPath) {
38789
38789
  }
38790
38790
  async function readProjectId(projectPath) {
38791
38791
  try {
38792
- const { readFileSync: readFileSync103, existsSync: existsSync131 } = await import("node:fs");
38792
+ const { readFileSync: readFileSync102, existsSync: existsSync131 } = await import("node:fs");
38793
38793
  const infoPath = join64(projectPath, ".cleo", "project-info.json");
38794
38794
  if (!existsSync131(infoPath)) return "";
38795
- const data = JSON.parse(readFileSync103(infoPath, "utf-8"));
38795
+ const data = JSON.parse(readFileSync102(infoPath, "utf-8"));
38796
38796
  return typeof data.projectId === "string" ? data.projectId : "";
38797
38797
  } catch {
38798
38798
  return "";
@@ -54643,33 +54643,23 @@ var init_runtime = __esm({
54643
54643
  });
54644
54644
 
54645
54645
  // packages/core/src/system/safestop.ts
54646
- import { existsSync as existsSync96, readFileSync as readFileSync67, writeFileSync as writeFileSync15 } from "node:fs";
54646
+ import { existsSync as existsSync96 } from "node:fs";
54647
54647
  import { join as join98 } from "node:path";
54648
- function safestop(projectRoot, opts) {
54648
+ async function safestop(projectRoot, opts) {
54649
54649
  const dryRun = opts?.dryRun ?? false;
54650
54650
  const reason = opts?.reason ?? "Manual safestop";
54651
54651
  let sessionEnded = false;
54652
54652
  if (!dryRun && !opts?.noSessionEnd) {
54653
- const sessPath = join98(projectRoot, ".cleo", "sessions.json");
54654
- if (existsSync96(sessPath)) {
54655
- try {
54656
- const data = JSON.parse(readFileSync67(sessPath, "utf-8"));
54657
- const sessions2 = data.sessions ?? [];
54658
- let changed = false;
54659
- for (const s3 of sessions2) {
54660
- if (s3.status === "active") {
54661
- s3.status = "ended";
54662
- s3.endedAt = (/* @__PURE__ */ new Date()).toISOString();
54663
- s3.endNote = `Safestop: ${reason}`;
54664
- changed = true;
54665
- sessionEnded = true;
54666
- }
54667
- }
54668
- if (changed) {
54669
- writeFileSync15(sessPath, JSON.stringify(data, null, 2), "utf-8");
54670
- }
54671
- } catch {
54653
+ try {
54654
+ const accessor = await getAccessor(projectRoot);
54655
+ const activeSession = await accessor.getActiveSession();
54656
+ if (activeSession && activeSession.id !== "default") {
54657
+ activeSession.status = "ended";
54658
+ activeSession.endedAt = (/* @__PURE__ */ new Date()).toISOString();
54659
+ await accessor.upsertSingleSession(activeSession);
54660
+ sessionEnded = true;
54672
54661
  }
54662
+ } catch {
54673
54663
  }
54674
54664
  }
54675
54665
  return { stopped: !dryRun, reason, sessionEnded, handoff: opts?.handoff, dryRun };
@@ -55260,7 +55250,7 @@ var init_tasks2 = __esm({
55260
55250
  });
55261
55251
 
55262
55252
  // packages/core/src/templates/parser.ts
55263
- import { existsSync as existsSync97, readdirSync as readdirSync31, readFileSync as readFileSync68 } from "fs";
55253
+ import { existsSync as existsSync97, readdirSync as readdirSync31, readFileSync as readFileSync67 } from "fs";
55264
55254
  import { join as join99 } from "path";
55265
55255
  import { parse as parseYaml } from "yaml";
55266
55256
  function deriveSubcommand(filename) {
@@ -55276,7 +55266,7 @@ function deriveSubcommand(filename) {
55276
55266
  }
55277
55267
  function parseTemplateFile2(templateDir, filename) {
55278
55268
  const filePath = join99(templateDir, filename);
55279
- const raw = readFileSync68(filePath, "utf-8");
55269
+ const raw = readFileSync67(filePath, "utf-8");
55280
55270
  const parsed = parseYaml(raw);
55281
55271
  const name2 = typeof parsed.name === "string" ? parsed.name : filename;
55282
55272
  const titlePrefix = typeof parsed.title === "string" ? parsed.title : "";
@@ -55463,7 +55453,7 @@ var init_templates = __esm({
55463
55453
  });
55464
55454
 
55465
55455
  // packages/core/src/ui/aliases.ts
55466
- import { existsSync as existsSync98, readFileSync as readFileSync69, writeFileSync as writeFileSync16 } from "node:fs";
55456
+ import { existsSync as existsSync98, readFileSync as readFileSync68, writeFileSync as writeFileSync15 } from "node:fs";
55467
55457
  import { homedir as homedir5, platform as platform3 } from "node:os";
55468
55458
  import { join as join100 } from "node:path";
55469
55459
  function getCurrentShell() {
@@ -55526,40 +55516,40 @@ function generatePowershellAliases(cleoPath) {
55526
55516
  }
55527
55517
  function hasAliasBlock(filePath) {
55528
55518
  if (!existsSync98(filePath)) return false;
55529
- const content = readFileSync69(filePath, "utf-8");
55519
+ const content = readFileSync68(filePath, "utf-8");
55530
55520
  return content.includes(MARKER_START) && content.includes(MARKER_END);
55531
55521
  }
55532
55522
  function getInstalledVersion(filePath) {
55533
55523
  if (!existsSync98(filePath)) return null;
55534
- const content = readFileSync69(filePath, "utf-8");
55524
+ const content = readFileSync68(filePath, "utf-8");
55535
55525
  const match = content.match(/CLEO CLI aliases \(v([^)]+)\)/);
55536
55526
  return match?.[1] ?? null;
55537
55527
  }
55538
55528
  function injectAliases(filePath, shell = "bash", cleoPath) {
55539
55529
  const content = shell === "powershell" ? generatePowershellAliases(cleoPath) : generateBashAliases(cleoPath);
55540
55530
  if (!existsSync98(filePath)) {
55541
- writeFileSync16(filePath, content + "\n", "utf-8");
55531
+ writeFileSync15(filePath, content + "\n", "utf-8");
55542
55532
  return { action: "created", version: ALIASES_VERSION };
55543
55533
  }
55544
- const existing = readFileSync69(filePath, "utf-8");
55534
+ const existing = readFileSync68(filePath, "utf-8");
55545
55535
  if (hasAliasBlock(filePath)) {
55546
55536
  const startIdx = existing.indexOf(MARKER_START);
55547
55537
  const endIdx = existing.indexOf(MARKER_END) + MARKER_END.length;
55548
55538
  const updated = existing.slice(0, startIdx) + content + existing.slice(endIdx);
55549
- writeFileSync16(filePath, updated, "utf-8");
55539
+ writeFileSync15(filePath, updated, "utf-8");
55550
55540
  return { action: "updated", version: ALIASES_VERSION };
55551
55541
  }
55552
- writeFileSync16(filePath, existing + "\n" + content + "\n", "utf-8");
55542
+ writeFileSync15(filePath, existing + "\n" + content + "\n", "utf-8");
55553
55543
  return { action: "added", version: ALIASES_VERSION };
55554
55544
  }
55555
55545
  function removeAliases(filePath) {
55556
55546
  if (!existsSync98(filePath) || !hasAliasBlock(filePath)) return false;
55557
- const existing = readFileSync69(filePath, "utf-8");
55547
+ const existing = readFileSync68(filePath, "utf-8");
55558
55548
  const startIdx = existing.indexOf(MARKER_START);
55559
55549
  const endIdx = existing.indexOf(MARKER_END) + MARKER_END.length;
55560
55550
  const before = existing.slice(0, startIdx).replace(/\n+$/, "\n");
55561
55551
  const after = existing.slice(endIdx).replace(/^\n+/, "\n");
55562
- writeFileSync16(filePath, before + after, "utf-8");
55552
+ writeFileSync15(filePath, before + after, "utf-8");
55563
55553
  return true;
55564
55554
  }
55565
55555
  function checkAliasesStatus(shell) {
@@ -55590,7 +55580,7 @@ var init_aliases = __esm({
55590
55580
  });
55591
55581
 
55592
55582
  // packages/core/src/ui/changelog.ts
55593
- import { appendFileSync as appendFileSync9, existsSync as existsSync99, readFileSync as readFileSync70, writeFileSync as writeFileSync17 } from "node:fs";
55583
+ import { appendFileSync as appendFileSync9, existsSync as existsSync99, readFileSync as readFileSync69, writeFileSync as writeFileSync16 } from "node:fs";
55594
55584
  async function discoverReleaseTasks(options = {}, cwd, accessor) {
55595
55585
  const tasks2 = [];
55596
55586
  const dataSources = [];
@@ -55673,21 +55663,21 @@ function formatChangelogJson(version2, date6, sections) {
55673
55663
  };
55674
55664
  }
55675
55665
  function writeChangelogFile(filePath, content) {
55676
- writeFileSync17(filePath, content, "utf-8");
55666
+ writeFileSync16(filePath, content, "utf-8");
55677
55667
  }
55678
55668
  function appendToChangelog(filePath, newContent) {
55679
55669
  if (!existsSync99(filePath)) {
55680
- writeFileSync17(filePath, `# Changelog
55670
+ writeFileSync16(filePath, `# Changelog
55681
55671
 
55682
55672
  ${newContent}`, "utf-8");
55683
55673
  return;
55684
55674
  }
55685
- const existing = readFileSync70(filePath, "utf-8");
55675
+ const existing = readFileSync69(filePath, "utf-8");
55686
55676
  const headerMatch = existing.match(/^# .+\n/m);
55687
55677
  if (headerMatch) {
55688
55678
  const insertPos = (headerMatch.index ?? 0) + headerMatch[0].length;
55689
55679
  const updated = existing.slice(0, insertPos) + "\n" + newContent + existing.slice(insertPos);
55690
- writeFileSync17(filePath, updated, "utf-8");
55680
+ writeFileSync16(filePath, updated, "utf-8");
55691
55681
  } else {
55692
55682
  appendFileSync9(filePath, "\n" + newContent);
55693
55683
  }
@@ -55747,11 +55737,11 @@ var init_changelog = __esm({
55747
55737
  });
55748
55738
 
55749
55739
  // packages/core/src/ui/command-registry.ts
55750
- import { existsSync as existsSync100, readdirSync as readdirSync32, readFileSync as readFileSync71 } from "node:fs";
55740
+ import { existsSync as existsSync100, readdirSync as readdirSync32, readFileSync as readFileSync70 } from "node:fs";
55751
55741
  import { basename as basename16, join as join101 } from "node:path";
55752
55742
  function parseCommandHeader(scriptPath) {
55753
55743
  if (!existsSync100(scriptPath)) return null;
55754
- const content = readFileSync71(scriptPath, "utf-8");
55744
+ const content = readFileSync70(scriptPath, "utf-8");
55755
55745
  const lines = content.split("\n");
55756
55746
  let inHeader = false;
55757
55747
  const headerLines = [];
@@ -71081,7 +71071,7 @@ var init_compliance2 = __esm({
71081
71071
  });
71082
71072
 
71083
71073
  // packages/core/src/validation/docs-sync.ts
71084
- import { existsSync as existsSync101, readdirSync as readdirSync33, readFileSync as readFileSync72 } from "node:fs";
71074
+ import { existsSync as existsSync101, readdirSync as readdirSync33, readFileSync as readFileSync71 } from "node:fs";
71085
71075
  import { join as join102 } from "node:path";
71086
71076
  function getScriptCommands(scriptsDir) {
71087
71077
  if (!existsSync101(scriptsDir)) return [];
@@ -71094,7 +71084,7 @@ function getScriptCommands(scriptsDir) {
71094
71084
  function getIndexScripts(indexPath) {
71095
71085
  if (!existsSync101(indexPath)) return [];
71096
71086
  try {
71097
- const content = readFileSync72(indexPath, "utf-8");
71087
+ const content = readFileSync71(indexPath, "utf-8");
71098
71088
  const index2 = JSON.parse(content);
71099
71089
  return index2.commands.map((cmd) => cmd.script ?? "").filter((s3) => s3).map((s3) => s3.replace(/\.sh$/, "")).sort();
71100
71090
  } catch {
@@ -71104,7 +71094,7 @@ function getIndexScripts(indexPath) {
71104
71094
  function getIndexCommands(indexPath) {
71105
71095
  if (!existsSync101(indexPath)) return [];
71106
71096
  try {
71107
- const content = readFileSync72(indexPath, "utf-8");
71097
+ const content = readFileSync71(indexPath, "utf-8");
71108
71098
  const index2 = JSON.parse(content);
71109
71099
  return index2.commands.map((cmd) => cmd.name).sort();
71110
71100
  } catch {
@@ -71141,8 +71131,8 @@ function checkWrapperSync(wrapperPath, indexPath) {
71141
71131
  if (!existsSync101(wrapperPath) || !existsSync101(indexPath)) return [];
71142
71132
  const issues = [];
71143
71133
  try {
71144
- const wrapperContent = readFileSync72(wrapperPath, "utf-8");
71145
- const indexContent = readFileSync72(indexPath, "utf-8");
71134
+ const wrapperContent = readFileSync71(wrapperPath, "utf-8");
71135
+ const indexContent = readFileSync71(indexPath, "utf-8");
71146
71136
  const index2 = JSON.parse(indexContent);
71147
71137
  const match = wrapperContent.match(/_get_all_commands\(\)\s*\{[^}]*echo\s+"([^"]+)"/);
71148
71138
  const wrapperCmds = new Set(match ? match[1].split(/\s+/).filter(Boolean) : []);
@@ -71173,7 +71163,7 @@ function detectDrift(mode = "full", projectRoot = ".") {
71173
71163
  const readmePath = join102(projectRoot, "README.md");
71174
71164
  if (existsSync101(readmePath)) {
71175
71165
  try {
71176
- const readme = readFileSync72(readmePath, "utf-8");
71166
+ const readme = readFileSync71(readmePath, "utf-8");
71177
71167
  const readmeCmds = new Set(
71178
71168
  (readme.match(/cleo [a-z-]+/g) ?? []).map((m2) => m2.replace("cleo ", ""))
71179
71169
  );
@@ -71223,7 +71213,7 @@ var init_docs_sync = __esm({
71223
71213
 
71224
71214
  // packages/core/src/validation/doctor/project-cache.ts
71225
71215
  import { createHash as createHash11 } from "node:crypto";
71226
- import { existsSync as existsSync102, mkdirSync as mkdirSync23, readFileSync as readFileSync73, unlinkSync as unlinkSync8, writeFileSync as writeFileSync18 } from "node:fs";
71216
+ import { existsSync as existsSync102, mkdirSync as mkdirSync23, readFileSync as readFileSync72, unlinkSync as unlinkSync8, writeFileSync as writeFileSync17 } from "node:fs";
71227
71217
  import { dirname as dirname19, join as join103 } from "node:path";
71228
71218
  function getCacheFilePath(cleoHome) {
71229
71219
  const home = cleoHome ?? getCleoHome();
@@ -71239,13 +71229,13 @@ function initCacheFile(cacheFile) {
71239
71229
  if (!existsSync102(dir)) {
71240
71230
  mkdirSync23(dir, { recursive: true });
71241
71231
  }
71242
- writeFileSync18(cacheFile, JSON.stringify(cache, null, 2));
71232
+ writeFileSync17(cacheFile, JSON.stringify(cache, null, 2));
71243
71233
  return cache;
71244
71234
  }
71245
71235
  function loadCache(cacheFile) {
71246
71236
  if (!existsSync102(cacheFile)) return null;
71247
71237
  try {
71248
- const content = readFileSync73(cacheFile, "utf-8");
71238
+ const content = readFileSync72(cacheFile, "utf-8");
71249
71239
  return JSON.parse(content);
71250
71240
  } catch {
71251
71241
  return null;
@@ -71254,7 +71244,7 @@ function loadCache(cacheFile) {
71254
71244
  function getFileHash(filePath) {
71255
71245
  if (!existsSync102(filePath)) return "";
71256
71246
  try {
71257
- const content = readFileSync73(filePath);
71247
+ const content = readFileSync72(filePath);
71258
71248
  return createHash11("sha256").update(content).digest("hex");
71259
71249
  } catch {
71260
71250
  return "";
@@ -71299,14 +71289,14 @@ function cacheValidationResult(projectHash, projectPath, validationStatus, issue
71299
71289
  ttl: CACHE_TTL_SECONDS
71300
71290
  };
71301
71291
  cache.lastUpdated = timestamp2;
71302
- writeFileSync18(cachePath, JSON.stringify(cache, null, 2));
71292
+ writeFileSync17(cachePath, JSON.stringify(cache, null, 2));
71303
71293
  }
71304
71294
  function clearProjectCache(projectHash, cacheFile) {
71305
71295
  const cachePath = cacheFile ?? getCacheFilePath();
71306
71296
  const cache = loadCache(cachePath);
71307
71297
  if (!cache) return;
71308
71298
  delete cache.projects[projectHash];
71309
- writeFileSync18(cachePath, JSON.stringify(cache, null, 2));
71299
+ writeFileSync17(cachePath, JSON.stringify(cache, null, 2));
71310
71300
  }
71311
71301
  function clearEntireCache(cacheFile) {
71312
71302
  const cachePath = cacheFile ?? getCacheFilePath();
@@ -72523,7 +72513,7 @@ var init_manifest = __esm({
72523
72513
  });
72524
72514
 
72525
72515
  // packages/core/src/validation/protocol-common.ts
72526
- import { existsSync as existsSync104, readdirSync as readdirSync34, readFileSync as readFileSync74 } from "node:fs";
72516
+ import { existsSync as existsSync104, readdirSync as readdirSync34, readFileSync as readFileSync73 } from "node:fs";
72527
72517
  function checkOutputFileExists(taskId, expectedDir, pattern) {
72528
72518
  if (!existsSync104(expectedDir)) return false;
72529
72519
  const filePattern = pattern ?? `${taskId}`;
@@ -72537,7 +72527,7 @@ function checkOutputFileExists(taskId, expectedDir, pattern) {
72537
72527
  function checkDocumentationSections(filePath, sections) {
72538
72528
  if (!existsSync104(filePath)) return false;
72539
72529
  try {
72540
- const content = readFileSync74(filePath, "utf-8");
72530
+ const content = readFileSync73(filePath, "utf-8");
72541
72531
  return sections.every((section) => {
72542
72532
  const regex = new RegExp(`^#+ .*${escapeRegex3(section)}`, "m");
72543
72533
  return regex.test(content);
@@ -72608,7 +72598,7 @@ function checkLinkedTasksPresent(entry, requiredIds) {
72608
72598
  function checkProvenanceTags(filePath, taskId) {
72609
72599
  if (!existsSync104(filePath)) return false;
72610
72600
  try {
72611
- const content = readFileSync74(filePath, "utf-8");
72601
+ const content = readFileSync73(filePath, "utf-8");
72612
72602
  if (taskId) {
72613
72603
  return content.includes(`@task ${taskId}`);
72614
72604
  }
@@ -73619,7 +73609,7 @@ __export(init_exports, {
73619
73609
  resolveSeedAgentsDir: () => resolveSeedAgentsDir,
73620
73610
  updateDocs: () => updateDocs
73621
73611
  });
73622
- import { existsSync as existsSync106, readdirSync as readdirSync36, readFileSync as readFileSync75 } from "node:fs";
73612
+ import { existsSync as existsSync106, readdirSync as readdirSync36, readFileSync as readFileSync74 } from "node:fs";
73623
73613
  import { copyFile as copyFile4, lstat, mkdir as mkdir16, readFile as readFile17, symlink, unlink as unlink4, writeFile as writeFile11 } from "node:fs/promises";
73624
73614
  import { platform as platform4 } from "node:os";
73625
73615
  import { basename as basename17, dirname as dirname21, join as join105 } from "node:path";
@@ -73753,7 +73743,7 @@ async function initCoreSkills(created, warnings) {
73753
73743
  warnings.push("Failed to register skill library with CAAMP");
73754
73744
  }
73755
73745
  const catalogPath = join105(ctSkillsRoot, "skills.json");
73756
- const catalog4 = JSON.parse(readFileSync75(catalogPath, "utf-8"));
73746
+ const catalog4 = JSON.parse(readFileSync74(catalogPath, "utf-8"));
73757
73747
  const skills = catalog4.skills ?? [];
73758
73748
  const coreSkills = skills.filter((s3) => s3.tier <= 2);
73759
73749
  const installed = [];
@@ -73822,7 +73812,7 @@ async function installGitHubTemplates(projectRoot, created, skipped) {
73822
73812
  skipped.push(`.github/ISSUE_TEMPLATE/${file2}`);
73823
73813
  continue;
73824
73814
  }
73825
- const content = readFileSync75(join105(issueSrcDir, file2), "utf-8");
73815
+ const content = readFileSync74(join105(issueSrcDir, file2), "utf-8");
73826
73816
  await writeFile11(dest, content, "utf-8");
73827
73817
  created.push(`.github/ISSUE_TEMPLATE/${file2}`);
73828
73818
  }
@@ -73833,7 +73823,7 @@ async function installGitHubTemplates(projectRoot, created, skipped) {
73833
73823
  if (existsSync106(prTemplateDest)) {
73834
73824
  skipped.push(".github/pull_request_template.md");
73835
73825
  } else {
73836
- const content = readFileSync75(prTemplateSrc, "utf-8");
73826
+ const content = readFileSync74(prTemplateSrc, "utf-8");
73837
73827
  await writeFile11(prTemplateDest, content, "utf-8");
73838
73828
  created.push(".github/pull_request_template.md");
73839
73829
  }
@@ -74286,13 +74276,13 @@ var init_init = __esm({
74286
74276
  });
74287
74277
 
74288
74278
  // packages/core/src/sessions/context-alert.ts
74289
- import { existsSync as existsSync107, readFileSync as readFileSync76, writeFileSync as writeFileSync19 } from "node:fs";
74279
+ import { existsSync as existsSync107, readFileSync as readFileSync75, writeFileSync as writeFileSync18 } from "node:fs";
74290
74280
  import { join as join106 } from "node:path";
74291
74281
  function getCurrentSessionId(cwd) {
74292
74282
  if (process.env.CLEO_SESSION) return process.env.CLEO_SESSION;
74293
74283
  const sessionFile = join106(getCleoDir(cwd), ".current-session");
74294
74284
  if (existsSync107(sessionFile)) {
74295
- return readFileSync76(sessionFile, "utf-8").trim() || null;
74285
+ return readFileSync75(sessionFile, "utf-8").trim() || null;
74296
74286
  }
74297
74287
  return null;
74298
74288
  }
@@ -74388,7 +74378,7 @@ __export(project_info_exports, {
74388
74378
  getProjectInfoSync: () => getProjectInfoSync,
74389
74379
  updateProjectName: () => updateProjectName
74390
74380
  });
74391
- import { existsSync as existsSync108, readFileSync as readFileSync77, writeFileSync as writeFileSync20 } from "node:fs";
74381
+ import { existsSync as existsSync108, readFileSync as readFileSync76, writeFileSync as writeFileSync19 } from "node:fs";
74392
74382
  import { readFile as readFile18 } from "node:fs/promises";
74393
74383
  import { join as join107 } from "node:path";
74394
74384
  async function getProjectInfo(cwd) {
@@ -74415,7 +74405,7 @@ function getProjectInfoSync(cwd) {
74415
74405
  const infoPath = join107(cleoDir, "project-info.json");
74416
74406
  if (!existsSync108(infoPath)) return null;
74417
74407
  try {
74418
- const raw = readFileSync77(infoPath, "utf-8");
74408
+ const raw = readFileSync76(infoPath, "utf-8");
74419
74409
  const data = JSON.parse(raw);
74420
74410
  if (typeof data.projectHash !== "string" || data.projectHash.length === 0) {
74421
74411
  return null;
@@ -74436,10 +74426,10 @@ function updateProjectName(cwd, name2) {
74436
74426
  const cleoDir = getCleoDirAbsolute(cwd);
74437
74427
  const infoPath = join107(cleoDir, "project-info.json");
74438
74428
  if (!existsSync108(infoPath)) return;
74439
- const data = JSON.parse(readFileSync77(infoPath, "utf-8"));
74429
+ const data = JSON.parse(readFileSync76(infoPath, "utf-8"));
74440
74430
  data.projectName = name2;
74441
74431
  data.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
74442
- writeFileSync20(infoPath, `${JSON.stringify(data, null, 2)}
74432
+ writeFileSync19(infoPath, `${JSON.stringify(data, null, 2)}
74443
74433
  `);
74444
74434
  }
74445
74435
  var init_project_info = __esm({
@@ -74450,7 +74440,7 @@ var init_project_info = __esm({
74450
74440
  });
74451
74441
 
74452
74442
  // packages/core/src/bootstrap.ts
74453
- import { existsSync as existsSync109, readFileSync as readFileSync78 } from "node:fs";
74443
+ import { existsSync as existsSync109, readFileSync as readFileSync77 } from "node:fs";
74454
74444
  import { mkdir as mkdir17, readFile as readFile19, writeFile as writeFile12 } from "node:fs/promises";
74455
74445
  import { homedir as homedir6 } from "node:os";
74456
74446
  import { join as join108 } from "node:path";
@@ -74489,7 +74479,7 @@ async function ensureGlobalTemplatesBootstrap(ctx, packageRootOverride) {
74489
74479
  const pkgRoot = packageRootOverride ?? getPackageRoot();
74490
74480
  const templatePath = join108(pkgRoot, "templates", "CLEO-INJECTION.md");
74491
74481
  if (existsSync109(templatePath)) {
74492
- templateContent = readFileSync78(templatePath, "utf-8");
74482
+ templateContent = readFileSync77(templatePath, "utf-8");
74493
74483
  }
74494
74484
  } catch {
74495
74485
  }
@@ -79175,7 +79165,7 @@ var init_engine_compat = __esm({
79175
79165
 
79176
79166
  // packages/core/src/memory/pipeline-manifest-sqlite.ts
79177
79167
  import { createHash as createHash12 } from "node:crypto";
79178
- import { existsSync as existsSync111, readFileSync as readFileSync79, renameSync as renameSync8 } from "node:fs";
79168
+ import { existsSync as existsSync111, readFileSync as readFileSync78, renameSync as renameSync8 } from "node:fs";
79179
79169
  import { join as join109 } from "node:path";
79180
79170
  import { and as and10, count as count2, desc as desc5, eq as eq13, gte as gte3, isNull as isNull3, like as like3, lte as lte2, or as or5 } from "drizzle-orm";
79181
79171
  async function getDb3(cwd) {
@@ -79308,7 +79298,7 @@ async function pipelineManifestShow(researchId, projectRoot) {
79308
79298
  try {
79309
79299
  const filePath = join109(root, entry.file);
79310
79300
  if (existsSync111(filePath)) {
79311
- fileContent = readFileSync79(filePath, "utf-8");
79301
+ fileContent = readFileSync78(filePath, "utf-8");
79312
79302
  }
79313
79303
  } catch {
79314
79304
  }
@@ -79697,7 +79687,7 @@ var init_model_provider_registry = __esm({
79697
79687
 
79698
79688
  // packages/core/src/metrics/token-service.ts
79699
79689
  import { createHash as createHash13, randomUUID as randomUUID9 } from "node:crypto";
79700
- import { existsSync as existsSync112, readdirSync as readdirSync37, readFileSync as readFileSync80 } from "node:fs";
79690
+ import { existsSync as existsSync112, readdirSync as readdirSync37, readFileSync as readFileSync79 } from "node:fs";
79701
79691
  import { join as join110 } from "node:path";
79702
79692
  function normalizeProvider(provider, model, runtimeProvider) {
79703
79693
  const value = (provider ?? "").trim().toLowerCase();
@@ -79785,7 +79775,7 @@ function readOtelJsonl(dir) {
79785
79775
  for (const file2 of readdirSync37(dir)) {
79786
79776
  if (!file2.endsWith(".json") && !file2.endsWith(".jsonl")) continue;
79787
79777
  const filePath = join110(dir, file2);
79788
- const raw = readFileSync80(filePath, "utf-8").trim();
79778
+ const raw = readFileSync79(filePath, "utf-8").trim();
79789
79779
  if (!raw) continue;
79790
79780
  for (const line2 of raw.split("\n")) {
79791
79781
  try {
@@ -80174,7 +80164,7 @@ var init_parallel = __esm({
80174
80164
  });
80175
80165
 
80176
80166
  // packages/core/src/orchestration/skill-ops.ts
80177
- import { existsSync as existsSync113, readdirSync as readdirSync38, readFileSync as readFileSync81 } from "node:fs";
80167
+ import { existsSync as existsSync113, readdirSync as readdirSync38, readFileSync as readFileSync80 } from "node:fs";
80178
80168
  import { join as join111 } from "node:path";
80179
80169
  import { getCanonicalSkillsDir as getCanonicalSkillsDir3 } from "@cleocode/caamp";
80180
80170
  function getSkillContent(skillName, projectRoot) {
@@ -80194,7 +80184,7 @@ function getSkillContent(skillName, projectRoot) {
80194
80184
  if (!existsSync113(skillFilePath)) {
80195
80185
  throw new CleoError(4 /* NOT_FOUND */, `Skill file not found: ${skillFilePath}`);
80196
80186
  }
80197
- const content = readFileSync81(skillFilePath, "utf-8");
80187
+ const content = readFileSync80(skillFilePath, "utf-8");
80198
80188
  const refsDir = join111(skillDir, "references");
80199
80189
  let references = [];
80200
80190
  if (existsSync113(refsDir)) {
@@ -80389,7 +80379,7 @@ var init_validate_spawn = __esm({
80389
80379
  });
80390
80380
 
80391
80381
  // packages/core/src/sessions/context-inject.ts
80392
- import { existsSync as existsSync114, readFileSync as readFileSync82 } from "node:fs";
80382
+ import { existsSync as existsSync114, readFileSync as readFileSync81 } from "node:fs";
80393
80383
  import { resolve as resolve11 } from "node:path";
80394
80384
  function resolveRoot2(projectRoot) {
80395
80385
  return projectRoot || getProjectRoot();
@@ -80409,7 +80399,7 @@ function injectContext(protocolType, params, projectRoot) {
80409
80399
  for (const loc of protocolLocations) {
80410
80400
  if (existsSync114(loc)) {
80411
80401
  try {
80412
- protocolContent = readFileSync82(loc, "utf-8");
80402
+ protocolContent = readFileSync81(loc, "utf-8");
80413
80403
  protocolPath = loc.replace(root + "/", "");
80414
80404
  break;
80415
80405
  } catch {
@@ -86109,7 +86099,7 @@ __export(migration_sqlite_exports, {
86109
86099
  migrateJsonToSqlite: () => migrateJsonToSqlite2,
86110
86100
  migrateJsonToSqliteAtomic: () => migrateJsonToSqliteAtomic
86111
86101
  });
86112
- import { existsSync as existsSync117, mkdirSync as mkdirSync25, readFileSync as readFileSync83 } from "node:fs";
86102
+ import { existsSync as existsSync117, mkdirSync as mkdirSync25, readFileSync as readFileSync82 } from "node:fs";
86113
86103
  import { dirname as dirname22, join as join114 } from "node:path";
86114
86104
  function topoSortTasks(tasks2) {
86115
86105
  const taskMap = new Map(tasks2.map((t) => [t.id, t]));
@@ -86148,7 +86138,7 @@ function countJsonRecords(cleoDir) {
86148
86138
  const todoPath = join114(cleoDir, "todo.json");
86149
86139
  if (existsSync117(todoPath)) {
86150
86140
  try {
86151
- const data = JSON.parse(readFileSync83(todoPath, "utf-8"));
86141
+ const data = JSON.parse(readFileSync82(todoPath, "utf-8"));
86152
86142
  tasks2 = (data.tasks ?? []).length;
86153
86143
  } catch {
86154
86144
  }
@@ -86156,7 +86146,7 @@ function countJsonRecords(cleoDir) {
86156
86146
  const archivePath = join114(cleoDir, "todo-archive.json");
86157
86147
  if (existsSync117(archivePath)) {
86158
86148
  try {
86159
- const data = JSON.parse(readFileSync83(archivePath, "utf-8"));
86149
+ const data = JSON.parse(readFileSync82(archivePath, "utf-8"));
86160
86150
  archived = (data.tasks ?? data.archivedTasks ?? []).length;
86161
86151
  } catch {
86162
86152
  }
@@ -86164,7 +86154,7 @@ function countJsonRecords(cleoDir) {
86164
86154
  const sessionsPath = join114(cleoDir, "sessions.json");
86165
86155
  if (existsSync117(sessionsPath)) {
86166
86156
  try {
86167
- const data = JSON.parse(readFileSync83(sessionsPath, "utf-8"));
86157
+ const data = JSON.parse(readFileSync82(sessionsPath, "utf-8"));
86168
86158
  sessions2 = (data.sessions ?? []).length;
86169
86159
  } catch {
86170
86160
  }
@@ -86237,7 +86227,7 @@ async function runMigrationDataImport(db, cleoDir, result, logger) {
86237
86227
  logger?.info("import", "read-todo", "Reading todo.json", {
86238
86228
  path: todoPath.replace(cleoDir, ".")
86239
86229
  });
86240
- const todoData = JSON.parse(readFileSync83(todoPath, "utf-8"));
86230
+ const todoData = JSON.parse(readFileSync82(todoPath, "utf-8"));
86241
86231
  const tasks2 = topoSortTasks(todoData.tasks ?? []);
86242
86232
  const totalTasks = tasks2.length;
86243
86233
  logger?.info("import", "tasks-start", `Starting import of ${totalTasks} tasks`, {
@@ -86317,7 +86307,7 @@ async function runMigrationDataImport(db, cleoDir, result, logger) {
86317
86307
  logger?.info("import", "read-archive", "Reading todo-archive.json", {
86318
86308
  path: archivePath.replace(cleoDir, ".")
86319
86309
  });
86320
- const archiveData = JSON.parse(readFileSync83(archivePath, "utf-8"));
86310
+ const archiveData = JSON.parse(readFileSync82(archivePath, "utf-8"));
86321
86311
  const archivedTasks = topoSortTasks(archiveData.tasks ?? archiveData.archivedTasks ?? []);
86322
86312
  const totalArchived = archivedTasks.length;
86323
86313
  logger?.info(
@@ -86386,7 +86376,7 @@ async function runMigrationDataImport(db, cleoDir, result, logger) {
86386
86376
  logger?.info("import", "read-sessions", "Reading sessions.json", {
86387
86377
  path: sessionsPath.replace(cleoDir, ".")
86388
86378
  });
86389
- const sessionsData = JSON.parse(readFileSync83(sessionsPath, "utf-8"));
86379
+ const sessionsData = JSON.parse(readFileSync82(sessionsPath, "utf-8"));
86390
86380
  const sessions2 = sessionsData.sessions ?? [];
86391
86381
  const totalSessions = sessions2.length;
86392
86382
  logger?.info("import", "sessions-start", `Starting import of ${totalSessions} sessions`, {
@@ -86516,7 +86506,7 @@ async function migrateJsonToSqlite2(cwd, options) {
86516
86506
  const todoPath = join114(cleoDir, "todo.json");
86517
86507
  if (existsSync117(todoPath)) {
86518
86508
  try {
86519
- const todoData = JSON.parse(readFileSync83(todoPath, "utf-8"));
86509
+ const todoData = JSON.parse(readFileSync82(todoPath, "utf-8"));
86520
86510
  const tasks2 = topoSortTasks(todoData.tasks ?? []);
86521
86511
  for (const task of tasks2) {
86522
86512
  try {
@@ -86568,7 +86558,7 @@ async function migrateJsonToSqlite2(cwd, options) {
86568
86558
  const archivePath = join114(cleoDir, "todo-archive.json");
86569
86559
  if (existsSync117(archivePath)) {
86570
86560
  try {
86571
- const archiveData = JSON.parse(readFileSync83(archivePath, "utf-8"));
86561
+ const archiveData = JSON.parse(readFileSync82(archivePath, "utf-8"));
86572
86562
  const archivedTasks = topoSortTasks(archiveData.tasks ?? archiveData.archivedTasks ?? []);
86573
86563
  for (const task of archivedTasks) {
86574
86564
  try {
@@ -86606,7 +86596,7 @@ async function migrateJsonToSqlite2(cwd, options) {
86606
86596
  const sessionsPath = join114(cleoDir, "sessions.json");
86607
86597
  if (existsSync117(sessionsPath)) {
86608
86598
  try {
86609
- const sessionsData = JSON.parse(readFileSync83(sessionsPath, "utf-8"));
86599
+ const sessionsData = JSON.parse(readFileSync82(sessionsPath, "utf-8"));
86610
86600
  const sessions2 = sessionsData.sessions ?? [];
86611
86601
  for (const session of sessions2) {
86612
86602
  try {
@@ -86787,8 +86777,8 @@ import {
86787
86777
  existsSync as existsSync118,
86788
86778
  mkdirSync as mkdirSync26,
86789
86779
  readdirSync as readdirSync39,
86790
- readFileSync as readFileSync84,
86791
- writeFileSync as writeFileSync21
86780
+ readFileSync as readFileSync83,
86781
+ writeFileSync as writeFileSync20
86792
86782
  } from "node:fs";
86793
86783
  import { join as join115 } from "node:path";
86794
86784
  async function runUpgrade(options = {}) {
@@ -86878,8 +86868,8 @@ async function runUpgrade(options = {}) {
86878
86868
  }
86879
86869
  copyFileSync9(dbPath2, dbBackupPath);
86880
86870
  const { createHash: createHash14 } = await import("node:crypto");
86881
- const origChecksum = createHash14("sha256").update(readFileSync84(dbPath2)).digest("hex");
86882
- const backupChecksum = createHash14("sha256").update(readFileSync84(dbBackupPath)).digest("hex");
86871
+ const origChecksum = createHash14("sha256").update(readFileSync83(dbPath2)).digest("hex");
86872
+ const backupChecksum = createHash14("sha256").update(readFileSync83(dbBackupPath)).digest("hex");
86883
86873
  if (origChecksum !== backupChecksum) {
86884
86874
  throw new Error(
86885
86875
  `Backup verification failed: checksum mismatch. Aborting migration to prevent data loss.`
@@ -86903,7 +86893,7 @@ async function runUpgrade(options = {}) {
86903
86893
  const configPath = join115(cleoDir2, "config.json");
86904
86894
  let configBackup = null;
86905
86895
  if (existsSync118(configPath)) {
86906
- configBackup = readFileSync84(configPath, "utf-8");
86896
+ configBackup = readFileSync83(configPath, "utf-8");
86907
86897
  }
86908
86898
  const { resetDbState: resetDbState2 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
86909
86899
  resetDbState2();
@@ -86934,7 +86924,7 @@ async function runUpgrade(options = {}) {
86934
86924
  if (totalImported === 0 && existsSync118(dbBackupPath)) {
86935
86925
  copyFileSync9(dbBackupPath, dbPath2);
86936
86926
  if (configBackup) {
86937
- writeFileSync21(configPath, configBackup);
86927
+ writeFileSync20(configPath, configBackup);
86938
86928
  }
86939
86929
  actions.push({
86940
86930
  action: "storage_migration",
@@ -86947,7 +86937,7 @@ async function runUpgrade(options = {}) {
86947
86937
  let config2 = {};
86948
86938
  if (existsSync118(configPath)) {
86949
86939
  try {
86950
- config2 = JSON.parse(readFileSync84(configPath, "utf-8"));
86940
+ config2 = JSON.parse(readFileSync83(configPath, "utf-8"));
86951
86941
  } catch {
86952
86942
  }
86953
86943
  }
@@ -86955,7 +86945,7 @@ async function runUpgrade(options = {}) {
86955
86945
  config2.storage = {};
86956
86946
  }
86957
86947
  config2.storage.engine = "sqlite";
86958
- writeFileSync21(configPath, JSON.stringify(config2, null, 2));
86948
+ writeFileSync20(configPath, JSON.stringify(config2, null, 2));
86959
86949
  actions.push({
86960
86950
  action: "storage_migration",
86961
86951
  status: "applied",
@@ -86977,7 +86967,7 @@ async function runUpgrade(options = {}) {
86977
86967
  copyFileSync9(dbBackupPath, dbPath2);
86978
86968
  }
86979
86969
  if (configBackup) {
86980
- writeFileSync21(configPath, configBackup);
86970
+ writeFileSync20(configPath, configBackup);
86981
86971
  }
86982
86972
  await updateMigrationPhase2(cleoDir2, "failed");
86983
86973
  for (const error48 of result.errors) {
@@ -87205,7 +87195,7 @@ async function runUpgrade(options = {}) {
87205
87195
  });
87206
87196
  } else {
87207
87197
  try {
87208
- const context = JSON.parse(readFileSync84(contextPath, "utf-8"));
87198
+ const context = JSON.parse(readFileSync83(contextPath, "utf-8"));
87209
87199
  if (context.detectedAt) {
87210
87200
  const daysSince = (Date.now() - new Date(context.detectedAt).getTime()) / (1e3 * 60 * 60 * 24);
87211
87201
  if (daysSince > 30) {
@@ -88888,10 +88878,10 @@ var init_param_utils = __esm({
88888
88878
  });
88889
88879
 
88890
88880
  // packages/core/src/validation/protocols/_shared.ts
88891
- import { existsSync as existsSync119, readFileSync as readFileSync85 } from "node:fs";
88881
+ import { existsSync as existsSync119, readFileSync as readFileSync84 } from "node:fs";
88892
88882
  function findManifestEntry2(taskId, manifestPath) {
88893
88883
  if (!existsSync119(manifestPath)) return null;
88894
- const content = readFileSync85(manifestPath, "utf-8").trim();
88884
+ const content = readFileSync84(manifestPath, "utf-8").trim();
88895
88885
  if (content.length === 0) return null;
88896
88886
  const lines = content.split("\n");
88897
88887
  for (let i = lines.length - 1; i >= 0; i--) {
@@ -88918,7 +88908,7 @@ function loadManifestEntryFromFile(manifestFile) {
88918
88908
  details: { field: "manifestFile", actual: manifestFile }
88919
88909
  });
88920
88910
  }
88921
- return JSON.parse(readFileSync85(manifestFile, "utf-8"));
88911
+ return JSON.parse(readFileSync84(manifestFile, "utf-8"));
88922
88912
  }
88923
88913
  function throwIfStrictFailed(result, opts, protocol, taskId) {
88924
88914
  if (!opts.strict || result.valid) return;
@@ -88988,10 +88978,10 @@ var init_artifact_publish = __esm({
88988
88978
  });
88989
88979
 
88990
88980
  // packages/core/src/validation/protocols/consensus.ts
88991
- import { existsSync as existsSync120, readFileSync as readFileSync86 } from "node:fs";
88981
+ import { existsSync as existsSync120, readFileSync as readFileSync85 } from "node:fs";
88992
88982
  function loadVotingMatrix(votingMatrixFile) {
88993
88983
  if (!votingMatrixFile || !existsSync120(votingMatrixFile)) return { options: [] };
88994
- const raw = JSON.parse(readFileSync86(votingMatrixFile, "utf-8"));
88984
+ const raw = JSON.parse(readFileSync85(votingMatrixFile, "utf-8"));
88995
88985
  const options = Array.isArray(raw.options) ? raw.options : Object.values(raw.options ?? {});
88996
88986
  return {
88997
88987
  options: options.filter(
@@ -89156,10 +89146,10 @@ var init_research4 = __esm({
89156
89146
  });
89157
89147
 
89158
89148
  // packages/core/src/validation/protocols/specification.ts
89159
- import { existsSync as existsSync121, readFileSync as readFileSync87 } from "node:fs";
89149
+ import { existsSync as existsSync121, readFileSync as readFileSync86 } from "node:fs";
89160
89150
  async function validateSpecificationTask(taskId, opts) {
89161
89151
  const entry = loadManifestEntryByTaskId(taskId);
89162
- const specContent = opts.specFile && existsSync121(opts.specFile) ? readFileSync87(opts.specFile, "utf-8") : void 0;
89152
+ const specContent = opts.specFile && existsSync121(opts.specFile) ? readFileSync86(opts.specFile, "utf-8") : void 0;
89163
89153
  const result = validateSpecificationProtocol(entry, specContent);
89164
89154
  throwIfStrictFailed(result, opts, "specification", taskId);
89165
89155
  return result;
@@ -89167,7 +89157,7 @@ async function validateSpecificationTask(taskId, opts) {
89167
89157
  async function checkSpecificationManifest(manifestFile, opts) {
89168
89158
  const entry = loadManifestEntryFromFile(manifestFile);
89169
89159
  const taskId = entry.linked_tasks?.[0] ?? "UNKNOWN";
89170
- const specContent = opts.specFile && existsSync121(opts.specFile) ? readFileSync87(opts.specFile, "utf-8") : void 0;
89160
+ const specContent = opts.specFile && existsSync121(opts.specFile) ? readFileSync86(opts.specFile, "utf-8") : void 0;
89171
89161
  const result = validateSpecificationProtocol(entry, specContent);
89172
89162
  throwIfStrictFailed(result, opts, "specification", taskId);
89173
89163
  return result;
@@ -89227,7 +89217,7 @@ var init_validation3 = __esm({
89227
89217
  // packages/core/src/validation/schema-validator.ts
89228
89218
  import AjvModule from "ajv";
89229
89219
  import addFormatsModule from "ajv-formats";
89230
- import { readFileSync as readFileSync88 } from "fs";
89220
+ import { readFileSync as readFileSync87 } from "fs";
89231
89221
  function createAjv() {
89232
89222
  const ajv = new Ajv3({
89233
89223
  allErrors: true,
@@ -89256,7 +89246,7 @@ function getValidator(schemaType) {
89256
89246
  return null;
89257
89247
  }
89258
89248
  try {
89259
- const schemaContent = readFileSync88(schemaPath, "utf-8");
89249
+ const schemaContent = readFileSync87(schemaPath, "utf-8");
89260
89250
  const schema = JSON.parse(schemaContent);
89261
89251
  const ajv = getAjv2();
89262
89252
  const validate = ajv.compile(schema);
@@ -89310,11 +89300,11 @@ var init_schema_validator = __esm({
89310
89300
 
89311
89301
  // packages/core/src/validation/validate-ops.ts
89312
89302
  import { execFileSync as execFileSync12 } from "node:child_process";
89313
- import { appendFileSync as appendFileSync10, existsSync as existsSync122, mkdirSync as mkdirSync27, readFileSync as readFileSync89 } from "node:fs";
89303
+ import { appendFileSync as appendFileSync10, existsSync as existsSync122, mkdirSync as mkdirSync27, readFileSync as readFileSync88 } from "node:fs";
89314
89304
  import { dirname as dirname23, join as join116, resolve as resolve12 } from "node:path";
89315
89305
  function readJsonFile2(filePath) {
89316
89306
  try {
89317
- const raw = readFileSync89(filePath, "utf-8");
89307
+ const raw = readFileSync88(filePath, "utf-8");
89318
89308
  return JSON.parse(raw);
89319
89309
  } catch {
89320
89310
  return null;
@@ -89479,7 +89469,7 @@ function coreValidateManifest(projectRoot) {
89479
89469
  message: "No manifest file found"
89480
89470
  };
89481
89471
  }
89482
- const content = readFileSync89(manifestPath, "utf-8");
89472
+ const content = readFileSync88(manifestPath, "utf-8");
89483
89473
  const lines = content.split("\n").filter((l) => l.trim());
89484
89474
  let validCount = 0;
89485
89475
  let invalidCount = 0;
@@ -89523,7 +89513,7 @@ function coreValidateOutput(filePath, taskId, projectRoot) {
89523
89513
  if (!existsSync122(fullPath)) {
89524
89514
  throw new Error(`Output file not found: ${filePath}`);
89525
89515
  }
89526
- const content = readFileSync89(fullPath, "utf-8");
89516
+ const content = readFileSync88(fullPath, "utf-8");
89527
89517
  const issues = [];
89528
89518
  if (!content.includes("# ")) {
89529
89519
  issues.push({
@@ -89559,7 +89549,7 @@ function parseComplianceEntries(projectRoot) {
89559
89549
  if (!existsSync122(compliancePath)) {
89560
89550
  return [];
89561
89551
  }
89562
- const content = readFileSync89(compliancePath, "utf-8");
89552
+ const content = readFileSync88(compliancePath, "utf-8");
89563
89553
  const entries = [];
89564
89554
  for (const line2 of content.split("\n")) {
89565
89555
  const trimmed = line2.trim();
@@ -89906,7 +89896,7 @@ var init_validate_ops = __esm({
89906
89896
  });
89907
89897
 
89908
89898
  // packages/core/src/orchestration/bootstrap.ts
89909
- import { existsSync as existsSync123, readFileSync as readFileSync90 } from "node:fs";
89899
+ import { existsSync as existsSync123, readFileSync as readFileSync89 } from "node:fs";
89910
89900
  import { join as join117 } from "node:path";
89911
89901
  async function buildBrainState(projectRoot, opts, accessor) {
89912
89902
  const speed = opts?.speed || "fast";
@@ -89975,7 +89965,7 @@ async function buildBrainState(projectRoot, opts, accessor) {
89975
89965
  try {
89976
89966
  const decisionLogPath = join117(projectRoot, ".cleo", "decision-log.jsonl");
89977
89967
  if (existsSync123(decisionLogPath)) {
89978
- const content = readFileSync90(decisionLogPath, "utf-8").trim();
89968
+ const content = readFileSync89(decisionLogPath, "utf-8").trim();
89979
89969
  if (content) {
89980
89970
  const entries = content.split("\n").filter((l) => l.trim()).map((l) => {
89981
89971
  try {
@@ -89997,7 +89987,7 @@ async function buildBrainState(projectRoot, opts, accessor) {
89997
89987
  try {
89998
89988
  const contextStatePath = join117(projectRoot, ".cleo", ".context-state.json");
89999
89989
  if (existsSync123(contextStatePath)) {
90000
- const state = JSON.parse(readFileSync90(contextStatePath, "utf-8"));
89990
+ const state = JSON.parse(readFileSync89(contextStatePath, "utf-8"));
90001
89991
  const percentage = state.contextWindow?.percentage ?? 0;
90002
89992
  const factors = [];
90003
89993
  if (percentage > 80) factors.push("high_context_usage");
@@ -97343,13 +97333,13 @@ var init_backup_unpack = __esm({
97343
97333
 
97344
97334
  // packages/core/src/store/regenerators.ts
97345
97335
  import { randomUUID as randomUUID10 } from "node:crypto";
97346
- import { existsSync as existsSync124, readFileSync as readFileSync91 } from "node:fs";
97336
+ import { existsSync as existsSync124, readFileSync as readFileSync90 } from "node:fs";
97347
97337
  import { join as join118, resolve as resolve13 } from "node:path";
97348
97338
  function isContributorProject(projectRoot) {
97349
97339
  const at2 = (p2) => existsSync124(join118(projectRoot, p2));
97350
97340
  if (!at2("src/dispatch") || !at2("src/core")) return false;
97351
97341
  try {
97352
- const pkg = JSON.parse(readFileSync91(join118(projectRoot, "package.json"), "utf-8"));
97342
+ const pkg = JSON.parse(readFileSync90(join118(projectRoot, "package.json"), "utf-8"));
97353
97343
  return pkg.name === "@cleocode/cleo";
97354
97344
  } catch {
97355
97345
  return false;
@@ -98355,7 +98345,7 @@ var init_api_key_kdf = __esm({
98355
98345
 
98356
98346
  // packages/core/src/store/agent-registry-accessor.ts
98357
98347
  import { randomBytes as randomBytes16 } from "node:crypto";
98358
- import { existsSync as existsSync125, mkdirSync as mkdirSync28, readFileSync as readFileSync92, statSync as statSync21, writeFileSync as writeFileSync22 } from "node:fs";
98348
+ import { existsSync as existsSync125, mkdirSync as mkdirSync28, readFileSync as readFileSync91, statSync as statSync21, writeFileSync as writeFileSync21 } from "node:fs";
98359
98349
  import { createRequire as createRequire12 } from "node:module";
98360
98350
  import { join as join120 } from "node:path";
98361
98351
  function readMachineKey() {
@@ -98366,7 +98356,7 @@ function readMachineKey() {
98366
98356
  mkdirSync28(cleoHome, { recursive: true });
98367
98357
  }
98368
98358
  const key2 = randomBytes16(MACHINE_KEY_LENGTH);
98369
- writeFileSync22(keyPath, key2, { mode: 384 });
98359
+ writeFileSync21(keyPath, key2, { mode: 384 });
98370
98360
  return key2;
98371
98361
  }
98372
98362
  if (process.platform !== "win32") {
@@ -98378,7 +98368,7 @@ function readMachineKey() {
98378
98368
  );
98379
98369
  }
98380
98370
  }
98381
- const key = readFileSync92(keyPath);
98371
+ const key = readFileSync91(keyPath);
98382
98372
  if (key.length !== MACHINE_KEY_LENGTH) {
98383
98373
  throw new Error(
98384
98374
  `Machine key at ${keyPath} has wrong length: expected ${MACHINE_KEY_LENGTH} bytes, got ${key.length}.`
@@ -102620,13 +102610,19 @@ var init_registry5 = __esm({
102620
102610
  tier: 0,
102621
102611
  idempotent: false,
102622
102612
  sessionRequired: true,
102623
- requiredParams: ["id"],
102613
+ requiredParams: ["taskId", "agentId"],
102624
102614
  params: [
102625
102615
  {
102626
- name: "id",
102616
+ name: "taskId",
102627
102617
  type: "string",
102628
102618
  required: true,
102629
102619
  description: "Task ID to claim"
102620
+ },
102621
+ {
102622
+ name: "agentId",
102623
+ type: "string",
102624
+ required: true,
102625
+ description: "Agent ID to assign the task to"
102630
102626
  }
102631
102627
  ]
102632
102628
  },
@@ -102638,10 +102634,10 @@ var init_registry5 = __esm({
102638
102634
  tier: 0,
102639
102635
  idempotent: false,
102640
102636
  sessionRequired: true,
102641
- requiredParams: ["id"],
102637
+ requiredParams: ["taskId"],
102642
102638
  params: [
102643
102639
  {
102644
- name: "id",
102640
+ name: "taskId",
102645
102641
  type: "string",
102646
102642
  required: true,
102647
102643
  description: "Task ID to unclaim"
@@ -106261,7 +106257,7 @@ var init_pipeline_engine = __esm({
106261
106257
 
106262
106258
  // packages/cleo/src/dispatch/engines/release-engine.ts
106263
106259
  import { execFileSync as execFileSync14 } from "node:child_process";
106264
- import { readFileSync as readFileSync93 } from "node:fs";
106260
+ import { readFileSync as readFileSync92 } from "node:fs";
106265
106261
  async function loadTasks2(projectRoot) {
106266
106262
  const root = projectRoot ?? resolveProjectRoot();
106267
106263
  try {
@@ -106512,7 +106508,7 @@ async function releaseShip(params, projectRoot) {
106512
106508
  const changelogPath = `${cwd}/CHANGELOG.md`;
106513
106509
  const cleanVersion = version2.replace(/^v/, "");
106514
106510
  try {
106515
- const changelogContent = readFileSync93(changelogPath, "utf8");
106511
+ const changelogContent = readFileSync92(changelogPath, "utf8");
106516
106512
  if (!changelogContent.includes(`## [${cleanVersion}]`)) {
106517
106513
  logStep(
106518
106514
  4,
@@ -106766,7 +106762,7 @@ __export(system_engine_exports, {
106766
106762
  systemSync: () => systemSync,
106767
106763
  systemUncancel: () => systemUncancel
106768
106764
  });
106769
- import { existsSync as existsSync126, readdirSync as readdirSync40, readFileSync as readFileSync94 } from "node:fs";
106765
+ import { existsSync as existsSync126, readdirSync as readdirSync40, readFileSync as readFileSync93 } from "node:fs";
106770
106766
  import { basename as basename18, join as join121 } from "node:path";
106771
106767
  async function systemDash(projectRoot, params) {
106772
106768
  try {
@@ -107005,7 +107001,7 @@ function systemContext(projectRoot, params) {
107005
107001
  } else {
107006
107002
  const currentSessionPath = join121(cleoDir, ".current-session");
107007
107003
  if (existsSync126(currentSessionPath)) {
107008
- const currentSession2 = readFileSync94(currentSessionPath, "utf-8").trim();
107004
+ const currentSession2 = readFileSync93(currentSessionPath, "utf-8").trim();
107009
107005
  if (currentSession2) {
107010
107006
  const sessionFile = join121(
107011
107007
  cleoDir,
@@ -107026,7 +107022,7 @@ function systemContext(projectRoot, params) {
107026
107022
  for (const file2 of readdirSync40(statesDir)) {
107027
107023
  if (file2.startsWith("context-state-") && file2.endsWith(".json")) {
107028
107024
  try {
107029
- const state = JSON.parse(readFileSync94(join121(statesDir, file2), "utf-8"));
107025
+ const state = JSON.parse(readFileSync93(join121(statesDir, file2), "utf-8"));
107030
107026
  sessions2.push({
107031
107027
  file: basename18(file2),
107032
107028
  sessionId: state.sessionId ?? null,
@@ -107042,7 +107038,7 @@ function systemContext(projectRoot, params) {
107042
107038
  const singletonFile = join121(cleoDir, ".context-state.json");
107043
107039
  if (existsSync126(singletonFile)) {
107044
107040
  try {
107045
- const state = JSON.parse(readFileSync94(singletonFile, "utf-8"));
107041
+ const state = JSON.parse(readFileSync93(singletonFile, "utf-8"));
107046
107042
  sessions2.push({
107047
107043
  file: ".context-state.json",
107048
107044
  sessionId: state.sessionId ?? "global",
@@ -107069,7 +107065,7 @@ function systemContext(projectRoot, params) {
107069
107065
  };
107070
107066
  }
107071
107067
  try {
107072
- const state = JSON.parse(readFileSync94(stateFile, "utf-8"));
107068
+ const state = JSON.parse(readFileSync93(stateFile, "utf-8"));
107073
107069
  const timestamp2 = state.timestamp;
107074
107070
  const staleMs = state.staleAfterMs ?? 5e3;
107075
107071
  const percentage = state.contextWindow?.percentage ?? 0;
@@ -107224,7 +107220,7 @@ function systemCompliance(projectRoot, params) {
107224
107220
  const compliancePath2 = join121(projectRoot, ".cleo", "metrics", "COMPLIANCE.jsonl");
107225
107221
  let entries2 = [];
107226
107222
  if (existsSync126(compliancePath2)) {
107227
- const content = readFileSync94(compliancePath2, "utf-8").trim();
107223
+ const content = readFileSync93(compliancePath2, "utf-8").trim();
107228
107224
  if (content) {
107229
107225
  entries2 = content.split("\n").filter((l) => l.trim()).map((l) => JSON.parse(l));
107230
107226
  }
@@ -107291,7 +107287,7 @@ function systemCompliance(projectRoot, params) {
107291
107287
  const compliancePath = join121(projectRoot, ".cleo", "metrics", "COMPLIANCE.jsonl");
107292
107288
  let entries = [];
107293
107289
  if (existsSync126(compliancePath)) {
107294
- const content = readFileSync94(compliancePath, "utf-8").trim();
107290
+ const content = readFileSync93(compliancePath, "utf-8").trim();
107295
107291
  if (content) {
107296
107292
  entries = content.split("\n").filter((l) => l.trim()).map((l) => JSON.parse(l));
107297
107293
  }
@@ -107437,9 +107433,9 @@ function systemSync(_projectRoot, params) {
107437
107433
  }
107438
107434
  };
107439
107435
  }
107440
- function systemSafestop(projectRoot, params) {
107436
+ async function systemSafestop(projectRoot, params) {
107441
107437
  try {
107442
- const result = safestop(projectRoot, params);
107438
+ const result = await safestop(projectRoot, params);
107443
107439
  return { success: true, data: result };
107444
107440
  } catch (err) {
107445
107441
  return cleoErrorToEngineError(err, "E_GENERAL", "Sync failed");
@@ -108032,13 +108028,16 @@ async function taskDelete(projectRoot, taskId, force) {
108032
108028
  return cleoErrorToEngineError(err, "E_NOT_INITIALIZED", "Task database not initialized");
108033
108029
  }
108034
108030
  }
108035
- async function taskArchive(projectRoot, taskId, before) {
108031
+ async function taskArchive(projectRoot, taskId, before, opts) {
108036
108032
  try {
108037
108033
  const accessor = await getAccessor(projectRoot);
108034
+ const taskIds = opts?.taskIds ?? (taskId ? [taskId] : void 0);
108038
108035
  const result = await archiveTasks(
108039
108036
  {
108040
- taskIds: taskId ? [taskId] : void 0,
108041
- before
108037
+ taskIds,
108038
+ before,
108039
+ includeCancelled: opts?.includeCancelled,
108040
+ dryRun: opts?.dryRun
108042
108041
  },
108043
108042
  projectRoot,
108044
108043
  accessor
@@ -109624,7 +109623,7 @@ var init_admin2 = __esm({
109624
109623
  );
109625
109624
  }
109626
109625
  case "safestop": {
109627
- const result = systemSafestop(
109626
+ const result = await systemSafestop(
109628
109627
  projectRoot,
109629
109628
  params
109630
109629
  );
@@ -111740,7 +111739,7 @@ var init_nexus2 = __esm({
111740
111739
  async function orchestrateClassify(request, context, projectRoot) {
111741
111740
  try {
111742
111741
  const { getCleoCantWorkflowsDir: getCleoCantWorkflowsDir2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
111743
- const { readFileSync: readFileSync103, readdirSync: readdirSync42, existsSync: existsSync131 } = await import("node:fs");
111742
+ const { readFileSync: readFileSync102, readdirSync: readdirSync42, existsSync: existsSync131 } = await import("node:fs");
111744
111743
  const { join: join131 } = await import("node:path");
111745
111744
  const workflowsDir = getCleoCantWorkflowsDir2();
111746
111745
  const combined = `${request} ${context ?? ""}`.toLowerCase();
@@ -111749,7 +111748,7 @@ async function orchestrateClassify(request, context, projectRoot) {
111749
111748
  const files = readdirSync42(workflowsDir).filter((f2) => f2.endsWith(".cant"));
111750
111749
  for (const file2 of files) {
111751
111750
  try {
111752
- const src = readFileSync103(join131(workflowsDir, file2), "utf-8");
111751
+ const src = readFileSync102(join131(workflowsDir, file2), "utf-8");
111753
111752
  const teamMatch = /^team\s+(\S+):/m.exec(src);
111754
111753
  if (!teamMatch) continue;
111755
111754
  const teamName = teamMatch[1];
@@ -111769,7 +111768,7 @@ async function orchestrateClassify(request, context, projectRoot) {
111769
111768
  const files = readdirSync42(localCantDir).filter((f2) => f2.endsWith(".cant"));
111770
111769
  for (const file2 of files) {
111771
111770
  try {
111772
- const src = readFileSync103(join131(localCantDir, file2), "utf-8");
111771
+ const src = readFileSync102(join131(localCantDir, file2), "utf-8");
111773
111772
  const teamMatch = /^team\s+(\S+):/m.exec(src);
111774
111773
  if (!teamMatch) continue;
111775
111774
  const teamName = teamMatch[1];
@@ -114270,7 +114269,12 @@ var init_tasks4 = __esm({
114270
114269
  const result = await taskArchive(
114271
114270
  projectRoot,
114272
114271
  params?.taskId,
114273
- params?.before
114272
+ params?.before,
114273
+ {
114274
+ taskIds: params?.taskIds,
114275
+ includeCancelled: params?.includeCancelled,
114276
+ dryRun: params?.dryRun
114277
+ }
114274
114278
  );
114275
114279
  return wrapResult(result, "mutate", "tasks", operation, startTime);
114276
114280
  }
@@ -115657,7 +115661,7 @@ var init_defaults = __esm({
115657
115661
  });
115658
115662
 
115659
115663
  // packages/cleo/src/dispatch/lib/config-loader.ts
115660
- import { existsSync as existsSync127, readFileSync as readFileSync95 } from "fs";
115664
+ import { existsSync as existsSync127, readFileSync as readFileSync94 } from "fs";
115661
115665
  import { join as join123 } from "path";
115662
115666
  function loadFromEnv(key) {
115663
115667
  const envKey = `${ENV_PREFIX}${key.toUpperCase()}`;
@@ -115684,7 +115688,7 @@ function loadFromFile(projectRoot) {
115684
115688
  return {};
115685
115689
  }
115686
115690
  try {
115687
- const content = readFileSync95(configPath, "utf-8");
115691
+ const content = readFileSync94(configPath, "utf-8");
115688
115692
  const config2 = JSON.parse(content);
115689
115693
  const result = {};
115690
115694
  if (config2.lifecycleEnforcement) {
@@ -116309,7 +116313,7 @@ var init_cli = __esm({
116309
116313
 
116310
116314
  // packages/cleo/src/cli/index.ts
116311
116315
  init_internal();
116312
- import { readFileSync as readFileSync102 } from "node:fs";
116316
+ import { readFileSync as readFileSync101 } from "node:fs";
116313
116317
  import { dirname as dirname28, join as join130 } from "node:path";
116314
116318
  import { fileURLToPath as fileURLToPath5 } from "node:url";
116315
116319
 
@@ -117465,7 +117469,7 @@ function registerAddCommand(program) {
117465
117469
  // packages/cleo/src/cli/commands/add-batch.ts
117466
117470
  init_cli();
117467
117471
  init_renderers();
117468
- import { readFileSync as readFileSync96 } from "node:fs";
117472
+ import { readFileSync as readFileSync95 } from "node:fs";
117469
117473
  function registerAddBatchCommand(program) {
117470
117474
  program.command("add-batch").description("Create multiple tasks atomically from a JSON file").option("--file <path>", "Path to JSON file (array of task objects). Use - for stdin.").option("--parent <parentId>", "Default parent for all tasks (overridden by per-task parent)").option("--dry-run", "Preview what would be created without making changes").action(async (opts) => {
117471
117475
  const filePath = opts["file"];
@@ -117479,7 +117483,7 @@ function registerAddBatchCommand(program) {
117479
117483
  }
117480
117484
  raw = Buffer.concat(chunks).toString("utf-8");
117481
117485
  } else {
117482
- raw = readFileSync96(filePath, "utf-8");
117486
+ raw = readFileSync95(filePath, "utf-8");
117483
117487
  }
117484
117488
  let tasks2;
117485
117489
  try {
@@ -117768,7 +117772,7 @@ function registerAgentCommand(program) {
117768
117772
  transportConfig: {},
117769
117773
  isActive: true
117770
117774
  });
117771
- const { existsSync: existsSync131, mkdirSync: mkdirSync31, writeFileSync: writeFileSync25 } = await import("node:fs");
117775
+ const { existsSync: existsSync131, mkdirSync: mkdirSync31, writeFileSync: writeFileSync24 } = await import("node:fs");
117772
117776
  const { join: join131 } = await import("node:path");
117773
117777
  const cantDir = join131(".cleo", "agents");
117774
117778
  const cantPath = join131(cantDir, `${agentId}.cant`);
@@ -117824,7 +117828,7 @@ agent ${agentId}:
117824
117828
  enforcement:
117825
117829
  1: TODO \u2014 what does this agent push back on?
117826
117830
  `;
117827
- writeFileSync25(cantPath, cantContent, "utf-8");
117831
+ writeFileSync24(cantPath, cantContent, "utf-8");
117828
117832
  cantScaffolded = true;
117829
117833
  }
117830
117834
  cliOutput(
@@ -117913,7 +117917,7 @@ agent ${agentId}:
117913
117917
  try {
117914
117918
  const { AgentRegistryAccessor: AgentRegistryAccessor2, getDb: getDb4 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
117915
117919
  const { createRuntime } = await import("@cleocode/runtime");
117916
- const { existsSync: existsSync131, readFileSync: readFileSync103 } = await import("node:fs");
117920
+ const { existsSync: existsSync131, readFileSync: readFileSync102 } = await import("node:fs");
117917
117921
  const { join: join131 } = await import("node:path");
117918
117922
  await getDb4();
117919
117923
  const registry2 = new AgentRegistryAccessor2(process.cwd());
@@ -117936,7 +117940,7 @@ agent ${agentId}:
117936
117940
  let cantValidation = null;
117937
117941
  const cantPath = opts["cant"] ?? join131(".cleo", "agents", `${agentId}.cant`);
117938
117942
  if (existsSync131(cantPath)) {
117939
- profile = readFileSync103(cantPath, "utf-8");
117943
+ profile = readFileSync102(cantPath, "utf-8");
117940
117944
  try {
117941
117945
  const cantModule = await import("@cleocode/cant");
117942
117946
  const validate = "validate" in cantModule ? cantModule.validate : null;
@@ -118976,7 +118980,7 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
118976
118980
  });
118977
118981
  agent.command("install <path>").description("Install an agent from a .cantz archive or agent directory").option("--global", "Install to global tier (~/.local/share/cleo/cant/agents/)").action(async (sourcePath, opts) => {
118978
118982
  try {
118979
- const { existsSync: existsSync131, mkdirSync: mkdirSync31, cpSync, readFileSync: readFileSync103, rmSync: rmSync3, statSync: statSync22 } = await import("node:fs");
118983
+ const { existsSync: existsSync131, mkdirSync: mkdirSync31, cpSync, readFileSync: readFileSync102, rmSync: rmSync3, statSync: statSync22 } = await import("node:fs");
118980
118984
  const { join: join131, basename: basename19, resolve: resolve16 } = await import("node:path");
118981
118985
  const { homedir: homedir7 } = await import("node:os");
118982
118986
  const { tmpdir: tmpdir3 } = await import("node:os");
@@ -119095,7 +119099,7 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
119095
119099
  }
119096
119100
  let registered = false;
119097
119101
  try {
119098
- const persona = readFileSync103(join131(targetDir, "persona.cant"), "utf-8");
119102
+ const persona = readFileSync102(join131(targetDir, "persona.cant"), "utf-8");
119099
119103
  const descMatch = persona.match(/description:\s*"([^"]+)"/);
119100
119104
  const displayName = descMatch?.[1] ?? agentName;
119101
119105
  const { AgentRegistryAccessor: AgentRegistryAccessor2, getDb: getDb4 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
@@ -119236,7 +119240,7 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
119236
119240
  });
119237
119241
  agent.command("create").description("Scaffold a new agent package with persona.cant and manifest.json").requiredOption("--name <name>", "Agent name (kebab-case)").requiredOption("--role <role>", "Agent role: orchestrator, lead, worker, or docs-worker").option("--tier <tier>", "Agent tier: low, mid, or high (defaults based on role)").option("--team <teamName>", "Team this agent belongs to").option("--domain <description>", "Domain description for file permissions and context").option("--global", "Create in global tier (~/.local/share/cleo/cant/agents/)").option("--seed-brain", "Create expertise/mental-model-seed.md and seed a BRAIN observation").option("--parent <parentAgent>", "Parent agent name in the hierarchy").action(async (opts) => {
119238
119242
  try {
119239
- const { existsSync: existsSync131, mkdirSync: mkdirSync31, writeFileSync: writeFileSync25 } = await import("node:fs");
119243
+ const { existsSync: existsSync131, mkdirSync: mkdirSync31, writeFileSync: writeFileSync24 } = await import("node:fs");
119240
119244
  const { join: join131 } = await import("node:path");
119241
119245
  const { homedir: homedir7 } = await import("node:os");
119242
119246
  const name2 = opts["name"];
@@ -119327,9 +119331,9 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
119327
119331
  domain: domain2,
119328
119332
  parent
119329
119333
  });
119330
- writeFileSync25(join131(agentDir, "persona.cant"), personaContent, "utf-8");
119334
+ writeFileSync24(join131(agentDir, "persona.cant"), personaContent, "utf-8");
119331
119335
  const manifest = generateManifest2({ name: name2, role, tier, domain: domain2 });
119332
- writeFileSync25(
119336
+ writeFileSync24(
119333
119337
  join131(agentDir, "manifest.json"),
119334
119338
  `${JSON.stringify(manifest, null, 2)}
119335
119339
  `,
@@ -119341,14 +119345,14 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
119341
119345
  ];
119342
119346
  if (team) {
119343
119347
  const teamConfigContent = generateTeamConfig(name2, role, team);
119344
- writeFileSync25(join131(agentDir, "team-config.cant"), teamConfigContent, "utf-8");
119348
+ writeFileSync24(join131(agentDir, "team-config.cant"), teamConfigContent, "utf-8");
119345
119349
  createdFiles.push(join131(agentDir, "team-config.cant"));
119346
119350
  }
119347
119351
  if (seedBrain) {
119348
119352
  const expertiseDir = join131(agentDir, "expertise");
119349
119353
  mkdirSync31(expertiseDir, { recursive: true });
119350
119354
  const seedContent = generateMentalModelSeed(name2, role, domain2);
119351
- writeFileSync25(join131(expertiseDir, "mental-model-seed.md"), seedContent, "utf-8");
119355
+ writeFileSync24(join131(expertiseDir, "mental-model-seed.md"), seedContent, "utf-8");
119352
119356
  createdFiles.push(join131(expertiseDir, "mental-model-seed.md"));
119353
119357
  try {
119354
119358
  const { execFile: execFile9 } = await import("node:child_process");
@@ -119861,6 +119865,12 @@ function registerBackfillCommand(program) {
119861
119865
  const dryRun = !!opts.dryRun;
119862
119866
  const rollback = !!opts.rollback;
119863
119867
  const taskIds = opts.tasks?.trim() ? opts.tasks.split(",").map((s3) => s3.trim()).filter(Boolean) : void 0;
119868
+ if (!dryRun && !rollback && !process.env["CLEO_NONINTERACTIVE"]) {
119869
+ console.log(
119870
+ "\u26A0 Backfill will modify tasks in-place. Run with --dry-run first to preview changes."
119871
+ );
119872
+ console.log(" Set CLEO_NONINTERACTIVE=1 or pass --dry-run to suppress this warning.\n");
119873
+ }
119864
119874
  if (dryRun) {
119865
119875
  console.log("[dry run] No changes will be made.\n");
119866
119876
  }
@@ -120711,7 +120721,7 @@ function registerCancelCommand(program) {
120711
120721
 
120712
120722
  // packages/cleo/src/cli/commands/cant.ts
120713
120723
  init_renderers();
120714
- import { existsSync as existsSync128, mkdirSync as mkdirSync29, readFileSync as readFileSync97, writeFileSync as writeFileSync23 } from "node:fs";
120724
+ import { existsSync as existsSync128, mkdirSync as mkdirSync29, readFileSync as readFileSync96, writeFileSync as writeFileSync22 } from "node:fs";
120715
120725
  import { dirname as dirname25, isAbsolute as isAbsolute3, join as join124, resolve as resolve15 } from "node:path";
120716
120726
  function registerCantCommand(program) {
120717
120727
  const cant = program.command("cant").description("CANT DSL tooling");
@@ -120789,7 +120799,7 @@ function registerCantCommand(program) {
120789
120799
  }
120790
120800
  try {
120791
120801
  const mod = await loadMigrateEngine();
120792
- const content = readFileSync97(filePath, "utf-8");
120802
+ const content = readFileSync96(filePath, "utf-8");
120793
120803
  const result = mod.migrateMarkdown(content, filePath, {
120794
120804
  write: isWrite,
120795
120805
  verbose: isVerbose,
@@ -120805,7 +120815,7 @@ function registerCantCommand(program) {
120805
120815
  for (const outputFile of result.outputFiles) {
120806
120816
  const outputPath = isAbsolute3(outputFile.path) ? outputFile.path : join124(projectRoot, outputFile.path);
120807
120817
  mkdirSync29(dirname25(outputPath), { recursive: true });
120808
- writeFileSync23(outputPath, outputFile.content, "utf-8");
120818
+ writeFileSync22(outputPath, outputFile.content, "utf-8");
120809
120819
  written++;
120810
120820
  if (isVerbose) {
120811
120821
  console.log(` Created: ${outputFile.path} (${outputFile.kind})`);
@@ -120882,7 +120892,7 @@ async function loadMigrateEngine() {
120882
120892
 
120883
120893
  // packages/cleo/src/cli/commands/chain.ts
120884
120894
  init_cli();
120885
- import { readFileSync as readFileSync98 } from "node:fs";
120895
+ import { readFileSync as readFileSync97 } from "node:fs";
120886
120896
  function registerChainCommand(program) {
120887
120897
  const chain = program.command("chain").description("WarpChain pipeline management (tier-2 orchestrator)");
120888
120898
  chain.command("show <chainId>").description("Show details for a WarpChain definition").action(async (chainId) => {
@@ -120892,7 +120902,7 @@ function registerChainCommand(program) {
120892
120902
  await dispatchFromCli("query", "pipeline", "chain.list", {}, { command: "chain" });
120893
120903
  });
120894
120904
  chain.command("add <file>").description("Add a new WarpChain definition from a JSON file").action(async (file2) => {
120895
- const chainJson = JSON.parse(readFileSync98(file2, "utf-8"));
120905
+ const chainJson = JSON.parse(readFileSync97(file2, "utf-8"));
120896
120906
  await dispatchFromCli(
120897
120907
  "mutate",
120898
120908
  "pipeline",
@@ -120961,10 +120971,10 @@ function registerCheckCommand(program) {
120961
120971
  );
120962
120972
  });
120963
120973
  check2.command("chain-validate <file>").description("Validate a WarpChain definition from a JSON file").action(async (file2) => {
120964
- const { readFileSync: readFileSync103 } = await import("node:fs");
120974
+ const { readFileSync: readFileSync102 } = await import("node:fs");
120965
120975
  let chain;
120966
120976
  try {
120967
- chain = JSON.parse(readFileSync103(file2, "utf8"));
120977
+ chain = JSON.parse(readFileSync102(file2, "utf8"));
120968
120978
  } catch (err) {
120969
120979
  const message = err instanceof Error ? err.message : String(err);
120970
120980
  console.error(`Failed to read or parse chain file: ${message}`);
@@ -121132,13 +121142,13 @@ function registerCheckpointCommand(program) {
121132
121142
  // packages/cleo/src/cli/commands/claim.ts
121133
121143
  init_cli();
121134
121144
  function registerClaimCommand(program) {
121135
- program.command("claim <taskId>").description("Claim a task by assigning it to an agent").option("--agent <agentId>", "Agent ID to assign the task to (required)").action(async (taskId, opts) => {
121145
+ program.command("claim <taskId>").description("Claim a task by assigning it to an agent").requiredOption("--agent <agentId>", "Agent ID to assign the task to").action(async (taskId, opts) => {
121136
121146
  await dispatchFromCli(
121137
121147
  "mutate",
121138
121148
  "tasks",
121139
121149
  "claim",
121140
121150
  {
121141
- id: taskId,
121151
+ taskId,
121142
121152
  agentId: opts["agent"]
121143
121153
  },
121144
121154
  { command: "claim", operation: "tasks.claim" }
@@ -121151,7 +121161,7 @@ function registerUnclaimCommand(program) {
121151
121161
  "mutate",
121152
121162
  "tasks",
121153
121163
  "unclaim",
121154
- { id: taskId },
121164
+ { taskId },
121155
121165
  { command: "unclaim", operation: "tasks.unclaim" }
121156
121166
  );
121157
121167
  });
@@ -121722,7 +121732,7 @@ function registerDetectCommand(program) {
121722
121732
  // packages/cleo/src/cli/commands/detect-drift.ts
121723
121733
  init_src();
121724
121734
  init_renderers();
121725
- import { existsSync as existsSync129, readdirSync as readdirSync41, readFileSync as readFileSync99 } from "node:fs";
121735
+ import { existsSync as existsSync129, readdirSync as readdirSync41, readFileSync as readFileSync98 } from "node:fs";
121726
121736
  import { dirname as dirname26, join as join125 } from "node:path";
121727
121737
  function findProjectRoot() {
121728
121738
  let currentDir = process.cwd();
@@ -121742,7 +121752,7 @@ function registerDetectDriftCommand(program) {
121742
121752
  const isCleoRepo = existsSync129(join125(projectRoot, "src", "cli", "commands")) || existsSync129(join125(projectRoot, "packages", "cleo", "src"));
121743
121753
  const safeRead = (filePath) => {
121744
121754
  try {
121745
- return readFileSync99(filePath, "utf-8");
121755
+ return readFileSync98(filePath, "utf-8");
121746
121756
  } catch {
121747
121757
  return "";
121748
121758
  }
@@ -122547,7 +122557,7 @@ function registerExportTasksCommand(program) {
122547
122557
  program.command("export-tasks [taskIds...]").description("Export tasks to portable .cleo-export.json package for cross-project transfer").option("-o, --output <file>", "Output file path (stdout if omitted)").option("--subtree", "Include all descendants of specified task(s)").option("--filter <filters...>", "Filter tasks by criteria (key=value, repeatable)").option("--include-deps", "Auto-include task dependencies").option("--dry-run", "Preview selection without creating export file").action(async (taskIds, opts) => {
122548
122558
  const hasOutput = !!opts["output"];
122549
122559
  const params = {
122550
- taskIds: taskIds.length > 0 ? taskIds : void 0,
122560
+ taskIds: taskIds && taskIds.length > 0 ? taskIds : void 0,
122551
122561
  output: opts["output"],
122552
122562
  subtree: opts["subtree"],
122553
122563
  filter: opts["filter"],
@@ -122701,12 +122711,12 @@ init_src();
122701
122711
  init_src2();
122702
122712
  init_renderers();
122703
122713
  import { execFileSync as execFileSync16 } from "node:child_process";
122704
- import { existsSync as existsSync130, mkdirSync as mkdirSync30, readFileSync as readFileSync100, writeFileSync as writeFileSync24 } from "node:fs";
122714
+ import { existsSync as existsSync130, mkdirSync as mkdirSync30, readFileSync as readFileSync99, writeFileSync as writeFileSync23 } from "node:fs";
122705
122715
  import { dirname as dirname27, join as join127 } from "node:path";
122706
122716
  function getChangelogSource(cwd) {
122707
122717
  const configPath = getConfigPath(cwd);
122708
122718
  try {
122709
- const config2 = JSON.parse(readFileSync100(configPath, "utf-8"));
122719
+ const config2 = JSON.parse(readFileSync99(configPath, "utf-8"));
122710
122720
  return config2?.release?.changelog?.source ?? "CHANGELOG.md";
122711
122721
  } catch {
122712
122722
  return "CHANGELOG.md";
@@ -122715,7 +122725,7 @@ function getChangelogSource(cwd) {
122715
122725
  function getEnabledPlatforms(cwd) {
122716
122726
  const configPath = getConfigPath(cwd);
122717
122727
  try {
122718
- const config2 = JSON.parse(readFileSync100(configPath, "utf-8"));
122728
+ const config2 = JSON.parse(readFileSync99(configPath, "utf-8"));
122719
122729
  const outputs = config2?.release?.changelog?.outputs ?? [];
122720
122730
  return outputs.filter((o) => o.enabled);
122721
122731
  } catch {
@@ -122844,7 +122854,7 @@ function registerGenerateChangelogCommand(program) {
122844
122854
  if (!existsSync130(sourcePath)) {
122845
122855
  throw new CleoError(4 /* NOT_FOUND */, `Changelog source not found: ${sourcePath}`);
122846
122856
  }
122847
- const sourceContent = readFileSync100(sourcePath, "utf-8");
122857
+ const sourceContent = readFileSync99(sourcePath, "utf-8");
122848
122858
  const repoSlug = getGitHubRepoSlug();
122849
122859
  const results = [];
122850
122860
  if (targetPlatform) {
@@ -122855,7 +122865,7 @@ function registerGenerateChangelogCommand(program) {
122855
122865
  if (!dryRun) {
122856
122866
  const fullPath = join127(getProjectRoot(), outputPath);
122857
122867
  mkdirSync30(dirname27(fullPath), { recursive: true });
122858
- writeFileSync24(fullPath, content, "utf-8");
122868
+ writeFileSync23(fullPath, content, "utf-8");
122859
122869
  }
122860
122870
  results.push({ platform: targetPlatform, path: outputPath, written: !dryRun });
122861
122871
  } else {
@@ -122876,7 +122886,7 @@ function registerGenerateChangelogCommand(program) {
122876
122886
  if (!dryRun) {
122877
122887
  const fullPath = join127(getProjectRoot(), platformConfig.path);
122878
122888
  mkdirSync30(dirname27(fullPath), { recursive: true });
122879
- writeFileSync24(fullPath, content, "utf-8");
122889
+ writeFileSync23(fullPath, content, "utf-8");
122880
122890
  }
122881
122891
  results.push({
122882
122892
  platform: platformConfig.platform,
@@ -126763,10 +126773,10 @@ function registerSyncCommand(program) {
126763
126773
  "How to resolve conflicts: keep-cleo, keep-external, or newest (default: keep-cleo)",
126764
126774
  "keep-cleo"
126765
126775
  ).action(async (file2, opts) => {
126766
- const { readFileSync: readFileSync103 } = await import("node:fs");
126776
+ const { readFileSync: readFileSync102 } = await import("node:fs");
126767
126777
  let externalTasks;
126768
126778
  try {
126769
- externalTasks = JSON.parse(readFileSync103(file2, "utf8"));
126779
+ externalTasks = JSON.parse(readFileSync102(file2, "utf8"));
126770
126780
  } catch (err) {
126771
126781
  const message = err instanceof Error ? err.message : String(err);
126772
126782
  console.error(`Failed to read or parse external tasks file: ${message}`);
@@ -126862,11 +126872,11 @@ function registerTestingCommand(program) {
126862
126872
  init_internal();
126863
126873
  init_cli();
126864
126874
  init_renderers();
126865
- import { readFileSync as readFileSync101 } from "node:fs";
126875
+ import { readFileSync as readFileSync100 } from "node:fs";
126866
126876
  function readPayload(opts, textKey, fileKey) {
126867
126877
  const text3 = opts[textKey];
126868
126878
  const file2 = opts[fileKey];
126869
- if (file2) return readFileSync101(file2, "utf-8");
126879
+ if (file2) return readFileSync100(file2, "utf-8");
126870
126880
  return text3;
126871
126881
  }
126872
126882
  function registerTokenCommand(program) {
@@ -127452,7 +127462,7 @@ var codeCommand = defineCommand({
127452
127462
  // packages/cleo/src/cli/index.ts
127453
127463
  function getPackageVersion() {
127454
127464
  const pkgPath = join130(dirname28(fileURLToPath5(import.meta.url)), "../../package.json");
127455
- const pkg = JSON.parse(readFileSync102(pkgPath, "utf-8"));
127465
+ const pkg = JSON.parse(readFileSync101(pkgPath, "utf-8"));
127456
127466
  return pkg.version;
127457
127467
  }
127458
127468
  var CLI_VERSION = getPackageVersion();