@cleocode/core 2026.6.2 → 2026.6.4

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 (71) hide show
  1. package/dist/docs/export-document.js +626 -310
  2. package/dist/docs/export-document.js.map +3 -3
  3. package/dist/llm/catalog-cache.d.ts +3 -0
  4. package/dist/llm/catalog-cache.d.ts.map +1 -1
  5. package/dist/llm/catalog-cache.js.map +1 -1
  6. package/dist/llm/catalog-model-resolver.d.ts +89 -0
  7. package/dist/llm/catalog-model-resolver.d.ts.map +1 -0
  8. package/dist/llm/catalog-model-resolver.js +158 -0
  9. package/dist/llm/catalog-model-resolver.js.map +1 -0
  10. package/dist/llm/cli-ops.d.ts +14 -0
  11. package/dist/llm/cli-ops.d.ts.map +1 -1
  12. package/dist/llm/cli-ops.js +35 -0
  13. package/dist/llm/cli-ops.js.map +1 -1
  14. package/dist/llm/index.d.ts +3 -0
  15. package/dist/llm/index.d.ts.map +1 -1
  16. package/dist/llm/index.js +3 -0
  17. package/dist/llm/index.js.map +1 -1
  18. package/dist/llm/oauth/pkce.d.ts +6 -0
  19. package/dist/llm/oauth/pkce.d.ts.map +1 -1
  20. package/dist/llm/oauth/pkce.js +36 -5
  21. package/dist/llm/oauth/pkce.js.map +1 -1
  22. package/dist/llm/plugin-facade.js +648 -324
  23. package/dist/llm/plugin-facade.js.map +3 -3
  24. package/dist/llm/provider-registry/builtin/openai.d.ts +44 -0
  25. package/dist/llm/provider-registry/builtin/openai.d.ts.map +1 -0
  26. package/dist/llm/provider-registry/builtin/openai.js +79 -0
  27. package/dist/llm/provider-registry/builtin/openai.js.map +1 -0
  28. package/dist/llm/provider-registry/index.d.ts.map +1 -1
  29. package/dist/llm/provider-registry/index.js +2 -0
  30. package/dist/llm/provider-registry/index.js.map +1 -1
  31. package/dist/llm/system-resolver.d.ts +94 -0
  32. package/dist/llm/system-resolver.d.ts.map +1 -0
  33. package/dist/llm/system-resolver.js +165 -0
  34. package/dist/llm/system-resolver.js.map +1 -0
  35. package/dist/store/dual-scope-db.d.ts +20 -2
  36. package/dist/store/dual-scope-db.d.ts.map +1 -1
  37. package/dist/store/dual-scope-db.js +74 -7
  38. package/dist/store/dual-scope-db.js.map +1 -1
  39. package/dist/store/exodus/archive.d.ts +216 -0
  40. package/dist/store/exodus/archive.d.ts.map +1 -0
  41. package/dist/store/exodus/archive.js +314 -0
  42. package/dist/store/exodus/archive.js.map +1 -0
  43. package/dist/store/exodus/index.d.ts +1 -0
  44. package/dist/store/exodus/index.d.ts.map +1 -1
  45. package/dist/store/exodus/index.js +1 -0
  46. package/dist/store/exodus/index.js.map +1 -1
  47. package/dist/store/exodus/migrate.d.ts.map +1 -1
  48. package/dist/store/exodus/migrate.js +118 -24
  49. package/dist/store/exodus/migrate.js.map +1 -1
  50. package/dist/store/exodus/on-open.d.ts.map +1 -1
  51. package/dist/store/exodus/on-open.js +95 -34
  52. package/dist/store/exodus/on-open.js.map +1 -1
  53. package/dist/store/exodus/types.d.ts +10 -1
  54. package/dist/store/exodus/types.d.ts.map +1 -1
  55. package/dist/store/exodus/types.js.map +1 -1
  56. package/dist/store/exodus/verify-migration.d.ts.map +1 -1
  57. package/dist/store/exodus/verify-migration.js +12 -1
  58. package/dist/store/exodus/verify-migration.js.map +1 -1
  59. package/dist/store/sqlite.d.ts +16 -0
  60. package/dist/store/sqlite.d.ts.map +1 -1
  61. package/dist/store/sqlite.js +160 -39
  62. package/dist/store/sqlite.js.map +1 -1
  63. package/dist/validation/doctor/checks.d.ts +22 -0
  64. package/dist/validation/doctor/checks.d.ts.map +1 -1
  65. package/dist/validation/doctor/checks.js +67 -0
  66. package/dist/validation/doctor/checks.js.map +1 -1
  67. package/dist/validation/doctor/index.d.ts +1 -1
  68. package/dist/validation/doctor/index.d.ts.map +1 -1
  69. package/dist/validation/doctor/index.js +1 -1
  70. package/dist/validation/doctor/index.js.map +1 -1
  71. package/package.json +12 -12
