@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 +127 -80
- package/dist/index.js.map +3 -3
- package/dist/init.d.ts.map +1 -1
- package/dist/internal.js +149 -89
- package/dist/internal.js.map +3 -3
- package/dist/scaffold.d.ts +30 -0
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/system/health.d.ts.map +1 -1
- package/dist/upgrade.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/init.ts +15 -18
- package/src/scaffold.ts +152 -0
- package/src/system/health.ts +2 -0
- package/src/upgrade.ts +17 -0
package/dist/scaffold.d.ts
CHANGED
|
@@ -659,6 +659,36 @@ export declare function ensureGlobalScaffold(): Promise<{
|
|
|
659
659
|
* ```
|
|
660
660
|
*/
|
|
661
661
|
export declare function ensureCleoOsHub(): Promise<ScaffoldResult>;
|
|
662
|
+
/**
|
|
663
|
+
* Ensure the Cleo Prime identity file is deployed to the global XDG path.
|
|
664
|
+
*
|
|
665
|
+
* SSoT architecture (T631): CLEOOS-IDENTITY.md lives ONCE at the global path
|
|
666
|
+
* (`~/.local/share/cleo/CLEOOS-IDENTITY.md`). Per-project override is OPTIONAL —
|
|
667
|
+
* a project may place a customized copy at `.cleo/CLEOOS-IDENTITY.md` and the
|
|
668
|
+
* loader (`cant-context.ts readIdentityFile`) reads project-first then global.
|
|
669
|
+
*
|
|
670
|
+
* Called by both `cleo init` (init.ts deployStarterBundle) and `cleo upgrade`
|
|
671
|
+
* (upgrade.ts) so existing projects self-heal on upgrade if the file is missing
|
|
672
|
+
* or out of date.
|
|
673
|
+
*
|
|
674
|
+
* Idempotent. Always overwrites if `forceRefresh` is true (used by `upgrade
|
|
675
|
+
* --refresh-identity`); otherwise only writes when missing.
|
|
676
|
+
*
|
|
677
|
+
* @param forceRefresh - Overwrite even if the file exists. Default false.
|
|
678
|
+
* @returns ScaffoldResult describing what happened.
|
|
679
|
+
*/
|
|
680
|
+
export declare function ensureGlobalIdentity(forceRefresh?: boolean): Promise<ScaffoldResult>;
|
|
681
|
+
/**
|
|
682
|
+
* Check that the global CLEOOS-IDENTITY.md file is present and non-empty.
|
|
683
|
+
* Read-only diagnostic for `cleo doctor`.
|
|
684
|
+
*
|
|
685
|
+
* @returns Check result with status, path details, and self-heal command.
|
|
686
|
+
*
|
|
687
|
+
* @remarks
|
|
688
|
+
* Used by `cleo doctor` to verify the orchestrator persona is installed.
|
|
689
|
+
* Self-heal: `cleo upgrade --refresh-identity` re-deploys from source.
|
|
690
|
+
*/
|
|
691
|
+
export declare function checkGlobalIdentity(): CheckResult;
|
|
662
692
|
/**
|
|
663
693
|
* Check that the global ~/.cleo/ home and its required subdirectories exist.
|
|
664
694
|
* Read-only: no side effects.
|
package/dist/scaffold.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA6BH,kDAAkD;AAClD,MAAM,WAAW,cAAc;IAC7B,4DAA4D;IAC5D,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IAC3C,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qCAAqC;AACrC,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AAEnE,oFAAoF;AACpF,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,EAAE,EAAE,MAAM,CAAC;IACX,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,MAAM,EAAE,WAAW,CAAC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SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,EAAE,cAAc,CAAC;CAC3B,CAAC,CAMD;AA2ID;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,cAAc,CAAC,CAiD/D;AAqCD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,oBAAoB,CAAC,YAAY,UAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,CA2CxF;AAID;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,IAAI,WAAW,CAyCjD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,IAAI,WAAW,CAmC7C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,WAAW,CA4ClD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,CAsB5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/system/health.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAI5D,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/system/health.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAI5D,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA6GhE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,SAAS,GAAG,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AAC,CA8/BxB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,eAAe,CAAC,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,cAAc,CAAC,CAqX7F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleocode/core",
|
|
3
|
-
"version": "2026.4.
|
|
3
|
+
"version": "2026.4.53",
|
|
4
4
|
"description": "CLEO core business logic kernel — tasks, sessions, memory, orchestration, lifecycle, with bundled SQLite store",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -63,13 +63,13 @@
|
|
|
63
63
|
"write-file-atomic": "^7.0.1",
|
|
64
64
|
"yaml": "^2.8.3",
|
|
65
65
|
"zod": "^4.3.6",
|
|
66
|
-
"@cleocode/adapters": "2026.4.
|
|
67
|
-
"@cleocode/agents": "2026.4.
|
|
68
|
-
"@cleocode/
|
|
69
|
-
"@cleocode/
|
|
70
|
-
"@cleocode/
|
|
71
|
-
"@cleocode/nexus": "2026.4.
|
|
72
|
-
"@cleocode/skills": "2026.4.
|
|
66
|
+
"@cleocode/adapters": "2026.4.53",
|
|
67
|
+
"@cleocode/agents": "2026.4.53",
|
|
68
|
+
"@cleocode/contracts": "2026.4.53",
|
|
69
|
+
"@cleocode/lafs": "2026.4.53",
|
|
70
|
+
"@cleocode/caamp": "2026.4.53",
|
|
71
|
+
"@cleocode/nexus": "2026.4.53",
|
|
72
|
+
"@cleocode/skills": "2026.4.53"
|
|
73
73
|
},
|
|
74
74
|
"engines": {
|
|
75
75
|
"node": ">=24.0.0"
|
package/src/init.ts
CHANGED
|
@@ -1097,26 +1097,23 @@ export async function deployStarterBundle(
|
|
|
1097
1097
|
}
|
|
1098
1098
|
}
|
|
1099
1099
|
|
|
1100
|
-
//
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
await copyFile(identitySrc, identityDst);
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
// Also deploy CLEOOS-IDENTITY.md to the global XDG data directory so it is
|
|
1108
|
-
// available system-wide (e.g. ~/.local/share/cleo/CLEOOS-IDENTITY.md).
|
|
1109
|
-
// This mirrors the project-level copy above and follows the same
|
|
1110
|
-
// idempotent pattern: never overwrite an existing file.
|
|
1100
|
+
// Deploy CLEOOS-IDENTITY.md to global XDG via shared utility.
|
|
1101
|
+
// Single SSoT at global path; project path reserved for optional per-project
|
|
1102
|
+
// override (loader: cant-context.ts readIdentityFile reads project→global).
|
|
1103
|
+
// Same utility is called by `cleo upgrade` so existing projects self-heal.
|
|
1111
1104
|
try {
|
|
1112
|
-
const {
|
|
1113
|
-
const
|
|
1114
|
-
if (
|
|
1115
|
-
|
|
1105
|
+
const { ensureGlobalIdentity } = await import('./scaffold.js');
|
|
1106
|
+
const identityResult = await ensureGlobalIdentity();
|
|
1107
|
+
if (identityResult.action === 'created') {
|
|
1108
|
+
created.push(`identity: ${identityResult.path}`);
|
|
1109
|
+
} else if (identityResult.action === 'skipped' && identityResult.details) {
|
|
1110
|
+
warnings.push(`identity skipped: ${identityResult.details}`);
|
|
1116
1111
|
}
|
|
1117
|
-
} catch {
|
|
1118
|
-
|
|
1112
|
+
} catch (err) {
|
|
1113
|
+
warnings.push(`identity deploy failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1119
1114
|
}
|
|
1120
1115
|
|
|
1121
|
-
created.push(
|
|
1116
|
+
created.push(
|
|
1117
|
+
'starter-bundle: team + agent .cant files deployed to .cleo/ (identity at global XDG)',
|
|
1118
|
+
);
|
|
1122
1119
|
}
|
package/src/scaffold.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { randomUUID } from 'node:crypto';
|
|
|
15
15
|
import type { Dirent } from 'node:fs';
|
|
16
16
|
import { existsSync, constants as fsConstants, readFileSync, statSync } from 'node:fs';
|
|
17
17
|
import { access, copyFile, mkdir, readdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
18
|
+
import { createRequire } from 'node:module';
|
|
18
19
|
import { homedir as getHomedir } from 'node:os';
|
|
19
20
|
import { dirname, join, resolve } from 'node:path';
|
|
20
21
|
import { fileURLToPath } from 'node:url';
|
|
@@ -1836,8 +1837,159 @@ export async function ensureCleoOsHub(): Promise<ScaffoldResult> {
|
|
|
1836
1837
|
};
|
|
1837
1838
|
}
|
|
1838
1839
|
|
|
1840
|
+
/**
|
|
1841
|
+
* Resolve the source location of CLEOOS-IDENTITY.md from the cleo-os starter bundle.
|
|
1842
|
+
*
|
|
1843
|
+
* Search order:
|
|
1844
|
+
* 1. Monorepo development: `packages/cleo-os/starter-bundle/CLEOOS-IDENTITY.md`
|
|
1845
|
+
* 2. Installed package: `node_modules/@cleocode/cleo-os/starter-bundle/CLEOOS-IDENTITY.md`
|
|
1846
|
+
*
|
|
1847
|
+
* @returns Absolute path to the source identity file, or null if not found.
|
|
1848
|
+
* @internal Used by ensureGlobalIdentity.
|
|
1849
|
+
*/
|
|
1850
|
+
function resolveIdentitySourcePath(): string | null {
|
|
1851
|
+
// Prefer monorepo source (development)
|
|
1852
|
+
const monorepoPath = join(
|
|
1853
|
+
process.cwd(),
|
|
1854
|
+
'packages',
|
|
1855
|
+
'cleo-os',
|
|
1856
|
+
'starter-bundle',
|
|
1857
|
+
'CLEOOS-IDENTITY.md',
|
|
1858
|
+
);
|
|
1859
|
+
if (existsSync(monorepoPath)) return monorepoPath;
|
|
1860
|
+
|
|
1861
|
+
// Fall back to installed package via require resolution
|
|
1862
|
+
try {
|
|
1863
|
+
const require = createRequire(import.meta.url);
|
|
1864
|
+
const pkgJson = require.resolve('@cleocode/cleo-os/package.json');
|
|
1865
|
+
const pkgDir = pkgJson.replace(/\/package\.json$/, '');
|
|
1866
|
+
const installedPath = join(pkgDir, 'starter-bundle', 'CLEOOS-IDENTITY.md');
|
|
1867
|
+
if (existsSync(installedPath)) return installedPath;
|
|
1868
|
+
} catch {
|
|
1869
|
+
// Not installed — fall through
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
return null;
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
/**
|
|
1876
|
+
* Ensure the Cleo Prime identity file is deployed to the global XDG path.
|
|
1877
|
+
*
|
|
1878
|
+
* SSoT architecture (T631): CLEOOS-IDENTITY.md lives ONCE at the global path
|
|
1879
|
+
* (`~/.local/share/cleo/CLEOOS-IDENTITY.md`). Per-project override is OPTIONAL —
|
|
1880
|
+
* a project may place a customized copy at `.cleo/CLEOOS-IDENTITY.md` and the
|
|
1881
|
+
* loader (`cant-context.ts readIdentityFile`) reads project-first then global.
|
|
1882
|
+
*
|
|
1883
|
+
* Called by both `cleo init` (init.ts deployStarterBundle) and `cleo upgrade`
|
|
1884
|
+
* (upgrade.ts) so existing projects self-heal on upgrade if the file is missing
|
|
1885
|
+
* or out of date.
|
|
1886
|
+
*
|
|
1887
|
+
* Idempotent. Always overwrites if `forceRefresh` is true (used by `upgrade
|
|
1888
|
+
* --refresh-identity`); otherwise only writes when missing.
|
|
1889
|
+
*
|
|
1890
|
+
* @param forceRefresh - Overwrite even if the file exists. Default false.
|
|
1891
|
+
* @returns ScaffoldResult describing what happened.
|
|
1892
|
+
*/
|
|
1893
|
+
export async function ensureGlobalIdentity(forceRefresh = false): Promise<ScaffoldResult> {
|
|
1894
|
+
const sourcePath = resolveIdentitySourcePath();
|
|
1895
|
+
if (!sourcePath) {
|
|
1896
|
+
return {
|
|
1897
|
+
action: 'skipped',
|
|
1898
|
+
path: '',
|
|
1899
|
+
details: 'CLEOOS-IDENTITY.md source not found in monorepo or installed package',
|
|
1900
|
+
};
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
const cleoHome = getCleoHome();
|
|
1904
|
+
const dst = join(cleoHome, 'CLEOOS-IDENTITY.md');
|
|
1905
|
+
|
|
1906
|
+
try {
|
|
1907
|
+
await mkdir(cleoHome, { recursive: true });
|
|
1908
|
+
} catch (err) {
|
|
1909
|
+
return {
|
|
1910
|
+
action: 'skipped',
|
|
1911
|
+
path: dst,
|
|
1912
|
+
details: `Failed to create global cleo home: ${err instanceof Error ? err.message : String(err)}`,
|
|
1913
|
+
};
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
if (existsSync(dst) && !forceRefresh) {
|
|
1917
|
+
return { action: 'skipped', path: dst, details: 'identity already present' };
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
const existedBefore = existsSync(dst);
|
|
1921
|
+
try {
|
|
1922
|
+
const content = readFileSync(sourcePath, 'utf-8');
|
|
1923
|
+
await writeFile(dst, content);
|
|
1924
|
+
return {
|
|
1925
|
+
action: existedBefore ? 'repaired' : 'created',
|
|
1926
|
+
path: dst,
|
|
1927
|
+
details: `from ${sourcePath}`,
|
|
1928
|
+
};
|
|
1929
|
+
} catch (err) {
|
|
1930
|
+
return {
|
|
1931
|
+
action: 'skipped',
|
|
1932
|
+
path: dst,
|
|
1933
|
+
details: `Failed to write identity: ${err instanceof Error ? err.message : String(err)}`,
|
|
1934
|
+
};
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1839
1938
|
// ── Global check* functions (read-only diagnostics) ──────────────────
|
|
1840
1939
|
|
|
1940
|
+
/**
|
|
1941
|
+
* Check that the global CLEOOS-IDENTITY.md file is present and non-empty.
|
|
1942
|
+
* Read-only diagnostic for `cleo doctor`.
|
|
1943
|
+
*
|
|
1944
|
+
* @returns Check result with status, path details, and self-heal command.
|
|
1945
|
+
*
|
|
1946
|
+
* @remarks
|
|
1947
|
+
* Used by `cleo doctor` to verify the orchestrator persona is installed.
|
|
1948
|
+
* Self-heal: `cleo upgrade --refresh-identity` re-deploys from source.
|
|
1949
|
+
*/
|
|
1950
|
+
export function checkGlobalIdentity(): CheckResult {
|
|
1951
|
+
const cleoHome = getCleoHome();
|
|
1952
|
+
const identityPath = join(cleoHome, 'CLEOOS-IDENTITY.md');
|
|
1953
|
+
|
|
1954
|
+
if (!existsSync(identityPath)) {
|
|
1955
|
+
return {
|
|
1956
|
+
id: 'global_identity',
|
|
1957
|
+
category: 'global',
|
|
1958
|
+
status: 'failed',
|
|
1959
|
+
message: 'Global CLEOOS-IDENTITY.md not found — orchestrator persona missing',
|
|
1960
|
+
details: { path: identityPath, exists: false },
|
|
1961
|
+
fix: 'cleo upgrade (auto-deploys identity)',
|
|
1962
|
+
};
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
let size = 0;
|
|
1966
|
+
try {
|
|
1967
|
+
size = statSync(identityPath).size;
|
|
1968
|
+
} catch {
|
|
1969
|
+
/* ignore */
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
if (size === 0) {
|
|
1973
|
+
return {
|
|
1974
|
+
id: 'global_identity',
|
|
1975
|
+
category: 'global',
|
|
1976
|
+
status: 'failed',
|
|
1977
|
+
message: 'Global CLEOOS-IDENTITY.md exists but is empty',
|
|
1978
|
+
details: { path: identityPath, exists: true, size: 0 },
|
|
1979
|
+
fix: 'cleo upgrade --refresh-identity',
|
|
1980
|
+
};
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
return {
|
|
1984
|
+
id: 'global_identity',
|
|
1985
|
+
category: 'global',
|
|
1986
|
+
status: 'passed',
|
|
1987
|
+
message: 'Global CLEOOS-IDENTITY.md present',
|
|
1988
|
+
details: { path: identityPath, exists: true, size },
|
|
1989
|
+
fix: '',
|
|
1990
|
+
};
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1841
1993
|
/**
|
|
1842
1994
|
* Check that the global ~/.cleo/ home and its required subdirectories exist.
|
|
1843
1995
|
* Read-only: no side effects.
|
package/src/system/health.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
checkCleoStructure,
|
|
19
19
|
checkConfig,
|
|
20
20
|
checkGlobalHome,
|
|
21
|
+
checkGlobalIdentity,
|
|
21
22
|
checkGlobalTemplates,
|
|
22
23
|
checkLogDir,
|
|
23
24
|
checkMemoryBridge,
|
|
@@ -842,6 +843,7 @@ export async function coreDoctorReport(projectRoot: string): Promise<DoctorRepor
|
|
|
842
843
|
// 5c. Global scaffold checks: home, templates, schemas
|
|
843
844
|
checks.push(mapCheckResult(checkGlobalHome()));
|
|
844
845
|
checks.push(mapCheckResult(checkGlobalTemplates()));
|
|
846
|
+
checks.push(mapCheckResult(checkGlobalIdentity()));
|
|
845
847
|
checks.push(mapSchemaCheckResult(checkGlobalSchemas()));
|
|
846
848
|
|
|
847
849
|
// 5d. Project scaffold checks: log dir, structure, git hooks, project-info, injection
|
package/src/upgrade.ts
CHANGED
|
@@ -940,6 +940,23 @@ export async function runUpgrade(
|
|
|
940
940
|
/* best-effort */
|
|
941
941
|
}
|
|
942
942
|
|
|
943
|
+
// Ensure global CLEOOS-IDENTITY.md is present (T631 — single SSoT).
|
|
944
|
+
// Self-heals if file is missing on existing projects after upgrade.
|
|
945
|
+
try {
|
|
946
|
+
const { ensureGlobalIdentity } = await import('./scaffold.js');
|
|
947
|
+
const identityResult = await ensureGlobalIdentity();
|
|
948
|
+
actions.push({
|
|
949
|
+
action: 'global_identity',
|
|
950
|
+
status:
|
|
951
|
+
identityResult.action === 'created' || identityResult.action === 'repaired'
|
|
952
|
+
? 'applied'
|
|
953
|
+
: 'skipped',
|
|
954
|
+
details: `${identityResult.path} (${identityResult.details ?? identityResult.action})`,
|
|
955
|
+
});
|
|
956
|
+
} catch {
|
|
957
|
+
/* best-effort — identity is already-kept-or-skipped on failure */
|
|
958
|
+
}
|
|
959
|
+
|
|
943
960
|
// Install core skills
|
|
944
961
|
try {
|
|
945
962
|
const skillsCreated: string[] = [];
|