@cleocode/cleo 2026.4.26 → 2026.4.28
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 +314 -254
- package/dist/cli/index.js.map +4 -4
- package/package.json +7 -7
package/dist/cli/index.js
CHANGED
|
@@ -38789,10 +38789,10 @@ async function readProjectMeta(projectPath) {
|
|
|
38789
38789
|
}
|
|
38790
38790
|
async function readProjectId(projectPath) {
|
|
38791
38791
|
try {
|
|
38792
|
-
const { readFileSync:
|
|
38792
|
+
const { readFileSync: readFileSync102, existsSync: existsSync131 } = await import("node:fs");
|
|
38793
38793
|
const infoPath = join64(projectPath, ".cleo", "project-info.json");
|
|
38794
38794
|
if (!existsSync131(infoPath)) return "";
|
|
38795
|
-
const data = JSON.parse(
|
|
38795
|
+
const data = JSON.parse(readFileSync102(infoPath, "utf-8"));
|
|
38796
38796
|
return typeof data.projectId === "string" ? data.projectId : "";
|
|
38797
38797
|
} catch {
|
|
38798
38798
|
return "";
|
|
@@ -54643,33 +54643,23 @@ var init_runtime = __esm({
|
|
|
54643
54643
|
});
|
|
54644
54644
|
|
|
54645
54645
|
// packages/core/src/system/safestop.ts
|
|
54646
|
-
import { existsSync as existsSync96
|
|
54646
|
+
import { existsSync as existsSync96 } from "node:fs";
|
|
54647
54647
|
import { join as join98 } from "node:path";
|
|
54648
|
-
function safestop(projectRoot, opts) {
|
|
54648
|
+
async function safestop(projectRoot, opts) {
|
|
54649
54649
|
const dryRun = opts?.dryRun ?? false;
|
|
54650
54650
|
const reason = opts?.reason ?? "Manual safestop";
|
|
54651
54651
|
let sessionEnded = false;
|
|
54652
54652
|
if (!dryRun && !opts?.noSessionEnd) {
|
|
54653
|
-
|
|
54654
|
-
|
|
54655
|
-
|
|
54656
|
-
|
|
54657
|
-
|
|
54658
|
-
|
|
54659
|
-
|
|
54660
|
-
|
|
54661
|
-
s3.status = "ended";
|
|
54662
|
-
s3.endedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
54663
|
-
s3.endNote = `Safestop: ${reason}`;
|
|
54664
|
-
changed = true;
|
|
54665
|
-
sessionEnded = true;
|
|
54666
|
-
}
|
|
54667
|
-
}
|
|
54668
|
-
if (changed) {
|
|
54669
|
-
writeFileSync15(sessPath, JSON.stringify(data, null, 2), "utf-8");
|
|
54670
|
-
}
|
|
54671
|
-
} catch {
|
|
54653
|
+
try {
|
|
54654
|
+
const accessor = await getAccessor(projectRoot);
|
|
54655
|
+
const activeSession = await accessor.getActiveSession();
|
|
54656
|
+
if (activeSession && activeSession.id !== "default") {
|
|
54657
|
+
activeSession.status = "ended";
|
|
54658
|
+
activeSession.endedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
54659
|
+
await accessor.upsertSingleSession(activeSession);
|
|
54660
|
+
sessionEnded = true;
|
|
54672
54661
|
}
|
|
54662
|
+
} catch {
|
|
54673
54663
|
}
|
|
54674
54664
|
}
|
|
54675
54665
|
return { stopped: !dryRun, reason, sessionEnded, handoff: opts?.handoff, dryRun };
|
|
@@ -55260,7 +55250,7 @@ var init_tasks2 = __esm({
|
|
|
55260
55250
|
});
|
|
55261
55251
|
|
|
55262
55252
|
// packages/core/src/templates/parser.ts
|
|
55263
|
-
import { existsSync as existsSync97, readdirSync as readdirSync31, readFileSync as
|
|
55253
|
+
import { existsSync as existsSync97, readdirSync as readdirSync31, readFileSync as readFileSync67 } from "fs";
|
|
55264
55254
|
import { join as join99 } from "path";
|
|
55265
55255
|
import { parse as parseYaml } from "yaml";
|
|
55266
55256
|
function deriveSubcommand(filename) {
|
|
@@ -55276,7 +55266,7 @@ function deriveSubcommand(filename) {
|
|
|
55276
55266
|
}
|
|
55277
55267
|
function parseTemplateFile2(templateDir, filename) {
|
|
55278
55268
|
const filePath = join99(templateDir, filename);
|
|
55279
|
-
const raw =
|
|
55269
|
+
const raw = readFileSync67(filePath, "utf-8");
|
|
55280
55270
|
const parsed = parseYaml(raw);
|
|
55281
55271
|
const name2 = typeof parsed.name === "string" ? parsed.name : filename;
|
|
55282
55272
|
const titlePrefix = typeof parsed.title === "string" ? parsed.title : "";
|
|
@@ -55463,7 +55453,7 @@ var init_templates = __esm({
|
|
|
55463
55453
|
});
|
|
55464
55454
|
|
|
55465
55455
|
// packages/core/src/ui/aliases.ts
|
|
55466
|
-
import { existsSync as existsSync98, readFileSync as
|
|
55456
|
+
import { existsSync as existsSync98, readFileSync as readFileSync68, writeFileSync as writeFileSync15 } from "node:fs";
|
|
55467
55457
|
import { homedir as homedir5, platform as platform3 } from "node:os";
|
|
55468
55458
|
import { join as join100 } from "node:path";
|
|
55469
55459
|
function getCurrentShell() {
|
|
@@ -55526,40 +55516,40 @@ function generatePowershellAliases(cleoPath) {
|
|
|
55526
55516
|
}
|
|
55527
55517
|
function hasAliasBlock(filePath) {
|
|
55528
55518
|
if (!existsSync98(filePath)) return false;
|
|
55529
|
-
const content =
|
|
55519
|
+
const content = readFileSync68(filePath, "utf-8");
|
|
55530
55520
|
return content.includes(MARKER_START) && content.includes(MARKER_END);
|
|
55531
55521
|
}
|
|
55532
55522
|
function getInstalledVersion(filePath) {
|
|
55533
55523
|
if (!existsSync98(filePath)) return null;
|
|
55534
|
-
const content =
|
|
55524
|
+
const content = readFileSync68(filePath, "utf-8");
|
|
55535
55525
|
const match = content.match(/CLEO CLI aliases \(v([^)]+)\)/);
|
|
55536
55526
|
return match?.[1] ?? null;
|
|
55537
55527
|
}
|
|
55538
55528
|
function injectAliases(filePath, shell = "bash", cleoPath) {
|
|
55539
55529
|
const content = shell === "powershell" ? generatePowershellAliases(cleoPath) : generateBashAliases(cleoPath);
|
|
55540
55530
|
if (!existsSync98(filePath)) {
|
|
55541
|
-
|
|
55531
|
+
writeFileSync15(filePath, content + "\n", "utf-8");
|
|
55542
55532
|
return { action: "created", version: ALIASES_VERSION };
|
|
55543
55533
|
}
|
|
55544
|
-
const existing =
|
|
55534
|
+
const existing = readFileSync68(filePath, "utf-8");
|
|
55545
55535
|
if (hasAliasBlock(filePath)) {
|
|
55546
55536
|
const startIdx = existing.indexOf(MARKER_START);
|
|
55547
55537
|
const endIdx = existing.indexOf(MARKER_END) + MARKER_END.length;
|
|
55548
55538
|
const updated = existing.slice(0, startIdx) + content + existing.slice(endIdx);
|
|
55549
|
-
|
|
55539
|
+
writeFileSync15(filePath, updated, "utf-8");
|
|
55550
55540
|
return { action: "updated", version: ALIASES_VERSION };
|
|
55551
55541
|
}
|
|
55552
|
-
|
|
55542
|
+
writeFileSync15(filePath, existing + "\n" + content + "\n", "utf-8");
|
|
55553
55543
|
return { action: "added", version: ALIASES_VERSION };
|
|
55554
55544
|
}
|
|
55555
55545
|
function removeAliases(filePath) {
|
|
55556
55546
|
if (!existsSync98(filePath) || !hasAliasBlock(filePath)) return false;
|
|
55557
|
-
const existing =
|
|
55547
|
+
const existing = readFileSync68(filePath, "utf-8");
|
|
55558
55548
|
const startIdx = existing.indexOf(MARKER_START);
|
|
55559
55549
|
const endIdx = existing.indexOf(MARKER_END) + MARKER_END.length;
|
|
55560
55550
|
const before = existing.slice(0, startIdx).replace(/\n+$/, "\n");
|
|
55561
55551
|
const after = existing.slice(endIdx).replace(/^\n+/, "\n");
|
|
55562
|
-
|
|
55552
|
+
writeFileSync15(filePath, before + after, "utf-8");
|
|
55563
55553
|
return true;
|
|
55564
55554
|
}
|
|
55565
55555
|
function checkAliasesStatus(shell) {
|
|
@@ -55590,7 +55580,7 @@ var init_aliases = __esm({
|
|
|
55590
55580
|
});
|
|
55591
55581
|
|
|
55592
55582
|
// packages/core/src/ui/changelog.ts
|
|
55593
|
-
import { appendFileSync as appendFileSync9, existsSync as existsSync99, readFileSync as
|
|
55583
|
+
import { appendFileSync as appendFileSync9, existsSync as existsSync99, readFileSync as readFileSync69, writeFileSync as writeFileSync16 } from "node:fs";
|
|
55594
55584
|
async function discoverReleaseTasks(options = {}, cwd, accessor) {
|
|
55595
55585
|
const tasks2 = [];
|
|
55596
55586
|
const dataSources = [];
|
|
@@ -55673,21 +55663,21 @@ function formatChangelogJson(version2, date6, sections) {
|
|
|
55673
55663
|
};
|
|
55674
55664
|
}
|
|
55675
55665
|
function writeChangelogFile(filePath, content) {
|
|
55676
|
-
|
|
55666
|
+
writeFileSync16(filePath, content, "utf-8");
|
|
55677
55667
|
}
|
|
55678
55668
|
function appendToChangelog(filePath, newContent) {
|
|
55679
55669
|
if (!existsSync99(filePath)) {
|
|
55680
|
-
|
|
55670
|
+
writeFileSync16(filePath, `# Changelog
|
|
55681
55671
|
|
|
55682
55672
|
${newContent}`, "utf-8");
|
|
55683
55673
|
return;
|
|
55684
55674
|
}
|
|
55685
|
-
const existing =
|
|
55675
|
+
const existing = readFileSync69(filePath, "utf-8");
|
|
55686
55676
|
const headerMatch = existing.match(/^# .+\n/m);
|
|
55687
55677
|
if (headerMatch) {
|
|
55688
55678
|
const insertPos = (headerMatch.index ?? 0) + headerMatch[0].length;
|
|
55689
55679
|
const updated = existing.slice(0, insertPos) + "\n" + newContent + existing.slice(insertPos);
|
|
55690
|
-
|
|
55680
|
+
writeFileSync16(filePath, updated, "utf-8");
|
|
55691
55681
|
} else {
|
|
55692
55682
|
appendFileSync9(filePath, "\n" + newContent);
|
|
55693
55683
|
}
|
|
@@ -55747,11 +55737,11 @@ var init_changelog = __esm({
|
|
|
55747
55737
|
});
|
|
55748
55738
|
|
|
55749
55739
|
// packages/core/src/ui/command-registry.ts
|
|
55750
|
-
import { existsSync as existsSync100, readdirSync as readdirSync32, readFileSync as
|
|
55740
|
+
import { existsSync as existsSync100, readdirSync as readdirSync32, readFileSync as readFileSync70 } from "node:fs";
|
|
55751
55741
|
import { basename as basename16, join as join101 } from "node:path";
|
|
55752
55742
|
function parseCommandHeader(scriptPath) {
|
|
55753
55743
|
if (!existsSync100(scriptPath)) return null;
|
|
55754
|
-
const content =
|
|
55744
|
+
const content = readFileSync70(scriptPath, "utf-8");
|
|
55755
55745
|
const lines = content.split("\n");
|
|
55756
55746
|
let inHeader = false;
|
|
55757
55747
|
const headerLines = [];
|
|
@@ -71081,7 +71071,7 @@ var init_compliance2 = __esm({
|
|
|
71081
71071
|
});
|
|
71082
71072
|
|
|
71083
71073
|
// packages/core/src/validation/docs-sync.ts
|
|
71084
|
-
import { existsSync as existsSync101, readdirSync as readdirSync33, readFileSync as
|
|
71074
|
+
import { existsSync as existsSync101, readdirSync as readdirSync33, readFileSync as readFileSync71 } from "node:fs";
|
|
71085
71075
|
import { join as join102 } from "node:path";
|
|
71086
71076
|
function getScriptCommands(scriptsDir) {
|
|
71087
71077
|
if (!existsSync101(scriptsDir)) return [];
|
|
@@ -71094,7 +71084,7 @@ function getScriptCommands(scriptsDir) {
|
|
|
71094
71084
|
function getIndexScripts(indexPath) {
|
|
71095
71085
|
if (!existsSync101(indexPath)) return [];
|
|
71096
71086
|
try {
|
|
71097
|
-
const content =
|
|
71087
|
+
const content = readFileSync71(indexPath, "utf-8");
|
|
71098
71088
|
const index2 = JSON.parse(content);
|
|
71099
71089
|
return index2.commands.map((cmd) => cmd.script ?? "").filter((s3) => s3).map((s3) => s3.replace(/\.sh$/, "")).sort();
|
|
71100
71090
|
} catch {
|
|
@@ -71104,7 +71094,7 @@ function getIndexScripts(indexPath) {
|
|
|
71104
71094
|
function getIndexCommands(indexPath) {
|
|
71105
71095
|
if (!existsSync101(indexPath)) return [];
|
|
71106
71096
|
try {
|
|
71107
|
-
const content =
|
|
71097
|
+
const content = readFileSync71(indexPath, "utf-8");
|
|
71108
71098
|
const index2 = JSON.parse(content);
|
|
71109
71099
|
return index2.commands.map((cmd) => cmd.name).sort();
|
|
71110
71100
|
} catch {
|
|
@@ -71141,8 +71131,8 @@ function checkWrapperSync(wrapperPath, indexPath) {
|
|
|
71141
71131
|
if (!existsSync101(wrapperPath) || !existsSync101(indexPath)) return [];
|
|
71142
71132
|
const issues = [];
|
|
71143
71133
|
try {
|
|
71144
|
-
const wrapperContent =
|
|
71145
|
-
const indexContent =
|
|
71134
|
+
const wrapperContent = readFileSync71(wrapperPath, "utf-8");
|
|
71135
|
+
const indexContent = readFileSync71(indexPath, "utf-8");
|
|
71146
71136
|
const index2 = JSON.parse(indexContent);
|
|
71147
71137
|
const match = wrapperContent.match(/_get_all_commands\(\)\s*\{[^}]*echo\s+"([^"]+)"/);
|
|
71148
71138
|
const wrapperCmds = new Set(match ? match[1].split(/\s+/).filter(Boolean) : []);
|
|
@@ -71173,7 +71163,7 @@ function detectDrift(mode = "full", projectRoot = ".") {
|
|
|
71173
71163
|
const readmePath = join102(projectRoot, "README.md");
|
|
71174
71164
|
if (existsSync101(readmePath)) {
|
|
71175
71165
|
try {
|
|
71176
|
-
const readme =
|
|
71166
|
+
const readme = readFileSync71(readmePath, "utf-8");
|
|
71177
71167
|
const readmeCmds = new Set(
|
|
71178
71168
|
(readme.match(/cleo [a-z-]+/g) ?? []).map((m2) => m2.replace("cleo ", ""))
|
|
71179
71169
|
);
|
|
@@ -71223,7 +71213,7 @@ var init_docs_sync = __esm({
|
|
|
71223
71213
|
|
|
71224
71214
|
// packages/core/src/validation/doctor/project-cache.ts
|
|
71225
71215
|
import { createHash as createHash11 } from "node:crypto";
|
|
71226
|
-
import { existsSync as existsSync102, mkdirSync as mkdirSync23, readFileSync as
|
|
71216
|
+
import { existsSync as existsSync102, mkdirSync as mkdirSync23, readFileSync as readFileSync72, unlinkSync as unlinkSync8, writeFileSync as writeFileSync17 } from "node:fs";
|
|
71227
71217
|
import { dirname as dirname19, join as join103 } from "node:path";
|
|
71228
71218
|
function getCacheFilePath(cleoHome) {
|
|
71229
71219
|
const home = cleoHome ?? getCleoHome();
|
|
@@ -71239,13 +71229,13 @@ function initCacheFile(cacheFile) {
|
|
|
71239
71229
|
if (!existsSync102(dir)) {
|
|
71240
71230
|
mkdirSync23(dir, { recursive: true });
|
|
71241
71231
|
}
|
|
71242
|
-
|
|
71232
|
+
writeFileSync17(cacheFile, JSON.stringify(cache, null, 2));
|
|
71243
71233
|
return cache;
|
|
71244
71234
|
}
|
|
71245
71235
|
function loadCache(cacheFile) {
|
|
71246
71236
|
if (!existsSync102(cacheFile)) return null;
|
|
71247
71237
|
try {
|
|
71248
|
-
const content =
|
|
71238
|
+
const content = readFileSync72(cacheFile, "utf-8");
|
|
71249
71239
|
return JSON.parse(content);
|
|
71250
71240
|
} catch {
|
|
71251
71241
|
return null;
|
|
@@ -71254,7 +71244,7 @@ function loadCache(cacheFile) {
|
|
|
71254
71244
|
function getFileHash(filePath) {
|
|
71255
71245
|
if (!existsSync102(filePath)) return "";
|
|
71256
71246
|
try {
|
|
71257
|
-
const content =
|
|
71247
|
+
const content = readFileSync72(filePath);
|
|
71258
71248
|
return createHash11("sha256").update(content).digest("hex");
|
|
71259
71249
|
} catch {
|
|
71260
71250
|
return "";
|
|
@@ -71299,14 +71289,14 @@ function cacheValidationResult(projectHash, projectPath, validationStatus, issue
|
|
|
71299
71289
|
ttl: CACHE_TTL_SECONDS
|
|
71300
71290
|
};
|
|
71301
71291
|
cache.lastUpdated = timestamp2;
|
|
71302
|
-
|
|
71292
|
+
writeFileSync17(cachePath, JSON.stringify(cache, null, 2));
|
|
71303
71293
|
}
|
|
71304
71294
|
function clearProjectCache(projectHash, cacheFile) {
|
|
71305
71295
|
const cachePath = cacheFile ?? getCacheFilePath();
|
|
71306
71296
|
const cache = loadCache(cachePath);
|
|
71307
71297
|
if (!cache) return;
|
|
71308
71298
|
delete cache.projects[projectHash];
|
|
71309
|
-
|
|
71299
|
+
writeFileSync17(cachePath, JSON.stringify(cache, null, 2));
|
|
71310
71300
|
}
|
|
71311
71301
|
function clearEntireCache(cacheFile) {
|
|
71312
71302
|
const cachePath = cacheFile ?? getCacheFilePath();
|
|
@@ -72523,7 +72513,7 @@ var init_manifest = __esm({
|
|
|
72523
72513
|
});
|
|
72524
72514
|
|
|
72525
72515
|
// packages/core/src/validation/protocol-common.ts
|
|
72526
|
-
import { existsSync as existsSync104, readdirSync as readdirSync34, readFileSync as
|
|
72516
|
+
import { existsSync as existsSync104, readdirSync as readdirSync34, readFileSync as readFileSync73 } from "node:fs";
|
|
72527
72517
|
function checkOutputFileExists(taskId, expectedDir, pattern) {
|
|
72528
72518
|
if (!existsSync104(expectedDir)) return false;
|
|
72529
72519
|
const filePattern = pattern ?? `${taskId}`;
|
|
@@ -72537,7 +72527,7 @@ function checkOutputFileExists(taskId, expectedDir, pattern) {
|
|
|
72537
72527
|
function checkDocumentationSections(filePath, sections) {
|
|
72538
72528
|
if (!existsSync104(filePath)) return false;
|
|
72539
72529
|
try {
|
|
72540
|
-
const content =
|
|
72530
|
+
const content = readFileSync73(filePath, "utf-8");
|
|
72541
72531
|
return sections.every((section) => {
|
|
72542
72532
|
const regex = new RegExp(`^#+ .*${escapeRegex3(section)}`, "m");
|
|
72543
72533
|
return regex.test(content);
|
|
@@ -72608,7 +72598,7 @@ function checkLinkedTasksPresent(entry, requiredIds) {
|
|
|
72608
72598
|
function checkProvenanceTags(filePath, taskId) {
|
|
72609
72599
|
if (!existsSync104(filePath)) return false;
|
|
72610
72600
|
try {
|
|
72611
|
-
const content =
|
|
72601
|
+
const content = readFileSync73(filePath, "utf-8");
|
|
72612
72602
|
if (taskId) {
|
|
72613
72603
|
return content.includes(`@task ${taskId}`);
|
|
72614
72604
|
}
|
|
@@ -73619,7 +73609,7 @@ __export(init_exports, {
|
|
|
73619
73609
|
resolveSeedAgentsDir: () => resolveSeedAgentsDir,
|
|
73620
73610
|
updateDocs: () => updateDocs
|
|
73621
73611
|
});
|
|
73622
|
-
import { existsSync as existsSync106, readdirSync as readdirSync36, readFileSync as
|
|
73612
|
+
import { existsSync as existsSync106, readdirSync as readdirSync36, readFileSync as readFileSync74 } from "node:fs";
|
|
73623
73613
|
import { copyFile as copyFile4, lstat, mkdir as mkdir16, readFile as readFile17, symlink, unlink as unlink4, writeFile as writeFile11 } from "node:fs/promises";
|
|
73624
73614
|
import { platform as platform4 } from "node:os";
|
|
73625
73615
|
import { basename as basename17, dirname as dirname21, join as join105 } from "node:path";
|
|
@@ -73753,7 +73743,7 @@ async function initCoreSkills(created, warnings) {
|
|
|
73753
73743
|
warnings.push("Failed to register skill library with CAAMP");
|
|
73754
73744
|
}
|
|
73755
73745
|
const catalogPath = join105(ctSkillsRoot, "skills.json");
|
|
73756
|
-
const catalog4 = JSON.parse(
|
|
73746
|
+
const catalog4 = JSON.parse(readFileSync74(catalogPath, "utf-8"));
|
|
73757
73747
|
const skills = catalog4.skills ?? [];
|
|
73758
73748
|
const coreSkills = skills.filter((s3) => s3.tier <= 2);
|
|
73759
73749
|
const installed = [];
|
|
@@ -73822,7 +73812,7 @@ async function installGitHubTemplates(projectRoot, created, skipped) {
|
|
|
73822
73812
|
skipped.push(`.github/ISSUE_TEMPLATE/${file2}`);
|
|
73823
73813
|
continue;
|
|
73824
73814
|
}
|
|
73825
|
-
const content =
|
|
73815
|
+
const content = readFileSync74(join105(issueSrcDir, file2), "utf-8");
|
|
73826
73816
|
await writeFile11(dest, content, "utf-8");
|
|
73827
73817
|
created.push(`.github/ISSUE_TEMPLATE/${file2}`);
|
|
73828
73818
|
}
|
|
@@ -73833,7 +73823,7 @@ async function installGitHubTemplates(projectRoot, created, skipped) {
|
|
|
73833
73823
|
if (existsSync106(prTemplateDest)) {
|
|
73834
73824
|
skipped.push(".github/pull_request_template.md");
|
|
73835
73825
|
} else {
|
|
73836
|
-
const content =
|
|
73826
|
+
const content = readFileSync74(prTemplateSrc, "utf-8");
|
|
73837
73827
|
await writeFile11(prTemplateDest, content, "utf-8");
|
|
73838
73828
|
created.push(".github/pull_request_template.md");
|
|
73839
73829
|
}
|
|
@@ -74286,13 +74276,13 @@ var init_init = __esm({
|
|
|
74286
74276
|
});
|
|
74287
74277
|
|
|
74288
74278
|
// packages/core/src/sessions/context-alert.ts
|
|
74289
|
-
import { existsSync as existsSync107, readFileSync as
|
|
74279
|
+
import { existsSync as existsSync107, readFileSync as readFileSync75, writeFileSync as writeFileSync18 } from "node:fs";
|
|
74290
74280
|
import { join as join106 } from "node:path";
|
|
74291
74281
|
function getCurrentSessionId(cwd) {
|
|
74292
74282
|
if (process.env.CLEO_SESSION) return process.env.CLEO_SESSION;
|
|
74293
74283
|
const sessionFile = join106(getCleoDir(cwd), ".current-session");
|
|
74294
74284
|
if (existsSync107(sessionFile)) {
|
|
74295
|
-
return
|
|
74285
|
+
return readFileSync75(sessionFile, "utf-8").trim() || null;
|
|
74296
74286
|
}
|
|
74297
74287
|
return null;
|
|
74298
74288
|
}
|
|
@@ -74388,7 +74378,7 @@ __export(project_info_exports, {
|
|
|
74388
74378
|
getProjectInfoSync: () => getProjectInfoSync,
|
|
74389
74379
|
updateProjectName: () => updateProjectName
|
|
74390
74380
|
});
|
|
74391
|
-
import { existsSync as existsSync108, readFileSync as
|
|
74381
|
+
import { existsSync as existsSync108, readFileSync as readFileSync76, writeFileSync as writeFileSync19 } from "node:fs";
|
|
74392
74382
|
import { readFile as readFile18 } from "node:fs/promises";
|
|
74393
74383
|
import { join as join107 } from "node:path";
|
|
74394
74384
|
async function getProjectInfo(cwd) {
|
|
@@ -74415,7 +74405,7 @@ function getProjectInfoSync(cwd) {
|
|
|
74415
74405
|
const infoPath = join107(cleoDir, "project-info.json");
|
|
74416
74406
|
if (!existsSync108(infoPath)) return null;
|
|
74417
74407
|
try {
|
|
74418
|
-
const raw =
|
|
74408
|
+
const raw = readFileSync76(infoPath, "utf-8");
|
|
74419
74409
|
const data = JSON.parse(raw);
|
|
74420
74410
|
if (typeof data.projectHash !== "string" || data.projectHash.length === 0) {
|
|
74421
74411
|
return null;
|
|
@@ -74436,10 +74426,10 @@ function updateProjectName(cwd, name2) {
|
|
|
74436
74426
|
const cleoDir = getCleoDirAbsolute(cwd);
|
|
74437
74427
|
const infoPath = join107(cleoDir, "project-info.json");
|
|
74438
74428
|
if (!existsSync108(infoPath)) return;
|
|
74439
|
-
const data = JSON.parse(
|
|
74429
|
+
const data = JSON.parse(readFileSync76(infoPath, "utf-8"));
|
|
74440
74430
|
data.projectName = name2;
|
|
74441
74431
|
data.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
|
|
74442
|
-
|
|
74432
|
+
writeFileSync19(infoPath, `${JSON.stringify(data, null, 2)}
|
|
74443
74433
|
`);
|
|
74444
74434
|
}
|
|
74445
74435
|
var init_project_info = __esm({
|
|
@@ -74450,7 +74440,7 @@ var init_project_info = __esm({
|
|
|
74450
74440
|
});
|
|
74451
74441
|
|
|
74452
74442
|
// packages/core/src/bootstrap.ts
|
|
74453
|
-
import { existsSync as existsSync109, readFileSync as
|
|
74443
|
+
import { existsSync as existsSync109, readFileSync as readFileSync77 } from "node:fs";
|
|
74454
74444
|
import { mkdir as mkdir17, readFile as readFile19, writeFile as writeFile12 } from "node:fs/promises";
|
|
74455
74445
|
import { homedir as homedir6 } from "node:os";
|
|
74456
74446
|
import { join as join108 } from "node:path";
|
|
@@ -74489,7 +74479,7 @@ async function ensureGlobalTemplatesBootstrap(ctx, packageRootOverride) {
|
|
|
74489
74479
|
const pkgRoot = packageRootOverride ?? getPackageRoot();
|
|
74490
74480
|
const templatePath = join108(pkgRoot, "templates", "CLEO-INJECTION.md");
|
|
74491
74481
|
if (existsSync109(templatePath)) {
|
|
74492
|
-
templateContent =
|
|
74482
|
+
templateContent = readFileSync77(templatePath, "utf-8");
|
|
74493
74483
|
}
|
|
74494
74484
|
} catch {
|
|
74495
74485
|
}
|
|
@@ -79175,7 +79165,7 @@ var init_engine_compat = __esm({
|
|
|
79175
79165
|
|
|
79176
79166
|
// packages/core/src/memory/pipeline-manifest-sqlite.ts
|
|
79177
79167
|
import { createHash as createHash12 } from "node:crypto";
|
|
79178
|
-
import { existsSync as existsSync111, readFileSync as
|
|
79168
|
+
import { existsSync as existsSync111, readFileSync as readFileSync78, renameSync as renameSync8 } from "node:fs";
|
|
79179
79169
|
import { join as join109 } from "node:path";
|
|
79180
79170
|
import { and as and10, count as count2, desc as desc5, eq as eq13, gte as gte3, isNull as isNull3, like as like3, lte as lte2, or as or5 } from "drizzle-orm";
|
|
79181
79171
|
async function getDb3(cwd) {
|
|
@@ -79308,7 +79298,7 @@ async function pipelineManifestShow(researchId, projectRoot) {
|
|
|
79308
79298
|
try {
|
|
79309
79299
|
const filePath = join109(root, entry.file);
|
|
79310
79300
|
if (existsSync111(filePath)) {
|
|
79311
|
-
fileContent =
|
|
79301
|
+
fileContent = readFileSync78(filePath, "utf-8");
|
|
79312
79302
|
}
|
|
79313
79303
|
} catch {
|
|
79314
79304
|
}
|
|
@@ -79697,7 +79687,7 @@ var init_model_provider_registry = __esm({
|
|
|
79697
79687
|
|
|
79698
79688
|
// packages/core/src/metrics/token-service.ts
|
|
79699
79689
|
import { createHash as createHash13, randomUUID as randomUUID9 } from "node:crypto";
|
|
79700
|
-
import { existsSync as existsSync112, readdirSync as readdirSync37, readFileSync as
|
|
79690
|
+
import { existsSync as existsSync112, readdirSync as readdirSync37, readFileSync as readFileSync79 } from "node:fs";
|
|
79701
79691
|
import { join as join110 } from "node:path";
|
|
79702
79692
|
function normalizeProvider(provider, model, runtimeProvider) {
|
|
79703
79693
|
const value = (provider ?? "").trim().toLowerCase();
|
|
@@ -79785,7 +79775,7 @@ function readOtelJsonl(dir) {
|
|
|
79785
79775
|
for (const file2 of readdirSync37(dir)) {
|
|
79786
79776
|
if (!file2.endsWith(".json") && !file2.endsWith(".jsonl")) continue;
|
|
79787
79777
|
const filePath = join110(dir, file2);
|
|
79788
|
-
const raw =
|
|
79778
|
+
const raw = readFileSync79(filePath, "utf-8").trim();
|
|
79789
79779
|
if (!raw) continue;
|
|
79790
79780
|
for (const line2 of raw.split("\n")) {
|
|
79791
79781
|
try {
|
|
@@ -80174,7 +80164,7 @@ var init_parallel = __esm({
|
|
|
80174
80164
|
});
|
|
80175
80165
|
|
|
80176
80166
|
// packages/core/src/orchestration/skill-ops.ts
|
|
80177
|
-
import { existsSync as existsSync113, readdirSync as readdirSync38, readFileSync as
|
|
80167
|
+
import { existsSync as existsSync113, readdirSync as readdirSync38, readFileSync as readFileSync80 } from "node:fs";
|
|
80178
80168
|
import { join as join111 } from "node:path";
|
|
80179
80169
|
import { getCanonicalSkillsDir as getCanonicalSkillsDir3 } from "@cleocode/caamp";
|
|
80180
80170
|
function getSkillContent(skillName, projectRoot) {
|
|
@@ -80194,7 +80184,7 @@ function getSkillContent(skillName, projectRoot) {
|
|
|
80194
80184
|
if (!existsSync113(skillFilePath)) {
|
|
80195
80185
|
throw new CleoError(4 /* NOT_FOUND */, `Skill file not found: ${skillFilePath}`);
|
|
80196
80186
|
}
|
|
80197
|
-
const content =
|
|
80187
|
+
const content = readFileSync80(skillFilePath, "utf-8");
|
|
80198
80188
|
const refsDir = join111(skillDir, "references");
|
|
80199
80189
|
let references = [];
|
|
80200
80190
|
if (existsSync113(refsDir)) {
|
|
@@ -80389,7 +80379,7 @@ var init_validate_spawn = __esm({
|
|
|
80389
80379
|
});
|
|
80390
80380
|
|
|
80391
80381
|
// packages/core/src/sessions/context-inject.ts
|
|
80392
|
-
import { existsSync as existsSync114, readFileSync as
|
|
80382
|
+
import { existsSync as existsSync114, readFileSync as readFileSync81 } from "node:fs";
|
|
80393
80383
|
import { resolve as resolve11 } from "node:path";
|
|
80394
80384
|
function resolveRoot2(projectRoot) {
|
|
80395
80385
|
return projectRoot || getProjectRoot();
|
|
@@ -80409,7 +80399,7 @@ function injectContext(protocolType, params, projectRoot) {
|
|
|
80409
80399
|
for (const loc of protocolLocations) {
|
|
80410
80400
|
if (existsSync114(loc)) {
|
|
80411
80401
|
try {
|
|
80412
|
-
protocolContent =
|
|
80402
|
+
protocolContent = readFileSync81(loc, "utf-8");
|
|
80413
80403
|
protocolPath = loc.replace(root + "/", "");
|
|
80414
80404
|
break;
|
|
80415
80405
|
} catch {
|
|
@@ -86109,7 +86099,7 @@ __export(migration_sqlite_exports, {
|
|
|
86109
86099
|
migrateJsonToSqlite: () => migrateJsonToSqlite2,
|
|
86110
86100
|
migrateJsonToSqliteAtomic: () => migrateJsonToSqliteAtomic
|
|
86111
86101
|
});
|
|
86112
|
-
import { existsSync as existsSync117, mkdirSync as mkdirSync25, readFileSync as
|
|
86102
|
+
import { existsSync as existsSync117, mkdirSync as mkdirSync25, readFileSync as readFileSync82 } from "node:fs";
|
|
86113
86103
|
import { dirname as dirname22, join as join114 } from "node:path";
|
|
86114
86104
|
function topoSortTasks(tasks2) {
|
|
86115
86105
|
const taskMap = new Map(tasks2.map((t) => [t.id, t]));
|
|
@@ -86148,7 +86138,7 @@ function countJsonRecords(cleoDir) {
|
|
|
86148
86138
|
const todoPath = join114(cleoDir, "todo.json");
|
|
86149
86139
|
if (existsSync117(todoPath)) {
|
|
86150
86140
|
try {
|
|
86151
|
-
const data = JSON.parse(
|
|
86141
|
+
const data = JSON.parse(readFileSync82(todoPath, "utf-8"));
|
|
86152
86142
|
tasks2 = (data.tasks ?? []).length;
|
|
86153
86143
|
} catch {
|
|
86154
86144
|
}
|
|
@@ -86156,7 +86146,7 @@ function countJsonRecords(cleoDir) {
|
|
|
86156
86146
|
const archivePath = join114(cleoDir, "todo-archive.json");
|
|
86157
86147
|
if (existsSync117(archivePath)) {
|
|
86158
86148
|
try {
|
|
86159
|
-
const data = JSON.parse(
|
|
86149
|
+
const data = JSON.parse(readFileSync82(archivePath, "utf-8"));
|
|
86160
86150
|
archived = (data.tasks ?? data.archivedTasks ?? []).length;
|
|
86161
86151
|
} catch {
|
|
86162
86152
|
}
|
|
@@ -86164,7 +86154,7 @@ function countJsonRecords(cleoDir) {
|
|
|
86164
86154
|
const sessionsPath = join114(cleoDir, "sessions.json");
|
|
86165
86155
|
if (existsSync117(sessionsPath)) {
|
|
86166
86156
|
try {
|
|
86167
|
-
const data = JSON.parse(
|
|
86157
|
+
const data = JSON.parse(readFileSync82(sessionsPath, "utf-8"));
|
|
86168
86158
|
sessions2 = (data.sessions ?? []).length;
|
|
86169
86159
|
} catch {
|
|
86170
86160
|
}
|
|
@@ -86237,7 +86227,7 @@ async function runMigrationDataImport(db, cleoDir, result, logger) {
|
|
|
86237
86227
|
logger?.info("import", "read-todo", "Reading todo.json", {
|
|
86238
86228
|
path: todoPath.replace(cleoDir, ".")
|
|
86239
86229
|
});
|
|
86240
|
-
const todoData = JSON.parse(
|
|
86230
|
+
const todoData = JSON.parse(readFileSync82(todoPath, "utf-8"));
|
|
86241
86231
|
const tasks2 = topoSortTasks(todoData.tasks ?? []);
|
|
86242
86232
|
const totalTasks = tasks2.length;
|
|
86243
86233
|
logger?.info("import", "tasks-start", `Starting import of ${totalTasks} tasks`, {
|
|
@@ -86317,7 +86307,7 @@ async function runMigrationDataImport(db, cleoDir, result, logger) {
|
|
|
86317
86307
|
logger?.info("import", "read-archive", "Reading todo-archive.json", {
|
|
86318
86308
|
path: archivePath.replace(cleoDir, ".")
|
|
86319
86309
|
});
|
|
86320
|
-
const archiveData = JSON.parse(
|
|
86310
|
+
const archiveData = JSON.parse(readFileSync82(archivePath, "utf-8"));
|
|
86321
86311
|
const archivedTasks = topoSortTasks(archiveData.tasks ?? archiveData.archivedTasks ?? []);
|
|
86322
86312
|
const totalArchived = archivedTasks.length;
|
|
86323
86313
|
logger?.info(
|
|
@@ -86386,7 +86376,7 @@ async function runMigrationDataImport(db, cleoDir, result, logger) {
|
|
|
86386
86376
|
logger?.info("import", "read-sessions", "Reading sessions.json", {
|
|
86387
86377
|
path: sessionsPath.replace(cleoDir, ".")
|
|
86388
86378
|
});
|
|
86389
|
-
const sessionsData = JSON.parse(
|
|
86379
|
+
const sessionsData = JSON.parse(readFileSync82(sessionsPath, "utf-8"));
|
|
86390
86380
|
const sessions2 = sessionsData.sessions ?? [];
|
|
86391
86381
|
const totalSessions = sessions2.length;
|
|
86392
86382
|
logger?.info("import", "sessions-start", `Starting import of ${totalSessions} sessions`, {
|
|
@@ -86516,7 +86506,7 @@ async function migrateJsonToSqlite2(cwd, options) {
|
|
|
86516
86506
|
const todoPath = join114(cleoDir, "todo.json");
|
|
86517
86507
|
if (existsSync117(todoPath)) {
|
|
86518
86508
|
try {
|
|
86519
|
-
const todoData = JSON.parse(
|
|
86509
|
+
const todoData = JSON.parse(readFileSync82(todoPath, "utf-8"));
|
|
86520
86510
|
const tasks2 = topoSortTasks(todoData.tasks ?? []);
|
|
86521
86511
|
for (const task of tasks2) {
|
|
86522
86512
|
try {
|
|
@@ -86568,7 +86558,7 @@ async function migrateJsonToSqlite2(cwd, options) {
|
|
|
86568
86558
|
const archivePath = join114(cleoDir, "todo-archive.json");
|
|
86569
86559
|
if (existsSync117(archivePath)) {
|
|
86570
86560
|
try {
|
|
86571
|
-
const archiveData = JSON.parse(
|
|
86561
|
+
const archiveData = JSON.parse(readFileSync82(archivePath, "utf-8"));
|
|
86572
86562
|
const archivedTasks = topoSortTasks(archiveData.tasks ?? archiveData.archivedTasks ?? []);
|
|
86573
86563
|
for (const task of archivedTasks) {
|
|
86574
86564
|
try {
|
|
@@ -86606,7 +86596,7 @@ async function migrateJsonToSqlite2(cwd, options) {
|
|
|
86606
86596
|
const sessionsPath = join114(cleoDir, "sessions.json");
|
|
86607
86597
|
if (existsSync117(sessionsPath)) {
|
|
86608
86598
|
try {
|
|
86609
|
-
const sessionsData = JSON.parse(
|
|
86599
|
+
const sessionsData = JSON.parse(readFileSync82(sessionsPath, "utf-8"));
|
|
86610
86600
|
const sessions2 = sessionsData.sessions ?? [];
|
|
86611
86601
|
for (const session of sessions2) {
|
|
86612
86602
|
try {
|
|
@@ -86787,8 +86777,8 @@ import {
|
|
|
86787
86777
|
existsSync as existsSync118,
|
|
86788
86778
|
mkdirSync as mkdirSync26,
|
|
86789
86779
|
readdirSync as readdirSync39,
|
|
86790
|
-
readFileSync as
|
|
86791
|
-
writeFileSync as
|
|
86780
|
+
readFileSync as readFileSync83,
|
|
86781
|
+
writeFileSync as writeFileSync20
|
|
86792
86782
|
} from "node:fs";
|
|
86793
86783
|
import { join as join115 } from "node:path";
|
|
86794
86784
|
async function runUpgrade(options = {}) {
|
|
@@ -86878,8 +86868,8 @@ async function runUpgrade(options = {}) {
|
|
|
86878
86868
|
}
|
|
86879
86869
|
copyFileSync9(dbPath2, dbBackupPath);
|
|
86880
86870
|
const { createHash: createHash14 } = await import("node:crypto");
|
|
86881
|
-
const origChecksum = createHash14("sha256").update(
|
|
86882
|
-
const backupChecksum = createHash14("sha256").update(
|
|
86871
|
+
const origChecksum = createHash14("sha256").update(readFileSync83(dbPath2)).digest("hex");
|
|
86872
|
+
const backupChecksum = createHash14("sha256").update(readFileSync83(dbBackupPath)).digest("hex");
|
|
86883
86873
|
if (origChecksum !== backupChecksum) {
|
|
86884
86874
|
throw new Error(
|
|
86885
86875
|
`Backup verification failed: checksum mismatch. Aborting migration to prevent data loss.`
|
|
@@ -86903,7 +86893,7 @@ async function runUpgrade(options = {}) {
|
|
|
86903
86893
|
const configPath = join115(cleoDir2, "config.json");
|
|
86904
86894
|
let configBackup = null;
|
|
86905
86895
|
if (existsSync118(configPath)) {
|
|
86906
|
-
configBackup =
|
|
86896
|
+
configBackup = readFileSync83(configPath, "utf-8");
|
|
86907
86897
|
}
|
|
86908
86898
|
const { resetDbState: resetDbState2 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
86909
86899
|
resetDbState2();
|
|
@@ -86934,7 +86924,7 @@ async function runUpgrade(options = {}) {
|
|
|
86934
86924
|
if (totalImported === 0 && existsSync118(dbBackupPath)) {
|
|
86935
86925
|
copyFileSync9(dbBackupPath, dbPath2);
|
|
86936
86926
|
if (configBackup) {
|
|
86937
|
-
|
|
86927
|
+
writeFileSync20(configPath, configBackup);
|
|
86938
86928
|
}
|
|
86939
86929
|
actions.push({
|
|
86940
86930
|
action: "storage_migration",
|
|
@@ -86947,7 +86937,7 @@ async function runUpgrade(options = {}) {
|
|
|
86947
86937
|
let config2 = {};
|
|
86948
86938
|
if (existsSync118(configPath)) {
|
|
86949
86939
|
try {
|
|
86950
|
-
config2 = JSON.parse(
|
|
86940
|
+
config2 = JSON.parse(readFileSync83(configPath, "utf-8"));
|
|
86951
86941
|
} catch {
|
|
86952
86942
|
}
|
|
86953
86943
|
}
|
|
@@ -86955,7 +86945,7 @@ async function runUpgrade(options = {}) {
|
|
|
86955
86945
|
config2.storage = {};
|
|
86956
86946
|
}
|
|
86957
86947
|
config2.storage.engine = "sqlite";
|
|
86958
|
-
|
|
86948
|
+
writeFileSync20(configPath, JSON.stringify(config2, null, 2));
|
|
86959
86949
|
actions.push({
|
|
86960
86950
|
action: "storage_migration",
|
|
86961
86951
|
status: "applied",
|
|
@@ -86977,7 +86967,7 @@ async function runUpgrade(options = {}) {
|
|
|
86977
86967
|
copyFileSync9(dbBackupPath, dbPath2);
|
|
86978
86968
|
}
|
|
86979
86969
|
if (configBackup) {
|
|
86980
|
-
|
|
86970
|
+
writeFileSync20(configPath, configBackup);
|
|
86981
86971
|
}
|
|
86982
86972
|
await updateMigrationPhase2(cleoDir2, "failed");
|
|
86983
86973
|
for (const error48 of result.errors) {
|
|
@@ -87205,7 +87195,7 @@ async function runUpgrade(options = {}) {
|
|
|
87205
87195
|
});
|
|
87206
87196
|
} else {
|
|
87207
87197
|
try {
|
|
87208
|
-
const context = JSON.parse(
|
|
87198
|
+
const context = JSON.parse(readFileSync83(contextPath, "utf-8"));
|
|
87209
87199
|
if (context.detectedAt) {
|
|
87210
87200
|
const daysSince = (Date.now() - new Date(context.detectedAt).getTime()) / (1e3 * 60 * 60 * 24);
|
|
87211
87201
|
if (daysSince > 30) {
|
|
@@ -88888,10 +88878,10 @@ var init_param_utils = __esm({
|
|
|
88888
88878
|
});
|
|
88889
88879
|
|
|
88890
88880
|
// packages/core/src/validation/protocols/_shared.ts
|
|
88891
|
-
import { existsSync as existsSync119, readFileSync as
|
|
88881
|
+
import { existsSync as existsSync119, readFileSync as readFileSync84 } from "node:fs";
|
|
88892
88882
|
function findManifestEntry2(taskId, manifestPath) {
|
|
88893
88883
|
if (!existsSync119(manifestPath)) return null;
|
|
88894
|
-
const content =
|
|
88884
|
+
const content = readFileSync84(manifestPath, "utf-8").trim();
|
|
88895
88885
|
if (content.length === 0) return null;
|
|
88896
88886
|
const lines = content.split("\n");
|
|
88897
88887
|
for (let i = lines.length - 1; i >= 0; i--) {
|
|
@@ -88918,7 +88908,7 @@ function loadManifestEntryFromFile(manifestFile) {
|
|
|
88918
88908
|
details: { field: "manifestFile", actual: manifestFile }
|
|
88919
88909
|
});
|
|
88920
88910
|
}
|
|
88921
|
-
return JSON.parse(
|
|
88911
|
+
return JSON.parse(readFileSync84(manifestFile, "utf-8"));
|
|
88922
88912
|
}
|
|
88923
88913
|
function throwIfStrictFailed(result, opts, protocol, taskId) {
|
|
88924
88914
|
if (!opts.strict || result.valid) return;
|
|
@@ -88988,10 +88978,10 @@ var init_artifact_publish = __esm({
|
|
|
88988
88978
|
});
|
|
88989
88979
|
|
|
88990
88980
|
// packages/core/src/validation/protocols/consensus.ts
|
|
88991
|
-
import { existsSync as existsSync120, readFileSync as
|
|
88981
|
+
import { existsSync as existsSync120, readFileSync as readFileSync85 } from "node:fs";
|
|
88992
88982
|
function loadVotingMatrix(votingMatrixFile) {
|
|
88993
88983
|
if (!votingMatrixFile || !existsSync120(votingMatrixFile)) return { options: [] };
|
|
88994
|
-
const raw = JSON.parse(
|
|
88984
|
+
const raw = JSON.parse(readFileSync85(votingMatrixFile, "utf-8"));
|
|
88995
88985
|
const options = Array.isArray(raw.options) ? raw.options : Object.values(raw.options ?? {});
|
|
88996
88986
|
return {
|
|
88997
88987
|
options: options.filter(
|
|
@@ -89156,10 +89146,10 @@ var init_research4 = __esm({
|
|
|
89156
89146
|
});
|
|
89157
89147
|
|
|
89158
89148
|
// packages/core/src/validation/protocols/specification.ts
|
|
89159
|
-
import { existsSync as existsSync121, readFileSync as
|
|
89149
|
+
import { existsSync as existsSync121, readFileSync as readFileSync86 } from "node:fs";
|
|
89160
89150
|
async function validateSpecificationTask(taskId, opts) {
|
|
89161
89151
|
const entry = loadManifestEntryByTaskId(taskId);
|
|
89162
|
-
const specContent = opts.specFile && existsSync121(opts.specFile) ?
|
|
89152
|
+
const specContent = opts.specFile && existsSync121(opts.specFile) ? readFileSync86(opts.specFile, "utf-8") : void 0;
|
|
89163
89153
|
const result = validateSpecificationProtocol(entry, specContent);
|
|
89164
89154
|
throwIfStrictFailed(result, opts, "specification", taskId);
|
|
89165
89155
|
return result;
|
|
@@ -89167,7 +89157,7 @@ async function validateSpecificationTask(taskId, opts) {
|
|
|
89167
89157
|
async function checkSpecificationManifest(manifestFile, opts) {
|
|
89168
89158
|
const entry = loadManifestEntryFromFile(manifestFile);
|
|
89169
89159
|
const taskId = entry.linked_tasks?.[0] ?? "UNKNOWN";
|
|
89170
|
-
const specContent = opts.specFile && existsSync121(opts.specFile) ?
|
|
89160
|
+
const specContent = opts.specFile && existsSync121(opts.specFile) ? readFileSync86(opts.specFile, "utf-8") : void 0;
|
|
89171
89161
|
const result = validateSpecificationProtocol(entry, specContent);
|
|
89172
89162
|
throwIfStrictFailed(result, opts, "specification", taskId);
|
|
89173
89163
|
return result;
|
|
@@ -89227,7 +89217,7 @@ var init_validation3 = __esm({
|
|
|
89227
89217
|
// packages/core/src/validation/schema-validator.ts
|
|
89228
89218
|
import AjvModule from "ajv";
|
|
89229
89219
|
import addFormatsModule from "ajv-formats";
|
|
89230
|
-
import { readFileSync as
|
|
89220
|
+
import { readFileSync as readFileSync87 } from "fs";
|
|
89231
89221
|
function createAjv() {
|
|
89232
89222
|
const ajv = new Ajv3({
|
|
89233
89223
|
allErrors: true,
|
|
@@ -89256,7 +89246,7 @@ function getValidator(schemaType) {
|
|
|
89256
89246
|
return null;
|
|
89257
89247
|
}
|
|
89258
89248
|
try {
|
|
89259
|
-
const schemaContent =
|
|
89249
|
+
const schemaContent = readFileSync87(schemaPath, "utf-8");
|
|
89260
89250
|
const schema = JSON.parse(schemaContent);
|
|
89261
89251
|
const ajv = getAjv2();
|
|
89262
89252
|
const validate = ajv.compile(schema);
|
|
@@ -89310,11 +89300,11 @@ var init_schema_validator = __esm({
|
|
|
89310
89300
|
|
|
89311
89301
|
// packages/core/src/validation/validate-ops.ts
|
|
89312
89302
|
import { execFileSync as execFileSync12 } from "node:child_process";
|
|
89313
|
-
import { appendFileSync as appendFileSync10, existsSync as existsSync122, mkdirSync as mkdirSync27, readFileSync as
|
|
89303
|
+
import { appendFileSync as appendFileSync10, existsSync as existsSync122, mkdirSync as mkdirSync27, readFileSync as readFileSync88 } from "node:fs";
|
|
89314
89304
|
import { dirname as dirname23, join as join116, resolve as resolve12 } from "node:path";
|
|
89315
89305
|
function readJsonFile2(filePath) {
|
|
89316
89306
|
try {
|
|
89317
|
-
const raw =
|
|
89307
|
+
const raw = readFileSync88(filePath, "utf-8");
|
|
89318
89308
|
return JSON.parse(raw);
|
|
89319
89309
|
} catch {
|
|
89320
89310
|
return null;
|
|
@@ -89479,7 +89469,7 @@ function coreValidateManifest(projectRoot) {
|
|
|
89479
89469
|
message: "No manifest file found"
|
|
89480
89470
|
};
|
|
89481
89471
|
}
|
|
89482
|
-
const content =
|
|
89472
|
+
const content = readFileSync88(manifestPath, "utf-8");
|
|
89483
89473
|
const lines = content.split("\n").filter((l) => l.trim());
|
|
89484
89474
|
let validCount = 0;
|
|
89485
89475
|
let invalidCount = 0;
|
|
@@ -89523,7 +89513,7 @@ function coreValidateOutput(filePath, taskId, projectRoot) {
|
|
|
89523
89513
|
if (!existsSync122(fullPath)) {
|
|
89524
89514
|
throw new Error(`Output file not found: ${filePath}`);
|
|
89525
89515
|
}
|
|
89526
|
-
const content =
|
|
89516
|
+
const content = readFileSync88(fullPath, "utf-8");
|
|
89527
89517
|
const issues = [];
|
|
89528
89518
|
if (!content.includes("# ")) {
|
|
89529
89519
|
issues.push({
|
|
@@ -89559,7 +89549,7 @@ function parseComplianceEntries(projectRoot) {
|
|
|
89559
89549
|
if (!existsSync122(compliancePath)) {
|
|
89560
89550
|
return [];
|
|
89561
89551
|
}
|
|
89562
|
-
const content =
|
|
89552
|
+
const content = readFileSync88(compliancePath, "utf-8");
|
|
89563
89553
|
const entries = [];
|
|
89564
89554
|
for (const line2 of content.split("\n")) {
|
|
89565
89555
|
const trimmed = line2.trim();
|
|
@@ -89906,7 +89896,7 @@ var init_validate_ops = __esm({
|
|
|
89906
89896
|
});
|
|
89907
89897
|
|
|
89908
89898
|
// packages/core/src/orchestration/bootstrap.ts
|
|
89909
|
-
import { existsSync as existsSync123, readFileSync as
|
|
89899
|
+
import { existsSync as existsSync123, readFileSync as readFileSync89 } from "node:fs";
|
|
89910
89900
|
import { join as join117 } from "node:path";
|
|
89911
89901
|
async function buildBrainState(projectRoot, opts, accessor) {
|
|
89912
89902
|
const speed = opts?.speed || "fast";
|
|
@@ -89975,7 +89965,7 @@ async function buildBrainState(projectRoot, opts, accessor) {
|
|
|
89975
89965
|
try {
|
|
89976
89966
|
const decisionLogPath = join117(projectRoot, ".cleo", "decision-log.jsonl");
|
|
89977
89967
|
if (existsSync123(decisionLogPath)) {
|
|
89978
|
-
const content =
|
|
89968
|
+
const content = readFileSync89(decisionLogPath, "utf-8").trim();
|
|
89979
89969
|
if (content) {
|
|
89980
89970
|
const entries = content.split("\n").filter((l) => l.trim()).map((l) => {
|
|
89981
89971
|
try {
|
|
@@ -89997,7 +89987,7 @@ async function buildBrainState(projectRoot, opts, accessor) {
|
|
|
89997
89987
|
try {
|
|
89998
89988
|
const contextStatePath = join117(projectRoot, ".cleo", ".context-state.json");
|
|
89999
89989
|
if (existsSync123(contextStatePath)) {
|
|
90000
|
-
const state = JSON.parse(
|
|
89990
|
+
const state = JSON.parse(readFileSync89(contextStatePath, "utf-8"));
|
|
90001
89991
|
const percentage = state.contextWindow?.percentage ?? 0;
|
|
90002
89992
|
const factors = [];
|
|
90003
89993
|
if (percentage > 80) factors.push("high_context_usage");
|
|
@@ -97343,13 +97333,13 @@ var init_backup_unpack = __esm({
|
|
|
97343
97333
|
|
|
97344
97334
|
// packages/core/src/store/regenerators.ts
|
|
97345
97335
|
import { randomUUID as randomUUID10 } from "node:crypto";
|
|
97346
|
-
import { existsSync as existsSync124, readFileSync as
|
|
97336
|
+
import { existsSync as existsSync124, readFileSync as readFileSync90 } from "node:fs";
|
|
97347
97337
|
import { join as join118, resolve as resolve13 } from "node:path";
|
|
97348
97338
|
function isContributorProject(projectRoot) {
|
|
97349
97339
|
const at2 = (p2) => existsSync124(join118(projectRoot, p2));
|
|
97350
97340
|
if (!at2("src/dispatch") || !at2("src/core")) return false;
|
|
97351
97341
|
try {
|
|
97352
|
-
const pkg = JSON.parse(
|
|
97342
|
+
const pkg = JSON.parse(readFileSync90(join118(projectRoot, "package.json"), "utf-8"));
|
|
97353
97343
|
return pkg.name === "@cleocode/cleo";
|
|
97354
97344
|
} catch {
|
|
97355
97345
|
return false;
|
|
@@ -98355,7 +98345,7 @@ var init_api_key_kdf = __esm({
|
|
|
98355
98345
|
|
|
98356
98346
|
// packages/core/src/store/agent-registry-accessor.ts
|
|
98357
98347
|
import { randomBytes as randomBytes16 } from "node:crypto";
|
|
98358
|
-
import { existsSync as existsSync125, mkdirSync as mkdirSync28, readFileSync as
|
|
98348
|
+
import { existsSync as existsSync125, mkdirSync as mkdirSync28, readFileSync as readFileSync91, statSync as statSync21, writeFileSync as writeFileSync21 } from "node:fs";
|
|
98359
98349
|
import { createRequire as createRequire12 } from "node:module";
|
|
98360
98350
|
import { join as join120 } from "node:path";
|
|
98361
98351
|
function readMachineKey() {
|
|
@@ -98366,7 +98356,7 @@ function readMachineKey() {
|
|
|
98366
98356
|
mkdirSync28(cleoHome, { recursive: true });
|
|
98367
98357
|
}
|
|
98368
98358
|
const key2 = randomBytes16(MACHINE_KEY_LENGTH);
|
|
98369
|
-
|
|
98359
|
+
writeFileSync21(keyPath, key2, { mode: 384 });
|
|
98370
98360
|
return key2;
|
|
98371
98361
|
}
|
|
98372
98362
|
if (process.platform !== "win32") {
|
|
@@ -98378,7 +98368,7 @@ function readMachineKey() {
|
|
|
98378
98368
|
);
|
|
98379
98369
|
}
|
|
98380
98370
|
}
|
|
98381
|
-
const key =
|
|
98371
|
+
const key = readFileSync91(keyPath);
|
|
98382
98372
|
if (key.length !== MACHINE_KEY_LENGTH) {
|
|
98383
98373
|
throw new Error(
|
|
98384
98374
|
`Machine key at ${keyPath} has wrong length: expected ${MACHINE_KEY_LENGTH} bytes, got ${key.length}.`
|
|
@@ -102620,13 +102610,19 @@ var init_registry5 = __esm({
|
|
|
102620
102610
|
tier: 0,
|
|
102621
102611
|
idempotent: false,
|
|
102622
102612
|
sessionRequired: true,
|
|
102623
|
-
requiredParams: ["
|
|
102613
|
+
requiredParams: ["taskId", "agentId"],
|
|
102624
102614
|
params: [
|
|
102625
102615
|
{
|
|
102626
|
-
name: "
|
|
102616
|
+
name: "taskId",
|
|
102627
102617
|
type: "string",
|
|
102628
102618
|
required: true,
|
|
102629
102619
|
description: "Task ID to claim"
|
|
102620
|
+
},
|
|
102621
|
+
{
|
|
102622
|
+
name: "agentId",
|
|
102623
|
+
type: "string",
|
|
102624
|
+
required: true,
|
|
102625
|
+
description: "Agent ID to assign the task to"
|
|
102630
102626
|
}
|
|
102631
102627
|
]
|
|
102632
102628
|
},
|
|
@@ -102638,10 +102634,10 @@ var init_registry5 = __esm({
|
|
|
102638
102634
|
tier: 0,
|
|
102639
102635
|
idempotent: false,
|
|
102640
102636
|
sessionRequired: true,
|
|
102641
|
-
requiredParams: ["
|
|
102637
|
+
requiredParams: ["taskId"],
|
|
102642
102638
|
params: [
|
|
102643
102639
|
{
|
|
102644
|
-
name: "
|
|
102640
|
+
name: "taskId",
|
|
102645
102641
|
type: "string",
|
|
102646
102642
|
required: true,
|
|
102647
102643
|
description: "Task ID to unclaim"
|
|
@@ -106261,7 +106257,7 @@ var init_pipeline_engine = __esm({
|
|
|
106261
106257
|
|
|
106262
106258
|
// packages/cleo/src/dispatch/engines/release-engine.ts
|
|
106263
106259
|
import { execFileSync as execFileSync14 } from "node:child_process";
|
|
106264
|
-
import { readFileSync as
|
|
106260
|
+
import { readFileSync as readFileSync92 } from "node:fs";
|
|
106265
106261
|
async function loadTasks2(projectRoot) {
|
|
106266
106262
|
const root = projectRoot ?? resolveProjectRoot();
|
|
106267
106263
|
try {
|
|
@@ -106512,7 +106508,7 @@ async function releaseShip(params, projectRoot) {
|
|
|
106512
106508
|
const changelogPath = `${cwd}/CHANGELOG.md`;
|
|
106513
106509
|
const cleanVersion = version2.replace(/^v/, "");
|
|
106514
106510
|
try {
|
|
106515
|
-
const changelogContent =
|
|
106511
|
+
const changelogContent = readFileSync92(changelogPath, "utf8");
|
|
106516
106512
|
if (!changelogContent.includes(`## [${cleanVersion}]`)) {
|
|
106517
106513
|
logStep(
|
|
106518
106514
|
4,
|
|
@@ -106766,7 +106762,7 @@ __export(system_engine_exports, {
|
|
|
106766
106762
|
systemSync: () => systemSync,
|
|
106767
106763
|
systemUncancel: () => systemUncancel
|
|
106768
106764
|
});
|
|
106769
|
-
import { existsSync as existsSync126, readdirSync as readdirSync40, readFileSync as
|
|
106765
|
+
import { existsSync as existsSync126, readdirSync as readdirSync40, readFileSync as readFileSync93 } from "node:fs";
|
|
106770
106766
|
import { basename as basename18, join as join121 } from "node:path";
|
|
106771
106767
|
async function systemDash(projectRoot, params) {
|
|
106772
106768
|
try {
|
|
@@ -107005,7 +107001,7 @@ function systemContext(projectRoot, params) {
|
|
|
107005
107001
|
} else {
|
|
107006
107002
|
const currentSessionPath = join121(cleoDir, ".current-session");
|
|
107007
107003
|
if (existsSync126(currentSessionPath)) {
|
|
107008
|
-
const currentSession2 =
|
|
107004
|
+
const currentSession2 = readFileSync93(currentSessionPath, "utf-8").trim();
|
|
107009
107005
|
if (currentSession2) {
|
|
107010
107006
|
const sessionFile = join121(
|
|
107011
107007
|
cleoDir,
|
|
@@ -107026,7 +107022,7 @@ function systemContext(projectRoot, params) {
|
|
|
107026
107022
|
for (const file2 of readdirSync40(statesDir)) {
|
|
107027
107023
|
if (file2.startsWith("context-state-") && file2.endsWith(".json")) {
|
|
107028
107024
|
try {
|
|
107029
|
-
const state = JSON.parse(
|
|
107025
|
+
const state = JSON.parse(readFileSync93(join121(statesDir, file2), "utf-8"));
|
|
107030
107026
|
sessions2.push({
|
|
107031
107027
|
file: basename18(file2),
|
|
107032
107028
|
sessionId: state.sessionId ?? null,
|
|
@@ -107042,7 +107038,7 @@ function systemContext(projectRoot, params) {
|
|
|
107042
107038
|
const singletonFile = join121(cleoDir, ".context-state.json");
|
|
107043
107039
|
if (existsSync126(singletonFile)) {
|
|
107044
107040
|
try {
|
|
107045
|
-
const state = JSON.parse(
|
|
107041
|
+
const state = JSON.parse(readFileSync93(singletonFile, "utf-8"));
|
|
107046
107042
|
sessions2.push({
|
|
107047
107043
|
file: ".context-state.json",
|
|
107048
107044
|
sessionId: state.sessionId ?? "global",
|
|
@@ -107069,7 +107065,7 @@ function systemContext(projectRoot, params) {
|
|
|
107069
107065
|
};
|
|
107070
107066
|
}
|
|
107071
107067
|
try {
|
|
107072
|
-
const state = JSON.parse(
|
|
107068
|
+
const state = JSON.parse(readFileSync93(stateFile, "utf-8"));
|
|
107073
107069
|
const timestamp2 = state.timestamp;
|
|
107074
107070
|
const staleMs = state.staleAfterMs ?? 5e3;
|
|
107075
107071
|
const percentage = state.contextWindow?.percentage ?? 0;
|
|
@@ -107224,7 +107220,7 @@ function systemCompliance(projectRoot, params) {
|
|
|
107224
107220
|
const compliancePath2 = join121(projectRoot, ".cleo", "metrics", "COMPLIANCE.jsonl");
|
|
107225
107221
|
let entries2 = [];
|
|
107226
107222
|
if (existsSync126(compliancePath2)) {
|
|
107227
|
-
const content =
|
|
107223
|
+
const content = readFileSync93(compliancePath2, "utf-8").trim();
|
|
107228
107224
|
if (content) {
|
|
107229
107225
|
entries2 = content.split("\n").filter((l) => l.trim()).map((l) => JSON.parse(l));
|
|
107230
107226
|
}
|
|
@@ -107291,7 +107287,7 @@ function systemCompliance(projectRoot, params) {
|
|
|
107291
107287
|
const compliancePath = join121(projectRoot, ".cleo", "metrics", "COMPLIANCE.jsonl");
|
|
107292
107288
|
let entries = [];
|
|
107293
107289
|
if (existsSync126(compliancePath)) {
|
|
107294
|
-
const content =
|
|
107290
|
+
const content = readFileSync93(compliancePath, "utf-8").trim();
|
|
107295
107291
|
if (content) {
|
|
107296
107292
|
entries = content.split("\n").filter((l) => l.trim()).map((l) => JSON.parse(l));
|
|
107297
107293
|
}
|
|
@@ -107437,9 +107433,9 @@ function systemSync(_projectRoot, params) {
|
|
|
107437
107433
|
}
|
|
107438
107434
|
};
|
|
107439
107435
|
}
|
|
107440
|
-
function systemSafestop(projectRoot, params) {
|
|
107436
|
+
async function systemSafestop(projectRoot, params) {
|
|
107441
107437
|
try {
|
|
107442
|
-
const result = safestop(projectRoot, params);
|
|
107438
|
+
const result = await safestop(projectRoot, params);
|
|
107443
107439
|
return { success: true, data: result };
|
|
107444
107440
|
} catch (err) {
|
|
107445
107441
|
return cleoErrorToEngineError(err, "E_GENERAL", "Sync failed");
|
|
@@ -108032,13 +108028,16 @@ async function taskDelete(projectRoot, taskId, force) {
|
|
|
108032
108028
|
return cleoErrorToEngineError(err, "E_NOT_INITIALIZED", "Task database not initialized");
|
|
108033
108029
|
}
|
|
108034
108030
|
}
|
|
108035
|
-
async function taskArchive(projectRoot, taskId, before) {
|
|
108031
|
+
async function taskArchive(projectRoot, taskId, before, opts) {
|
|
108036
108032
|
try {
|
|
108037
108033
|
const accessor = await getAccessor(projectRoot);
|
|
108034
|
+
const taskIds = opts?.taskIds ?? (taskId ? [taskId] : void 0);
|
|
108038
108035
|
const result = await archiveTasks(
|
|
108039
108036
|
{
|
|
108040
|
-
taskIds
|
|
108041
|
-
before
|
|
108037
|
+
taskIds,
|
|
108038
|
+
before,
|
|
108039
|
+
includeCancelled: opts?.includeCancelled,
|
|
108040
|
+
dryRun: opts?.dryRun
|
|
108042
108041
|
},
|
|
108043
108042
|
projectRoot,
|
|
108044
108043
|
accessor
|
|
@@ -109624,7 +109623,7 @@ var init_admin2 = __esm({
|
|
|
109624
109623
|
);
|
|
109625
109624
|
}
|
|
109626
109625
|
case "safestop": {
|
|
109627
|
-
const result = systemSafestop(
|
|
109626
|
+
const result = await systemSafestop(
|
|
109628
109627
|
projectRoot,
|
|
109629
109628
|
params
|
|
109630
109629
|
);
|
|
@@ -110222,7 +110221,9 @@ var init_check = __esm({
|
|
|
110222
110221
|
return wrapResult(result, "query", "check", operation, startTime);
|
|
110223
110222
|
}
|
|
110224
110223
|
case "archive.stats": {
|
|
110225
|
-
const result = await systemArchiveStats(projectRoot
|
|
110224
|
+
const result = await systemArchiveStats(projectRoot, {
|
|
110225
|
+
period: params?.period
|
|
110226
|
+
});
|
|
110226
110227
|
return wrapResult(result, "query", "check", operation, startTime);
|
|
110227
110228
|
}
|
|
110228
110229
|
// T5405: WarpChain validation
|
|
@@ -111740,7 +111741,7 @@ var init_nexus2 = __esm({
|
|
|
111740
111741
|
async function orchestrateClassify(request, context, projectRoot) {
|
|
111741
111742
|
try {
|
|
111742
111743
|
const { getCleoCantWorkflowsDir: getCleoCantWorkflowsDir2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
111743
|
-
const { readFileSync:
|
|
111744
|
+
const { readFileSync: readFileSync102, readdirSync: readdirSync42, existsSync: existsSync131 } = await import("node:fs");
|
|
111744
111745
|
const { join: join131 } = await import("node:path");
|
|
111745
111746
|
const workflowsDir = getCleoCantWorkflowsDir2();
|
|
111746
111747
|
const combined = `${request} ${context ?? ""}`.toLowerCase();
|
|
@@ -111749,7 +111750,7 @@ async function orchestrateClassify(request, context, projectRoot) {
|
|
|
111749
111750
|
const files = readdirSync42(workflowsDir).filter((f2) => f2.endsWith(".cant"));
|
|
111750
111751
|
for (const file2 of files) {
|
|
111751
111752
|
try {
|
|
111752
|
-
const src =
|
|
111753
|
+
const src = readFileSync102(join131(workflowsDir, file2), "utf-8");
|
|
111753
111754
|
const teamMatch = /^team\s+(\S+):/m.exec(src);
|
|
111754
111755
|
if (!teamMatch) continue;
|
|
111755
111756
|
const teamName = teamMatch[1];
|
|
@@ -111769,7 +111770,7 @@ async function orchestrateClassify(request, context, projectRoot) {
|
|
|
111769
111770
|
const files = readdirSync42(localCantDir).filter((f2) => f2.endsWith(".cant"));
|
|
111770
111771
|
for (const file2 of files) {
|
|
111771
111772
|
try {
|
|
111772
|
-
const src =
|
|
111773
|
+
const src = readFileSync102(join131(localCantDir, file2), "utf-8");
|
|
111773
111774
|
const teamMatch = /^team\s+(\S+):/m.exec(src);
|
|
111774
111775
|
if (!teamMatch) continue;
|
|
111775
111776
|
const teamName = teamMatch[1];
|
|
@@ -114270,7 +114271,12 @@ var init_tasks4 = __esm({
|
|
|
114270
114271
|
const result = await taskArchive(
|
|
114271
114272
|
projectRoot,
|
|
114272
114273
|
params?.taskId,
|
|
114273
|
-
params?.before
|
|
114274
|
+
params?.before,
|
|
114275
|
+
{
|
|
114276
|
+
taskIds: params?.taskIds,
|
|
114277
|
+
includeCancelled: params?.includeCancelled,
|
|
114278
|
+
dryRun: params?.dryRun
|
|
114279
|
+
}
|
|
114274
114280
|
);
|
|
114275
114281
|
return wrapResult(result, "mutate", "tasks", operation, startTime);
|
|
114276
114282
|
}
|
|
@@ -115657,7 +115663,7 @@ var init_defaults = __esm({
|
|
|
115657
115663
|
});
|
|
115658
115664
|
|
|
115659
115665
|
// packages/cleo/src/dispatch/lib/config-loader.ts
|
|
115660
|
-
import { existsSync as existsSync127, readFileSync as
|
|
115666
|
+
import { existsSync as existsSync127, readFileSync as readFileSync94 } from "fs";
|
|
115661
115667
|
import { join as join123 } from "path";
|
|
115662
115668
|
function loadFromEnv(key) {
|
|
115663
115669
|
const envKey = `${ENV_PREFIX}${key.toUpperCase()}`;
|
|
@@ -115684,7 +115690,7 @@ function loadFromFile(projectRoot) {
|
|
|
115684
115690
|
return {};
|
|
115685
115691
|
}
|
|
115686
115692
|
try {
|
|
115687
|
-
const content =
|
|
115693
|
+
const content = readFileSync94(configPath, "utf-8");
|
|
115688
115694
|
const config2 = JSON.parse(content);
|
|
115689
115695
|
const result = {};
|
|
115690
115696
|
if (config2.lifecycleEnforcement) {
|
|
@@ -116309,7 +116315,7 @@ var init_cli = __esm({
|
|
|
116309
116315
|
|
|
116310
116316
|
// packages/cleo/src/cli/index.ts
|
|
116311
116317
|
init_internal();
|
|
116312
|
-
import { readFileSync as
|
|
116318
|
+
import { readFileSync as readFileSync101 } from "node:fs";
|
|
116313
116319
|
import { dirname as dirname28, join as join130 } from "node:path";
|
|
116314
116320
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
116315
116321
|
|
|
@@ -117393,7 +117399,9 @@ var ADD_PARAMS = [
|
|
|
117393
117399
|
}
|
|
117394
117400
|
];
|
|
117395
117401
|
function registerAddCommand(program) {
|
|
117396
|
-
const cmd = program.command("add").description(
|
|
117402
|
+
const cmd = program.command("add").description(
|
|
117403
|
+
buildOperationHelp("tasks.add", "Create a new task (requires active session)", ADD_PARAMS)
|
|
117404
|
+
);
|
|
117397
117405
|
applyParamDefsToCommand(cmd, ADD_PARAMS, "tasks.add");
|
|
117398
117406
|
cmd.option("--add-phase", "Create new phase if it does not exist").option("--desc <desc>", "Task description (alias for --description)").option("--dry-run", "Show what would be created without making changes").action(async (title, opts) => {
|
|
117399
117407
|
const params = { title };
|
|
@@ -117465,7 +117473,7 @@ function registerAddCommand(program) {
|
|
|
117465
117473
|
// packages/cleo/src/cli/commands/add-batch.ts
|
|
117466
117474
|
init_cli();
|
|
117467
117475
|
init_renderers();
|
|
117468
|
-
import { readFileSync as
|
|
117476
|
+
import { readFileSync as readFileSync95 } from "node:fs";
|
|
117469
117477
|
function registerAddBatchCommand(program) {
|
|
117470
117478
|
program.command("add-batch").description("Create multiple tasks atomically from a JSON file").option("--file <path>", "Path to JSON file (array of task objects). Use - for stdin.").option("--parent <parentId>", "Default parent for all tasks (overridden by per-task parent)").option("--dry-run", "Preview what would be created without making changes").action(async (opts) => {
|
|
117471
117479
|
const filePath = opts["file"];
|
|
@@ -117479,7 +117487,7 @@ function registerAddBatchCommand(program) {
|
|
|
117479
117487
|
}
|
|
117480
117488
|
raw = Buffer.concat(chunks).toString("utf-8");
|
|
117481
117489
|
} else {
|
|
117482
|
-
raw =
|
|
117490
|
+
raw = readFileSync95(filePath, "utf-8");
|
|
117483
117491
|
}
|
|
117484
117492
|
let tasks2;
|
|
117485
117493
|
try {
|
|
@@ -117768,7 +117776,7 @@ function registerAgentCommand(program) {
|
|
|
117768
117776
|
transportConfig: {},
|
|
117769
117777
|
isActive: true
|
|
117770
117778
|
});
|
|
117771
|
-
const { existsSync: existsSync131, mkdirSync: mkdirSync31, writeFileSync:
|
|
117779
|
+
const { existsSync: existsSync131, mkdirSync: mkdirSync31, writeFileSync: writeFileSync24 } = await import("node:fs");
|
|
117772
117780
|
const { join: join131 } = await import("node:path");
|
|
117773
117781
|
const cantDir = join131(".cleo", "agents");
|
|
117774
117782
|
const cantPath = join131(cantDir, `${agentId}.cant`);
|
|
@@ -117824,7 +117832,7 @@ agent ${agentId}:
|
|
|
117824
117832
|
enforcement:
|
|
117825
117833
|
1: TODO \u2014 what does this agent push back on?
|
|
117826
117834
|
`;
|
|
117827
|
-
|
|
117835
|
+
writeFileSync24(cantPath, cantContent, "utf-8");
|
|
117828
117836
|
cantScaffolded = true;
|
|
117829
117837
|
}
|
|
117830
117838
|
cliOutput(
|
|
@@ -117913,7 +117921,7 @@ agent ${agentId}:
|
|
|
117913
117921
|
try {
|
|
117914
117922
|
const { AgentRegistryAccessor: AgentRegistryAccessor2, getDb: getDb4 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
117915
117923
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
117916
|
-
const { existsSync: existsSync131, readFileSync:
|
|
117924
|
+
const { existsSync: existsSync131, readFileSync: readFileSync102 } = await import("node:fs");
|
|
117917
117925
|
const { join: join131 } = await import("node:path");
|
|
117918
117926
|
await getDb4();
|
|
117919
117927
|
const registry2 = new AgentRegistryAccessor2(process.cwd());
|
|
@@ -117936,7 +117944,7 @@ agent ${agentId}:
|
|
|
117936
117944
|
let cantValidation = null;
|
|
117937
117945
|
const cantPath = opts["cant"] ?? join131(".cleo", "agents", `${agentId}.cant`);
|
|
117938
117946
|
if (existsSync131(cantPath)) {
|
|
117939
|
-
profile =
|
|
117947
|
+
profile = readFileSync102(cantPath, "utf-8");
|
|
117940
117948
|
try {
|
|
117941
117949
|
const cantModule = await import("@cleocode/cant");
|
|
117942
117950
|
const validate = "validate" in cantModule ? cantModule.validate : null;
|
|
@@ -118976,7 +118984,7 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
118976
118984
|
});
|
|
118977
118985
|
agent.command("install <path>").description("Install an agent from a .cantz archive or agent directory").option("--global", "Install to global tier (~/.local/share/cleo/cant/agents/)").action(async (sourcePath, opts) => {
|
|
118978
118986
|
try {
|
|
118979
|
-
const { existsSync: existsSync131, mkdirSync: mkdirSync31, cpSync, readFileSync:
|
|
118987
|
+
const { existsSync: existsSync131, mkdirSync: mkdirSync31, cpSync, readFileSync: readFileSync102, rmSync: rmSync3, statSync: statSync22 } = await import("node:fs");
|
|
118980
118988
|
const { join: join131, basename: basename19, resolve: resolve16 } = await import("node:path");
|
|
118981
118989
|
const { homedir: homedir7 } = await import("node:os");
|
|
118982
118990
|
const { tmpdir: tmpdir3 } = await import("node:os");
|
|
@@ -119095,7 +119103,7 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
119095
119103
|
}
|
|
119096
119104
|
let registered = false;
|
|
119097
119105
|
try {
|
|
119098
|
-
const persona =
|
|
119106
|
+
const persona = readFileSync102(join131(targetDir, "persona.cant"), "utf-8");
|
|
119099
119107
|
const descMatch = persona.match(/description:\s*"([^"]+)"/);
|
|
119100
119108
|
const displayName = descMatch?.[1] ?? agentName;
|
|
119101
119109
|
const { AgentRegistryAccessor: AgentRegistryAccessor2, getDb: getDb4 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
@@ -119236,7 +119244,7 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
119236
119244
|
});
|
|
119237
119245
|
agent.command("create").description("Scaffold a new agent package with persona.cant and manifest.json").requiredOption("--name <name>", "Agent name (kebab-case)").requiredOption("--role <role>", "Agent role: orchestrator, lead, worker, or docs-worker").option("--tier <tier>", "Agent tier: low, mid, or high (defaults based on role)").option("--team <teamName>", "Team this agent belongs to").option("--domain <description>", "Domain description for file permissions and context").option("--global", "Create in global tier (~/.local/share/cleo/cant/agents/)").option("--seed-brain", "Create expertise/mental-model-seed.md and seed a BRAIN observation").option("--parent <parentAgent>", "Parent agent name in the hierarchy").action(async (opts) => {
|
|
119238
119246
|
try {
|
|
119239
|
-
const { existsSync: existsSync131, mkdirSync: mkdirSync31, writeFileSync:
|
|
119247
|
+
const { existsSync: existsSync131, mkdirSync: mkdirSync31, writeFileSync: writeFileSync24 } = await import("node:fs");
|
|
119240
119248
|
const { join: join131 } = await import("node:path");
|
|
119241
119249
|
const { homedir: homedir7 } = await import("node:os");
|
|
119242
119250
|
const name2 = opts["name"];
|
|
@@ -119327,9 +119335,9 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
119327
119335
|
domain: domain2,
|
|
119328
119336
|
parent
|
|
119329
119337
|
});
|
|
119330
|
-
|
|
119338
|
+
writeFileSync24(join131(agentDir, "persona.cant"), personaContent, "utf-8");
|
|
119331
119339
|
const manifest = generateManifest2({ name: name2, role, tier, domain: domain2 });
|
|
119332
|
-
|
|
119340
|
+
writeFileSync24(
|
|
119333
119341
|
join131(agentDir, "manifest.json"),
|
|
119334
119342
|
`${JSON.stringify(manifest, null, 2)}
|
|
119335
119343
|
`,
|
|
@@ -119341,14 +119349,14 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
119341
119349
|
];
|
|
119342
119350
|
if (team) {
|
|
119343
119351
|
const teamConfigContent = generateTeamConfig(name2, role, team);
|
|
119344
|
-
|
|
119352
|
+
writeFileSync24(join131(agentDir, "team-config.cant"), teamConfigContent, "utf-8");
|
|
119345
119353
|
createdFiles.push(join131(agentDir, "team-config.cant"));
|
|
119346
119354
|
}
|
|
119347
119355
|
if (seedBrain) {
|
|
119348
119356
|
const expertiseDir = join131(agentDir, "expertise");
|
|
119349
119357
|
mkdirSync31(expertiseDir, { recursive: true });
|
|
119350
119358
|
const seedContent = generateMentalModelSeed(name2, role, domain2);
|
|
119351
|
-
|
|
119359
|
+
writeFileSync24(join131(expertiseDir, "mental-model-seed.md"), seedContent, "utf-8");
|
|
119352
119360
|
createdFiles.push(join131(expertiseDir, "mental-model-seed.md"));
|
|
119353
119361
|
try {
|
|
119354
119362
|
const { execFile: execFile9 } = await import("node:child_process");
|
|
@@ -119756,10 +119764,6 @@ function capitalizeFirst(str) {
|
|
|
119756
119764
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
119757
119765
|
}
|
|
119758
119766
|
|
|
119759
|
-
// packages/cleo/src/cli/commands/agents.ts
|
|
119760
|
-
function registerAgentsCommand(_program) {
|
|
119761
|
-
}
|
|
119762
|
-
|
|
119763
119767
|
// packages/cleo/src/cli/commands/analyze.ts
|
|
119764
119768
|
init_cli();
|
|
119765
119769
|
function registerAnalyzeCommand(program) {
|
|
@@ -119861,6 +119865,12 @@ function registerBackfillCommand(program) {
|
|
|
119861
119865
|
const dryRun = !!opts.dryRun;
|
|
119862
119866
|
const rollback = !!opts.rollback;
|
|
119863
119867
|
const taskIds = opts.tasks?.trim() ? opts.tasks.split(",").map((s3) => s3.trim()).filter(Boolean) : void 0;
|
|
119868
|
+
if (!dryRun && !rollback && !process.env["CLEO_NONINTERACTIVE"]) {
|
|
119869
|
+
console.log(
|
|
119870
|
+
"\u26A0 Backfill will modify tasks in-place. Run with --dry-run first to preview changes."
|
|
119871
|
+
);
|
|
119872
|
+
console.log(" Set CLEO_NONINTERACTIVE=1 or pass --dry-run to suppress this warning.\n");
|
|
119873
|
+
}
|
|
119864
119874
|
if (dryRun) {
|
|
119865
119875
|
console.log("[dry run] No changes will be made.\n");
|
|
119866
119876
|
}
|
|
@@ -120209,7 +120219,9 @@ async function promptPassphrase() {
|
|
|
120209
120219
|
}
|
|
120210
120220
|
function registerBackupCommand(program) {
|
|
120211
120221
|
const backup = program.command("backup").description("Add backup of todo files or list available backups");
|
|
120212
|
-
backup.command("add").alias("create").description(
|
|
120222
|
+
backup.command("add").alias("create").description(
|
|
120223
|
+
"Add a new backup of all CLEO data files (backup create is an alias for backup add)"
|
|
120224
|
+
).option("--destination <dir>", "Backup destination directory").option("--global", "Also snapshot global-tier databases (nexus.db)").action(async (opts) => {
|
|
120213
120225
|
await dispatchFromCli(
|
|
120214
120226
|
"mutate",
|
|
120215
120227
|
"admin",
|
|
@@ -120612,7 +120624,7 @@ function registerBrainCommand(program) {
|
|
|
120612
120624
|
init_cli();
|
|
120613
120625
|
function registerBriefingCommand(program) {
|
|
120614
120626
|
program.command("briefing").description(
|
|
120615
|
-
"
|
|
120627
|
+
"Session resume context: last handoff, current task, next tasks, bugs, blockers, epics, and memory. Use at session start to restore context."
|
|
120616
120628
|
).option("-s, --scope <scope>", "Scope filter (global or epic:T###)").option("--max-next <n>", "Maximum next tasks to show", "5").option("--max-bugs <n>", "Maximum bugs to show", "10").option("--max-blocked <n>", "Maximum blocked tasks to show", "10").option("--max-epics <n>", "Maximum active epics to show", "5").action(async (opts) => {
|
|
120617
120629
|
const scope = opts["scope"];
|
|
120618
120630
|
const maxNextTasks = parseInt(opts["maxNext"], 10);
|
|
@@ -120646,7 +120658,7 @@ var SEVERITY_MAP = {
|
|
|
120646
120658
|
};
|
|
120647
120659
|
var VALID_SEVERITIES = Object.keys(SEVERITY_MAP);
|
|
120648
120660
|
function registerBugCommand(program) {
|
|
120649
|
-
program.command("bug <title>").description("Create a bug report task with severity mapping").option("-s, --severity <level>", "Severity level (P0, P1, P2, P3) - required", "P2").option("-e, --epic <id>", "Epic ID to link as parent (optional)").option("-d, --description <desc>", "Bug description").option("--dry-run", "Show what would be created without making changes").action(async (title, opts) => {
|
|
120661
|
+
program.command("bug <title>").description("Create a bug report task with severity mapping (requires active session)").option("-s, --severity <level>", "Severity level (P0, P1, P2, P3) - required", "P2").option("-e, --epic <id>", "Epic ID to link as parent (optional)").option("-d, --description <desc>", "Bug description").option("--dry-run", "Show what would be created without making changes").action(async (title, opts) => {
|
|
120650
120662
|
const severity = opts["severity"] || "P2";
|
|
120651
120663
|
if (!VALID_SEVERITIES.includes(severity)) {
|
|
120652
120664
|
console.error(
|
|
@@ -120711,7 +120723,7 @@ function registerCancelCommand(program) {
|
|
|
120711
120723
|
|
|
120712
120724
|
// packages/cleo/src/cli/commands/cant.ts
|
|
120713
120725
|
init_renderers();
|
|
120714
|
-
import { existsSync as existsSync128, mkdirSync as mkdirSync29, readFileSync as
|
|
120726
|
+
import { existsSync as existsSync128, mkdirSync as mkdirSync29, readFileSync as readFileSync96, writeFileSync as writeFileSync22 } from "node:fs";
|
|
120715
120727
|
import { dirname as dirname25, isAbsolute as isAbsolute3, join as join124, resolve as resolve15 } from "node:path";
|
|
120716
120728
|
function registerCantCommand(program) {
|
|
120717
120729
|
const cant = program.command("cant").description("CANT DSL tooling");
|
|
@@ -120789,7 +120801,7 @@ function registerCantCommand(program) {
|
|
|
120789
120801
|
}
|
|
120790
120802
|
try {
|
|
120791
120803
|
const mod = await loadMigrateEngine();
|
|
120792
|
-
const content =
|
|
120804
|
+
const content = readFileSync96(filePath, "utf-8");
|
|
120793
120805
|
const result = mod.migrateMarkdown(content, filePath, {
|
|
120794
120806
|
write: isWrite,
|
|
120795
120807
|
verbose: isVerbose,
|
|
@@ -120805,7 +120817,7 @@ function registerCantCommand(program) {
|
|
|
120805
120817
|
for (const outputFile of result.outputFiles) {
|
|
120806
120818
|
const outputPath = isAbsolute3(outputFile.path) ? outputFile.path : join124(projectRoot, outputFile.path);
|
|
120807
120819
|
mkdirSync29(dirname25(outputPath), { recursive: true });
|
|
120808
|
-
|
|
120820
|
+
writeFileSync22(outputPath, outputFile.content, "utf-8");
|
|
120809
120821
|
written++;
|
|
120810
120822
|
if (isVerbose) {
|
|
120811
120823
|
console.log(` Created: ${outputFile.path} (${outputFile.kind})`);
|
|
@@ -120882,7 +120894,7 @@ async function loadMigrateEngine() {
|
|
|
120882
120894
|
|
|
120883
120895
|
// packages/cleo/src/cli/commands/chain.ts
|
|
120884
120896
|
init_cli();
|
|
120885
|
-
import { readFileSync as
|
|
120897
|
+
import { readFileSync as readFileSync97 } from "node:fs";
|
|
120886
120898
|
function registerChainCommand(program) {
|
|
120887
120899
|
const chain = program.command("chain").description("WarpChain pipeline management (tier-2 orchestrator)");
|
|
120888
120900
|
chain.command("show <chainId>").description("Show details for a WarpChain definition").action(async (chainId) => {
|
|
@@ -120892,7 +120904,7 @@ function registerChainCommand(program) {
|
|
|
120892
120904
|
await dispatchFromCli("query", "pipeline", "chain.list", {}, { command: "chain" });
|
|
120893
120905
|
});
|
|
120894
120906
|
chain.command("add <file>").description("Add a new WarpChain definition from a JSON file").action(async (file2) => {
|
|
120895
|
-
const chainJson = JSON.parse(
|
|
120907
|
+
const chainJson = JSON.parse(readFileSync97(file2, "utf-8"));
|
|
120896
120908
|
await dispatchFromCli(
|
|
120897
120909
|
"mutate",
|
|
120898
120910
|
"pipeline",
|
|
@@ -120961,10 +120973,10 @@ function registerCheckCommand(program) {
|
|
|
120961
120973
|
);
|
|
120962
120974
|
});
|
|
120963
120975
|
check2.command("chain-validate <file>").description("Validate a WarpChain definition from a JSON file").action(async (file2) => {
|
|
120964
|
-
const { readFileSync:
|
|
120976
|
+
const { readFileSync: readFileSync102 } = await import("node:fs");
|
|
120965
120977
|
let chain;
|
|
120966
120978
|
try {
|
|
120967
|
-
chain = JSON.parse(
|
|
120979
|
+
chain = JSON.parse(readFileSync102(file2, "utf8"));
|
|
120968
120980
|
} catch (err) {
|
|
120969
120981
|
const message = err instanceof Error ? err.message : String(err);
|
|
120970
120982
|
console.error(`Failed to read or parse chain file: ${message}`);
|
|
@@ -121132,13 +121144,13 @@ function registerCheckpointCommand(program) {
|
|
|
121132
121144
|
// packages/cleo/src/cli/commands/claim.ts
|
|
121133
121145
|
init_cli();
|
|
121134
121146
|
function registerClaimCommand(program) {
|
|
121135
|
-
program.command("claim <taskId>").description("Claim a task by assigning it to an agent").
|
|
121147
|
+
program.command("claim <taskId>").description("Claim a task by assigning it to an agent").requiredOption("--agent <agentId>", "Agent ID to assign the task to").action(async (taskId, opts) => {
|
|
121136
121148
|
await dispatchFromCli(
|
|
121137
121149
|
"mutate",
|
|
121138
121150
|
"tasks",
|
|
121139
121151
|
"claim",
|
|
121140
121152
|
{
|
|
121141
|
-
|
|
121153
|
+
taskId,
|
|
121142
121154
|
agentId: opts["agent"]
|
|
121143
121155
|
},
|
|
121144
121156
|
{ command: "claim", operation: "tasks.claim" }
|
|
@@ -121151,7 +121163,7 @@ function registerUnclaimCommand(program) {
|
|
|
121151
121163
|
"mutate",
|
|
121152
121164
|
"tasks",
|
|
121153
121165
|
"unclaim",
|
|
121154
|
-
{
|
|
121166
|
+
{ taskId },
|
|
121155
121167
|
{ command: "unclaim", operation: "tasks.unclaim" }
|
|
121156
121168
|
);
|
|
121157
121169
|
});
|
|
@@ -121160,7 +121172,9 @@ function registerUnclaimCommand(program) {
|
|
|
121160
121172
|
// packages/cleo/src/cli/commands/commands.ts
|
|
121161
121173
|
init_cli();
|
|
121162
121174
|
function registerCommandsCommand(program) {
|
|
121163
|
-
program.command("commands [command]").description(
|
|
121175
|
+
program.command("commands [command]").description(
|
|
121176
|
+
"DEPRECATED: Use `cleo ops` instead. List and query available CLEO commands (delegates to admin help)"
|
|
121177
|
+
).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) => {
|
|
121164
121178
|
console.error(
|
|
121165
121179
|
"[DEPRECATED] cleo commands now delegates to admin.help.\nUse: cleo help (CLI)\n"
|
|
121166
121180
|
);
|
|
@@ -121220,7 +121234,13 @@ var COMPLETE_PARAMS = [
|
|
|
121220
121234
|
}
|
|
121221
121235
|
];
|
|
121222
121236
|
function registerCompleteCommand(program) {
|
|
121223
|
-
const cmd = program.command("complete").alias("done").description(
|
|
121237
|
+
const cmd = program.command("complete").alias("done").description(
|
|
121238
|
+
buildOperationHelp(
|
|
121239
|
+
"tasks.complete",
|
|
121240
|
+
"Mark a task as completed (requires active session)",
|
|
121241
|
+
COMPLETE_PARAMS
|
|
121242
|
+
)
|
|
121243
|
+
);
|
|
121224
121244
|
applyParamDefsToCommand(cmd, COMPLETE_PARAMS, "tasks.complete");
|
|
121225
121245
|
cmd.action(async (taskId, opts) => {
|
|
121226
121246
|
const response = await dispatchRaw("mutate", "tasks", "complete", {
|
|
@@ -121431,7 +121451,9 @@ function registerConfigCommand(program) {
|
|
|
121431
121451
|
// packages/cleo/src/cli/commands/consensus.ts
|
|
121432
121452
|
init_cli();
|
|
121433
121453
|
function registerConsensusCommand(program) {
|
|
121434
|
-
const consensus = program.command("consensus").description(
|
|
121454
|
+
const consensus = program.command("consensus").description(
|
|
121455
|
+
"Validate consensus protocol compliance (alias for `cleo check protocol consensus`)"
|
|
121456
|
+
);
|
|
121435
121457
|
consensus.command("validate <taskId>").description("Validate consensus protocol compliance for task").option("--strict", "Exit with error code on violations").option("--voting-matrix <file>", "Path to voting matrix JSON file").action(async (taskId, opts) => {
|
|
121436
121458
|
await dispatchFromCli(
|
|
121437
121459
|
"query",
|
|
@@ -121480,7 +121502,7 @@ function registerContextCommand(program) {
|
|
|
121480
121502
|
{ command: "context" }
|
|
121481
121503
|
);
|
|
121482
121504
|
});
|
|
121483
|
-
context.command("check").description("
|
|
121505
|
+
context.command("check").description("Show context window state (same as status)").option("--session <id>", "Check specific CLEO session").action(async (opts) => {
|
|
121484
121506
|
await dispatchFromCli(
|
|
121485
121507
|
"query",
|
|
121486
121508
|
"admin",
|
|
@@ -121492,7 +121514,7 @@ function registerContextCommand(program) {
|
|
|
121492
121514
|
{ command: "context" }
|
|
121493
121515
|
);
|
|
121494
121516
|
});
|
|
121495
|
-
context.command("list").description("
|
|
121517
|
+
context.command("list").description("Show context window state including all sessions").action(async () => {
|
|
121496
121518
|
await dispatchFromCli(
|
|
121497
121519
|
"query",
|
|
121498
121520
|
"admin",
|
|
@@ -121508,7 +121530,9 @@ function registerContextCommand(program) {
|
|
|
121508
121530
|
// packages/cleo/src/cli/commands/contribution.ts
|
|
121509
121531
|
init_cli();
|
|
121510
121532
|
function registerContributionCommand(program) {
|
|
121511
|
-
const contribution = program.command("contribution").description(
|
|
121533
|
+
const contribution = program.command("contribution").description(
|
|
121534
|
+
"Validate contribution protocol compliance (alias for `cleo check protocol contribution`)"
|
|
121535
|
+
);
|
|
121512
121536
|
contribution.command("validate <taskId>").description("Validate contribution protocol compliance for task").option("--strict", "Exit with error code on violations").action(async (taskId, opts) => {
|
|
121513
121537
|
await dispatchFromCli(
|
|
121514
121538
|
"query",
|
|
@@ -121542,7 +121566,9 @@ function registerContributionCommand(program) {
|
|
|
121542
121566
|
// packages/cleo/src/cli/commands/current.ts
|
|
121543
121567
|
init_cli();
|
|
121544
121568
|
function registerCurrentCommand(program) {
|
|
121545
|
-
program.command("current").description(
|
|
121569
|
+
program.command("current").description(
|
|
121570
|
+
"Show the current task being worked on. Returns: {currentTask: string|null, currentPhase: string|null}"
|
|
121571
|
+
).action(async () => {
|
|
121546
121572
|
await dispatchFromCli("query", "tasks", "current", {}, { command: "current" });
|
|
121547
121573
|
});
|
|
121548
121574
|
}
|
|
@@ -121550,15 +121576,25 @@ function registerCurrentCommand(program) {
|
|
|
121550
121576
|
// packages/cleo/src/cli/commands/dash.ts
|
|
121551
121577
|
init_cli();
|
|
121552
121578
|
function registerDashCommand(program) {
|
|
121553
|
-
program.command("dash").description(
|
|
121554
|
-
|
|
121579
|
+
program.command("dash").description(
|
|
121580
|
+
"Project health dashboard: status summary, phase progress, recent activity, high priority tasks. Use for overall project status."
|
|
121581
|
+
).option("--blocked-limit <n>", "Max blocked tasks to show", parseInt).action(async (opts) => {
|
|
121582
|
+
await dispatchFromCli(
|
|
121583
|
+
"query",
|
|
121584
|
+
"admin",
|
|
121585
|
+
"dash",
|
|
121586
|
+
{ blockedTasksLimit: opts["blockedLimit"] },
|
|
121587
|
+
{ command: "dash" }
|
|
121588
|
+
);
|
|
121555
121589
|
});
|
|
121556
121590
|
}
|
|
121557
121591
|
|
|
121558
121592
|
// packages/cleo/src/cli/commands/decomposition.ts
|
|
121559
121593
|
init_cli();
|
|
121560
121594
|
function registerDecompositionCommand(program) {
|
|
121561
|
-
const decomposition = program.command("decomposition").description(
|
|
121595
|
+
const decomposition = program.command("decomposition").description(
|
|
121596
|
+
"Validate decomposition protocol compliance (alias for `cleo check protocol decomposition`)"
|
|
121597
|
+
);
|
|
121562
121598
|
decomposition.command("validate <taskId>").description("Validate decomposition protocol compliance for task").option("--strict", "Exit with error code on violations").option("--epic <id>", "Specify parent epic ID").action(async (taskId, opts) => {
|
|
121563
121599
|
await dispatchFromCli(
|
|
121564
121600
|
"query",
|
|
@@ -121722,7 +121758,7 @@ function registerDetectCommand(program) {
|
|
|
121722
121758
|
// packages/cleo/src/cli/commands/detect-drift.ts
|
|
121723
121759
|
init_src();
|
|
121724
121760
|
init_renderers();
|
|
121725
|
-
import { existsSync as existsSync129, readdirSync as readdirSync41, readFileSync as
|
|
121761
|
+
import { existsSync as existsSync129, readdirSync as readdirSync41, readFileSync as readFileSync98 } from "node:fs";
|
|
121726
121762
|
import { dirname as dirname26, join as join125 } from "node:path";
|
|
121727
121763
|
function findProjectRoot() {
|
|
121728
121764
|
let currentDir = process.cwd();
|
|
@@ -121739,10 +121775,11 @@ function findProjectRoot() {
|
|
|
121739
121775
|
function registerDetectDriftCommand(program) {
|
|
121740
121776
|
program.command("detect-drift").description("Detect documentation drift against TypeScript source of truth").action(async () => {
|
|
121741
121777
|
const projectRoot = findProjectRoot();
|
|
121742
|
-
const isCleoRepo = existsSync129(join125(projectRoot, "
|
|
121778
|
+
const isCleoRepo = existsSync129(join125(projectRoot, "packages", "cleo", "src"));
|
|
121779
|
+
const cleoSrcRoot = isCleoRepo ? join125(projectRoot, "packages", "cleo", "src") : join125(projectRoot, "src");
|
|
121743
121780
|
const safeRead = (filePath) => {
|
|
121744
121781
|
try {
|
|
121745
|
-
return
|
|
121782
|
+
return readFileSync98(filePath, "utf-8");
|
|
121746
121783
|
} catch {
|
|
121747
121784
|
return "";
|
|
121748
121785
|
}
|
|
@@ -121805,17 +121842,17 @@ function registerDetectDriftCommand(program) {
|
|
|
121805
121842
|
}
|
|
121806
121843
|
};
|
|
121807
121844
|
try {
|
|
121808
|
-
const specPath = join125(projectRoot, "docs", "specs", "CLEO-
|
|
121809
|
-
const registryPath = join125(
|
|
121810
|
-
const dispatchDomainsDir = join125(
|
|
121845
|
+
const specPath = join125(projectRoot, "docs", "specs", "CLEO-OPERATION-CONSTITUTION.md");
|
|
121846
|
+
const registryPath = join125(cleoSrcRoot, "dispatch", "registry.ts");
|
|
121847
|
+
const dispatchDomainsDir = join125(cleoSrcRoot, "dispatch", "domains");
|
|
121811
121848
|
if (!existsSync129(specPath)) {
|
|
121812
|
-
addCheck("Gateway-to-spec sync", "fail", "CLEO-
|
|
121849
|
+
addCheck("Gateway-to-spec sync", "fail", "CLEO-OPERATION-CONSTITUTION.md missing", [
|
|
121813
121850
|
{
|
|
121814
121851
|
severity: "error",
|
|
121815
121852
|
category: "spec",
|
|
121816
121853
|
message: "Operations reference specification not found",
|
|
121817
121854
|
file: specPath,
|
|
121818
|
-
recommendation: "Create docs/specs/CLEO-
|
|
121855
|
+
recommendation: "Create docs/specs/CLEO-OPERATION-CONSTITUTION.md with canonical operation definitions"
|
|
121819
121856
|
}
|
|
121820
121857
|
]);
|
|
121821
121858
|
} else if (!existsSync129(registryPath) || !existsSync129(dispatchDomainsDir)) {
|
|
@@ -121825,7 +121862,7 @@ function registerDetectDriftCommand(program) {
|
|
|
121825
121862
|
category: "implementation",
|
|
121826
121863
|
message: "Dispatch registry or domains directory not found",
|
|
121827
121864
|
file: registryPath,
|
|
121828
|
-
recommendation: "Verify src/dispatch/registry.ts and src/dispatch/domains/ exist"
|
|
121865
|
+
recommendation: "Verify packages/cleo/src/dispatch/registry.ts and packages/cleo/src/dispatch/domains/ exist"
|
|
121829
121866
|
}
|
|
121830
121867
|
]);
|
|
121831
121868
|
} else {
|
|
@@ -121882,14 +121919,14 @@ function registerDetectDriftCommand(program) {
|
|
|
121882
121919
|
]);
|
|
121883
121920
|
}
|
|
121884
121921
|
try {
|
|
121885
|
-
const cliDir = join125(
|
|
121886
|
-
const coreDir = join125(projectRoot, "src", "core");
|
|
121922
|
+
const cliDir = join125(cleoSrcRoot, "cli", "commands");
|
|
121923
|
+
const coreDir = isCleoRepo ? join125(projectRoot, "packages", "core", "src") : join125(projectRoot, "src", "core");
|
|
121887
121924
|
if (!existsSync129(cliDir)) {
|
|
121888
121925
|
addCheck("CLI-to-core sync", "fail", "CLI commands directory missing", [
|
|
121889
121926
|
{
|
|
121890
121927
|
severity: "error",
|
|
121891
121928
|
category: "structure",
|
|
121892
|
-
message:
|
|
121929
|
+
message: `${cliDir} directory not found`,
|
|
121893
121930
|
recommendation: "Verify TypeScript source structure is intact"
|
|
121894
121931
|
}
|
|
121895
121932
|
]);
|
|
@@ -121898,7 +121935,7 @@ function registerDetectDriftCommand(program) {
|
|
|
121898
121935
|
{
|
|
121899
121936
|
severity: "error",
|
|
121900
121937
|
category: "structure",
|
|
121901
|
-
message:
|
|
121938
|
+
message: `${coreDir} directory not found`,
|
|
121902
121939
|
recommendation: "Verify TypeScript source structure is intact"
|
|
121903
121940
|
}
|
|
121904
121941
|
]);
|
|
@@ -121912,13 +121949,13 @@ function registerDetectDriftCommand(program) {
|
|
|
121912
121949
|
addCheck("CLI-to-core sync", "fail", `Error: ${getErrorMessage(e)}`);
|
|
121913
121950
|
}
|
|
121914
121951
|
try {
|
|
121915
|
-
const domainsDir = join125(
|
|
121952
|
+
const domainsDir = join125(cleoSrcRoot, "dispatch", "domains");
|
|
121916
121953
|
if (!existsSync129(domainsDir)) {
|
|
121917
121954
|
addCheck("Domain handler coverage", "fail", "Dispatch domains directory missing", [
|
|
121918
121955
|
{
|
|
121919
121956
|
severity: "error",
|
|
121920
121957
|
category: "structure",
|
|
121921
|
-
message:
|
|
121958
|
+
message: `${domainsDir} not found`,
|
|
121922
121959
|
recommendation: "Verify dispatch domain handlers are in place"
|
|
121923
121960
|
}
|
|
121924
121961
|
]);
|
|
@@ -121930,13 +121967,13 @@ function registerDetectDriftCommand(program) {
|
|
|
121930
121967
|
addCheck("Domain handler coverage", "fail", `Error: ${getErrorMessage(e)}`);
|
|
121931
121968
|
}
|
|
121932
121969
|
try {
|
|
121933
|
-
const matrixPath = join125(
|
|
121970
|
+
const matrixPath = join125(cleoSrcRoot, "dispatch", "lib", "capability-matrix.ts");
|
|
121934
121971
|
if (!existsSync129(matrixPath)) {
|
|
121935
121972
|
addCheck("Capability matrix", "fail", "Capability matrix missing", [
|
|
121936
121973
|
{
|
|
121937
121974
|
severity: "error",
|
|
121938
121975
|
category: "configuration",
|
|
121939
|
-
message:
|
|
121976
|
+
message: `${matrixPath} not found`,
|
|
121940
121977
|
recommendation: "Create capability matrix to document supported operations"
|
|
121941
121978
|
}
|
|
121942
121979
|
]);
|
|
@@ -122068,14 +122105,14 @@ function registerDetectDriftCommand(program) {
|
|
|
122068
122105
|
addCheck("Agent injection", "fail", `Error: ${getErrorMessage(e)}`);
|
|
122069
122106
|
}
|
|
122070
122107
|
try {
|
|
122071
|
-
const exitCodesPath = join125(
|
|
122108
|
+
const exitCodesPath = join125(cleoSrcRoot, "dispatch", "lib", "exit-codes.ts");
|
|
122072
122109
|
if (!existsSync129(exitCodesPath)) {
|
|
122073
122110
|
addCheck("Exit codes", "fail", "Exit codes definition missing", [
|
|
122074
122111
|
{
|
|
122075
122112
|
severity: "error",
|
|
122076
122113
|
category: "protocol",
|
|
122077
|
-
message:
|
|
122078
|
-
recommendation: "Create exit codes
|
|
122114
|
+
message: `${exitCodesPath} not found`,
|
|
122115
|
+
recommendation: "Create exit codes definition for CLI protocol compliance"
|
|
122079
122116
|
}
|
|
122080
122117
|
]);
|
|
122081
122118
|
} else {
|
|
@@ -122088,7 +122125,6 @@ function registerDetectDriftCommand(program) {
|
|
|
122088
122125
|
}
|
|
122089
122126
|
if (result.summary.errors > 0) {
|
|
122090
122127
|
result.recommendations.push("Address all ERROR-level issues before proceeding");
|
|
122091
|
-
result.recommendations.push("Run cleo detect-drift --json for structured output");
|
|
122092
122128
|
}
|
|
122093
122129
|
if (result.summary.warnings > 0) {
|
|
122094
122130
|
result.recommendations.push("Review WARNING-level issues for documentation improvements");
|
|
@@ -122547,7 +122583,7 @@ function registerExportTasksCommand(program) {
|
|
|
122547
122583
|
program.command("export-tasks [taskIds...]").description("Export tasks to portable .cleo-export.json package for cross-project transfer").option("-o, --output <file>", "Output file path (stdout if omitted)").option("--subtree", "Include all descendants of specified task(s)").option("--filter <filters...>", "Filter tasks by criteria (key=value, repeatable)").option("--include-deps", "Auto-include task dependencies").option("--dry-run", "Preview selection without creating export file").action(async (taskIds, opts) => {
|
|
122548
122584
|
const hasOutput = !!opts["output"];
|
|
122549
122585
|
const params = {
|
|
122550
|
-
taskIds: taskIds.length > 0 ? taskIds : void 0,
|
|
122586
|
+
taskIds: taskIds && taskIds.length > 0 ? taskIds : void 0,
|
|
122551
122587
|
output: opts["output"],
|
|
122552
122588
|
subtree: opts["subtree"],
|
|
122553
122589
|
filter: opts["filter"],
|
|
@@ -122587,7 +122623,7 @@ var FIND_PARAMS = [
|
|
|
122587
122623
|
name: "query",
|
|
122588
122624
|
type: "string",
|
|
122589
122625
|
required: false,
|
|
122590
|
-
description: "
|
|
122626
|
+
description: "Search text (required unless --id is provided)",
|
|
122591
122627
|
cli: { positional: true }
|
|
122592
122628
|
},
|
|
122593
122629
|
{
|
|
@@ -122616,7 +122652,7 @@ var FIND_PARAMS = [
|
|
|
122616
122652
|
name: "field",
|
|
122617
122653
|
type: "string",
|
|
122618
122654
|
required: false,
|
|
122619
|
-
description: "Field to search in (title
|
|
122655
|
+
description: "Field to search in (title|description|notes|id)",
|
|
122620
122656
|
cli: { flag: "in" }
|
|
122621
122657
|
},
|
|
122622
122658
|
{
|
|
@@ -122701,12 +122737,12 @@ init_src();
|
|
|
122701
122737
|
init_src2();
|
|
122702
122738
|
init_renderers();
|
|
122703
122739
|
import { execFileSync as execFileSync16 } from "node:child_process";
|
|
122704
|
-
import { existsSync as existsSync130, mkdirSync as mkdirSync30, readFileSync as
|
|
122740
|
+
import { existsSync as existsSync130, mkdirSync as mkdirSync30, readFileSync as readFileSync99, writeFileSync as writeFileSync23 } from "node:fs";
|
|
122705
122741
|
import { dirname as dirname27, join as join127 } from "node:path";
|
|
122706
122742
|
function getChangelogSource(cwd) {
|
|
122707
122743
|
const configPath = getConfigPath(cwd);
|
|
122708
122744
|
try {
|
|
122709
|
-
const config2 = JSON.parse(
|
|
122745
|
+
const config2 = JSON.parse(readFileSync99(configPath, "utf-8"));
|
|
122710
122746
|
return config2?.release?.changelog?.source ?? "CHANGELOG.md";
|
|
122711
122747
|
} catch {
|
|
122712
122748
|
return "CHANGELOG.md";
|
|
@@ -122715,7 +122751,7 @@ function getChangelogSource(cwd) {
|
|
|
122715
122751
|
function getEnabledPlatforms(cwd) {
|
|
122716
122752
|
const configPath = getConfigPath(cwd);
|
|
122717
122753
|
try {
|
|
122718
|
-
const config2 = JSON.parse(
|
|
122754
|
+
const config2 = JSON.parse(readFileSync99(configPath, "utf-8"));
|
|
122719
122755
|
const outputs = config2?.release?.changelog?.outputs ?? [];
|
|
122720
122756
|
return outputs.filter((o) => o.enabled);
|
|
122721
122757
|
} catch {
|
|
@@ -122844,7 +122880,7 @@ function registerGenerateChangelogCommand(program) {
|
|
|
122844
122880
|
if (!existsSync130(sourcePath)) {
|
|
122845
122881
|
throw new CleoError(4 /* NOT_FOUND */, `Changelog source not found: ${sourcePath}`);
|
|
122846
122882
|
}
|
|
122847
|
-
const sourceContent =
|
|
122883
|
+
const sourceContent = readFileSync99(sourcePath, "utf-8");
|
|
122848
122884
|
const repoSlug = getGitHubRepoSlug();
|
|
122849
122885
|
const results = [];
|
|
122850
122886
|
if (targetPlatform) {
|
|
@@ -122855,7 +122891,7 @@ function registerGenerateChangelogCommand(program) {
|
|
|
122855
122891
|
if (!dryRun) {
|
|
122856
122892
|
const fullPath = join127(getProjectRoot(), outputPath);
|
|
122857
122893
|
mkdirSync30(dirname27(fullPath), { recursive: true });
|
|
122858
|
-
|
|
122894
|
+
writeFileSync23(fullPath, content, "utf-8");
|
|
122859
122895
|
}
|
|
122860
122896
|
results.push({ platform: targetPlatform, path: outputPath, written: !dryRun });
|
|
122861
122897
|
} else {
|
|
@@ -122876,7 +122912,7 @@ function registerGenerateChangelogCommand(program) {
|
|
|
122876
122912
|
if (!dryRun) {
|
|
122877
122913
|
const fullPath = join127(getProjectRoot(), platformConfig.path);
|
|
122878
122914
|
mkdirSync30(dirname27(fullPath), { recursive: true });
|
|
122879
|
-
|
|
122915
|
+
writeFileSync23(fullPath, content, "utf-8");
|
|
122880
122916
|
}
|
|
122881
122917
|
results.push({
|
|
122882
122918
|
platform: platformConfig.platform,
|
|
@@ -122940,7 +122976,9 @@ function registerHistoryCommand(program) {
|
|
|
122940
122976
|
// packages/cleo/src/cli/commands/implementation.ts
|
|
122941
122977
|
init_cli();
|
|
122942
122978
|
function registerImplementationCommand(program) {
|
|
122943
|
-
const implementation = program.command("implementation").description(
|
|
122979
|
+
const implementation = program.command("implementation").description(
|
|
122980
|
+
"Validate implementation protocol compliance (alias for `cleo check protocol implementation`)"
|
|
122981
|
+
);
|
|
122944
122982
|
implementation.command("validate <taskId>").description("Validate implementation protocol compliance for task").option("--strict", "Exit with error code on violations").action(async (taskId, opts) => {
|
|
122945
122983
|
await dispatchFromCli(
|
|
122946
122984
|
"query",
|
|
@@ -123143,7 +123181,7 @@ function registerLabelsCommand(program) {
|
|
|
123143
123181
|
await dispatchFromCli("query", "tasks", "label.list", {}, { command: "labels" });
|
|
123144
123182
|
});
|
|
123145
123183
|
labels.command("show <label>").description("Show tasks with specific label").action(async (label) => {
|
|
123146
|
-
await dispatchFromCli("query", "tasks", "
|
|
123184
|
+
await dispatchFromCli("query", "tasks", "list", { label }, { command: "labels" });
|
|
123147
123185
|
});
|
|
123148
123186
|
labels.command("stats").description("Show detailed label statistics").action(async () => {
|
|
123149
123187
|
await dispatchFromCli("query", "tasks", "label.list", {}, { command: "labels" });
|
|
@@ -123166,7 +123204,9 @@ function registerLifecycleCommand(program) {
|
|
|
123166
123204
|
{ command: "lifecycle" }
|
|
123167
123205
|
);
|
|
123168
123206
|
});
|
|
123169
|
-
lifecycle.command("start <epicId> <stage>").description(
|
|
123207
|
+
lifecycle.command("start <epicId> <stage>").description(
|
|
123208
|
+
"Start a lifecycle stage. Valid stages: research|consensus|architecture_decision|specification|decomposition|implementation|validation|testing|release|contribution"
|
|
123209
|
+
).action(async (epicId, stage) => {
|
|
123170
123210
|
await dispatchFromCli(
|
|
123171
123211
|
"mutate",
|
|
123172
123212
|
"pipeline",
|
|
@@ -123179,7 +123219,9 @@ function registerLifecycleCommand(program) {
|
|
|
123179
123219
|
{ command: "lifecycle" }
|
|
123180
123220
|
);
|
|
123181
123221
|
});
|
|
123182
|
-
lifecycle.command("complete <epicId> <stage>").description(
|
|
123222
|
+
lifecycle.command("complete <epicId> <stage>").description(
|
|
123223
|
+
"Complete a lifecycle stage. Valid stages: research|consensus|architecture_decision|specification|decomposition|implementation|validation|testing|release|contribution"
|
|
123224
|
+
).option("--artifacts <artifacts>", "Comma-separated artifact paths").option("--notes <notes>", "Completion notes").action(async (epicId, stage, opts) => {
|
|
123183
123225
|
await dispatchFromCli(
|
|
123184
123226
|
"mutate",
|
|
123185
123227
|
"pipeline",
|
|
@@ -123193,7 +123235,9 @@ function registerLifecycleCommand(program) {
|
|
|
123193
123235
|
{ command: "lifecycle" }
|
|
123194
123236
|
);
|
|
123195
123237
|
});
|
|
123196
|
-
lifecycle.command("skip <epicId> <stage>").description(
|
|
123238
|
+
lifecycle.command("skip <epicId> <stage>").description(
|
|
123239
|
+
"Skip a lifecycle stage. Valid stages: research|consensus|architecture_decision|specification|decomposition|implementation|validation|testing|release|contribution"
|
|
123240
|
+
).requiredOption("--reason <reason>", "Reason for skipping").action(async (epicId, stage, opts) => {
|
|
123197
123241
|
await dispatchFromCli(
|
|
123198
123242
|
"mutate",
|
|
123199
123243
|
"pipeline",
|
|
@@ -123246,7 +123290,9 @@ function registerLifecycleCommand(program) {
|
|
|
123246
123290
|
{ command: "lifecycle" }
|
|
123247
123291
|
);
|
|
123248
123292
|
});
|
|
123249
|
-
lifecycle.command("reset <epicId> <stage>").description(
|
|
123293
|
+
lifecycle.command("reset <epicId> <stage>").description(
|
|
123294
|
+
"Reset a lifecycle stage back to pending. Valid stages: research|consensus|architecture_decision|specification|decomposition|implementation|validation|testing|release|contribution"
|
|
123295
|
+
).requiredOption("--reason <reason>", "Reason for resetting the stage").action(async (epicId, stage, opts) => {
|
|
123250
123296
|
await dispatchFromCli(
|
|
123251
123297
|
"mutate",
|
|
123252
123298
|
"pipeline",
|
|
@@ -124276,7 +124322,9 @@ function registerOrchestrateCommand(program) {
|
|
|
124276
124322
|
init_internal();
|
|
124277
124323
|
init_renderers();
|
|
124278
124324
|
function registerOtelCommand(program) {
|
|
124279
|
-
const otel = program.command("otel").description(
|
|
124325
|
+
const otel = program.command("otel").description(
|
|
124326
|
+
"Lightweight token metrics from .cleo/metrics/TOKEN_USAGE.jsonl (session-level, spawn-level events)"
|
|
124327
|
+
);
|
|
124280
124328
|
otel.command("status").description("Show token tracking status and recent activity").action(async () => {
|
|
124281
124329
|
try {
|
|
124282
124330
|
const result = await getOtelStatus();
|
|
@@ -124441,11 +124489,15 @@ function registerPhaseCommand(program) {
|
|
|
124441
124489
|
// packages/cleo/src/cli/commands/phases.ts
|
|
124442
124490
|
init_cli();
|
|
124443
124491
|
function registerPhasesCommand(program) {
|
|
124444
|
-
const phases = program.command("phases").description(
|
|
124492
|
+
const phases = program.command("phases").description(
|
|
124493
|
+
"DEPRECATED: Use `cleo phase` instead. List phases with progress bars and statistics"
|
|
124494
|
+
);
|
|
124445
124495
|
phases.command("list", { isDefault: true }).description("List all phases with progress (default)").action(async () => {
|
|
124496
|
+
console.error("[DEPRECATED] cleo phases is deprecated. Use: cleo phase list");
|
|
124446
124497
|
await dispatchFromCli("query", "pipeline", "phase.list", {}, { command: "phases" });
|
|
124447
124498
|
});
|
|
124448
124499
|
phases.command("show <phase>").description("Show phase details and task counts").action(async (phase) => {
|
|
124500
|
+
console.error("[DEPRECATED] cleo phases is deprecated. Use: cleo phase show");
|
|
124449
124501
|
await dispatchFromCli(
|
|
124450
124502
|
"query",
|
|
124451
124503
|
"pipeline",
|
|
@@ -124455,6 +124507,7 @@ function registerPhasesCommand(program) {
|
|
|
124455
124507
|
);
|
|
124456
124508
|
});
|
|
124457
124509
|
phases.command("stats").description("Show detailed phase statistics").action(async () => {
|
|
124510
|
+
console.error("[DEPRECATED] cleo phases is deprecated. Use: cleo phase list");
|
|
124458
124511
|
await dispatchFromCli("query", "pipeline", "phase.list", {}, { command: "phases" });
|
|
124459
124512
|
});
|
|
124460
124513
|
}
|
|
@@ -124463,7 +124516,7 @@ function registerPhasesCommand(program) {
|
|
|
124463
124516
|
init_cli();
|
|
124464
124517
|
function registerPlanCommand(program) {
|
|
124465
124518
|
program.command("plan").description(
|
|
124466
|
-
"
|
|
124519
|
+
"Task prioritization view: in-progress epics, ready tasks, blocked tasks, open bugs with scoring. Use when deciding what to work on next."
|
|
124467
124520
|
).action(async () => {
|
|
124468
124521
|
await dispatchFromCli(
|
|
124469
124522
|
"query",
|
|
@@ -124672,7 +124725,9 @@ function registerRelatesCommand(program) {
|
|
|
124672
124725
|
handleRawError(response, { command: "relates", operation: "relates" });
|
|
124673
124726
|
cliOutput(response.data ?? {}, { command: "relates" });
|
|
124674
124727
|
});
|
|
124675
|
-
relates.command("add <from> <to> <type> <reason>").description(
|
|
124728
|
+
relates.command("add <from> <to> <type> <reason>").description(
|
|
124729
|
+
"Add a relates entry to a task. Valid types: blocks|related|duplicates|absorbs|fixes|extends|supersedes"
|
|
124730
|
+
).action(async (from, to2, type, reason) => {
|
|
124676
124731
|
await dispatchFromCli(
|
|
124677
124732
|
"mutate",
|
|
124678
124733
|
"tasks",
|
|
@@ -124726,15 +124781,6 @@ function registerReleaseCommand(program) {
|
|
|
124726
124781
|
{ command: "release" }
|
|
124727
124782
|
);
|
|
124728
124783
|
});
|
|
124729
|
-
release2.command("changelog <version>").description("Generate changelog for a release").action(async (version2) => {
|
|
124730
|
-
await dispatchFromCli(
|
|
124731
|
-
"mutate",
|
|
124732
|
-
"pipeline",
|
|
124733
|
-
"release.ship",
|
|
124734
|
-
{ version: version2, step: "changelog" },
|
|
124735
|
-
{ command: "release" }
|
|
124736
|
-
);
|
|
124737
|
-
});
|
|
124738
124784
|
release2.command("cancel <version>").description("Cancel and remove a release in draft or prepared state").action(async (version2) => {
|
|
124739
124785
|
await dispatchFromCli(
|
|
124740
124786
|
"mutate",
|
|
@@ -124880,15 +124926,15 @@ function registerRemoteCommand(program) {
|
|
|
124880
124926
|
const remoteName = opts["remote"];
|
|
124881
124927
|
const result = await pull(remoteName);
|
|
124882
124928
|
if (!result.success) {
|
|
124883
|
-
const
|
|
124929
|
+
const details = {
|
|
124884
124930
|
pulled: false,
|
|
124885
124931
|
branch: result.branch,
|
|
124886
124932
|
remote: result.remote
|
|
124887
124933
|
};
|
|
124888
124934
|
if (result.hasConflicts) {
|
|
124889
|
-
|
|
124935
|
+
details["conflicts"] = result.conflictFiles;
|
|
124890
124936
|
}
|
|
124891
|
-
|
|
124937
|
+
cliError(result.message, 1 /* GENERAL_ERROR */, { details });
|
|
124892
124938
|
process.exit(1 /* GENERAL_ERROR */);
|
|
124893
124939
|
}
|
|
124894
124940
|
cliOutput(
|
|
@@ -124947,7 +124993,7 @@ function registerRemoteCommand(program) {
|
|
|
124947
124993
|
// packages/cleo/src/cli/commands/reorder.ts
|
|
124948
124994
|
init_cli();
|
|
124949
124995
|
function registerReorderCommand(program) {
|
|
124950
|
-
program.command("reorder <task-id>").description("Change task position within sibling group").option("--position <n>", "Move to specific position
|
|
124996
|
+
program.command("reorder <task-id>").description("Change task position within sibling group").option("--position <n>", "Move to specific zero-based position among siblings", parseInt).action(async (taskId, opts) => {
|
|
124951
124997
|
const position = opts["position"];
|
|
124952
124998
|
await dispatchFromCli(
|
|
124953
124999
|
"mutate",
|
|
@@ -126239,7 +126285,13 @@ var SHOW_PARAMS = [
|
|
|
126239
126285
|
}
|
|
126240
126286
|
];
|
|
126241
126287
|
function registerShowCommand(program) {
|
|
126242
|
-
const cmd = program.command("show").description(
|
|
126288
|
+
const cmd = program.command("show").description(
|
|
126289
|
+
buildOperationHelp(
|
|
126290
|
+
"tasks.show",
|
|
126291
|
+
"Show full task details by ID (returns complete task record with metadata, verification, lifecycle)",
|
|
126292
|
+
SHOW_PARAMS
|
|
126293
|
+
)
|
|
126294
|
+
);
|
|
126243
126295
|
applyParamDefsToCommand(cmd, SHOW_PARAMS, "tasks.show");
|
|
126244
126296
|
cmd.action(async (taskId) => {
|
|
126245
126297
|
await dispatchFromCli("query", "tasks", "show", { taskId }, { command: "show" });
|
|
@@ -126471,7 +126523,9 @@ function registerSnapshotCommand(program) {
|
|
|
126471
126523
|
// packages/cleo/src/cli/commands/specification.ts
|
|
126472
126524
|
init_cli();
|
|
126473
126525
|
function registerSpecificationCommand(program) {
|
|
126474
|
-
const specification = program.command("specification").description(
|
|
126526
|
+
const specification = program.command("specification").description(
|
|
126527
|
+
"Validate specification protocol compliance (alias for `cleo check protocol specification`)"
|
|
126528
|
+
);
|
|
126475
126529
|
specification.command("validate <taskId>").description("Validate specification protocol compliance for task").option("--strict", "Exit with error code on violations").option("--spec-file <file>", "Path to specification file").action(async (taskId, opts) => {
|
|
126476
126530
|
await dispatchFromCli(
|
|
126477
126531
|
"query",
|
|
@@ -126507,7 +126561,7 @@ function registerSpecificationCommand(program) {
|
|
|
126507
126561
|
// packages/cleo/src/cli/commands/start.ts
|
|
126508
126562
|
init_cli();
|
|
126509
126563
|
function registerStartCommand(program) {
|
|
126510
|
-
program.command("start <taskId>").description("Start working on a task").action(async (taskId) => {
|
|
126564
|
+
program.command("start <taskId>").description("Start working on a task (sets it as the current task in the active session)").action(async (taskId) => {
|
|
126511
126565
|
await dispatchFromCli("mutate", "tasks", "start", { taskId }, { command: "start" });
|
|
126512
126566
|
});
|
|
126513
126567
|
}
|
|
@@ -126521,7 +126575,7 @@ function registerStatsCommand(program) {
|
|
|
126521
126575
|
"admin",
|
|
126522
126576
|
"stats",
|
|
126523
126577
|
{
|
|
126524
|
-
period: opts["period"]
|
|
126578
|
+
period: opts["period"] ?? 30
|
|
126525
126579
|
},
|
|
126526
126580
|
{ command: "stats", operation: "admin.stats" }
|
|
126527
126581
|
);
|
|
@@ -126718,7 +126772,9 @@ function collect(value, previous) {
|
|
|
126718
126772
|
// packages/cleo/src/cli/commands/stop.ts
|
|
126719
126773
|
init_cli();
|
|
126720
126774
|
function registerStopCommand(program) {
|
|
126721
|
-
program.command("stop").description(
|
|
126775
|
+
program.command("stop").description(
|
|
126776
|
+
"Stop working on the current task (clears the active task, returns {cleared: boolean, previousTask: string|null})"
|
|
126777
|
+
).action(async () => {
|
|
126722
126778
|
await dispatchFromCli("mutate", "tasks", "stop", {}, { command: "stop" });
|
|
126723
126779
|
});
|
|
126724
126780
|
}
|
|
@@ -126763,10 +126819,10 @@ function registerSyncCommand(program) {
|
|
|
126763
126819
|
"How to resolve conflicts: keep-cleo, keep-external, or newest (default: keep-cleo)",
|
|
126764
126820
|
"keep-cleo"
|
|
126765
126821
|
).action(async (file2, opts) => {
|
|
126766
|
-
const { readFileSync:
|
|
126822
|
+
const { readFileSync: readFileSync102 } = await import("node:fs");
|
|
126767
126823
|
let externalTasks;
|
|
126768
126824
|
try {
|
|
126769
|
-
externalTasks = JSON.parse(
|
|
126825
|
+
externalTasks = JSON.parse(readFileSync102(file2, "utf8"));
|
|
126770
126826
|
} catch (err) {
|
|
126771
126827
|
const message = err instanceof Error ? err.message : String(err);
|
|
126772
126828
|
console.error(`Failed to read or parse external tasks file: ${message}`);
|
|
@@ -126862,15 +126918,17 @@ function registerTestingCommand(program) {
|
|
|
126862
126918
|
init_internal();
|
|
126863
126919
|
init_cli();
|
|
126864
126920
|
init_renderers();
|
|
126865
|
-
import { readFileSync as
|
|
126921
|
+
import { readFileSync as readFileSync100 } from "node:fs";
|
|
126866
126922
|
function readPayload(opts, textKey, fileKey) {
|
|
126867
126923
|
const text3 = opts[textKey];
|
|
126868
126924
|
const file2 = opts[fileKey];
|
|
126869
|
-
if (file2) return
|
|
126925
|
+
if (file2) return readFileSync100(file2, "utf-8");
|
|
126870
126926
|
return text3;
|
|
126871
126927
|
}
|
|
126872
126928
|
function registerTokenCommand(program) {
|
|
126873
|
-
const token = program.command("token").description(
|
|
126929
|
+
const token = program.command("token").description(
|
|
126930
|
+
"Provider-aware token telemetry from tasks.db (historical, per-operation tracking)"
|
|
126931
|
+
);
|
|
126874
126932
|
token.command("summary").description("Summarize recorded token telemetry").option("--provider <provider>", "Filter by provider").option("--transport <transport>", "Filter by transport").option("--domain <domain>", "Filter by domain").option("--operation <name>", "Filter by operation name").option("--session <id>", "Filter by session ID").option("--task <id>", "Filter by task ID").action(async (opts) => {
|
|
126875
126933
|
await dispatchFromCli(
|
|
126876
126934
|
"query",
|
|
@@ -126966,7 +127024,7 @@ function registerTokenCommand(program) {
|
|
|
126966
127024
|
// packages/cleo/src/cli/commands/update.ts
|
|
126967
127025
|
init_cli();
|
|
126968
127026
|
function registerUpdateCommand(program) {
|
|
126969
|
-
program.command("update <taskId>").description("Update a task").option("--title <title>", "New title").option("-s, --status <status>", "New status").option("-p, --priority <priority>", "New priority").option("-t, --type <type>", "New type").option("--size <size>", "New size").option("-P, --phase <phase>", "New phase").option("-d, --description <desc>", "New description").option("-l, --labels <labels>", "Set labels (comma-separated)").option("--add-labels <labels>", "Add labels (comma-separated)").option("--remove-labels <labels>", "Remove labels (comma-separated)").option("-D, --depends <ids>", "Set dependencies (comma-separated)").option("--add-depends <ids>", "Add dependencies (comma-separated)").option("--remove-depends <ids>", "Remove dependencies (comma-separated)").option("--notes <note>", "Add a note").option(
|
|
127027
|
+
program.command("update <taskId>").description("Update a task").option("--title <title>", "New title").option("-s, --status <status>", "New status (pending|active|blocked|done|cancelled)").option("-p, --priority <priority>", "New priority (critical|high|medium|low)").option("-t, --type <type>", "New type (task|epic|subtask|bug)").option("--size <size>", "New size").option("-P, --phase <phase>", "New phase").option("-d, --description <desc>", "New description").option("-l, --labels <labels>", "Set labels (comma-separated)").option("--add-labels <labels>", "Add labels (comma-separated)").option("--remove-labels <labels>", "Remove labels (comma-separated)").option("-D, --depends <ids>", "Set dependencies (comma-separated)").option("--add-depends <ids>", "Add dependencies (comma-separated)").option("--remove-depends <ids>", "Remove dependencies (comma-separated)").option("--notes <note>", "Add a note").option(
|
|
126970
127028
|
"--acceptance <criteria>",
|
|
126971
127029
|
'Set acceptance criteria (pipe-separated, e.g. "AC1|AC2|AC3")'
|
|
126972
127030
|
).option("--files <files>", "Set files (comma-separated)").option("--blocked-by <reason>", "Set blocked-by reason").option("--parent <id>", "Set parent ID").option("--no-auto-complete", "Disable auto-complete for epic").option(
|
|
@@ -127089,7 +127147,10 @@ function registerUpgradeCommand(program) {
|
|
|
127089
127147
|
// packages/cleo/src/cli/commands/validate.ts
|
|
127090
127148
|
init_cli();
|
|
127091
127149
|
function registerValidateCommand(program) {
|
|
127092
|
-
program.command("validate").description(
|
|
127150
|
+
program.command("validate").description(
|
|
127151
|
+
"DEPRECATED: Use `cleo check schema todo` instead. Validate task data against schema and business rules"
|
|
127152
|
+
).option("--strict", "Treat warnings as errors").action(async (opts) => {
|
|
127153
|
+
console.error("[DEPRECATED] cleo validate is deprecated. Use: cleo check schema todo");
|
|
127093
127154
|
await dispatchFromCli(
|
|
127094
127155
|
"query",
|
|
127095
127156
|
"check",
|
|
@@ -127452,13 +127513,12 @@ var codeCommand = defineCommand({
|
|
|
127452
127513
|
// packages/cleo/src/cli/index.ts
|
|
127453
127514
|
function getPackageVersion() {
|
|
127454
127515
|
const pkgPath = join130(dirname28(fileURLToPath5(import.meta.url)), "../../package.json");
|
|
127455
|
-
const pkg = JSON.parse(
|
|
127516
|
+
const pkg = JSON.parse(readFileSync101(pkgPath, "utf-8"));
|
|
127456
127517
|
return pkg.version;
|
|
127457
127518
|
}
|
|
127458
127519
|
var CLI_VERSION = getPackageVersion();
|
|
127459
127520
|
var rootShim = new ShimCommand();
|
|
127460
127521
|
registerAgentCommand(rootShim);
|
|
127461
|
-
registerAgentsCommand(rootShim);
|
|
127462
127522
|
registerAddCommand(rootShim);
|
|
127463
127523
|
registerAddBatchCommand(rootShim);
|
|
127464
127524
|
registerListCommand(rootShim);
|