@cleocode/cleo 2026.3.46 → 2026.3.47

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
@@ -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 -->[\s\S]*?<!-- CLEO:END -->\n?/g, "");
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 rm3 of raw.resourceMetrics ?? []) {
39449
- for (const sm of rm3.scopeMetrics ?? []) {
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: readFileSync97, existsSync: existsSync122 } = await import("node:fs");
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(readFileSync97(infoPath, "utf-8"));
42253
+ const data = JSON.parse(readFileSync98(infoPath, "utf-8"));
42226
42254
  return typeof data.projectId === "string" ? data.projectId : "";
42227
42255
  } catch {
42228
42256
  return "";
@@ -65523,6 +65551,7 @@ async function bootstrapGlobalCleo(options) {
65523
65551
  await injectAgentsHub(ctx);
65524
65552
  await installMcpToProviders(ctx);
65525
65553
  await installSkillsGlobally(ctx);
65554
+ await installAgentDefinitionGlobally(ctx);
65526
65555
  await installProviderAdapters(ctx, options?.packageRoot);
65527
65556
  return ctx;
65528
65557
  }
@@ -65573,7 +65602,10 @@ async function injectAgentsHub(ctx) {
65573
65602
  await mkdir17(globalAgentsDir, { recursive: true });
65574
65603
  if (existsSync103(globalAgentsMd)) {
65575
65604
  const content = await readFile19(globalAgentsMd, "utf8");
65576
- const stripped = content.replace(/\n?<!-- CLEO:START -->[\s\S]*?<!-- CLEO:END -->\n?/g, "");
65605
+ const stripped = content.replace(
65606
+ /\n?<!-- CLEO:START[^>]*-->[\s\S]*?<!-- CLEO:END -->\n?/g,
65607
+ ""
65608
+ );
65577
65609
  if (stripped !== content) {
65578
65610
  await writeFile12(globalAgentsMd, stripped, "utf8");
65579
65611
  }
@@ -65597,7 +65629,7 @@ async function injectAgentsHub(ctx) {
65597
65629
  if (existsSync103(instructFilePath)) {
65598
65630
  const fileContent = await readFile19(instructFilePath, "utf8");
65599
65631
  const stripped = fileContent.replace(
65600
- /\n?<!-- CLEO:START -->[\s\S]*?<!-- CLEO:END -->\n?/g,
65632
+ /\n?<!-- CLEO:START[^>]*-->[\s\S]*?<!-- CLEO:END -->\n?/g,
65601
65633
  ""
65602
65634
  );
65603
65635
  if (stripped !== fileContent) {
@@ -65666,6 +65698,20 @@ async function installSkillsGlobally(ctx) {
65666
65698
  );
65667
65699
  }
65668
65700
  }
65701
+ async function installAgentDefinitionGlobally(ctx) {
65702
+ try {
65703
+ if (!ctx.isDryRun) {
65704
+ const { initAgentDefinition: initAgentDefinition2 } = await Promise.resolve().then(() => (init_init(), init_exports));
65705
+ await initAgentDefinition2(ctx.created, ctx.warnings);
65706
+ } else {
65707
+ ctx.created.push("agent: cleo-subagent (would symlink)");
65708
+ }
65709
+ } catch (err) {
65710
+ ctx.warnings.push(
65711
+ `Agent definition install: ${err instanceof Error ? err.message : String(err)}`
65712
+ );
65713
+ }
65714
+ }
65669
65715
  async function installProviderAdapters(ctx, packageRootOverride) {
65670
65716
  try {
65671
65717
  const { AdapterManager: AdapterManager2 } = await Promise.resolve().then(() => (init_adapters(), adapters_exports));
@@ -77854,7 +77900,9 @@ var init_hooks_engine = __esm({
77854
77900
  });
77855
77901
 
77856
77902
  // packages/cleo/src/cli/index.ts
77857
- import { join as join118 } from "node:path";
77903
+ import { readFileSync as readFileSync97 } from "node:fs";
77904
+ import { dirname as dirname25, join as join118 } from "node:path";
77905
+ import { fileURLToPath as fileURLToPath7 } from "node:url";
77858
77906
 
77859
77907
  // node_modules/.pnpm/citty@0.2.1/node_modules/citty/dist/_chunks/libs/scule.mjs
77860
77908
  var NUMBER_CHAR_RE = /\d/;
@@ -95685,7 +95733,7 @@ init_src();
95685
95733
  init_src2();
95686
95734
  init_renderers();
95687
95735
  import { execFileSync as execFileSync16, spawn as spawn2 } from "node:child_process";
95688
- import { mkdir as mkdir18, readFile as readFile22, rm as rm2, stat as stat2, writeFile as writeFile13 } from "node:fs/promises";
95736
+ import { mkdir as mkdir18, readFile as readFile22, rm as rm3, stat as stat2, writeFile as writeFile13 } from "node:fs/promises";
95689
95737
  import { join as join117 } from "node:path";
95690
95738
  var DEFAULT_PORT = 3456;
95691
95739
  var DEFAULT_HOST = "127.0.0.1";
@@ -95791,7 +95839,7 @@ function registerWebCommand(program) {
95791
95839
  process.kill(serverProcess.pid);
95792
95840
  } catch {
95793
95841
  }
95794
- await rm2(pidFile, { force: true });
95842
+ await rm3(pidFile, { force: true });
95795
95843
  throw new CleoError(1 /* GENERAL_ERROR */, "Server failed to start within 15 seconds");
95796
95844
  }
95797
95845
  cliOutput(
@@ -95816,7 +95864,7 @@ function registerWebCommand(program) {
95816
95864
  const { pidFile } = getWebPaths();
95817
95865
  const status = await getStatus();
95818
95866
  if (!status.running || !status.pid) {
95819
- await rm2(pidFile, { force: true });
95867
+ await rm3(pidFile, { force: true });
95820
95868
  cliOutput({ running: false }, { command: "web", message: "Server is not running" });
95821
95869
  return;
95822
95870
  }
@@ -95834,7 +95882,7 @@ function registerWebCommand(program) {
95834
95882
  } catch {
95835
95883
  }
95836
95884
  }
95837
- await rm2(pidFile, { force: true });
95885
+ await rm3(pidFile, { force: true });
95838
95886
  cliOutput({ stopped: true }, { command: "web", message: "CLEO Web UI stopped" });
95839
95887
  } catch (err) {
95840
95888
  if (err instanceof CleoError) {
@@ -95887,7 +95935,12 @@ function registerWebCommand(program) {
95887
95935
  }
95888
95936
 
95889
95937
  // packages/cleo/src/cli/index.ts
95890
- var CLI_VERSION = "2026.3.38";
95938
+ function getPackageVersion() {
95939
+ const pkgPath = join118(dirname25(fileURLToPath7(import.meta.url)), "../../package.json");
95940
+ const pkg = JSON.parse(readFileSync97(pkgPath, "utf-8"));
95941
+ return pkg.version;
95942
+ }
95943
+ var CLI_VERSION = getPackageVersion();
95891
95944
  var rootShim = new ShimCommand();
95892
95945
  registerAddCommand(rootShim);
95893
95946
  registerListCommand(rootShim);