@cleocode/cleo 2026.3.62 → 2026.3.64

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.
Files changed (87) hide show
  1. package/dist/cli/commands/add.d.ts.map +1 -1
  2. package/dist/cli/commands/add.js +5 -2
  3. package/dist/cli/commands/add.js.map +1 -1
  4. package/dist/cli/commands/agents.d.ts +31 -0
  5. package/dist/cli/commands/agents.d.ts.map +1 -0
  6. package/dist/cli/commands/agents.js +104 -0
  7. package/dist/cli/commands/agents.js.map +1 -0
  8. package/dist/cli/commands/backfill.d.ts +32 -0
  9. package/dist/cli/commands/backfill.d.ts.map +1 -0
  10. package/dist/cli/commands/backfill.js +101 -0
  11. package/dist/cli/commands/backfill.js.map +1 -0
  12. package/dist/cli/commands/backup.js +1 -1
  13. package/dist/cli/commands/backup.js.map +1 -1
  14. package/dist/cli/commands/config.d.ts +1 -0
  15. package/dist/cli/commands/config.d.ts.map +1 -1
  16. package/dist/cli/commands/config.js +26 -0
  17. package/dist/cli/commands/config.js.map +1 -1
  18. package/dist/cli/commands/context.js +1 -1
  19. package/dist/cli/commands/context.js.map +1 -1
  20. package/dist/cli/commands/deps.d.ts +15 -0
  21. package/dist/cli/commands/deps.d.ts.map +1 -1
  22. package/dist/cli/commands/deps.js +28 -3
  23. package/dist/cli/commands/deps.js.map +1 -1
  24. package/dist/cli/commands/detect-drift.d.ts.map +1 -1
  25. package/dist/cli/commands/detect-drift.js +4 -3
  26. package/dist/cli/commands/detect-drift.js.map +1 -1
  27. package/dist/cli/commands/exists.d.ts +15 -0
  28. package/dist/cli/commands/exists.d.ts.map +1 -1
  29. package/dist/cli/commands/exists.js +33 -15
  30. package/dist/cli/commands/exists.js.map +1 -1
  31. package/dist/cli/commands/issue.d.ts +3 -0
  32. package/dist/cli/commands/issue.d.ts.map +1 -1
  33. package/dist/cli/commands/issue.js +23 -21
  34. package/dist/cli/commands/issue.js.map +1 -1
  35. package/dist/cli/commands/labels.js +1 -1
  36. package/dist/cli/commands/labels.js.map +1 -1
  37. package/dist/cli/commands/phases.js +1 -1
  38. package/dist/cli/commands/phases.js.map +1 -1
  39. package/dist/cli/commands/reason.d.ts +35 -0
  40. package/dist/cli/commands/reason.d.ts.map +1 -0
  41. package/dist/cli/commands/reason.js +104 -0
  42. package/dist/cli/commands/reason.js.map +1 -0
  43. package/dist/cli/commands/session.d.ts.map +1 -1
  44. package/dist/cli/commands/session.js +15 -0
  45. package/dist/cli/commands/session.js.map +1 -1
  46. package/dist/cli/commands/stats.d.ts.map +1 -1
  47. package/dist/cli/commands/stats.js +13 -1
  48. package/dist/cli/commands/stats.js.map +1 -1
  49. package/dist/cli/commands/update.d.ts.map +1 -1
  50. package/dist/cli/commands/update.js +8 -2
  51. package/dist/cli/commands/update.js.map +1 -1
  52. package/dist/cli/index.js +91 -38
  53. package/dist/cli/index.js.map +3 -3
  54. package/dist/dispatch/domains/admin.d.ts.map +1 -1
  55. package/dist/dispatch/domains/admin.js +25 -1
  56. package/dist/dispatch/domains/admin.js.map +1 -1
  57. package/dist/dispatch/domains/check.d.ts.map +1 -1
  58. package/dist/dispatch/domains/check.js +15 -1
  59. package/dist/dispatch/domains/check.js.map +1 -1
  60. package/dist/dispatch/domains/tasks.d.ts.map +1 -1
  61. package/dist/dispatch/domains/tasks.js +17 -1
  62. package/dist/dispatch/domains/tasks.js.map +1 -1
  63. package/dist/dispatch/engines/config-engine.d.ts +11 -0
  64. package/dist/dispatch/engines/config-engine.d.ts.map +1 -1
  65. package/dist/dispatch/engines/config-engine.js +26 -1
  66. package/dist/dispatch/engines/config-engine.js.map +1 -1
  67. package/dist/dispatch/engines/session-engine.d.ts.map +1 -1
  68. package/dist/dispatch/engines/session-engine.js +9 -5
  69. package/dist/dispatch/engines/session-engine.js.map +1 -1
  70. package/dist/dispatch/engines/system-engine.d.ts +6 -1
  71. package/dist/dispatch/engines/system-engine.d.ts.map +1 -1
  72. package/dist/dispatch/engines/system-engine.js +14 -1
  73. package/dist/dispatch/engines/system-engine.js.map +1 -1
  74. package/dist/dispatch/engines/task-engine.d.ts +19 -1
  75. package/dist/dispatch/engines/task-engine.d.ts.map +1 -1
  76. package/dist/dispatch/engines/task-engine.js +31 -2
  77. package/dist/dispatch/engines/task-engine.js.map +1 -1
  78. package/dist/dispatch/lib/engine.d.ts +3 -3
  79. package/dist/dispatch/lib/engine.d.ts.map +1 -1
  80. package/dist/dispatch/lib/engine.js +3 -3
  81. package/dist/dispatch/lib/engine.js.map +1 -1
  82. package/dist/dispatch/registry.d.ts.map +1 -1
  83. package/dist/dispatch/registry.js +81 -0
  84. package/dist/dispatch/registry.js.map +1 -1
  85. package/dist/mcp/index.js +37 -4
  86. package/dist/mcp/index.js.map +3 -3
  87. package/package.json +3 -3
