@cleocode/cleo 2026.3.47 → 2026.3.49
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 +112 -35
- package/dist/cli/index.js.map +4 -4
- package/dist/mcp/index.js +79 -27
- package/dist/mcp/index.js.map +3 -3
- package/package.json +3 -3
package/dist/cli/index.js
CHANGED
|
@@ -34691,7 +34691,7 @@ function checkInjection2(projectRoot) {
|
|
|
34691
34691
|
status: "warning",
|
|
34692
34692
|
message: "AGENTS.md not found in project root",
|
|
34693
34693
|
details: { path: agentsMdPath, exists: false },
|
|
34694
|
-
fix: "cleo
|
|
34694
|
+
fix: "cleo upgrade"
|
|
34695
34695
|
};
|
|
34696
34696
|
}
|
|
34697
34697
|
let content;
|
|
@@ -34716,7 +34716,7 @@ function checkInjection2(projectRoot) {
|
|
|
34716
34716
|
status: "warning",
|
|
34717
34717
|
message: "AGENTS.md exists but has no CAAMP markers",
|
|
34718
34718
|
details: { path: agentsMdPath, hasCaampMarker: false },
|
|
34719
|
-
fix: "cleo
|
|
34719
|
+
fix: "cleo upgrade"
|
|
34720
34720
|
};
|
|
34721
34721
|
}
|
|
34722
34722
|
if (startCount !== endCount) {
|
|
@@ -34726,7 +34726,7 @@ function checkInjection2(projectRoot) {
|
|
|
34726
34726
|
status: "warning",
|
|
34727
34727
|
message: `CAAMP markers unbalanced: ${startCount} START vs ${endCount} END`,
|
|
34728
34728
|
details: { path: agentsMdPath, startCount, endCount },
|
|
34729
|
-
fix: "cleo
|
|
34729
|
+
fix: "cleo upgrade"
|
|
34730
34730
|
};
|
|
34731
34731
|
}
|
|
34732
34732
|
const caampMatch = content.match(/<!-- CAAMP:START -->([\s\S]*?)<!-- CAAMP:END -->/);
|
|
@@ -34748,7 +34748,7 @@ function checkInjection2(projectRoot) {
|
|
|
34748
34748
|
status: "warning",
|
|
34749
34749
|
message: `Missing @ reference targets: ${missing.join(", ")}`,
|
|
34750
34750
|
details: { path: agentsMdPath, missing, totalRefs: refs.length },
|
|
34751
|
-
fix: "cleo
|
|
34751
|
+
fix: "cleo upgrade"
|
|
34752
34752
|
};
|
|
34753
34753
|
}
|
|
34754
34754
|
}
|
|
@@ -34765,7 +34765,7 @@ function checkInjection2(projectRoot) {
|
|
|
34765
34765
|
status: "warning",
|
|
34766
34766
|
message: `CLAUDE.md CAAMP markers unbalanced: ${cStartCount} START vs ${cEndCount} END`,
|
|
34767
34767
|
details: { file: "CLAUDE.md", startCount: cStartCount, endCount: cEndCount },
|
|
34768
|
-
fix: "cleo
|
|
34768
|
+
fix: "cleo upgrade"
|
|
34769
34769
|
};
|
|
34770
34770
|
}
|
|
34771
34771
|
if (cStartCount === 0) {
|
|
@@ -34775,7 +34775,7 @@ function checkInjection2(projectRoot) {
|
|
|
34775
34775
|
status: "warning",
|
|
34776
34776
|
message: "CLAUDE.md has no CAAMP markers",
|
|
34777
34777
|
details: { file: "CLAUDE.md", hasCaampMarker: false },
|
|
34778
|
-
fix: "cleo
|
|
34778
|
+
fix: "cleo upgrade"
|
|
34779
34779
|
};
|
|
34780
34780
|
}
|
|
34781
34781
|
} catch {
|
|
@@ -57677,7 +57677,7 @@ function checkAgentsMdHub(projectRoot) {
|
|
|
57677
57677
|
status: "warning",
|
|
57678
57678
|
message: "AGENTS.md not found in project root",
|
|
57679
57679
|
details: { path: agentsMdPath, exists: false },
|
|
57680
|
-
fix: "cleo
|
|
57680
|
+
fix: "cleo upgrade"
|
|
57681
57681
|
};
|
|
57682
57682
|
}
|
|
57683
57683
|
let content;
|
|
@@ -57700,7 +57700,7 @@ function checkAgentsMdHub(projectRoot) {
|
|
|
57700
57700
|
status: "warning",
|
|
57701
57701
|
message: "AGENTS.md exists but has no CAAMP:START marker",
|
|
57702
57702
|
details: { path: agentsMdPath, hasCaampMarker: false },
|
|
57703
|
-
fix: "cleo
|
|
57703
|
+
fix: "cleo upgrade"
|
|
57704
57704
|
};
|
|
57705
57705
|
}
|
|
57706
57706
|
return {
|
|
@@ -58039,7 +58039,7 @@ function checkCaampMarkerIntegrity(projectRoot) {
|
|
|
58039
58039
|
status: "warning",
|
|
58040
58040
|
message: `CAAMP marker issues: ${issues.join("; ")}`,
|
|
58041
58041
|
details: { issues },
|
|
58042
|
-
fix: "cleo
|
|
58042
|
+
fix: "cleo upgrade"
|
|
58043
58043
|
};
|
|
58044
58044
|
}
|
|
58045
58045
|
return {
|
|
@@ -58105,7 +58105,7 @@ function checkAtReferenceTargetExists(projectRoot) {
|
|
|
58105
58105
|
status: "warning",
|
|
58106
58106
|
message: `Missing @ reference targets: ${missing.join(", ")}`,
|
|
58107
58107
|
details: { missing, totalRefs: refs.length },
|
|
58108
|
-
fix: "cleo
|
|
58108
|
+
fix: "cleo upgrade"
|
|
58109
58109
|
};
|
|
58110
58110
|
}
|
|
58111
58111
|
return {
|
|
@@ -64333,7 +64333,14 @@ async function initAgentDefinition(created, warnings) {
|
|
|
64333
64333
|
try {
|
|
64334
64334
|
try {
|
|
64335
64335
|
const stat3 = await lstat(globalAgentsDir);
|
|
64336
|
-
if (stat3.isSymbolicLink()
|
|
64336
|
+
if (stat3.isSymbolicLink()) {
|
|
64337
|
+
const { readlink } = await import("node:fs/promises");
|
|
64338
|
+
const currentTarget = await readlink(globalAgentsDir);
|
|
64339
|
+
if (currentTarget === agentSourceDir) {
|
|
64340
|
+
return;
|
|
64341
|
+
}
|
|
64342
|
+
await unlink4(globalAgentsDir);
|
|
64343
|
+
} else if (stat3.isDirectory()) {
|
|
64337
64344
|
return;
|
|
64338
64345
|
}
|
|
64339
64346
|
} catch {
|
|
@@ -64539,9 +64546,6 @@ async function updateDocs() {
|
|
|
64539
64546
|
};
|
|
64540
64547
|
}
|
|
64541
64548
|
async function initProject(opts = {}) {
|
|
64542
|
-
if (opts.updateDocs) {
|
|
64543
|
-
return updateDocs();
|
|
64544
|
-
}
|
|
64545
64549
|
const cleoDir = getCleoDirAbsolute();
|
|
64546
64550
|
const projRoot = getProjectRoot();
|
|
64547
64551
|
const alreadyInitialized = existsSync100(cleoDir) && (existsSync100(join100(cleoDir, "tasks.db")) || existsSync100(join100(cleoDir, "config.json")));
|
|
@@ -64908,7 +64912,13 @@ var init_output = __esm({
|
|
|
64908
64912
|
});
|
|
64909
64913
|
|
|
64910
64914
|
// packages/core/src/project-info.ts
|
|
64911
|
-
|
|
64915
|
+
var project_info_exports = {};
|
|
64916
|
+
__export(project_info_exports, {
|
|
64917
|
+
getProjectInfo: () => getProjectInfo,
|
|
64918
|
+
getProjectInfoSync: () => getProjectInfoSync,
|
|
64919
|
+
updateProjectName: () => updateProjectName
|
|
64920
|
+
});
|
|
64921
|
+
import { existsSync as existsSync102, readFileSync as readFileSync75, writeFileSync as writeFileSync19 } from "node:fs";
|
|
64912
64922
|
import { readFile as readFile18 } from "node:fs/promises";
|
|
64913
64923
|
import { join as join102 } from "node:path";
|
|
64914
64924
|
async function getProjectInfo(cwd) {
|
|
@@ -64952,6 +64962,16 @@ function getProjectInfoSync(cwd) {
|
|
|
64952
64962
|
return null;
|
|
64953
64963
|
}
|
|
64954
64964
|
}
|
|
64965
|
+
function updateProjectName(cwd, name2) {
|
|
64966
|
+
const cleoDir = getCleoDirAbsolute(cwd);
|
|
64967
|
+
const infoPath = join102(cleoDir, "project-info.json");
|
|
64968
|
+
if (!existsSync102(infoPath)) return;
|
|
64969
|
+
const data = JSON.parse(readFileSync75(infoPath, "utf-8"));
|
|
64970
|
+
data.projectName = name2;
|
|
64971
|
+
data.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
|
|
64972
|
+
writeFileSync19(infoPath, `${JSON.stringify(data, null, 2)}
|
|
64973
|
+
`);
|
|
64974
|
+
}
|
|
64955
64975
|
var init_project_info = __esm({
|
|
64956
64976
|
"packages/core/src/project-info.ts"() {
|
|
64957
64977
|
"use strict";
|
|
@@ -65547,6 +65567,11 @@ async function bootstrapGlobalCleo(options) {
|
|
|
65547
65567
|
warnings: [],
|
|
65548
65568
|
isDryRun: options?.dryRun ?? false
|
|
65549
65569
|
};
|
|
65570
|
+
try {
|
|
65571
|
+
const { ensureGlobalHome: ensureGlobalHome2 } = await Promise.resolve().then(() => (init_scaffold(), scaffold_exports));
|
|
65572
|
+
await ensureGlobalHome2();
|
|
65573
|
+
} catch {
|
|
65574
|
+
}
|
|
65550
65575
|
await ensureGlobalTemplatesBootstrap(ctx, options?.packageRoot);
|
|
65551
65576
|
await injectAgentsHub(ctx);
|
|
65552
65577
|
await installMcpToProviders(ctx);
|
|
@@ -65602,13 +65627,9 @@ async function injectAgentsHub(ctx) {
|
|
|
65602
65627
|
await mkdir17(globalAgentsDir, { recursive: true });
|
|
65603
65628
|
if (existsSync103(globalAgentsMd)) {
|
|
65604
65629
|
const content = await readFile19(globalAgentsMd, "utf8");
|
|
65605
|
-
const stripped = content.replace(
|
|
65606
|
-
|
|
65607
|
-
|
|
65608
|
-
);
|
|
65609
|
-
if (stripped !== content) {
|
|
65610
|
-
await writeFile12(globalAgentsMd, stripped, "utf8");
|
|
65611
|
-
}
|
|
65630
|
+
const stripped = content.replace(/\n?<!-- CLEO:START[^>]*-->[\s\S]*?<!-- CLEO:END -->\n?/g, "").replace(/\n?<!-- CAAMP:START -->[\s\S]*?<!-- CAAMP:END -->\n?/g, "").trim();
|
|
65631
|
+
await writeFile12(globalAgentsMd, stripped ? `${stripped}
|
|
65632
|
+
` : "", "utf8");
|
|
65612
65633
|
}
|
|
65613
65634
|
const expectedContent = "@~/.cleo/templates/CLEO-INJECTION.md";
|
|
65614
65635
|
const action = await inject2(globalAgentsMd, expectedContent);
|
|
@@ -72381,7 +72402,7 @@ import {
|
|
|
72381
72402
|
mkdirSync as mkdirSync23,
|
|
72382
72403
|
readdirSync as readdirSync36,
|
|
72383
72404
|
readFileSync as readFileSync82,
|
|
72384
|
-
writeFileSync as
|
|
72405
|
+
writeFileSync as writeFileSync20
|
|
72385
72406
|
} from "node:fs";
|
|
72386
72407
|
import { join as join108 } from "node:path";
|
|
72387
72408
|
async function runUpgrade(options = {}) {
|
|
@@ -72527,7 +72548,7 @@ async function runUpgrade(options = {}) {
|
|
|
72527
72548
|
if (totalImported === 0 && existsSync110(dbBackupPath)) {
|
|
72528
72549
|
copyFileSync7(dbBackupPath, dbPath2);
|
|
72529
72550
|
if (configBackup) {
|
|
72530
|
-
|
|
72551
|
+
writeFileSync20(configPath, configBackup);
|
|
72531
72552
|
}
|
|
72532
72553
|
actions.push({
|
|
72533
72554
|
action: "storage_migration",
|
|
@@ -72548,7 +72569,7 @@ async function runUpgrade(options = {}) {
|
|
|
72548
72569
|
config2.storage = {};
|
|
72549
72570
|
}
|
|
72550
72571
|
config2.storage.engine = "sqlite";
|
|
72551
|
-
|
|
72572
|
+
writeFileSync20(configPath, JSON.stringify(config2, null, 2));
|
|
72552
72573
|
actions.push({
|
|
72553
72574
|
action: "storage_migration",
|
|
72554
72575
|
status: "applied",
|
|
@@ -72570,7 +72591,7 @@ async function runUpgrade(options = {}) {
|
|
|
72570
72591
|
copyFileSync7(dbBackupPath, dbPath2);
|
|
72571
72592
|
}
|
|
72572
72593
|
if (configBackup) {
|
|
72573
|
-
|
|
72594
|
+
writeFileSync20(configPath, configBackup);
|
|
72574
72595
|
}
|
|
72575
72596
|
await updateMigrationPhase2(cleoDir2, "failed");
|
|
72576
72597
|
for (const error40 of result.errors) {
|
|
@@ -72823,7 +72844,9 @@ async function runUpgrade(options = {}) {
|
|
|
72823
72844
|
}
|
|
72824
72845
|
}
|
|
72825
72846
|
} else {
|
|
72826
|
-
const contextResult = await ensureProjectContext(projectRootForContext, {
|
|
72847
|
+
const contextResult = await ensureProjectContext(projectRootForContext, {
|
|
72848
|
+
staleDays: options.forceDetect ? 0 : 30
|
|
72849
|
+
});
|
|
72827
72850
|
actions.push({
|
|
72828
72851
|
action: "project_context_detection",
|
|
72829
72852
|
status: contextResult.action === "skipped" ? "skipped" : "applied",
|
|
@@ -73021,6 +73044,35 @@ async function runUpgrade(options = {}) {
|
|
|
73021
73044
|
}
|
|
73022
73045
|
} catch {
|
|
73023
73046
|
}
|
|
73047
|
+
if (options.mapCodebase) {
|
|
73048
|
+
try {
|
|
73049
|
+
const { mapCodebase: mapCodebase3 } = await Promise.resolve().then(() => (init_codebase_map(), codebase_map_exports));
|
|
73050
|
+
const mapResult = await mapCodebase3(projectRootForMaint, { storeToBrain: true });
|
|
73051
|
+
actions.push({
|
|
73052
|
+
action: "codebase_map",
|
|
73053
|
+
status: "applied",
|
|
73054
|
+
details: `Analyzed: ${mapResult.stack?.languages?.length ?? 0} languages, ${mapResult.concerns?.todos?.length ?? 0} TODOs found`
|
|
73055
|
+
});
|
|
73056
|
+
} catch (err) {
|
|
73057
|
+
actions.push({
|
|
73058
|
+
action: "codebase_map",
|
|
73059
|
+
status: "error",
|
|
73060
|
+
details: `Codebase mapping failed: ${err instanceof Error ? err.message : String(err)}`
|
|
73061
|
+
});
|
|
73062
|
+
}
|
|
73063
|
+
}
|
|
73064
|
+
if (options.projectName) {
|
|
73065
|
+
try {
|
|
73066
|
+
const { updateProjectName: updateProjectName2 } = await Promise.resolve().then(() => (init_project_info(), project_info_exports));
|
|
73067
|
+
await updateProjectName2(projectRootForMaint, options.projectName);
|
|
73068
|
+
actions.push({
|
|
73069
|
+
action: "project_name_update",
|
|
73070
|
+
status: "applied",
|
|
73071
|
+
details: `Project name set to "${options.projectName}"`
|
|
73072
|
+
});
|
|
73073
|
+
} catch {
|
|
73074
|
+
}
|
|
73075
|
+
}
|
|
73024
73076
|
try {
|
|
73025
73077
|
const { existsSync: fsExistsSync } = await import("node:fs");
|
|
73026
73078
|
const { join: pathJoin } = await import("node:path");
|
|
@@ -91598,6 +91650,24 @@ function registerTreeCommand(program) {
|
|
|
91598
91650
|
});
|
|
91599
91651
|
}
|
|
91600
91652
|
|
|
91653
|
+
// packages/cleo/src/cli/commands/detect.ts
|
|
91654
|
+
init_internal();
|
|
91655
|
+
init_renderers();
|
|
91656
|
+
function registerDetectCommand(program) {
|
|
91657
|
+
program.command("detect").description("Re-detect project type and update project-context.json").action(async () => {
|
|
91658
|
+
const projectRoot = getProjectRoot();
|
|
91659
|
+
const result = await ensureProjectContext(projectRoot, { staleDays: 0 });
|
|
91660
|
+
cliOutput(
|
|
91661
|
+
{
|
|
91662
|
+
action: result.action,
|
|
91663
|
+
path: result.path,
|
|
91664
|
+
details: result.details
|
|
91665
|
+
},
|
|
91666
|
+
{ command: "detect" }
|
|
91667
|
+
);
|
|
91668
|
+
});
|
|
91669
|
+
}
|
|
91670
|
+
|
|
91601
91671
|
// packages/cleo/src/cli/commands/detect-drift.ts
|
|
91602
91672
|
init_src();
|
|
91603
91673
|
init_renderers();
|
|
@@ -92402,7 +92472,7 @@ init_src();
|
|
|
92402
92472
|
init_src2();
|
|
92403
92473
|
init_renderers();
|
|
92404
92474
|
import { execFileSync as execFileSync14 } from "node:child_process";
|
|
92405
|
-
import { existsSync as existsSync121, mkdirSync as mkdirSync25, readFileSync as readFileSync95, writeFileSync as
|
|
92475
|
+
import { existsSync as existsSync121, mkdirSync as mkdirSync25, readFileSync as readFileSync95, writeFileSync as writeFileSync21 } from "node:fs";
|
|
92406
92476
|
import { dirname as dirname23, join as join115 } from "node:path";
|
|
92407
92477
|
function getChangelogSource(cwd) {
|
|
92408
92478
|
const configPath = getConfigPath(cwd);
|
|
@@ -92556,7 +92626,7 @@ function registerGenerateChangelogCommand(program) {
|
|
|
92556
92626
|
if (!dryRun) {
|
|
92557
92627
|
const fullPath = join115(getProjectRoot(), outputPath);
|
|
92558
92628
|
mkdirSync25(dirname23(fullPath), { recursive: true });
|
|
92559
|
-
|
|
92629
|
+
writeFileSync21(fullPath, content, "utf-8");
|
|
92560
92630
|
}
|
|
92561
92631
|
results.push({ platform: targetPlatform, path: outputPath, written: !dryRun });
|
|
92562
92632
|
} else {
|
|
@@ -92577,7 +92647,7 @@ function registerGenerateChangelogCommand(program) {
|
|
|
92577
92647
|
if (!dryRun) {
|
|
92578
92648
|
const fullPath = join115(getProjectRoot(), platformConfig.path);
|
|
92579
92649
|
mkdirSync25(dirname23(fullPath), { recursive: true });
|
|
92580
|
-
|
|
92650
|
+
writeFileSync21(fullPath, content, "utf-8");
|
|
92581
92651
|
}
|
|
92582
92652
|
results.push({
|
|
92583
92653
|
platform: platformConfig.platform,
|
|
@@ -92718,14 +92788,12 @@ function registerImportTasksCommand(program) {
|
|
|
92718
92788
|
init_src2();
|
|
92719
92789
|
init_renderers();
|
|
92720
92790
|
function registerInitCommand(program) {
|
|
92721
|
-
program.command("init").description("Initialize CLEO in a project directory").option("--name <name>", "Project name").option("--force", "Overwrite existing files").option("--detect", "Auto-detect project configuration").option("--
|
|
92791
|
+
program.command("init").description("Initialize CLEO in a project directory").option("--name <name>", "Project name").option("--force", "Overwrite existing files").option("--detect", "Auto-detect project configuration").option("--map-codebase", "Run codebase analysis and store findings to brain.db").argument("[projectName]", "Project name (alternative to --name)").action(async (projectName, opts) => {
|
|
92722
92792
|
try {
|
|
92723
|
-
if (opts["refresh"]) opts["detect"] = true;
|
|
92724
92793
|
const initOpts = {
|
|
92725
92794
|
name: opts["name"] || projectName || void 0,
|
|
92726
92795
|
force: !!opts["force"],
|
|
92727
92796
|
detect: !!opts["detect"],
|
|
92728
|
-
updateDocs: !!opts["updateDocs"],
|
|
92729
92797
|
mapCodebase: !!opts["mapCodebase"]
|
|
92730
92798
|
};
|
|
92731
92799
|
const result = await initProject(initOpts);
|
|
@@ -95640,7 +95708,9 @@ function registerUpdateCommand(program) {
|
|
|
95640
95708
|
init_internal();
|
|
95641
95709
|
init_renderers();
|
|
95642
95710
|
function registerUpgradeCommand(program) {
|
|
95643
|
-
program.command("upgrade").description(
|
|
95711
|
+
program.command("upgrade").description(
|
|
95712
|
+
"Unified project maintenance (storage migration, schema repair, structural fixes, doc refresh)"
|
|
95713
|
+
).option("--status", "Show what needs updating without making changes").option("--dry-run", "Preview changes without applying").option("--include-global", "Also check global ~/.cleo data").option("--no-auto-migrate", "Skip automatic JSON\u2192SQLite migration").option("--detect", "Force re-detection of project type (ignores staleness)").option("--map-codebase", "Run full codebase analysis and store findings to brain.db").option("--name <name>", "Update project name in project-info and nexus registry").action(async (_opts, command) => {
|
|
95644
95714
|
const opts = command.optsWithGlobals ? command.optsWithGlobals() : command.opts();
|
|
95645
95715
|
const isHuman = opts["human"] === true || !!process.stdout.isTTY && opts["json"] !== true;
|
|
95646
95716
|
const progress = createUpgradeProgress(isHuman);
|
|
@@ -95648,6 +95718,9 @@ function registerUpgradeCommand(program) {
|
|
|
95648
95718
|
const isDryRun = !!opts["dryRun"] || !!opts["status"];
|
|
95649
95719
|
const includeGlobal = !!opts["includeGlobal"];
|
|
95650
95720
|
const autoMigrate = opts["autoMigrate"] !== false;
|
|
95721
|
+
const forceDetect = !!opts["detect"];
|
|
95722
|
+
const mapCodebase3 = !!opts["mapCodebase"];
|
|
95723
|
+
const projectName = opts["name"];
|
|
95651
95724
|
progress.start();
|
|
95652
95725
|
progress.step(0, "Analyzing current state");
|
|
95653
95726
|
if (includeGlobal) {
|
|
@@ -95660,7 +95733,10 @@ function registerUpgradeCommand(program) {
|
|
|
95660
95733
|
const result = await runUpgrade({
|
|
95661
95734
|
dryRun: isDryRun,
|
|
95662
95735
|
includeGlobal,
|
|
95663
|
-
autoMigrate
|
|
95736
|
+
autoMigrate,
|
|
95737
|
+
forceDetect,
|
|
95738
|
+
mapCodebase: mapCodebase3,
|
|
95739
|
+
projectName
|
|
95664
95740
|
});
|
|
95665
95741
|
progress.step(4, "Verifying results");
|
|
95666
95742
|
cliOutput(
|
|
@@ -96017,6 +96093,7 @@ registerStatsCommand(rootShim);
|
|
|
96017
96093
|
registerUpgradeCommand(rootShim);
|
|
96018
96094
|
registerValidateCommand(rootShim);
|
|
96019
96095
|
registerVerifyCommand(rootShim);
|
|
96096
|
+
registerDetectCommand(rootShim);
|
|
96020
96097
|
registerDetectDriftCommand(rootShim);
|
|
96021
96098
|
registerOpsCommand(rootShim);
|
|
96022
96099
|
registerSnapshotCommand(rootShim);
|