@cleocode/core 2026.4.52 → 2026.4.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/index.js CHANGED
@@ -11117,44 +11117,6 @@ var init_platform_paths = __esm({
11117
11117
  });
11118
11118
 
11119
11119
  // packages/core/src/paths.ts
11120
- var paths_exports = {};
11121
- __export(paths_exports, {
11122
- getAgentOutputsAbsolute: () => getAgentOutputsAbsolute,
11123
- getAgentOutputsDir: () => getAgentOutputsDir,
11124
- getAgentsHome: () => getAgentsHome,
11125
- getArchivePath: () => getArchivePath,
11126
- getBackupDir: () => getBackupDir,
11127
- getClaudeAgentsDir: () => getClaudeAgentsDir,
11128
- getClaudeMemDbPath: () => getClaudeMemDbPath,
11129
- getCleoCacheDir: () => getCleoCacheDir,
11130
- getCleoCantWorkflowsDir: () => getCleoCantWorkflowsDir,
11131
- getCleoConfigDir: () => getCleoConfigDir,
11132
- getCleoDir: () => getCleoDir,
11133
- getCleoDirAbsolute: () => getCleoDirAbsolute,
11134
- getCleoDocsDir: () => getCleoDocsDir,
11135
- getCleoGlobalAgentsDir: () => getCleoGlobalAgentsDir,
11136
- getCleoGlobalJustfilePath: () => getCleoGlobalJustfilePath,
11137
- getCleoGlobalRecipesDir: () => getCleoGlobalRecipesDir,
11138
- getCleoHome: () => getCleoHome,
11139
- getCleoLogDir: () => getCleoLogDir,
11140
- getCleoPiExtensionsDir: () => getCleoPiExtensionsDir,
11141
- getCleoSchemasDir: () => getCleoSchemasDir,
11142
- getCleoTempDir: () => getCleoTempDir,
11143
- getCleoTemplatesDir: () => getCleoTemplatesDir,
11144
- getCleoTemplatesTildePath: () => getCleoTemplatesTildePath,
11145
- getConfigPath: () => getConfigPath,
11146
- getGlobalConfigPath: () => getGlobalConfigPath,
11147
- getLogPath: () => getLogPath,
11148
- getManifestArchivePath: () => getManifestArchivePath,
11149
- getManifestPath: () => getManifestPath,
11150
- getProjectRoot: () => getProjectRoot,
11151
- getSessionsPath: () => getSessionsPath,
11152
- getTaskPath: () => getTaskPath,
11153
- isAbsolutePath: () => isAbsolutePath,
11154
- isProjectInitialized: () => isProjectInitialized,
11155
- resolveProjectPath: () => resolveProjectPath,
11156
- worktreeScope: () => worktreeScope
11157
- });
11158
11120
  import { AsyncLocalStorage } from "node:async_hooks";
11159
11121
  import { existsSync as existsSync3, readFileSync as readFileSync2 } from "node:fs";
11160
11122
  import { homedir } from "node:os";
