@cleocode/cleo 2026.3.61 → 2026.3.62

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
@@ -13259,7 +13259,7 @@ async function showSequence(cwd) {
13259
13259
  counter: seq.counter,
13260
13260
  lastId: seq.lastId,
13261
13261
  checksum: seq.checksum,
13262
- nextId: `T${seq.counter + 1}`
13262
+ nextId: `T${String(seq.counter + 1).padStart(3, "0")}`
13263
13263
  };
13264
13264
  }
13265
13265
  async function loadAllTasks(cwd, accessor) {
@@ -41812,6 +41812,58 @@ async function addTask(options, cwd, accessor) {
41812
41812
  if (duplicate) {
41813
41813
  return { task: duplicate, duplicate: true };
41814
41814
  }
41815
+ if (options.dryRun) {
41816
+ const previewNow = (/* @__PURE__ */ new Date()).toISOString();
41817
+ let previewParentForStage = null;
41818
+ if (parentId) {
41819
+ const previewParentTask = await dataAccessor.loadSingleTask(parentId);
41820
+ previewParentForStage = previewParentTask ? { pipelineStage: previewParentTask.pipelineStage, type: previewParentTask.type } : null;
41821
+ }
41822
+ const previewPipelineStage = resolveDefaultPipelineStage({
41823
+ explicitStage: options.pipelineStage,
41824
+ taskType: taskType ?? null,
41825
+ parentTask: previewParentForStage
41826
+ });
41827
+ const previewPosition = options.position !== void 0 ? options.position : await dataAccessor.getNextPosition(parentId);
41828
+ const previewTask = {
41829
+ id: "T???",
41830
+ title: options.title,
41831
+ description: options.description,
41832
+ status,
41833
+ priority,
41834
+ type: taskType,
41835
+ parentId: parentId || null,
41836
+ position: previewPosition,
41837
+ positionVersion: 0,
41838
+ size,
41839
+ pipelineStage: previewPipelineStage,
41840
+ createdAt: previewNow,
41841
+ updatedAt: previewNow
41842
+ };
41843
+ if (phase) previewTask.phase = phase;
41844
+ if (options.labels?.length) previewTask.labels = options.labels.map((l) => l.trim());
41845
+ if (options.files?.length) previewTask.files = options.files.map((f) => f.trim());
41846
+ if (options.acceptance?.length)
41847
+ previewTask.acceptance = options.acceptance.map((a) => a.trim());
41848
+ if (options.depends?.length) previewTask.depends = options.depends.map((d) => d.trim());
41849
+ if (options.notes) {
41850
+ const previewNote = `${(/* @__PURE__ */ new Date()).toISOString().replace("T", " ").replace(/\.\d+Z$/, " UTC")}: ${options.notes}`;
41851
+ previewTask.notes = [previewNote];
41852
+ }
41853
+ if (status === "blocked" && options.description) {
41854
+ previewTask.blockedBy = options.description;
41855
+ }
41856
+ if (status === "done") {
41857
+ previewTask.completedAt = previewNow;
41858
+ }
41859
+ if (taskType !== "epic") {
41860
+ const verificationEnabledRaw = await getRawConfigValue("verification.enabled", cwd);
41861
+ if (verificationEnabledRaw === true) {
41862
+ previewTask.verification = buildDefaultVerification(previewNow);
41863
+ }
41864
+ }
41865
+ return { task: previewTask, dryRun: true };
41866
+ }
41815
41867
  const taskId = await allocateNextTaskId(cwd);
41816
41868
  const now2 = (/* @__PURE__ */ new Date()).toISOString();
41817
41869
  let resolvedParentForStage = null;
@@ -41881,9 +41933,6 @@ async function addTask(options, cwd, accessor) {
41881
41933
  task.verification = buildDefaultVerification(now2);
41882
41934
  }
41883
41935
  }
41884
- if (options.dryRun) {
41885
- return { task, dryRun: true };
41886
- }
41887
41936
  await dataAccessor.transaction(async (tx) => {
41888
41937
  if (options.position !== void 0) {
41889
41938
  await dataAccessor.shiftPositions(parentId, options.position, 1);
@@ -47795,8 +47844,9 @@ var init_observability = __esm({
47795
47844
  });
47796
47845
 
47797
47846
  // packages/core/src/phases/deps.ts
47798
- async function loadAllTasks3(_cwd, accessor) {
47799
- const { tasks: tasks2 } = await accessor.queryTasks({});
47847
+ async function loadAllTasks3(cwd, accessor) {
47848
+ const acc = accessor ?? await getAccessor(cwd);
47849
+ const { tasks: tasks2 } = await acc.queryTasks({});
47800
47850
  return tasks2;
47801
47851
  }
47802
47852
  function buildGraph(tasks2) {
@@ -47872,11 +47922,45 @@ async function getExecutionWaves(epicId, cwd, accessor) {
47872
47922
  }
47873
47923
  return waves;
47874
47924
  }
47925
+ async function getCriticalPath2(taskId, cwd, accessor) {
47926
+ const allTasks = await loadAllTasks3(cwd, accessor);
47927
+ const task = allTasks.find((t) => t.id === taskId);
47928
+ if (!task) {
47929
+ throw new CleoError(4 /* NOT_FOUND */, `Task not found: ${taskId}`);
47930
+ }
47931
+ const graph = buildGraph(allTasks);
47932
+ const taskMap = new Map(allTasks.map((t) => [t.id, t]));
47933
+ function findLongestPath(id, visited) {
47934
+ if (visited.has(id)) return [];
47935
+ visited.add(id);
47936
+ const node = graph.get(id);
47937
+ if (!node || node.dependents.length === 0) {
47938
+ return [id];
47939
+ }
47940
+ let longest = [];
47941
+ for (const depId of node.dependents) {
47942
+ const path3 = findLongestPath(depId, new Set(visited));
47943
+ if (path3.length > longest.length) {
47944
+ longest = path3;
47945
+ }
47946
+ }
47947
+ return [id, ...longest];
47948
+ }
47949
+ const path2 = findLongestPath(taskId, /* @__PURE__ */ new Set());
47950
+ return {
47951
+ path: path2.map((id) => {
47952
+ const t = taskMap.get(id);
47953
+ return t ? { id: t.id, title: t.title, status: t.status } : { id, title: "Unknown", status: "unknown" };
47954
+ }),
47955
+ length: path2.length
47956
+ };
47957
+ }
47875
47958
  var init_deps2 = __esm({
47876
47959
  "packages/core/src/phases/deps.ts"() {
47877
47960
  "use strict";
47878
47961
  init_src();
47879
47962
  init_errors3();
47963
+ init_data_accessor();
47880
47964
  }
47881
47965
  });
47882
47966
 
@@ -52678,6 +52762,13 @@ var init_capability_matrix = __esm({
52678
52762
  mode: "native",
52679
52763
  preferredChannel: "either"
52680
52764
  },
52765
+ {
52766
+ domain: "admin",
52767
+ operation: "backup",
52768
+ gateway: "query",
52769
+ mode: "native",
52770
+ preferredChannel: "either"
52771
+ },
52681
52772
  {
52682
52773
  domain: "admin",
52683
52774
  operation: "backup",
@@ -57927,7 +58018,7 @@ async function getProjectStats(opts, accessor) {
57927
58018
  dbAnd(dbEq(tasksTable.status, "archived"), dbEq(tasksTable.archiveReason, "completed"))
57928
58019
  ).get();
57929
58020
  archivedCompleted = archivedDoneRow?.c ?? 0;
57930
- totalCompleted = (statusMap["done"] ?? 0) + archivedCompleted;
58021
+ totalCompleted = entries.filter(isComplete).length;
57931
58022
  } catch {
57932
58023
  totalCreated = entries.filter(isCreate).length;
57933
58024
  totalCompleted = entries.filter(isComplete).length;
@@ -58933,7 +59024,7 @@ var init_audit2 = __esm({
58933
59024
  });
58934
59025
 
58935
59026
  // packages/core/src/system/backup.ts
58936
- import { existsSync as existsSync82, mkdirSync as mkdirSync18, readFileSync as readFileSync59, writeFileSync as writeFileSync11 } from "node:fs";
59027
+ import { existsSync as existsSync82, mkdirSync as mkdirSync18, readdirSync as readdirSync27, readFileSync as readFileSync59, writeFileSync as writeFileSync11 } from "node:fs";
58937
59028
  import { join as join84 } from "node:path";
58938
59029
  function createBackup2(projectRoot, opts) {
58939
59030
  const cleoDir = join84(projectRoot, ".cleo");
@@ -58979,6 +59070,36 @@ function createBackup2(projectRoot, opts) {
58979
59070
  }
58980
59071
  return { backupId, path: backupDir, timestamp: timestamp2, type: btype, files: backedUp };
58981
59072
  }
59073
+ function listSystemBackups(projectRoot) {
59074
+ const cleoDir = join84(projectRoot, ".cleo");
59075
+ const backupTypes = ["snapshot", "safety", "migration"];
59076
+ const entries = [];
59077
+ for (const btype of backupTypes) {
59078
+ const backupDir = join84(cleoDir, "backups", btype);
59079
+ if (!existsSync82(backupDir)) continue;
59080
+ try {
59081
+ const files = readdirSync27(backupDir).filter((f) => f.endsWith(".meta.json"));
59082
+ for (const metaFile of files) {
59083
+ try {
59084
+ const raw = readFileSync59(join84(backupDir, metaFile), "utf-8");
59085
+ const meta = JSON.parse(raw);
59086
+ if (meta.backupId && meta.timestamp) {
59087
+ entries.push({
59088
+ backupId: meta.backupId,
59089
+ type: meta.type ?? btype,
59090
+ timestamp: meta.timestamp,
59091
+ note: meta.note,
59092
+ files: meta.files ?? []
59093
+ });
59094
+ }
59095
+ } catch {
59096
+ }
59097
+ }
59098
+ } catch {
59099
+ }
59100
+ }
59101
+ return entries.sort((a, b) => b.timestamp.localeCompare(a.timestamp));
59102
+ }
58982
59103
  function restoreBackup(projectRoot, params) {
58983
59104
  if (!params.backupId) {
58984
59105
  throw new CleoError(2 /* INVALID_INPUT */, "backupId is required");
@@ -59103,7 +59224,7 @@ var init_audit_prune = __esm({
59103
59224
  });
59104
59225
 
59105
59226
  // packages/core/src/system/cleanup.ts
59106
- import { existsSync as existsSync83, readdirSync as readdirSync27, readFileSync as readFileSync60, unlinkSync as unlinkSync5, writeFileSync as writeFileSync12 } from "node:fs";
59227
+ import { existsSync as existsSync83, readdirSync as readdirSync28, readFileSync as readFileSync60, unlinkSync as unlinkSync5, writeFileSync as writeFileSync12 } from "node:fs";
59107
59228
  import { join as join86 } from "node:path";
59108
59229
  async function cleanupSystem(projectRoot, params) {
59109
59230
  if (!params.target) {
@@ -59151,10 +59272,10 @@ async function cleanupSystem(projectRoot, params) {
59151
59272
  case "backups": {
59152
59273
  const backupBaseDir = join86(cleoDir, "backups");
59153
59274
  if (existsSync83(backupBaseDir)) {
59154
- for (const typeDir of readdirSync27(backupBaseDir)) {
59275
+ for (const typeDir of readdirSync28(backupBaseDir)) {
59155
59276
  const fullDir = join86(backupBaseDir, typeDir);
59156
59277
  try {
59157
- for (const file2 of readdirSync27(fullDir)) {
59278
+ for (const file2 of readdirSync28(fullDir)) {
59158
59279
  if (file2.endsWith(".meta.json")) {
59159
59280
  const metaFilePath = join86(fullDir, file2);
59160
59281
  try {
@@ -59163,7 +59284,7 @@ async function cleanupSystem(projectRoot, params) {
59163
59284
  items.push(file2.replace(".meta.json", ""));
59164
59285
  if (!dryRun) {
59165
59286
  unlinkSync5(metaFilePath);
59166
- for (const bf of readdirSync27(fullDir)) {
59287
+ for (const bf of readdirSync28(fullDir)) {
59167
59288
  if (bf.includes(meta.backupId)) {
59168
59289
  try {
59169
59290
  unlinkSync5(join86(fullDir, bf));
@@ -59193,7 +59314,7 @@ async function cleanupSystem(projectRoot, params) {
59193
59314
  }
59194
59315
  const auditPattern = /^audit-log-.*\.json$/;
59195
59316
  if (existsSync83(cleoDir)) {
59196
- for (const file2 of readdirSync27(cleoDir)) {
59317
+ for (const file2 of readdirSync28(cleoDir)) {
59197
59318
  if (auditPattern.test(file2)) {
59198
59319
  items.push(file2);
59199
59320
  if (!dryRun) {
@@ -59353,7 +59474,7 @@ import { randomBytes as randomBytes12 } from "node:crypto";
59353
59474
  import {
59354
59475
  existsSync as existsSync85,
59355
59476
  mkdirSync as mkdirSync20,
59356
- readdirSync as readdirSync28,
59477
+ readdirSync as readdirSync29,
59357
59478
  readFileSync as readFileSync61,
59358
59479
  renameSync as renameSync6,
59359
59480
  unlinkSync as unlinkSync6,
@@ -62421,7 +62542,7 @@ var init_tasks2 = __esm({
62421
62542
  });
62422
62543
 
62423
62544
  // packages/core/src/templates/parser.ts
62424
- import { existsSync as existsSync93, readdirSync as readdirSync29, readFileSync as readFileSync67 } from "fs";
62545
+ import { existsSync as existsSync93, readdirSync as readdirSync30, readFileSync as readFileSync67 } from "fs";
62425
62546
  import { join as join96 } from "path";
62426
62547
  import { parse as parseYaml } from "yaml";
62427
62548
  function deriveSubcommand(filename) {
@@ -62495,7 +62616,7 @@ function parseIssueTemplates2(projectRoot) {
62495
62616
  }
62496
62617
  let files;
62497
62618
  try {
62498
- files = readdirSync29(templateDir).filter((f) => /\.ya?ml$/i.test(f) && f !== "config.yml");
62619
+ files = readdirSync30(templateDir).filter((f) => /\.ya?ml$/i.test(f) && f !== "config.yml");
62499
62620
  } catch (error40) {
62500
62621
  return {
62501
62622
  success: false,
@@ -62908,7 +63029,7 @@ var init_changelog = __esm({
62908
63029
  });
62909
63030
 
62910
63031
  // packages/core/src/ui/command-registry.ts
62911
- import { existsSync as existsSync96, readdirSync as readdirSync30, readFileSync as readFileSync70 } from "node:fs";
63032
+ import { existsSync as existsSync96, readdirSync as readdirSync31, readFileSync as readFileSync70 } from "node:fs";
62912
63033
  import { basename as basename16, join as join98 } from "node:path";
62913
63034
  function parseCommandHeader(scriptPath) {
62914
63035
  if (!existsSync96(scriptPath)) return null;
@@ -62991,7 +63112,7 @@ function parseCommandHeader(scriptPath) {
62991
63112
  function scanAllCommands(scriptsDir) {
62992
63113
  const registry2 = /* @__PURE__ */ new Map();
62993
63114
  if (!existsSync96(scriptsDir)) return registry2;
62994
- for (const file2 of readdirSync30(scriptsDir)) {
63115
+ for (const file2 of readdirSync31(scriptsDir)) {
62995
63116
  if (!file2.endsWith(".sh") && !file2.endsWith(".ts")) continue;
62996
63117
  const meta = parseCommandHeader(join98(scriptsDir, file2));
62997
63118
  if (meta) {
@@ -63919,12 +64040,12 @@ var init_compliance2 = __esm({
63919
64040
  });
63920
64041
 
63921
64042
  // packages/core/src/validation/docs-sync.ts
63922
- import { existsSync as existsSync97, readdirSync as readdirSync31, readFileSync as readFileSync71 } from "node:fs";
64043
+ import { existsSync as existsSync97, readdirSync as readdirSync32, readFileSync as readFileSync71 } from "node:fs";
63923
64044
  import { join as join99 } from "node:path";
63924
64045
  function getScriptCommands(scriptsDir) {
63925
64046
  if (!existsSync97(scriptsDir)) return [];
63926
64047
  try {
63927
- return readdirSync31(scriptsDir).filter((f) => f.endsWith(".sh")).map((f) => f.replace(/\.sh$/, "")).sort();
64048
+ return readdirSync32(scriptsDir).filter((f) => f.endsWith(".sh")).map((f) => f.replace(/\.sh$/, "")).sort();
63928
64049
  } catch {
63929
64050
  return [];
63930
64051
  }
@@ -65346,12 +65467,12 @@ var init_manifest = __esm({
65346
65467
  });
65347
65468
 
65348
65469
  // packages/core/src/validation/protocol-common.ts
65349
- import { existsSync as existsSync100, readdirSync as readdirSync32, readFileSync as readFileSync73 } from "node:fs";
65470
+ import { existsSync as existsSync100, readdirSync as readdirSync33, readFileSync as readFileSync73 } from "node:fs";
65350
65471
  function checkOutputFileExists(taskId, expectedDir, pattern) {
65351
65472
  if (!existsSync100(expectedDir)) return false;
65352
65473
  const filePattern = pattern ?? `${taskId}`;
65353
65474
  try {
65354
- const files = readdirSync32(expectedDir);
65475
+ const files = readdirSync33(expectedDir);
65355
65476
  return files.some((f) => f.includes(filePattern) && f.endsWith(".md"));
65356
65477
  } catch {
65357
65478
  return false;
@@ -66330,7 +66451,7 @@ __export(init_exports, {
66330
66451
  isAutoInitEnabled: () => isAutoInitEnabled,
66331
66452
  updateDocs: () => updateDocs
66332
66453
  });
66333
- import { existsSync as existsSync101, readdirSync as readdirSync33, readFileSync as readFileSync74 } from "node:fs";
66454
+ import { existsSync as existsSync101, readdirSync as readdirSync34, readFileSync as readFileSync74 } from "node:fs";
66334
66455
  import { copyFile as copyFile3, lstat, mkdir as mkdir16, readFile as readFile17, symlink, unlink as unlink4, writeFile as writeFile11 } from "node:fs/promises";
66335
66456
  import { platform as platform4 } from "node:os";
66336
66457
  import { basename as basename17, dirname as dirname19, join as join101 } from "node:path";
@@ -66380,7 +66501,7 @@ async function initAgentDefinition(created, warnings) {
66380
66501
  } catch (_err) {
66381
66502
  try {
66382
66503
  await mkdir16(globalAgentsDir, { recursive: true });
66383
- const files = readdirSync33(agentSourceDir);
66504
+ const files = readdirSync34(agentSourceDir);
66384
66505
  for (const file2 of files) {
66385
66506
  await copyFile3(join101(agentSourceDir, file2), join101(globalAgentsDir, file2));
66386
66507
  }
@@ -66529,7 +66650,7 @@ async function installGitHubTemplates(projectRoot, created, skipped) {
66529
66650
  await mkdir16(issueTemplateDir, { recursive: true });
66530
66651
  const issueSrcDir = join101(templateSrcDir, "ISSUE_TEMPLATE");
66531
66652
  if (existsSync101(issueSrcDir)) {
66532
- const issueFiles = readdirSync33(issueSrcDir);
66653
+ const issueFiles = readdirSync34(issueSrcDir);
66533
66654
  for (const file2 of issueFiles) {
66534
66655
  const dest = join101(issueTemplateDir, file2);
66535
66656
  if (existsSync101(dest)) {
@@ -71562,7 +71683,7 @@ var init_model_provider_registry = __esm({
71562
71683
 
71563
71684
  // packages/core/src/metrics/token-service.ts
71564
71685
  import { createHash as createHash13, randomUUID as randomUUID8 } from "node:crypto";
71565
- import { existsSync as existsSync107, readdirSync as readdirSync34, readFileSync as readFileSync79 } from "node:fs";
71686
+ import { existsSync as existsSync107, readdirSync as readdirSync35, readFileSync as readFileSync79 } from "node:fs";
71566
71687
  import { join as join106 } from "node:path";
71567
71688
  function normalizeProvider(provider, model, runtimeProvider) {
71568
71689
  const value = (provider ?? "").trim().toLowerCase();
@@ -71647,7 +71768,7 @@ function getOtelDir2() {
71647
71768
  function readOtelJsonl(dir) {
71648
71769
  if (!existsSync107(dir)) return [];
71649
71770
  const entries = [];
71650
- for (const file2 of readdirSync34(dir)) {
71771
+ for (const file2 of readdirSync35(dir)) {
71651
71772
  if (!file2.endsWith(".json") && !file2.endsWith(".jsonl")) continue;
71652
71773
  const filePath = join106(dir, file2);
71653
71774
  const raw = readFileSync79(filePath, "utf-8").trim();
@@ -72039,7 +72160,7 @@ var init_parallel = __esm({
72039
72160
  });
72040
72161
 
72041
72162
  // packages/core/src/orchestration/skill-ops.ts
72042
- import { existsSync as existsSync108, readdirSync as readdirSync35, readFileSync as readFileSync80 } from "node:fs";
72163
+ import { existsSync as existsSync108, readdirSync as readdirSync36, readFileSync as readFileSync80 } from "node:fs";
72043
72164
  import { join as join107 } from "node:path";
72044
72165
  import { getCanonicalSkillsDir as getCanonicalSkillsDir3 } from "@cleocode/caamp";
72045
72166
  function getSkillContent(skillName, projectRoot) {
@@ -72064,7 +72185,7 @@ function getSkillContent(skillName, projectRoot) {
72064
72185
  let references = [];
72065
72186
  if (existsSync108(refsDir)) {
72066
72187
  try {
72067
- references = readdirSync35(refsDir).filter((f) => f.endsWith(".md") || f.endsWith(".txt")).map((f) => ({
72188
+ references = readdirSync36(refsDir).filter((f) => f.endsWith(".md") || f.endsWith(".txt")).map((f) => ({
72068
72189
  name: f,
72069
72190
  path: join107(skillDir, "references", f)
72070
72191
  }));
@@ -74778,7 +74899,7 @@ import {
74778
74899
  copyFileSync as copyFileSync7,
74779
74900
  existsSync as existsSync111,
74780
74901
  mkdirSync as mkdirSync23,
74781
- readdirSync as readdirSync36,
74902
+ readdirSync as readdirSync37,
74782
74903
  readFileSync as readFileSync83,
74783
74904
  writeFileSync as writeFileSync20
74784
74905
  } from "node:fs";
@@ -74991,7 +75112,7 @@ async function runUpgrade(options = {}) {
74991
75112
  const dbPath2 = join109(cleoDir2, "tasks.db");
74992
75113
  const safetyDir = join109(cleoDir2, "backups", "safety");
74993
75114
  if (existsSync111(safetyDir)) {
74994
- const backups = readdirSync36(safetyDir).filter((f) => f.startsWith("tasks.db.pre-migration.")).sort().reverse();
75115
+ const backups = readdirSync37(safetyDir).filter((f) => f.startsWith("tasks.db.pre-migration.")).sort().reverse();
74995
75116
  if (backups.length > 0 && !existsSync111(dbPath2)) {
74996
75117
  copyFileSync7(join109(safetyDir, backups[0]), dbPath2);
74997
75118
  }
@@ -77918,7 +78039,7 @@ var init_bootstrap2 = __esm({
77918
78039
  });
77919
78040
 
77920
78041
  // packages/core/src/orchestration/critical-path.ts
77921
- async function getCriticalPath2(cwd, accessor) {
78042
+ async function getCriticalPath3(cwd, accessor) {
77922
78043
  const acc = accessor ?? await getAccessor(cwd);
77923
78044
  const { tasks: tasks2 } = await acc.queryTasks({});
77924
78045
  if (tasks2.length === 0) {
@@ -78539,6 +78660,7 @@ __export(internal_exports, {
78539
78660
  deletePhase: () => deletePhase,
78540
78661
  deleteTask: () => deleteTask,
78541
78662
  deleteTokenUsage: () => deleteTokenUsage,
78663
+ depsCriticalPath: () => getCriticalPath2,
78542
78664
  deregisterAgent: () => deregisterAgent,
78543
78665
  describeChannel: () => describeChannel,
78544
78666
  detectCrashedAgents: () => detectCrashedAgents,
@@ -78680,6 +78802,7 @@ __export(internal_exports, {
78680
78802
  getSystemInfo: () => getSystemInfo2,
78681
78803
  getSystemMetrics: () => getSystemMetrics,
78682
78804
  getSystemMigrationStatus: () => getMigrationStatus2,
78805
+ getTask: () => getTask,
78683
78806
  getTaskHistory: () => getTaskHistory,
78684
78807
  getTaskPath: () => getTaskPath,
78685
78808
  getTemplateForSubcommand: () => getTemplateForSubcommand2,
@@ -78755,6 +78878,7 @@ __export(internal_exports, {
78755
78878
  listSessions: () => listSessions,
78756
78879
  listStickies: () => listStickies,
78757
78880
  listStrictnessPresets: () => listStrictnessPresets,
78881
+ listSystemBackups: () => listSystemBackups,
78758
78882
  listTasks: () => listTasks,
78759
78883
  listTesseraTemplates: () => listTesseraTemplates,
78760
78884
  listTokenUsage: () => listTokenUsage,
@@ -78815,7 +78939,7 @@ __export(internal_exports, {
78815
78939
  ops: () => operations_exports,
78816
78940
  orchestration: () => orchestration_exports,
78817
78941
  orchestrationAnalyzeDependencies: () => analyzeDependencies,
78818
- orchestrationGetCriticalPath: () => getCriticalPath2,
78942
+ orchestrationGetCriticalPath: () => getCriticalPath3,
78819
78943
  orchestrationGetNextTask: () => getNextTask,
78820
78944
  orchestrationGetReadyTasks: () => getReadyTasks2,
78821
78945
  orphanDetection: () => orphanDetection,
@@ -79049,6 +79173,7 @@ var init_internal = __esm({
79049
79173
  init_waves();
79050
79174
  init_otel();
79051
79175
  init_paths();
79176
+ init_deps2();
79052
79177
  init_phases();
79053
79178
  init_pipeline2();
79054
79179
  init_platform();
@@ -82903,6 +83028,16 @@ var OPERATIONS = [
82903
83028
  }
82904
83029
  ]
82905
83030
  },
83031
+ {
83032
+ gateway: "query",
83033
+ domain: "admin",
83034
+ operation: "backup",
83035
+ description: "admin.backup (query) \u2014 list available backups (read-only)",
83036
+ tier: 1,
83037
+ idempotent: true,
83038
+ sessionRequired: false,
83039
+ requiredParams: []
83040
+ },
82906
83041
  {
82907
83042
  gateway: "mutate",
82908
83043
  domain: "admin",
@@ -84944,7 +85079,7 @@ async function orchestrateCriticalPath(projectRoot) {
84944
85079
  try {
84945
85080
  const root = projectRoot || resolveProjectRoot();
84946
85081
  const accessor = await getAccessor(root);
84947
- const result = await getCriticalPath2(root, accessor);
85082
+ const result = await getCriticalPath3(root, accessor);
84948
85083
  return { success: true, data: result };
84949
85084
  } catch (err) {
84950
85085
  return engineError("E_GENERAL", err.message);
@@ -85700,7 +85835,7 @@ async function releaseShip(params, projectRoot) {
85700
85835
  // packages/cleo/src/dispatch/engines/system-engine.ts
85701
85836
  init_internal();
85702
85837
  init_error();
85703
- import { existsSync as existsSync119, readdirSync as readdirSync37, readFileSync as readFileSync93 } from "node:fs";
85838
+ import { existsSync as existsSync119, readdirSync as readdirSync38, readFileSync as readFileSync93 } from "node:fs";
85704
85839
  import { basename as basename18, join as join112 } from "node:path";
85705
85840
  var HELP_TOPICS = {
85706
85841
  session: {
@@ -86007,7 +86142,7 @@ function systemContext(projectRoot, params) {
86007
86142
  const sessions2 = [];
86008
86143
  const statesDir = join112(cleoDir, "context-states");
86009
86144
  if (existsSync119(statesDir)) {
86010
- for (const file2 of readdirSync37(statesDir)) {
86145
+ for (const file2 of readdirSync38(statesDir)) {
86011
86146
  if (file2.startsWith("context-state-") && file2.endsWith(".json")) {
86012
86147
  try {
86013
86148
  const state = JSON.parse(readFileSync93(join112(statesDir, file2), "utf-8"));
@@ -86144,6 +86279,14 @@ function systemBackup(projectRoot, params) {
86144
86279
  return engineError("E_GENERAL", err.message);
86145
86280
  }
86146
86281
  }
86282
+ function systemListBackups(projectRoot) {
86283
+ try {
86284
+ const result = listSystemBackups(projectRoot);
86285
+ return { success: true, data: result };
86286
+ } catch (err) {
86287
+ return engineError("E_GENERAL", err.message);
86288
+ }
86289
+ }
86147
86290
  function systemRestore(projectRoot, params) {
86148
86291
  try {
86149
86292
  const result = restoreBackup(projectRoot, params);
@@ -87710,6 +87853,16 @@ var AdminHandler = class {
87710
87853
  data: result
87711
87854
  };
87712
87855
  }
87856
+ case "backup": {
87857
+ const result = systemListBackups(projectRoot);
87858
+ return wrapResult(
87859
+ { success: true, data: { backups: result, count: result.length } },
87860
+ "query",
87861
+ "admin",
87862
+ operation,
87863
+ startTime
87864
+ );
87865
+ }
87713
87866
  case "map": {
87714
87867
  const { mapCodebase: mapCodebase3 } = await Promise.resolve().then(() => (init_codebase_map_engine(), codebase_map_engine_exports));
87715
87868
  const result = await mapCodebase3(projectRoot, {
@@ -88199,6 +88352,7 @@ var AdminHandler = class {
88199
88352
  "token",
88200
88353
  "adr.show",
88201
88354
  "adr.find",
88355
+ "backup",
88202
88356
  "export",
88203
88357
  "map"
88204
88358
  ],
@@ -93741,7 +93895,7 @@ function registerBackupCommand(program) {
93741
93895
  });
93742
93896
  backup.command("list").description("List available backups").action(async () => {
93743
93897
  await dispatchFromCli(
93744
- "mutate",
93898
+ "query",
93745
93899
  "admin",
93746
93900
  "backup",
93747
93901
  {
@@ -94147,7 +94301,7 @@ function registerConsensusCommand(program) {
94147
94301
  // packages/cleo/src/cli/commands/context.ts
94148
94302
  function registerContextCommand(program) {
94149
94303
  const context = program.command("context").description("Monitor context window usage for agent safeguard system");
94150
- context.command("status").description("Show current context state (default)").option("--session <id>", "Check specific CLEO session").action(async (opts) => {
94304
+ context.command("status", { isDefault: true }).description("Show current context state (default)").option("--session <id>", "Check specific CLEO session").action(async (opts) => {
94151
94305
  await dispatchFromCli(
94152
94306
  "query",
94153
94307
  "admin",
@@ -94289,6 +94443,9 @@ function registerDeleteCommand(program) {
94289
94443
  }
94290
94444
 
94291
94445
  // packages/cleo/src/cli/commands/deps.ts
94446
+ init_src();
94447
+ init_internal();
94448
+ init_renderers();
94292
94449
  function registerDepsCommand(program) {
94293
94450
  const deps = program.command("deps").description("Dependency visualization and analysis");
94294
94451
  deps.command("overview").description("Overview of all dependencies").action(async () => {
@@ -94326,15 +94483,15 @@ function registerDepsCommand(program) {
94326
94483
  );
94327
94484
  });
94328
94485
  deps.command("critical-path <taskId>").description("Find longest dependency chain from task").action(async (taskId) => {
94329
- await dispatchFromCli(
94330
- "query",
94331
- "orchestrate",
94332
- "critical.path",
94333
- {
94334
- taskId
94335
- },
94336
- { command: "deps", operation: "tasks.depends" }
94337
- );
94486
+ const cwd = resolveProjectRoot();
94487
+ try {
94488
+ const result = await getCriticalPath2(taskId, cwd);
94489
+ cliOutput(result, { command: "deps", operation: "tasks.criticalPath" });
94490
+ } catch (err) {
94491
+ const msg = err instanceof Error ? err.message : String(err);
94492
+ console.error(`critical-path: ${msg}`);
94493
+ process.exit(4 /* NOT_FOUND */);
94494
+ }
94338
94495
  });
94339
94496
  deps.command("impact <taskId>").description("Find all tasks affected by changes to task").option("--depth <n>", "Maximum depth for impact analysis", "10").action(async (taskId, opts) => {
94340
94497
  await dispatchFromCli(
@@ -94396,7 +94553,7 @@ function registerDetectCommand(program) {
94396
94553
  // packages/cleo/src/cli/commands/detect-drift.ts
94397
94554
  init_src();
94398
94555
  init_renderers();
94399
- import { existsSync as existsSync121, readdirSync as readdirSync38, readFileSync as readFileSync95 } from "node:fs";
94556
+ import { existsSync as existsSync121, readdirSync as readdirSync39, readFileSync as readFileSync95 } from "node:fs";
94400
94557
  import { dirname as dirname22, join as join114 } from "node:path";
94401
94558
  import { fileURLToPath as fileURLToPath5 } from "node:url";
94402
94559
  function findProjectRoot() {
@@ -94548,7 +94705,7 @@ function registerDetectDriftCommand(program) {
94548
94705
  }
94549
94706
  ]);
94550
94707
  } else {
94551
- const files = readdirSync38(cliDir).filter(
94708
+ const files = readdirSync39(cliDir).filter(
94552
94709
  (f) => f.endsWith(".ts") && !f.includes(".test.")
94553
94710
  );
94554
94711
  addCheck("CLI-to-core sync", "pass", `Found ${files.length} CLI command implementations`);
@@ -94568,7 +94725,7 @@ function registerDetectDriftCommand(program) {
94568
94725
  }
94569
94726
  ]);
94570
94727
  } else {
94571
- const files = readdirSync38(domainsDir).filter((f) => f.endsWith(".ts"));
94728
+ const files = readdirSync39(domainsDir).filter((f) => f.endsWith(".ts"));
94572
94729
  addCheck("Domain handler coverage", "pass", `Found ${files.length} domain handlers`);
94573
94730
  }
94574
94731
  } catch (e) {
@@ -95062,24 +95219,29 @@ function registerEnvCommand(program) {
95062
95219
 
95063
95220
  // packages/cleo/src/cli/commands/exists.ts
95064
95221
  init_src();
95222
+ init_internal();
95065
95223
  init_renderers();
95066
95224
  function registerExistsCommand(program) {
95067
- program.command("exists <task-id>").description("Check if a task ID exists (exit 0=exists, 4=not found)").option("--include-archive", "Search archive file too").option("--verbose", "Show which file contains the task").action(async (taskId, opts) => {
95068
- const response = await dispatchRaw("query", "tasks", "exists", {
95069
- taskId,
95070
- includeArchive: opts["includeArchive"],
95071
- verbose: opts["verbose"]
95072
- });
95073
- if (!response.success) {
95074
- handleRawError(response, { command: "exists", operation: "tasks.exists" });
95225
+ program.command("exists <task-id>").description("Check if a task ID exists (exit 0=exists, 4=not found)").option("--verbose", "Show task title and status when found").action(async (taskId, opts) => {
95226
+ const cwd = resolveProjectRoot();
95227
+ let task;
95228
+ try {
95229
+ task = await getTask(taskId, cwd);
95230
+ } catch (err) {
95231
+ console.error(`exists: ${err instanceof Error ? err.message : String(err)}`);
95232
+ process.exit(1 /* GENERAL_ERROR */);
95075
95233
  }
95076
- const data = response.data;
95077
- if (data?.exists) {
95078
- cliOutput(data, { command: "exists" });
95079
- } else {
95080
- cliOutput(data, { command: "exists" });
95234
+ if (!task) {
95235
+ const data2 = { exists: false, taskId };
95236
+ cliOutput(data2, { command: "exists", operation: "tasks.exists" });
95081
95237
  process.exit(4 /* NOT_FOUND */);
95082
95238
  }
95239
+ const data = { exists: true, taskId };
95240
+ if (opts["verbose"]) {
95241
+ data["title"] = task.title;
95242
+ data["status"] = task.status;
95243
+ }
95244
+ cliOutput(data, { command: "exists", operation: "tasks.exists" });
95083
95245
  });
95084
95246
  }
95085
95247
 
@@ -95623,7 +95785,7 @@ async function handleIssueType(issueType, opts) {
95623
95785
  // packages/cleo/src/cli/commands/labels.ts
95624
95786
  function registerLabelsCommand(program) {
95625
95787
  const labels = program.command("labels").description("List all labels with counts or show tasks with specific label");
95626
- labels.command("list").description("List all labels with task counts (default)").action(async () => {
95788
+ labels.command("list", { isDefault: true }).description("List all labels with task counts (default)").action(async () => {
95627
95789
  await dispatchFromCli("query", "tasks", "label.list", {}, { command: "labels" });
95628
95790
  });
95629
95791
  labels.command("show <label>").description("Show tasks with specific label").action(async (label) => {
@@ -96507,7 +96669,7 @@ function registerPhaseCommand(program) {
96507
96669
  // packages/cleo/src/cli/commands/phases.ts
96508
96670
  function registerPhasesCommand(program) {
96509
96671
  const phases = program.command("phases").description("List phases with progress bars and statistics");
96510
- phases.command("list").description("List all phases with progress (default)").action(async () => {
96672
+ phases.command("list", { isDefault: true }).description("List all phases with progress (default)").action(async () => {
96511
96673
  await dispatchFromCli("query", "pipeline", "phase.list", {}, { command: "phases" });
96512
96674
  });
96513
96675
  phases.command("show <phase>").description("Show phase details and task counts").action(async (phase) => {
@@ -98910,14 +99072,15 @@ function shimToCitty(shim) {
98910
99072
  subCommands2[alias] = shimToCitty(sub);
98911
99073
  }
98912
99074
  }
98913
- return defineCommand({
99075
+ const cittyDef = defineCommand({
98914
99076
  meta: {
98915
99077
  name: shim._name,
98916
99078
  description: shim._description
98917
99079
  },
98918
99080
  args: cittyArgs,
98919
99081
  ...Object.keys(subCommands2).length > 0 ? { subCommands: subCommands2 } : {},
98920
- async run({ args }) {
99082
+ async run(context) {
99083
+ const { args } = context;
98921
99084
  if (shim._action) {
98922
99085
  const positionalValues = [];
98923
99086
  for (const arg of shim._args) {
@@ -98935,9 +99098,17 @@ function shimToCitty(shim) {
98935
99098
  }
98936
99099
  }
98937
99100
  await shim._action(...positionalValues, opts, shim);
99101
+ } else if (shim._subcommands.length > 0) {
99102
+ const defaultSub = shim._subcommands.find((s) => s._isDefault);
99103
+ if (defaultSub?._action) {
99104
+ await defaultSub._action({}, defaultSub);
99105
+ } else {
99106
+ await showUsage(context.cmd);
99107
+ }
98938
99108
  }
98939
99109
  }
98940
99110
  });
99111
+ return cittyDef;
98941
99112
  }
98942
99113
  var subCommands = {};
98943
99114
  subCommands["version"] = defineCommand({