@cleocode/cleo 2026.3.46 → 2026.3.48
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 +164 -43
- package/dist/cli/index.js.map +4 -4
- package/dist/mcp/index.js +116 -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 {
|
|
@@ -34804,6 +34804,7 @@ __export(scaffold_exports, {
|
|
|
34804
34804
|
CLEO_GITIGNORE_FALLBACK: () => CLEO_GITIGNORE_FALLBACK,
|
|
34805
34805
|
REQUIRED_CLEO_SUBDIRS: () => REQUIRED_CLEO_SUBDIRS,
|
|
34806
34806
|
REQUIRED_GLOBAL_SUBDIRS: () => REQUIRED_GLOBAL_SUBDIRS,
|
|
34807
|
+
STALE_GLOBAL_ENTRIES: () => STALE_GLOBAL_ENTRIES,
|
|
34807
34808
|
checkBrainDb: () => checkBrainDb,
|
|
34808
34809
|
checkCleoGitRepo: () => checkCleoGitRepo,
|
|
34809
34810
|
checkCleoStructure: () => checkCleoStructure,
|
|
@@ -34840,7 +34841,7 @@ __export(scaffold_exports, {
|
|
|
34840
34841
|
import { execFile as execFile3 } from "node:child_process";
|
|
34841
34842
|
import { randomUUID } from "node:crypto";
|
|
34842
34843
|
import { existsSync as existsSync34, constants as fsConstants3, readFileSync as readFileSync22, statSync as statSync8 } from "node:fs";
|
|
34843
|
-
import { access as access3, mkdir as mkdir5, readFile as readFile6, writeFile as writeFile5 } from "node:fs/promises";
|
|
34844
|
+
import { access as access3, mkdir as mkdir5, readFile as readFile6, rm as rm2, writeFile as writeFile5 } from "node:fs/promises";
|
|
34844
34845
|
import { dirname as dirname8, join as join37, resolve as resolve5 } from "node:path";
|
|
34845
34846
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
34846
34847
|
import { promisify as promisify3 } from "node:util";
|
|
@@ -34855,7 +34856,7 @@ async function fileExists(path2) {
|
|
|
34855
34856
|
async function stripCLEOBlocks(filePath) {
|
|
34856
34857
|
if (!existsSync34(filePath)) return;
|
|
34857
34858
|
const content = await readFile6(filePath, "utf8");
|
|
34858
|
-
const stripped = content.replace(/\n?<!-- CLEO:START
|
|
34859
|
+
const stripped = content.replace(/\n?<!-- CLEO:START[^>]*-->[\s\S]*?<!-- CLEO:END -->\n?/g, "");
|
|
34859
34860
|
if (stripped !== content) await writeFile5(filePath, stripped, "utf8");
|
|
34860
34861
|
}
|
|
34861
34862
|
async function removeCleoFromRootGitignore(projectRoot) {
|
|
@@ -35538,6 +35539,19 @@ async function ensureGlobalHome() {
|
|
|
35538
35539
|
for (const subdir of REQUIRED_GLOBAL_SUBDIRS) {
|
|
35539
35540
|
await mkdir5(join37(cleoHome, subdir), { recursive: true });
|
|
35540
35541
|
}
|
|
35542
|
+
for (const stale of STALE_GLOBAL_ENTRIES) {
|
|
35543
|
+
const stalePath = join37(cleoHome, stale);
|
|
35544
|
+
if (existsSync34(stalePath)) {
|
|
35545
|
+
try {
|
|
35546
|
+
await rm2(stalePath, { recursive: true, force: true });
|
|
35547
|
+
console.warn(`[CLEO] Removed stale global entry: ${stalePath}`);
|
|
35548
|
+
} catch (err) {
|
|
35549
|
+
console.warn(
|
|
35550
|
+
`[CLEO] Could not remove stale global entry ${stalePath}: ${err instanceof Error ? err.message : String(err)}`
|
|
35551
|
+
);
|
|
35552
|
+
}
|
|
35553
|
+
}
|
|
35554
|
+
}
|
|
35541
35555
|
return {
|
|
35542
35556
|
action: alreadyExists ? "skipped" : "created",
|
|
35543
35557
|
path: cleoHome,
|
|
@@ -35652,7 +35666,7 @@ function checkLogDir(projectRoot) {
|
|
|
35652
35666
|
fix: null
|
|
35653
35667
|
};
|
|
35654
35668
|
}
|
|
35655
|
-
var execFileAsync3, REQUIRED_CLEO_SUBDIRS, CLEO_GITIGNORE_FALLBACK, REQUIRED_GLOBAL_SUBDIRS;
|
|
35669
|
+
var execFileAsync3, REQUIRED_CLEO_SUBDIRS, CLEO_GITIGNORE_FALLBACK, REQUIRED_GLOBAL_SUBDIRS, STALE_GLOBAL_ENTRIES;
|
|
35656
35670
|
var init_scaffold = __esm({
|
|
35657
35671
|
"packages/core/src/scaffold.ts"() {
|
|
35658
35672
|
"use strict";
|
|
@@ -35710,6 +35724,20 @@ metrics/
|
|
|
35710
35724
|
backups/
|
|
35711
35725
|
`;
|
|
35712
35726
|
REQUIRED_GLOBAL_SUBDIRS = ["logs", "templates"];
|
|
35727
|
+
STALE_GLOBAL_ENTRIES = [
|
|
35728
|
+
"adrs",
|
|
35729
|
+
"rcasd",
|
|
35730
|
+
"agent-outputs",
|
|
35731
|
+
"backups",
|
|
35732
|
+
"sandbox",
|
|
35733
|
+
"tasks.db",
|
|
35734
|
+
"tasks.db-shm",
|
|
35735
|
+
"tasks.db-wal",
|
|
35736
|
+
"brain-worker.pid",
|
|
35737
|
+
"VERSION",
|
|
35738
|
+
"schemas",
|
|
35739
|
+
"bin"
|
|
35740
|
+
];
|
|
35713
35741
|
}
|
|
35714
35742
|
});
|
|
35715
35743
|
|
|
@@ -39445,8 +39473,8 @@ function parseTokenMetrics(inputFile, cwd) {
|
|
|
39445
39473
|
const raw = JSON.parse(readFileSync28(file2, "utf-8"));
|
|
39446
39474
|
if (raw.resourceMetrics) {
|
|
39447
39475
|
const points = [];
|
|
39448
|
-
for (const
|
|
39449
|
-
for (const sm of
|
|
39476
|
+
for (const rm4 of raw.resourceMetrics ?? []) {
|
|
39477
|
+
for (const sm of rm4.scopeMetrics ?? []) {
|
|
39450
39478
|
for (const metric of sm.metrics ?? []) {
|
|
39451
39479
|
if (metric.name !== "claude_code.token.usage") continue;
|
|
39452
39480
|
for (const dp of metric.sum?.dataPoints ?? []) {
|
|
@@ -42219,10 +42247,10 @@ async function readProjectMeta(projectPath) {
|
|
|
42219
42247
|
}
|
|
42220
42248
|
async function readProjectId(projectPath) {
|
|
42221
42249
|
try {
|
|
42222
|
-
const { readFileSync:
|
|
42250
|
+
const { readFileSync: readFileSync98, existsSync: existsSync122 } = await import("node:fs");
|
|
42223
42251
|
const infoPath = join57(projectPath, ".cleo", "project-info.json");
|
|
42224
42252
|
if (!existsSync122(infoPath)) return "";
|
|
42225
|
-
const data = JSON.parse(
|
|
42253
|
+
const data = JSON.parse(readFileSync98(infoPath, "utf-8"));
|
|
42226
42254
|
return typeof data.projectId === "string" ? data.projectId : "";
|
|
42227
42255
|
} catch {
|
|
42228
42256
|
return "";
|
|
@@ -57649,7 +57677,7 @@ function checkAgentsMdHub(projectRoot) {
|
|
|
57649
57677
|
status: "warning",
|
|
57650
57678
|
message: "AGENTS.md not found in project root",
|
|
57651
57679
|
details: { path: agentsMdPath, exists: false },
|
|
57652
|
-
fix: "cleo
|
|
57680
|
+
fix: "cleo upgrade"
|
|
57653
57681
|
};
|
|
57654
57682
|
}
|
|
57655
57683
|
let content;
|
|
@@ -57672,7 +57700,7 @@ function checkAgentsMdHub(projectRoot) {
|
|
|
57672
57700
|
status: "warning",
|
|
57673
57701
|
message: "AGENTS.md exists but has no CAAMP:START marker",
|
|
57674
57702
|
details: { path: agentsMdPath, hasCaampMarker: false },
|
|
57675
|
-
fix: "cleo
|
|
57703
|
+
fix: "cleo upgrade"
|
|
57676
57704
|
};
|
|
57677
57705
|
}
|
|
57678
57706
|
return {
|
|
@@ -58011,7 +58039,7 @@ function checkCaampMarkerIntegrity(projectRoot) {
|
|
|
58011
58039
|
status: "warning",
|
|
58012
58040
|
message: `CAAMP marker issues: ${issues.join("; ")}`,
|
|
58013
58041
|
details: { issues },
|
|
58014
|
-
fix: "cleo
|
|
58042
|
+
fix: "cleo upgrade"
|
|
58015
58043
|
};
|
|
58016
58044
|
}
|
|
58017
58045
|
return {
|
|
@@ -58077,7 +58105,7 @@ function checkAtReferenceTargetExists(projectRoot) {
|
|
|
58077
58105
|
status: "warning",
|
|
58078
58106
|
message: `Missing @ reference targets: ${missing.join(", ")}`,
|
|
58079
58107
|
details: { missing, totalRefs: refs.length },
|
|
58080
|
-
fix: "cleo
|
|
58108
|
+
fix: "cleo upgrade"
|
|
58081
58109
|
};
|
|
58082
58110
|
}
|
|
58083
58111
|
return {
|
|
@@ -64511,9 +64539,6 @@ async function updateDocs() {
|
|
|
64511
64539
|
};
|
|
64512
64540
|
}
|
|
64513
64541
|
async function initProject(opts = {}) {
|
|
64514
|
-
if (opts.updateDocs) {
|
|
64515
|
-
return updateDocs();
|
|
64516
|
-
}
|
|
64517
64542
|
const cleoDir = getCleoDirAbsolute();
|
|
64518
64543
|
const projRoot = getProjectRoot();
|
|
64519
64544
|
const alreadyInitialized = existsSync100(cleoDir) && (existsSync100(join100(cleoDir, "tasks.db")) || existsSync100(join100(cleoDir, "config.json")));
|
|
@@ -64880,7 +64905,13 @@ var init_output = __esm({
|
|
|
64880
64905
|
});
|
|
64881
64906
|
|
|
64882
64907
|
// packages/core/src/project-info.ts
|
|
64883
|
-
|
|
64908
|
+
var project_info_exports = {};
|
|
64909
|
+
__export(project_info_exports, {
|
|
64910
|
+
getProjectInfo: () => getProjectInfo,
|
|
64911
|
+
getProjectInfoSync: () => getProjectInfoSync,
|
|
64912
|
+
updateProjectName: () => updateProjectName
|
|
64913
|
+
});
|
|
64914
|
+
import { existsSync as existsSync102, readFileSync as readFileSync75, writeFileSync as writeFileSync19 } from "node:fs";
|
|
64884
64915
|
import { readFile as readFile18 } from "node:fs/promises";
|
|
64885
64916
|
import { join as join102 } from "node:path";
|
|
64886
64917
|
async function getProjectInfo(cwd) {
|
|
@@ -64924,6 +64955,16 @@ function getProjectInfoSync(cwd) {
|
|
|
64924
64955
|
return null;
|
|
64925
64956
|
}
|
|
64926
64957
|
}
|
|
64958
|
+
function updateProjectName(cwd, name2) {
|
|
64959
|
+
const cleoDir = getCleoDirAbsolute(cwd);
|
|
64960
|
+
const infoPath = join102(cleoDir, "project-info.json");
|
|
64961
|
+
if (!existsSync102(infoPath)) return;
|
|
64962
|
+
const data = JSON.parse(readFileSync75(infoPath, "utf-8"));
|
|
64963
|
+
data.projectName = name2;
|
|
64964
|
+
data.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
|
|
64965
|
+
writeFileSync19(infoPath, `${JSON.stringify(data, null, 2)}
|
|
64966
|
+
`);
|
|
64967
|
+
}
|
|
64927
64968
|
var init_project_info = __esm({
|
|
64928
64969
|
"packages/core/src/project-info.ts"() {
|
|
64929
64970
|
"use strict";
|
|
@@ -65421,7 +65462,6 @@ __export(src_exports, {
|
|
|
65421
65462
|
});
|
|
65422
65463
|
var init_src2 = __esm({
|
|
65423
65464
|
"packages/core/src/index.ts"() {
|
|
65424
|
-
"use strict";
|
|
65425
65465
|
init_src();
|
|
65426
65466
|
init_adapters();
|
|
65427
65467
|
init_admin();
|
|
@@ -65523,6 +65563,7 @@ async function bootstrapGlobalCleo(options) {
|
|
|
65523
65563
|
await injectAgentsHub(ctx);
|
|
65524
65564
|
await installMcpToProviders(ctx);
|
|
65525
65565
|
await installSkillsGlobally(ctx);
|
|
65566
|
+
await installAgentDefinitionGlobally(ctx);
|
|
65526
65567
|
await installProviderAdapters(ctx, options?.packageRoot);
|
|
65527
65568
|
return ctx;
|
|
65528
65569
|
}
|
|
@@ -65573,7 +65614,10 @@ async function injectAgentsHub(ctx) {
|
|
|
65573
65614
|
await mkdir17(globalAgentsDir, { recursive: true });
|
|
65574
65615
|
if (existsSync103(globalAgentsMd)) {
|
|
65575
65616
|
const content = await readFile19(globalAgentsMd, "utf8");
|
|
65576
|
-
const stripped = content.replace(
|
|
65617
|
+
const stripped = content.replace(
|
|
65618
|
+
/\n?<!-- CLEO:START[^>]*-->[\s\S]*?<!-- CLEO:END -->\n?/g,
|
|
65619
|
+
""
|
|
65620
|
+
);
|
|
65577
65621
|
if (stripped !== content) {
|
|
65578
65622
|
await writeFile12(globalAgentsMd, stripped, "utf8");
|
|
65579
65623
|
}
|
|
@@ -65597,7 +65641,7 @@ async function injectAgentsHub(ctx) {
|
|
|
65597
65641
|
if (existsSync103(instructFilePath)) {
|
|
65598
65642
|
const fileContent = await readFile19(instructFilePath, "utf8");
|
|
65599
65643
|
const stripped = fileContent.replace(
|
|
65600
|
-
/\n?<!-- CLEO:START
|
|
65644
|
+
/\n?<!-- CLEO:START[^>]*-->[\s\S]*?<!-- CLEO:END -->\n?/g,
|
|
65601
65645
|
""
|
|
65602
65646
|
);
|
|
65603
65647
|
if (stripped !== fileContent) {
|
|
@@ -65666,6 +65710,20 @@ async function installSkillsGlobally(ctx) {
|
|
|
65666
65710
|
);
|
|
65667
65711
|
}
|
|
65668
65712
|
}
|
|
65713
|
+
async function installAgentDefinitionGlobally(ctx) {
|
|
65714
|
+
try {
|
|
65715
|
+
if (!ctx.isDryRun) {
|
|
65716
|
+
const { initAgentDefinition: initAgentDefinition2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
65717
|
+
await initAgentDefinition2(ctx.created, ctx.warnings);
|
|
65718
|
+
} else {
|
|
65719
|
+
ctx.created.push("agent: cleo-subagent (would symlink)");
|
|
65720
|
+
}
|
|
65721
|
+
} catch (err) {
|
|
65722
|
+
ctx.warnings.push(
|
|
65723
|
+
`Agent definition install: ${err instanceof Error ? err.message : String(err)}`
|
|
65724
|
+
);
|
|
65725
|
+
}
|
|
65726
|
+
}
|
|
65669
65727
|
async function installProviderAdapters(ctx, packageRootOverride) {
|
|
65670
65728
|
try {
|
|
65671
65729
|
const { AdapterManager: AdapterManager2 } = await Promise.resolve().then(() => (init_adapters(), adapters_exports));
|
|
@@ -72335,7 +72393,7 @@ import {
|
|
|
72335
72393
|
mkdirSync as mkdirSync23,
|
|
72336
72394
|
readdirSync as readdirSync36,
|
|
72337
72395
|
readFileSync as readFileSync82,
|
|
72338
|
-
writeFileSync as
|
|
72396
|
+
writeFileSync as writeFileSync20
|
|
72339
72397
|
} from "node:fs";
|
|
72340
72398
|
import { join as join108 } from "node:path";
|
|
72341
72399
|
async function runUpgrade(options = {}) {
|
|
@@ -72481,7 +72539,7 @@ async function runUpgrade(options = {}) {
|
|
|
72481
72539
|
if (totalImported === 0 && existsSync110(dbBackupPath)) {
|
|
72482
72540
|
copyFileSync7(dbBackupPath, dbPath2);
|
|
72483
72541
|
if (configBackup) {
|
|
72484
|
-
|
|
72542
|
+
writeFileSync20(configPath, configBackup);
|
|
72485
72543
|
}
|
|
72486
72544
|
actions.push({
|
|
72487
72545
|
action: "storage_migration",
|
|
@@ -72502,7 +72560,7 @@ async function runUpgrade(options = {}) {
|
|
|
72502
72560
|
config2.storage = {};
|
|
72503
72561
|
}
|
|
72504
72562
|
config2.storage.engine = "sqlite";
|
|
72505
|
-
|
|
72563
|
+
writeFileSync20(configPath, JSON.stringify(config2, null, 2));
|
|
72506
72564
|
actions.push({
|
|
72507
72565
|
action: "storage_migration",
|
|
72508
72566
|
status: "applied",
|
|
@@ -72524,7 +72582,7 @@ async function runUpgrade(options = {}) {
|
|
|
72524
72582
|
copyFileSync7(dbBackupPath, dbPath2);
|
|
72525
72583
|
}
|
|
72526
72584
|
if (configBackup) {
|
|
72527
|
-
|
|
72585
|
+
writeFileSync20(configPath, configBackup);
|
|
72528
72586
|
}
|
|
72529
72587
|
await updateMigrationPhase2(cleoDir2, "failed");
|
|
72530
72588
|
for (const error40 of result.errors) {
|
|
@@ -72777,7 +72835,9 @@ async function runUpgrade(options = {}) {
|
|
|
72777
72835
|
}
|
|
72778
72836
|
}
|
|
72779
72837
|
} else {
|
|
72780
|
-
const contextResult = await ensureProjectContext(projectRootForContext, {
|
|
72838
|
+
const contextResult = await ensureProjectContext(projectRootForContext, {
|
|
72839
|
+
staleDays: options.forceDetect ? 0 : 30
|
|
72840
|
+
});
|
|
72781
72841
|
actions.push({
|
|
72782
72842
|
action: "project_context_detection",
|
|
72783
72843
|
status: contextResult.action === "skipped" ? "skipped" : "applied",
|
|
@@ -72975,6 +73035,35 @@ async function runUpgrade(options = {}) {
|
|
|
72975
73035
|
}
|
|
72976
73036
|
} catch {
|
|
72977
73037
|
}
|
|
73038
|
+
if (options.mapCodebase) {
|
|
73039
|
+
try {
|
|
73040
|
+
const { mapCodebase: mapCodebase3 } = await Promise.resolve().then(() => (init_codebase_map(), codebase_map_exports));
|
|
73041
|
+
const mapResult = await mapCodebase3(projectRootForMaint, { storeToBrain: true });
|
|
73042
|
+
actions.push({
|
|
73043
|
+
action: "codebase_map",
|
|
73044
|
+
status: "applied",
|
|
73045
|
+
details: `Analyzed: ${mapResult.stack?.languages?.length ?? 0} languages, ${mapResult.concerns?.todos?.length ?? 0} TODOs found`
|
|
73046
|
+
});
|
|
73047
|
+
} catch (err) {
|
|
73048
|
+
actions.push({
|
|
73049
|
+
action: "codebase_map",
|
|
73050
|
+
status: "error",
|
|
73051
|
+
details: `Codebase mapping failed: ${err instanceof Error ? err.message : String(err)}`
|
|
73052
|
+
});
|
|
73053
|
+
}
|
|
73054
|
+
}
|
|
73055
|
+
if (options.projectName) {
|
|
73056
|
+
try {
|
|
73057
|
+
const { updateProjectName: updateProjectName2 } = await Promise.resolve().then(() => (init_project_info(), project_info_exports));
|
|
73058
|
+
await updateProjectName2(projectRootForMaint, options.projectName);
|
|
73059
|
+
actions.push({
|
|
73060
|
+
action: "project_name_update",
|
|
73061
|
+
status: "applied",
|
|
73062
|
+
details: `Project name set to "${options.projectName}"`
|
|
73063
|
+
});
|
|
73064
|
+
} catch {
|
|
73065
|
+
}
|
|
73066
|
+
}
|
|
72978
73067
|
try {
|
|
72979
73068
|
const { existsSync: fsExistsSync } = await import("node:fs");
|
|
72980
73069
|
const { join: pathJoin } = await import("node:path");
|
|
@@ -77854,7 +77943,9 @@ var init_hooks_engine = __esm({
|
|
|
77854
77943
|
});
|
|
77855
77944
|
|
|
77856
77945
|
// packages/cleo/src/cli/index.ts
|
|
77857
|
-
import {
|
|
77946
|
+
import { readFileSync as readFileSync97 } from "node:fs";
|
|
77947
|
+
import { dirname as dirname25, join as join118 } from "node:path";
|
|
77948
|
+
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
77858
77949
|
|
|
77859
77950
|
// node_modules/.pnpm/citty@0.2.1/node_modules/citty/dist/_chunks/libs/scule.mjs
|
|
77860
77951
|
var NUMBER_CHAR_RE = /\d/;
|
|
@@ -91550,6 +91641,24 @@ function registerTreeCommand(program) {
|
|
|
91550
91641
|
});
|
|
91551
91642
|
}
|
|
91552
91643
|
|
|
91644
|
+
// packages/cleo/src/cli/commands/detect.ts
|
|
91645
|
+
init_internal();
|
|
91646
|
+
init_renderers();
|
|
91647
|
+
function registerDetectCommand(program) {
|
|
91648
|
+
program.command("detect").description("Re-detect project type and update project-context.json").action(async () => {
|
|
91649
|
+
const projectRoot = getProjectRoot();
|
|
91650
|
+
const result = await ensureProjectContext(projectRoot, { staleDays: 0 });
|
|
91651
|
+
cliOutput(
|
|
91652
|
+
{
|
|
91653
|
+
action: result.action,
|
|
91654
|
+
path: result.path,
|
|
91655
|
+
details: result.details
|
|
91656
|
+
},
|
|
91657
|
+
{ command: "detect" }
|
|
91658
|
+
);
|
|
91659
|
+
});
|
|
91660
|
+
}
|
|
91661
|
+
|
|
91553
91662
|
// packages/cleo/src/cli/commands/detect-drift.ts
|
|
91554
91663
|
init_src();
|
|
91555
91664
|
init_renderers();
|
|
@@ -92354,7 +92463,7 @@ init_src();
|
|
|
92354
92463
|
init_src2();
|
|
92355
92464
|
init_renderers();
|
|
92356
92465
|
import { execFileSync as execFileSync14 } from "node:child_process";
|
|
92357
|
-
import { existsSync as existsSync121, mkdirSync as mkdirSync25, readFileSync as readFileSync95, writeFileSync as
|
|
92466
|
+
import { existsSync as existsSync121, mkdirSync as mkdirSync25, readFileSync as readFileSync95, writeFileSync as writeFileSync21 } from "node:fs";
|
|
92358
92467
|
import { dirname as dirname23, join as join115 } from "node:path";
|
|
92359
92468
|
function getChangelogSource(cwd) {
|
|
92360
92469
|
const configPath = getConfigPath(cwd);
|
|
@@ -92508,7 +92617,7 @@ function registerGenerateChangelogCommand(program) {
|
|
|
92508
92617
|
if (!dryRun) {
|
|
92509
92618
|
const fullPath = join115(getProjectRoot(), outputPath);
|
|
92510
92619
|
mkdirSync25(dirname23(fullPath), { recursive: true });
|
|
92511
|
-
|
|
92620
|
+
writeFileSync21(fullPath, content, "utf-8");
|
|
92512
92621
|
}
|
|
92513
92622
|
results.push({ platform: targetPlatform, path: outputPath, written: !dryRun });
|
|
92514
92623
|
} else {
|
|
@@ -92529,7 +92638,7 @@ function registerGenerateChangelogCommand(program) {
|
|
|
92529
92638
|
if (!dryRun) {
|
|
92530
92639
|
const fullPath = join115(getProjectRoot(), platformConfig.path);
|
|
92531
92640
|
mkdirSync25(dirname23(fullPath), { recursive: true });
|
|
92532
|
-
|
|
92641
|
+
writeFileSync21(fullPath, content, "utf-8");
|
|
92533
92642
|
}
|
|
92534
92643
|
results.push({
|
|
92535
92644
|
platform: platformConfig.platform,
|
|
@@ -92670,14 +92779,12 @@ function registerImportTasksCommand(program) {
|
|
|
92670
92779
|
init_src2();
|
|
92671
92780
|
init_renderers();
|
|
92672
92781
|
function registerInitCommand(program) {
|
|
92673
|
-
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("--
|
|
92782
|
+
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) => {
|
|
92674
92783
|
try {
|
|
92675
|
-
if (opts["refresh"]) opts["detect"] = true;
|
|
92676
92784
|
const initOpts = {
|
|
92677
92785
|
name: opts["name"] || projectName || void 0,
|
|
92678
92786
|
force: !!opts["force"],
|
|
92679
92787
|
detect: !!opts["detect"],
|
|
92680
|
-
updateDocs: !!opts["updateDocs"],
|
|
92681
92788
|
mapCodebase: !!opts["mapCodebase"]
|
|
92682
92789
|
};
|
|
92683
92790
|
const result = await initProject(initOpts);
|
|
@@ -95592,7 +95699,9 @@ function registerUpdateCommand(program) {
|
|
|
95592
95699
|
init_internal();
|
|
95593
95700
|
init_renderers();
|
|
95594
95701
|
function registerUpgradeCommand(program) {
|
|
95595
|
-
program.command("upgrade").description(
|
|
95702
|
+
program.command("upgrade").description(
|
|
95703
|
+
"Unified project maintenance (storage migration, schema repair, structural fixes, doc refresh)"
|
|
95704
|
+
).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) => {
|
|
95596
95705
|
const opts = command.optsWithGlobals ? command.optsWithGlobals() : command.opts();
|
|
95597
95706
|
const isHuman = opts["human"] === true || !!process.stdout.isTTY && opts["json"] !== true;
|
|
95598
95707
|
const progress = createUpgradeProgress(isHuman);
|
|
@@ -95600,6 +95709,9 @@ function registerUpgradeCommand(program) {
|
|
|
95600
95709
|
const isDryRun = !!opts["dryRun"] || !!opts["status"];
|
|
95601
95710
|
const includeGlobal = !!opts["includeGlobal"];
|
|
95602
95711
|
const autoMigrate = opts["autoMigrate"] !== false;
|
|
95712
|
+
const forceDetect = !!opts["detect"];
|
|
95713
|
+
const mapCodebase3 = !!opts["mapCodebase"];
|
|
95714
|
+
const projectName = opts["name"];
|
|
95603
95715
|
progress.start();
|
|
95604
95716
|
progress.step(0, "Analyzing current state");
|
|
95605
95717
|
if (includeGlobal) {
|
|
@@ -95612,7 +95724,10 @@ function registerUpgradeCommand(program) {
|
|
|
95612
95724
|
const result = await runUpgrade({
|
|
95613
95725
|
dryRun: isDryRun,
|
|
95614
95726
|
includeGlobal,
|
|
95615
|
-
autoMigrate
|
|
95727
|
+
autoMigrate,
|
|
95728
|
+
forceDetect,
|
|
95729
|
+
mapCodebase: mapCodebase3,
|
|
95730
|
+
projectName
|
|
95616
95731
|
});
|
|
95617
95732
|
progress.step(4, "Verifying results");
|
|
95618
95733
|
cliOutput(
|
|
@@ -95685,7 +95800,7 @@ init_src();
|
|
|
95685
95800
|
init_src2();
|
|
95686
95801
|
init_renderers();
|
|
95687
95802
|
import { execFileSync as execFileSync16, spawn as spawn2 } from "node:child_process";
|
|
95688
|
-
import { mkdir as mkdir18, readFile as readFile22, rm as
|
|
95803
|
+
import { mkdir as mkdir18, readFile as readFile22, rm as rm3, stat as stat2, writeFile as writeFile13 } from "node:fs/promises";
|
|
95689
95804
|
import { join as join117 } from "node:path";
|
|
95690
95805
|
var DEFAULT_PORT = 3456;
|
|
95691
95806
|
var DEFAULT_HOST = "127.0.0.1";
|
|
@@ -95791,7 +95906,7 @@ function registerWebCommand(program) {
|
|
|
95791
95906
|
process.kill(serverProcess.pid);
|
|
95792
95907
|
} catch {
|
|
95793
95908
|
}
|
|
95794
|
-
await
|
|
95909
|
+
await rm3(pidFile, { force: true });
|
|
95795
95910
|
throw new CleoError(1 /* GENERAL_ERROR */, "Server failed to start within 15 seconds");
|
|
95796
95911
|
}
|
|
95797
95912
|
cliOutput(
|
|
@@ -95816,7 +95931,7 @@ function registerWebCommand(program) {
|
|
|
95816
95931
|
const { pidFile } = getWebPaths();
|
|
95817
95932
|
const status = await getStatus();
|
|
95818
95933
|
if (!status.running || !status.pid) {
|
|
95819
|
-
await
|
|
95934
|
+
await rm3(pidFile, { force: true });
|
|
95820
95935
|
cliOutput({ running: false }, { command: "web", message: "Server is not running" });
|
|
95821
95936
|
return;
|
|
95822
95937
|
}
|
|
@@ -95834,7 +95949,7 @@ function registerWebCommand(program) {
|
|
|
95834
95949
|
} catch {
|
|
95835
95950
|
}
|
|
95836
95951
|
}
|
|
95837
|
-
await
|
|
95952
|
+
await rm3(pidFile, { force: true });
|
|
95838
95953
|
cliOutput({ stopped: true }, { command: "web", message: "CLEO Web UI stopped" });
|
|
95839
95954
|
} catch (err) {
|
|
95840
95955
|
if (err instanceof CleoError) {
|
|
@@ -95887,7 +96002,12 @@ function registerWebCommand(program) {
|
|
|
95887
96002
|
}
|
|
95888
96003
|
|
|
95889
96004
|
// packages/cleo/src/cli/index.ts
|
|
95890
|
-
|
|
96005
|
+
function getPackageVersion() {
|
|
96006
|
+
const pkgPath = join118(dirname25(fileURLToPath7(import.meta.url)), "../../package.json");
|
|
96007
|
+
const pkg = JSON.parse(readFileSync97(pkgPath, "utf-8"));
|
|
96008
|
+
return pkg.version;
|
|
96009
|
+
}
|
|
96010
|
+
var CLI_VERSION = getPackageVersion();
|
|
95891
96011
|
var rootShim = new ShimCommand();
|
|
95892
96012
|
registerAddCommand(rootShim);
|
|
95893
96013
|
registerListCommand(rootShim);
|
|
@@ -95964,6 +96084,7 @@ registerStatsCommand(rootShim);
|
|
|
95964
96084
|
registerUpgradeCommand(rootShim);
|
|
95965
96085
|
registerValidateCommand(rootShim);
|
|
95966
96086
|
registerVerifyCommand(rootShim);
|
|
96087
|
+
registerDetectCommand(rootShim);
|
|
95967
96088
|
registerDetectDriftCommand(rootShim);
|
|
95968
96089
|
registerOpsCommand(rootShim);
|
|
95969
96090
|
registerSnapshotCommand(rootShim);
|