@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/mcp/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 {
@@ -64305,7 +64305,14 @@ async function initAgentDefinition(created, warnings) {
64305
64305
  try {
64306
64306
  try {
64307
64307
  const stat2 = await lstat(globalAgentsDir);
64308
- if (stat2.isSymbolicLink() || stat2.isDirectory()) {
64308
+ if (stat2.isSymbolicLink()) {
64309
+ const { readlink } = await import("node:fs/promises");
64310
+ const currentTarget = await readlink(globalAgentsDir);
64311
+ if (currentTarget === agentSourceDir) {
64312
+ return;
64313
+ }
64314
+ await unlink4(globalAgentsDir);
64315
+ } else if (stat2.isDirectory()) {
64309
64316
  return;
64310
64317
  }
64311
64318
  } catch {
@@ -64511,9 +64518,6 @@ async function updateDocs() {
64511
64518
  };
64512
64519
  }
64513
64520
  async function initProject(opts = {}) {
64514
- if (opts.updateDocs) {
64515
- return updateDocs();
64516
- }
64517
64521
  const cleoDir = getCleoDirAbsolute();
64518
64522
  const projRoot = getProjectRoot();
64519
64523
  const alreadyInitialized = existsSync100(cleoDir) && (existsSync100(join100(cleoDir, "tasks.db")) || existsSync100(join100(cleoDir, "config.json")));
@@ -64880,7 +64884,13 @@ var init_output = __esm({
64880
64884
  });
64881
64885
 
64882
64886
  // packages/core/src/project-info.ts
64883
- import { existsSync as existsSync102, readFileSync as readFileSync75 } from "node:fs";
64887
+ var project_info_exports = {};
64888
+ __export(project_info_exports, {
64889
+ getProjectInfo: () => getProjectInfo,
64890
+ getProjectInfoSync: () => getProjectInfoSync,
64891
+ updateProjectName: () => updateProjectName
64892
+ });
64893
+ import { existsSync as existsSync102, readFileSync as readFileSync75, writeFileSync as writeFileSync19 } from "node:fs";
64884
64894
  import { readFile as readFile18 } from "node:fs/promises";
64885
64895
  import { join as join102 } from "node:path";
64886
64896
  async function getProjectInfo(cwd) {
@@ -64924,6 +64934,16 @@ function getProjectInfoSync(cwd) {
64924
64934
  return null;
64925
64935
  }
64926
64936
  }
64937
+ function updateProjectName(cwd, name2) {
64938
+ const cleoDir = getCleoDirAbsolute(cwd);
64939
+ const infoPath = join102(cleoDir, "project-info.json");
64940
+ if (!existsSync102(infoPath)) return;
64941
+ const data = JSON.parse(readFileSync75(infoPath, "utf-8"));
64942
+ data.projectName = name2;
64943
+ data.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
64944
+ writeFileSync19(infoPath, `${JSON.stringify(data, null, 2)}
64945
+ `);
64946
+ }
64927
64947
  var init_project_info = __esm({
64928
64948
  "packages/core/src/project-info.ts"() {
64929
64949
  "use strict";
@@ -65297,6 +65317,11 @@ async function bootstrapGlobalCleo(options) {
65297
65317
  warnings: [],
65298
65318
  isDryRun: options?.dryRun ?? false
65299
65319
  };
65320
+ try {
65321
+ const { ensureGlobalHome: ensureGlobalHome2 } = await Promise.resolve().then(() => (init_scaffold(), scaffold_exports));
65322
+ await ensureGlobalHome2();
65323
+ } catch {
65324
+ }
65300
65325
  await ensureGlobalTemplatesBootstrap(ctx, options?.packageRoot);
65301
65326
  await injectAgentsHub(ctx);
65302
65327
  await installMcpToProviders(ctx);
@@ -65352,13 +65377,9 @@ async function injectAgentsHub(ctx) {
65352
65377
  await mkdir17(globalAgentsDir, { recursive: true });
65353
65378
  if (existsSync103(globalAgentsMd)) {
65354
65379
  const content = await readFile19(globalAgentsMd, "utf8");
65355
- const stripped = content.replace(
65356
- /\n?<!-- CLEO:START[^>]*-->[\s\S]*?<!-- CLEO:END -->\n?/g,
65357
- ""
65358
- );
65359
- if (stripped !== content) {
65360
- await writeFile12(globalAgentsMd, stripped, "utf8");
65361
- }
65380
+ const stripped = content.replace(/\n?<!-- CLEO:START[^>]*-->[\s\S]*?<!-- CLEO:END -->\n?/g, "").replace(/\n?<!-- CAAMP:START -->[\s\S]*?<!-- CAAMP:END -->\n?/g, "").trim();
65381
+ await writeFile12(globalAgentsMd, stripped ? `${stripped}
65382
+ ` : "", "utf8");
65362
65383
  }
65363
65384
  const expectedContent = "@~/.cleo/templates/CLEO-INJECTION.md";
65364
65385
  const action = await inject2(globalAgentsMd, expectedContent);
@@ -72131,7 +72152,7 @@ import {
72131
72152
  mkdirSync as mkdirSync23,
72132
72153
  readdirSync as readdirSync36,
72133
72154
  readFileSync as readFileSync82,
72134
- writeFileSync as writeFileSync19
72155
+ writeFileSync as writeFileSync20
72135
72156
  } from "node:fs";
72136
72157
  import { join as join108 } from "node:path";
72137
72158
  async function runUpgrade(options = {}) {
@@ -72277,7 +72298,7 @@ async function runUpgrade(options = {}) {
72277
72298
  if (totalImported === 0 && existsSync110(dbBackupPath)) {
72278
72299
  copyFileSync7(dbBackupPath, dbPath2);
72279
72300
  if (configBackup) {
72280
- writeFileSync19(configPath, configBackup);
72301
+ writeFileSync20(configPath, configBackup);
72281
72302
  }
72282
72303
  actions.push({
72283
72304
  action: "storage_migration",
@@ -72298,7 +72319,7 @@ async function runUpgrade(options = {}) {
72298
72319
  config2.storage = {};
72299
72320
  }
72300
72321
  config2.storage.engine = "sqlite";
72301
- writeFileSync19(configPath, JSON.stringify(config2, null, 2));
72322
+ writeFileSync20(configPath, JSON.stringify(config2, null, 2));
72302
72323
  actions.push({
72303
72324
  action: "storage_migration",
72304
72325
  status: "applied",
@@ -72320,7 +72341,7 @@ async function runUpgrade(options = {}) {
72320
72341
  copyFileSync7(dbBackupPath, dbPath2);
72321
72342
  }
72322
72343
  if (configBackup) {
72323
- writeFileSync19(configPath, configBackup);
72344
+ writeFileSync20(configPath, configBackup);
72324
72345
  }
72325
72346
  await updateMigrationPhase2(cleoDir2, "failed");
72326
72347
  for (const error40 of result.errors) {
@@ -72573,7 +72594,9 @@ async function runUpgrade(options = {}) {
72573
72594
  }
72574
72595
  }
72575
72596
  } else {
72576
- const contextResult = await ensureProjectContext(projectRootForContext, { staleDays: 30 });
72597
+ const contextResult = await ensureProjectContext(projectRootForContext, {
72598
+ staleDays: options.forceDetect ? 0 : 30
72599
+ });
72577
72600
  actions.push({
72578
72601
  action: "project_context_detection",
72579
72602
  status: contextResult.action === "skipped" ? "skipped" : "applied",
@@ -72771,6 +72794,35 @@ async function runUpgrade(options = {}) {
72771
72794
  }
72772
72795
  } catch {
72773
72796
  }
72797
+ if (options.mapCodebase) {
72798
+ try {
72799
+ const { mapCodebase: mapCodebase3 } = await Promise.resolve().then(() => (init_codebase_map(), codebase_map_exports));
72800
+ const mapResult = await mapCodebase3(projectRootForMaint, { storeToBrain: true });
72801
+ actions.push({
72802
+ action: "codebase_map",
72803
+ status: "applied",
72804
+ details: `Analyzed: ${mapResult.stack?.languages?.length ?? 0} languages, ${mapResult.concerns?.todos?.length ?? 0} TODOs found`
72805
+ });
72806
+ } catch (err) {
72807
+ actions.push({
72808
+ action: "codebase_map",
72809
+ status: "error",
72810
+ details: `Codebase mapping failed: ${err instanceof Error ? err.message : String(err)}`
72811
+ });
72812
+ }
72813
+ }
72814
+ if (options.projectName) {
72815
+ try {
72816
+ const { updateProjectName: updateProjectName2 } = await Promise.resolve().then(() => (init_project_info(), project_info_exports));
72817
+ await updateProjectName2(projectRootForMaint, options.projectName);
72818
+ actions.push({
72819
+ action: "project_name_update",
72820
+ status: "applied",
72821
+ details: `Project name set to "${options.projectName}"`
72822
+ });
72823
+ } catch {
72824
+ }
72825
+ }
72774
72826
  try {
72775
72827
  const { existsSync: fsExistsSync } = await import("node:fs");
72776
72828
  const { join: pathJoin } = await import("node:path");