@@ -0,0 +1,216 @@
1
+ /**
2
+ * Exodus source-DB ARCHIVE + completion-marker subsystem (T11777).
3
+ *
4
+ * ## Why this exists (stranded-residue corruption trigger)
5
+ *
6
+ * The exodus engine migrates from SIX legacy source DBs (project: `tasks.db`,
7
+ * `brain.db`, `conduit.db`; global: `nexus.db`, `signaldock.db`, `skills.db`)
8
+ * but, historically, NEVER retired them — `on-open.ts` literally notes "the file
9
+ * is never unlinked." Every cutover therefore STRANDS the legacy files, and each
10
+ * stranded file re-arms the `tasks_tasks=0` auto-recover / exodus-on-open
11
+ * corruption trigger (DHQ-052 · T11662): on the next open the consolidated DB
12
+ * looks empty-with-legacy-present and the hook re-fires.
13
+ *
14
+ * This module closes the loop. After a migration's lossless validation passes
15
+ * (row-count parity + integrity — `verifyMigration` / `isDataContinuityOk`), the
16
+ * consumed source DBs are ARCHIVED (moved, never deleted) into a per-scope
17
+ * `_archive/` directory, and a committed COMPLETION MARKER records the cutover.
18
+ * The marker becomes the durable "this scope is already migrated" signal so a
19
+ * re-appearing or stranded legacy file can never re-trigger exodus-on-open.
20
+ *
21
+ * ## Archive destinations (per scope, via the paths SSoT)
22
+ *
23
+ * - project sources → `<cleoDir>/_archive/` (e.g. `.cleo/_archive/`)
24
+ * - global sources → `<cleoHome>/_archive/` (e.g. `~/.local/share/cleo/_archive/`)
25
+ *
26
+ * Both are resolved through `resolveCleoDir(cwd)` / `getCleoHome()` — never a
27
+ * hardcoded `~/.local/share` (Paths SSoT · Gate 2 · D009).
28
+ *
29
+ * ## Reversibility + idempotency invariants
30
+ *
31
+ * - **Reversible** — archiving is an atomic `rename` (fallback copy+unlink
32
+ * across filesystems). Nothing is ever deleted; an operator can move a DB
33
+ * back out of `_archive/` to roll the cutover back.
34
+ * - **Idempotent** — a source that is already absent (already archived, or a
35
+ * fresh install that never had it) is a silent no-op. Re-running over an
36
+ * already-archived fleet does nothing and never throws.
37
+ * - **Never blind-move** — only sources the caller asserts were actually
38
+ * consumed + validated by the migration are archived. A source whose
39
+ * migration did not run is left untouched.
40
+ * - **Emergency-archive reconciliation** — this box was emergency-archived
41
+ * (`.cleo/_archive-legacy-postcutover-*` already holds `tasks.db` +
42
+ * `conduit.db`). When the canonical destination already contains a file with
43
+ * the same name, the incoming file is parked under a timestamped sibling name
44
+ * rather than clobbering the prior archive.
45
+ *
46
+ * @module
47
+ * @task T11777 (exodus archives all 6 legacy DBs post-validation + completion marker)
48
+ * @epic T11249 (E6)
49
+ * @saga T11242 (SG-DB-SUBSTRATE-V2)
50
+ * @see packages/core/src/store/exodus/on-open.ts — wires this into the validated success path
51
+ * @see packages/core/src/store/exodus/plan.ts — buildSourceDescriptors (the 6 sources)
52
+ */
53
+ import type { ExodusScope, LegacyDbDescriptor } from './types.js';
54
+ /**
55
+ * Absolute path to a scope's `_archive/` directory.
56
+ *
57
+ * @param scope - Target scope.
58
+ * @param cwd - Working directory used to resolve the project `.cleo/` dir.
59
+ * @returns Absolute path to `<scopeBase>/_archive/`.
60
+ */
61
+ export declare function exodusArchiveDir(scope: ExodusScope, cwd?: string): string;
62
+ /**
63
+ * Absolute path to a scope's exodus completion marker file.
64
+ *
65
+ * @param scope - Target scope.
66
+ * @param cwd - Working directory used to resolve the project `.cleo/` dir.
67
+ * @returns Absolute path to `<scopeBase>/exodus-complete`.
68
+ */
69
+ export declare function exodusMarkerPath(scope: ExodusScope, cwd?: string): string;
70
+ /**
71
+ * Shape of the committed exodus completion marker (`exodus-complete`).
72
+ *
73
+ * Recorded once per scope after a validated cutover. Its presence — not the
74
+ * source-file `existsSync` — is the durable trigger-gate for exodus-on-open.
75
+ */
76
+ export interface ExodusCompleteMarker {
77
+ /** Marker format version. */
78
+ readonly version: 1;
79
+ /** Scope this marker certifies as migrated. */
80
+ readonly scope: ExodusScope;
81
+ /** cleo package version that performed the cutover. */
82
+ readonly cleoVersion: string;
83
+ /** ISO-8601 timestamp of the cutover. */
84
+ readonly completedAt: string;
85
+ /** Logical names of the legacy sources that were archived (provenance). */
86
+ readonly archivedSources: readonly string[];
87
+ }
88
+ /**
89
+ * Return `true` if a scope's exodus completion marker exists on disk.
90
+ *
91
+ * Resolution-safe: when the project `.cleo/` dir cannot be resolved (e.g. `cwd`
92
+ * is not inside a CLEO project — `resolveCleoDir` throws), this returns `false`
93
+ * (no marker) rather than propagating, so the on-open trigger gate degrades to
94
+ * the source-file path safely instead of crashing the open.
95
+ *
96
+ * @param scope - Target scope.
97
+ * @param cwd - Working directory used to resolve the project `.cleo/` dir.
98
+ * @returns Whether `<scopeBase>/exodus-complete` exists.
99
+ */
100
+ export declare function hasExodusCompleteMarker(scope: ExodusScope, cwd?: string): boolean;
101
+ /**
102
+ * Write a scope's exodus completion marker atomically (write-then-rename).
103
+ *
104
+ * Idempotent: re-writing simply refreshes the marker (same path). The marker is
105
+ * the SSoT trigger-gate consulted by {@link maybeRunExodusOnOpen} — once present,
106
+ * a stranded/re-appearing legacy file cannot re-arm the auto-migration.
107
+ *
108
+ * @param scope - Scope being certified as migrated.
109
+ * @param archivedSources - Logical names of the sources archived for this scope.
110
+ * @param cwd - Working directory used to resolve the project dir.
111
+ * @returns The marker's absolute path.
112
+ *
113
+ * @task T11777
114
+ */
115
+ export declare function writeExodusCompleteMarker(scope: ExodusScope, archivedSources: readonly string[], cwd?: string): string;
116
+ /**
117
+ * Outcome of archiving one source DB.
118
+ */
119
+ export interface ArchivedSourceResult {
120
+ /** Logical source name (`LegacyDbDescriptor.name`). */
121
+ readonly name: string;
122
+ /** Original absolute source path. */
123
+ readonly sourcePath: string;
124
+ /** Destination path inside `_archive/`, or `null` when nothing was moved. */
125
+ readonly archivedTo: string | null;
126
+ /** `'archived'` — moved; `'absent'` — nothing to move (idempotent no-op). */
127
+ readonly action: 'archived' | 'absent';
128
+ }
129
+ /**
130
+ * Archive ONE legacy source DB (and its `-wal` / `-shm` sidecars) into the
131
+ * scope's `_archive/` directory.
132
+ *
133
+ * Idempotent: if the main DB file is already absent, this is a no-op (the file
134
+ * was already archived, or never existed). Sidecars are archived best-effort and
135
+ * only when the main DB is present.
136
+ *
137
+ * @param source - The descriptor for the source DB to archive.
138
+ * @param cwd - Working directory used to resolve the project dir.
139
+ * @returns A {@link ArchivedSourceResult} describing what happened.
140
+ *
141
+ * @task T11777
142
+ */
143
+ export declare function archiveSourceDb(source: LegacyDbDescriptor, cwd?: string): ArchivedSourceResult;
144
+ /**
145
+ * Result of {@link archiveMigratedSources}.
146
+ */
147
+ export interface ArchiveMigratedSourcesResult {
148
+ /** Per-source archive outcomes. */
149
+ readonly sources: readonly ArchivedSourceResult[];
150
+ /** Scopes for which a completion marker was written. */
151
+ readonly markersWritten: readonly ExodusScope[];
152
+ }
153
+ /**
154
+ * Archive every consumed legacy source DB AFTER a validated cutover and write a
155
+ * per-scope completion marker.
156
+ *
157
+ * **Never blind-moves**: only the descriptors passed in `consumed` are archived
158
+ * — the caller (the validated migrate/on-open success path) passes exactly the
159
+ * sources whose migration actually ran and passed parity. A completion marker is
160
+ * written for every scope represented in `consumed`, even if some of that scope's
161
+ * sources were already absent (already archived) — the marker certifies "this
162
+ * scope's cutover is done", which is true once parity passed.
163
+ *
164
+ * Idempotent + reversible (see module docs). Safe to call repeatedly.
165
+ *
166
+ * @param consumed - Source descriptors the migration consumed + validated.
167
+ * @param cwd - Working directory used to resolve the project dir.
168
+ * @returns A {@link ArchiveMigratedSourcesResult} with per-source + per-scope outcomes.
169
+ *
170
+ * @task T11777
171
+ */
172
+ export declare function archiveMigratedSources(consumed: readonly LegacyDbDescriptor[], cwd?: string): ArchiveMigratedSourcesResult;
173
+ /**
174
+ * A legacy source DB that is still present on disk AFTER its scope's exodus
175
+ * completion marker was written — i.e. stranded residue that should have been
176
+ * archived.
177
+ */
178
+ export interface StrandedResidueEntry {
179
+ /** Logical source name. */
180
+ readonly name: string;
181
+ /** Absolute path of the still-present legacy DB. */
182
+ readonly path: string;
183
+ /** Scope whose marker certifies the cutover. */
184
+ readonly scope: ExodusScope;
185
+ }
186
+ /**
187
+ * Detect stranded legacy source DBs: any of the six sources still present on
188
+ * disk for a scope whose exodus completion marker exists.
189
+ *
190
+ * Returns an empty array when no marker exists for either scope (a pre-cutover
191
+ * install where legacy DBs are still the live source of truth — NOT residue) or
192
+ * when every source for a marked scope has been archived.
193
+ *
194
+ * @param sources - The full legacy source descriptor list (from `buildExodusPlan`).
195
+ * @param cwd - Working directory used to resolve the project dir + markers.
196
+ * @returns The stranded entries (empty when clean).
197
+ *
198
+ * @task T11777
199
+ */
200
+ export declare function detectStrandedResidue(sources: readonly LegacyDbDescriptor[], cwd?: string): StrandedResidueEntry[];
201
+ /**
202
+ * Archive stranded residue detected by {@link detectStrandedResidue}.
203
+ *
204
+ * This is the `--fix` action for the `cleo doctor exodus-residue` check. It reuses
205
+ * {@link archiveSourceDb} so the on-open success path and the doctor fix share one
206
+ * archive routine. Reversible (move, never delete) and idempotent.
207
+ *
208
+ * @param stranded - The stranded entries to archive.
209
+ * @param sources - The full source descriptor list (to map name → descriptor).
210
+ * @param cwd - Working directory used to resolve the project dir.
211
+ * @returns Per-source archive outcomes.
212
+ *
213
+ * @task T11777
214
+ */
215
+ export declare function archiveStrandedResidue(stranded: readonly StrandedResidueEntry[], sources: readonly LegacyDbDescriptor[], cwd?: string): ArchivedSourceResult[];
216
+ //# sourceMappingURL=archive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archive.d.ts","sourceRoot":"","sources":["../../../src/store/exodus/archive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAcH,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AA6BlE;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzE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E,CAAC;CACjD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,EACvC,GAAG,CAAC,EAAE,MAAM,GACX,4BAA4B,CAiB9B;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,SAAS,kBAAkB,EAAE,EACtC,GAAG,CAAC,EAAE,MAAM,GACX,oBAAoB,EAAE,CAexB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,SAAS,oBAAoB,EAAE,EACzC,OAAO,EAAE,SAAS,kBAAkB,EAAE,EACtC,GAAG,CAAC,EAAE,MAAM,GACX,oBAAoB,EAAE,CASxB"}
@@ -0,0 +1,314 @@
1
+ /**
2
+ * Exodus source-DB ARCHIVE + completion-marker subsystem (T11777).
3
+ *
4
+ * ## Why this exists (stranded-residue corruption trigger)
5
+ *
6
+ * The exodus engine migrates from SIX legacy source DBs (project: `tasks.db`,
7
+ * `brain.db`, `conduit.db`; global: `nexus.db`, `signaldock.db`, `skills.db`)
8
+ * but, historically, NEVER retired them — `on-open.ts` literally notes "the file
9
+ * is never unlinked." Every cutover therefore STRANDS the legacy files, and each
10
+ * stranded file re-arms the `tasks_tasks=0` auto-recover / exodus-on-open
11
+ * corruption trigger (DHQ-052 · T11662): on the next open the consolidated DB
12
+ * looks empty-with-legacy-present and the hook re-fires.
13
+ *
14
+ * This module closes the loop. After a migration's lossless validation passes
15
+ * (row-count parity + integrity — `verifyMigration` / `isDataContinuityOk`), the
16
+ * consumed source DBs are ARCHIVED (moved, never deleted) into a per-scope
17
+ * `_archive/` directory, and a committed COMPLETION MARKER records the cutover.
18
+ * The marker becomes the durable "this scope is already migrated" signal so a
19
+ * re-appearing or stranded legacy file can never re-trigger exodus-on-open.
20
+ *
21
+ * ## Archive destinations (per scope, via the paths SSoT)
22
+ *
23
+ * - project sources → `<cleoDir>/_archive/` (e.g. `.cleo/_archive/`)
24
+ * - global sources → `<cleoHome>/_archive/` (e.g. `~/.local/share/cleo/_archive/`)
25
+ *
26
+ * Both are resolved through `resolveCleoDir(cwd)` / `getCleoHome()` — never a
27
+ * hardcoded `~/.local/share` (Paths SSoT · Gate 2 · D009).
28
+ *
29
+ * ## Reversibility + idempotency invariants
30
+ *
31
+ * - **Reversible** — archiving is an atomic `rename` (fallback copy+unlink
32
+ * across filesystems). Nothing is ever deleted; an operator can move a DB
33
+ * back out of `_archive/` to roll the cutover back.
34
+ * - **Idempotent** — a source that is already absent (already archived, or a
35
+ * fresh install that never had it) is a silent no-op. Re-running over an
36
+ * already-archived fleet does nothing and never throws.
37
+ * - **Never blind-move** — only sources the caller asserts were actually
38
+ * consumed + validated by the migration are archived. A source whose
39
+ * migration did not run is left untouched.
40
+ * - **Emergency-archive reconciliation** — this box was emergency-archived
41
+ * (`.cleo/_archive-legacy-postcutover-*` already holds `tasks.db` +
42
+ * `conduit.db`). When the canonical destination already contains a file with
43
+ * the same name, the incoming file is parked under a timestamped sibling name
44
+ * rather than clobbering the prior archive.
45
+ *
46
+ * @module
47
+ * @task T11777 (exodus archives all 6 legacy DBs post-validation + completion marker)
48
+ * @epic T11249 (E6)
49
+ * @saga T11242 (SG-DB-SUBSTRATE-V2)
50
+ * @see packages/core/src/store/exodus/on-open.ts — wires this into the validated success path
51
+ * @see packages/core/src/store/exodus/plan.ts — buildSourceDescriptors (the 6 sources)
52
+ */
53
+ import { copyFileSync, existsSync, mkdirSync, renameSync, unlinkSync, writeFileSync, } from 'node:fs';
54
+ import { basename, join } from 'node:path';
55
+ import { getLogger } from '../../logger.js';
56
+ import { getCleoHome, resolveCleoDir } from '../../paths.js';
57
+ import { getCleoVersion } from '../../scaffold/ensure-config.js';
58
+ const log = getLogger('exodus-archive');
59
+ /** Per-scope archive directory name (sibling of the migrated DBs). */
60
+ const ARCHIVE_DIR_NAME = '_archive';
61
+ /** Per-scope completion-marker filename written next to the consolidated cleo.db. */
62
+ const MARKER_FILENAME_BY_SCOPE = {
63
+ project: 'exodus-complete',
64
+ global: 'exodus-complete',
65
+ };
66
+ /** SQLite sidecar suffixes archived alongside the main DB file. */
67
+ const SIDECAR_SUFFIXES = ['-wal', '-shm'];
68
+ /**
69
+ * Resolve the directory that holds a scope's legacy source DBs (and therefore
70
+ * its archive + completion marker): project → `<cleoDir>`, global →
71
+ * `<cleoHome>`. Always via the paths SSoT.
72
+ *
73
+ * @param scope - Target scope.
74
+ * @param cwd - Working directory used to resolve the project `.cleo/` dir.
75
+ * @returns Absolute path to the scope's base directory.
76
+ */
77
+ function scopeBaseDir(scope, cwd) {
78
+ return scope === 'project' ? resolveCleoDir(cwd) : getCleoHome();
79
+ }
80
+ /**
81
+ * Absolute path to a scope's `_archive/` directory.
82
+ *
83
+ * @param scope - Target scope.
84
+ * @param cwd - Working directory used to resolve the project `.cleo/` dir.
85
+ * @returns Absolute path to `<scopeBase>/_archive/`.
86
+ */
87
+ export function exodusArchiveDir(scope, cwd) {
88
+ return join(scopeBaseDir(scope, cwd), ARCHIVE_DIR_NAME);
89
+ }
90
+ /**
91
+ * Absolute path to a scope's exodus completion marker file.
92
+ *
93
+ * @param scope - Target scope.
94
+ * @param cwd - Working directory used to resolve the project `.cleo/` dir.
95
+ * @returns Absolute path to `<scopeBase>/exodus-complete`.
96
+ */
97
+ export function exodusMarkerPath(scope, cwd) {
98
+ return join(scopeBaseDir(scope, cwd), MARKER_FILENAME_BY_SCOPE[scope]);
99
+ }
100
+ /**
101
+ * Return `true` if a scope's exodus completion marker exists on disk.
102
+ *
103
+ * Resolution-safe: when the project `.cleo/` dir cannot be resolved (e.g. `cwd`
104
+ * is not inside a CLEO project — `resolveCleoDir` throws), this returns `false`
105
+ * (no marker) rather than propagating, so the on-open trigger gate degrades to
106
+ * the source-file path safely instead of crashing the open.
107
+ *
108
+ * @param scope - Target scope.
109
+ * @param cwd - Working directory used to resolve the project `.cleo/` dir.
110
+ * @returns Whether `<scopeBase>/exodus-complete` exists.
111
+ */
112
+ export function hasExodusCompleteMarker(scope, cwd) {
113
+ try {
114
+ return existsSync(exodusMarkerPath(scope, cwd));
115
+ }
116
+ catch {
117
+ return false;
118
+ }
119
+ }
120
+ /**
121
+ * Write a scope's exodus completion marker atomically (write-then-rename).
122
+ *
123
+ * Idempotent: re-writing simply refreshes the marker (same path). The marker is
124
+ * the SSoT trigger-gate consulted by {@link maybeRunExodusOnOpen} — once present,
125
+ * a stranded/re-appearing legacy file cannot re-arm the auto-migration.
126
+ *
127
+ * @param scope - Scope being certified as migrated.
128
+ * @param archivedSources - Logical names of the sources archived for this scope.
129
+ * @param cwd - Working directory used to resolve the project dir.
130
+ * @returns The marker's absolute path.
131
+ *
132
+ * @task T11777
133
+ */
134
+ export function writeExodusCompleteMarker(scope, archivedSources, cwd) {
135
+ const markerPath = exodusMarkerPath(scope, cwd);
136
+ const baseDir = scopeBaseDir(scope, cwd);
137
+ mkdirSync(baseDir, { recursive: true });
138
+ const marker = {
139
+ version: 1,
140
+ scope,
141
+ cleoVersion: getCleoVersion(),
142
+ completedAt: new Date().toISOString(),
143
+ archivedSources: [...archivedSources],
144
+ };
145
+ const tmpPath = `${markerPath}.tmp`;
146
+ writeFileSync(tmpPath, JSON.stringify(marker, null, 2) + '\n', 'utf8');
147
+ renameSync(tmpPath, markerPath);
148
+ log.info({ scope, markerPath, archivedSources }, 'exodus: wrote completion marker');
149
+ return markerPath;
150
+ }
151
+ /**
152
+ * Move a single file to `destDir`, atomically when possible.
153
+ *
154
+ * Uses `rename`; on a cross-filesystem `EXDEV` (or any rename failure) falls back
155
+ * to copy-then-unlink so the move still completes. When `destDir` already holds a
156
+ * file with the same name (e.g. a prior emergency archive), the incoming file is
157
+ * parked under a timestamped sibling name so the prior archive is never clobbered.
158
+ *
159
+ * @param srcPath - Absolute source file path (assumed to exist).
160
+ * @param destDir - Absolute archive directory (created if missing).
161
+ * @returns The absolute destination path the file landed at.
162
+ */
163
+ function moveFileInto(srcPath, destDir) {
164
+ mkdirSync(destDir, { recursive: true });
165
+ let dest = join(destDir, basename(srcPath));
166
+ if (existsSync(dest)) {
167
+ // Do not clobber a prior archive (e.g. emergency-archived tasks.db). Park
168
+ // the incoming file under a timestamped sibling name instead.
169
+ const stamp = new Date().toISOString().replace(/[:.]/g, '').replace(/Z$/, 'Z');
170
+ dest = join(destDir, `${basename(srcPath)}.${stamp}`);
171
+ }
172
+ try {
173
+ renameSync(srcPath, dest);
174
+ }
175
+ catch {
176
+ // Cross-filesystem (EXDEV) or other rename failure → copy + unlink fallback.
177
+ copyFileSync(srcPath, dest);
178
+ unlinkSync(srcPath);
179
+ }
180
+ return dest;
181
+ }
182
+ /**
183
+ * Archive ONE legacy source DB (and its `-wal` / `-shm` sidecars) into the
184
+ * scope's `_archive/` directory.
185
+ *
186
+ * Idempotent: if the main DB file is already absent, this is a no-op (the file
187
+ * was already archived, or never existed). Sidecars are archived best-effort and
188
+ * only when the main DB is present.
189
+ *
190
+ * @param source - The descriptor for the source DB to archive.
191
+ * @param cwd - Working directory used to resolve the project dir.
192
+ * @returns A {@link ArchivedSourceResult} describing what happened.
193
+ *
194
+ * @task T11777
195
+ */
196
+ export function archiveSourceDb(source, cwd) {
197
+ // Idempotent no-op: nothing to archive (already archived or fresh install).
198
+ if (!existsSync(source.path)) {
199
+ return { name: source.name, sourcePath: source.path, archivedTo: null, action: 'absent' };
200
+ }
201
+ const destDir = exodusArchiveDir(source.targetScope, cwd);
202
+ const archivedTo = moveFileInto(source.path, destDir);
203
+ // Archive sidecars alongside the DB (best-effort — they may not exist).
204
+ for (const suffix of SIDECAR_SUFFIXES) {
205
+ const sidecar = `${source.path}${suffix}`;
206
+ if (existsSync(sidecar)) {
207
+ try {
208
+ moveFileInto(sidecar, destDir);
209
+ }
210
+ catch (err) {
211
+ log.warn({ err, sidecar, sourceName: source.name }, 'exodus-archive: failed to archive sidecar (non-fatal)');
212
+ }
213
+ }
214
+ }
215
+ log.info({ sourceName: source.name, sourcePath: source.path, archivedTo, scope: source.targetScope }, 'exodus-archive: archived legacy source DB');
216
+ return {
217
+ name: source.name,
218
+ sourcePath: source.path,
219
+ archivedTo,
220
+ action: 'archived',
221
+ };
222
+ }
223
+ /**
224
+ * Archive every consumed legacy source DB AFTER a validated cutover and write a
225
+ * per-scope completion marker.
226
+ *
227
+ * **Never blind-moves**: only the descriptors passed in `consumed` are archived
228
+ * — the caller (the validated migrate/on-open success path) passes exactly the
229
+ * sources whose migration actually ran and passed parity. A completion marker is
230
+ * written for every scope represented in `consumed`, even if some of that scope's
231
+ * sources were already absent (already archived) — the marker certifies "this
232
+ * scope's cutover is done", which is true once parity passed.
233
+ *
234
+ * Idempotent + reversible (see module docs). Safe to call repeatedly.
235
+ *
236
+ * @param consumed - Source descriptors the migration consumed + validated.
237
+ * @param cwd - Working directory used to resolve the project dir.
238
+ * @returns A {@link ArchiveMigratedSourcesResult} with per-source + per-scope outcomes.
239
+ *
240
+ * @task T11777
241
+ */
242
+ export function archiveMigratedSources(consumed, cwd) {
243
+ const results = [];
244
+ const scopes = new Set();
245
+ for (const source of consumed) {
246
+ scopes.add(source.targetScope);
247
+ results.push(archiveSourceDb(source, cwd));
248
+ }
249
+ const markersWritten = [];
250
+ for (const scope of scopes) {
251
+ const archivedForScope = consumed.filter((s) => s.targetScope === scope).map((s) => s.name);
252
+ writeExodusCompleteMarker(scope, archivedForScope, cwd);
253
+ markersWritten.push(scope);
254
+ }
255
+ return { sources: results, markersWritten };
256
+ }
257
+ /**
258
+ * Detect stranded legacy source DBs: any of the six sources still present on
259
+ * disk for a scope whose exodus completion marker exists.
260
+ *
261
+ * Returns an empty array when no marker exists for either scope (a pre-cutover
262
+ * install where legacy DBs are still the live source of truth — NOT residue) or
263
+ * when every source for a marked scope has been archived.
264
+ *
265
+ * @param sources - The full legacy source descriptor list (from `buildExodusPlan`).
266
+ * @param cwd - Working directory used to resolve the project dir + markers.
267
+ * @returns The stranded entries (empty when clean).
268
+ *
269
+ * @task T11777
270
+ */
271
+ export function detectStrandedResidue(sources, cwd) {
272
+ const markedScopes = new Set();
273
+ for (const scope of ['project', 'global']) {
274
+ if (hasExodusCompleteMarker(scope, cwd))
275
+ markedScopes.add(scope);
276
+ }
277
+ if (markedScopes.size === 0)
278
+ return [];
279
+ const stranded = [];
280
+ for (const source of sources) {
281
+ if (!markedScopes.has(source.targetScope))
282
+ continue;
283
+ if (existsSync(source.path)) {
284
+ stranded.push({ name: source.name, path: source.path, scope: source.targetScope });
285
+ }
286
+ }
287
+ return stranded;
288
+ }
289
+ /**
290
+ * Archive stranded residue detected by {@link detectStrandedResidue}.
291
+ *
292
+ * This is the `--fix` action for the `cleo doctor exodus-residue` check. It reuses
293
+ * {@link archiveSourceDb} so the on-open success path and the doctor fix share one
294
+ * archive routine. Reversible (move, never delete) and idempotent.
295
+ *
296
+ * @param stranded - The stranded entries to archive.
297
+ * @param sources - The full source descriptor list (to map name → descriptor).
298
+ * @param cwd - Working directory used to resolve the project dir.
299
+ * @returns Per-source archive outcomes.
300
+ *
301
+ * @task T11777
302
+ */
303
+ export function archiveStrandedResidue(stranded, sources, cwd) {
304
+ const byName = new Map(sources.map((s) => [s.name, s]));
305
+ const results = [];
306
+ for (const entry of stranded) {
307
+ const descriptor = byName.get(entry.name);
308
+ if (descriptor === undefined)
309
+ continue;
310
+ results.push(archiveSourceDb(descriptor, cwd));
311
+ }
312
+ return results;
313
+ }
314
+ //# sourceMappingURL=archive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archive.js","sourceRoot":"","sources":["../../../src/store/exodus/archive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;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AAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;QAC7B,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,UAAU,KAAK,SAAS;YAAE,SAAS;QACvC,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -8,6 +8,7 @@
8
8
  * @task T11248 (E5 · SG-DB-SUBSTRATE-V2)
