@cleocode/cleo 2026.3.51 → 2026.3.53

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
@@ -35539,16 +35539,33 @@ async function ensureGlobalHome() {
35539
35539
  for (const subdir of REQUIRED_GLOBAL_SUBDIRS) {
35540
35540
  await mkdir5(join37(cleoHome, subdir), { recursive: true });
35541
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
- );
35542
+ const globalConfigPath = join37(cleoHome, "config.json");
35543
+ if (!existsSync34(globalConfigPath)) {
35544
+ const templatePath = join37(getPackageRoot(), "templates", "global-config.template.json");
35545
+ if (existsSync34(templatePath)) {
35546
+ const template = readFileSync22(templatePath, "utf-8");
35547
+ const resolved = template.replace("{{SCHEMA_VERSION_GLOBAL_CONFIG}}", "1.0.0");
35548
+ await writeFile5(globalConfigPath, resolved);
35549
+ }
35550
+ }
35551
+ const homedir7 = (await import("node:os")).homedir();
35552
+ const legacyCleoHome = join37(homedir7, ".cleo");
35553
+ const cleanupPaths = [cleoHome];
35554
+ if (legacyCleoHome !== cleoHome && existsSync34(legacyCleoHome)) {
35555
+ cleanupPaths.push(legacyCleoHome);
35556
+ }
35557
+ for (const homeDir of cleanupPaths) {
35558
+ for (const stale of STALE_GLOBAL_ENTRIES) {
35559
+ const stalePath = join37(homeDir, stale);
35560
+ if (existsSync34(stalePath)) {
35561
+ try {
35562
+ await rm2(stalePath, { recursive: true, force: true });
35563
+ console.warn(`[CLEO] Removed stale global entry: ${stalePath}`);
35564
+ } catch (err) {
35565
+ console.warn(
35566
+ `[CLEO] Could not remove stale global entry ${stalePath}: ${err instanceof Error ? err.message : String(err)}`
35567
+ );
35568
+ }
35552
35569
  }
35553
35570
  }
35554
35571
  }
@@ -35736,7 +35753,9 @@ backups/
35736
35753
  "brain-worker.pid",
35737
35754
  "VERSION",
35738
35755
  "schemas",
35739
- "bin"
35756
+ "bin",
35757
+ ".install-state",
35758
+ "templates/templates"
35740
35759
  ];
35741
35760
  }
35742
35761
  });
@@ -65049,9 +65068,13 @@ async function injectAgentsHub(ctx) {
65049
65068
  await mkdir17(globalAgentsDir, { recursive: true });
65050
65069
  if (existsSync103(globalAgentsMd)) {
65051
65070
  const content = await readFile19(globalAgentsMd, "utf8");
65052
- const stripped = content.replace(/\n?<!-- CLEO:START[^>]*-->[\s\S]*?<!-- CLEO:END -->\n?/g, "").replace(/\n?<!-- CAAMP:START -->[\s\S]*?<!-- CAAMP:END -->\n?/g, "").trim();
65053
- await writeFile12(globalAgentsMd, stripped ? `${stripped}
65054
- ` : "", "utf8");
65071
+ const stripped = content.replace(
65072
+ /\n?<!-- CLEO:START[^>]*-->[\s\S]*?<!-- CLEO:END -->\n?/g,
65073
+ ""
65074
+ );
65075
+ if (stripped !== content) {
65076
+ await writeFile12(globalAgentsMd, stripped, "utf8");
65077
+ }
65055
65078
  }
65056
65079
  const expectedContent = "@~/.cleo/templates/CLEO-INJECTION.md";
65057
65080
  const action = await inject2(globalAgentsMd, expectedContent);