@cleocode/cleo 2026.4.52 → 2026.4.54

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
@@ -11142,44 +11142,6 @@ var init_platform_paths = __esm({
11142
11142
  });
11143
11143
 
11144
11144
  // packages/core/src/paths.ts
11145
- var paths_exports = {};
11146
- __export(paths_exports, {
11147
- getAgentOutputsAbsolute: () => getAgentOutputsAbsolute,
11148
- getAgentOutputsDir: () => getAgentOutputsDir,
11149
- getAgentsHome: () => getAgentsHome,
11150
- getArchivePath: () => getArchivePath,
11151
- getBackupDir: () => getBackupDir,
11152
- getClaudeAgentsDir: () => getClaudeAgentsDir,
11153
- getClaudeMemDbPath: () => getClaudeMemDbPath,
11154
- getCleoCacheDir: () => getCleoCacheDir,
11155
- getCleoCantWorkflowsDir: () => getCleoCantWorkflowsDir,
11156
- getCleoConfigDir: () => getCleoConfigDir,
11157
- getCleoDir: () => getCleoDir,
11158
- getCleoDirAbsolute: () => getCleoDirAbsolute,
11159
- getCleoDocsDir: () => getCleoDocsDir,
11160
- getCleoGlobalAgentsDir: () => getCleoGlobalAgentsDir,
11161
- getCleoGlobalJustfilePath: () => getCleoGlobalJustfilePath,
11162
- getCleoGlobalRecipesDir: () => getCleoGlobalRecipesDir,
11163
- getCleoHome: () => getCleoHome,
11164
- getCleoLogDir: () => getCleoLogDir,
11165
- getCleoPiExtensionsDir: () => getCleoPiExtensionsDir,
11166
- getCleoSchemasDir: () => getCleoSchemasDir,
11167
- getCleoTempDir: () => getCleoTempDir,
11168
- getCleoTemplatesDir: () => getCleoTemplatesDir,
11169
- getCleoTemplatesTildePath: () => getCleoTemplatesTildePath,
11170
- getConfigPath: () => getConfigPath,
11171
- getGlobalConfigPath: () => getGlobalConfigPath,
11172
- getLogPath: () => getLogPath,
11173
- getManifestArchivePath: () => getManifestArchivePath,
11174
- getManifestPath: () => getManifestPath,
11175
- getProjectRoot: () => getProjectRoot,
11176
- getSessionsPath: () => getSessionsPath,
11177
- getTaskPath: () => getTaskPath,
11178
- isAbsolutePath: () => isAbsolutePath,
11179
- isProjectInitialized: () => isProjectInitialized,
11180
- resolveProjectPath: () => resolveProjectPath,
11181
- worktreeScope: () => worktreeScope
11182
- });
11183
11145
  import { AsyncLocalStorage } from "node:async_hooks";
11184
11146
  import { existsSync as existsSync3, readFileSync as readFileSync2 } from "node:fs";
11185
11147
  import { homedir } from "node:os";