package/dist/cli/index.js CHANGED
@@ -10670,6 +10670,25 @@ function runBrainMigrations(nativeDb, db) {
10670
10670
  );
10671
10671
  }
10672
10672
  }
10673
+ if (tableExists(nativeDb, "__drizzle_migrations") && tableExists(nativeDb, "brain_decisions")) {
10674
+ const localMigrations = readMigrationFiles({ migrationsFolder });
10675
+ const localHashes = new Set(localMigrations.map((m) => m.hash));
10676
+ const dbEntries = nativeDb.prepare('SELECT hash FROM "__drizzle_migrations"').all();
10677
+ const hasOrphanedEntries = dbEntries.some((e) => !localHashes.has(e.hash));
10678
+ if (hasOrphanedEntries) {
10679
+ const log11 = getLogger("brain");
10680
+ log11.warn(
10681
+ { orphaned: dbEntries.filter((e) => !localHashes.has(e.hash)).length },
10682
+ "Detected stale migration journal entries from a previous CLEO version. Reconciling brain.db."
10683
+ );
10684
+ nativeDb.exec('DELETE FROM "__drizzle_migrations"');
10685
+ for (const m of localMigrations) {
10686
+ nativeDb.exec(
10687
+ `INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES ('${m.hash}', ${m.folderMillis})`
10688
+ );
10689
+ }
10690
+ }
10691
+ }
10673
10692
  const MAX_RETRIES = 5;
10674
10693
  const BASE_DELAY_MS = 100;
10675
10694
  const MAX_DELAY_MS = 2e3;
