@cleocode/cleo 2026.3.47 → 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 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 init --update-docs"
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 init --update-docs"
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 init --update-docs"
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 init --update-docs"
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 init --update-docs"
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 init --update-docs"
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 init --update-docs"
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 init --update-docs"
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 init --update-docs"
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 init --update-docs"
58108
+ fix: "cleo upgrade"
58109
58109
  };
58110
58110
  }
58111
58111
  return {
@@ -64539,9 +64539,6 @@ async function updateDocs() {
64539
64539
  };
64540
64540
  }
64541
64541
  async function initProject(opts = {}) {
64542
- if (opts.updateDocs) {
64543
- return updateDocs();
64544
- }
64545
64542
  const cleoDir = getCleoDirAbsolute();
64546
64543
  const projRoot = getProjectRoot();
64547
64544
  const alreadyInitialized = existsSync100(cleoDir) && (existsSync100(join100(cleoDir, "tasks.db")) || existsSync100(join100(cleoDir, "config.json")));
@@ -64908,7 +64905,13 @@ var init_output = __esm({
64908
64905
  });
64909
64906
 
64910
64907
  // packages/core/src/project-info.ts
64911
- import { existsSync as existsSync102, readFileSync as readFileSync75 } from "node:fs";
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";
64912
64915
  import { readFile as readFile18 } from "node:fs/promises";
64913
64916
  import { join as join102 } from "node:path";
64914
64917
  async function getProjectInfo(cwd) {
@@ -64952,6 +64955,16 @@ function getProjectInfoSync(cwd) {
64952
64955
  return null;
64953
64956
  }
64954
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
+ }
64955
64968
  var init_project_info = __esm({
64956
64969
  "packages/core/src/project-info.ts"() {
64957
64970
  "use strict";
@@ -65449,7 +65462,6 @@ __export(src_exports, {
65449
65462
  });
65450
65463
  var init_src2 = __esm({
65451
65464
  "packages/core/src/index.ts"() {
65452
- "use strict";
65453
65465
  init_src();
65454
65466
  init_adapters();
65455
65467
  init_admin();
@@ -72381,7 +72393,7 @@ import {
72381
72393
  mkdirSync as mkdirSync23,
72382
72394
  readdirSync as readdirSync36,
72383
72395
  readFileSync as readFileSync82,
72384
- writeFileSync as writeFileSync19
72396
+ writeFileSync as writeFileSync20
72385
72397
  } from "node:fs";
72386
72398
  import { join as join108 } from "node:path";
72387
72399
  async function runUpgrade(options = {}) {
@@ -72527,7 +72539,7 @@ async function runUpgrade(options = {}) {
72527
72539
  if (totalImported === 0 && existsSync110(dbBackupPath)) {
72528
72540
  copyFileSync7(dbBackupPath, dbPath2);
72529
72541
  if (configBackup) {
72530
- writeFileSync19(configPath, configBackup);
72542
+ writeFileSync20(configPath, configBackup);
72531
72543
  }
72532
72544
  actions.push({
72533
72545
  action: "storage_migration",
@@ -72548,7 +72560,7 @@ async function runUpgrade(options = {}) {
72548
72560
  config2.storage = {};
72549
72561
  }
72550
72562
  config2.storage.engine = "sqlite";
72551
- writeFileSync19(configPath, JSON.stringify(config2, null, 2));
72563
+ writeFileSync20(configPath, JSON.stringify(config2, null, 2));
72552
72564
  actions.push({
72553
72565
  action: "storage_migration",
72554
72566
  status: "applied",
@@ -72570,7 +72582,7 @@ async function runUpgrade(options = {}) {
72570
72582
  copyFileSync7(dbBackupPath, dbPath2);
72571
72583
  }
72572
72584
  if (configBackup) {
72573
- writeFileSync19(configPath, configBackup);
72585
+ writeFileSync20(configPath, configBackup);
72574
72586
  }
72575
72587
  await updateMigrationPhase2(cleoDir2, "failed");
72576
72588
  for (const error40 of result.errors) {
@@ -72823,7 +72835,9 @@ async function runUpgrade(options = {}) {
72823
72835
  }
72824
72836
  }
72825
72837
  } else {
72826
- const contextResult = await ensureProjectContext(projectRootForContext, { staleDays: 30 });
72838
+ const contextResult = await ensureProjectContext(projectRootForContext, {
72839
+ staleDays: options.forceDetect ? 0 : 30
72840
+ });
72827
72841
  actions.push({
72828
72842
  action: "project_context_detection",
72829
72843
  status: contextResult.action === "skipped" ? "skipped" : "applied",
@@ -73021,6 +73035,35 @@ async function runUpgrade(options = {}) {
73021
73035
  }
73022
73036
  } catch {
73023
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
+ }
73024
73067
  try {
73025
73068
  const { existsSync: fsExistsSync } = await import("node:fs");
73026
73069
  const { join: pathJoin } = await import("node:path");
@@ -91598,6 +91641,24 @@ function registerTreeCommand(program) {
91598
91641
  });
91599
91642
  }
91600
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
+
91601
91662
  // packages/cleo/src/cli/commands/detect-drift.ts
91602
91663
  init_src();
91603
91664
  init_renderers();
@@ -92402,7 +92463,7 @@ init_src();
92402
92463
  init_src2();
92403
92464
  init_renderers();
92404
92465
  import { execFileSync as execFileSync14 } from "node:child_process";
92405
- import { existsSync as existsSync121, mkdirSync as mkdirSync25, readFileSync as readFileSync95, writeFileSync as writeFileSync20 } from "node:fs";
92466
+ import { existsSync as existsSync121, mkdirSync as mkdirSync25, readFileSync as readFileSync95, writeFileSync as writeFileSync21 } from "node:fs";
92406
92467
  import { dirname as dirname23, join as join115 } from "node:path";
92407
92468
  function getChangelogSource(cwd) {
92408
92469
  const configPath = getConfigPath(cwd);
@@ -92556,7 +92617,7 @@ function registerGenerateChangelogCommand(program) {
92556
92617
  if (!dryRun) {
92557
92618
  const fullPath = join115(getProjectRoot(), outputPath);
92558
92619
  mkdirSync25(dirname23(fullPath), { recursive: true });
92559
- writeFileSync20(fullPath, content, "utf-8");
92620
+ writeFileSync21(fullPath, content, "utf-8");
92560
92621
  }
92561
92622
  results.push({ platform: targetPlatform, path: outputPath, written: !dryRun });
92562
92623
  } else {
@@ -92577,7 +92638,7 @@ function registerGenerateChangelogCommand(program) {
92577
92638
  if (!dryRun) {
92578
92639
  const fullPath = join115(getProjectRoot(), platformConfig.path);
92579
92640
  mkdirSync25(dirname23(fullPath), { recursive: true });
92580
- writeFileSync20(fullPath, content, "utf-8");
92641
+ writeFileSync21(fullPath, content, "utf-8");
92581
92642
  }
92582
92643
  results.push({
92583
92644
  platform: platformConfig.platform,
@@ -92718,14 +92779,12 @@ function registerImportTasksCommand(program) {
92718
92779
  init_src2();
92719
92780
  init_renderers();
92720
92781
  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("--refresh", "Force re-detection of project type (alias for --detect)").option("--update-docs", "Update agent documentation injections").option("--map-codebase", "Run codebase analysis and store findings to brain.db").argument("[projectName]", "Project name (alternative to --name)").action(async (projectName, opts) => {
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) => {
92722
92783
  try {
92723
- if (opts["refresh"]) opts["detect"] = true;
92724
92784
  const initOpts = {
92725
92785
  name: opts["name"] || projectName || void 0,
92726
92786
  force: !!opts["force"],
92727
92787
  detect: !!opts["detect"],
92728
- updateDocs: !!opts["updateDocs"],
92729
92788
  mapCodebase: !!opts["mapCodebase"]
92730
92789
  };
92731
92790
  const result = await initProject(initOpts);
@@ -95640,7 +95699,9 @@ function registerUpdateCommand(program) {
95640
95699
  init_internal();
95641
95700
  init_renderers();
95642
95701
  function registerUpgradeCommand(program) {
95643
- program.command("upgrade").description("Unified project maintenance (storage migration, schema repair, structural fixes)").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").action(async (_opts, command) => {
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) => {
95644
95705
  const opts = command.optsWithGlobals ? command.optsWithGlobals() : command.opts();
95645
95706
  const isHuman = opts["human"] === true || !!process.stdout.isTTY && opts["json"] !== true;
95646
95707
  const progress = createUpgradeProgress(isHuman);
@@ -95648,6 +95709,9 @@ function registerUpgradeCommand(program) {
95648
95709
  const isDryRun = !!opts["dryRun"] || !!opts["status"];
95649
95710
  const includeGlobal = !!opts["includeGlobal"];
95650
95711
  const autoMigrate = opts["autoMigrate"] !== false;
95712
+ const forceDetect = !!opts["detect"];
95713
+ const mapCodebase3 = !!opts["mapCodebase"];
95714
+ const projectName = opts["name"];
95651
95715
  progress.start();
95652
95716
  progress.step(0, "Analyzing current state");
95653
95717
  if (includeGlobal) {
@@ -95660,7 +95724,10 @@ function registerUpgradeCommand(program) {
95660
95724
  const result = await runUpgrade({
95661
95725
  dryRun: isDryRun,
95662
95726
  includeGlobal,
95663
- autoMigrate
95727
+ autoMigrate,
95728
+ forceDetect,
95729
+ mapCodebase: mapCodebase3,
95730
+ projectName
95664
95731
  });
95665
95732
  progress.step(4, "Verifying results");
95666
95733
  cliOutput(
@@ -96017,6 +96084,7 @@ registerStatsCommand(rootShim);
96017
96084
  registerUpgradeCommand(rootShim);
96018
96085
  registerValidateCommand(rootShim);
96019
96086
  registerVerifyCommand(rootShim);
96087
+ registerDetectCommand(rootShim);
96020
96088
  registerDetectDriftCommand(rootShim);
96021
96089
  registerOpsCommand(rootShim);
96022
96090
  registerSnapshotCommand(rootShim);