@cleocode/cleo 2026.3.61 → 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 +309 -90
- package/dist/cli/index.js.map +3 -3
- package/dist/mcp/index.js +219 -39
- package/dist/mcp/index.js.map +3 -3
- package/package.json +3 -3
package/dist/mcp/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();
|
|
@@ -13259,7 +13279,7 @@ async function showSequence(cwd) {
|
|
|
13259
13279
|
counter: seq.counter,
|
|
13260
13280
|
lastId: seq.lastId,
|
|
13261
13281
|
checksum: seq.checksum,
|
|
13262
|
-
nextId: `T${seq.counter + 1}`
|
|
13282
|
+
nextId: `T${String(seq.counter + 1).padStart(3, "0")}`
|
|
13263
13283
|
};
|
|
13264
13284
|
}
|
|
13265
13285
|
async function loadAllTasks(cwd, accessor) {
|
|
@@ -41812,6 +41832,58 @@ async function addTask(options, cwd, accessor) {
|
|
|
41812
41832
|
if (duplicate) {
|
|
41813
41833
|
return { task: duplicate, duplicate: true };
|
|
41814
41834
|
}
|
|
41835
|
+
if (options.dryRun) {
|
|
41836
|
+
const previewNow = (/* @__PURE__ */ new Date()).toISOString();
|
|
41837
|
+
let previewParentForStage = null;
|
|
41838
|
+
if (parentId) {
|
|
41839
|
+
const previewParentTask = await dataAccessor.loadSingleTask(parentId);
|
|
41840
|
+
previewParentForStage = previewParentTask ? { pipelineStage: previewParentTask.pipelineStage, type: previewParentTask.type } : null;
|
|
41841
|
+
}
|
|
41842
|
+
const previewPipelineStage = resolveDefaultPipelineStage({
|
|
41843
|
+
explicitStage: options.pipelineStage,
|
|
41844
|
+
taskType: taskType ?? null,
|
|
41845
|
+
parentTask: previewParentForStage
|
|
41846
|
+
});
|
|
41847
|
+
const previewPosition = options.position !== void 0 ? options.position : await dataAccessor.getNextPosition(parentId);
|
|
41848
|
+
const previewTask = {
|
|
41849
|
+
id: "T???",
|
|
41850
|
+
title: options.title,
|
|
41851
|
+
description: options.description,
|
|
41852
|
+
status,
|
|
41853
|
+
priority,
|
|
41854
|
+
type: taskType,
|
|
41855
|
+
parentId: parentId || null,
|
|
41856
|
+
position: previewPosition,
|
|
41857
|
+
positionVersion: 0,
|
|
41858
|
+
size,
|
|
41859
|
+
pipelineStage: previewPipelineStage,
|
|
41860
|
+
createdAt: previewNow,
|
|
41861
|
+
updatedAt: previewNow
|
|
41862
|
+
};
|
|
41863
|
+
if (phase) previewTask.phase = phase;
|
|
41864
|
+
if (options.labels?.length) previewTask.labels = options.labels.map((l) => l.trim());
|
|
41865
|
+
if (options.files?.length) previewTask.files = options.files.map((f) => f.trim());
|
|
41866
|
+
if (options.acceptance?.length)
|
|
41867
|
+
previewTask.acceptance = options.acceptance.map((a) => a.trim());
|
|
41868
|
+
if (options.depends?.length) previewTask.depends = options.depends.map((d) => d.trim());
|
|
41869
|
+
if (options.notes) {
|
|
41870
|
+
const previewNote = `${(/* @__PURE__ */ new Date()).toISOString().replace("T", " ").replace(/\.\d+Z$/, " UTC")}: ${options.notes}`;
|
|
41871
|
+
previewTask.notes = [previewNote];
|
|
41872
|
+
}
|
|
41873
|
+
if (status === "blocked" && options.description) {
|
|
41874
|
+
previewTask.blockedBy = options.description;
|
|
41875
|
+
}
|
|
41876
|
+
if (status === "done") {
|
|
41877
|
+
previewTask.completedAt = previewNow;
|
|
41878
|
+
}
|
|
41879
|
+
if (taskType !== "epic") {
|
|
41880
|
+
const verificationEnabledRaw = await getRawConfigValue("verification.enabled", cwd);
|
|
41881
|
+
if (verificationEnabledRaw === true) {
|
|
41882
|
+
previewTask.verification = buildDefaultVerification(previewNow);
|
|
41883
|
+
}
|
|
41884
|
+
}
|
|
41885
|
+
return { task: previewTask, dryRun: true };
|
|
41886
|
+
}
|
|
41815
41887
|
const taskId = await allocateNextTaskId(cwd);
|
|
41816
41888
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
41817
41889
|
let resolvedParentForStage = null;
|
|
@@ -41881,9 +41953,6 @@ async function addTask(options, cwd, accessor) {
|
|
|
41881
41953
|
task.verification = buildDefaultVerification(now2);
|
|
41882
41954
|
}
|
|
41883
41955
|
}
|
|
41884
|
-
if (options.dryRun) {
|
|
41885
|
-
return { task, dryRun: true };
|
|
41886
|
-
}
|
|
41887
41956
|
await dataAccessor.transaction(async (tx) => {
|
|
41888
41957
|
if (options.position !== void 0) {
|
|
41889
41958
|
await dataAccessor.shiftPositions(parentId, options.position, 1);
|
|
@@ -47795,8 +47864,9 @@ var init_observability = __esm({
|
|
|
47795
47864
|
});
|
|
47796
47865
|
|
|
47797
47866
|
// packages/core/src/phases/deps.ts
|
|
47798
|
-
async function loadAllTasks3(
|
|
47799
|
-
const
|
|
47867
|
+
async function loadAllTasks3(cwd, accessor) {
|
|
47868
|
+
const acc = accessor ?? await getAccessor(cwd);
|
|
47869
|
+
const { tasks: tasks2 } = await acc.queryTasks({});
|
|
47800
47870
|
return tasks2;
|
|
47801
47871
|
}
|
|
47802
47872
|
function buildGraph(tasks2) {
|
|
@@ -47872,11 +47942,45 @@ async function getExecutionWaves(epicId, cwd, accessor) {
|
|
|
47872
47942
|
}
|
|
47873
47943
|
return waves;
|
|
47874
47944
|
}
|
|
47945
|
+
async function getCriticalPath2(taskId, cwd, accessor) {
|
|
47946
|
+
const allTasks = await loadAllTasks3(cwd, accessor);
|
|
47947
|
+
const task = allTasks.find((t) => t.id === taskId);
|
|
47948
|
+
if (!task) {
|
|
47949
|
+
throw new CleoError(4 /* NOT_FOUND */, `Task not found: ${taskId}`);
|
|
47950
|
+
}
|
|
47951
|
+
const graph = buildGraph(allTasks);
|
|
47952
|
+
const taskMap = new Map(allTasks.map((t) => [t.id, t]));
|
|
47953
|
+
function findLongestPath(id, visited) {
|
|
47954
|
+
if (visited.has(id)) return [];
|
|
47955
|
+
visited.add(id);
|
|
47956
|
+
const node = graph.get(id);
|
|
47957
|
+
if (!node || node.dependents.length === 0) {
|
|
47958
|
+
return [id];
|
|
47959
|
+
}
|
|
47960
|
+
let longest = [];
|
|
47961
|
+
for (const depId of node.dependents) {
|
|
47962
|
+
const path3 = findLongestPath(depId, new Set(visited));
|
|
47963
|
+
if (path3.length > longest.length) {
|
|
47964
|
+
longest = path3;
|
|
47965
|
+
}
|
|
47966
|
+
}
|
|
47967
|
+
return [id, ...longest];
|
|
47968
|
+
}
|
|
47969
|
+
const path2 = findLongestPath(taskId, /* @__PURE__ */ new Set());
|
|
47970
|
+
return {
|
|
47971
|
+
path: path2.map((id) => {
|
|
47972
|
+
const t = taskMap.get(id);
|
|
47973
|
+
return t ? { id: t.id, title: t.title, status: t.status } : { id, title: "Unknown", status: "unknown" };
|
|
47974
|
+
}),
|
|
47975
|
+
length: path2.length
|
|
47976
|
+
};
|
|
47977
|
+
}
|
|
47875
47978
|
var init_deps2 = __esm({
|
|
47876
47979
|
"packages/core/src/phases/deps.ts"() {
|
|
47877
47980
|
"use strict";
|
|
47878
47981
|
init_src();
|
|
47879
47982
|
init_errors3();
|
|
47983
|
+
init_data_accessor();
|
|
47880
47984
|
}
|
|
47881
47985
|
});
|
|
47882
47986
|
|
|
@@ -52678,6 +52782,13 @@ var init_capability_matrix = __esm({
|
|
|
52678
52782
|
mode: "native",
|
|
52679
52783
|
preferredChannel: "either"
|
|
52680
52784
|
},
|
|
52785
|
+
{
|
|
52786
|
+
domain: "admin",
|
|
52787
|
+
operation: "backup",
|
|
52788
|
+
gateway: "query",
|
|
52789
|
+
mode: "native",
|
|
52790
|
+
preferredChannel: "either"
|
|
52791
|
+
},
|
|
52681
52792
|
{
|
|
52682
52793
|
domain: "admin",
|
|
52683
52794
|
operation: "backup",
|
|
@@ -57927,7 +58038,7 @@ async function getProjectStats(opts, accessor) {
|
|
|
57927
58038
|
dbAnd(dbEq(tasksTable.status, "archived"), dbEq(tasksTable.archiveReason, "completed"))
|
|
57928
58039
|
).get();
|
|
57929
58040
|
archivedCompleted = archivedDoneRow?.c ?? 0;
|
|
57930
|
-
totalCompleted = (
|
|
58041
|
+
totalCompleted = entries.filter(isComplete).length;
|
|
57931
58042
|
} catch {
|
|
57932
58043
|
totalCreated = entries.filter(isCreate).length;
|
|
57933
58044
|
totalCompleted = entries.filter(isComplete).length;
|
|
@@ -58933,7 +59044,7 @@ var init_audit2 = __esm({
|
|
|
58933
59044
|
});
|
|
58934
59045
|
|
|
58935
59046
|
// packages/core/src/system/backup.ts
|
|
58936
|
-
import { existsSync as existsSync82, mkdirSync as mkdirSync18, readFileSync as readFileSync59, writeFileSync as writeFileSync11 } from "node:fs";
|
|
59047
|
+
import { existsSync as existsSync82, mkdirSync as mkdirSync18, readdirSync as readdirSync27, readFileSync as readFileSync59, writeFileSync as writeFileSync11 } from "node:fs";
|
|
58937
59048
|
import { join as join84 } from "node:path";
|
|
58938
59049
|
function createBackup2(projectRoot, opts) {
|
|
58939
59050
|
const cleoDir = join84(projectRoot, ".cleo");
|
|
@@ -58979,6 +59090,36 @@ function createBackup2(projectRoot, opts) {
|
|
|
58979
59090
|
}
|
|
58980
59091
|
return { backupId, path: backupDir, timestamp: timestamp2, type: btype, files: backedUp };
|
|
58981
59092
|
}
|
|
59093
|
+
function listSystemBackups(projectRoot) {
|
|
59094
|
+
const cleoDir = join84(projectRoot, ".cleo");
|
|
59095
|
+
const backupTypes = ["snapshot", "safety", "migration"];
|
|
59096
|
+
const entries = [];
|
|
59097
|
+
for (const btype of backupTypes) {
|
|
59098
|
+
const backupDir = join84(cleoDir, "backups", btype);
|
|
59099
|
+
if (!existsSync82(backupDir)) continue;
|
|
59100
|
+
try {
|
|
59101
|
+
const files = readdirSync27(backupDir).filter((f) => f.endsWith(".meta.json"));
|
|
59102
|
+
for (const metaFile of files) {
|
|
59103
|
+
try {
|
|
59104
|
+
const raw = readFileSync59(join84(backupDir, metaFile), "utf-8");
|
|
59105
|
+
const meta = JSON.parse(raw);
|
|
59106
|
+
if (meta.backupId && meta.timestamp) {
|
|
59107
|
+
entries.push({
|
|
59108
|
+
backupId: meta.backupId,
|
|
59109
|
+
type: meta.type ?? btype,
|
|
59110
|
+
timestamp: meta.timestamp,
|
|
59111
|
+
note: meta.note,
|
|
59112
|
+
files: meta.files ?? []
|
|
59113
|
+
});
|
|
59114
|
+
}
|
|
59115
|
+
} catch {
|
|
59116
|
+
}
|
|
59117
|
+
}
|
|
59118
|
+
} catch {
|
|
59119
|
+
}
|
|
59120
|
+
}
|
|
59121
|
+
return entries.sort((a, b) => b.timestamp.localeCompare(a.timestamp));
|
|
59122
|
+
}
|
|
58982
59123
|
function restoreBackup(projectRoot, params) {
|
|
58983
59124
|
if (!params.backupId) {
|
|
58984
59125
|
throw new CleoError(2 /* INVALID_INPUT */, "backupId is required");
|
|
@@ -59103,7 +59244,7 @@ var init_audit_prune = __esm({
|
|
|
59103
59244
|
});
|
|
59104
59245
|
|
|
59105
59246
|
// packages/core/src/system/cleanup.ts
|
|
59106
|
-
import { existsSync as existsSync83, readdirSync as
|
|
59247
|
+
import { existsSync as existsSync83, readdirSync as readdirSync28, readFileSync as readFileSync60, unlinkSync as unlinkSync5, writeFileSync as writeFileSync12 } from "node:fs";
|
|
59107
59248
|
import { join as join86 } from "node:path";
|
|
59108
59249
|
async function cleanupSystem(projectRoot, params) {
|
|
59109
59250
|
if (!params.target) {
|
|
@@ -59151,10 +59292,10 @@ async function cleanupSystem(projectRoot, params) {
|
|
|
59151
59292
|
case "backups": {
|
|
59152
59293
|
const backupBaseDir = join86(cleoDir, "backups");
|
|
59153
59294
|
if (existsSync83(backupBaseDir)) {
|
|
59154
|
-
for (const typeDir of
|
|
59295
|
+
for (const typeDir of readdirSync28(backupBaseDir)) {
|
|
59155
59296
|
const fullDir = join86(backupBaseDir, typeDir);
|
|
59156
59297
|
try {
|
|
59157
|
-
for (const file2 of
|
|
59298
|
+
for (const file2 of readdirSync28(fullDir)) {
|
|
59158
59299
|
if (file2.endsWith(".meta.json")) {
|
|
59159
59300
|
const metaFilePath = join86(fullDir, file2);
|
|
59160
59301
|
try {
|
|
@@ -59163,7 +59304,7 @@ async function cleanupSystem(projectRoot, params) {
|
|
|
59163
59304
|
items.push(file2.replace(".meta.json", ""));
|
|
59164
59305
|
if (!dryRun) {
|
|
59165
59306
|
unlinkSync5(metaFilePath);
|
|
59166
|
-
for (const bf of
|
|
59307
|
+
for (const bf of readdirSync28(fullDir)) {
|
|
59167
59308
|
if (bf.includes(meta.backupId)) {
|
|
59168
59309
|
try {
|
|
59169
59310
|
unlinkSync5(join86(fullDir, bf));
|
|
@@ -59193,7 +59334,7 @@ async function cleanupSystem(projectRoot, params) {
|
|
|
59193
59334
|
}
|
|
59194
59335
|
const auditPattern = /^audit-log-.*\.json$/;
|
|
59195
59336
|
if (existsSync83(cleoDir)) {
|
|
59196
|
-
for (const file2 of
|
|
59337
|
+
for (const file2 of readdirSync28(cleoDir)) {
|
|
59197
59338
|
if (auditPattern.test(file2)) {
|
|
59198
59339
|
items.push(file2);
|
|
59199
59340
|
if (!dryRun) {
|
|
@@ -59353,7 +59494,7 @@ import { randomBytes as randomBytes12 } from "node:crypto";
|
|
|
59353
59494
|
import {
|
|
59354
59495
|
existsSync as existsSync85,
|
|
59355
59496
|
mkdirSync as mkdirSync20,
|
|
59356
|
-
readdirSync as
|
|
59497
|
+
readdirSync as readdirSync29,
|
|
59357
59498
|
readFileSync as readFileSync61,
|
|
59358
59499
|
renameSync as renameSync6,
|
|
59359
59500
|
unlinkSync as unlinkSync6,
|
|
@@ -62392,7 +62533,7 @@ var init_tasks2 = __esm({
|
|
|
62392
62533
|
});
|
|
62393
62534
|
|
|
62394
62535
|
// packages/core/src/templates/parser.ts
|
|
62395
|
-
import { existsSync as existsSync93, readdirSync as
|
|
62536
|
+
import { existsSync as existsSync93, readdirSync as readdirSync30, readFileSync as readFileSync67 } from "fs";
|
|
62396
62537
|
import { join as join96 } from "path";
|
|
62397
62538
|
import { parse as parseYaml } from "yaml";
|
|
62398
62539
|
function deriveSubcommand(filename) {
|
|
@@ -62466,7 +62607,7 @@ function parseIssueTemplates2(projectRoot) {
|
|
|
62466
62607
|
}
|
|
62467
62608
|
let files;
|
|
62468
62609
|
try {
|
|
62469
|
-
files =
|
|
62610
|
+
files = readdirSync30(templateDir).filter((f) => /\.ya?ml$/i.test(f) && f !== "config.yml");
|
|
62470
62611
|
} catch (error40) {
|
|
62471
62612
|
return {
|
|
62472
62613
|
success: false,
|
|
@@ -62879,7 +63020,7 @@ var init_changelog = __esm({
|
|
|
62879
63020
|
});
|
|
62880
63021
|
|
|
62881
63022
|
// packages/core/src/ui/command-registry.ts
|
|
62882
|
-
import { existsSync as existsSync96, readdirSync as
|
|
63023
|
+
import { existsSync as existsSync96, readdirSync as readdirSync31, readFileSync as readFileSync70 } from "node:fs";
|
|
62883
63024
|
import { basename as basename16, join as join98 } from "node:path";
|
|
62884
63025
|
function parseCommandHeader(scriptPath) {
|
|
62885
63026
|
if (!existsSync96(scriptPath)) return null;
|
|
@@ -62962,7 +63103,7 @@ function parseCommandHeader(scriptPath) {
|
|
|
62962
63103
|
function scanAllCommands(scriptsDir) {
|
|
62963
63104
|
const registry2 = /* @__PURE__ */ new Map();
|
|
62964
63105
|
if (!existsSync96(scriptsDir)) return registry2;
|
|
62965
|
-
for (const file2 of
|
|
63106
|
+
for (const file2 of readdirSync31(scriptsDir)) {
|
|
62966
63107
|
if (!file2.endsWith(".sh") && !file2.endsWith(".ts")) continue;
|
|
62967
63108
|
const meta = parseCommandHeader(join98(scriptsDir, file2));
|
|
62968
63109
|
if (meta) {
|
|
@@ -63890,12 +64031,12 @@ var init_compliance2 = __esm({
|
|
|
63890
64031
|
});
|
|
63891
64032
|
|
|
63892
64033
|
// packages/core/src/validation/docs-sync.ts
|
|
63893
|
-
import { existsSync as existsSync97, readdirSync as
|
|
64034
|
+
import { existsSync as existsSync97, readdirSync as readdirSync32, readFileSync as readFileSync71 } from "node:fs";
|
|
63894
64035
|
import { join as join99 } from "node:path";
|
|
63895
64036
|
function getScriptCommands(scriptsDir) {
|
|
63896
64037
|
if (!existsSync97(scriptsDir)) return [];
|
|
63897
64038
|
try {
|
|
63898
|
-
return
|
|
64039
|
+
return readdirSync32(scriptsDir).filter((f) => f.endsWith(".sh")).map((f) => f.replace(/\.sh$/, "")).sort();
|
|
63899
64040
|
} catch {
|
|
63900
64041
|
return [];
|
|
63901
64042
|
}
|
|
@@ -65317,12 +65458,12 @@ var init_manifest = __esm({
|
|
|
65317
65458
|
});
|
|
65318
65459
|
|
|
65319
65460
|
// packages/core/src/validation/protocol-common.ts
|
|
65320
|
-
import { existsSync as existsSync100, readdirSync as
|
|
65461
|
+
import { existsSync as existsSync100, readdirSync as readdirSync33, readFileSync as readFileSync73 } from "node:fs";
|
|
65321
65462
|
function checkOutputFileExists(taskId, expectedDir, pattern) {
|
|
65322
65463
|
if (!existsSync100(expectedDir)) return false;
|
|
65323
65464
|
const filePattern = pattern ?? `${taskId}`;
|
|
65324
65465
|
try {
|
|
65325
|
-
const files =
|
|
65466
|
+
const files = readdirSync33(expectedDir);
|
|
65326
65467
|
return files.some((f) => f.includes(filePattern) && f.endsWith(".md"));
|
|
65327
65468
|
} catch {
|
|
65328
65469
|
return false;
|
|
@@ -66301,7 +66442,7 @@ __export(init_exports, {
|
|
|
66301
66442
|
isAutoInitEnabled: () => isAutoInitEnabled,
|
|
66302
66443
|
updateDocs: () => updateDocs
|
|
66303
66444
|
});
|
|
66304
|
-
import { existsSync as existsSync101, readdirSync as
|
|
66445
|
+
import { existsSync as existsSync101, readdirSync as readdirSync34, readFileSync as readFileSync74 } from "node:fs";
|
|
66305
66446
|
import { copyFile as copyFile3, lstat, mkdir as mkdir16, readFile as readFile17, symlink, unlink as unlink4, writeFile as writeFile11 } from "node:fs/promises";
|
|
66306
66447
|
import { platform as platform4 } from "node:os";
|
|
66307
66448
|
import { basename as basename17, dirname as dirname19, join as join101 } from "node:path";
|
|
@@ -66351,7 +66492,7 @@ async function initAgentDefinition(created, warnings) {
|
|
|
66351
66492
|
} catch (_err) {
|
|
66352
66493
|
try {
|
|
66353
66494
|
await mkdir16(globalAgentsDir, { recursive: true });
|
|
66354
|
-
const files =
|
|
66495
|
+
const files = readdirSync34(agentSourceDir);
|
|
66355
66496
|
for (const file2 of files) {
|
|
66356
66497
|
await copyFile3(join101(agentSourceDir, file2), join101(globalAgentsDir, file2));
|
|
66357
66498
|
}
|
|
@@ -66500,7 +66641,7 @@ async function installGitHubTemplates(projectRoot, created, skipped) {
|
|
|
66500
66641
|
await mkdir16(issueTemplateDir, { recursive: true });
|
|
66501
66642
|
const issueSrcDir = join101(templateSrcDir, "ISSUE_TEMPLATE");
|
|
66502
66643
|
if (existsSync101(issueSrcDir)) {
|
|
66503
|
-
const issueFiles =
|
|
66644
|
+
const issueFiles = readdirSync34(issueSrcDir);
|
|
66504
66645
|
for (const file2 of issueFiles) {
|
|
66505
66646
|
const dest = join101(issueTemplateDir, file2);
|
|
66506
66647
|
if (existsSync101(dest)) {
|
|
@@ -71306,7 +71447,7 @@ var init_model_provider_registry = __esm({
|
|
|
71306
71447
|
|
|
71307
71448
|
// packages/core/src/metrics/token-service.ts
|
|
71308
71449
|
import { createHash as createHash13, randomUUID as randomUUID8 } from "node:crypto";
|
|
71309
|
-
import { existsSync as existsSync107, readdirSync as
|
|
71450
|
+
import { existsSync as existsSync107, readdirSync as readdirSync35, readFileSync as readFileSync79 } from "node:fs";
|
|
71310
71451
|
import { join as join106 } from "node:path";
|
|
71311
71452
|
function normalizeProvider(provider, model, runtimeProvider) {
|
|
71312
71453
|
const value = (provider ?? "").trim().toLowerCase();
|
|
@@ -71391,7 +71532,7 @@ function getOtelDir2() {
|
|
|
71391
71532
|
function readOtelJsonl(dir) {
|
|
71392
71533
|
if (!existsSync107(dir)) return [];
|
|
71393
71534
|
const entries = [];
|
|
71394
|
-
for (const file2 of
|
|
71535
|
+
for (const file2 of readdirSync35(dir)) {
|
|
71395
71536
|
if (!file2.endsWith(".json") && !file2.endsWith(".jsonl")) continue;
|
|
71396
71537
|
const filePath = join106(dir, file2);
|
|
71397
71538
|
const raw = readFileSync79(filePath, "utf-8").trim();
|
|
@@ -71783,7 +71924,7 @@ var init_parallel = __esm({
|
|
|
71783
71924
|
});
|
|
71784
71925
|
|
|
71785
71926
|
// packages/core/src/orchestration/skill-ops.ts
|
|
71786
|
-
import { existsSync as existsSync108, readdirSync as
|
|
71927
|
+
import { existsSync as existsSync108, readdirSync as readdirSync36, readFileSync as readFileSync80 } from "node:fs";
|
|
71787
71928
|
import { join as join107 } from "node:path";
|
|
71788
71929
|
import { getCanonicalSkillsDir as getCanonicalSkillsDir3 } from "@cleocode/caamp";
|
|
71789
71930
|
function getSkillContent(skillName, projectRoot) {
|
|
@@ -71808,7 +71949,7 @@ function getSkillContent(skillName, projectRoot) {
|
|
|
71808
71949
|
let references = [];
|
|
71809
71950
|
if (existsSync108(refsDir)) {
|
|
71810
71951
|
try {
|
|
71811
|
-
references =
|
|
71952
|
+
references = readdirSync36(refsDir).filter((f) => f.endsWith(".md") || f.endsWith(".txt")).map((f) => ({
|
|
71812
71953
|
name: f,
|
|
71813
71954
|
path: join107(skillDir, "references", f)
|
|
71814
71955
|
}));
|
|
@@ -74522,7 +74663,7 @@ import {
|
|
|
74522
74663
|
copyFileSync as copyFileSync7,
|
|
74523
74664
|
existsSync as existsSync111,
|
|
74524
74665
|
mkdirSync as mkdirSync23,
|
|
74525
|
-
readdirSync as
|
|
74666
|
+
readdirSync as readdirSync37,
|
|
74526
74667
|
readFileSync as readFileSync83,
|
|
74527
74668
|
writeFileSync as writeFileSync20
|
|
74528
74669
|
} from "node:fs";
|
|
@@ -74735,7 +74876,7 @@ async function runUpgrade(options = {}) {
|
|
|
74735
74876
|
const dbPath2 = join109(cleoDir2, "tasks.db");
|
|
74736
74877
|
const safetyDir = join109(cleoDir2, "backups", "safety");
|
|
74737
74878
|
if (existsSync111(safetyDir)) {
|
|
74738
|
-
const backups =
|
|
74879
|
+
const backups = readdirSync37(safetyDir).filter((f) => f.startsWith("tasks.db.pre-migration.")).sort().reverse();
|
|
74739
74880
|
if (backups.length > 0 && !existsSync111(dbPath2)) {
|
|
74740
74881
|
copyFileSync7(join109(safetyDir, backups[0]), dbPath2);
|
|
74741
74882
|
}
|
|
@@ -77662,7 +77803,7 @@ var init_bootstrap2 = __esm({
|
|
|
77662
77803
|
});
|
|
77663
77804
|
|
|
77664
77805
|
// packages/core/src/orchestration/critical-path.ts
|
|
77665
|
-
async function
|
|
77806
|
+
async function getCriticalPath3(cwd, accessor) {
|
|
77666
77807
|
const acc = accessor ?? await getAccessor(cwd);
|
|
77667
77808
|
const { tasks: tasks2 } = await acc.queryTasks({});
|
|
77668
77809
|
if (tasks2.length === 0) {
|
|
@@ -78283,6 +78424,7 @@ __export(internal_exports, {
|
|
|
78283
78424
|
deletePhase: () => deletePhase,
|
|
78284
78425
|
deleteTask: () => deleteTask,
|
|
78285
78426
|
deleteTokenUsage: () => deleteTokenUsage,
|
|
78427
|
+
depsCriticalPath: () => getCriticalPath2,
|
|
78286
78428
|
deregisterAgent: () => deregisterAgent,
|
|
78287
78429
|
describeChannel: () => describeChannel,
|
|
78288
78430
|
detectCrashedAgents: () => detectCrashedAgents,
|
|
@@ -78424,6 +78566,7 @@ __export(internal_exports, {
|
|
|
78424
78566
|
getSystemInfo: () => getSystemInfo2,
|
|
78425
78567
|
getSystemMetrics: () => getSystemMetrics,
|
|
78426
78568
|
getSystemMigrationStatus: () => getMigrationStatus2,
|
|
78569
|
+
getTask: () => getTask,
|
|
78427
78570
|
getTaskHistory: () => getTaskHistory,
|
|
78428
78571
|
getTaskPath: () => getTaskPath,
|
|
78429
78572
|
getTemplateForSubcommand: () => getTemplateForSubcommand2,
|
|
@@ -78499,6 +78642,7 @@ __export(internal_exports, {
|
|
|
78499
78642
|
listSessions: () => listSessions,
|
|
78500
78643
|
listStickies: () => listStickies,
|
|
78501
78644
|
listStrictnessPresets: () => listStrictnessPresets,
|
|
78645
|
+
listSystemBackups: () => listSystemBackups,
|
|
78502
78646
|
listTasks: () => listTasks,
|
|
78503
78647
|
listTesseraTemplates: () => listTesseraTemplates,
|
|
78504
78648
|
listTokenUsage: () => listTokenUsage,
|
|
@@ -78559,7 +78703,7 @@ __export(internal_exports, {
|
|
|
78559
78703
|
ops: () => operations_exports,
|
|
78560
78704
|
orchestration: () => orchestration_exports,
|
|
78561
78705
|
orchestrationAnalyzeDependencies: () => analyzeDependencies,
|
|
78562
|
-
orchestrationGetCriticalPath: () =>
|
|
78706
|
+
orchestrationGetCriticalPath: () => getCriticalPath3,
|
|
78563
78707
|
orchestrationGetNextTask: () => getNextTask,
|
|
78564
78708
|
orchestrationGetReadyTasks: () => getReadyTasks2,
|
|
78565
78709
|
orphanDetection: () => orphanDetection,
|
|
@@ -78793,6 +78937,7 @@ var init_internal = __esm({
|
|
|
78793
78937
|
init_waves();
|
|
78794
78938
|
init_otel();
|
|
78795
78939
|
init_paths();
|
|
78940
|
+
init_deps2();
|
|
78796
78941
|
init_phases();
|
|
78797
78942
|
init_pipeline2();
|
|
78798
78943
|
init_platform();
|
|
@@ -84515,6 +84660,16 @@ var OPERATIONS = [
|
|
|
84515
84660
|
}
|
|
84516
84661
|
]
|
|
84517
84662
|
},
|
|
84663
|
+
{
|
|
84664
|
+
gateway: "query",
|
|
84665
|
+
domain: "admin",
|
|
84666
|
+
operation: "backup",
|
|
84667
|
+
description: "admin.backup (query) \u2014 list available backups (read-only)",
|
|
84668
|
+
tier: 1,
|
|
84669
|
+
idempotent: true,
|
|
84670
|
+
sessionRequired: false,
|
|
84671
|
+
requiredParams: []
|
|
84672
|
+
},
|
|
84518
84673
|
{
|
|
84519
84674
|
gateway: "mutate",
|
|
84520
84675
|
domain: "admin",
|
|
@@ -86568,7 +86723,7 @@ async function orchestrateCriticalPath(projectRoot) {
|
|
|
86568
86723
|
try {
|
|
86569
86724
|
const root = projectRoot || resolveProjectRoot();
|
|
86570
86725
|
const accessor = await getAccessor(root);
|
|
86571
|
-
const result = await
|
|
86726
|
+
const result = await getCriticalPath3(root, accessor);
|
|
86572
86727
|
return { success: true, data: result };
|
|
86573
86728
|
} catch (err) {
|
|
86574
86729
|
return engineError("E_GENERAL", err.message);
|
|
@@ -87324,7 +87479,7 @@ async function releaseShip(params, projectRoot) {
|
|
|
87324
87479
|
// packages/cleo/src/dispatch/engines/system-engine.ts
|
|
87325
87480
|
init_internal();
|
|
87326
87481
|
init_error();
|
|
87327
|
-
import { existsSync as existsSync119, readdirSync as
|
|
87482
|
+
import { existsSync as existsSync119, readdirSync as readdirSync38, readFileSync as readFileSync93 } from "node:fs";
|
|
87328
87483
|
import { basename as basename18, join as join112 } from "node:path";
|
|
87329
87484
|
var HELP_TOPICS = {
|
|
87330
87485
|
session: {
|
|
@@ -87631,7 +87786,7 @@ function systemContext(projectRoot, params) {
|
|
|
87631
87786
|
const sessions2 = [];
|
|
87632
87787
|
const statesDir = join112(cleoDir, "context-states");
|
|
87633
87788
|
if (existsSync119(statesDir)) {
|
|
87634
|
-
for (const file2 of
|
|
87789
|
+
for (const file2 of readdirSync38(statesDir)) {
|
|
87635
87790
|
if (file2.startsWith("context-state-") && file2.endsWith(".json")) {
|
|
87636
87791
|
try {
|
|
87637
87792
|
const state = JSON.parse(readFileSync93(join112(statesDir, file2), "utf-8"));
|
|
@@ -87768,6 +87923,14 @@ function systemBackup(projectRoot, params) {
|
|
|
87768
87923
|
return engineError("E_GENERAL", err.message);
|
|
87769
87924
|
}
|
|
87770
87925
|
}
|
|
87926
|
+
function systemListBackups(projectRoot) {
|
|
87927
|
+
try {
|
|
87928
|
+
const result = listSystemBackups(projectRoot);
|
|
87929
|
+
return { success: true, data: result };
|
|
87930
|
+
} catch (err) {
|
|
87931
|
+
return engineError("E_GENERAL", err.message);
|
|
87932
|
+
}
|
|
87933
|
+
}
|
|
87771
87934
|
function systemRestore(projectRoot, params) {
|
|
87772
87935
|
try {
|
|
87773
87936
|
const result = restoreBackup(projectRoot, params);
|
|
@@ -88042,14 +88205,19 @@ async function taskCreate(projectRoot, params) {
|
|
|
88042
88205
|
size: params.size,
|
|
88043
88206
|
acceptance: params.acceptance,
|
|
88044
88207
|
notes: params.notes,
|
|
88045
|
-
files: params.files
|
|
88208
|
+
files: params.files,
|
|
88209
|
+
dryRun: params.dryRun
|
|
88046
88210
|
},
|
|
88047
88211
|
projectRoot,
|
|
88048
88212
|
accessor
|
|
88049
88213
|
);
|
|
88050
88214
|
return {
|
|
88051
88215
|
success: true,
|
|
88052
|
-
data: {
|
|
88216
|
+
data: {
|
|
88217
|
+
task: taskToRecord(result.task),
|
|
88218
|
+
duplicate: result.duplicate ?? false,
|
|
88219
|
+
dryRun: params.dryRun
|
|
88220
|
+
}
|
|
88053
88221
|
};
|
|
88054
88222
|
} catch (err) {
|
|
88055
88223
|
const cleoErr = err;
|
|
@@ -89334,6 +89502,16 @@ var AdminHandler = class {
|
|
|
89334
89502
|
data: result
|
|
89335
89503
|
};
|
|
89336
89504
|
}
|
|
89505
|
+
case "backup": {
|
|
89506
|
+
const result = systemListBackups(projectRoot);
|
|
89507
|
+
return wrapResult(
|
|
89508
|
+
{ success: true, data: { backups: result, count: result.length } },
|
|
89509
|
+
"query",
|
|
89510
|
+
"admin",
|
|
89511
|
+
operation,
|
|
89512
|
+
startTime
|
|
89513
|
+
);
|
|
89514
|
+
}
|
|
89337
89515
|
case "map": {
|
|
89338
89516
|
const { mapCodebase: mapCodebase3 } = await Promise.resolve().then(() => (init_codebase_map_engine(), codebase_map_engine_exports));
|
|
89339
89517
|
const result = await mapCodebase3(projectRoot, {
|
|
@@ -89823,6 +90001,7 @@ var AdminHandler = class {
|
|
|
89823
90001
|
"token",
|
|
89824
90002
|
"adr.show",
|
|
89825
90003
|
"adr.find",
|
|
90004
|
+
"backup",
|
|
89826
90005
|
"export",
|
|
89827
90006
|
"map"
|
|
89828
90007
|
],
|
|
@@ -93275,7 +93454,8 @@ var TasksHandler = class {
|
|
|
93275
93454
|
phase: params?.phase,
|
|
93276
93455
|
size: params?.size,
|
|
93277
93456
|
notes: params?.notes,
|
|
93278
|
-
files: params?.files
|
|
93457
|
+
files: params?.files,
|
|
93458
|
+
dryRun: params?.dryRun
|
|
93279
93459
|
});
|
|
93280
93460
|
return wrapResult(result, "mutate", "tasks", operation, startTime);
|
|
93281
93461
|
}
|