@@ -11173,9 +11135,6 @@ function getCleoTemplatesDir() {
11173
11135
  function getCleoSchemasDir() {
11174
11136
  return join4(getCleoHome(), "schemas");
11175
11137
  }
11176
- function getCleoDocsDir() {
11177
- return join4(getCleoHome(), "docs");
11178
- }
11179
11138
  function getCleoDir(cwd) {
11180
11139
  if (cwd) {
11181
11140
  return getCleoDirAbsolute(cwd);
@@ -11247,15 +11206,6 @@ function getTaskPath(cwd) {
11247
11206
  function getConfigPath(cwd) {
11248
11207
  return join4(getCleoDirAbsolute(cwd), "config.json");
11249
11208
  }
11250
- function getSessionsPath(cwd) {
11251
- return join4(getCleoDirAbsolute(cwd), "sessions.json");
11252
- }
11253
- function getArchivePath(cwd) {
11254
- return join4(getCleoDirAbsolute(cwd), "tasks-archive.json");
11255
- }
11256
- function getLogPath(cwd) {
11257
- return join4(getCleoDirAbsolute(cwd), "logs", "cleo.log");
11258
- }
11259
11209
  function getBackupDir(cwd) {
11260
11210
  return join4(getCleoDirAbsolute(cwd), "backups", "operational");
11261
11211
  }
@@ -11363,9 +11313,6 @@ function getClaudeAgentsDir() {
11363
11313
  const claudeDir = process.env["CLAUDE_HOME"] ?? join4(homedir(), ".claude");
11364
11314
  return join4(claudeDir, "agents");
11365
11315
  }
11366
- function getClaudeMemDbPath() {
11367
- return process.env["CLAUDE_MEM_DB"] ?? join4(homedir(), ".claude-mem", "claude-mem.db");
11368
- }
11369
11316
  var worktreeScope, DEFAULT_AGENT_OUTPUTS_DIR;
11370
11317
  var init_paths = __esm({
11371
11318
  "packages/core/src/paths.ts"() {
@@ -49750,6 +49697,7 @@ __export(scaffold_exports, {
49750
49697
  checkConfig: () => checkConfig,
49751
49698
  checkGitignore: () => checkGitignore,
49752
49699
  checkGlobalHome: () => checkGlobalHome,
49700
+ checkGlobalIdentity: () => checkGlobalIdentity,
49753
49701
  checkGlobalTemplates: () => checkGlobalTemplates,
49754
49702
  checkLogDir: () => checkLogDir,
49755
49703
  checkMemoryBridge: () => checkMemoryBridge,
@@ -49766,6 +49714,7 @@ __export(scaffold_exports, {
49766
49714
  ensureContributorMcp: () => ensureContributorMcp,
49767
49715
  ensureGitignore: () => ensureGitignore,
49768
49716
  ensureGlobalHome: () => ensureGlobalHome,
49717
+ ensureGlobalIdentity: () => ensureGlobalIdentity,
49769
49718
  ensureGlobalScaffold: () => ensureGlobalScaffold,
49770
49719
  ensureGlobalTemplates: () => ensureGlobalTemplates,
49771
49720
  ensureProjectContext: () => ensureProjectContext,
@@ -49783,6 +49732,7 @@ import { execFile as execFile3 } from "node:child_process";
49783
49732
  import { randomUUID as randomUUID2 } from "node:crypto";
49784
49733
  import { existsSync as existsSync38, constants as fsConstants3, readFileSync as readFileSync23, statSync as statSync8 } from "node:fs";
49785
49734
  import { access as access3, copyFile as copyFile2, mkdir as mkdir6, readdir as readdir2, readFile as readFile7, rm as rm2, writeFile as writeFile6 } from "node:fs/promises";
49735
+ import { createRequire as createRequire6 } from "node:module";
49786
49736
  import { homedir as getHomedir } from "node:os";
49787
49737
  import { dirname as dirname10, join as join40, resolve as resolve5 } from "node:path";
49788
49738
  import { fileURLToPath as fileURLToPath4 } from "node:url";
@@ -50638,6 +50588,102 @@ async function ensureCleoOsHub() {
50638
50588
  details: `pi-extensions: ${piResult.copied} created/${piResult.kept} kept, global-recipes: ${recipesResult.copied} created/${recipesResult.kept} kept`
50639
50589
  };
50640
50590
  }
50591
+ function resolveIdentitySourcePath() {
50592
+ const monorepoPath = join40(
50593
+ process.cwd(),
50594
+ "packages",
50595
+ "cleo-os",
50596
+ "starter-bundle",
50597
+ "CLEOOS-IDENTITY.md"
50598
+ );
50599
+ if (existsSync38(monorepoPath)) return monorepoPath;
50600
+ try {
50601
+ const require2 = createRequire6(import.meta.url);
50602
+ const pkgJson = require2.resolve("@cleocode/cleo-os/package.json");
50603
+ const pkgDir = pkgJson.replace(/\/package\.json$/, "");
50604
+ const installedPath = join40(pkgDir, "starter-bundle", "CLEOOS-IDENTITY.md");
50605
+ if (existsSync38(installedPath)) return installedPath;
50606
+ } catch {
50607
+ }
50608
+ return null;
50609
+ }
50610
+ async function ensureGlobalIdentity(forceRefresh = false) {
50611
+ const sourcePath = resolveIdentitySourcePath();
50612
+ if (!sourcePath) {
50613
+ return {
50614
+ action: "skipped",
50615
+ path: "",
50616
+ details: "CLEOOS-IDENTITY.md source not found in monorepo or installed package"
50617
+ };
50618
+ }
50619
+ const cleoHome = getCleoHome();
50620
+ const dst = join40(cleoHome, "CLEOOS-IDENTITY.md");
50621
+ try {
50622
+ await mkdir6(cleoHome, { recursive: true });
50623
+ } catch (err) {
50624
+ return {
50625
+ action: "skipped",
50626
+ path: dst,
50627
+ details: `Failed to create global cleo home: ${err instanceof Error ? err.message : String(err)}`
50628
+ };
50629
+ }
50630
+ if (existsSync38(dst) && !forceRefresh) {
50631
+ return { action: "skipped", path: dst, details: "identity already present" };
50632
+ }
50633
+ const existedBefore = existsSync38(dst);
50634
+ try {
50635
+ const content = readFileSync23(sourcePath, "utf-8");
50636
+ await writeFile6(dst, content);
50637
+ return {
50638
+ action: existedBefore ? "repaired" : "created",
50639
+ path: dst,
50640
+ details: `from ${sourcePath}`
50641
+ };
50642
+ } catch (err) {
50643
+ return {
50644
+ action: "skipped",
50645
+ path: dst,
50646
+ details: `Failed to write identity: ${err instanceof Error ? err.message : String(err)}`
50647
+ };
50648
+ }
50649
+ }
50650
+ function checkGlobalIdentity() {
50651
+ const cleoHome = getCleoHome();
50652
+ const identityPath = join40(cleoHome, "CLEOOS-IDENTITY.md");
50653
+ if (!existsSync38(identityPath)) {
50654
+ return {
50655
+ id: "global_identity",
50656
+ category: "global",
50657
+ status: "failed",
50658
+ message: "Global CLEOOS-IDENTITY.md not found \u2014 orchestrator persona missing",
50659
+ details: { path: identityPath, exists: false },
50660
+ fix: "cleo upgrade (auto-deploys identity)"
50661
+ };
50662
+ }
50663
+ let size = 0;
50664
+ try {
50665
+ size = statSync8(identityPath).size;
50666
+ } catch {
50667
+ }
50668
+ if (size === 0) {
50669
+ return {
50670
+ id: "global_identity",
50671
+ category: "global",
50672
+ status: "failed",
50673
+ message: "Global CLEOOS-IDENTITY.md exists but is empty",
50674
+ details: { path: identityPath, exists: true, size: 0 },
50675
+ fix: "cleo upgrade --refresh-identity"
50676
+ };
50677
+ }
50678
+ return {
50679
+ id: "global_identity",
50680
+ category: "global",
50681
+ status: "passed",
50682
+ message: "Global CLEOOS-IDENTITY.md present",
50683
+ details: { path: identityPath, exists: true, size },
50684
+ fix: ""
50685
+ };
50686
+ }
50641
50687
  function checkGlobalHome() {
50642
50688
  const cleoHome = getCleoHome();
50643
50689
  if (!existsSync38(cleoHome)) {
@@ -54045,7 +54091,7 @@ __export(parser_exports, {
54045
54091
  parseFile: () => parseFile2
54046
54092
  });
54047
54093
  import { readFileSync as readFileSync64 } from "node:fs";
54048
- import { createRequire as createRequire7 } from "node:module";
54094
+ import { createRequire as createRequire8 } from "node:module";
54049
54095
  import { relative as relative7 } from "node:path";
54050
54096
  function tryRequire(id) {
54051
54097
  try {
@@ -54246,7 +54292,7 @@ var init_parser3 = __esm({
54246
54292
  "packages/core/src/code/parser.ts"() {
54247
54293
  "use strict";
54248
54294
  init_tree_sitter_languages();
54249
- _require7 = createRequire7(import.meta.url);
54295
+ _require7 = createRequire8(import.meta.url);
54250
54296
  _ParserClass = null;
54251
54297
  _QueryClass = null;
54252
54298
  _parserInstance = null;
@@ -54346,7 +54392,7 @@ var init_parser3 = __esm({
54346
54392
 
54347
54393
  // packages/core/src/system/dependencies.ts
54348
54394
  import { execFileSync as execFileSync10 } from "node:child_process";
54349
- import { createRequire as createRequire8 } from "node:module";
54395
+ import { createRequire as createRequire9 } from "node:module";
54350
54396
  import { dirname as dirname19 } from "node:path";
54351
54397
  import { fileURLToPath as fileURLToPath5 } from "node:url";
54352
54398
  function tryExec(cmd, args, timeoutMs = 3e3) {
@@ -54616,7 +54662,7 @@ var init_dependencies = __esm({
54616
54662
  "packages/core/src/system/dependencies.ts"() {
54617
54663
  "use strict";
54618
54664
  init_platform();
54619
- _require8 = createRequire8(import.meta.url);
54665
+ _require8 = createRequire9(import.meta.url);
54620
54666
  _dirname = dirname19(fileURLToPath5(import.meta.url));
54621
54667
  DEPENDENCY_SPECS = [
54622
54668
  // ── Required ────────────────────────────────────────────────────────────
@@ -54818,8 +54864,8 @@ import { platform as platform4 } from "node:os";
54818
54864
  import { basename as basename17, dirname as dirname23, join as join106 } from "node:path";
54819
54865
  async function resolveSeedAgentsDir() {
54820
54866
  try {
54821
- const { createRequire: createRequire10 } = await import("node:module");
54822
- const req = createRequire10(import.meta.url);
54867
+ const { createRequire: createRequire11 } = await import("node:module");
54868
+ const req = createRequire11(import.meta.url);
54823
54869
  const agentsPkgMain = req.resolve("@cleocode/agents/package.json");
54824
54870
  const agentsPkgRoot = dirname23(agentsPkgMain);
54825
54871
  const candidate = join106(agentsPkgRoot, "seed-agents");
@@ -54846,8 +54892,8 @@ async function resolveSeedAgentsDir() {
54846
54892
  async function initAgentDefinition(created, warnings) {
54847
54893
  let agentSourceDir = null;
54848
54894
  try {
54849
- const { createRequire: createRequire10 } = await import("node:module");
54850
- const req = createRequire10(import.meta.url);
54895
+ const { createRequire: createRequire11 } = await import("node:module");
54896
+ const req = createRequire11(import.meta.url);
54851
54897
  const agentsPkgMain = req.resolve("@cleocode/agents/package.json");
54852
54898
  const agentsPkgRoot = dirname23(agentsPkgMain);
54853
54899
  const candidate = join106(agentsPkgRoot, "cleo-subagent");
@@ -54913,8 +54959,8 @@ async function initCoreSkills(created, warnings) {
54913
54959
  const packageRoot = getPackageRoot();
54914
54960
  let ctSkillsRoot = null;
54915
54961
  try {
54916
- const { createRequire: createRequire10 } = await import("node:module");
54917
- const req = createRequire10(import.meta.url);
54962
+ const { createRequire: createRequire11 } = await import("node:module");
54963
+ const req = createRequire11(import.meta.url);
54918
54964
  const skillsPkgMain = req.resolve("@cleocode/skills/package.json");
54919
54965
  const skillsPkgRoot = dirname23(skillsPkgMain);
54920
54966
  if (existsSync106(join106(skillsPkgRoot, "skills.json"))) {
@@ -55422,8 +55468,8 @@ async function deployStarterBundle(cleoDir, created, warnings) {
55422
55468
  if (hasCantFiles) return;
55423
55469
  let starterBundleSrc = null;
55424
55470
  try {
55425
- const { createRequire: createRequire10 } = await import("node:module");
55426
- const req = createRequire10(import.meta.url);
55471
+ const { createRequire: createRequire11 } = await import("node:module");
55472
+ const req = createRequire11(import.meta.url);
55427
55473
  const cleoOsPkgMain = req.resolve("@cleocode/cleo-os/package.json");
55428
55474
  const cleoOsPkgRoot = dirname23(cleoOsPkgMain);
55429
55475
  const candidate = join106(cleoOsPkgRoot, "starter-bundle");
@@ -55463,20 +55509,20 @@ async function deployStarterBundle(cleoDir, created, warnings) {
55463
55509
  }
55464
55510
  }
55465
55511
  }
55466
- const identitySrc = join106(starterBundleSrc, "CLEOOS-IDENTITY.md");
55467
- const identityDst = join106(cleoDir, "CLEOOS-IDENTITY.md");
55468
- if (existsSync106(identitySrc) && !existsSync106(identityDst)) {
55469
- await copyFile4(identitySrc, identityDst);
55470
- }
55471
55512
  try {
55472
- const { getCleoHome: getCleoHome2 } = await Promise.resolve().then(() => (init_paths(), paths_exports));
55473
- const globalIdentityDst = join106(getCleoHome2(), "CLEOOS-IDENTITY.md");
55474
- if (existsSync106(identitySrc) && !existsSync106(globalIdentityDst)) {
55475
- await copyFile4(identitySrc, globalIdentityDst);
55513
+ const { ensureGlobalIdentity: ensureGlobalIdentity2 } = await Promise.resolve().then(() => (init_scaffold(), scaffold_exports));
55514
+ const identityResult = await ensureGlobalIdentity2();
55515
+ if (identityResult.action === "created") {
55516
+ created.push(`identity: ${identityResult.path}`);
55517
+ } else if (identityResult.action === "skipped" && identityResult.details) {
55518
+ warnings.push(`identity skipped: ${identityResult.details}`);
55476
55519
  }
55477
- } catch {
55520
+ } catch (err) {
55521
+ warnings.push(`identity deploy failed: ${err instanceof Error ? err.message : String(err)}`);
55478
55522
  }
55479
- created.push("starter-bundle: team + agent .cant files + identity deployed to .cleo/");
55523
+ created.push(
55524
+ "starter-bundle: team + agent .cant files deployed to .cleo/ (identity at global XDG)"
55525
+ );
55480
55526
  }
55481
55527
  var DIR_SYMLINK_TYPE2;
55482
55528
  var init_init = __esm({
@@ -64390,8 +64436,8 @@ init_agent_outputs();
64390
64436
  // packages/core/src/migration/checksum.ts
64391
64437
  import { createHash as createHash7 } from "node:crypto";
64392
64438
  import { readFileSync as readFileSync34 } from "node:fs";
64393
- import { createRequire as createRequire6 } from "node:module";
64394
- var _require6 = createRequire6(import.meta.url);
64439
+ import { createRequire as createRequire7 } from "node:module";
64440
+ var _require6 = createRequire7(import.meta.url);
64395
64441
  var { DatabaseSync: DatabaseSync4 } = _require6("node:sqlite");
64396
64442
  async function computeChecksum(filePath) {
64397
64443
  const content = readFileSync34(filePath);
@@ -77277,7 +77323,7 @@ init_schema_management();
77277
77323
  init_data_accessor();
77278
77324
  import { execFileSync as execFileSync11 } from "node:child_process";
77279
77325
  import { existsSync as existsSync90, readFileSync as readFileSync65, statSync as statSync19 } from "node:fs";
77280
- import { createRequire as createRequire9 } from "node:module";
77326
+ import { createRequire as createRequire10 } from "node:module";
77281
77327
  import { join as join92 } from "node:path";
77282
77328
 
77283
77329
  // packages/core/src/validation/doctor/checks.ts
@@ -78091,7 +78137,7 @@ function calculateHealthStatus(checks) {
78091
78137
 
78092
78138
  // packages/core/src/system/health.ts
78093
78139
  init_dependencies();
78094
- var _require9 = createRequire9(import.meta.url);
78140
+ var _require9 = createRequire10(import.meta.url);
78095
78141
  var databaseSyncCtor = (() => {
78096
78142
  try {
78097
78143
  return _require9("node:sqlite").DatabaseSync;
@@ -78639,6 +78685,7 @@ async function coreDoctorReport(projectRoot) {
78639
78685
  });
78640
78686
  checks.push(mapCheckResult(checkGlobalHome()));
78641
78687
  checks.push(mapCheckResult(checkGlobalTemplates()));
78688
+ checks.push(mapCheckResult(checkGlobalIdentity()));
78642
78689
  checks.push(mapSchemaCheckResult(checkGlobalSchemas()));
78643
78690
  checks.push(mapCheckResult(checkLogDir(projectRoot)));
78644
78691
  const hookResults = await checkGitHooks(projectRoot);