@cleocode/cleo 2026.4.24 → 2026.4.26

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: readFileSync102, existsSync: existsSync131 } = await import("node:fs");
38792
+ const { readFileSync: readFileSync103, 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(readFileSync102(infoPath, "utf-8"));
38795
+ const data = JSON.parse(readFileSync103(infoPath, "utf-8"));
38796
38796
  return typeof data.projectId === "string" ? data.projectId : "";
38797
38797
  } catch {
38798
38798
  return "";
@@ -75190,6 +75190,7 @@ var init_cleo = __esm({
75190
75190
  // packages/core/src/index.ts
75191
75191
  var init_src2 = __esm({
75192
75192
  "packages/core/src/index.ts"() {
75193
+ "use strict";
75193
75194
  init_src();
75194
75195
  init_adapters();
75195
75196
  init_admin();
@@ -102133,6 +102134,30 @@ var init_registry5 = __esm({
102133
102134
  sessionRequired: false,
102134
102135
  requiredParams: []
102135
102136
  },
102137
+ {
102138
+ gateway: "query",
102139
+ domain: "admin",
102140
+ operation: "roadmap",
102141
+ description: "admin.roadmap (query) \u2014 project roadmap from task provenance, epics grouped by status with progress",
102142
+ tier: 1,
102143
+ idempotent: true,
102144
+ sessionRequired: false,
102145
+ requiredParams: [],
102146
+ params: [
102147
+ {
102148
+ name: "includeHistory",
102149
+ type: "boolean",
102150
+ required: false,
102151
+ description: "Include release history from CHANGELOG.md"
102152
+ },
102153
+ {
102154
+ name: "upcomingOnly",
102155
+ type: "boolean",
102156
+ required: false,
102157
+ description: "Only show pending/upcoming epics (exclude completed)"
102158
+ }
102159
+ ]
102160
+ },
102136
102161
  {
102137
102162
  gateway: "query",
102138
102163
  domain: "admin",
@@ -106707,6 +106732,40 @@ var init_release_engine = __esm({
106707
106732
  });
106708
106733
 
106709
106734
  // packages/cleo/src/dispatch/engines/system-engine.ts
106735
+ var system_engine_exports = {};
106736
+ __export(system_engine_exports, {
106737
+ backupRestore: () => backupRestore,
106738
+ systemArchiveStats: () => systemArchiveStats,
106739
+ systemAudit: () => systemAudit,
106740
+ systemBackup: () => systemBackup,
106741
+ systemCleanup: () => systemCleanup,
106742
+ systemCompliance: () => systemCompliance,
106743
+ systemContext: () => systemContext,
106744
+ systemDash: () => systemDash,
106745
+ systemDiagnostics: () => systemDiagnostics,
106746
+ systemDoctor: () => systemDoctor,
106747
+ systemFix: () => systemFix,
106748
+ systemHealth: () => systemHealth,
106749
+ systemHelp: () => systemHelp,
106750
+ systemInjectGenerate: () => systemInjectGenerate,
106751
+ systemLabels: () => systemLabels,
106752
+ systemListBackups: () => systemListBackups,
106753
+ systemLog: () => systemLog,
106754
+ systemMetrics: () => systemMetrics,
106755
+ systemMigrate: () => systemMigrate,
106756
+ systemPaths: () => systemPaths,
106757
+ systemRestore: () => systemRestore,
106758
+ systemRoadmap: () => systemRoadmap,
106759
+ systemRuntime: () => systemRuntime,
106760
+ systemSafestop: () => systemSafestop,
106761
+ systemScaffoldHub: () => systemScaffoldHub,
106762
+ systemSequence: () => systemSequence,
106763
+ systemSequenceRepair: () => systemSequenceRepair,
106764
+ systemSmoke: () => systemSmoke,
106765
+ systemStats: () => systemStats,
106766
+ systemSync: () => systemSync,
106767
+ systemUncancel: () => systemUncancel
106768
+ });
106710
106769
  import { existsSync as existsSync126, readdirSync as readdirSync40, readFileSync as readFileSync94 } from "node:fs";
106711
106770
  import { basename as basename18, join as join121 } from "node:path";
106712
106771
  async function systemDash(projectRoot, params) {
@@ -106812,6 +106871,15 @@ async function systemStats(projectRoot, params) {
106812
106871
  return cleoErrorToEngineError(err, "E_NOT_INITIALIZED", "Failed to get stats");
106813
106872
  }
106814
106873
  }
106874
+ async function systemLabels(projectRoot) {
106875
+ try {
106876
+ const accessor = await getAccessor(projectRoot);
106877
+ const result = await getLabels(projectRoot, accessor);
106878
+ return { success: true, data: result };
106879
+ } catch (err) {
106880
+ return cleoErrorToEngineError(err, "E_NOT_INITIALIZED", "Failed to get labels");
106881
+ }
106882
+ }
106815
106883
  async function systemArchiveStats(projectRoot, params) {
106816
106884
  try {
106817
106885
  const accessor = await getAccessor(projectRoot);
@@ -107076,6 +107144,15 @@ async function systemInjectGenerate(projectRoot) {
107076
107144
  return cleoErrorToEngineError(err, "E_GENERAL", "Failed to generate injection");
107077
107145
  }
107078
107146
  }
107147
+ async function systemMetrics(projectRoot, params) {
107148
+ try {
107149
+ const accessor = await getAccessor(projectRoot);
107150
+ const result = await getSystemMetrics(projectRoot, params, accessor);
107151
+ return { success: true, data: result };
107152
+ } catch (err) {
107153
+ return cleoErrorToEngineError(err, "E_GENERAL", "Failed to get metrics");
107154
+ }
107155
+ }
107079
107156
  async function systemHealth(projectRoot, params) {
107080
107157
  try {
107081
107158
  const result = await getSystemHealth(projectRoot, params);
@@ -107084,6 +107161,176 @@ async function systemHealth(projectRoot, params) {
107084
107161
  return cleoErrorToEngineError(err, "E_GENERAL", "Failed to get health");
107085
107162
  }
107086
107163
  }
107164
+ async function systemDiagnostics(projectRoot, params) {
107165
+ try {
107166
+ const result = await getSystemDiagnostics(projectRoot, params);
107167
+ return { success: true, data: result };
107168
+ } catch (err) {
107169
+ return cleoErrorToEngineError(err, "E_GENERAL", "Failed to get diagnostics");
107170
+ }
107171
+ }
107172
+ function systemHelp(_projectRoot, params) {
107173
+ const topic = params?.topic;
107174
+ if (topic) {
107175
+ const topicHelp = HELP_TOPICS[topic];
107176
+ if (topicHelp) {
107177
+ return { success: true, data: topicHelp };
107178
+ }
107179
+ return engineError(
107180
+ "E_NOT_FOUND",
107181
+ `Unknown help topic: ${topic}. Available topics: ${Object.keys(HELP_TOPICS).join(", ")}`
107182
+ );
107183
+ }
107184
+ return {
107185
+ success: true,
107186
+ data: {
107187
+ content: [
107188
+ "CLEO Task Management System",
107189
+ "",
107190
+ "Essential Commands:",
107191
+ ' cleofind "query" - Fuzzy search tasks',
107192
+ " cleoshow T1234 - Full task details",
107193
+ ' cleoadd "Task" - Create task',
107194
+ " cleodone <id> - Complete task",
107195
+ " cleostart <id> - Start working on task",
107196
+ " cleodash - Project overview",
107197
+ " cleosession list - List sessions",
107198
+ "",
107199
+ "Help Topics: session, tasks, focus, labels, compliance"
107200
+ ].join("\n"),
107201
+ relatedCommands: ["cleo find", "cleo show", "cleo add", "cleo done", "cleo dash"]
107202
+ }
107203
+ };
107204
+ }
107205
+ async function systemRoadmap(projectRoot, params) {
107206
+ try {
107207
+ const accessor = await getAccessor(projectRoot);
107208
+ const result = await getRoadmap(
107209
+ {
107210
+ includeHistory: params?.includeHistory,
107211
+ upcomingOnly: params?.upcomingOnly,
107212
+ cwd: projectRoot
107213
+ },
107214
+ accessor
107215
+ );
107216
+ return { success: true, data: result };
107217
+ } catch (err) {
107218
+ return cleoErrorToEngineError(err, "E_NOT_INITIALIZED", "System not initialized");
107219
+ }
107220
+ }
107221
+ function systemCompliance(projectRoot, params) {
107222
+ try {
107223
+ if (params?.subcommand === "trend") {
107224
+ const compliancePath2 = join121(projectRoot, ".cleo", "metrics", "COMPLIANCE.jsonl");
107225
+ let entries2 = [];
107226
+ if (existsSync126(compliancePath2)) {
107227
+ const content = readFileSync94(compliancePath2, "utf-8").trim();
107228
+ if (content) {
107229
+ entries2 = content.split("\n").filter((l) => l.trim()).map((l) => JSON.parse(l));
107230
+ }
107231
+ }
107232
+ if (params.epic) {
107233
+ entries2 = entries2.filter((e) => {
107234
+ const ctx = e._context ?? {};
107235
+ return ctx.epic_id === params.epic || ctx.task_id === params.epic;
107236
+ });
107237
+ }
107238
+ if (params.days) {
107239
+ const cutoff = new Date(Date.now() - params.days * 864e5).toISOString();
107240
+ entries2 = entries2.filter((e) => e.timestamp >= cutoff);
107241
+ }
107242
+ const totalEntries2 = entries2.length;
107243
+ const compliance2 = entries2.map((e) => e.compliance ?? {});
107244
+ const avgPassRate2 = totalEntries2 > 0 ? Math.round(
107245
+ compliance2.reduce((sum, c) => sum + (c.compliance_pass_rate ?? 0), 0) / totalEntries2 * 1e3
107246
+ ) / 1e3 : 0;
107247
+ const avgAdherence2 = totalEntries2 > 0 ? Math.round(
107248
+ compliance2.reduce((sum, c) => sum + (c.rule_adherence_score ?? 0), 0) / totalEntries2 * 1e3
107249
+ ) / 1e3 : 0;
107250
+ const totalViolations2 = compliance2.reduce(
107251
+ (sum, c) => sum + (c.violation_count ?? 0),
107252
+ 0
107253
+ );
107254
+ const byDate = {};
107255
+ for (const e of entries2) {
107256
+ const date6 = e.timestamp.split("T")[0];
107257
+ if (!byDate[date6]) byDate[date6] = [];
107258
+ byDate[date6].push(e);
107259
+ }
107260
+ const dataPoints = Object.entries(byDate).sort(([a], [b2]) => a.localeCompare(b2)).map(([date6, dayEntries]) => {
107261
+ const dayCompliance = dayEntries.map(
107262
+ (de2) => de2.compliance ?? {}
107263
+ );
107264
+ return {
107265
+ date: date6,
107266
+ entries: dayEntries.length,
107267
+ avgPassRate: dayCompliance.reduce((s3, c) => s3 + (c.compliance_pass_rate ?? 0), 0) / dayEntries.length,
107268
+ violations: dayCompliance.reduce((s3, c) => s3 + (c.violation_count ?? 0), 0)
107269
+ };
107270
+ });
107271
+ let trend;
107272
+ if (dataPoints.length >= 2) {
107273
+ const first = dataPoints[0].avgPassRate;
107274
+ const last = dataPoints[dataPoints.length - 1].avgPassRate;
107275
+ trend = last > first ? "improving" : last < first ? "declining" : "stable";
107276
+ } else {
107277
+ trend = "insufficient_data";
107278
+ }
107279
+ return {
107280
+ success: true,
107281
+ data: {
107282
+ totalEntries: totalEntries2,
107283
+ averagePassRate: avgPassRate2,
107284
+ averageAdherence: avgAdherence2,
107285
+ totalViolations: totalViolations2,
107286
+ trend,
107287
+ dataPoints
107288
+ }
107289
+ };
107290
+ }
107291
+ const compliancePath = join121(projectRoot, ".cleo", "metrics", "COMPLIANCE.jsonl");
107292
+ let entries = [];
107293
+ if (existsSync126(compliancePath)) {
107294
+ const content = readFileSync94(compliancePath, "utf-8").trim();
107295
+ if (content) {
107296
+ entries = content.split("\n").filter((l) => l.trim()).map((l) => JSON.parse(l));
107297
+ }
107298
+ }
107299
+ if (params?.epic) {
107300
+ entries = entries.filter((e) => {
107301
+ const ctx = e._context ?? {};
107302
+ return ctx.epic_id === params.epic || ctx.task_id === params.epic;
107303
+ });
107304
+ }
107305
+ if (params?.days) {
107306
+ const cutoff = new Date(Date.now() - params.days * 864e5).toISOString();
107307
+ entries = entries.filter((e) => e.timestamp >= cutoff);
107308
+ }
107309
+ const totalEntries = entries.length;
107310
+ const compliance = entries.map((e) => e.compliance ?? {});
107311
+ const avgPassRate = totalEntries > 0 ? Math.round(
107312
+ compliance.reduce((sum, c) => sum + (c.compliance_pass_rate ?? 0), 0) / totalEntries * 1e3
107313
+ ) / 1e3 : 0;
107314
+ const avgAdherence = totalEntries > 0 ? Math.round(
107315
+ compliance.reduce((sum, c) => sum + (c.rule_adherence_score ?? 0), 0) / totalEntries * 1e3
107316
+ ) / 1e3 : 0;
107317
+ const totalViolations = compliance.reduce(
107318
+ (sum, c) => sum + (c.violation_count ?? 0),
107319
+ 0
107320
+ );
107321
+ return {
107322
+ success: true,
107323
+ data: {
107324
+ totalEntries,
107325
+ averagePassRate: avgPassRate,
107326
+ averageAdherence: avgAdherence,
107327
+ totalViolations
107328
+ }
107329
+ };
107330
+ } catch (err) {
107331
+ return cleoErrorToEngineError(err, "E_GENERAL", "Failed to get roadmap");
107332
+ }
107333
+ }
107087
107334
  async function systemBackup(projectRoot, params) {
107088
107335
  try {
107089
107336
  const result = await createBackup2(projectRoot, params);
@@ -107171,6 +107418,25 @@ async function systemCleanup(projectRoot, params) {
107171
107418
  return cleoErrorToEngineError(err, "E_CLEANUP_FAILED", "Failed to cleanup");
107172
107419
  }
107173
107420
  }
107421
+ async function systemAudit(projectRoot, params) {
107422
+ try {
107423
+ const result = await auditData(projectRoot, params);
107424
+ return { success: true, data: result };
107425
+ } catch (err) {
107426
+ return cleoErrorToEngineError(err, "E_GENERAL", "Failed to audit");
107427
+ }
107428
+ }
107429
+ function systemSync(_projectRoot, params) {
107430
+ return {
107431
+ success: true,
107432
+ data: {
107433
+ direction: params?.direction ?? "up",
107434
+ synced: 0,
107435
+ conflicts: 0,
107436
+ message: "Sync is a no-op in native mode (no external sync targets configured)"
107437
+ }
107438
+ };
107439
+ }
107174
107440
  function systemSafestop(projectRoot, params) {
107175
107441
  try {
107176
107442
  const result = safestop(projectRoot, params);
@@ -107179,6 +107445,14 @@ function systemSafestop(projectRoot, params) {
107179
107445
  return cleoErrorToEngineError(err, "E_GENERAL", "Sync failed");
107180
107446
  }
107181
107447
  }
107448
+ async function systemUncancel(projectRoot, params) {
107449
+ try {
107450
+ const result = await uncancelTask(projectRoot, params);
107451
+ return { success: true, data: result };
107452
+ } catch (err) {
107453
+ return cleoErrorToEngineError(err, "E_UNCANCEL_FAILED", "Failed to uncancel");
107454
+ }
107455
+ }
107182
107456
  async function systemDoctor(projectRoot) {
107183
107457
  const { coreDoctorReport: coreDoctorReport2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
107184
107458
  try {
@@ -107248,6 +107522,23 @@ async function systemScaffoldHub() {
107248
107522
  return cleoErrorToEngineError(err, "E_SCAFFOLD_HUB_FAILED", "Failed to scaffold hub");
107249
107523
  }
107250
107524
  }
107525
+ async function systemSequenceRepair(projectRoot) {
107526
+ try {
107527
+ const repair = await repairSequence(projectRoot);
107528
+ return {
107529
+ success: true,
107530
+ data: {
107531
+ repaired: repair.repaired,
107532
+ message: repair.message,
107533
+ counter: repair.counter,
107534
+ oldCounter: repair.oldCounter,
107535
+ newCounter: repair.newCounter
107536
+ }
107537
+ };
107538
+ } catch (err) {
107539
+ return cleoErrorToEngineError(err, "E_SEQUENCE_REPAIR_FAILED", "Failed to repair sequence");
107540
+ }
107541
+ }
107251
107542
  async function systemSmoke() {
107252
107543
  const { dispatchRaw: dispatchRaw2 } = await Promise.resolve().then(() => (init_cli(), cli_exports));
107253
107544
  const totalStart = Date.now();
@@ -109131,6 +109422,13 @@ var init_admin2 = __esm({
109131
109422
  });
109132
109423
  return wrapResult(result, "query", "admin", operation, startTime);
109133
109424
  }
109425
+ case "roadmap": {
109426
+ const result = await systemRoadmap(projectRoot, {
109427
+ includeHistory: params?.includeHistory,
109428
+ upcomingOnly: params?.upcomingOnly
109429
+ });
109430
+ return wrapResult(result, "query", "admin", operation, startTime);
109431
+ }
109134
109432
  case "smoke": {
109135
109433
  const result = await systemSmoke();
109136
109434
  return wrapResult(result, "query", "admin", operation, startTime);
@@ -109631,6 +109929,7 @@ var init_admin2 = __esm({
109631
109929
  "backup",
109632
109930
  "export",
109633
109931
  "map",
109932
+ "roadmap",
109634
109933
  "smoke",
109635
109934
  "hooks.matrix"
109636
109935
  ],
@@ -111441,7 +111740,7 @@ var init_nexus2 = __esm({
111441
111740
  async function orchestrateClassify(request, context, projectRoot) {
111442
111741
  try {
111443
111742
  const { getCleoCantWorkflowsDir: getCleoCantWorkflowsDir2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
111444
- const { readFileSync: readFileSync102, readdirSync: readdirSync42, existsSync: existsSync131 } = await import("node:fs");
111743
+ const { readFileSync: readFileSync103, readdirSync: readdirSync42, existsSync: existsSync131 } = await import("node:fs");
111445
111744
  const { join: join131 } = await import("node:path");
111446
111745
  const workflowsDir = getCleoCantWorkflowsDir2();
111447
111746
  const combined = `${request} ${context ?? ""}`.toLowerCase();
@@ -111450,7 +111749,7 @@ async function orchestrateClassify(request, context, projectRoot) {
111450
111749
  const files = readdirSync42(workflowsDir).filter((f2) => f2.endsWith(".cant"));
111451
111750
  for (const file2 of files) {
111452
111751
  try {
111453
- const src = readFileSync102(join131(workflowsDir, file2), "utf-8");
111752
+ const src = readFileSync103(join131(workflowsDir, file2), "utf-8");
111454
111753
  const teamMatch = /^team\s+(\S+):/m.exec(src);
111455
111754
  if (!teamMatch) continue;
111456
111755
  const teamName = teamMatch[1];
@@ -111470,7 +111769,7 @@ async function orchestrateClassify(request, context, projectRoot) {
111470
111769
  const files = readdirSync42(localCantDir).filter((f2) => f2.endsWith(".cant"));
111471
111770
  for (const file2 of files) {
111472
111771
  try {
111473
- const src = readFileSync102(join131(localCantDir, file2), "utf-8");
111772
+ const src = readFileSync103(join131(localCantDir, file2), "utf-8");
111474
111773
  const teamMatch = /^team\s+(\S+):/m.exec(src);
111475
111774
  if (!teamMatch) continue;
111476
111775
  const teamName = teamMatch[1];
@@ -116010,7 +116309,7 @@ var init_cli = __esm({
116010
116309
 
116011
116310
  // packages/cleo/src/cli/index.ts
116012
116311
  init_internal();
116013
- import { readFileSync as readFileSync101 } from "node:fs";
116312
+ import { readFileSync as readFileSync102 } from "node:fs";
116014
116313
  import { dirname as dirname28, join as join130 } from "node:path";
116015
116314
  import { fileURLToPath as fileURLToPath5 } from "node:url";
116016
116315
 
@@ -116791,6 +117090,75 @@ function resolveFormat2(opts, defaults) {
116791
117090
  return resolveOutputFormat(input);
116792
117091
  }
116793
117092
 
117093
+ // packages/cleo/src/cli/commands/adapter.ts
117094
+ init_cli();
117095
+ function registerAdapterCommand(program) {
117096
+ const adapterCmd = program.command("adapter").description("Provider adapter management: list, show, detect, health, activate, dispose");
117097
+ adapterCmd.command("list").description("List all discovered provider adapters").action(async () => {
117098
+ await dispatchFromCli(
117099
+ "query",
117100
+ "tools",
117101
+ "adapter.list",
117102
+ {},
117103
+ { command: "adapter", operation: "tools.adapter.list" }
117104
+ );
117105
+ });
117106
+ adapterCmd.command("show <adapter-id>").description("Show details for a specific adapter").action(async (adapterId) => {
117107
+ await dispatchFromCli(
117108
+ "query",
117109
+ "tools",
117110
+ "adapter.show",
117111
+ { id: adapterId },
117112
+ { command: "adapter", operation: "tools.adapter.show" }
117113
+ );
117114
+ });
117115
+ adapterCmd.command("detect").description("Detect active providers in the current environment").action(async () => {
117116
+ await dispatchFromCli(
117117
+ "query",
117118
+ "tools",
117119
+ "adapter.detect",
117120
+ {},
117121
+ { command: "adapter", operation: "tools.adapter.detect" }
117122
+ );
117123
+ });
117124
+ adapterCmd.command("health").description("Show health status for adapters").option("--id <adapter-id>", "Specific adapter ID (omit for all adapters)").action(async (opts) => {
117125
+ await dispatchFromCli(
117126
+ "query",
117127
+ "tools",
117128
+ "adapter.health",
117129
+ { id: opts["id"] },
117130
+ { command: "adapter", operation: "tools.adapter.health" }
117131
+ );
117132
+ });
117133
+ adapterCmd.command("activate <adapter-id>").description("Load and activate a provider adapter").action(async (adapterId) => {
117134
+ await dispatchFromCli(
117135
+ "mutate",
117136
+ "tools",
117137
+ "adapter.activate",
117138
+ { id: adapterId },
117139
+ { command: "adapter", operation: "tools.adapter.activate" }
117140
+ );
117141
+ });
117142
+ adapterCmd.command("dispose").description("Dispose one or all adapters").option("--id <adapter-id>", "Specific adapter ID to dispose (omit to dispose all)").action(async (opts) => {
117143
+ await dispatchFromCli(
117144
+ "mutate",
117145
+ "tools",
117146
+ "adapter.dispose",
117147
+ { id: opts["id"] },
117148
+ { command: "adapter", operation: "tools.adapter.dispose" }
117149
+ );
117150
+ });
117151
+ adapterCmd.action(async () => {
117152
+ await dispatchFromCli(
117153
+ "query",
117154
+ "tools",
117155
+ "adapter.list",
117156
+ {},
117157
+ { command: "adapter", operation: "tools.adapter.list" }
117158
+ );
117159
+ });
117160
+ }
117161
+
116794
117162
  // packages/cleo/src/cli/commands/add.ts
116795
117163
  init_cli();
116796
117164
 
@@ -117226,6 +117594,83 @@ function registerAdminCommand(program) {
117226
117594
  ).action(async () => {
117227
117595
  await dispatchFromCli("mutate", "admin", "scaffold-hub", {}, { command: "admin" });
117228
117596
  });
117597
+ admin.command("cleanup").description("Purge stale CLEO data (backups, logs, archive entries)").requiredOption("--target <target>", "What to clean: backups | logs | archive | sessions").option("--older-than <age>", "Remove entries older than this duration (e.g. 30d, 6m, 1y)").option("--dry-run", "Preview what would be removed without making changes").action(async (opts) => {
117598
+ await dispatchFromCli(
117599
+ "mutate",
117600
+ "admin",
117601
+ "cleanup",
117602
+ {
117603
+ target: opts["target"],
117604
+ olderThan: opts["olderThan"],
117605
+ dryRun: opts["dryRun"] === true
117606
+ },
117607
+ { command: "admin cleanup", operation: "admin.cleanup" }
117608
+ );
117609
+ });
117610
+ const job = admin.command("job").description("Inspect background jobs managed by the job manager");
117611
+ job.command("list", { isDefault: true }).description("List all background jobs (default)").option("--status <status>", "Filter by job status (pending, running, done, failed, cancelled)").option("--limit <n>", "Maximum jobs to return", "20").option("--offset <n>", "Skip N jobs", "0").action(async (opts) => {
117612
+ await dispatchFromCli(
117613
+ "query",
117614
+ "admin",
117615
+ "job",
117616
+ {
117617
+ action: "list",
117618
+ status: opts["status"],
117619
+ limit: opts["limit"] ? Number(opts["limit"]) : 20,
117620
+ offset: opts["offset"] ? Number(opts["offset"]) : 0
117621
+ },
117622
+ { command: "admin job list", operation: "admin.job" }
117623
+ );
117624
+ });
117625
+ job.command("status <jobId>").description("Show status of a specific background job").action(async (jobId) => {
117626
+ await dispatchFromCli(
117627
+ "query",
117628
+ "admin",
117629
+ "job",
117630
+ { action: "status", jobId },
117631
+ { command: "admin job status", operation: "admin.job" }
117632
+ );
117633
+ });
117634
+ job.command("cancel <jobId>").description("Cancel a running background job").action(async (jobId) => {
117635
+ await dispatchFromCli(
117636
+ "mutate",
117637
+ "admin",
117638
+ "job.cancel",
117639
+ { jobId },
117640
+ { command: "admin job cancel", operation: "admin.job.cancel" }
117641
+ );
117642
+ });
117643
+ admin.command("install-global").description("Refresh global CLEO setup (provider files, configs, ~/.agents/AGENTS.md)").action(async () => {
117644
+ await dispatchFromCli(
117645
+ "mutate",
117646
+ "admin",
117647
+ "install.global",
117648
+ {},
117649
+ { command: "admin install-global", operation: "admin.install.global" }
117650
+ );
117651
+ });
117652
+ admin.command("context-inject <protocolType>").description(
117653
+ "Inject protocol content into session context (e.g. cleo-base, ct-orchestrator, ct-cleo)"
117654
+ ).option("--task <id>", "Scope injection to a specific task ID").option("--variant <variant>", "Select a named protocol variant").action(async (protocolType, opts) => {
117655
+ if (!protocolType || typeof protocolType !== "string" || protocolType.trim() === "") {
117656
+ console.error("Error: missing required argument <protocolType>");
117657
+ console.error(
117658
+ "Usage: cleo admin context-inject <protocolType> [--task <id>] [--variant <variant>]"
117659
+ );
117660
+ process.exit(1);
117661
+ }
117662
+ await dispatchFromCli(
117663
+ "mutate",
117664
+ "admin",
117665
+ "context.inject",
117666
+ {
117667
+ protocolType,
117668
+ taskId: opts["task"],
117669
+ variant: opts["variant"]
117670
+ },
117671
+ { command: "admin context-inject", operation: "admin.context.inject" }
117672
+ );
117673
+ });
117229
117674
  }
117230
117675
 
117231
117676
  // packages/cleo/src/cli/commands/adr.ts
@@ -117468,7 +117913,7 @@ agent ${agentId}:
117468
117913
  try {
117469
117914
  const { AgentRegistryAccessor: AgentRegistryAccessor2, getDb: getDb4 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
117470
117915
  const { createRuntime } = await import("@cleocode/runtime");
117471
- const { existsSync: existsSync131, readFileSync: readFileSync102 } = await import("node:fs");
117916
+ const { existsSync: existsSync131, readFileSync: readFileSync103 } = await import("node:fs");
117472
117917
  const { join: join131 } = await import("node:path");
117473
117918
  await getDb4();
117474
117919
  const registry2 = new AgentRegistryAccessor2(process.cwd());
@@ -117491,7 +117936,7 @@ agent ${agentId}:
117491
117936
  let cantValidation = null;
117492
117937
  const cantPath = opts["cant"] ?? join131(".cleo", "agents", `${agentId}.cant`);
117493
117938
  if (existsSync131(cantPath)) {
117494
- profile = readFileSync102(cantPath, "utf-8");
117939
+ profile = readFileSync103(cantPath, "utf-8");
117495
117940
  try {
117496
117941
  const cantModule = await import("@cleocode/cant");
117497
117942
  const validate = "validate" in cantModule ? cantModule.validate : null;
@@ -118531,7 +118976,7 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
118531
118976
  });
118532
118977
  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) => {
118533
118978
  try {
118534
- const { existsSync: existsSync131, mkdirSync: mkdirSync31, cpSync, readFileSync: readFileSync102, rmSync: rmSync3, statSync: statSync22 } = await import("node:fs");
118979
+ const { existsSync: existsSync131, mkdirSync: mkdirSync31, cpSync, readFileSync: readFileSync103, rmSync: rmSync3, statSync: statSync22 } = await import("node:fs");
118535
118980
  const { join: join131, basename: basename19, resolve: resolve16 } = await import("node:path");
118536
118981
  const { homedir: homedir7 } = await import("node:os");
118537
118982
  const { tmpdir: tmpdir3 } = await import("node:os");
@@ -118650,7 +119095,7 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
118650
119095
  }
118651
119096
  let registered = false;
118652
119097
  try {
118653
- const persona = readFileSync102(join131(targetDir, "persona.cant"), "utf-8");
119098
+ const persona = readFileSync103(join131(targetDir, "persona.cant"), "utf-8");
118654
119099
  const descMatch = persona.match(/description:\s*"([^"]+)"/);
118655
119100
  const displayName = descMatch?.[1] ?? agentName;
118656
119101
  const { AgentRegistryAccessor: AgentRegistryAccessor2, getDb: getDb4 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
@@ -120247,6 +120692,23 @@ function registerBugCommand(program) {
120247
120692
  });
120248
120693
  }
120249
120694
 
120695
+ // packages/cleo/src/cli/commands/cancel.ts
120696
+ init_cli();
120697
+ function registerCancelCommand(program) {
120698
+ program.command("cancel <taskId>").description("Cancel a task (soft terminal state; reversible via restore)").option("--reason <reason>", "Reason for cancellation").action(async (taskId, opts) => {
120699
+ await dispatchFromCli(
120700
+ "mutate",
120701
+ "tasks",
120702
+ "cancel",
120703
+ {
120704
+ taskId,
120705
+ reason: opts["reason"]
120706
+ },
120707
+ { command: "cancel", operation: "tasks.cancel" }
120708
+ );
120709
+ });
120710
+ }
120711
+
120250
120712
  // packages/cleo/src/cli/commands/cant.ts
120251
120713
  init_renderers();
120252
120714
  import { existsSync as existsSync128, mkdirSync as mkdirSync29, readFileSync as readFileSync97, writeFileSync as writeFileSync23 } from "node:fs";
@@ -120418,6 +120880,47 @@ async function loadMigrateEngine() {
120418
120880
  throw new Error("Cannot load CANT migration engine. Ensure @cleocode/cant is installed.");
120419
120881
  }
120420
120882
 
120883
+ // packages/cleo/src/cli/commands/chain.ts
120884
+ init_cli();
120885
+ import { readFileSync as readFileSync98 } from "node:fs";
120886
+ function registerChainCommand(program) {
120887
+ const chain = program.command("chain").description("WarpChain pipeline management (tier-2 orchestrator)");
120888
+ chain.command("show <chainId>").description("Show details for a WarpChain definition").action(async (chainId) => {
120889
+ await dispatchFromCli("query", "pipeline", "chain.show", { chainId }, { command: "chain" });
120890
+ });
120891
+ chain.command("list").description("List all WarpChain definitions").action(async () => {
120892
+ await dispatchFromCli("query", "pipeline", "chain.list", {}, { command: "chain" });
120893
+ });
120894
+ 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"));
120896
+ await dispatchFromCli(
120897
+ "mutate",
120898
+ "pipeline",
120899
+ "chain.add",
120900
+ { chain: chainJson },
120901
+ { command: "chain" }
120902
+ );
120903
+ });
120904
+ chain.command("instantiate <chainId> <epicId>").description("Instantiate a WarpChain for an epic").action(async (chainId, epicId) => {
120905
+ await dispatchFromCli(
120906
+ "mutate",
120907
+ "pipeline",
120908
+ "chain.instantiate",
120909
+ { chainId, epicId },
120910
+ { command: "chain" }
120911
+ );
120912
+ });
120913
+ chain.command("advance <instanceId> <nextStage>").description("Advance a WarpChain instance to the next stage").action(async (instanceId, nextStage) => {
120914
+ await dispatchFromCli(
120915
+ "mutate",
120916
+ "pipeline",
120917
+ "chain.advance",
120918
+ { instanceId, nextStage },
120919
+ { command: "chain" }
120920
+ );
120921
+ });
120922
+ }
120923
+
120421
120924
  // packages/cleo/src/cli/commands/check.ts
120422
120925
  init_cli();
120423
120926
  var SUPPORTED_PROTOCOL_TYPES = [
@@ -120445,6 +120948,36 @@ function registerCheckCommand(program) {
120445
120948
  check2.command("task <taskId>").description("Validate a specific task").action(async (taskId) => {
120446
120949
  await dispatchFromCli("query", "check", "task", { taskId }, { command: "check" });
120447
120950
  });
120951
+ check2.command("output <filePath>").description("Validate an agent output file against the manifest schema").option("--task-id <id>", "Task ID the output file belongs to").action(async (filePath, opts) => {
120952
+ await dispatchFromCli(
120953
+ "query",
120954
+ "check",
120955
+ "output",
120956
+ {
120957
+ filePath,
120958
+ taskId: opts["taskId"]
120959
+ },
120960
+ { command: "check", operation: "check.output" }
120961
+ );
120962
+ });
120963
+ 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");
120965
+ let chain;
120966
+ try {
120967
+ chain = JSON.parse(readFileSync103(file2, "utf8"));
120968
+ } catch (err) {
120969
+ const message = err instanceof Error ? err.message : String(err);
120970
+ console.error(`Failed to read or parse chain file: ${message}`);
120971
+ process.exit(2);
120972
+ }
120973
+ await dispatchFromCli(
120974
+ "query",
120975
+ "check",
120976
+ "chain.validate",
120977
+ { chain },
120978
+ { command: "check", operation: "check.chain.validate" }
120979
+ );
120980
+ });
120448
120981
  check2.command("protocol <protocolType>").description(
120449
120982
  `Validate any of the 12 RCASD-IVTR+C protocols: ${SUPPORTED_PROTOCOL_TYPES.join(", ")}`
120450
120983
  ).option("--task-id <id>", "Task ID to validate (mode=task, default)").option("--manifest-file <file>", "Manifest file to validate (mode=manifest)").option("--strict", "Exit with error code on violations").option("--voting-matrix-file <file>", "consensus: voting matrix JSON file").option("--epic-id <id>", "decomposition: parent epic ID").option("--sibling-count <n>", "decomposition: actual sibling count", Number).option("--max-siblings <n>", "decomposition: configured max siblings", Number).option("--spec-file <file>", "specification: path to spec markdown").option("--has-code-changes", "research: code changes detected (forbidden)").option("--has-task-tags", "implementation: @task tags present in code").option("--has-contribution-tags", "contribution: @contribution tags present").option("--version <v>", "release: target version (semver/calver)").option("--has-changelog", "release: changelog updated").option(
@@ -120596,6 +121129,34 @@ function registerCheckpointCommand(program) {
120596
121129
  });
120597
121130
  }
120598
121131
 
121132
+ // packages/cleo/src/cli/commands/claim.ts
121133
+ init_cli();
121134
+ 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) => {
121136
+ await dispatchFromCli(
121137
+ "mutate",
121138
+ "tasks",
121139
+ "claim",
121140
+ {
121141
+ id: taskId,
121142
+ agentId: opts["agent"]
121143
+ },
121144
+ { command: "claim", operation: "tasks.claim" }
121145
+ );
121146
+ });
121147
+ }
121148
+ function registerUnclaimCommand(program) {
121149
+ program.command("unclaim <taskId>").description("Unclaim a task by removing its current assignee").action(async (taskId) => {
121150
+ await dispatchFromCli(
121151
+ "mutate",
121152
+ "tasks",
121153
+ "unclaim",
121154
+ { id: taskId },
121155
+ { command: "unclaim", operation: "tasks.unclaim" }
121156
+ );
121157
+ });
121158
+ }
121159
+
120599
121160
  // packages/cleo/src/cli/commands/commands.ts
120600
121161
  init_cli();
120601
121162
  function registerCommandsCommand(program) {
@@ -120687,6 +121248,21 @@ function registerCompleteCommand(program) {
120687
121248
  });
120688
121249
  }
120689
121250
 
121251
+ // packages/cleo/src/cli/commands/complexity.ts
121252
+ init_cli();
121253
+ function registerComplexityCommand(program) {
121254
+ const complexity = program.command("complexity").description("Task complexity analysis");
121255
+ complexity.command("estimate <taskId>").description("Estimate complexity of a task (small / medium / large)").action(async (taskId) => {
121256
+ await dispatchFromCli(
121257
+ "query",
121258
+ "tasks",
121259
+ "complexity.estimate",
121260
+ { taskId },
121261
+ { command: "complexity", operation: "tasks.complexity.estimate" }
121262
+ );
121263
+ });
121264
+ }
121265
+
120690
121266
  // packages/cleo/src/cli/commands/compliance.ts
120691
121267
  init_cli();
120692
121268
  function registerComplianceCommand(program) {
@@ -120777,6 +121353,34 @@ function registerComplianceCommand(program) {
120777
121353
  { command: "compliance" }
120778
121354
  );
120779
121355
  });
121356
+ compliance.command("record <taskId> <result>").description("Record a compliance check result for a task (pass|fail|warning)").option("--protocol <name>", "Protocol name the check applies to (e.g. implementation)").option(
121357
+ "--violation <spec>",
121358
+ 'Add a violation as "code:severity:message" (repeatable)',
121359
+ (val, prev) => [...prev, val],
121360
+ []
121361
+ ).action(async (taskId, result, opts) => {
121362
+ const rawViolations = opts["violation"];
121363
+ const violations = rawViolations.map((v2) => {
121364
+ const [code, severity, ...rest] = v2.split(":");
121365
+ return {
121366
+ code: code ?? "",
121367
+ severity: severity === "error" || severity === "warning" ? severity : "error",
121368
+ message: rest.join(":")
121369
+ };
121370
+ }).filter((v2) => v2.code);
121371
+ await dispatchFromCli(
121372
+ "mutate",
121373
+ "check",
121374
+ "compliance.record",
121375
+ {
121376
+ taskId,
121377
+ result,
121378
+ protocol: opts["protocol"],
121379
+ violations: violations.length > 0 ? violations : void 0
121380
+ },
121381
+ { command: "compliance", operation: "check.compliance.record" }
121382
+ );
121383
+ });
120780
121384
  }
120781
121385
 
120782
121386
  // packages/cleo/src/cli/commands/config.ts
@@ -121048,7 +121652,7 @@ function registerDepsCommand(program) {
121048
121652
  {
121049
121653
  epicId
121050
121654
  },
121051
- { command: "deps", operation: "tasks.depends" }
121655
+ { command: "deps", operation: "orchestrate.waves" }
121052
121656
  );
121053
121657
  });
121054
121658
  deps.command("critical-path <taskId>").description("Find longest dependency chain from task").action(async (taskId) => {
@@ -121102,19 +121706,15 @@ function registerTreeCommand(program) {
121102
121706
  }
121103
121707
 
121104
121708
  // packages/cleo/src/cli/commands/detect.ts
121105
- init_internal();
121106
- init_renderers();
121709
+ init_cli();
121107
121710
  function registerDetectCommand(program) {
121108
121711
  program.command("detect").description("Re-detect project type and update project-context.json").action(async () => {
121109
- const projectRoot = getProjectRoot();
121110
- const result = await ensureProjectContext(projectRoot, { staleDays: 0 });
121111
- cliOutput(
121112
- {
121113
- action: result.action,
121114
- path: result.path,
121115
- details: result.details
121116
- },
121117
- { command: "detect" }
121712
+ await dispatchFromCli(
121713
+ "mutate",
121714
+ "admin",
121715
+ "detect",
121716
+ {},
121717
+ { command: "detect", operation: "admin.detect" }
121118
121718
  );
121119
121719
  });
121120
121720
  }
@@ -121122,7 +121722,7 @@ function registerDetectCommand(program) {
121122
121722
  // packages/cleo/src/cli/commands/detect-drift.ts
121123
121723
  init_src();
121124
121724
  init_renderers();
121125
- import { existsSync as existsSync129, readdirSync as readdirSync41, readFileSync as readFileSync98 } from "node:fs";
121725
+ import { existsSync as existsSync129, readdirSync as readdirSync41, readFileSync as readFileSync99 } from "node:fs";
121126
121726
  import { dirname as dirname26, join as join125 } from "node:path";
121127
121727
  function findProjectRoot() {
121128
121728
  let currentDir = process.cwd();
@@ -121142,7 +121742,7 @@ function registerDetectDriftCommand(program) {
121142
121742
  const isCleoRepo = existsSync129(join125(projectRoot, "src", "cli", "commands")) || existsSync129(join125(projectRoot, "packages", "cleo", "src"));
121143
121743
  const safeRead = (filePath) => {
121144
121744
  try {
121145
- return readFileSync98(filePath, "utf-8");
121745
+ return readFileSync99(filePath, "utf-8");
121146
121746
  } catch {
121147
121747
  return "";
121148
121748
  }
@@ -121877,27 +122477,6 @@ function registerDoctorCommand(program) {
121877
122477
  });
121878
122478
  }
121879
122479
 
121880
- // packages/cleo/src/cli/commands/env.ts
121881
- init_internal();
121882
- init_renderers();
121883
- async function getEnvStatus() {
121884
- return getRuntimeDiagnostics({ detailed: false });
121885
- }
121886
- async function getEnvInfo() {
121887
- return getRuntimeDiagnostics({ detailed: true });
121888
- }
121889
- function registerEnvCommand(program) {
121890
- const env = program.command("env").description("Environment and mode inspection");
121891
- env.command("status", { isDefault: true }).description("Show current environment mode and runtime info").action(async () => {
121892
- const result = await getEnvStatus();
121893
- cliOutput(result, { command: "env" });
121894
- });
121895
- env.command("info").description("Show detailed environment info including binary paths and compilation status").action(async () => {
121896
- const result = await getEnvInfo();
121897
- cliOutput(result, { command: "env" });
121898
- });
121899
- }
121900
-
121901
122480
  // packages/cleo/src/cli/commands/exists.ts
121902
122481
  init_src();
121903
122482
  init_internal();
@@ -122122,12 +122701,12 @@ init_src();
122122
122701
  init_src2();
122123
122702
  init_renderers();
122124
122703
  import { execFileSync as execFileSync16 } from "node:child_process";
122125
- import { existsSync as existsSync130, mkdirSync as mkdirSync30, readFileSync as readFileSync99, writeFileSync as writeFileSync24 } from "node:fs";
122704
+ import { existsSync as existsSync130, mkdirSync as mkdirSync30, readFileSync as readFileSync100, writeFileSync as writeFileSync24 } from "node:fs";
122126
122705
  import { dirname as dirname27, join as join127 } from "node:path";
122127
122706
  function getChangelogSource(cwd) {
122128
122707
  const configPath = getConfigPath(cwd);
122129
122708
  try {
122130
- const config2 = JSON.parse(readFileSync99(configPath, "utf-8"));
122709
+ const config2 = JSON.parse(readFileSync100(configPath, "utf-8"));
122131
122710
  return config2?.release?.changelog?.source ?? "CHANGELOG.md";
122132
122711
  } catch {
122133
122712
  return "CHANGELOG.md";
@@ -122136,7 +122715,7 @@ function getChangelogSource(cwd) {
122136
122715
  function getEnabledPlatforms(cwd) {
122137
122716
  const configPath = getConfigPath(cwd);
122138
122717
  try {
122139
- const config2 = JSON.parse(readFileSync99(configPath, "utf-8"));
122718
+ const config2 = JSON.parse(readFileSync100(configPath, "utf-8"));
122140
122719
  const outputs = config2?.release?.changelog?.outputs ?? [];
122141
122720
  return outputs.filter((o) => o.enabled);
122142
122721
  } catch {
@@ -122265,7 +122844,7 @@ function registerGenerateChangelogCommand(program) {
122265
122844
  if (!existsSync130(sourcePath)) {
122266
122845
  throw new CleoError(4 /* NOT_FOUND */, `Changelog source not found: ${sourcePath}`);
122267
122846
  }
122268
- const sourceContent = readFileSync99(sourcePath, "utf-8");
122847
+ const sourceContent = readFileSync100(sourcePath, "utf-8");
122269
122848
  const repoSlug = getGitHubRepoSlug();
122270
122849
  const results = [];
122271
122850
  if (targetPlatform) {
@@ -122658,6 +123237,56 @@ function registerLifecycleCommand(program) {
122658
123237
  { command: "lifecycle" }
122659
123238
  );
122660
123239
  });
123240
+ lifecycle.command("history <taskId>").description("Show full lifecycle stage history for a task or epic").action(async (taskId) => {
123241
+ await dispatchFromCli(
123242
+ "query",
123243
+ "pipeline",
123244
+ "stage.history",
123245
+ { taskId },
123246
+ { command: "lifecycle" }
123247
+ );
123248
+ });
123249
+ lifecycle.command("reset <epicId> <stage>").description("Reset a lifecycle stage back to pending").requiredOption("--reason <reason>", "Reason for resetting the stage").action(async (epicId, stage, opts) => {
123250
+ await dispatchFromCli(
123251
+ "mutate",
123252
+ "pipeline",
123253
+ "stage.reset",
123254
+ {
123255
+ taskId: epicId,
123256
+ stage,
123257
+ reason: opts["reason"]
123258
+ },
123259
+ { command: "lifecycle" }
123260
+ );
123261
+ });
123262
+ const gate = lifecycle.command("gate-record").description("Record a gate pass or fail for a lifecycle stage");
123263
+ gate.command("pass <epicId> <gateName>").description("Record a gate as passed for a lifecycle stage").option("--agent <agent>", "Agent that performed the gate check").option("--notes <notes>", "Notes on gate outcome").action(async (epicId, gateName, opts) => {
123264
+ await dispatchFromCli(
123265
+ "mutate",
123266
+ "pipeline",
123267
+ "stage.gate.pass",
123268
+ {
123269
+ taskId: epicId,
123270
+ gateName,
123271
+ agent: opts["agent"],
123272
+ notes: opts["notes"]
123273
+ },
123274
+ { command: "lifecycle" }
123275
+ );
123276
+ });
123277
+ gate.command("fail <epicId> <gateName>").description("Record a gate as failed for a lifecycle stage").option("--reason <reason>", "Reason the gate failed").action(async (epicId, gateName, opts) => {
123278
+ await dispatchFromCli(
123279
+ "mutate",
123280
+ "pipeline",
123281
+ "stage.gate.fail",
123282
+ {
123283
+ taskId: epicId,
123284
+ gateName,
123285
+ reason: opts["reason"]
123286
+ },
123287
+ { command: "lifecycle" }
123288
+ );
123289
+ });
122661
123290
  }
122662
123291
 
122663
123292
  // packages/cleo/src/cli/commands/list.ts
@@ -122907,9 +123536,20 @@ function registerMemoryBrainCommand(program) {
122907
123536
  }
122908
123537
  cliOutput(result, { command: "memory", operation: "memory.stats" });
122909
123538
  });
122910
- memory.command("observe <text>").description("Save an observation to brain.db").option("--title <title>", "Short title for the observation").option(
123539
+ memory.command("observe <text>").description(
123540
+ "Save an observation to brain.db \u2014 captures facts, decisions, and discoveries for cross-session memory"
123541
+ ).option(
123542
+ "--title <title>",
123543
+ "Short title for the observation (defaults to first 120 chars of text)"
123544
+ ).option(
123545
+ "--type <type>",
123546
+ "Category: discovery (found something new), decision (choice made), bugfix (bug found/fixed), refactor (code restructured), feature (feature added), change (general change), pattern (recurring pattern), session_summary (end-of-session recap)"
123547
+ ).option(
122911
123548
  "--agent <name>",
122912
- "Tag this observation with the producing agent name (Wave 8 mental models)"
123549
+ "Name of the agent producing this observation (enables per-agent memory retrieval)"
123550
+ ).option(
123551
+ "--source-type <sourceType>",
123552
+ "How this observation was captured: manual (typed by human/agent), auto (lifecycle hook), transcript (extracted from session)"
122913
123553
  ).action(async (text3, opts) => {
122914
123554
  await dispatchFromCli(
122915
123555
  "mutate",
@@ -122918,7 +123558,9 @@ function registerMemoryBrainCommand(program) {
122918
123558
  {
122919
123559
  text: text3,
122920
123560
  title: opts["title"],
122921
- ...opts["agent"] !== void 0 && { agent: opts["agent"] }
123561
+ ...opts["agent"] !== void 0 && { agent: opts["agent"] },
123562
+ ...opts["type"] !== void 0 && { type: opts["type"] },
123563
+ sourceType: opts["sourceType"] ?? "manual"
122922
123564
  },
122923
123565
  { command: "memory", operation: "memory.observe" }
122924
123566
  );
@@ -122946,15 +123588,149 @@ function registerMemoryBrainCommand(program) {
122946
123588
  { command: "memory", operation: "memory.fetch" }
122947
123589
  );
122948
123590
  });
123591
+ memory.command("decision-find [query]").description("Search decisions stored in brain.db").option("--limit <n>", "Maximum results", parseInt).option("--json", "Output as JSON").action(async (query, opts) => {
123592
+ await dispatchFromCli(
123593
+ "query",
123594
+ "memory",
123595
+ "decision.find",
123596
+ {
123597
+ query: query ?? "",
123598
+ limit: opts["limit"]
123599
+ },
123600
+ { command: "memory", operation: "memory.decision.find" }
123601
+ );
123602
+ });
123603
+ memory.command("decision-store").description("Store a decision to brain.db").requiredOption("--decision <text>", "The decision that was made").requiredOption("--rationale <text>", "Rationale behind the decision").option("--alternatives <text>", "Alternatives that were considered").option("--linked-task <id>", "Task ID to associate with this decision").option("--json", "Output as JSON").action(async (opts) => {
123604
+ await dispatchFromCli(
123605
+ "mutate",
123606
+ "memory",
123607
+ "decision.store",
123608
+ {
123609
+ decision: opts["decision"],
123610
+ rationale: opts["rationale"],
123611
+ ...opts["alternatives"] !== void 0 && { alternatives: opts["alternatives"] },
123612
+ ...opts["linkedTask"] !== void 0 && { taskId: opts["linkedTask"] }
123613
+ },
123614
+ { command: "memory", operation: "memory.decision.store" }
123615
+ );
123616
+ });
123617
+ memory.command("link <taskId> <entryId>").description("Link a brain entry to a task").option("--json", "Output as JSON").action(async (taskId, entryId, _opts) => {
123618
+ await dispatchFromCli(
123619
+ "mutate",
123620
+ "memory",
123621
+ "link",
123622
+ { taskId, entryId },
123623
+ { command: "memory", operation: "memory.link" }
123624
+ );
123625
+ });
123626
+ memory.command("graph-show <nodeId>").description("Get a PageIndex graph node and its edges").option("--json", "Output as JSON").action(async (nodeId, _opts) => {
123627
+ await dispatchFromCli(
123628
+ "query",
123629
+ "memory",
123630
+ "graph.show",
123631
+ { nodeId },
123632
+ { command: "memory", operation: "memory.graph.show" }
123633
+ );
123634
+ });
123635
+ memory.command("graph-neighbors <nodeId>").description("Get neighbor nodes from the PageIndex graph").option("--depth <n>", "Traversal depth", parseInt).option("--limit <n>", "Maximum neighbors", parseInt).option("--json", "Output as JSON").action(async (nodeId, opts) => {
123636
+ await dispatchFromCli(
123637
+ "query",
123638
+ "memory",
123639
+ "graph.neighbors",
123640
+ {
123641
+ nodeId,
123642
+ ...opts["depth"] !== void 0 && { depth: opts["depth"] },
123643
+ ...opts["limit"] !== void 0 && { limit: opts["limit"] }
123644
+ },
123645
+ { command: "memory", operation: "memory.graph.neighbors" }
123646
+ );
123647
+ });
123648
+ memory.command("graph-add").description("Add a node or edge to the PageIndex graph").option("--node-id <id>", "Node ID to add").option("--label <text>", "Label for the node").option("--from <id>", "Source node ID for an edge").option("--to <id>", "Target node ID for an edge").option("--edge-type <type>", "Edge relationship type").option("--json", "Output as JSON").action(async (opts) => {
123649
+ await dispatchFromCli(
123650
+ "mutate",
123651
+ "memory",
123652
+ "graph.add",
123653
+ {
123654
+ ...opts["nodeId"] !== void 0 && { nodeId: opts["nodeId"] },
123655
+ ...opts["label"] !== void 0 && { label: opts["label"] },
123656
+ ...opts["from"] !== void 0 && { from: opts["from"] },
123657
+ ...opts["to"] !== void 0 && { to: opts["to"] },
123658
+ ...opts["edgeType"] !== void 0 && { edgeType: opts["edgeType"] }
123659
+ },
123660
+ { command: "memory", operation: "memory.graph.add" }
123661
+ );
123662
+ });
123663
+ memory.command("graph-remove").description("Remove a node or edge from the PageIndex graph").option("--node-id <id>", "Node ID to remove").option("--from <id>", "Source node ID of the edge to remove").option("--to <id>", "Target node ID of the edge to remove").option("--json", "Output as JSON").action(async (opts) => {
123664
+ await dispatchFromCli(
123665
+ "mutate",
123666
+ "memory",
123667
+ "graph.remove",
123668
+ {
123669
+ ...opts["nodeId"] !== void 0 && { nodeId: opts["nodeId"] },
123670
+ ...opts["from"] !== void 0 && { from: opts["from"] },
123671
+ ...opts["to"] !== void 0 && { to: opts["to"] }
123672
+ },
123673
+ { command: "memory", operation: "memory.graph.remove" }
123674
+ );
123675
+ });
123676
+ memory.command("reason-why <taskId>").description("Causal trace through task dependency chains").option("--depth <n>", "Maximum trace depth", parseInt).option("--json", "Output as JSON").action(async (taskId, opts) => {
123677
+ await dispatchFromCli(
123678
+ "query",
123679
+ "memory",
123680
+ "reason.why",
123681
+ {
123682
+ taskId,
123683
+ ...opts["depth"] !== void 0 && { depth: opts["depth"] }
123684
+ },
123685
+ { command: "memory", operation: "memory.reason.why" }
123686
+ );
123687
+ });
123688
+ memory.command("reason-similar <entryId>").description("Find semantically similar brain entries").option("--limit <n>", "Maximum results", parseInt).option("--json", "Output as JSON").action(async (entryId, opts) => {
123689
+ await dispatchFromCli(
123690
+ "query",
123691
+ "memory",
123692
+ "reason.similar",
123693
+ {
123694
+ entryId,
123695
+ ...opts["limit"] !== void 0 && { limit: opts["limit"] }
123696
+ },
123697
+ { command: "memory", operation: "memory.reason.similar" }
123698
+ );
123699
+ });
123700
+ memory.command("search-hybrid <query>").description("Hybrid search across FTS5, vector, and graph indexes").option("--limit <n>", "Maximum results", parseInt).option("--json", "Output as JSON").action(async (query, opts) => {
123701
+ await dispatchFromCli(
123702
+ "query",
123703
+ "memory",
123704
+ "search.hybrid",
123705
+ {
123706
+ query,
123707
+ ...opts["limit"] !== void 0 && { limit: opts["limit"] }
123708
+ },
123709
+ { command: "memory", operation: "memory.search.hybrid" }
123710
+ );
123711
+ });
122949
123712
  }
122950
123713
 
122951
123714
  // packages/cleo/src/cli/commands/migrate-claude-mem.ts
122952
123715
  init_internal();
123716
+ init_cli();
122953
123717
  function registerMigrateClaudeMemCommand(program) {
122954
123718
  let migrateCmd = program.commands.find((c) => c.name() === "migrate");
122955
123719
  if (!migrateCmd) {
122956
123720
  migrateCmd = program.command("migrate").description("Data migration utilities");
122957
123721
  }
123722
+ migrateCmd.command("storage").description("Run CLEO internal storage and schema migrations").option("--target <version>", "Target schema version to migrate to").option("--dry-run", "Preview migration steps without making changes").action(async (opts) => {
123723
+ await dispatchFromCli(
123724
+ "mutate",
123725
+ "admin",
123726
+ "migrate",
123727
+ {
123728
+ target: opts["target"],
123729
+ dryRun: opts["dryRun"] === true
123730
+ },
123731
+ { command: "migrate storage", operation: "admin.migrate" }
123732
+ );
123733
+ });
122958
123734
  migrateCmd.command("claude-mem").description("Import observations from claude-mem into brain.db").option("--dry-run", "Show what would be imported without making changes").option("--source <path>", "Path to claude-mem.db (default: ~/.claude-mem/claude-mem.db)").option("--project <name>", "Project tag for imported entries").option("--batch-size <n>", "Rows per transaction batch (default: 100)", parseInt).action(async (opts) => {
122959
123735
  const root = getProjectRoot();
122960
123736
  try {
@@ -123032,13 +123808,24 @@ function registerNexusCommand(program) {
123032
123808
  nexus.command("status").description("Show NEXUS registry status").action(async () => {
123033
123809
  await dispatchFromCli("query", "nexus", "status", {}, { command: "nexus" });
123034
123810
  });
123035
- nexus.command("show <taskId>").alias("query").description("Show a task across projects (project:T### or T###)").action(async (taskId) => {
123811
+ nexus.command("show <name>").description("Show details for a registered project by name").action(async (name2) => {
123812
+ await dispatchFromCli(
123813
+ "query",
123814
+ "nexus",
123815
+ "show",
123816
+ {
123817
+ name: name2
123818
+ },
123819
+ { command: "nexus" }
123820
+ );
123821
+ });
123822
+ nexus.command("resolve <taskRef>").alias("query").description("Resolve a task reference across projects (project:T### or T###)").action(async (taskRef) => {
123036
123823
  await dispatchFromCli(
123037
123824
  "query",
123038
123825
  "nexus",
123039
123826
  "resolve",
123040
123827
  {
123041
- query: taskId
123828
+ query: taskRef
123042
123829
  },
123043
123830
  { command: "nexus" }
123044
123831
  );
@@ -123126,28 +123913,116 @@ function registerNexusCommand(program) {
123126
123913
  { command: "nexus" }
123127
123914
  );
123128
123915
  });
123129
- }
123130
-
123131
- // packages/cleo/src/cli/commands/observe.ts
123132
- init_cli();
123133
- function registerObserveCommand(program) {
123134
- program.command("observe <text>").description("Save an observation to brain.db").option("-t, --title <title>", "Optional title (defaults to first 120 chars of text)").option(
123135
- "--type <type>",
123136
- "Observation type (discovery, decision, bugfix, refactor, feature, change, pattern, session_summary)"
123137
- ).action(async (text3, opts) => {
123916
+ nexus.command("graph").description("Show full dependency graph across all registered projects").action(async () => {
123917
+ await dispatchFromCli("query", "nexus", "graph", {}, { command: "nexus" });
123918
+ });
123919
+ nexus.command("share-status").description("Show multi-contributor sharing status for the current project").action(async () => {
123920
+ await dispatchFromCli("query", "nexus", "share.status", {}, { command: "nexus" });
123921
+ });
123922
+ nexus.command("transfer-preview <taskIds...>").description("Preview a task transfer between projects (dry-run, no changes made)").requiredOption("--from <project>", "Source project name").requiredOption("--to <project>", "Target project name").option("--mode <mode>", "Transfer mode: copy|move", "copy").option("--scope <scope>", "Transfer scope: single|subtree", "subtree").action(async (taskIds, opts) => {
123923
+ await dispatchFromCli(
123924
+ "query",
123925
+ "nexus",
123926
+ "transfer.preview",
123927
+ {
123928
+ taskIds,
123929
+ sourceProject: opts["from"],
123930
+ targetProject: opts["to"],
123931
+ mode: opts["mode"],
123932
+ scope: opts["scope"]
123933
+ },
123934
+ { command: "nexus" }
123935
+ );
123936
+ });
123937
+ nexus.command("transfer <taskIds...>").description("Transfer tasks from one project to another").requiredOption("--from <project>", "Source project name").requiredOption("--to <project>", "Target project name").option("--mode <mode>", "Transfer mode: copy|move", "copy").option("--scope <scope>", "Transfer scope: single|subtree", "subtree").option("--on-conflict <strategy>", "Conflict strategy: rename|skip|duplicate|fail", "rename").option("--transfer-brain", "Also transfer associated brain memory entries", false).action(async (taskIds, opts) => {
123138
123938
  await dispatchFromCli(
123139
123939
  "mutate",
123140
- "memory",
123141
- "observe",
123940
+ "nexus",
123941
+ "transfer",
123142
123942
  {
123143
- text: text3,
123144
- title: opts.title,
123145
- ...opts.type !== void 0 && { type: opts.type },
123146
- sourceType: "manual"
123943
+ taskIds,
123944
+ sourceProject: opts["from"],
123945
+ targetProject: opts["to"],
123946
+ mode: opts["mode"],
123947
+ scope: opts["scope"],
123948
+ onConflict: opts["onConflict"],
123949
+ transferBrain: opts["transferBrain"]
123950
+ },
123951
+ { command: "nexus" }
123952
+ );
123953
+ });
123954
+ const permission = nexus.command("permission").description("Manage permissions for registered projects");
123955
+ permission.command("set <name> <level>").description("Set permission level for a registered project (read|write|execute)").action(async (name2, level) => {
123956
+ await dispatchFromCli(
123957
+ "mutate",
123958
+ "nexus",
123959
+ "permission.set",
123960
+ {
123961
+ name: name2,
123962
+ level
123147
123963
  },
123148
- { command: "observe", operation: "memory.observe" }
123964
+ { command: "nexus" }
123149
123965
  );
123150
123966
  });
123967
+ const share = nexus.command("share").description("Multi-contributor sharing operations");
123968
+ share.command("export").description("Export a snapshot of current project state for sharing").option("--output <path>", "Output file path (default: auto-generated in current directory)").action(async (opts) => {
123969
+ await dispatchFromCli(
123970
+ "mutate",
123971
+ "nexus",
123972
+ "share.snapshot.export",
123973
+ {
123974
+ outputPath: opts["output"]
123975
+ },
123976
+ { command: "nexus" }
123977
+ );
123978
+ });
123979
+ share.command("import <file>").description("Import a shared project snapshot").action(async (file2) => {
123980
+ await dispatchFromCli(
123981
+ "mutate",
123982
+ "nexus",
123983
+ "share.snapshot.import",
123984
+ {
123985
+ inputPath: file2
123986
+ },
123987
+ { command: "nexus" }
123988
+ );
123989
+ });
123990
+ }
123991
+
123992
+ // packages/cleo/src/cli/commands/observe.ts
123993
+ init_cli();
123994
+ function registerObserveCommand(program) {
123995
+ program.command("observe <text>").description(
123996
+ "Save an observation to brain.db \u2014 captures facts, decisions, and discoveries for cross-session memory"
123997
+ ).option(
123998
+ "-t, --title <title>",
123999
+ "Short title for the observation (defaults to first 120 chars of text)"
124000
+ ).option(
124001
+ "--type <type>",
124002
+ "Category: discovery (found something new), decision (choice made), bugfix (bug found/fixed), refactor (code restructured), feature (feature added), change (general change), pattern (recurring pattern), session_summary (end-of-session recap)"
124003
+ ).option(
124004
+ "--agent <name>",
124005
+ "Name of the agent producing this observation (enables per-agent memory retrieval)"
124006
+ ).option(
124007
+ "--source-type <sourceType>",
124008
+ "How this observation was captured: manual (typed by human/agent), auto (lifecycle hook), transcript (extracted from session)"
124009
+ ).action(
124010
+ async (text3, opts) => {
124011
+ await dispatchFromCli(
124012
+ "mutate",
124013
+ "memory",
124014
+ "observe",
124015
+ {
124016
+ text: text3,
124017
+ title: opts.title,
124018
+ ...opts.type !== void 0 && { type: opts.type },
124019
+ ...opts.agent !== void 0 && { agent: opts.agent },
124020
+ sourceType: opts.sourceType ?? "manual"
124021
+ },
124022
+ { command: "observe", operation: "memory.observe" }
124023
+ );
124024
+ }
124025
+ );
123151
124026
  }
123152
124027
 
123153
124028
  // packages/cleo/src/cli/commands/ops.ts
@@ -123172,12 +124047,23 @@ function registerOrchestrateCommand(program) {
123172
124047
  { command: "orchestrate" }
123173
124048
  );
123174
124049
  });
123175
- orch.command("analyze <epicId>").description("Analyze epic dependency structure").action(async (epicId) => {
124050
+ orch.command("status").description("Get orchestration status for an epic or overall project").option("--epic <epicId>", "Epic ID to scope status to").action(async (opts) => {
124051
+ await dispatchFromCli(
124052
+ "query",
124053
+ "orchestrate",
124054
+ "status",
124055
+ { epicId: opts["epic"] },
124056
+ { command: "orchestrate" }
124057
+ );
124058
+ });
124059
+ orch.command("analyze <epicId>").description("Analyze epic dependency structure").option("--mode <mode>", "Analysis mode: critical-path or parallel-safety").option("--tasks <ids>", "Comma-separated task IDs for parallel-safety mode").action(async (epicId, opts) => {
124060
+ const mode = opts["mode"];
124061
+ const taskIds = typeof opts["tasks"] === "string" ? opts["tasks"].split(",").map((s3) => s3.trim()) : void 0;
123176
124062
  await dispatchFromCli(
123177
124063
  "query",
123178
124064
  "orchestrate",
123179
124065
  "analyze",
123180
- { epicId },
124066
+ { epicId, mode, taskIds },
123181
124067
  { command: "orchestrate" }
123182
124068
  );
123183
124069
  });
@@ -123193,12 +124079,21 @@ function registerOrchestrateCommand(program) {
123193
124079
  orch.command("next <epicId>").description("Get next task to spawn").action(async (epicId) => {
123194
124080
  await dispatchFromCli("query", "orchestrate", "next", { epicId }, { command: "orchestrate" });
123195
124081
  });
123196
- orch.command("spawn <taskId>").description("Prepare spawn context for a subagent").action(async (taskId) => {
124082
+ orch.command("waves <epicId>").description("Compute dependency waves for an epic").action(async (epicId) => {
124083
+ await dispatchFromCli(
124084
+ "query",
124085
+ "orchestrate",
124086
+ "waves",
124087
+ { epicId },
124088
+ { command: "orchestrate" }
124089
+ );
124090
+ });
124091
+ orch.command("spawn <taskId>").description("Prepare spawn context for a subagent").option("--protocol <type>", "Protocol type override").option("--tier <tier>", "Protocol tier (0, 1, or 2)", parseInt).action(async (taskId, opts) => {
123197
124092
  await dispatchFromCli(
123198
124093
  "mutate",
123199
124094
  "orchestrate",
123200
124095
  "spawn",
123201
- { taskId },
124096
+ { taskId, protocolType: opts["protocol"], tier: opts["tier"] },
123202
124097
  { command: "orchestrate" }
123203
124098
  );
123204
124099
  });
@@ -123224,6 +124119,157 @@ function registerOrchestrateCommand(program) {
123224
124119
  { command: "orchestrate" }
123225
124120
  );
123226
124121
  });
124122
+ orch.command("parallel <action> <epicId>").description("Manage parallel wave execution (action: start | end)").option("--wave <number>", "Wave number", parseInt).action(async (action, epicId, opts) => {
124123
+ await dispatchFromCli(
124124
+ "mutate",
124125
+ "orchestrate",
124126
+ "parallel",
124127
+ { action, epicId, wave: opts["wave"] },
124128
+ { command: "orchestrate" }
124129
+ );
124130
+ });
124131
+ const tessera = orch.command("tessera").description("Tessera template operations for multi-agent orchestration");
124132
+ tessera.command("list").description("List available tessera templates").option("--id <templateId>", "Show details for a specific template").option("--limit <n>", "Max results to return", parseInt).option("--offset <n>", "Results offset for pagination", parseInt).action(async (opts) => {
124133
+ await dispatchFromCli(
124134
+ "query",
124135
+ "orchestrate",
124136
+ "tessera.list",
124137
+ { id: opts["id"], limit: opts["limit"], offset: opts["offset"] },
124138
+ { command: "orchestrate" }
124139
+ );
124140
+ });
124141
+ tessera.command("instantiate <templateId> <epicId>").description("Instantiate a tessera template for an epic").option("--var <pairs...>", "Key=value variable overrides").action(async (templateId, epicId, opts) => {
124142
+ const variables = {};
124143
+ const pairs = opts["var"];
124144
+ if (Array.isArray(pairs)) {
124145
+ for (const pair of pairs) {
124146
+ const eqIdx = pair.indexOf("=");
124147
+ if (eqIdx > 0) {
124148
+ variables[pair.slice(0, eqIdx)] = pair.slice(eqIdx + 1);
124149
+ }
124150
+ }
124151
+ }
124152
+ await dispatchFromCli(
124153
+ "mutate",
124154
+ "orchestrate",
124155
+ "tessera.instantiate",
124156
+ { templateId, epicId, variables },
124157
+ { command: "orchestrate" }
124158
+ );
124159
+ });
124160
+ orch.command("unblock").description("Analyze dependency graph for unblocking opportunities").action(async () => {
124161
+ await dispatchFromCli(
124162
+ "query",
124163
+ "orchestrate",
124164
+ "unblock.opportunities",
124165
+ {},
124166
+ { command: "orchestrate" }
124167
+ );
124168
+ });
124169
+ orch.command("bootstrap").description("Load brain state for agent bootstrapping").option("--epic <epicId>", "Epic ID to scope bootstrap context to").action(async (opts) => {
124170
+ await dispatchFromCli(
124171
+ "query",
124172
+ "orchestrate",
124173
+ "bootstrap",
124174
+ { epicId: opts["epic"] },
124175
+ { command: "orchestrate" }
124176
+ );
124177
+ });
124178
+ orch.command("classify <request>").description("Classify a request using CANT prompt-based team routing").action(async (request) => {
124179
+ await dispatchFromCli(
124180
+ "query",
124181
+ "orchestrate",
124182
+ "classify",
124183
+ { request },
124184
+ { command: "orchestrate" }
124185
+ );
124186
+ });
124187
+ orch.command("fanout-status").description("Get fanout status for an epic").option("--epic <epicId>", "Epic ID to scope fanout status to").action(async (opts) => {
124188
+ await dispatchFromCli(
124189
+ "query",
124190
+ "orchestrate",
124191
+ "fanout.status",
124192
+ { epicId: opts["epic"] },
124193
+ { command: "orchestrate" }
124194
+ );
124195
+ });
124196
+ orch.command("handoff <taskId>").description("Perform session handoff and spawn successor for a task").requiredOption("--protocol <type>", "Protocol type for handoff").action(async (taskId, opts) => {
124197
+ await dispatchFromCli(
124198
+ "mutate",
124199
+ "orchestrate",
124200
+ "handoff",
124201
+ { taskId, protocolType: opts["protocol"] },
124202
+ { command: "orchestrate" }
124203
+ );
124204
+ });
124205
+ orch.command("spawn-execute <taskId>").description("Execute spawn for a task via the adapter registry").action(async (taskId) => {
124206
+ await dispatchFromCli(
124207
+ "mutate",
124208
+ "orchestrate",
124209
+ "spawn.execute",
124210
+ { taskId },
124211
+ { command: "orchestrate" }
124212
+ );
124213
+ });
124214
+ orch.command("fanout <epicId>").description("Fan out tasks for an epic using parallel spawn").option("--tasks <ids>", "Comma-separated task IDs to fan out").action(async (epicId, opts) => {
124215
+ const taskIds = typeof opts["tasks"] === "string" ? opts["tasks"].split(",").map((s3) => s3.trim()) : void 0;
124216
+ await dispatchFromCli(
124217
+ "mutate",
124218
+ "orchestrate",
124219
+ "fanout",
124220
+ { epicId, taskIds },
124221
+ { command: "orchestrate" }
124222
+ );
124223
+ });
124224
+ orch.command("conduit-status").description("Get conduit messaging status").action(async () => {
124225
+ await dispatchFromCli(
124226
+ "query",
124227
+ "orchestrate",
124228
+ "conduit.status",
124229
+ {},
124230
+ { command: "orchestrate" }
124231
+ );
124232
+ });
124233
+ orch.command("conduit-peek").description("Peek at queued conduit messages").option("--limit <n>", "Maximum number of messages to return", parseInt).action(async (opts) => {
124234
+ await dispatchFromCli(
124235
+ "query",
124236
+ "orchestrate",
124237
+ "conduit.peek",
124238
+ { limit: opts["limit"] },
124239
+ { command: "orchestrate" }
124240
+ );
124241
+ });
124242
+ orch.command("conduit-start").description("Start the conduit message loop").option("--poll-interval <ms>", "Polling interval in milliseconds", parseInt).action(async (opts) => {
124243
+ await dispatchFromCli(
124244
+ "mutate",
124245
+ "orchestrate",
124246
+ "conduit.start",
124247
+ { pollInterval: opts["pollInterval"] },
124248
+ { command: "orchestrate" }
124249
+ );
124250
+ });
124251
+ orch.command("conduit-stop").description("Stop the conduit message loop").action(async () => {
124252
+ await dispatchFromCli(
124253
+ "mutate",
124254
+ "orchestrate",
124255
+ "conduit.stop",
124256
+ {},
124257
+ { command: "orchestrate" }
124258
+ );
124259
+ });
124260
+ orch.command("conduit-send <content>").description("Send a message via conduit to an agent or conversation").option("--to <agentId>", "Target agent ID").option("--conversation <id>", "Conversation ID to send into").action(async (content, opts) => {
124261
+ await dispatchFromCli(
124262
+ "mutate",
124263
+ "orchestrate",
124264
+ "conduit.send",
124265
+ {
124266
+ content,
124267
+ agentId: opts["to"],
124268
+ conversationId: opts["conversation"]
124269
+ },
124270
+ { command: "orchestrate" }
124271
+ );
124272
+ });
123227
124273
  }
123228
124274
 
123229
124275
  // packages/cleo/src/cli/commands/otel.ts
@@ -123443,6 +124489,85 @@ function registerPromoteCommand(program) {
123443
124489
  });
123444
124490
  }
123445
124491
 
124492
+ // packages/cleo/src/cli/commands/provider.ts
124493
+ init_cli();
124494
+ function registerProviderCommand(program) {
124495
+ const providerCmd = program.command("provider").description("CAAMP provider registry: list, detect, supports, hooks, inject");
124496
+ providerCmd.command("list").description("List all registered CAAMP providers").option("--limit <n>", "Maximum providers to return").option("--offset <n>", "Offset for pagination").action(async (opts) => {
124497
+ await dispatchFromCli(
124498
+ "query",
124499
+ "tools",
124500
+ "provider.list",
124501
+ {
124502
+ limit: opts["limit"] ? Number(opts["limit"]) : void 0,
124503
+ offset: opts["offset"] ? Number(opts["offset"]) : void 0
124504
+ },
124505
+ { command: "provider", operation: "tools.provider.list" }
124506
+ );
124507
+ });
124508
+ providerCmd.command("detect").description("Detect which provider is active in the current environment").action(async () => {
124509
+ await dispatchFromCli(
124510
+ "query",
124511
+ "tools",
124512
+ "provider.detect",
124513
+ {},
124514
+ { command: "provider", operation: "tools.provider.detect" }
124515
+ );
124516
+ });
124517
+ providerCmd.command("inject-status").description("Show provider injection status for project or global scope").option("--scope <scope>", "Scope: project or global (default: project)").option("--content <content>", "Content string to check against").action(async (opts) => {
124518
+ await dispatchFromCli(
124519
+ "query",
124520
+ "tools",
124521
+ "provider.inject.status",
124522
+ {
124523
+ scope: opts["scope"] ?? "project",
124524
+ content: opts["content"]
124525
+ },
124526
+ { command: "provider", operation: "tools.provider.inject.status" }
124527
+ );
124528
+ });
124529
+ providerCmd.command("supports <provider-id> <capability>").description("Check if a provider supports a capability (e.g., spawn.supportsSubagents)").action(async (providerId, capability) => {
124530
+ await dispatchFromCli(
124531
+ "query",
124532
+ "tools",
124533
+ "provider.supports",
124534
+ { providerId, capability },
124535
+ { command: "provider", operation: "tools.provider.supports" }
124536
+ );
124537
+ });
124538
+ providerCmd.command("hooks <event>").description("List providers that support a specific hook event (e.g., onSessionStart)").action(async (event) => {
124539
+ await dispatchFromCli(
124540
+ "query",
124541
+ "tools",
124542
+ "provider.hooks",
124543
+ { event },
124544
+ { command: "provider", operation: "tools.provider.hooks" }
124545
+ );
124546
+ });
124547
+ providerCmd.command("inject").description("Inject provider references into AGENTS.md (project or global scope)").option("--scope <scope>", "Scope: project or global (default: project)").option("--references <refs...>", "Provider reference IDs to inject").option("--content <content>", "Content string to inject directly").action(async (opts) => {
124548
+ await dispatchFromCli(
124549
+ "mutate",
124550
+ "tools",
124551
+ "provider.inject",
124552
+ {
124553
+ scope: opts["scope"] ?? "project",
124554
+ references: opts["references"],
124555
+ content: opts["content"]
124556
+ },
124557
+ { command: "provider", operation: "tools.provider.inject" }
124558
+ );
124559
+ });
124560
+ providerCmd.action(async () => {
124561
+ await dispatchFromCli(
124562
+ "query",
124563
+ "tools",
124564
+ "provider.list",
124565
+ {},
124566
+ { command: "provider", operation: "tools.provider.list" }
124567
+ );
124568
+ });
124569
+ }
124570
+
123446
124571
  // packages/cleo/src/cli/commands/reason.ts
123447
124572
  init_cli();
123448
124573
  function registerReasonCommand(program) {
@@ -123619,6 +124744,27 @@ function registerReleaseCommand(program) {
123619
124744
  { command: "release" }
123620
124745
  );
123621
124746
  });
124747
+ release2.command("rollback <version>").description("Roll back a shipped release (marks it as rolled-back in CLEO records)").option("--reason <reason>", "Reason for rollback").action(async (version2, opts) => {
124748
+ await dispatchFromCli(
124749
+ "mutate",
124750
+ "pipeline",
124751
+ "release.rollback",
124752
+ {
124753
+ version: version2,
124754
+ reason: opts["reason"]
124755
+ },
124756
+ { command: "release" }
124757
+ );
124758
+ });
124759
+ release2.command("channel").description("Show the current release channel based on git branch (latest/beta/alpha)").action(async () => {
124760
+ await dispatchFromCli(
124761
+ "query",
124762
+ "pipeline",
124763
+ "release.channel.show",
124764
+ {},
124765
+ { command: "release" }
124766
+ );
124767
+ });
123622
124768
  }
123623
124769
 
123624
124770
  // packages/cleo/src/cli/commands/remote.ts
@@ -124367,17 +125513,18 @@ function registerRestoreCommand(program) {
124367
125513
  // packages/cleo/src/cli/commands/roadmap.ts
124368
125514
  init_cli();
124369
125515
  function registerRoadmapCommand(program) {
124370
- program.command("roadmap").description("Generate roadmap from pending epics and CHANGELOG history").option("--include-history", "Include release history from CHANGELOG").option("--upcoming-only", "Only show upcoming/planned releases").action(async (opts) => {
125516
+ program.command("roadmap").description(
125517
+ "Generate project roadmap from task provenance \u2014 epics grouped by status with progress"
125518
+ ).option("--include-history", "Include release history from CHANGELOG.md").option("--upcoming-only", "Only show pending/upcoming epics (exclude completed)").action(async (opts) => {
124371
125519
  await dispatchFromCli(
124372
125520
  "query",
124373
125521
  "admin",
124374
- "dash",
125522
+ "roadmap",
124375
125523
  {
124376
- type: "roadmap",
124377
125524
  includeHistory: opts["includeHistory"],
124378
125525
  upcomingOnly: opts["upcomingOnly"]
124379
125526
  },
124380
- { command: "roadmap" }
125527
+ { command: "roadmap", operation: "admin.roadmap" }
124381
125528
  );
124382
125529
  });
124383
125530
  }
@@ -124834,7 +125981,9 @@ async function runPostUpdateDiagnostics(opts) {
124834
125981
  }
124835
125982
 
124836
125983
  // packages/cleo/src/cli/commands/sequence.ts
125984
+ init_internal();
124837
125985
  init_cli();
125986
+ init_renderers();
124838
125987
  function registerSequenceCommand(program) {
124839
125988
  const sequence = program.command("sequence").description("Inspect and manage task ID sequence (show/check/repair)");
124840
125989
  sequence.command("show").description("Display current sequence state").action(async () => {
@@ -124856,13 +126005,10 @@ function registerSequenceCommand(program) {
124856
126005
  );
124857
126006
  });
124858
126007
  sequence.command("repair").description("Reset counter to max + 1 if behind").action(async () => {
124859
- await dispatchFromCli(
124860
- "mutate",
124861
- "admin",
124862
- "config.set",
124863
- { key: "sequence", value: "repair" },
124864
- { command: "sequence" }
124865
- );
126008
+ const { systemSequenceRepair: systemSequenceRepair2 } = await Promise.resolve().then(() => (init_system_engine(), system_engine_exports));
126009
+ const projectRoot = getProjectRoot();
126010
+ const result = await systemSequenceRepair2(projectRoot);
126011
+ cliOutput(result, { command: "sequence", operation: "admin.sequence.repair" });
124866
126012
  });
124867
126013
  }
124868
126014
 
@@ -125003,6 +126149,55 @@ function registerSessionCommand(program) {
125003
126149
  { command: "session", operation: "session.gc" }
125004
126150
  );
125005
126151
  });
126152
+ session.command("show <sessionId>").description("Show full details for a session (absorbs debrief.show via --include debrief)").option("--include <include>", "Include extra data (debrief)").action(async (sessionId, opts) => {
126153
+ await dispatchFromCli(
126154
+ "query",
126155
+ "session",
126156
+ "show",
126157
+ {
126158
+ sessionId,
126159
+ include: opts["include"]
126160
+ },
126161
+ { command: "session", operation: "session.show" }
126162
+ );
126163
+ });
126164
+ session.command("context-drift").description("Detect context drift in the current or specified session").option("--session-id <sessionId>", "Session ID to check (defaults to active session)").action(async (opts) => {
126165
+ await dispatchFromCli(
126166
+ "query",
126167
+ "session",
126168
+ "context.drift",
126169
+ {
126170
+ sessionId: opts["sessionId"]
126171
+ },
126172
+ { command: "session", operation: "session.context.drift" }
126173
+ );
126174
+ });
126175
+ session.command("suspend <sessionId>").description("Suspend an active session (pause without ending)").option("--reason <reason>", "Reason for suspension").action(async (sessionId, opts) => {
126176
+ await dispatchFromCli(
126177
+ "mutate",
126178
+ "session",
126179
+ "suspend",
126180
+ {
126181
+ sessionId,
126182
+ reason: opts["reason"]
126183
+ },
126184
+ { command: "session", operation: "session.suspend" }
126185
+ );
126186
+ });
126187
+ session.command("record-assumption").description("Record an assumption made during the current session").requiredOption("--assumption <assumption>", "Assumption text").requiredOption("--confidence <confidence>", "Confidence level (high|medium|low)").option("--session-id <sessionId>", "Session ID (defaults to active session)").option("--task-id <taskId>", "Task ID the assumption relates to").action(async (opts) => {
126188
+ await dispatchFromCli(
126189
+ "mutate",
126190
+ "session",
126191
+ "record.assumption",
126192
+ {
126193
+ sessionId: opts["sessionId"],
126194
+ taskId: opts["taskId"],
126195
+ assumption: opts["assumption"],
126196
+ confidence: opts["confidence"]
126197
+ },
126198
+ { command: "session", operation: "session.record.assumption" }
126199
+ );
126200
+ });
125006
126201
  session.command("record-decision").description("Record a decision made during the current session").requiredOption("--session-id <sessionId>", "Session ID").requiredOption("--task-id <taskId>", "Task ID the decision relates to").requiredOption("--decision <decision>", "Decision text").requiredOption("--rationale <rationale>", "Rationale for the decision").option("--alternatives <alternatives>", "Alternatives considered").action(async (opts) => {
125007
126202
  await dispatchFromCli(
125008
126203
  "mutate",
@@ -125054,7 +126249,7 @@ function registerShowCommand(program) {
125054
126249
  // packages/cleo/src/cli/commands/skills.ts
125055
126250
  init_cli();
125056
126251
  function registerSkillsCommand(program) {
125057
- const skillsCmd = program.command("skills").description("Skill management: list, discover, validate, info, install");
126252
+ const skillsCmd = program.command("skills").description("Skill management: list, search, validate, info, install");
125058
126253
  skillsCmd.command("list").description("List installed skills").option("--global", "Use global skills directory").action(async (opts) => {
125059
126254
  await dispatchFromCli(
125060
126255
  "query",
@@ -125078,17 +126273,6 @@ function registerSkillsCommand(program) {
125078
126273
  { command: "skills", operation: "tools.skill.find" }
125079
126274
  );
125080
126275
  });
125081
- skillsCmd.command("discover").description("Scan and discover available skills").action(async () => {
125082
- await dispatchFromCli(
125083
- "query",
125084
- "tools",
125085
- "skill.list",
125086
- {
125087
- scope: "project"
125088
- },
125089
- { command: "skills", operation: "tools.skill.list" }
125090
- );
125091
- });
125092
126276
  skillsCmd.command("validate <skill-name>").description("Validate skill against protocol").action(async (skillName) => {
125093
126277
  await dispatchFromCli(
125094
126278
  "query",
@@ -125168,6 +126352,63 @@ function registerSkillsCommand(program) {
125168
126352
  }
125169
126353
  );
125170
126354
  });
126355
+ skillsCmd.command("dispatch <skill-name>").description("Resolve dispatch path for a skill").action(async (skillName) => {
126356
+ await dispatchFromCli(
126357
+ "query",
126358
+ "tools",
126359
+ "skill.dispatch",
126360
+ { name: skillName },
126361
+ { command: "skills", operation: "tools.skill.dispatch" }
126362
+ );
126363
+ });
126364
+ skillsCmd.command("catalog").description("Browse CAAMP skill catalog (protocols, profiles, resources, info)").option("--type <type>", "Catalog type: protocols, profiles, resources, info (default: info)").option("--limit <n>", "Maximum items to return").option("--offset <n>", "Offset for pagination").action(async (opts) => {
126365
+ await dispatchFromCli(
126366
+ "query",
126367
+ "tools",
126368
+ "skill.catalog",
126369
+ {
126370
+ type: opts["type"] ?? "info",
126371
+ limit: opts["limit"] ? Number(opts["limit"]) : void 0,
126372
+ offset: opts["offset"] ? Number(opts["offset"]) : void 0
126373
+ },
126374
+ { command: "skills", operation: "tools.skill.catalog" }
126375
+ );
126376
+ });
126377
+ skillsCmd.command("precedence").description("Show or resolve skill provider precedence").option("--resolve <provider-id>", "Resolve precedence for a specific provider").option("--scope <scope>", "Scope: global or project (default: global)").action(async (opts) => {
126378
+ const providerId = opts["resolve"];
126379
+ await dispatchFromCli(
126380
+ "query",
126381
+ "tools",
126382
+ "skill.precedence",
126383
+ {
126384
+ action: providerId ? "resolve" : "show",
126385
+ providerId,
126386
+ scope: opts["scope"] ?? "global"
126387
+ },
126388
+ { command: "skills", operation: "tools.skill.precedence" }
126389
+ );
126390
+ });
126391
+ skillsCmd.command("deps <skill-name>").description("Show skill dependency tree").action(async (skillName) => {
126392
+ await dispatchFromCli(
126393
+ "query",
126394
+ "tools",
126395
+ "skill.dependencies",
126396
+ { name: skillName },
126397
+ { command: "skills", operation: "tools.skill.dependencies" }
126398
+ );
126399
+ });
126400
+ skillsCmd.command("spawn-providers").description("List providers capable of spawning subagents").option(
126401
+ "--capability <cap>",
126402
+ "Filter by capability: supportsSubagents, supportsProgrammaticSpawn, supportsInterAgentComms, supportsParallelSpawn"
126403
+ ).action(async (opts) => {
126404
+ await dispatchFromCli(
126405
+ "query",
126406
+ "tools",
126407
+ "skill.spawn.providers",
126408
+ { capability: opts["capability"] },
126409
+ { command: "skills", operation: "tools.skill.spawn.providers" }
126410
+ );
126411
+ });
125171
126412
  skillsCmd.action(async () => {
125172
126413
  await dispatchFromCli(
125173
126414
  "query",
@@ -125482,6 +126723,73 @@ function registerStopCommand(program) {
125482
126723
  });
125483
126724
  }
125484
126725
 
126726
+ // packages/cleo/src/cli/commands/sync.ts
126727
+ init_cli();
126728
+ function registerSyncCommand(program) {
126729
+ const sync = program.command("sync").description("External task synchronisation management");
126730
+ const links = sync.command("links").description("List external task links");
126731
+ links.command("list").description("List external task links (filter by provider or task)").option("--provider <providerId>", "Filter links by provider (e.g. linear, jira, github)").option("--task <taskId>", "Filter links by CLEO task ID").action(async (opts) => {
126732
+ await dispatchFromCli(
126733
+ "query",
126734
+ "tasks",
126735
+ "sync.links",
126736
+ {
126737
+ providerId: opts["provider"],
126738
+ taskId: opts["task"]
126739
+ },
126740
+ { command: "sync", operation: "tasks.sync.links" }
126741
+ );
126742
+ });
126743
+ links.command("remove <providerId>").description("Remove all external task links for a provider").action(async (providerId) => {
126744
+ await dispatchFromCli(
126745
+ "mutate",
126746
+ "tasks",
126747
+ "sync.links.remove",
126748
+ { providerId },
126749
+ { command: "sync", operation: "tasks.sync.links.remove" }
126750
+ );
126751
+ });
126752
+ links.action(async () => {
126753
+ await dispatchFromCli(
126754
+ "query",
126755
+ "tasks",
126756
+ "sync.links",
126757
+ {},
126758
+ { command: "sync", operation: "tasks.sync.links" }
126759
+ );
126760
+ });
126761
+ sync.command("reconcile <file>").description("Reconcile external tasks from a JSON file against CLEO tasks").requiredOption("--provider <providerId>", "Provider ID (e.g. linear, jira, github)").option(
126762
+ "--conflict-policy <policy>",
126763
+ "How to resolve conflicts: keep-cleo, keep-external, or newest (default: keep-cleo)",
126764
+ "keep-cleo"
126765
+ ).action(async (file2, opts) => {
126766
+ const { readFileSync: readFileSync103 } = await import("node:fs");
126767
+ let externalTasks;
126768
+ try {
126769
+ externalTasks = JSON.parse(readFileSync103(file2, "utf8"));
126770
+ } catch (err) {
126771
+ const message = err instanceof Error ? err.message : String(err);
126772
+ console.error(`Failed to read or parse external tasks file: ${message}`);
126773
+ process.exit(2);
126774
+ }
126775
+ if (!Array.isArray(externalTasks)) {
126776
+ console.error("External tasks file must contain a JSON array");
126777
+ process.exit(2);
126778
+ }
126779
+ await dispatchFromCli(
126780
+ "mutate",
126781
+ "tasks",
126782
+ "sync.reconcile",
126783
+ {
126784
+ providerId: opts["provider"],
126785
+ externalTasks,
126786
+ conflictPolicy: opts["conflictPolicy"]
126787
+ },
126788
+ { command: "sync", operation: "tasks.sync.reconcile" }
126789
+ );
126790
+ });
126791
+ }
126792
+
125485
126793
  // packages/cleo/src/cli/commands/testing.ts
125486
126794
  init_cli();
125487
126795
  function registerTestingCommand(program) {
@@ -125490,13 +126798,14 @@ function registerTestingCommand(program) {
125490
126798
  await dispatchFromCli(
125491
126799
  "query",
125492
126800
  "check",
125493
- "manifest",
126801
+ "protocol",
125494
126802
  {
126803
+ protocolType: "testing",
126804
+ mode: "task",
125495
126805
  taskId,
125496
- strict: !!opts["strict"],
125497
- type: "testing"
126806
+ strict: !!opts["strict"]
125498
126807
  },
125499
- { command: "testing", operation: "check.manifest" }
126808
+ { command: "testing", operation: "check.protocol" }
125500
126809
  );
125501
126810
  });
125502
126811
  testingCmd.command("check <manifestFile>").description("Validate testing protocol from a manifest file").option("--strict", "Exit with error code on violations").action(async (manifestFile, opts) => {
@@ -125553,11 +126862,11 @@ function registerTestingCommand(program) {
125553
126862
  init_internal();
125554
126863
  init_cli();
125555
126864
  init_renderers();
125556
- import { readFileSync as readFileSync100 } from "node:fs";
126865
+ import { readFileSync as readFileSync101 } from "node:fs";
125557
126866
  function readPayload(opts, textKey, fileKey) {
125558
126867
  const text3 = opts[textKey];
125559
126868
  const file2 = opts[fileKey];
125560
- if (file2) return readFileSync100(file2, "utf-8");
126869
+ if (file2) return readFileSync101(file2, "utf-8");
125561
126870
  return text3;
125562
126871
  }
125563
126872
  function registerTokenCommand(program) {
@@ -126143,7 +127452,7 @@ var codeCommand = defineCommand({
126143
127452
  // packages/cleo/src/cli/index.ts
126144
127453
  function getPackageVersion() {
126145
127454
  const pkgPath = join130(dirname28(fileURLToPath5(import.meta.url)), "../../package.json");
126146
- const pkg = JSON.parse(readFileSync101(pkgPath, "utf-8"));
127455
+ const pkg = JSON.parse(readFileSync102(pkgPath, "utf-8"));
126147
127456
  return pkg.version;
126148
127457
  }
126149
127458
  var CLI_VERSION = getPackageVersion();
@@ -126169,9 +127478,9 @@ registerDepsCommand(rootShim);
126169
127478
  registerTreeCommand(rootShim);
126170
127479
  registerResearchCommand(rootShim);
126171
127480
  registerOrchestrateCommand(rootShim);
127481
+ registerChainCommand(rootShim);
126172
127482
  registerLifecycleCommand(rootShim);
126173
127483
  registerReleaseCommand(rootShim);
126174
- registerEnvCommand(rootShim);
126175
127484
  registerCheckpointCommand(rootShim);
126176
127485
  registerCommandsCommand(rootShim);
126177
127486
  registerDocsCommand(rootShim);
@@ -126185,8 +127494,15 @@ registerArchiveStatsCommand(rootShim);
126185
127494
  registerGenerateChangelogCommand(rootShim);
126186
127495
  registerIssueCommand(rootShim);
126187
127496
  registerSkillsCommand(rootShim);
127497
+ registerProviderCommand(rootShim);
127498
+ registerAdapterCommand(rootShim);
126188
127499
  registerExistsCommand(rootShim);
126189
127500
  registerBugCommand(rootShim);
127501
+ registerCancelCommand(rootShim);
127502
+ registerClaimCommand(rootShim);
127503
+ registerUnclaimCommand(rootShim);
127504
+ registerComplexityCommand(rootShim);
127505
+ registerSyncCommand(rootShim);
126190
127506
  registerAnalyzeCommand(rootShim);
126191
127507
  registerMapCommand(rootShim);
126192
127508
  registerBackupCommand(rootShim);