9
9
  * @saga T11242
10
10
  */
11
+ export { type ArchivedSourceResult, type ArchiveMigratedSourcesResult, archiveMigratedSources, archiveSourceDb, archiveStrandedResidue, detectStrandedResidue, type ExodusCompleteMarker, exodusArchiveDir, exodusMarkerPath, hasExodusCompleteMarker, type StrandedResidueEntry, writeExodusCompleteMarker, } from './archive.js';
11
12
  export { clearExodusJournal, runExodusMigrate } from './migrate.js';
12
13
  export { buildExodusPlan, deriveStagingDirName, sourcesPresent } from './plan.js';
13
14
  export { runExodusStatus } from './status.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/store/exodus/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,aAAa,EACb,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,4BAA4B,EAC5B,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/store/exodus/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EACjC,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,oBAAoB,EACzB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,KAAK,oBAAoB,EACzB,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,aAAa,EACb,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,4BAA4B,EAC5B,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
@@ -8,6 +8,7 @@
8
8
  * @task T11248 (E5 · SG-DB-SUBSTRATE-V2)
9
9
  * @saga T11242
10
10
  */
11
+ export { archiveMigratedSources, archiveSourceDb, archiveStrandedResidue, detectStrandedResidue, exodusArchiveDir, exodusMarkerPath, hasExodusCompleteMarker, writeExodusCompleteMarker, } from './archive.js';
11
12
  export { clearExodusJournal, runExodusMigrate } from './migrate.js';
12
13
  export { buildExodusPlan, deriveStagingDirName, sourcesPresent } from './plan.js';
13
14
  export { runExodusStatus } from './status.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/store/exodus/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,aAAa,GAEd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,4BAA4B,GAY7B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/store/exodus/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAGL,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EAErB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EAEvB,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,aAAa,GAEd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,4BAA4B,GAY7B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../src/store/exodus/migrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgHG;AAkBH,OAAO,KAAK,EAEV,mBAAmB,EACnB,UAAU,EAMX,MAAM,YAAY,CAAC;AAiEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAiB9D;AAs3BD;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,UAAU,EAChB,iBAAiB,UAAQ,EACzB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GACjC,OAAO,CAAC,mBAAmB,CAAC,CA0I9B"}
1
+ {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../src/store/exodus/migrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgHG;AAmBH,OAAO,KAAK,EAEV,mBAAmB,EACnB,UAAU,EAMX,MAAM,YAAY,CAAC;AAiEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAiB9D;AAw9BD;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,UAAU,EAChB,iBAAiB,UAAQ,EACzB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GACjC,OAAO,CAAC,mBAAmB,CAAC,CAoK9B"}