@cleocode/cleo 2026.3.23 → 2026.3.24

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
@@ -24929,9 +24929,9 @@ async function systemLog(projectRoot, filters) {
24929
24929
  }
24930
24930
  async function queryAuditLogSqlite(projectRoot, filters) {
24931
24931
  try {
24932
- const { join: join83 } = await import("node:path");
24932
+ const { join: join82 } = await import("node:path");
24933
24933
  const { existsSync: existsSync78 } = await import("node:fs");
24934
- const dbPath = join83(projectRoot, ".cleo", "tasks.db");
24934
+ const dbPath = join82(projectRoot, ".cleo", "tasks.db");
24935
24935
  if (!existsSync78(dbPath)) {
24936
24936
  const offset = filters?.offset ?? 0;
24937
24937
  const limit = filters?.limit ?? 20;
@@ -28393,7 +28393,12 @@ async function taskCreate(projectRoot, params) {
28393
28393
  depends: params.depends,
28394
28394
  priority: params.priority || "medium",
28395
28395
  labels: params.labels,
28396
- type: params.type || void 0
28396
+ type: params.type || void 0,
28397
+ phase: params.phase,
28398
+ size: params.size,
28399
+ acceptance: params.acceptance,
28400
+ notes: params.notes,
28401
+ files: params.files
28397
28402
  },
28398
28403
  projectRoot,
28399
28404
  accessor
@@ -32171,7 +32176,7 @@ import {
32171
32176
  statSync as statSync9,
32172
32177
  unlinkSync as unlinkSync5
32173
32178
  } from "node:fs";
32174
- import { dirname as dirname19, join as join75, relative as relative6 } from "node:path";
32179
+ import { dirname as dirname19, join as join74, relative as relative6 } from "node:path";
32175
32180
  function createMigrationLogger(cleoDir, config) {
32176
32181
  return new MigrationLogger(cleoDir, config);
32177
32182
  }
@@ -32189,14 +32194,14 @@ function logFileExists(logPath) {
32189
32194
  }
32190
32195
  function getLatestMigrationLog(cleoDir) {
32191
32196
  try {
32192
- const logsDir = join75(cleoDir, "logs");
32197
+ const logsDir = join74(cleoDir, "logs");
32193
32198
  if (!existsSync74(logsDir)) {
32194
32199
  return null;
32195
32200
  }
32196
32201
  const files = readdirSync21(logsDir).filter((f) => f.startsWith("migration-") && f.endsWith(".jsonl")).map((f) => ({
32197
32202
  name: f,
32198
- path: join75(logsDir, f),
32199
- mtime: statSync9(join75(logsDir, f)).mtime.getTime()
32203
+ path: join74(logsDir, f),
32204
+ mtime: statSync9(join74(logsDir, f)).mtime.getTime()
32200
32205
  })).sort((a, b) => b.mtime - a.mtime);
32201
32206
  return files.length > 0 ? files[0].path : null;
32202
32207
  } catch {
@@ -32226,7 +32231,7 @@ var init_logger2 = __esm({
32226
32231
  consoleOutput: config.consoleOutput ?? false
32227
32232
  };
32228
32233
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
32229
- this.logPath = join75(cleoDir, "logs", `migration-${timestamp}.jsonl`);
32234
+ this.logPath = join74(cleoDir, "logs", `migration-${timestamp}.jsonl`);
32230
32235
  const logsDir = dirname19(this.logPath);
32231
32236
  if (!existsSync74(logsDir)) {
32232
32237
  mkdirSync17(logsDir, { recursive: true });
@@ -32396,14 +32401,14 @@ var init_logger2 = __esm({
32396
32401
  */
32397
32402
  cleanupOldLogs() {
32398
32403
  try {
32399
- const logsDir = join75(this.cleoDir, "logs");
32404
+ const logsDir = join74(this.cleoDir, "logs");
32400
32405
  if (!existsSync74(logsDir)) {
32401
32406
  return;
32402
32407
  }
32403
32408
  const files = readdirSync21(logsDir).filter((f) => f.startsWith("migration-") && f.endsWith(".jsonl")).map((f) => ({
32404
32409
  name: f,
32405
- path: join75(logsDir, f),
32406
- mtime: statSync9(join75(logsDir, f)).mtime.getTime()
32410
+ path: join74(logsDir, f),
32411
+ mtime: statSync9(join74(logsDir, f)).mtime.getTime()
32407
32412
  })).sort((a, b) => b.mtime - a.mtime);
32408
32413
  const filesToRemove = files.slice(this.config.maxLogFiles);
32409
32414
  for (const file of filesToRemove) {
@@ -32501,7 +32506,7 @@ __export(state_exports, {
32501
32506
  import { createHash as createHash9 } from "node:crypto";
32502
32507
  import { existsSync as existsSync75 } from "node:fs";
32503
32508
  import { readFile as readFile18, unlink as unlink5, writeFile as writeFile12 } from "node:fs/promises";
32504
- import { join as join76 } from "node:path";
32509
+ import { join as join75 } from "node:path";
32505
32510
  async function computeFileChecksum(filePath) {
32506
32511
  try {
32507
32512
  const content = await readFile18(filePath);
@@ -32522,7 +32527,7 @@ async function countRecords(filePath, key) {
32522
32527
  async function createMigrationState(cleoDir, sourceFiles) {
32523
32528
  const files = sourceFiles ?? {};
32524
32529
  if (!files.todoJson) {
32525
- const todoPath = join76(cleoDir, "todo.json");
32530
+ const todoPath = join75(cleoDir, "todo.json");
32526
32531
  if (existsSync75(todoPath)) {
32527
32532
  files.todoJson = {
32528
32533
  path: todoPath,
@@ -32532,7 +32537,7 @@ async function createMigrationState(cleoDir, sourceFiles) {
32532
32537
  }
32533
32538
  }
32534
32539
  if (!files.sessionsJson) {
32535
- const sessionsPath = join76(cleoDir, "sessions.json");
32540
+ const sessionsPath = join75(cleoDir, "sessions.json");
32536
32541
  if (existsSync75(sessionsPath)) {
32537
32542
  files.sessionsJson = {
32538
32543
  path: sessionsPath,
@@ -32542,7 +32547,7 @@ async function createMigrationState(cleoDir, sourceFiles) {
32542
32547
  }
32543
32548
  }
32544
32549
  if (!files.archiveJson) {
32545
- const archivePath = join76(cleoDir, "todo-archive.json");
32550
+ const archivePath = join75(cleoDir, "todo-archive.json");
32546
32551
  if (existsSync75(archivePath)) {
32547
32552
  files.archiveJson = {
32548
32553
  path: archivePath,
@@ -32571,7 +32576,7 @@ async function createMigrationState(cleoDir, sourceFiles) {
32571
32576
  return state;
32572
32577
  }
32573
32578
  async function writeMigrationState(cleoDir, state) {
32574
- const statePath = join76(cleoDir, STATE_FILENAME);
32579
+ const statePath = join75(cleoDir, STATE_FILENAME);
32575
32580
  const tempPath = `${statePath}.tmp`;
32576
32581
  await writeFile12(tempPath, JSON.stringify(state, null, 2));
32577
32582
  await writeFile12(statePath, await readFile18(tempPath));
@@ -32646,7 +32651,7 @@ async function addMigrationWarning(cleoDir, warning) {
32646
32651
  }
32647
32652
  async function loadMigrationState(cleoDir) {
32648
32653
  try {
32649
- const statePath = join76(cleoDir, STATE_FILENAME);
32654
+ const statePath = join75(cleoDir, STATE_FILENAME);
32650
32655
  const content = await readFile18(statePath, "utf-8");
32651
32656
  return JSON.parse(content);
32652
32657
  } catch {
@@ -32688,7 +32693,7 @@ async function failMigration(cleoDir, error) {
32688
32693
  }
32689
32694
  async function clearMigrationState(cleoDir) {
32690
32695
  try {
32691
- const statePath = join76(cleoDir, STATE_FILENAME);
32696
+ const statePath = join75(cleoDir, STATE_FILENAME);
32692
32697
  await unlink5(statePath);
32693
32698
  } catch {
32694
32699
  }
@@ -32764,7 +32769,7 @@ __export(migration_sqlite_exports, {
32764
32769
  migrateJsonToSqliteAtomic: () => migrateJsonToSqliteAtomic
32765
32770
  });
32766
32771
  import { existsSync as existsSync76, mkdirSync as mkdirSync18, readFileSync as readFileSync57 } from "node:fs";
32767
- import { dirname as dirname20, join as join77 } from "node:path";
32772
+ import { dirname as dirname20, join as join76 } from "node:path";
32768
32773
  import { drizzle as drizzle4 } from "drizzle-orm/sqlite-proxy";
32769
32774
  import { migrate as migrate4 } from "drizzle-orm/sqlite-proxy/migrator";
32770
32775
  function topoSortTasks(tasks2) {
@@ -32801,7 +32806,7 @@ function countJsonRecords(cleoDir) {
32801
32806
  let tasks2 = 0;
32802
32807
  let archived = 0;
32803
32808
  let sessions2 = 0;
32804
- const todoPath = join77(cleoDir, "todo.json");
32809
+ const todoPath = join76(cleoDir, "todo.json");
32805
32810
  if (existsSync76(todoPath)) {
32806
32811
  try {
32807
32812
  const data = JSON.parse(readFileSync57(todoPath, "utf-8"));
@@ -32809,7 +32814,7 @@ function countJsonRecords(cleoDir) {
32809
32814
  } catch {
32810
32815
  }
32811
32816
  }
32812
- const archivePath = join77(cleoDir, "todo-archive.json");
32817
+ const archivePath = join76(cleoDir, "todo-archive.json");
32813
32818
  if (existsSync76(archivePath)) {
32814
32819
  try {
32815
32820
  const data = JSON.parse(readFileSync57(archivePath, "utf-8"));
@@ -32817,7 +32822,7 @@ function countJsonRecords(cleoDir) {
32817
32822
  } catch {
32818
32823
  }
32819
32824
  }
32820
- const sessionsPath = join77(cleoDir, "sessions.json");
32825
+ const sessionsPath = join76(cleoDir, "sessions.json");
32821
32826
  if (existsSync76(sessionsPath)) {
32822
32827
  try {
32823
32828
  const data = JSON.parse(readFileSync57(sessionsPath, "utf-8"));
@@ -32901,7 +32906,7 @@ async function migrateJsonToSqliteAtomic(cwd, tempDbPath, logger) {
32901
32906
  }
32902
32907
  }
32903
32908
  async function runMigrationDataImport(db, cleoDir, result, logger) {
32904
- const todoPath = join77(cleoDir, "todo.json");
32909
+ const todoPath = join76(cleoDir, "todo.json");
32905
32910
  if (existsSync76(todoPath)) {
32906
32911
  try {
32907
32912
  logger?.info("import", "read-todo", "Reading todo.json", {
@@ -32981,7 +32986,7 @@ async function runMigrationDataImport(db, cleoDir, result, logger) {
32981
32986
  result.warnings.push("todo.json not found, skipping task import");
32982
32987
  logger?.warn("import", "todo-missing", "todo.json not found, skipping task import");
32983
32988
  }
32984
- const archivePath = join77(cleoDir, "todo-archive.json");
32989
+ const archivePath = join76(cleoDir, "todo-archive.json");
32985
32990
  if (existsSync76(archivePath)) {
32986
32991
  try {
32987
32992
  logger?.info("import", "read-archive", "Reading todo-archive.json", {
@@ -33050,7 +33055,7 @@ async function runMigrationDataImport(db, cleoDir, result, logger) {
33050
33055
  logger?.error("import", "parse-archive", errorMsg);
33051
33056
  }
33052
33057
  }
33053
- const sessionsPath = join77(cleoDir, "sessions.json");
33058
+ const sessionsPath = join76(cleoDir, "sessions.json");
33054
33059
  if (existsSync76(sessionsPath)) {
33055
33060
  try {
33056
33061
  logger?.info("import", "read-sessions", "Reading sessions.json", {
@@ -33183,7 +33188,7 @@ async function migrateJsonToSqlite2(cwd, options) {
33183
33188
  return result;
33184
33189
  }
33185
33190
  const db = await getDb(cwd);
33186
- const todoPath = join77(cleoDir, "todo.json");
33191
+ const todoPath = join76(cleoDir, "todo.json");
33187
33192
  if (existsSync76(todoPath)) {
33188
33193
  try {
33189
33194
  const todoData = JSON.parse(readFileSync57(todoPath, "utf-8"));
@@ -33235,7 +33240,7 @@ async function migrateJsonToSqlite2(cwd, options) {
33235
33240
  } else {
33236
33241
  result.warnings.push("todo.json not found, skipping task import");
33237
33242
  }
33238
- const archivePath = join77(cleoDir, "todo-archive.json");
33243
+ const archivePath = join76(cleoDir, "todo-archive.json");
33239
33244
  if (existsSync76(archivePath)) {
33240
33245
  try {
33241
33246
  const archiveData = JSON.parse(readFileSync57(archivePath, "utf-8"));
@@ -33273,7 +33278,7 @@ async function migrateJsonToSqlite2(cwd, options) {
33273
33278
  result.errors.push(`Failed to parse todo-archive.json: ${String(err)}`);
33274
33279
  }
33275
33280
  }
33276
- const sessionsPath = join77(cleoDir, "sessions.json");
33281
+ const sessionsPath = join76(cleoDir, "sessions.json");
33277
33282
  if (existsSync76(sessionsPath)) {
33278
33283
  try {
33279
33284
  const sessionsData = JSON.parse(readFileSync57(sessionsPath, "utf-8"));
@@ -33345,7 +33350,7 @@ init_platform();
33345
33350
  init_storage_preflight();
33346
33351
  import { Command, Help } from "commander";
33347
33352
  import { readFileSync as readFileSync60 } from "node:fs";
33348
- import { join as join82 } from "node:path";
33353
+ import { join as join81 } from "node:path";
33349
33354
 
33350
33355
  // src/dispatch/adapters/cli.ts
33351
33356
  init_renderers();
@@ -45519,12 +45524,12 @@ function registerAdrCommand(program2) {
45519
45524
  await dispatchFromCli(
45520
45525
  "query",
45521
45526
  "admin",
45522
- "adr.list",
45527
+ "adr.find",
45523
45528
  {
45524
45529
  status: opts["status"],
45525
45530
  since: opts["since"]
45526
45531
  },
45527
- { command: "adr list", operation: "admin.adr.list" }
45532
+ { command: "adr list", operation: "admin.adr.find" }
45528
45533
  );
45529
45534
  });
45530
45535
  adr.command("show <adrId>").description("Show full details for a single ADR (e.g., ct adr show ADR-017)").action(async (adrId) => {
@@ -45811,93 +45816,23 @@ function registerCheckpointCommand(program2) {
45811
45816
  }
45812
45817
 
45813
45818
  // src/cli/commands/commands.ts
45814
- init_errors();
45815
- init_output();
45816
- init_paths();
45817
- init_json();
45818
- init_exit_codes();
45819
- init_renderers();
45820
- import { join as join68 } from "node:path";
45821
- var VALID_CATEGORIES = ["write", "read", "sync", "maintenance"];
45822
- var VALID_RELEVANCE = ["critical", "high", "medium", "low"];
45823
- async function locateCommandsIndex() {
45824
- const cleoHome = getCleoHome();
45825
- const paths = [
45826
- join68(cleoHome, "docs", "commands", "COMMANDS-INDEX.json"),
45827
- join68(process.cwd(), "docs", "commands", "COMMANDS-INDEX.json")
45828
- ];
45829
- for (const p of paths) {
45830
- const data = await readJson(p);
45831
- if (data) return data;
45832
- }
45833
- throw new CleoError(3 /* FILE_ERROR */, "COMMANDS-INDEX.json not found", {
45834
- fix: "Reinstall cleo or check CLEO_HOME"
45835
- });
45836
- }
45837
45819
  function registerCommandsCommand(program2) {
45838
- program2.command("commands [command]").description("List and query available CLEO commands").option("-c, --category <category>", "Filter by category (write|read|sync|maintenance)").option("-r, --relevance <level>", "Filter by agent relevance (critical|high|medium|low)").option("--workflows", "Show agent workflow sequences").option("--lookup", "Show intent-to-command quick lookup").action(async (commandName, opts) => {
45839
- try {
45840
- const category = opts["category"];
45841
- const relevance = opts["relevance"];
45842
- if (category && !VALID_CATEGORIES.includes(category)) {
45843
- throw new CleoError(
45844
- 2 /* INVALID_INPUT */,
45845
- `Invalid category: ${category}. Valid: ${VALID_CATEGORIES.join(", ")}`
45846
- );
45847
- }
45848
- if (relevance && !VALID_RELEVANCE.includes(relevance)) {
45849
- throw new CleoError(
45850
- 2 /* INVALID_INPUT */,
45851
- `Invalid relevance: ${relevance}. Valid: ${VALID_RELEVANCE.join(", ")}`
45852
- );
45853
- }
45854
- const index5 = await locateCommandsIndex();
45855
- console.error(
45856
- "[DEPRECATED] cleo commands reads from COMMANDS-INDEX.json which is deprecated.\nThe canonical operations reference is: docs/specs/CLEO-OPERATIONS-REFERENCE.md\nUse query/mutate MCP tools for programmatic access.\n"
45857
- );
45858
- if (opts["workflows"]) {
45859
- cliOutput({ workflows: index5.agentWorkflows ?? {} }, { command: "commands" });
45860
- return;
45861
- }
45862
- if (opts["lookup"]) {
45863
- cliOutput({ quickLookup: index5.quickLookup ?? {} }, { command: "commands" });
45864
- return;
45865
- }
45866
- let commands = index5.commands;
45867
- if (category) {
45868
- commands = commands.filter((c) => c.category === category);
45869
- }
45870
- if (relevance) {
45871
- commands = commands.filter((c) => c.agentRelevance === relevance);
45872
- }
45873
- if (commandName) {
45874
- commands = commands.filter((c) => c.name === commandName);
45875
- if (commands.length === 0) {
45876
- throw new CleoError(4 /* NOT_FOUND */, `Command not found: ${commandName}`, {
45877
- fix: "Run 'cleo commands' to see available commands"
45878
- });
45879
- }
45880
- cliOutput({ command: commands[0] }, { command: "commands" });
45881
- return;
45882
- }
45883
- cliOutput(
45884
- {
45885
- summary: {
45886
- totalCommands: commands.length,
45887
- categoryFilter: category ?? "all",
45888
- relevanceFilter: relevance ?? "all"
45889
- },
45890
- commands
45891
- },
45892
- { command: "commands" }
45893
- );
45894
- } catch (err) {
45895
- if (err instanceof CleoError) {
45896
- console.error(formatError(err));
45897
- process.exit(err.code);
45898
- }
45899
- throw err;
45900
- }
45820
+ program2.command("commands [command]").description("List and query available CLEO commands (delegates to admin help)").option("-c, --category <category>", "Filter by category").option("-r, --relevance <level>", "Filter by agent relevance").option("--tier <n>", "Help tier level (0=basic, 1=extended, 2=full)", parseInt).action(async (commandName, opts) => {
45821
+ console.error(
45822
+ "[DEPRECATED] cleo commands now delegates to admin.help.\nUse: query admin help (MCP) or cleo help (CLI)\n"
45823
+ );
45824
+ await dispatchFromCli(
45825
+ "query",
45826
+ "admin",
45827
+ "help",
45828
+ {
45829
+ tier: opts["tier"] ?? 0,
45830
+ domain: commandName,
45831
+ category: opts["category"],
45832
+ relevance: opts["relevance"]
45833
+ },
45834
+ { command: "commands", operation: "admin.help" }
45835
+ );
45901
45836
  });
45902
45837
  }
45903
45838
 
@@ -45945,8 +45880,9 @@ function registerComplianceCommand(program2) {
45945
45880
  await dispatchFromCli(
45946
45881
  "query",
45947
45882
  "check",
45948
- "compliance.violations",
45883
+ "compliance.summary",
45949
45884
  {
45885
+ detail: true,
45950
45886
  severity: opts["severity"],
45951
45887
  since: opts["since"],
45952
45888
  agent: opts["agent"]
@@ -46051,8 +45987,9 @@ function registerConsensusCommand(program2) {
46051
45987
  await dispatchFromCli(
46052
45988
  "query",
46053
45989
  "check",
46054
- "protocol.consensus",
45990
+ "protocol",
46055
45991
  {
45992
+ protocolType: "consensus",
46056
45993
  mode: "task",
46057
45994
  taskId,
46058
45995
  strict: opts["strict"],
@@ -46065,8 +46002,9 @@ function registerConsensusCommand(program2) {
46065
46002
  await dispatchFromCli(
46066
46003
  "query",
46067
46004
  "check",
46068
- "protocol.consensus",
46005
+ "protocol",
46069
46006
  {
46007
+ protocolType: "consensus",
46070
46008
  mode: "manifest",
46071
46009
  manifestFile,
46072
46010
  strict: opts["strict"],
@@ -46124,8 +46062,9 @@ function registerContributionCommand(program2) {
46124
46062
  await dispatchFromCli(
46125
46063
  "query",
46126
46064
  "check",
46127
- "protocol.contribution",
46065
+ "protocol",
46128
46066
  {
46067
+ protocolType: "contribution",
46129
46068
  mode: "task",
46130
46069
  taskId,
46131
46070
  strict: opts["strict"]
@@ -46137,8 +46076,9 @@ function registerContributionCommand(program2) {
46137
46076
  await dispatchFromCli(
46138
46077
  "query",
46139
46078
  "check",
46140
- "protocol.contribution",
46079
+ "protocol",
46141
46080
  {
46081
+ protocolType: "contribution",
46142
46082
  mode: "manifest",
46143
46083
  manifestFile,
46144
46084
  strict: opts["strict"]
@@ -46169,8 +46109,9 @@ function registerDecompositionCommand(program2) {
46169
46109
  await dispatchFromCli(
46170
46110
  "query",
46171
46111
  "check",
46172
- "protocol.decomposition",
46112
+ "protocol",
46173
46113
  {
46114
+ protocolType: "decomposition",
46174
46115
  mode: "task",
46175
46116
  taskId,
46176
46117
  strict: opts["strict"],
@@ -46183,8 +46124,9 @@ function registerDecompositionCommand(program2) {
46183
46124
  await dispatchFromCli(
46184
46125
  "query",
46185
46126
  "check",
46186
- "protocol.decomposition",
46127
+ "protocol",
46187
46128
  {
46129
+ protocolType: "decomposition",
46188
46130
  mode: "manifest",
46189
46131
  manifestFile,
46190
46132
  strict: opts["strict"],
@@ -46306,13 +46248,13 @@ function registerTreeCommand(program2) {
46306
46248
  // src/cli/commands/detect-drift.ts
46307
46249
  init_renderers();
46308
46250
  import { existsSync as existsSync69, readdirSync as readdirSync20, readFileSync as readFileSync52 } from "node:fs";
46309
- import { dirname as dirname16, join as join69 } from "node:path";
46251
+ import { dirname as dirname16, join as join68 } from "node:path";
46310
46252
  import { fileURLToPath as fileURLToPath5 } from "node:url";
46311
46253
  function findProjectRoot() {
46312
46254
  const currentFile = fileURLToPath5(import.meta.url);
46313
46255
  let currentDir = dirname16(currentFile);
46314
46256
  while (currentDir !== "/") {
46315
- if (existsSync69(join69(currentDir, "package.json"))) {
46257
+ if (existsSync69(join68(currentDir, "package.json"))) {
46316
46258
  return currentDir;
46317
46259
  }
46318
46260
  const parent = dirname16(currentDir);
@@ -46356,9 +46298,9 @@ function registerDetectDriftCommand(program2) {
46356
46298
  }
46357
46299
  };
46358
46300
  try {
46359
- const specPath = join69(projectRoot, "docs", "specs", "CLEO-OPERATIONS-REFERENCE.md");
46360
- const queryPath = join69(projectRoot, "src", "mcp", "gateways", "query.ts");
46361
- const mutatePath = join69(projectRoot, "src", "mcp", "gateways", "mutate.ts");
46301
+ const specPath = join68(projectRoot, "docs", "specs", "CLEO-OPERATIONS-REFERENCE.md");
46302
+ const queryPath = join68(projectRoot, "src", "mcp", "gateways", "query.ts");
46303
+ const mutatePath = join68(projectRoot, "src", "mcp", "gateways", "mutate.ts");
46362
46304
  if (!existsSync69(specPath)) {
46363
46305
  addCheck("Gateway-to-spec sync", "fail", "CLEO-OPERATIONS-REFERENCE.md missing", [
46364
46306
  {
@@ -46436,8 +46378,8 @@ function registerDetectDriftCommand(program2) {
46436
46378
  ]);
46437
46379
  }
46438
46380
  try {
46439
- const cliDir = join69(projectRoot, "src", "cli", "commands");
46440
- const coreDir = join69(projectRoot, "src", "core");
46381
+ const cliDir = join68(projectRoot, "src", "cli", "commands");
46382
+ const coreDir = join68(projectRoot, "src", "core");
46441
46383
  if (!existsSync69(cliDir)) {
46442
46384
  addCheck("CLI-to-core sync", "fail", "CLI commands directory missing", [
46443
46385
  {
@@ -46466,7 +46408,7 @@ function registerDetectDriftCommand(program2) {
46466
46408
  addCheck("CLI-to-core sync", "fail", `Error: ${e.message}`);
46467
46409
  }
46468
46410
  try {
46469
- const domainsDir = join69(projectRoot, "src", "mcp", "domains");
46411
+ const domainsDir = join68(projectRoot, "src", "mcp", "domains");
46470
46412
  if (!existsSync69(domainsDir)) {
46471
46413
  addCheck("Domain handler coverage", "fail", "MCP domains directory missing", [
46472
46414
  {
@@ -46484,7 +46426,7 @@ function registerDetectDriftCommand(program2) {
46484
46426
  addCheck("Domain handler coverage", "fail", `Error: ${e.message}`);
46485
46427
  }
46486
46428
  try {
46487
- const matrixPath = join69(projectRoot, "src", "dispatch", "lib", "capability-matrix.ts");
46429
+ const matrixPath = join68(projectRoot, "src", "dispatch", "lib", "capability-matrix.ts");
46488
46430
  if (!existsSync69(matrixPath)) {
46489
46431
  addCheck("Capability matrix", "fail", "Capability matrix missing", [
46490
46432
  {
@@ -46501,7 +46443,7 @@ function registerDetectDriftCommand(program2) {
46501
46443
  addCheck("Capability matrix", "fail", `Error: ${e.message}`);
46502
46444
  }
46503
46445
  try {
46504
- const schemaPath = join69(projectRoot, "src", "store", "schema.ts");
46446
+ const schemaPath = join68(projectRoot, "src", "store", "schema.ts");
46505
46447
  if (!existsSync69(schemaPath)) {
46506
46448
  addCheck("Schema validation", "fail", "Schema definition missing", [
46507
46449
  {
@@ -46536,8 +46478,8 @@ function registerDetectDriftCommand(program2) {
46536
46478
  addCheck("Schema validation", "fail", `Error: ${e.message}`);
46537
46479
  }
46538
46480
  try {
46539
- const visionPath = join69(projectRoot, "docs", "concepts", "CLEO-VISION.md");
46540
- const specPath = join69(projectRoot, "docs", "specs", "PORTABLE-BRAIN-SPEC.md");
46481
+ const visionPath = join68(projectRoot, "docs", "concepts", "CLEO-VISION.md");
46482
+ const specPath = join68(projectRoot, "docs", "specs", "PORTABLE-BRAIN-SPEC.md");
46541
46483
  const issues = [];
46542
46484
  if (!existsSync69(visionPath)) {
46543
46485
  issues.push({
@@ -46592,7 +46534,7 @@ function registerDetectDriftCommand(program2) {
46592
46534
  addCheck("Canonical identity", "fail", `Error: ${e.message}`);
46593
46535
  }
46594
46536
  try {
46595
- const injectionPath = join69(projectRoot, ".cleo", "templates", "CLEO-INJECTION.md");
46537
+ const injectionPath = join68(projectRoot, ".cleo", "templates", "CLEO-INJECTION.md");
46596
46538
  if (!existsSync69(injectionPath)) {
46597
46539
  addCheck("Agent injection", "fail", "Agent injection template missing", [
46598
46540
  {
@@ -46622,7 +46564,7 @@ function registerDetectDriftCommand(program2) {
46622
46564
  addCheck("Agent injection", "fail", `Error: ${e.message}`);
46623
46565
  }
46624
46566
  try {
46625
- const exitCodesPath = join69(projectRoot, "src", "types", "exit-codes.ts");
46567
+ const exitCodesPath = join68(projectRoot, "src", "types", "exit-codes.ts");
46626
46568
  if (!existsSync69(exitCodesPath)) {
46627
46569
  addCheck("Exit codes", "fail", "Exit codes definition missing", [
46628
46570
  {
@@ -46662,9 +46604,9 @@ init_paths();
46662
46604
  init_json();
46663
46605
  init_renderers();
46664
46606
  import { readdir as readdir2, readFile as readFile15 } from "node:fs/promises";
46665
- import { join as join70 } from "node:path";
46607
+ import { join as join69 } from "node:path";
46666
46608
  async function getScriptNames(projectRoot) {
46667
- const scriptsDir = join70(projectRoot, "scripts");
46609
+ const scriptsDir = join69(projectRoot, "scripts");
46668
46610
  try {
46669
46611
  const files = await readdir2(scriptsDir);
46670
46612
  return files.filter((f) => f.endsWith(".sh")).map((f) => f.replace(".sh", "")).sort();
@@ -46673,7 +46615,7 @@ async function getScriptNames(projectRoot) {
46673
46615
  }
46674
46616
  }
46675
46617
  async function getIndexedCommands(projectRoot) {
46676
- const indexPath = join70(projectRoot, "docs", "commands", "COMMANDS-INDEX.json");
46618
+ const indexPath = join69(projectRoot, "docs", "commands", "COMMANDS-INDEX.json");
46677
46619
  const index5 = await readJson(indexPath);
46678
46620
  if (!index5) return [];
46679
46621
  return index5.commands.map((c) => c.name).sort();
@@ -46706,7 +46648,7 @@ async function runGapCheck(_projectRoot, filterId) {
46706
46648
  const reviewFiles = files.filter((f) => f.endsWith(".md"));
46707
46649
  for (const file of reviewFiles) {
46708
46650
  if (filterId && !file.includes(filterId)) continue;
46709
- const filePath = join70(reviewDir, file);
46651
+ const filePath = join69(reviewDir, file);
46710
46652
  const content = await readFile15(filePath, "utf-8");
46711
46653
  const taskMatch = file.match(/^(T\d+)/);
46712
46654
  const taskId = taskMatch ? taskMatch[1] : "UNKNOWN";
@@ -46895,13 +46837,23 @@ function createUpgradeProgress(enabled) {
46895
46837
 
46896
46838
  // src/cli/commands/doctor.ts
46897
46839
  function registerDoctorCommand(program2) {
46898
- program2.command("doctor").description("Run system diagnostics and health checks").option("--detailed", "Show detailed health check results").option("--comprehensive", "Run comprehensive doctor report").option("--fix", "Auto-fix failed checks").action(async (_opts, command) => {
46840
+ program2.command("doctor").description("Run system diagnostics and health checks").option("--detailed", "Show detailed health check results").option("--comprehensive", "Run comprehensive doctor report").option("--fix", "Auto-fix failed checks").option("--coherence", "Run coherence check across task data").action(async (_opts, command) => {
46899
46841
  const opts = command.optsWithGlobals ? command.optsWithGlobals() : command.opts();
46900
46842
  const isHuman = opts["human"] === true || !!process.stdout.isTTY && opts["json"] !== true;
46901
46843
  const progress = createDoctorProgress(isHuman);
46902
46844
  progress.start();
46903
46845
  try {
46904
- if (opts["fix"]) {
46846
+ if (opts["coherence"]) {
46847
+ progress.step(0, "Running coherence check");
46848
+ await dispatchFromCli(
46849
+ "query",
46850
+ "check",
46851
+ "coherence",
46852
+ {},
46853
+ { command: "doctor", operation: "check.coherence" }
46854
+ );
46855
+ progress.complete("Coherence check complete");
46856
+ } else if (opts["fix"]) {
46905
46857
  progress.step(4, "Applying fixes");
46906
46858
  await dispatchFromCli(
46907
46859
  "mutate",
@@ -47068,7 +47020,7 @@ init_json();
47068
47020
  init_exit_codes();
47069
47021
  init_renderers();
47070
47022
  import { readFile as readFile16, rm as rm3, stat as stat3 } from "node:fs/promises";
47071
- import { join as join71 } from "node:path";
47023
+ import { join as join70 } from "node:path";
47072
47024
  function parseTaskId(content) {
47073
47025
  const match = content.match(/^\[T(\d+)\]/);
47074
47026
  return match ? `T${match[1]}` : null;
@@ -47124,7 +47076,7 @@ function registerExtractCommand(program2) {
47124
47076
  const accessor = await getAccessor();
47125
47077
  const taskData = await accessor.loadTaskFile();
47126
47078
  const cleoDir = getCleoDir();
47127
- const stateFile = join71(cleoDir, "sync", "todowrite-session.json");
47079
+ const stateFile = join70(cleoDir, "sync", "todowrite-session.json");
47128
47080
  let sessionState = null;
47129
47081
  try {
47130
47082
  sessionState = await readJson(stateFile);
@@ -47272,7 +47224,7 @@ init_exit_codes();
47272
47224
  init_renderers();
47273
47225
  import { execFileSync as execFileSync11 } from "node:child_process";
47274
47226
  import { existsSync as existsSync70, mkdirSync as mkdirSync16, readFileSync as readFileSync53, writeFileSync as writeFileSync10 } from "node:fs";
47275
- import { dirname as dirname17, join as join72 } from "node:path";
47227
+ import { dirname as dirname17, join as join71 } from "node:path";
47276
47228
  function getChangelogSource(cwd) {
47277
47229
  const configPath = getConfigPath(cwd);
47278
47230
  try {
@@ -47410,7 +47362,7 @@ function registerGenerateChangelogCommand(program2) {
47410
47362
  const targetPlatform = opts["platform"];
47411
47363
  const dryRun = !!opts["dryRun"];
47412
47364
  const sourceFile = getChangelogSource();
47413
- const sourcePath = join72(getProjectRoot(), sourceFile);
47365
+ const sourcePath = join71(getProjectRoot(), sourceFile);
47414
47366
  if (!existsSync70(sourcePath)) {
47415
47367
  throw new CleoError(4 /* NOT_FOUND */, `Changelog source not found: ${sourcePath}`);
47416
47368
  }
@@ -47423,7 +47375,7 @@ function registerGenerateChangelogCommand(program2) {
47423
47375
  const outputPath = platformConfig?.path ?? getDefaultOutputPath(targetPlatform);
47424
47376
  const content = generateForPlatform(targetPlatform, sourceContent, repoSlug, limit);
47425
47377
  if (!dryRun) {
47426
- const fullPath = join72(getProjectRoot(), outputPath);
47378
+ const fullPath = join71(getProjectRoot(), outputPath);
47427
47379
  mkdirSync16(dirname17(fullPath), { recursive: true });
47428
47380
  writeFileSync10(fullPath, content, "utf-8");
47429
47381
  }
@@ -47444,7 +47396,7 @@ function registerGenerateChangelogCommand(program2) {
47444
47396
  limit
47445
47397
  );
47446
47398
  if (!dryRun) {
47447
- const fullPath = join72(getProjectRoot(), platformConfig.path);
47399
+ const fullPath = join71(getProjectRoot(), platformConfig.path);
47448
47400
  mkdirSync16(dirname17(fullPath), { recursive: true });
47449
47401
  writeFileSync10(fullPath, content, "utf-8");
47450
47402
  }
@@ -47512,8 +47464,9 @@ function registerImplementationCommand(program2) {
47512
47464
  await dispatchFromCli(
47513
47465
  "query",
47514
47466
  "check",
47515
- "protocol.implementation",
47467
+ "protocol",
47516
47468
  {
47469
+ protocolType: "implementation",
47517
47470
  mode: "task",
47518
47471
  taskId,
47519
47472
  strict: opts["strict"]
@@ -47525,8 +47478,9 @@ function registerImplementationCommand(program2) {
47525
47478
  await dispatchFromCli(
47526
47479
  "query",
47527
47480
  "check",
47528
- "protocol.implementation",
47481
+ "protocol",
47529
47482
  {
47483
+ protocolType: "implementation",
47530
47484
  mode: "manifest",
47531
47485
  manifestFile,
47532
47486
  strict: opts["strict"]
@@ -47644,7 +47598,7 @@ init_renderers();
47644
47598
  import { existsSync as existsSync71, readFileSync as readFileSync54 } from "node:fs";
47645
47599
  import { mkdir as mkdir12, readFile as readFile17, writeFile as writeFile11 } from "node:fs/promises";
47646
47600
  import { homedir as homedir4 } from "node:os";
47647
- import { dirname as dirname18, join as join73, resolve as resolve9 } from "node:path";
47601
+ import { dirname as dirname18, join as join72, resolve as resolve9 } from "node:path";
47648
47602
  import { fileURLToPath as fileURLToPath6 } from "node:url";
47649
47603
  function registerInstallGlobalCommand(program2) {
47650
47604
  program2.command("install-global").description("Refresh global CLEO setup: provider files, MCP configs, templates").option("--dry-run", "Preview changes without applying").action(async (opts) => {
@@ -47653,17 +47607,17 @@ function registerInstallGlobalCommand(program2) {
47653
47607
  const warnings = [];
47654
47608
  try {
47655
47609
  const cleoHome = getCleoHome();
47656
- const globalTemplatesDir = join73(cleoHome, "templates");
47610
+ const globalTemplatesDir = join72(cleoHome, "templates");
47657
47611
  if (!isDryRun) {
47658
47612
  await mkdir12(globalTemplatesDir, { recursive: true });
47659
47613
  }
47660
47614
  try {
47661
47615
  const thisFile = fileURLToPath6(import.meta.url);
47662
47616
  const packageRoot = resolve9(dirname18(thisFile), "..", "..", "..");
47663
- const templatePath = join73(packageRoot, "templates", "CLEO-INJECTION.md");
47617
+ const templatePath = join72(packageRoot, "templates", "CLEO-INJECTION.md");
47664
47618
  if (existsSync71(templatePath)) {
47665
47619
  const content = readFileSync54(templatePath, "utf-8");
47666
- const globalPath = join73(globalTemplatesDir, "CLEO-INJECTION.md");
47620
+ const globalPath = join72(globalTemplatesDir, "CLEO-INJECTION.md");
47667
47621
  if (!isDryRun) {
47668
47622
  await writeFile11(globalPath, content);
47669
47623
  }
@@ -47675,7 +47629,7 @@ function registerInstallGlobalCommand(program2) {
47675
47629
  warnings.push("Could not refresh CLEO-INJECTION.md template");
47676
47630
  }
47677
47631
  const globalAgentsDir = getAgentsHome();
47678
- const globalAgentsMd = join73(globalAgentsDir, "AGENTS.md");
47632
+ const globalAgentsMd = join72(globalAgentsDir, "AGENTS.md");
47679
47633
  try {
47680
47634
  const { inject, getInstalledProviders: getInstalledProviders3, injectAll: injectAll2, buildInjectionContent: buildInjectionContent2 } = await import("@cleocode/caamp");
47681
47635
  if (!isDryRun) {
@@ -47704,7 +47658,7 @@ function registerInstallGlobalCommand(program2) {
47704
47658
  });
47705
47659
  if (!isDryRun) {
47706
47660
  for (const provider of providers) {
47707
- const instructFilePath = join73(provider.pathGlobal, provider.instructFile);
47661
+ const instructFilePath = join72(provider.pathGlobal, provider.instructFile);
47708
47662
  if (existsSync71(instructFilePath)) {
47709
47663
  const fileContent = await readFile17(instructFilePath, "utf8");
47710
47664
  const stripped = fileContent.replace(
@@ -47723,7 +47677,7 @@ function registerInstallGlobalCommand(program2) {
47723
47677
  }
47724
47678
  } else {
47725
47679
  for (const p of providers) {
47726
- const displayPath = join73(p.pathGlobal, p.instructFile).replace(homedir4(), "~");
47680
+ const displayPath = join72(p.pathGlobal, p.instructFile).replace(homedir4(), "~");
47727
47681
  created.push(`${displayPath} (would update CAAMP block)`);
47728
47682
  }
47729
47683
  }
@@ -47795,7 +47749,7 @@ import { execFileSync as execFileSync12 } from "node:child_process";
47795
47749
  // src/config/build-config.ts
47796
47750
  var BUILD_CONFIG = {
47797
47751
  "name": "@cleocode/cleo",
47798
- "version": "2026.3.23",
47752
+ "version": "2026.3.24",
47799
47753
  "description": "CLEO V2 - TypeScript task management CLI for AI coding agents",
47800
47754
  "repository": {
47801
47755
  "owner": "kryptobaseddev",
@@ -47804,7 +47758,7 @@ var BUILD_CONFIG = {
47804
47758
  "url": "https://github.com/kryptobaseddev/cleo.git",
47805
47759
  "issuesUrl": "https://github.com/kryptobaseddev/cleo/issues"
47806
47760
  },
47807
- "buildDate": "2026-03-08T19:53:16.610Z",
47761
+ "buildDate": "2026-03-08T20:55:22.134Z",
47808
47762
  "templates": {
47809
47763
  "issueTemplatesDir": "templates/issue-templates"
47810
47764
  }
@@ -48234,8 +48188,8 @@ function registerMemoryBrainCommand(program2) {
48234
48188
  }
48235
48189
  });
48236
48190
  memory.command("stats").description("Show BRAIN memory statistics").option("--json", "Output as JSON").action(async () => {
48237
- const pResponse = await dispatchRaw("query", "memory", "pattern.stats", {});
48238
- const lResponse = await dispatchRaw("query", "memory", "learning.stats", {});
48191
+ const pResponse = await dispatchRaw("query", "memory", "pattern.find", { query: "", limit: 0 });
48192
+ const lResponse = await dispatchRaw("query", "memory", "learning.find", { query: "", limit: 0 });
48239
48193
  const result = {};
48240
48194
  if (pResponse.success) result["patterns"] = pResponse.data;
48241
48195
  if (lResponse.success) result["learnings"] = lResponse.data;
@@ -48575,7 +48529,7 @@ function registerNexusCommand(program2) {
48575
48529
  await dispatchFromCli(
48576
48530
  "query",
48577
48531
  "nexus",
48578
- "query",
48532
+ "resolve",
48579
48533
  {
48580
48534
  query: taskId
48581
48535
  },
@@ -48621,13 +48575,13 @@ function registerNexusCommand(program2) {
48621
48575
  );
48622
48576
  });
48623
48577
  nexus.command("critical-path").description("Show global critical path across all registered projects").action(async () => {
48624
- await dispatchFromCli("query", "nexus", "critical-path", {}, { command: "nexus" });
48578
+ await dispatchFromCli("query", "nexus", "path.show", {}, { command: "nexus" });
48625
48579
  });
48626
48580
  nexus.command("blocking <taskQuery>").description("Show blocking impact analysis for a task").action(async (taskQuery) => {
48627
48581
  await dispatchFromCli(
48628
48582
  "query",
48629
48583
  "nexus",
48630
- "blocking",
48584
+ "blockers.show",
48631
48585
  {
48632
48586
  query: taskQuery
48633
48587
  },
@@ -48635,7 +48589,7 @@ function registerNexusCommand(program2) {
48635
48589
  );
48636
48590
  });
48637
48591
  nexus.command("orphans").description("Detect broken cross-project dependency references").action(async () => {
48638
- await dispatchFromCli("query", "nexus", "orphans", {}, { command: "nexus" });
48592
+ await dispatchFromCli("query", "nexus", "orphans.list", {}, { command: "nexus" });
48639
48593
  });
48640
48594
  nexus.command("sync [project]").description("Sync project metadata (task count, labels)").action(async (project) => {
48641
48595
  if (project) {
@@ -48649,7 +48603,7 @@ function registerNexusCommand(program2) {
48649
48603
  { command: "nexus" }
48650
48604
  );
48651
48605
  } else {
48652
- await dispatchFromCli("mutate", "nexus", "sync.all", {}, { command: "nexus" });
48606
+ await dispatchFromCli("mutate", "nexus", "sync", {}, { command: "nexus" });
48653
48607
  }
48654
48608
  });
48655
48609
  nexus.command("reconcile").description(
@@ -48746,17 +48700,17 @@ init_errors();
48746
48700
 
48747
48701
  // src/core/otel/index.ts
48748
48702
  import { copyFileSync as copyFileSync4, existsSync as existsSync73, readFileSync as readFileSync55, writeFileSync as writeFileSync11 } from "node:fs";
48749
- import { join as join74 } from "node:path";
48703
+ import { join as join73 } from "node:path";
48750
48704
  function getProjectRoot2() {
48751
48705
  let dir = process.cwd();
48752
48706
  while (dir !== "/") {
48753
- if (existsSync73(join74(dir, ".cleo", "config.json"))) return dir;
48754
- dir = join74(dir, "..");
48707
+ if (existsSync73(join73(dir, ".cleo", "config.json"))) return dir;
48708
+ dir = join73(dir, "..");
48755
48709
  }
48756
48710
  return process.cwd();
48757
48711
  }
48758
48712
  function getTokenFilePath() {
48759
- return join74(getProjectRoot2(), ".cleo", "metrics", "TOKEN_USAGE.jsonl");
48713
+ return join73(getProjectRoot2(), ".cleo", "metrics", "TOKEN_USAGE.jsonl");
48760
48714
  }
48761
48715
  function readJsonlFile(filePath) {
48762
48716
  if (!existsSync73(filePath)) return [];
@@ -48967,8 +48921,8 @@ function registerPhaseCommand(program2) {
48967
48921
  await dispatchFromCli(
48968
48922
  "mutate",
48969
48923
  "pipeline",
48970
- "phase.start",
48971
- { phaseId: slug },
48924
+ "phase.set",
48925
+ { phaseId: slug, action: "start" },
48972
48926
  { command: "phase" }
48973
48927
  );
48974
48928
  });
@@ -48976,8 +48930,8 @@ function registerPhaseCommand(program2) {
48976
48930
  await dispatchFromCli(
48977
48931
  "mutate",
48978
48932
  "pipeline",
48979
- "phase.complete",
48980
- { phaseId: slug },
48933
+ "phase.set",
48934
+ { phaseId: slug, action: "complete" },
48981
48935
  { command: "phase" }
48982
48936
  );
48983
48937
  });
@@ -49910,7 +49864,7 @@ function registerSafestopCommand(program2) {
49910
49864
  // src/cli/commands/self-update.ts
49911
49865
  import { execFile as execFile7 } from "node:child_process";
49912
49866
  import { readFile as readFile19 } from "node:fs/promises";
49913
- import { join as join79 } from "node:path";
49867
+ import { join as join78 } from "node:path";
49914
49868
  import * as readline from "node:readline";
49915
49869
  import { promisify as promisify9 } from "node:util";
49916
49870
  init_errors();
@@ -49928,7 +49882,7 @@ import {
49928
49882
  readFileSync as readFileSync58,
49929
49883
  writeFileSync as writeFileSync12
49930
49884
  } from "node:fs";
49931
- import { join as join78 } from "node:path";
49885
+ import { join as join77 } from "node:path";
49932
49886
 
49933
49887
  // src/store/index.ts
49934
49888
  init_atomic();
@@ -49974,7 +49928,7 @@ async function runUpgrade(options = {}) {
49974
49928
  };
49975
49929
  }
49976
49930
  const cleoDir = getCleoDirAbsolute(options.cwd);
49977
- const dbPath = join78(cleoDir, "tasks.db");
49931
+ const dbPath = join77(cleoDir, "tasks.db");
49978
49932
  const dbExists2 = existsSync77(dbPath);
49979
49933
  const legacyRecordCount = preflight.details.todoJsonTaskCount + preflight.details.archiveJsonTaskCount + preflight.details.sessionsJsonCount;
49980
49934
  const needsMigration = !dbExists2 && legacyRecordCount > 0;
@@ -49991,7 +49945,7 @@ async function runUpgrade(options = {}) {
49991
49945
  let migrationLock = null;
49992
49946
  try {
49993
49947
  const cleoDir2 = getCleoDirAbsolute(options.cwd);
49994
- const dbPath2 = join78(cleoDir2, "tasks.db");
49948
+ const dbPath2 = join77(cleoDir2, "tasks.db");
49995
49949
  try {
49996
49950
  migrationLock = await acquireLock(dbPath2, { stale: 3e4, retries: 0 });
49997
49951
  } catch {
@@ -50016,21 +49970,21 @@ async function runUpgrade(options = {}) {
50016
49970
  } = await Promise.resolve().then(() => (init_state(), state_exports));
50017
49971
  const logger = new MigrationLogger2(cleoDir2);
50018
49972
  await createMigrationState2(cleoDir2, {
50019
- todoJson: { path: join78(cleoDir2, "todo.json"), checksum: "" },
50020
- sessionsJson: { path: join78(cleoDir2, "sessions.json"), checksum: "" },
50021
- archiveJson: { path: join78(cleoDir2, "todo-archive.json"), checksum: "" }
49973
+ todoJson: { path: join77(cleoDir2, "todo.json"), checksum: "" },
49974
+ sessionsJson: { path: join77(cleoDir2, "sessions.json"), checksum: "" },
49975
+ archiveJson: { path: join77(cleoDir2, "todo-archive.json"), checksum: "" }
50022
49976
  });
50023
49977
  await updateMigrationPhase2(cleoDir2, "backup");
50024
49978
  logger.info("init", "start", "Migration state initialized");
50025
- const dbBackupPath = join78(
49979
+ const dbBackupPath = join77(
50026
49980
  cleoDir2,
50027
49981
  "backups",
50028
49982
  "safety",
50029
49983
  `tasks.db.pre-migration.${Date.now()}`
50030
49984
  );
50031
- const dbTempPath = join78(cleoDir2, "tasks.db.migrating");
49985
+ const dbTempPath = join77(cleoDir2, "tasks.db.migrating");
50032
49986
  if (existsSync77(dbPath2)) {
50033
- const backupDir = join78(cleoDir2, "backups", "safety");
49987
+ const backupDir = join77(cleoDir2, "backups", "safety");
50034
49988
  if (!existsSync77(backupDir)) {
50035
49989
  mkdirSync19(backupDir, { recursive: true });
50036
49990
  }
@@ -50058,7 +50012,7 @@ async function runUpgrade(options = {}) {
50058
50012
  const { unlinkSync: unlinkSync6 } = await import("node:fs");
50059
50013
  unlinkSync6(dbTempPath);
50060
50014
  }
50061
- const configPath = join78(cleoDir2, "config.json");
50015
+ const configPath = join77(cleoDir2, "config.json");
50062
50016
  let configBackup = null;
50063
50017
  if (existsSync77(configPath)) {
50064
50018
  configBackup = readFileSync58(configPath, "utf-8");
@@ -50154,12 +50108,12 @@ async function runUpgrade(options = {}) {
50154
50108
  } catch (err) {
50155
50109
  try {
50156
50110
  const cleoDir2 = getCleoDirAbsolute(options.cwd);
50157
- const dbPath2 = join78(cleoDir2, "tasks.db");
50158
- const safetyDir = join78(cleoDir2, "backups", "safety");
50111
+ const dbPath2 = join77(cleoDir2, "tasks.db");
50112
+ const safetyDir = join77(cleoDir2, "backups", "safety");
50159
50113
  if (existsSync77(safetyDir)) {
50160
50114
  const backups = readdirSync22(safetyDir).filter((f) => f.startsWith("tasks.db.pre-migration.")).sort().reverse();
50161
50115
  if (backups.length > 0 && !existsSync77(dbPath2)) {
50162
- copyFileSync5(join78(safetyDir, backups[0]), dbPath2);
50116
+ copyFileSync5(join77(safetyDir, backups[0]), dbPath2);
50163
50117
  }
50164
50118
  }
50165
50119
  } catch {
@@ -50206,7 +50160,7 @@ async function runUpgrade(options = {}) {
50206
50160
  }
50207
50161
  if (existsSync77(dbPath)) {
50208
50162
  const legacySequenceFiles = [".sequence", ".sequence.json"].filter(
50209
- (f) => existsSync77(join78(cleoDir, f))
50163
+ (f) => existsSync77(join77(cleoDir, f))
50210
50164
  );
50211
50165
  if (legacySequenceFiles.length > 0) {
50212
50166
  if (isDryRun) {
@@ -50242,7 +50196,7 @@ async function runUpgrade(options = {}) {
50242
50196
  ".sequence",
50243
50197
  ".sequence.json"
50244
50198
  ];
50245
- const foundStale = staleJsonFiles.filter((f) => existsSync77(join78(cleoDir, f)));
50199
+ const foundStale = staleJsonFiles.filter((f) => existsSync77(join77(cleoDir, f)));
50246
50200
  if (foundStale.length > 0) {
50247
50201
  if (isDryRun) {
50248
50202
  actions.push({
@@ -50252,15 +50206,15 @@ async function runUpgrade(options = {}) {
50252
50206
  });
50253
50207
  } else {
50254
50208
  try {
50255
- const backupDir = join78(cleoDir, ".backups", `legacy-json-${Date.now()}`);
50209
+ const backupDir = join77(cleoDir, ".backups", `legacy-json-${Date.now()}`);
50256
50210
  mkdirSync19(backupDir, { recursive: true });
50257
50211
  for (const f of foundStale) {
50258
- const src = join78(cleoDir, f);
50259
- copyFileSync5(src, join78(backupDir, f));
50212
+ const src = join77(cleoDir, f);
50213
+ copyFileSync5(src, join77(backupDir, f));
50260
50214
  }
50261
50215
  const { unlinkSync: unlinkSync6 } = await import("node:fs");
50262
50216
  for (const f of foundStale) {
50263
- unlinkSync6(join78(cleoDir, f));
50217
+ unlinkSync6(join77(cleoDir, f));
50264
50218
  }
50265
50219
  actions.push({
50266
50220
  action: "stale_json_cleanup",
@@ -50280,7 +50234,7 @@ async function runUpgrade(options = {}) {
50280
50234
  if (options.includeGlobal) {
50281
50235
  try {
50282
50236
  const globalDir = getCleoHome();
50283
- const globalPreflight = checkStorageMigration(join78(globalDir, ".."));
50237
+ const globalPreflight = checkStorageMigration(join77(globalDir, ".."));
50284
50238
  if (globalPreflight.migrationNeeded) {
50285
50239
  actions.push({
50286
50240
  action: "global_storage_check",
@@ -50301,7 +50255,7 @@ async function runUpgrade(options = {}) {
50301
50255
  try {
50302
50256
  const projectRoot = getProjectRoot(options.cwd);
50303
50257
  if (isDryRun) {
50304
- const gitignorePath = join78(cleoDir, ".gitignore");
50258
+ const gitignorePath = join77(cleoDir, ".gitignore");
50305
50259
  if (!existsSync77(gitignorePath)) {
50306
50260
  actions.push({
50307
50261
  action: "gitignore_integrity",
@@ -50353,7 +50307,7 @@ async function runUpgrade(options = {}) {
50353
50307
  try {
50354
50308
  const projectRootForContext = getProjectRoot(options.cwd);
50355
50309
  if (isDryRun) {
50356
- const contextPath = join78(cleoDir, "project-context.json");
50310
+ const contextPath = join77(cleoDir, "project-context.json");
50357
50311
  if (!existsSync77(contextPath)) {
50358
50312
  actions.push({
50359
50313
  action: "project_context_detection",
@@ -50591,7 +50545,7 @@ var GITHUB_REPO = BUILD_CONFIG.repository.fullName;
50591
50545
  async function getCurrentVersion() {
50592
50546
  const cleoHome = getCleoHome();
50593
50547
  try {
50594
- const content = await readFile19(join79(cleoHome, "VERSION"), "utf-8");
50548
+ const content = await readFile19(join78(cleoHome, "VERSION"), "utf-8");
50595
50549
  return (content.split("\n")[0] ?? "unknown").trim();
50596
50550
  } catch {
50597
50551
  return "unknown";
@@ -50645,7 +50599,7 @@ async function writeRuntimeVersionMetadata(mode, source, version) {
50645
50599
  ];
50646
50600
  await import("node:fs/promises").then(
50647
50601
  ({ writeFile: writeFile14, mkdir: mkdir14 }) => mkdir14(cleoHome, { recursive: true }).then(
50648
- () => writeFile14(join79(cleoHome, "VERSION"), `${lines.join("\n")}
50602
+ () => writeFile14(join78(cleoHome, "VERSION"), `${lines.join("\n")}
50649
50603
  `, "utf-8")
50650
50604
  )
50651
50605
  );
@@ -51271,8 +51225,9 @@ function registerSpecificationCommand(program2) {
51271
51225
  await dispatchFromCli(
51272
51226
  "query",
51273
51227
  "check",
51274
- "protocol.specification",
51228
+ "protocol",
51275
51229
  {
51230
+ protocolType: "specification",
51276
51231
  mode: "task",
51277
51232
  taskId,
51278
51233
  strict: opts["strict"],
@@ -51285,8 +51240,9 @@ function registerSpecificationCommand(program2) {
51285
51240
  await dispatchFromCli(
51286
51241
  "query",
51287
51242
  "check",
51288
- "protocol.specification",
51243
+ "protocol",
51289
51244
  {
51245
+ protocolType: "specification",
51290
51246
  mode: "manifest",
51291
51247
  manifestFile,
51292
51248
  strict: opts["strict"],
@@ -51557,11 +51513,11 @@ function registerTestingCommand(program2) {
51557
51513
  await dispatchFromCli(
51558
51514
  "query",
51559
51515
  "check",
51560
- "test.status",
51561
- {},
51516
+ "test",
51517
+ { format: "status" },
51562
51518
  {
51563
51519
  command: "testing",
51564
- operation: "check.test.status"
51520
+ operation: "check.test"
51565
51521
  }
51566
51522
  );
51567
51523
  });
@@ -51569,11 +51525,11 @@ function registerTestingCommand(program2) {
51569
51525
  await dispatchFromCli(
51570
51526
  "query",
51571
51527
  "check",
51572
- "test.coverage",
51573
- {},
51528
+ "test",
51529
+ { format: "coverage" },
51574
51530
  {
51575
51531
  command: "testing",
51576
- operation: "check.test.coverage"
51532
+ operation: "check.test"
51577
51533
  }
51578
51534
  );
51579
51535
  });
@@ -51792,7 +51748,7 @@ function registerValidateCommand(program2) {
51792
51748
  "check",
51793
51749
  "schema",
51794
51750
  {
51795
- type: "tasks",
51751
+ type: "todo",
51796
51752
  strict: opts["strict"]
51797
51753
  },
51798
51754
  { command: "validate", operation: "check.schema" }
@@ -51806,7 +51762,7 @@ function registerVerifyCommand(program2) {
51806
51762
  await dispatchFromCli(
51807
51763
  "query",
51808
51764
  "check",
51809
- "gate.verify",
51765
+ "gate.status",
51810
51766
  {
51811
51767
  taskId,
51812
51768
  gate: opts["gate"],
@@ -51828,15 +51784,15 @@ init_exit_codes();
51828
51784
  init_renderers();
51829
51785
  import { execFileSync as execFileSync13, spawn as spawn2 } from "node:child_process";
51830
51786
  import { mkdir as mkdir13, readFile as readFile20, rm as rm4, stat as stat4, writeFile as writeFile13 } from "node:fs/promises";
51831
- import { join as join80 } from "node:path";
51787
+ import { join as join79 } from "node:path";
51832
51788
  var DEFAULT_PORT = 3456;
51833
51789
  var DEFAULT_HOST = "127.0.0.1";
51834
51790
  function getWebPaths() {
51835
51791
  const cleoHome = getCleoHome();
51836
51792
  return {
51837
- pidFile: join80(cleoHome, "web-server.pid"),
51838
- configFile: join80(cleoHome, "web-server.json"),
51839
- logFile: join80(cleoHome, "logs", "web-server.log")
51793
+ pidFile: join79(cleoHome, "web-server.pid"),
51794
+ configFile: join79(cleoHome, "web-server.json"),
51795
+ logFile: join79(cleoHome, "logs", "web-server.log")
51840
51796
  };
51841
51797
  }
51842
51798
  function isProcessRunning(pid) {
@@ -51883,8 +51839,8 @@ function registerWebCommand(program2) {
51883
51839
  );
51884
51840
  }
51885
51841
  const projectRoot = process.env["CLEO_ROOT"] ?? process.cwd();
51886
- const distMcpDir = join80(projectRoot, "dist", "mcp");
51887
- await mkdir13(join80(getCleoHome(), "logs"), { recursive: true });
51842
+ const distMcpDir = join79(projectRoot, "dist", "mcp");
51843
+ await mkdir13(join79(getCleoHome(), "logs"), { recursive: true });
51888
51844
  await writeFile13(
51889
51845
  configFile,
51890
51846
  JSON.stringify({
@@ -51893,7 +51849,7 @@ function registerWebCommand(program2) {
51893
51849
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
51894
51850
  })
51895
51851
  );
51896
- const webIndexPath = join80(distMcpDir, "index.js");
51852
+ const webIndexPath = join79(distMcpDir, "index.js");
51897
51853
  try {
51898
51854
  await stat4(webIndexPath);
51899
51855
  } catch {
@@ -52035,10 +51991,10 @@ init_format_context();
52035
51991
  // src/cli/logger-bootstrap.ts
52036
51992
  init_logger();
52037
51993
  init_project_info();
52038
- import { join as join81 } from "node:path";
51994
+ import { join as join80 } from "node:path";
52039
51995
  function initCliLogger(cwd, loggingConfig) {
52040
51996
  const projectInfo = getProjectInfoSync(cwd);
52041
- initLogger(join81(cwd, ".cleo"), loggingConfig, projectInfo?.projectHash);
51997
+ initLogger(join80(cwd, ".cleo"), loggingConfig, projectInfo?.projectHash);
52042
51998
  }
52043
51999
 
52044
52000
  // src/cli/middleware/output-format.ts
@@ -52249,8 +52205,8 @@ Upgrade options:
52249
52205
  }
52250
52206
  function getPackageVersion() {
52251
52207
  try {
52252
- const moduleRoot = join82(import.meta.dirname ?? "", "..", "..");
52253
- const pkg = JSON.parse(readFileSync60(join82(moduleRoot, "package.json"), "utf-8"));
52208
+ const moduleRoot = join81(import.meta.dirname ?? "", "..", "..");
52209
+ const pkg = JSON.parse(readFileSync60(join81(moduleRoot, "package.json"), "utf-8"));
52254
52210
  return pkg.version ?? "0.0.0";
52255
52211
  } catch {
52256
52212
  return "0.0.0";
@@ -52362,7 +52318,7 @@ program.hook("preAction", async () => {
52362
52318
  const config = await loadConfig();
52363
52319
  initCliLogger(process.cwd(), config.logging);
52364
52320
  const { pruneAuditLog: pruneAuditLog2 } = await Promise.resolve().then(() => (init_audit_prune(), audit_prune_exports));
52365
- pruneAuditLog2(join82(process.cwd(), ".cleo"), config.logging).catch(() => {
52321
+ pruneAuditLog2(join81(process.cwd(), ".cleo"), config.logging).catch(() => {
52366
52322
  });
52367
52323
  } catch {
52368
52324
  }
@@ -52402,7 +52358,7 @@ program.hook("preAction", (thisCommand) => {
52402
52358
  }
52403
52359
  });
52404
52360
  if (process.argv[2] === "mcp") {
52405
- const mcpPath = join82(import.meta.dirname ?? "", "..", "mcp", "index.js");
52361
+ const mcpPath = join81(import.meta.dirname ?? "", "..", "mcp", "index.js");
52406
52362
  const { spawn: spawn3 } = await import("node:child_process");
52407
52363
  const child = spawn3(process.execPath, ["--disable-warning=ExperimentalWarning", mcpPath], {
52408
52364
  stdio: "inherit"