@@ -10777,6 +10796,7 @@ var init_brain_sqlite = __esm({
10777
10796
  init_migrator();
10778
10797
  init_node_sqlite();
10779
10798
  init_migrator2();
10799
+ init_logger();
10780
10800
  init_paths();
10781
10801
  init_brain_schema();
10782
10802
  init_sqlite2();
@@ -15391,6 +15411,9 @@ function createPage(input) {
15391
15411
  };
15392
15412
  }
15393
15413
  function paginate(items, limit, offset) {
15414
+ if (!items || items.length === 0) {
15415
+ return { items: [], page: { mode: "none" } };
15416
+ }
15394
15417
  const total = items.length;
15395
15418
  if (limit === void 0 && offset === void 0) {
15396
15419
  return { items, page: { mode: "none" } };
@@ -80484,7 +80507,7 @@ var init_hooks_engine = __esm({
80484
80507
  // packages/cleo/src/cli/index.ts
80485
80508
  import { readFileSync as readFileSync98 } from "node:fs";
80486
80509
  import { dirname as dirname24, join as join119 } from "node:path";
80487
- import { fileURLToPath as fileURLToPath6 } from "node:url";
80510
+ import { fileURLToPath as fileURLToPath5 } from "node:url";
80488
80511
 
80489
80512
  // node_modules/.pnpm/citty@0.2.1/node_modules/citty/dist/_chunks/libs/scule.mjs
80490
80513
  var NUMBER_CHAR_RE = /\d/;
@@ -86561,14 +86584,19 @@ async function taskCreate(projectRoot, params) {
86561
86584
  size: params.size,
86562
86585
  acceptance: params.acceptance,
86563
86586
  notes: params.notes,
86564
- files: params.files
86587
+ files: params.files,
86588
+ dryRun: params.dryRun
86565
86589
  },
86566
86590
  projectRoot,
86567
86591
  accessor
86568
86592
  );
86569
86593
  return {
86570
86594
  success: true,
86571
- data: { task: taskToRecord(result.task), duplicate: result.duplicate ?? false }
86595
+ data: {
86596
+ task: taskToRecord(result.task),
86597
+ duplicate: result.duplicate ?? false,
86598
+ dryRun: params.dryRun
86599
+ }
86572
86600
  };
86573
86601
  } catch (err) {
86574
86602
  const cleoErr = err;
@@ -87855,8 +87883,12 @@ var AdminHandler = class {
87855
87883
  }
87856
87884
  case "backup": {
87857
87885
  const result = systemListBackups(projectRoot);
87886
+ if (!result.success || !result.data) {
87887
+ return wrapResult(result, "query", "admin", operation, startTime);
87888
+ }
87889
+ const backups = result.data;
87858
87890
  return wrapResult(
87859
- { success: true, data: { backups: result, count: result.length } },
87891
+ { success: true, data: { backups, count: backups.length } },
87860
87892
  "query",
87861
87893
  "admin",
87862
87894
  operation,
@@ -91805,7 +91837,8 @@ var TasksHandler = class {
91805
91837
  phase: params?.phase,
91806
91838
  size: params?.size,
91807
91839
  notes: params?.notes,
91808
- files: params?.files
91840
+ files: params?.files,
91841
+ dryRun: params?.dryRun
91809
91842
  });
91810
91843
  return wrapResult(result, "mutate", "tasks", operation, startTime);
91811
91844
  }
@@ -94555,10 +94588,8 @@ init_src();
94555
94588
  init_renderers();
94556
94589
  import { existsSync as existsSync121, readdirSync as readdirSync39, readFileSync as readFileSync95 } from "node:fs";
94557
94590
  import { dirname as dirname22, join as join114 } from "node:path";
94558
- import { fileURLToPath as fileURLToPath5 } from "node:url";
94559
94591
  function findProjectRoot() {
94560
- const currentFile = fileURLToPath5(import.meta.url);
94561
- let currentDir = dirname22(currentFile);
94592
+ let currentDir = process.cwd();
94562
94593
  while (currentDir !== "/") {
94563
94594
  if (existsSync121(join114(currentDir, "package.json"))) {
94564
94595
  return currentDir;
@@ -97930,6 +97961,20 @@ function registerSessionCommand(program) {
97930
97961
  { command: "session", operation: "session.resume" }
97931
97962
  );
97932
97963
  });
97964
+ session.command("find").description("Find sessions (lightweight discovery \u2014 minimal fields, low context cost)").option("--status <status>", "Filter by status (active|ended|orphaned)").option("--scope <scope>", 'Filter by scope (e.g. "epic:T001" or "global")').option("--query <query>", "Fuzzy match on session name or ID").option("--limit <n>", "Max results", parseInt).action(async (opts) => {
97965
+ await dispatchFromCli(
97966
+ "query",
97967
+ "session",
97968
+ "find",
97969
+ {
97970
+ status: opts["status"],
97971
+ scope: opts["scope"],
97972
+ query: opts["query"],
97973
+ limit: opts["limit"]
97974
+ },
97975
+ { command: "session", operation: "session.find" }
97976
+ );
97977
+ });
97933
97978
  session.command("list").description("List sessions").option("--status <status>", "Filter by status (active|ended|orphaned)").option("--limit <n>", "Max results", parseInt).option("--offset <n>", "Skip first n results", parseInt).action(async (opts) => {
97934
97979
  await dispatchFromCli(
97935
97980
  "query",
@@ -98946,7 +98991,7 @@ function registerWebCommand(program) {
98946
98991
 
98947
98992
  // packages/cleo/src/cli/index.ts
98948
98993
  function getPackageVersion() {
98949
- const pkgPath = join119(dirname24(fileURLToPath6(import.meta.url)), "../../package.json");
98994
+ const pkgPath = join119(dirname24(fileURLToPath5(import.meta.url)), "../../package.json");
98950
98995
  const pkg = JSON.parse(readFileSync98(pkgPath, "utf-8"));
98951
98996
  return pkg.version;
98952
98997
  }
@@ -99072,41 +99117,49 @@ function shimToCitty(shim) {
99072
99117
  subCommands2[alias] = shimToCitty(sub);
99073
99118
  }
99074
99119
  }
99120
+ const hasSubCommands = Object.keys(subCommands2).length > 0;
99121
+ const subCommandNames = new Set(
99122
+ shim._subcommands.flatMap((s) => [s._name, ...s._aliases].filter(Boolean))
99123
+ );
99124
+ const runFn = async (context) => {
99125
+ const { args } = context;
99126
+ if (hasSubCommands && context.rawArgs.some((a) => subCommandNames.has(a))) {
99127
+ return;
99128
+ }
99129
+ if (shim._action) {
99130
+ const positionalValues = [];
99131
+ for (const arg of shim._args) {
99132
+ positionalValues.push(args[arg.name]);
99133
+ }
99134
+ const opts = {};
99135
+ for (const opt of shim._options) {
99136
+ const val = args[opt.longName];
99137
+ if (val !== void 0 && val !== false) {
99138
+ if (opt.parseFn && typeof val === "string") {
99139
+ opts[opt.longName] = opt.parseFn(val);
99140
+ } else {
99141
+ opts[opt.longName] = val;
99142
+ }
99143
+ }
99144
+ }
99145
+ await shim._action(...positionalValues, opts, shim);
99146
+ } else if (shim._subcommands.length > 0) {
99147
+ const defaultSub = shim._subcommands.find((s) => s._isDefault);
99148
+ if (defaultSub?._action) {
99149
+ await defaultSub._action({}, defaultSub);
99150
+ } else {
99151
+ await showUsage(context.cmd);
99152
+ }
99153
+ }
99154
+ };
99075
99155
  const cittyDef = defineCommand({
99076
99156
  meta: {
99077
99157
  name: shim._name,
99078
99158
  description: shim._description
99079
99159
  },
99080
99160
  args: cittyArgs,
99081
- ...Object.keys(subCommands2).length > 0 ? { subCommands: subCommands2 } : {},
99082
- async run(context) {
99083
- const { args } = context;
99084
- if (shim._action) {
99085
- const positionalValues = [];
99086
- for (const arg of shim._args) {
99087
- positionalValues.push(args[arg.name]);
99088
- }
99089
- const opts = {};
99090
- for (const opt of shim._options) {
99091
- const val = args[opt.longName];
99092
- if (val !== void 0 && val !== false) {
99093
- if (opt.parseFn && typeof val === "string") {
99094
- opts[opt.longName] = opt.parseFn(val);
99095
- } else {
99096
- opts[opt.longName] = val;
99097
- }
99098
- }
99099
- }
99100
- await shim._action(...positionalValues, opts, shim);
99101
- } else if (shim._subcommands.length > 0) {
99102
- const defaultSub = shim._subcommands.find((s) => s._isDefault);
99103
- if (defaultSub?._action) {
99104
- await defaultSub._action({}, defaultSub);
99105
- } else {
99106
- await showUsage(context.cmd);
99107
- }
99108
- }
99109
- }
99161
+ ...hasSubCommands ? { subCommands: subCommands2 } : {},
99162
+ run: runFn
99110
99163
  });
99111
99164
  return cittyDef;
99112
99165
  }