@cleocode/core 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.
Files changed (37) hide show
  1. package/dist/bootstrap.d.ts.map +1 -1
  2. package/dist/index.js +44 -41
  3. package/dist/index.js.map +3 -3
  4. package/dist/init.d.ts +1 -3
  5. package/dist/init.d.ts.map +1 -1
  6. package/dist/project-info.d.ts +5 -0
  7. package/dist/project-info.d.ts.map +1 -1
  8. package/dist/scaffold.d.ts +19 -0
  9. package/dist/scaffold.d.ts.map +1 -1
  10. package/dist/upgrade.d.ts +6 -0
  11. package/dist/upgrade.d.ts.map +1 -1
  12. package/package.json +5 -5
  13. package/src/__tests__/injection-chain.test.d.ts +4 -3
  14. package/src/__tests__/injection-chain.test.d.ts.map +1 -1
  15. package/src/__tests__/injection-chain.test.js +11 -10
  16. package/src/__tests__/injection-chain.test.js.map +1 -1
  17. package/src/__tests__/injection-chain.test.ts +3 -2
  18. package/src/__tests__/injection-mvi-tiers.test.js +4 -2
  19. package/src/__tests__/injection-mvi-tiers.test.js.map +1 -1
  20. package/src/bootstrap.ts +34 -5
  21. package/src/init.ts +1 -8
  22. package/src/injection.ts +6 -6
  23. package/src/project-info.ts +16 -1
  24. package/src/scaffold.ts +52 -2
  25. package/src/sessions/__tests__/briefing.test.js +28 -2
  26. package/src/sessions/__tests__/briefing.test.js.map +1 -1
  27. package/src/skills/__tests__/routing-table.test.js +48 -31
  28. package/src/skills/__tests__/routing-table.test.js.map +1 -1
  29. package/src/skills/orchestrator/__tests__/spawn-tier.test.js +41 -32
  30. package/src/skills/orchestrator/__tests__/spawn-tier.test.js.map +1 -1
  31. package/src/store/__tests__/project-detect.test.js +1 -1
  32. package/src/store/__tests__/project-detect.test.js.map +1 -1
  33. package/src/store/__tests__/test-db-helper.d.ts.map +1 -1
  34. package/src/store/__tests__/test-db-helper.js +0 -1
  35. package/src/store/__tests__/test-db-helper.js.map +1 -1
  36. package/src/upgrade.ts +49 -2
  37. package/src/validation/doctor/checks.ts +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAWH,iEAAiE;AACjE,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,uCAAuC;AACvC,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAuB/F;AA6HD;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmChF;AAID;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAahF"}
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAWH,iEAAiE;AACjE,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,uCAAuC;AACvC,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA0B/F;AAiID;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmChF;AAID;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAahF"}
package/dist/index.js CHANGED
@@ -18900,7 +18900,7 @@ function checkInjection2(projectRoot) {
18900
18900
  status: "warning",
18901
18901
  message: "AGENTS.md not found in project root",
18902
18902
  details: { path: agentsMdPath, exists: false },
18903
- fix: "cleo init --update-docs"
18903
+ fix: "cleo upgrade"
18904
18904
  };
18905
18905
  }
18906
18906
  let content;
@@ -18925,7 +18925,7 @@ function checkInjection2(projectRoot) {
18925
18925
  status: "warning",
18926
18926
  message: "AGENTS.md exists but has no CAAMP markers",
18927
18927
  details: { path: agentsMdPath, hasCaampMarker: false },
18928
- fix: "cleo init --update-docs"
18928
+ fix: "cleo upgrade"
18929
18929
  };
18930
18930
  }
18931
18931
  if (startCount !== endCount) {
@@ -18935,7 +18935,7 @@ function checkInjection2(projectRoot) {
18935
18935
  status: "warning",
18936
18936
  message: `CAAMP markers unbalanced: ${startCount} START vs ${endCount} END`,
18937
18937
  details: { path: agentsMdPath, startCount, endCount },
18938
- fix: "cleo init --update-docs"
18938
+ fix: "cleo upgrade"
18939
18939
  };
18940
18940
  }
18941
18941
  const caampMatch = content.match(/<!-- CAAMP:START -->([\s\S]*?)<!-- CAAMP:END -->/);
@@ -18957,7 +18957,7 @@ function checkInjection2(projectRoot) {
18957
18957
  status: "warning",
18958
18958
  message: `Missing @ reference targets: ${missing.join(", ")}`,
18959
18959
  details: { path: agentsMdPath, missing, totalRefs: refs.length },
18960
- fix: "cleo init --update-docs"
18960
+ fix: "cleo upgrade"
18961
18961
  };
18962
18962
  }
18963
18963
  }
@@ -18974,7 +18974,7 @@ function checkInjection2(projectRoot) {
18974
18974
  status: "warning",
18975
18975
  message: `CLAUDE.md CAAMP markers unbalanced: ${cStartCount} START vs ${cEndCount} END`,
18976
18976
  details: { file: "CLAUDE.md", startCount: cStartCount, endCount: cEndCount },
18977
- fix: "cleo init --update-docs"
18977
+ fix: "cleo upgrade"
18978
18978
  };
