@cleocode/core 2026.9.15 → 2026.9.17
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/changesets/parser.d.ts.map +1 -1
- package/dist/changesets/parser.js +67 -0
- package/dist/changesets/parser.js.map +1 -1
- package/dist/crypto/credentials.d.ts +128 -26
- package/dist/crypto/credentials.d.ts.map +1 -1
- package/dist/crypto/credentials.js +183 -142
- package/dist/crypto/credentials.js.map +1 -1
- package/dist/docs/export-document.js +14705 -12949
- package/dist/docs/export-document.js.map +3 -3
- package/dist/doctor/index.d.ts +1 -1
- package/dist/doctor/index.d.ts.map +1 -1
- package/dist/doctor/index.js +1 -1
- package/dist/doctor/index.js.map +1 -1
- package/dist/doctor/nexus-schema-residency.d.ts +1 -1
- package/dist/doctor/nexus-schema-residency.d.ts.map +1 -1
- package/dist/doctor/nexus-schema-residency.js +1 -0
- package/dist/doctor/nexus-schema-residency.js.map +1 -1
- package/dist/doctor/project-identity.d.ts +124 -0
- package/dist/doctor/project-identity.d.ts.map +1 -0
- package/dist/doctor/project-identity.js +307 -0
- package/dist/doctor/project-identity.js.map +1 -0
- package/dist/doctor/superseded-store.d.ts +8 -0
- package/dist/doctor/superseded-store.d.ts.map +1 -1
- package/dist/doctor/superseded-store.js +48 -3
- package/dist/doctor/superseded-store.js.map +1 -1
- package/dist/init.d.ts +7 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +17 -2
- package/dist/init.js.map +1 -1
- package/dist/internal.d.ts +5 -2
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +4 -2
- package/dist/internal.js.map +1 -1
- package/dist/llm/credentials-store.d.ts +10 -0
- package/dist/llm/credentials-store.d.ts.map +1 -1
- package/dist/llm/credentials-store.js +7 -1
- package/dist/llm/credentials-store.js.map +1 -1
- package/dist/llm/plugin-facade.js +13368 -1550
- package/dist/llm/plugin-facade.js.map +3 -3
- package/dist/nexus/analyze-orchestrator.d.ts +20 -3
- package/dist/nexus/analyze-orchestrator.d.ts.map +1 -1
- package/dist/nexus/analyze-orchestrator.js +159 -10
- package/dist/nexus/analyze-orchestrator.js.map +1 -1
- package/dist/nexus/assessment-store.d.ts +57 -0
- package/dist/nexus/assessment-store.d.ts.map +1 -0
- package/dist/nexus/assessment-store.js +73 -0
- package/dist/nexus/assessment-store.js.map +1 -0
- package/dist/nexus/freshness.d.ts +131 -0
- package/dist/nexus/freshness.d.ts.map +1 -0
- package/dist/nexus/freshness.js +391 -0
- package/dist/nexus/freshness.js.map +1 -0
- package/dist/nexus/graph-manifest.d.ts +88 -0
- package/dist/nexus/graph-manifest.d.ts.map +1 -0
- package/dist/nexus/graph-manifest.js +114 -0
- package/dist/nexus/graph-manifest.js.map +1 -0
- package/dist/nexus/knowledge.d.ts +21 -1
- package/dist/nexus/knowledge.d.ts.map +1 -1
- package/dist/nexus/knowledge.js +76 -37
- package/dist/nexus/knowledge.js.map +1 -1
- package/dist/nexus/path-map.d.ts +55 -0
- package/dist/nexus/path-map.d.ts.map +1 -0
- package/dist/nexus/path-map.js +87 -0
- package/dist/nexus/path-map.js.map +1 -0
- package/dist/nexus/projects-clean.d.ts +21 -28
- package/dist/nexus/projects-clean.d.ts.map +1 -1
- package/dist/nexus/projects-clean.js +168 -85
- package/dist/nexus/projects-clean.js.map +1 -1
- package/dist/nexus/query.d.ts.map +1 -1
- package/dist/nexus/query.js +3 -2
- package/dist/nexus/query.js.map +1 -1
- package/dist/nexus/registry-hygiene.d.ts +70 -0
- package/dist/nexus/registry-hygiene.d.ts.map +1 -0
- package/dist/nexus/registry-hygiene.js +113 -0
- package/dist/nexus/registry-hygiene.js.map +1 -0
- package/dist/nexus/registry.d.ts +2 -2
- package/dist/nexus/registry.d.ts.map +1 -1
- package/dist/nexus/registry.js +48 -12
- package/dist/nexus/registry.js.map +1 -1
- package/dist/paths.d.ts +26 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +99 -6
- package/dist/paths.js.map +1 -1
- package/dist/render/nexus/graph/index.d.ts.map +1 -1
- package/dist/render/nexus/graph/index.js +8 -0
- package/dist/render/nexus/graph/index.js.map +1 -1
- package/dist/resources/spawn-wrapper.d.ts +0 -11
- package/dist/resources/spawn-wrapper.d.ts.map +1 -1
- package/dist/resources/spawn-wrapper.js +62 -6
- package/dist/resources/spawn-wrapper.js.map +1 -1
- package/dist/scaffold/ensure-config.d.ts +12 -3
- package/dist/scaffold/ensure-config.d.ts.map +1 -1
- package/dist/scaffold/ensure-config.js +61 -38
- package/dist/scaffold/ensure-config.js.map +1 -1
- package/dist/scaffold/project-identity.d.ts +136 -0
- package/dist/scaffold/project-identity.d.ts.map +1 -0
- package/dist/scaffold/project-identity.js +225 -0
- package/dist/scaffold/project-identity.js.map +1 -0
- package/dist/selfimprove/fix-gen.js +13319 -1556
- package/dist/selfimprove/fix-gen.js.map +3 -3
- package/dist/store/agent-api-key.d.ts +114 -0
- package/dist/store/agent-api-key.d.ts.map +1 -0
- package/dist/store/agent-api-key.js +136 -0
- package/dist/store/agent-api-key.js.map +1 -0
- package/dist/store/agent-registry-accessor.d.ts +4 -2
- package/dist/store/agent-registry-accessor.d.ts.map +1 -1
- package/dist/store/agent-registry-accessor.js +39 -89
- package/dist/store/agent-registry-accessor.js.map +1 -1
- package/dist/store/api-key-kdf.d.ts +7 -0
- package/dist/store/api-key-kdf.d.ts.map +1 -1
- package/dist/store/api-key-kdf.js +7 -0
- package/dist/store/api-key-kdf.js.map +1 -1
- package/dist/store/backup-crypto.d.ts +49 -0
- package/dist/store/backup-crypto.d.ts.map +1 -1
- package/dist/store/backup-crypto.js +154 -0
- package/dist/store/backup-crypto.js.map +1 -1
- package/dist/store/credential-transfer.d.ts +303 -0
- package/dist/store/credential-transfer.d.ts.map +1 -0
- package/dist/store/credential-transfer.js +774 -0
- package/dist/store/credential-transfer.js.map +1 -0
- package/dist/store/exodus/column-transforms.d.ts +79 -4
- package/dist/store/exodus/column-transforms.d.ts.map +1 -1
- package/dist/store/exodus/column-transforms.js +121 -4
- package/dist/store/exodus/column-transforms.js.map +1 -1
- package/dist/store/exodus/index.d.ts +1 -0
- package/dist/store/exodus/index.d.ts.map +1 -1
- package/dist/store/exodus/index.js +1 -0
- package/dist/store/exodus/index.js.map +1 -1
- package/dist/store/exodus/migrate.d.ts +17 -1
- package/dist/store/exodus/migrate.d.ts.map +1 -1
- package/dist/store/exodus/migrate.js +155 -33
- package/dist/store/exodus/migrate.js.map +1 -1
- package/dist/store/exodus/on-open.d.ts +14 -0
- package/dist/store/exodus/on-open.d.ts.map +1 -1
- package/dist/store/exodus/on-open.js +115 -6
- package/dist/store/exodus/on-open.js.map +1 -1
- package/dist/store/exodus/reconcile.d.ts +103 -0
- package/dist/store/exodus/reconcile.d.ts.map +1 -0
- package/dist/store/exodus/reconcile.js +728 -0
- package/dist/store/exodus/reconcile.js.map +1 -0
- package/dist/store/exodus/recovery.d.ts.map +1 -1
- package/dist/store/exodus/recovery.js +14 -2
- package/dist/store/exodus/recovery.js.map +1 -1
- package/dist/store/exodus/runtime-targets.d.ts +39 -0
- package/dist/store/exodus/runtime-targets.d.ts.map +1 -0
- package/dist/store/exodus/runtime-targets.js +63 -0
- package/dist/store/exodus/runtime-targets.js.map +1 -0
- package/dist/store/exodus/table-name-map.d.ts.map +1 -1
- package/dist/store/exodus/table-name-map.js +5 -0
- package/dist/store/exodus/table-name-map.js.map +1 -1
- package/dist/store/exodus/table-order.d.ts +35 -0
- package/dist/store/exodus/table-order.d.ts.map +1 -0
- package/dist/store/exodus/table-order.js +62 -0
- package/dist/store/exodus/table-order.js.map +1 -0
- package/dist/store/exodus/verify-migration.d.ts +4 -1
- package/dist/store/exodus/verify-migration.d.ts.map +1 -1
- package/dist/store/exodus/verify-migration.js +142 -10
- package/dist/store/exodus/verify-migration.js.map +1 -1
- package/dist/store/global-salt.d.ts +16 -0
- package/dist/store/global-salt.d.ts.map +1 -1
- package/dist/store/global-salt.js +22 -7
- package/dist/store/global-salt.js.map +1 -1
- package/dist/store/legacy-tasks-lineage.d.ts +86 -0
- package/dist/store/legacy-tasks-lineage.d.ts.map +1 -0
- package/dist/store/legacy-tasks-lineage.js +285 -0
- package/dist/store/legacy-tasks-lineage.js.map +1 -0
- package/dist/store/migration-manager.d.ts +27 -0
- package/dist/store/migration-manager.d.ts.map +1 -1
- package/dist/store/migration-manager.js +63 -0
- package/dist/store/migration-manager.js.map +1 -1
- package/dist/store/portable-bundle-import.d.ts +117 -0
- package/dist/store/portable-bundle-import.d.ts.map +1 -0
- package/dist/store/portable-bundle-import.js +589 -0
- package/dist/store/portable-bundle-import.js.map +1 -0
- package/dist/store/portable-bundle-relocate.d.ts +66 -0
- package/dist/store/portable-bundle-relocate.d.ts.map +1 -0
- package/dist/store/portable-bundle-relocate.js +304 -0
- package/dist/store/portable-bundle-relocate.js.map +1 -0
- package/dist/store/portable-bundle-scan.d.ts +167 -0
- package/dist/store/portable-bundle-scan.d.ts.map +1 -0
- package/dist/store/portable-bundle-scan.js +569 -0
- package/dist/store/portable-bundle-scan.js.map +1 -0
- package/dist/store/portable-bundle.d.ts +146 -0
- package/dist/store/portable-bundle.d.ts.map +1 -0
- package/dist/store/portable-bundle.js +674 -0
- package/dist/store/portable-bundle.js.map +1 -0
- package/dist/store/regenerators.d.ts +3 -1
- package/dist/store/regenerators.d.ts.map +1 -1
- package/dist/store/regenerators.js +6 -2
- package/dist/store/regenerators.js.map +1 -1
- package/dist/store/schema/cleo-global/nexus.d.ts +98 -0
- package/dist/store/schema/cleo-global/nexus.d.ts.map +1 -1
- package/dist/store/schema/cleo-global/nexus.js +19 -0
- package/dist/store/schema/cleo-global/nexus.js.map +1 -1
- package/dist/store/schema/nexus-schema.d.ts +102 -0
- package/dist/store/schema/nexus-schema.d.ts.map +1 -1
- package/dist/store/schema/nexus-schema.js +24 -0
- package/dist/store/schema/nexus-schema.js.map +1 -1
- package/dist/store/split-brain-import.d.ts +176 -0
- package/dist/store/split-brain-import.d.ts.map +1 -0
- package/dist/store/split-brain-import.js +680 -0
- package/dist/store/split-brain-import.js.map +1 -0
- package/dist/store/sqlite.d.ts +29 -0
- package/dist/store/sqlite.d.ts.map +1 -1
- package/dist/store/sqlite.js +57 -5
- package/dist/store/sqlite.js.map +1 -1
- package/dist/system/health.d.ts.map +1 -1
- package/dist/system/health.js +30 -5
- package/dist/system/health.js.map +1 -1
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +60 -0
- package/dist/upgrade.js.map +1 -1
- package/dist/validation/doctor/checks.d.ts +14 -0
- package/dist/validation/doctor/checks.d.ts.map +1 -1
- package/dist/validation/doctor/checks.js +33 -0
- package/dist/validation/doctor/checks.js.map +1 -1
- package/migrations/drizzle-cleo-global/20260924000000_t12354-project-paths/migration.sql +40 -0
- package/migrations/drizzle-nexus/20260924000000_t12315-nexus-parse-cache/migration.sql +21 -0
- package/package.json +13 -13
- package/templates/CLEO-INJECTION.md +3 -3
- package/templates/cleo-gitignore +7 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* portable-bundle-import.ts — import side of the lossless machine-migration
|
|
3
|
+
* bundle (manifest v2).
|
|
4
|
+
*
|
|
5
|
+
* Order of operations (nothing is placed until everything is verified):
|
|
6
|
+
* 1. decrypt (streamed) and extract into a staging directory;
|
|
7
|
+
* 2. verify the manifest self-hash, every file's size + SHA-256, and
|
|
8
|
+
* `PRAGMA integrity_check` on every database;
|
|
9
|
+
* 3. resolve destinations (`--target` for a single project, `--map`
|
|
10
|
+
* prefix rewrites, else the original paths) and refuse to overwrite
|
|
11
|
+
* live data without `force`;
|
|
12
|
+
* 4. relocate the STAGED copies (paths, registry rows) when a project
|
|
13
|
+
* moves;
|
|
14
|
+
* 5. place files and databases (tmp + rename, stale WAL sidecars removed);
|
|
15
|
+
* 6. re-count every table of every placed database and compare with the
|
|
16
|
+
* manifest — any mismatch fails the import;
|
|
17
|
+
* 7. encrypted bundles: unseal the passphrase-sealed credentials and
|
|
18
|
+
* re-encrypt each under the TARGET home's machine-key (the bundle never
|
|
19
|
+
* carries the source machine-key), reporting any that must be re-entered.
|
|
20
|
+
*
|
|
21
|
+
* @task T12318
|
|
22
|
+
* @epic T12317
|
|
23
|
+
* @module store/portable-bundle-import
|
|
24
|
+
*/
|
|
25
|
+
import type { PortableImportResult, PortableImportSectionResult } from '@cleocode/contracts';
|
|
26
|
+
/** One `--map <old>=<new>` prefix rewrite. */
|
|
27
|
+
export interface PathMapping {
|
|
28
|
+
/** Old absolute prefix. */
|
|
29
|
+
from: string;
|
|
30
|
+
/** New absolute prefix. */
|
|
31
|
+
to: string;
|
|
32
|
+
}
|
|
33
|
+
/** Input for {@link importPortableBundle}. */
|
|
34
|
+
export interface ImportPortableBundleInput {
|
|
35
|
+
/** Bundle file. */
|
|
36
|
+
bundlePath: string;
|
|
37
|
+
/** Passphrase for encrypted bundles. */
|
|
38
|
+
passphrase?: string;
|
|
39
|
+
/** Destination project root for a single-project bundle. */
|
|
40
|
+
target?: string;
|
|
41
|
+
/** Prefix rewrites applied to project paths (longest match wins). */
|
|
42
|
+
maps?: readonly PathMapping[];
|
|
43
|
+
/** Destination global home (defaults to `getCleoHome()`). */
|
|
44
|
+
cleoHome?: string;
|
|
45
|
+
/** Destination config home (defaults to `getCleoConfigDir()`). */
|
|
46
|
+
configHome?: string;
|
|
47
|
+
/** Overwrite existing live data. */
|
|
48
|
+
force?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Throw `E_RESTORE_MISMATCH` (carrying the full report) when any restored
|
|
51
|
+
* table count differs from the manifest, instead of returning `lossless: false`.
|
|
52
|
+
*/
|
|
53
|
+
requireLossless?: boolean;
|
|
54
|
+
/** Directory in which to create the staging directory (defaults to the parent of `cleoHome`). */
|
|
55
|
+
stagingParent?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Called after placement for projects whose global registry row could not be
|
|
58
|
+
* rewritten in a bundled global store (project-only bundles). Receives the
|
|
59
|
+
* projectId and new root; returns the registry outcome.
|
|
60
|
+
*/
|
|
61
|
+
registerProject?: (projectId: string | null, newRoot: string) => Promise<NonNullable<PortableImportSectionResult['registry']>>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Parse `--map` values (`<old>=<new>`).
|
|
65
|
+
*
|
|
66
|
+
* @param values - Raw flag values.
|
|
67
|
+
* @returns Parsed mappings with resolved absolute prefixes.
|
|
68
|
+
* @throws {PortableBundleError} `E_BUNDLE_FORMAT` on a malformed value.
|
|
69
|
+
*/
|
|
70
|
+
export declare function parsePathMappings(values: readonly string[]): PathMapping[];
|
|
71
|
+
/**
|
|
72
|
+
* Apply the longest matching prefix mapping to a path.
|
|
73
|
+
*
|
|
74
|
+
* @param original - Original absolute path.
|
|
75
|
+
* @param maps - Mappings.
|
|
76
|
+
* @returns The mapped path (unchanged when nothing matches).
|
|
77
|
+
*/
|
|
78
|
+
export declare function applyPathMappings(original: string, maps: readonly PathMapping[]): string;
|
|
79
|
+
/**
|
|
80
|
+
* Peek at a bundle and report whether it is a portable (manifest v2) bundle.
|
|
81
|
+
*
|
|
82
|
+
* Encrypted bundles are identified by their format version byte; unencrypted
|
|
83
|
+
* ones by the `format` field of their first entry, `manifest.json`.
|
|
84
|
+
*
|
|
85
|
+
* @param bundlePath - Bundle file.
|
|
86
|
+
* @returns `v2`, `v1`, or `unknown`.
|
|
87
|
+
*/
|
|
88
|
+
export declare function detectBundleFormat(bundlePath: string): Promise<'v1' | 'v2' | 'unknown'>;
|
|
89
|
+
/**
|
|
90
|
+
* Import a portable (manifest v2) bundle.
|
|
91
|
+
*
|
|
92
|
+
* @param input - Import options.
|
|
93
|
+
* @returns Per-section outcomes; `lossless` is true only when every table of
|
|
94
|
+
* every placed database re-counts to the manifest value.
|
|
95
|
+
* @throws {PortableBundleError} On decrypt/format/integrity failure, existing
|
|
96
|
+
* live data without `force`, or an ambiguous destination.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* const r = await importPortableBundle({ bundlePath: '/b/p.cleobundle.tar.gz', target: '/new/p' });
|
|
101
|
+
* if (!r.lossless) throw new Error('restore is not lossless');
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare function importPortableBundle(input: ImportPortableBundleInput): Promise<PortableImportResult>;
|
|
105
|
+
/**
|
|
106
|
+
* Point the ambient global registry at a relocated project: move the existing
|
|
107
|
+
* row (keyed by projectId) or register the project when it is absent.
|
|
108
|
+
*
|
|
109
|
+
* Uses the canonical nexus registry API against the CURRENT `getCleoHome()`,
|
|
110
|
+
* so callers must run it with the destination home active.
|
|
111
|
+
*
|
|
112
|
+
* @param projectId - Stable projectId from project-info.json (null when absent).
|
|
113
|
+
* @param newRoot - New project root.
|
|
114
|
+
* @returns Registry outcome.
|
|
115
|
+
*/
|
|
116
|
+
export declare function registerRelocatedProject(projectId: string | null, newRoot: string): Promise<NonNullable<PortableImportSectionResult['registry']>>;
|
|
117
|
+
//# sourceMappingURL=portable-bundle-import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portable-bundle-import.d.ts","sourceRoot":"","sources":["../../src/store/portable-bundle-import.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,OAAO,KAAK,EAIV,oBAAoB,EACpB,2BAA2B,EAK5B,MAAM,qBAAqB,CAAC;AAyB7B,8CAA8C;AAC9C,MAAM,WAAW,WAAW;IAC1B,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,8CAA8C;AAC9C,MAAM,WAAW,yBAAyB;IACxC,mBAAmB;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,IAAI,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAC9B,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iGAAiG;IACjG,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAChB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC,WAAW,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;CACpE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,WAAW,EAAE,CAW1E;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,WAAW,EAAE,GAAG,MAAM,CAQxF;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC,CAqC7F;AA+UD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,oBAAoB,CAAC,CAkM/B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,wBAAwB,CAC5C,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,WAAW,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC,CAAC,CAkB/D"}
|