@cleocode/cleo 2026.3.62 → 2026.3.63
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 +80 -32
- package/dist/cli/index.js.map +3 -3
- package/dist/mcp/index.js +29 -3
- package/dist/mcp/index.js.map +3 -3
- 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();
|
|
@@ -86561,14 +86581,19 @@ async function taskCreate(projectRoot, params) {
|
|
|
86561
86581
|
size: params.size,
|
|
86562
86582
|
acceptance: params.acceptance,
|
|
86563
86583
|
notes: params.notes,
|
|
86564
|
-
files: params.files
|
|
86584
|
+
files: params.files,
|
|
86585
|
+
dryRun: params.dryRun
|
|
86565
86586
|
},
|
|
86566
86587
|
projectRoot,
|
|
86567
86588
|
accessor
|
|
86568
86589
|
);
|
|
86569
86590
|
return {
|
|
86570
86591
|
success: true,
|
|
86571
|
-
data: {
|
|
86592
|
+
data: {
|
|
86593
|
+
task: taskToRecord(result.task),
|
|
86594
|
+
duplicate: result.duplicate ?? false,
|
|
86595
|
+
dryRun: params.dryRun
|
|
86596
|
+
}
|
|
86572
86597
|
};
|
|
86573
86598
|
} catch (err) {
|
|
86574
86599
|
const cleoErr = err;
|
|
@@ -91805,7 +91830,8 @@ var TasksHandler = class {
|
|
|
91805
91830
|
phase: params?.phase,
|
|
91806
91831
|
size: params?.size,
|
|
91807
91832
|
notes: params?.notes,
|
|
91808
|
-
files: params?.files
|
|
91833
|
+
files: params?.files,
|
|
91834
|
+
dryRun: params?.dryRun
|
|
91809
91835
|
});
|
|
91810
91836
|
return wrapResult(result, "mutate", "tasks", operation, startTime);
|
|
91811
91837
|
}
|
|
@@ -97930,6 +97956,20 @@ function registerSessionCommand(program) {
|
|
|
97930
97956
|
{ command: "session", operation: "session.resume" }
|
|
97931
97957
|
);
|
|
97932
97958
|
});
|
|
97959
|
+
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) => {
|
|
97960
|
+
await dispatchFromCli(
|
|
97961
|
+
"query",
|
|
97962
|
+
"session",
|
|
97963
|
+
"find",
|
|
97964
|
+
{
|
|
97965
|
+
status: opts["status"],
|
|
97966
|
+
scope: opts["scope"],
|
|
97967
|
+
query: opts["query"],
|
|
97968
|
+
limit: opts["limit"]
|
|
97969
|
+
},
|
|
97970
|
+
{ command: "session", operation: "session.find" }
|
|
97971
|
+
);
|
|
97972
|
+
});
|
|
97933
97973
|
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
97974
|
await dispatchFromCli(
|
|
97935
97975
|
"query",
|
|
@@ -99072,41 +99112,49 @@ function shimToCitty(shim) {
|
|
|
99072
99112
|
subCommands2[alias] = shimToCitty(sub);
|
|
99073
99113
|
}
|
|
99074
99114
|
}
|
|
99115
|
+
const hasSubCommands = Object.keys(subCommands2).length > 0;
|
|
99116
|
+
const subCommandNames = new Set(
|
|
99117
|
+
shim._subcommands.flatMap((s) => [s._name, ...s._aliases].filter(Boolean))
|
|
99118
|
+
);
|
|
99119
|
+
const runFn = async (context) => {
|
|
99120
|
+
const { args } = context;
|
|
99121
|
+
if (hasSubCommands && context.rawArgs.some((a) => subCommandNames.has(a))) {
|
|
99122
|
+
return;
|
|
99123
|
+
}
|
|
99124
|
+
if (shim._action) {
|
|
99125
|
+
const positionalValues = [];
|
|
99126
|
+
for (const arg of shim._args) {
|
|
99127
|
+
positionalValues.push(args[arg.name]);
|
|
99128
|
+
}
|
|
99129
|
+
const opts = {};
|
|
99130
|
+
for (const opt of shim._options) {
|
|
99131
|
+
const val = args[opt.longName];
|
|
99132
|
+
if (val !== void 0 && val !== false) {
|
|
99133
|
+
if (opt.parseFn && typeof val === "string") {
|
|
99134
|
+
opts[opt.longName] = opt.parseFn(val);
|
|
99135
|
+
} else {
|
|
99136
|
+
opts[opt.longName] = val;
|
|
99137
|
+
}
|
|
99138
|
+
}
|
|
99139
|
+
}
|
|
99140
|
+
await shim._action(...positionalValues, opts, shim);
|
|
99141
|
+
} else if (shim._subcommands.length > 0) {
|
|
99142
|
+
const defaultSub = shim._subcommands.find((s) => s._isDefault);
|
|
99143
|
+
if (defaultSub?._action) {
|
|
99144
|
+
await defaultSub._action({}, defaultSub);
|
|
99145
|
+
} else {
|
|
99146
|
+
await showUsage(context.cmd);
|
|
99147
|
+
}
|
|
99148
|
+
}
|
|
99149
|
+
};
|
|
99075
99150
|
const cittyDef = defineCommand({
|
|
99076
99151
|
meta: {
|
|
99077
99152
|
name: shim._name,
|
|
99078
99153
|
description: shim._description
|
|
99079
99154
|
},
|
|
99080
99155
|
args: cittyArgs,
|
|
99081
|
-
...
|
|
99082
|
-
|
|
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
|
-
}
|
|
99156
|
+
...hasSubCommands ? { subCommands: subCommands2 } : {},
|
|
99157
|
+
run: runFn
|
|
99110
99158
|
});
|
|
99111
99159
|
return cittyDef;
|
|
99112
99160
|
}
|