18979
18979
  }
18980
18980
  if (cStartCount === 0) {
@@ -18984,7 +18984,7 @@ function checkInjection2(projectRoot) {
18984
18984
  status: "warning",
18985
18985
  message: "CLAUDE.md has no CAAMP markers",
18986
18986
  details: { file: "CLAUDE.md", hasCaampMarker: false },
18987
- fix: "cleo init --update-docs"
18987
+ fix: "cleo upgrade"
18988
18988
  };
18989
18989
  }
18990
18990
  } catch {
@@ -19013,6 +19013,7 @@ __export(scaffold_exports, {
19013
19013
  CLEO_GITIGNORE_FALLBACK: () => CLEO_GITIGNORE_FALLBACK,
19014
19014
  REQUIRED_CLEO_SUBDIRS: () => REQUIRED_CLEO_SUBDIRS,
19015
19015
  REQUIRED_GLOBAL_SUBDIRS: () => REQUIRED_GLOBAL_SUBDIRS,
19016
+ STALE_GLOBAL_ENTRIES: () => STALE_GLOBAL_ENTRIES,
19016
19017
  checkBrainDb: () => checkBrainDb,
19017
19018
  checkCleoGitRepo: () => checkCleoGitRepo,
19018
19019
  checkCleoStructure: () => checkCleoStructure,
@@ -19049,7 +19050,7 @@ __export(scaffold_exports, {
19049
19050
  import { execFile as execFile3 } from "node:child_process";
19050
19051
  import { randomUUID } from "node:crypto";
19051
19052
  import { existsSync as existsSync33, constants as fsConstants3, readFileSync as readFileSync22, statSync as statSync8 } from "node:fs";
19052
- import { access as access3, mkdir as mkdir5, readFile as readFile6, writeFile as writeFile5 } from "node:fs/promises";
19053
+ import { access as access3, mkdir as mkdir5, readFile as readFile6, rm as rm2, writeFile as writeFile5 } from "node:fs/promises";
19053
19054
  import { dirname as dirname8, join as join37, resolve as resolve5 } from "node:path";
19054
19055
  import { fileURLToPath as fileURLToPath4 } from "node:url";
19055
19056
  import { promisify as promisify3 } from "node:util";
@@ -19064,7 +19065,7 @@ async function fileExists(path2) {
19064
19065
  async function stripCLEOBlocks(filePath) {
19065
19066
  if (!existsSync33(filePath)) return;
19066
19067
  const content = await readFile6(filePath, "utf8");
19067
- const stripped = content.replace(/\n?<!-- CLEO:START -->[\s\S]*?<!-- CLEO:END -->\n?/g, "");
19068
+ const stripped = content.replace(/\n?<!-- CLEO:START[^>]*-->[\s\S]*?<!-- CLEO:END -->\n?/g, "");
19068
19069
  if (stripped !== content) await writeFile5(filePath, stripped, "utf8");
19069
19070
  }
19070
19071
  async function removeCleoFromRootGitignore(projectRoot) {
@@ -19747,6 +19748,19 @@ async function ensureGlobalHome() {
19747
19748
  for (const subdir of REQUIRED_GLOBAL_SUBDIRS) {
19748
19749
  await mkdir5(join37(cleoHome, subdir), { recursive: true });
19749
19750
  }
19751
+ for (const stale of STALE_GLOBAL_ENTRIES) {
19752
+ const stalePath = join37(cleoHome, stale);
19753
+ if (existsSync33(stalePath)) {
19754
+ try {
19755
+ await rm2(stalePath, { recursive: true, force: true });
19756
+ console.warn(`[CLEO] Removed stale global entry: ${stalePath}`);
19757
+ } catch (err) {
19758
+ console.warn(
19759
+ `[CLEO] Could not remove stale global entry ${stalePath}: ${err instanceof Error ? err.message : String(err)}`
19760
+ );
19761
+ }
19762
+ }
19763
+ }
19750
19764
  return {
19751
19765
  action: alreadyExists ? "skipped" : "created",
19752
19766
  path: cleoHome,
@@ -19861,7 +19875,7 @@ function checkLogDir(projectRoot) {
19861
19875
  fix: null
19862
19876
  };
19863
19877
  }
19864
- var execFileAsync3, REQUIRED_CLEO_SUBDIRS, CLEO_GITIGNORE_FALLBACK, REQUIRED_GLOBAL_SUBDIRS;
19878
+ var execFileAsync3, REQUIRED_CLEO_SUBDIRS, CLEO_GITIGNORE_FALLBACK, REQUIRED_GLOBAL_SUBDIRS, STALE_GLOBAL_ENTRIES;
19865
19879
  var init_scaffold = __esm({
19866
19880
  "packages/core/src/scaffold.ts"() {
19867
19881
  "use strict";
@@ -19919,6 +19933,20 @@ metrics/
19919
19933
  backups/
19920
19934
  `;
19921
19935
  REQUIRED_GLOBAL_SUBDIRS = ["logs", "templates"];
19936
+ STALE_GLOBAL_ENTRIES = [
19937
+ "adrs",
19938
+ "rcasd",
19939
+ "agent-outputs",
19940
+ "backups",
19941
+ "sandbox",
19942
+ "tasks.db",
19943
+ "tasks.db-shm",
19944
+ "tasks.db-wal",
19945
+ "brain-worker.pid",
19946
+ "VERSION",
19947
+ "schemas",
19948
+ "bin"
19949
+ ];
19922
19950
  }
19923
19951
  });
19924
19952
 
@@ -41462,8 +41490,8 @@ function parseTokenMetrics(inputFile, cwd) {
41462
41490
  const raw = JSON.parse(readFileSync28(file2, "utf-8"));
41463
41491
  if (raw.resourceMetrics) {
41464
41492
  const points = [];
41465
- for (const rm2 of raw.resourceMetrics ?? []) {
41466
- for (const sm of rm2.scopeMetrics ?? []) {
41493
+ for (const rm3 of raw.resourceMetrics ?? []) {
41494
+ for (const sm of rm3.scopeMetrics ?? []) {
41467
41495
  for (const metric of sm.metrics ?? []) {
41468
41496
  if (metric.name !== "claude_code.token.usage") continue;
41469
41497
  for (const dp of metric.sum?.dataPoints ?? []) {
@@ -55905,7 +55933,7 @@ function checkAgentsMdHub(projectRoot) {
55905
55933
  status: "warning",
55906
55934
  message: "AGENTS.md not found in project root",
55907
55935
  details: { path: agentsMdPath, exists: false },
55908
- fix: "cleo init --update-docs"
55936
+ fix: "cleo upgrade"
55909
55937
  };
55910
55938
  }
55911
55939
  let content;
@@ -55928,7 +55956,7 @@ function checkAgentsMdHub(projectRoot) {
55928
55956
  status: "warning",
55929
55957
  message: "AGENTS.md exists but has no CAAMP:START marker",
55930
55958
  details: { path: agentsMdPath, hasCaampMarker: false },
55931
- fix: "cleo init --update-docs"
55959
+ fix: "cleo upgrade"
55932
55960
  };
55933
55961
  }
55934
55962
  return {
@@ -56267,7 +56295,7 @@ function checkCaampMarkerIntegrity(projectRoot) {
56267
56295
  status: "warning",
56268
56296
  message: `CAAMP marker issues: ${issues.join("; ")}`,
56269
56297
  details: { issues },
56270
- fix: "cleo init --update-docs"
56298
+ fix: "cleo upgrade"
56271
56299
  };
56272
56300
  }
56273
56301
  return {
@@ -56333,7 +56361,7 @@ function checkAtReferenceTargetExists(projectRoot) {
56333
56361
  status: "warning",
56334
56362
  message: `Missing @ reference targets: ${missing.join(", ")}`,
56335
56363
  details: { missing, totalRefs: refs.length },
56336
- fix: "cleo init --update-docs"
56364
+ fix: "cleo upgrade"
56337
56365
  };
56338
56366
  }
56339
56367
  return {
@@ -61914,32 +61942,7 @@ async function installGitHubTemplates(projectRoot, created, skipped) {
61914
61942
  }
61915
61943
  }
61916
61944
  }
61917
- async function updateDocs() {
61918
- const cleoDir = getCleoDirAbsolute();
61919
- const projRoot = getProjectRoot();
61920
- const created = [];
61921
- const warnings = [];
61922
- try {
61923
- const result = await ensureInjection(projRoot);
61924
- if (result.action !== "skipped") {
61925
- created.push(`injection: ${result.details ?? result.action}`);
61926
- }
61927
- } catch (err) {
61928
- warnings.push(`CAAMP injection: ${err instanceof Error ? err.message : String(err)}`);
61929
- }
61930
- return {
61931
- initialized: true,
61932
- directory: cleoDir,
61933
- created,
61934
- skipped: [],
61935
- warnings,
61936
- updateDocsOnly: true
61937
- };
61938
- }
61939
61945
  async function initProject(opts = {}) {
61940
- if (opts.updateDocs) {
61941
- return updateDocs();
61942
- }
61943
61946
  const cleoDir = getCleoDirAbsolute();
61944
61947
  const projRoot = getProjectRoot();
61945
61948
  const alreadyInitialized = existsSync99(cleoDir) && (existsSync99(join100(cleoDir, "tasks.db")) || existsSync99(join100(cleoDir, "config.json")));
@@ -62287,7 +62290,7 @@ init_paths();
62287
62290
 
62288
62291
  // packages/core/src/project-info.ts
62289
62292
  init_paths();
62290
- import { existsSync as existsSync101, readFileSync as readFileSync75 } from "node:fs";
62293
+ import { existsSync as existsSync101, readFileSync as readFileSync75, writeFileSync as writeFileSync19 } from "node:fs";
62291
62294
  import { readFile as readFile18 } from "node:fs/promises";
62292
62295
  import { join as join102 } from "node:path";
62293
62296
  async function getProjectInfo(cwd) {