@@ -11198,9 +11160,6 @@ function getCleoTemplatesDir() {
11198
11160
  function getCleoSchemasDir() {
11199
11161
  return join4(getCleoHome(), "schemas");
11200
11162
  }
11201
- function getCleoDocsDir() {
11202
- return join4(getCleoHome(), "docs");
11203
- }
11204
11163
  function getCleoDir(cwd) {
11205
11164
  if (cwd) {
11206
11165
  return getCleoDirAbsolute(cwd);
@@ -11272,15 +11231,6 @@ function getTaskPath(cwd) {
11272
11231
  function getConfigPath(cwd) {
11273
11232
  return join4(getCleoDirAbsolute(cwd), "config.json");
11274
11233
  }
11275
- function getSessionsPath(cwd) {
11276
- return join4(getCleoDirAbsolute(cwd), "sessions.json");
11277
- }
11278
- function getArchivePath(cwd) {
11279
- return join4(getCleoDirAbsolute(cwd), "tasks-archive.json");
11280
- }
11281
- function getLogPath(cwd) {
11282
- return join4(getCleoDirAbsolute(cwd), "logs", "cleo.log");
11283
- }
11284
11234
  function getBackupDir(cwd) {
11285
11235
  return join4(getCleoDirAbsolute(cwd), "backups", "operational");
11286
11236
  }
@@ -11484,6 +11434,54 @@ function insertJournalEntry(nativeDb, hash2, createdAt, name2) {
11484
11434
  `INSERT OR IGNORE INTO "__drizzle_migrations" ("hash", "created_at", "name") VALUES ('${hash2}', ${createdAt}, '${name2}')`
11485
11435
  );
11486
11436
  }
11437
+ function probeAndMarkApplied(nativeDb, migration, logSubsystem) {
11438
+ const sqlStatements = Array.isArray(migration.sql) ? migration.sql : [migration.sql ?? ""];
11439
+ const fullSql = sqlStatements.join("\n");
11440
+ const alterColumnRegex = /ALTER\s+TABLE\s+[`"]?(\w+)[`"]?\s+ADD\s+COLUMN\s+[`"]?(\w+)[`"]?/gi;
11441
+ const createTableRegex = /CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?[`"]?(\w+)[`"]?/gi;
11442
+ const createIndexRegex = /CREATE\s+(?:UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?[`"]?(\w+)[`"]?/gi;
11443
+ const alterTargets = [];
11444
+ for (const m2 of fullSql.matchAll(alterColumnRegex)) {
11445
+ alterTargets.push({ table: m2[1], column: m2[2] });
11446
+ }
11447
+ const tableTargets = [];
11448
+ for (const m2 of fullSql.matchAll(createTableRegex)) {
11449
+ tableTargets.push(m2[1]);
11450
+ }
11451
+ const indexTargets = [];
11452
+ for (const m2 of fullSql.matchAll(createIndexRegex)) {
11453
+ indexTargets.push(m2[1]);
11454
+ }
11455
+ const totalTargets = alterTargets.length + tableTargets.length + indexTargets.length;
11456
+ if (totalTargets === 0) {
11457
+ return false;
11458
+ }
11459
+ const allAltersPresent = alterTargets.every(({ table, column }) => {
11460
+ if (!tableExists(nativeDb, table)) return false;
11461
+ const cols = nativeDb.prepare(`PRAGMA table_info(${table})`).all();
11462
+ return cols.some((c) => c.name === column);
11463
+ });
11464
+ const allTablesPresent = tableTargets.every((t) => tableExists(nativeDb, t));
11465
+ const allIndexesPresent = indexTargets.every((idx) => {
11466
+ const rows = nativeDb.prepare(`SELECT name FROM sqlite_master WHERE type='index' AND name=?`).all(idx);
11467
+ return rows.length > 0;
11468
+ });
11469
+ if (allAltersPresent && allTablesPresent && allIndexesPresent) {
11470
+ insertJournalEntry(nativeDb, migration.hash, migration.folderMillis, migration.name ?? "");
11471
+ const log13 = getLogger(logSubsystem);
11472
+ log13.debug(
11473
+ {
11474
+ migration: migration.name,
11475
+ alters: alterTargets.length,
11476
+ tables: tableTargets.length,
11477
+ indexes: indexTargets.length
11478
+ },
11479
+ `Migration ${migration.name} DDL already present in schema \u2014 marked applied.`
11480
+ );
11481
+ return true;
11482
+ }
11483
+ return false;
11484
+ }
11487
11485
  function reconcileJournal(nativeDb, migrationsFolder, existenceTable, logSubsystem) {
11488
11486
  if (tableExists(nativeDb, existenceTable) && !tableExists(nativeDb, "__drizzle_migrations")) {
11489
11487
  const migrations = readMigrationFiles({ migrationsFolder });
@@ -11520,11 +11518,11 @@ function reconcileJournal(nativeDb, migrationsFolder, existenceTable, logSubsyst
11520
11518
  const log13 = getLogger(logSubsystem);
11521
11519
  log13.warn(
11522
11520
  { orphaned: orphanedEntries.length },
11523
- `Detected stale migration journal entries from a previous CLEO version. Reconciling.`
11521
+ `Detected stale migration journal entries from a previous CLEO version. Reconciling via DDL probe.`
11524
11522
  );
11525
11523
  nativeDb.exec('DELETE FROM "__drizzle_migrations"');
11526
11524
  for (const m2 of localMigrations) {
11527
- insertJournalEntry(nativeDb, m2.hash, m2.folderMillis, m2.name ?? "");
11525
+ probeAndMarkApplied(nativeDb, m2, logSubsystem);
11528
11526
  }
11529
11527
  }
11530
11528
  }
@@ -14333,8 +14331,8 @@ async function cleanupMigrationArtifacts(backupPath) {
14333
14331
  }
14334
14332
  async function validateSqliteDatabase(dbPath) {
14335
14333
  try {
14336
- const { createRequire: createRequire19 } = await import("node:module");
14337
- const _req = createRequire19(import.meta.url);
14334
+ const { createRequire: createRequire20 } = await import("node:module");
14335
+ const _req = createRequire20(import.meta.url);
14338
14336
  const { DatabaseSync: DatabaseSync10 } = _req("node:sqlite");
14339
14337
  const db = new DatabaseSync10(dbPath, { readOnly: true });
14340
14338
  const integrityRow = db.prepare("PRAGMA integrity_check").get();
@@ -15051,7 +15049,6 @@ function runBrainMigrations(nativeDb, db) {
15051
15049
  "brain"
15052
15050
  );
15053
15051
  }
15054
- ensureColumns(nativeDb, "brain_observations", [{ name: "agent", ddl: "text" }], "brain");
15055
15052
  if (tableExists(nativeDb, "brain_page_edges")) {
15056
15053
  nativeDb.prepare(
15057
15054
  `UPDATE brain_page_edges
@@ -56056,6 +56053,7 @@ __export(scaffold_exports, {
56056
56053
  checkConfig: () => checkConfig,
56057
56054
  checkGitignore: () => checkGitignore,
56058
56055
  checkGlobalHome: () => checkGlobalHome,
56056
+ checkGlobalIdentity: () => checkGlobalIdentity,
56059
56057
  checkGlobalTemplates: () => checkGlobalTemplates,
56060
56058
  checkLogDir: () => checkLogDir,
56061
56059
  checkMemoryBridge: () => checkMemoryBridge,
@@ -56072,6 +56070,7 @@ __export(scaffold_exports, {
56072
56070
  ensureContributorMcp: () => ensureContributorMcp,
56073
56071
  ensureGitignore: () => ensureGitignore,
56074
56072
  ensureGlobalHome: () => ensureGlobalHome,
56073
+ ensureGlobalIdentity: () => ensureGlobalIdentity,
56075
56074
  ensureGlobalScaffold: () => ensureGlobalScaffold,
56076
56075
  ensureGlobalTemplates: () => ensureGlobalTemplates,
56077
56076
  ensureProjectContext: () => ensureProjectContext,
@@ -56089,6 +56088,7 @@ import { execFile as execFile3 } from "node:child_process";
56089
56088
  import { randomUUID as randomUUID2 } from "node:crypto";
56090
56089
  import { existsSync as existsSync40, constants as fsConstants3, readFileSync as readFileSync26, statSync as statSync8 } from "node:fs";
56091
56090
  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";
56091
+ import { createRequire as createRequire9 } from "node:module";
56092
56092
  import { homedir as getHomedir } from "node:os";
56093
56093
  import { dirname as dirname10, join as join42, resolve as resolve5 } from "node:path";
56094
56094
  import { fileURLToPath as fileURLToPath4 } from "node:url";
@@ -56944,6 +56944,102 @@ async function ensureCleoOsHub() {
56944
56944
  details: `pi-extensions: ${piResult.copied} created/${piResult.kept} kept, global-recipes: ${recipesResult.copied} created/${recipesResult.kept} kept`
56945
56945
  };
56946
56946
  }
56947
+ function resolveIdentitySourcePath() {
56948
+ const monorepoPath = join42(
56949
+ process.cwd(),
56950
+ "packages",
56951
+ "cleo-os",
56952
+ "starter-bundle",
56953
+ "CLEOOS-IDENTITY.md"
56954
+ );
56955
+ if (existsSync40(monorepoPath)) return monorepoPath;
56956
+ try {
56957
+ const require2 = createRequire9(import.meta.url);
56958
+ const pkgJson = require2.resolve("@cleocode/cleo-os/package.json");
56959
+ const pkgDir = pkgJson.replace(/\/package\.json$/, "");
56960
+ const installedPath = join42(pkgDir, "starter-bundle", "CLEOOS-IDENTITY.md");
56961
+ if (existsSync40(installedPath)) return installedPath;
56962
+ } catch {
56963
+ }
56964
+ return null;
56965
+ }
56966
+ async function ensureGlobalIdentity(forceRefresh = false) {
56967
+ const sourcePath = resolveIdentitySourcePath();
56968
+ if (!sourcePath) {
56969
+ return {
56970
+ action: "skipped",
56971
+ path: "",
56972
+ details: "CLEOOS-IDENTITY.md source not found in monorepo or installed package"
56973
+ };
56974
+ }
56975
+ const cleoHome = getCleoHome();
56976
+ const dst = join42(cleoHome, "CLEOOS-IDENTITY.md");
56977
+ try {
56978
+ await mkdir6(cleoHome, { recursive: true });
56979
+ } catch (err) {
56980
+ return {
56981
+ action: "skipped",
56982
+ path: dst,
56983
+ details: `Failed to create global cleo home: ${err instanceof Error ? err.message : String(err)}`
56984
+ };
56985
+ }
56986
+ if (existsSync40(dst) && !forceRefresh) {
56987
+ return { action: "skipped", path: dst, details: "identity already present" };
56988
+ }
56989
+ const existedBefore = existsSync40(dst);
56990
+ try {
56991
+ const content = readFileSync26(sourcePath, "utf-8");
56992
+ await writeFile6(dst, content);
56993
+ return {
56994
+ action: existedBefore ? "repaired" : "created",
56995
+ path: dst,
56996
+ details: `from ${sourcePath}`
56997
+ };
56998
+ } catch (err) {
56999
+ return {
57000
+ action: "skipped",
57001
+ path: dst,
57002
+ details: `Failed to write identity: ${err instanceof Error ? err.message : String(err)}`
57003
+ };
57004
+ }
57005
+ }
57006
+ function checkGlobalIdentity() {
57007
+ const cleoHome = getCleoHome();
57008
+ const identityPath = join42(cleoHome, "CLEOOS-IDENTITY.md");
57009
+ if (!existsSync40(identityPath)) {
57010
+ return {
57011
+ id: "global_identity",
57012
+ category: "global",
57013
+ status: "failed",
57014
+ message: "Global CLEOOS-IDENTITY.md not found \u2014 orchestrator persona missing",
57015
+ details: { path: identityPath, exists: false },
57016
+ fix: "cleo upgrade (auto-deploys identity)"
57017
+ };
57018
+ }
57019
+ let size = 0;
57020
+ try {
57021
+ size = statSync8(identityPath).size;
57022
+ } catch {
57023
+ }
57024
+ if (size === 0) {
57025
+ return {
57026
+ id: "global_identity",
57027
+ category: "global",
57028
+ status: "failed",
57029
+ message: "Global CLEOOS-IDENTITY.md exists but is empty",
57030
+ details: { path: identityPath, exists: true, size: 0 },
57031
+ fix: "cleo upgrade --refresh-identity"
57032
+ };
57033
+ }
57034
+ return {
57035
+ id: "global_identity",
57036
+ category: "global",
57037
+ status: "passed",
57038
+ message: "Global CLEOOS-IDENTITY.md present",
57039
+ details: { path: identityPath, exists: true, size },
57040
+ fix: ""
57041
+ };
57042
+ }
56947
57043
  function checkGlobalHome() {
56948
57044
  const cleoHome = getCleoHome();
56949
57045
  if (!existsSync40(cleoHome)) {
@@ -63342,7 +63438,7 @@ var init_agent_outputs = __esm({
63342
63438
  // packages/core/src/migration/checksum.ts
63343
63439
  import { createHash as createHash8 } from "node:crypto";
63344
63440
  import { readFileSync as readFileSync37 } from "node:fs";
63345
- import { createRequire as createRequire9 } from "node:module";
63441
+ import { createRequire as createRequire10 } from "node:module";
63346
63442
  async function computeChecksum2(filePath) {
63347
63443
  const content = readFileSync37(filePath);
63348
63444
  return createHash8("sha256").update(content).digest("hex");
@@ -63388,7 +63484,7 @@ var _require9, DatabaseSync4;
63388
63484
  var init_checksum = __esm({
63389
63485
  "packages/core/src/migration/checksum.ts"() {
63390
63486
  "use strict";
63391
- _require9 = createRequire9(import.meta.url);
63487
+ _require9 = createRequire10(import.meta.url);
63392
63488
  ({ DatabaseSync: DatabaseSync4 } = _require9("node:sqlite"));
63393
63489
  }
63394
63490
  });
@@ -79566,7 +79662,7 @@ __export(parser_exports, {
79566
79662
  parseFile: () => parseFile2
79567
79663
  });
79568
79664
  import { readFileSync as readFileSync67 } from "node:fs";
79569
- import { createRequire as createRequire10 } from "node:module";
79665
+ import { createRequire as createRequire11 } from "node:module";
79570
79666
  import { relative as relative11 } from "node:path";
79571
79667
  function tryRequire2(id) {
79572
79668
  try {
@@ -79767,7 +79863,7 @@ var init_parser4 = __esm({
79767
79863
  "packages/core/src/code/parser.ts"() {
79768
79864
  "use strict";
79769
79865
  init_tree_sitter_languages2();
79770
- _require10 = createRequire10(import.meta.url);
79866
+ _require10 = createRequire11(import.meta.url);
79771
79867
  _ParserClass2 = null;
79772
79868
  _QueryClass2 = null;
79773
79869
  _parserInstance2 = null;
@@ -79873,7 +79969,7 @@ __export(dependencies_exports, {
79873
79969
  getDependencySpecs: () => getDependencySpecs
79874
79970
  });
79875
79971
  import { execFileSync as execFileSync10 } from "node:child_process";
79876
- import { createRequire as createRequire11 } from "node:module";
79972
+ import { createRequire as createRequire12 } from "node:module";
79877
79973
  import { dirname as dirname19 } from "node:path";
79878
79974
  import { fileURLToPath as fileURLToPath5 } from "node:url";
79879
79975
  function tryExec(cmd, args, timeoutMs = 3e3) {
@@ -80146,7 +80242,7 @@ var init_dependencies = __esm({
80146
80242
  "packages/core/src/system/dependencies.ts"() {
80147
80243
  "use strict";
80148
80244
  init_platform();
80149
- _require11 = createRequire11(import.meta.url);
80245
+ _require11 = createRequire12(import.meta.url);
80150
80246
  _dirname = dirname19(fileURLToPath5(import.meta.url));
80151
80247
  DEPENDENCY_SPECS = [
80152
80248
  // ── Required ────────────────────────────────────────────────────────────
@@ -80218,7 +80314,7 @@ var init_dependencies = __esm({
80218
80314
  // packages/core/src/system/health.ts
80219
80315
  import { execFileSync as execFileSync11 } from "node:child_process";
80220
80316
  import { existsSync as existsSync92, readFileSync as readFileSync68, statSync as statSync19 } from "node:fs";
80221
- import { createRequire as createRequire12 } from "node:module";
80317
+ import { createRequire as createRequire13 } from "node:module";
80222
80318
  import { join as join94 } from "node:path";
80223
80319
  function resolveStructuredLogPath(cleoDir) {
80224
80320
  const defaultPath = join94(cleoDir, "logs", "cleo.log");
@@ -80759,6 +80855,7 @@ async function coreDoctorReport(projectRoot) {
80759
80855
  });
80760
80856
  checks.push(mapCheckResult(checkGlobalHome()));
80761
80857
  checks.push(mapCheckResult(checkGlobalTemplates()));
80858
+ checks.push(mapCheckResult(checkGlobalIdentity()));
80762
80859
  checks.push(mapSchemaCheckResult(checkGlobalSchemas()));
80763
80860
  checks.push(mapCheckResult(checkLogDir(projectRoot)));
80764
80861
  const hookResults = await checkGitHooks(projectRoot);
@@ -81190,7 +81287,7 @@ var init_health = __esm({
81190
81287
  init_checks3();
81191
81288
  init_dependencies();
81192
81289
  init_storage_preflight();
81193
- _require12 = createRequire12(import.meta.url);
81290
+ _require12 = createRequire13(import.meta.url);
81194
81291
  databaseSyncCtor = (() => {
81195
81292
  try {
81196
81293
  return _require12("node:sqlite").DatabaseSync;
@@ -86560,8 +86657,8 @@ import { platform as platform4 } from "node:os";
86560
86657
  import { basename as basename17, dirname as dirname23, join as join108 } from "node:path";
86561
86658
  async function resolveSeedAgentsDir() {
86562
86659
  try {
86563
- const { createRequire: createRequire19 } = await import("node:module");
86564
- const req = createRequire19(import.meta.url);
86660
+ const { createRequire: createRequire20 } = await import("node:module");
86661
+ const req = createRequire20(import.meta.url);
86565
86662
  const agentsPkgMain = req.resolve("@cleocode/agents/package.json");
86566
86663
  const agentsPkgRoot = dirname23(agentsPkgMain);
86567
86664
  const candidate = join108(agentsPkgRoot, "seed-agents");
@@ -86588,8 +86685,8 @@ async function resolveSeedAgentsDir() {
86588
86685
  async function initAgentDefinition(created, warnings) {
86589
86686
  let agentSourceDir = null;
86590
86687
  try {
86591
- const { createRequire: createRequire19 } = await import("node:module");
86592
- const req = createRequire19(import.meta.url);
86688
+ const { createRequire: createRequire20 } = await import("node:module");
86689
+ const req = createRequire20(import.meta.url);
86593
86690
  const agentsPkgMain = req.resolve("@cleocode/agents/package.json");
86594
86691
  const agentsPkgRoot = dirname23(agentsPkgMain);
86595
86692
  const candidate = join108(agentsPkgRoot, "cleo-subagent");
@@ -86655,8 +86752,8 @@ async function initCoreSkills(created, warnings) {
86655
86752
  const packageRoot = getPackageRoot();
86656
86753
  let ctSkillsRoot = null;
86657
86754
  try {
86658
- const { createRequire: createRequire19 } = await import("node:module");
86659
- const req = createRequire19(import.meta.url);
86755
+ const { createRequire: createRequire20 } = await import("node:module");
86756
+ const req = createRequire20(import.meta.url);
86660
86757
  const skillsPkgMain = req.resolve("@cleocode/skills/package.json");
86661
86758
  const skillsPkgRoot = dirname23(skillsPkgMain);
86662
86759
  if (existsSync108(join108(skillsPkgRoot, "skills.json"))) {
@@ -87164,8 +87261,8 @@ async function deployStarterBundle(cleoDir, created, warnings) {
87164
87261
  if (hasCantFiles) return;
87165
87262
  let starterBundleSrc = null;
87166
87263
  try {
87167
- const { createRequire: createRequire19 } = await import("node:module");
87168
- const req = createRequire19(import.meta.url);
87264
+ const { createRequire: createRequire20 } = await import("node:module");
87265
+ const req = createRequire20(import.meta.url);
87169
87266
  const cleoOsPkgMain = req.resolve("@cleocode/cleo-os/package.json");
87170
87267
  const cleoOsPkgRoot = dirname23(cleoOsPkgMain);
87171
87268
  const candidate = join108(cleoOsPkgRoot, "starter-bundle");
@@ -87205,20 +87302,20 @@ async function deployStarterBundle(cleoDir, created, warnings) {
87205
87302
  }
87206
87303
  }
87207
87304
  }
87208
- const identitySrc = join108(starterBundleSrc, "CLEOOS-IDENTITY.md");
87209
- const identityDst = join108(cleoDir, "CLEOOS-IDENTITY.md");
87210
- if (existsSync108(identitySrc) && !existsSync108(identityDst)) {
87211
- await copyFile4(identitySrc, identityDst);
87212
- }
87213
87305
  try {
87214
- const { getCleoHome: getCleoHome2 } = await Promise.resolve().then(() => (init_paths(), paths_exports));
87215
- const globalIdentityDst = join108(getCleoHome2(), "CLEOOS-IDENTITY.md");
87216
- if (existsSync108(identitySrc) && !existsSync108(globalIdentityDst)) {
87217
- await copyFile4(identitySrc, globalIdentityDst);
87306
+ const { ensureGlobalIdentity: ensureGlobalIdentity2 } = await Promise.resolve().then(() => (init_scaffold(), scaffold_exports));
87307
+ const identityResult = await ensureGlobalIdentity2();
87308
+ if (identityResult.action === "created") {
87309
+ created.push(`identity: ${identityResult.path}`);
87310
+ } else if (identityResult.action === "skipped" && identityResult.details) {
87311
+ warnings.push(`identity skipped: ${identityResult.details}`);
87218
87312
  }
87219
- } catch {
87313
+ } catch (err) {
87314
+ warnings.push(`identity deploy failed: ${err instanceof Error ? err.message : String(err)}`);
87220
87315
  }
87221
- created.push("starter-bundle: team + agent .cant files + identity deployed to .cleo/");
87316
+ created.push(
87317
+ "starter-bundle: team + agent .cant files deployed to .cleo/ (identity at global XDG)"
87318
+ );
87222
87319
  }
87223
87320
  var DIR_SYMLINK_TYPE2;
87224
87321
  var init_init = __esm({
@@ -91350,7 +91447,7 @@ var init_brain_purge = __esm({
91350
91447
 
91351
91448
  // packages/core/src/memory/claude-mem-migration.ts
91352
91449
  import { existsSync as existsSync111 } from "node:fs";
91353
- import { createRequire as createRequire13 } from "node:module";
91450
+ import { createRequire as createRequire14 } from "node:module";
91354
91451
  function typedAll3(db, sql16) {
91355
91452
  return db.prepare(sql16).all();
91356
91453
  }
@@ -91580,7 +91677,7 @@ var init_claude_mem_migration = __esm({
91580
91677
  init_paths();
91581
91678
  init_brain_sqlite();
91582
91679
  init_brain_search();
91583
- _require13 = createRequire13(import.meta.url);
91680
+ _require13 = createRequire14(import.meta.url);
91584
91681
  ({ DatabaseSync: DatabaseSync5 } = _require13("node:sqlite"));
91585
91682
  VALID_OBSERVATION_TYPES = /* @__PURE__ */ new Set([
91586
91683
  "discovery",
@@ -97334,7 +97431,7 @@ var init_t310_readiness = __esm({
97334
97431
  // packages/core/src/store/backup-pack.ts
97335
97432
  import crypto5 from "node:crypto";
97336
97433
  import fs4 from "node:fs";
97337
- import { createRequire as createRequire14 } from "node:module";
97434
+ import { createRequire as createRequire15 } from "node:module";
97338
97435
  import os2 from "node:os";
97339
97436
  import path4 from "node:path";
97340
97437
  function resolveContractsSchemasDir() {
@@ -97774,7 +97871,7 @@ var init_backup_pack = __esm({
97774
97871
  init_nexus_sqlite();
97775
97872
  init_signaldock_sqlite();
97776
97873
  init_t310_readiness();
97777
- _require14 = createRequire14(import.meta.url);
97874
+ _require14 = createRequire15(import.meta.url);
97778
97875
  ({ DatabaseSync: DatabaseSync6 } = _require14("node:sqlite"));
97779
97876
  }
97780
97877
  });
@@ -97843,7 +97940,7 @@ var init_cleanup_legacy = __esm({
97843
97940
 
97844
97941
  // packages/core/src/store/migrate-signaldock-to-conduit.ts
97845
97942
  import { existsSync as existsSync117, mkdirSync as mkdirSync27, renameSync as renameSync9, unlinkSync as unlinkSync9 } from "node:fs";
97846
- import { createRequire as createRequire15 } from "node:module";
97943
+ import { createRequire as createRequire16 } from "node:module";
97847
97944
  import { join as join115 } from "node:path";
97848
97945
  function needsSignaldockToConduitMigration(projectRoot) {
97849
97946
  const legacyPath = join115(projectRoot, ".cleo", "signaldock.db");
@@ -98183,7 +98280,7 @@ var init_migrate_signaldock_to_conduit = __esm({
98183
98280
  init_conduit_sqlite();
98184
98281
  init_global_salt();
98185
98282
  init_signaldock_sqlite();
98186
- _require15 = createRequire15(import.meta.url);
98283
+ _require15 = createRequire16(import.meta.url);
98187
98284
  ({ DatabaseSync: DatabaseSync7 } = _require15("node:sqlite"));
98188
98285
  PROJECT_TIER_TABLES = [
98189
98286
  "messages",
@@ -101306,6 +101403,16 @@ async function runUpgrade(options = {}) {
101306
101403
  }
101307
101404
  } catch {
101308
101405
  }
101406
+ try {
101407
+ const { ensureGlobalIdentity: ensureGlobalIdentity2 } = await Promise.resolve().then(() => (init_scaffold(), scaffold_exports));
101408
+ const identityResult = await ensureGlobalIdentity2();
101409
+ actions.push({
101410
+ action: "global_identity",
101411
+ status: identityResult.action === "created" || identityResult.action === "repaired" ? "applied" : "skipped",
101412
+ details: `${identityResult.path} (${identityResult.details ?? identityResult.action})`
101413
+ });
101414
+ } catch {
101415
+ }
101309
101416
  try {
101310
101417
  const skillsCreated = [];
101311
101418
  const skillsWarnings = [];
@@ -111107,7 +111214,7 @@ var require__ = __commonJS({
111107
111214
  // packages/core/src/store/backup-unpack.ts
111108
111215
  import crypto6 from "node:crypto";
111109
111216
  import fs6 from "node:fs";
111110
- import { createRequire as createRequire16 } from "node:module";
111217
+ import { createRequire as createRequire17 } from "node:module";
111111
111218
  import os3 from "node:os";
111112
111219
  import path6 from "node:path";
111113
111220
  import { default as addFormatsImport2 } from "ajv-formats";
@@ -111376,7 +111483,7 @@ var init_backup_unpack = __esm({
111376
111483
  import__ = __toESM(require__(), 1);
111377
111484
  init_index_min();
111378
111485
  init_backup_crypto();
111379
- _require16 = createRequire16(import.meta.url);
111486
+ _require16 = createRequire17(import.meta.url);
111380
111487
  ({ DatabaseSync: DatabaseSync8 } = _require16("node:sqlite"));
111381
111488
  ajv2020Mod = import__.default;
111382
111489
  Ajv2020 = typeof ajv2020Mod.default === "function" ? ajv2020Mod.default : import__.default;
@@ -112700,7 +112807,7 @@ var init_api_key_kdf = __esm({
112700
112807
  // packages/core/src/store/agent-registry-accessor.ts
112701
112808
  import { randomBytes as randomBytes17 } from "node:crypto";
112702
112809
  import { existsSync as existsSync127, mkdirSync as mkdirSync32, readFileSync as readFileSync96, statSync as statSync21, writeFileSync as writeFileSync23 } from "node:fs";
112703
- import { createRequire as createRequire17 } from "node:module";
112810
+ import { createRequire as createRequire18 } from "node:module";
112704
112811
  import { join as join123 } from "node:path";
112705
112812
  function readMachineKey() {
112706
112813
  const keyPath = join123(getCleoHome(), "machine-key");
@@ -112995,7 +113102,7 @@ var init_agent_registry_accessor = __esm({
112995
113102
  init_conduit_sqlite();
112996
113103
  init_global_salt();
112997
113104
  init_signaldock_sqlite();
112998
- _require17 = createRequire17(import.meta.url);
113105
+ _require17 = createRequire18(import.meta.url);
112999
113106
  ({ DatabaseSync: DatabaseSync9 } = _require17("node:sqlite"));
113000
113107
  MACHINE_KEY_LENGTH = 32;
113001
113108
  AgentRegistryAccessor = class {
@@ -131713,7 +131820,7 @@ __export(cli_exports, {
131713
131820
  });
131714
131821
  import { randomUUID as randomUUID14 } from "node:crypto";
131715
131822
  import { existsSync as existsSync130 } from "node:fs";
131716
- import { createRequire as createRequire18 } from "node:module";
131823
+ import { createRequire as createRequire19 } from "node:module";
131717
131824
  import { dirname as dirname27, join as join127 } from "node:path";
131718
131825
  import { fileURLToPath as fileURLToPath7 } from "node:url";
131719
131826
  import { catalog as catalog4, registerSkillLibraryFromPath } from "@cleocode/caamp";
@@ -131722,7 +131829,7 @@ function ensureCaampLibrary() {
131722
131829
  try {
131723
131830
  let skillsRoot = null;
131724
131831
  try {
131725
- const req = createRequire18(import.meta.url);
131832
+ const req = createRequire19(import.meta.url);
131726
131833
  const skillsPkgJson = req.resolve("@cleocode/skills/package.json");
131727
131834
  const candidate = dirname27(skillsPkgJson);
131728
131835
  if (existsSync130(join127(candidate, "skills.json"))) {
@@ -144851,7 +144958,8 @@ Logs: ${logFile}`
144851
144958
  const port = opts["port"] ?? String(DEFAULT_PORT);
144852
144959
  const host = opts["host"] ?? DEFAULT_HOST;
144853
144960
  const startOpts = { port, host };
144854
- const startAction = webCmd.commands.find((c) => c.name() === "start")?.action;
144961
+ const startCmd = webCmd.commands.find((c) => c.name() === "start");
144962
+ const startAction = startCmd?.action;
144855
144963
  if (startAction) {
144856
144964
  await startAction(startOpts);
144857
144965
  } else {