@cleocode/contracts 2026.5.108 → 2026.5.110

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 (51) hide show
  1. package/dist/__tests__/db-inventory.test.d.ts +25 -0
  2. package/dist/__tests__/db-inventory.test.d.ts.map +1 -0
  3. package/dist/__tests__/db-inventory.test.js +148 -0
  4. package/dist/__tests__/db-inventory.test.js.map +1 -0
  5. package/dist/__tests__/memory-wire-shapes.test.js.map +1 -1
  6. package/dist/__tests__/task-type-narrowing.test.d.ts +14 -0
  7. package/dist/__tests__/task-type-narrowing.test.d.ts.map +1 -0
  8. package/dist/__tests__/task-type-narrowing.test.js +51 -0
  9. package/dist/__tests__/task-type-narrowing.test.js.map +1 -0
  10. package/dist/backup-verify.d.ts +136 -0
  11. package/dist/backup-verify.d.ts.map +1 -0
  12. package/dist/backup-verify.js +29 -0
  13. package/dist/backup-verify.js.map +1 -0
  14. package/dist/brain.d.ts +103 -0
  15. package/dist/brain.d.ts.map +1 -1
  16. package/dist/db-inventory.d.ts +200 -0
  17. package/dist/db-inventory.d.ts.map +1 -0
  18. package/dist/db-inventory.js +76 -0
  19. package/dist/db-inventory.js.map +1 -0
  20. package/dist/db-inventory.json +165 -0
  21. package/dist/db-recovery.d.ts +141 -0
  22. package/dist/db-recovery.d.ts.map +1 -0
  23. package/dist/db-recovery.js +29 -0
  24. package/dist/db-recovery.js.map +1 -0
  25. package/dist/doctor.d.ts +605 -0
  26. package/dist/doctor.d.ts.map +1 -1
  27. package/dist/index.d.ts +6 -2
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +1 -0
  30. package/dist/index.js.map +1 -1
  31. package/dist/memory/observe.d.ts +8 -0
  32. package/dist/memory/observe.d.ts.map +1 -1
  33. package/dist/operations/tasks.d.ts +4 -4
  34. package/dist/operations/tasks.d.ts.map +1 -1
  35. package/dist/task.d.ts +13 -2
  36. package/dist/task.d.ts.map +1 -1
  37. package/dist/task.js.map +1 -1
  38. package/package.json +5 -4
  39. package/src/__tests__/db-inventory.test.ts +184 -0
  40. package/src/__tests__/memory-wire-shapes.test.ts +1 -0
  41. package/src/__tests__/task-type-narrowing.test.ts +56 -0
  42. package/src/backup-verify.ts +140 -0
  43. package/src/brain.ts +114 -0
  44. package/src/db-inventory.json +165 -0
  45. package/src/db-inventory.ts +234 -0
  46. package/src/db-recovery.ts +144 -0
  47. package/src/doctor.ts +634 -0
  48. package/src/index.ts +46 -0
  49. package/src/memory/observe.ts +8 -0
  50. package/src/operations/tasks.ts +4 -4
  51. package/src/task.ts +13 -2
package/src/index.ts CHANGED
@@ -128,6 +128,14 @@ export type {
128
128
  BackupMetadata,
129
129
  BackupScope,
130
130
  } from './backup-manifest.js';
131
+ // === Backup Verify Types (T10319 — per-DB freshness + integrity walker) ===
132
+ export type {
133
+ BackupVerifyDbReport,
134
+ BackupVerifyResult,
135
+ BackupVerifySnapshot,
136
+ BackupVerifySummary,
137
+ BackupVerifyVerdict,
138
+ } from './backup-verify.js';
131
139
  // === Boundary Registry (SSoT for Rust/TS layering — ADR-078, Saga T10176) ===
132
140
  export type {
133
141
  BoundaryEntry,
@@ -140,10 +148,13 @@ export type {
140
148
  export { BOUNDARY_REGISTRY } from './boundary.js';
141
149
  // === Brain/Memory Types ===
142
150
  export type {
151
+ BackupRecoverBrainResult,
143
152
  BrainCognitiveType,
144
153
  BrainEntryRef,
145
154
  BrainEntrySummary,
146
155
  BrainMemoryTier,
156
+ BrainRecoveredRowCounts,
157
+ BrainRecoveryResult,
147
158
  BrainSourceConfidence,
148
159
  ContradictionDetail,
149
160
  SupersededEntry,
@@ -271,6 +282,21 @@ export type {
271
282
  TaskQueryFilters,
272
283
  TransactionAccessor,
273
284
  } from './data-accessor.js';
285
+ // === Database Inventory (Saga T10281 / Epic T10282 / Task T10305 — SG-BRAIN-DB-RESILIENCE) ===
286
+ export type {
287
+ DbConcurrency,
288
+ DbInventoryEntry,
289
+ DbPrivacy,
290
+ DbRole,
291
+ DbTier,
292
+ } from './db-inventory.js';
293
+ export { DB_INVENTORY } from './db-inventory.js';
294
+ // === DB Recovery (T10318 — Saga T10281 / Epic T10284 — generic across DB_INVENTORY) ===
295
+ export type {
296
+ BackupRecoverResult,
297
+ DbRecoveredRowCounts,
298
+ DbRecoveryResult,
299
+ } from './db-recovery.js';
274
300
  // === Dependency Registry Contracts ===
275
301
  export type {
276
302
  DependencyCategory,
@@ -313,10 +339,30 @@ export {
313
339
  } from './docs-taxonomy.js';
314
340
  // === Doctor: Worktree-Orphan Audit + Prune Types (T9790, T9808, T9962) ===
315
341
  // === Doctor: Saga Hierarchy Audit (T10119 — ADR-073 §1.2) ===
342
+ // === Doctor: DB-Substrate Survey (T10307 — Saga T10281 / Epic T10282) ===
343
+ // === Doctor: Legacy-Backup Walker (T10309 — Saga T10281 / Epic T10282) ===
344
+ // === Doctor: Cross-DB Invariants (T10323 — Saga T10281 / Epic T10285) ===
316
345
  export type {
317
346
  ComprehensiveAuditResult,
347
+ DbCrossDbInvariantId,
348
+ DbCrossDbOrphanReport,
349
+ DbSubstrateAuditResult,
350
+ DbSubstrateEntry,
351
+ DbSubstrateMigrationCoverage,
352
+ DbSubstrateMigrationMissing,
353
+ DbSubstrateMigrationOrphan,
354
+ DbSubstrateProjectSurvey,
355
+ DbSubstrateSummary,
356
+ DbSubstrateSurveyOptions,
357
+ DbSubstrateWarning,
358
+ DbSubstrateWarningKind,
359
+ LegacyBackupEntry,
360
+ LegacyBackupOriginHint,
361
+ LegacyBackupRecommendation,
362
+ LegacyBackupScanResult,
318
363
  OrphanEntry,
319
364
  OrphanScanResult,
365
+ PragmaDriftItem,
320
366
  PruneAuditEntry,
321
367
  PruneResult,
322
368
  SagaAuditEntry,
@@ -122,6 +122,14 @@ export interface ObserveBrainParams {
122
122
  * External callers MUST NOT set this flag.
123
123
  */
124
124
  _skipGate?: boolean;
125
+ /**
126
+ * T10351: Internal flag — when true, bypasses the brain writer-thread
127
+ * chokepoint and writes directly. Set ONLY by the writer-thread handler
128
+ * (`brain-writer-handlers.ts`) when re-entering observeBrain from inside
129
+ * the worker, so the routing doesn't recurse forever. External callers
130
+ * MUST NOT set this flag.
131
+ */
132
+ _skipQueue?: boolean;
125
133
  }
126
134
 
127
135
  // ── ObserveBrainResult ──────────────────────────────────────────────
@@ -24,7 +24,7 @@ import type { TaskAnalysisResult, TaskRef } from '../results.js';
24
24
  * Common task types (API contract — matches CLI src/types/task.ts)
25
25
  */
26
26
  import type { TaskStatus } from '../status-registry.js';
27
- import type { TaskPriority } from '../task.js';
27
+ import type { TaskPriority, TaskType } from '../task.js';
28
28
  import type { TaskRecord } from '../task-record.js';
29
29
  import type { ExternalTask, ExternalTaskLink, ReconcileResult } from '../task-sync.js';
30
30
  import type {
@@ -725,7 +725,7 @@ export interface TasksAddBatchParams {
725
725
  depends?: string[];
726
726
  priority?: string;
727
727
  labels?: string[];
728
- type?: string; // SSoT-EXEMPT:kind≠type — 'type' is hierarchy(epic|task|subtask), 'kind' is intent(work|bug|...) — separate axes T944
728
+ type?: TaskType; // SSoT-EXEMPT:kind≠type — 'type' is hierarchy(saga|epic|task|subtask), 'kind' is intent(work|bug|...) — separate axes T944 // ssot-exempt-ok: pre-existing exempt, narrowed string→TaskType (T10328)
729
729
  acceptance?: string[];
730
730
  phase?: string;
731
731
  size?: string;
@@ -768,7 +768,7 @@ export interface TasksAddParams {
768
768
  depends?: string[];
769
769
  priority?: string;
770
770
  labels?: string[];
771
- type?: string; // SSoT-EXEMPT:kind≠type — 'type' is hierarchy(epic|task|subtask), 'kind' is intent(work|bug|...) — separate axes T944
771
+ type?: TaskType; // SSoT-EXEMPT:kind≠type — 'type' is hierarchy(saga|epic|task|subtask), 'kind' is intent(work|bug|...) — separate axes T944 // ssot-exempt-ok: pre-existing exempt, narrowed string→TaskType (T10328)
772
772
  acceptance?: string[];
773
773
  phase?: string;
774
774
  size?: string;
@@ -824,7 +824,7 @@ export interface TasksUpdateQueryParams {
824
824
  acceptance?: string[];
825
825
  /** Canonical wire field for parent task ID. @see ADR-057 D2 */
826
826
  parent?: string | null;
827
- type?: string; // SSoT-EXEMPT:kind≠type — 'type' is hierarchy(epic|task|subtask), 'kind' is intent(work|bug|...) — separate axes T944
827
+ type?: TaskType; // SSoT-EXEMPT:kind≠type — 'type' is hierarchy(saga|epic|task|subtask), 'kind' is intent(work|bug|...) — separate axes T944 // ssot-exempt-ok: pre-existing exempt, narrowed string→TaskType (T10328)
828
828
  size?: string;
829
829
  files?: string[];
830
830
  /** Add files incrementally (mirrors --add-labels pattern). @task T9242 */
package/src/task.ts CHANGED
@@ -41,8 +41,19 @@ export type AcceptanceItem = string | AcceptanceGate;
41
41
  /** Task priority levels. */
42
42
  export type TaskPriority = 'critical' | 'high' | 'medium' | 'low';
43
43
 
44
- /** Task type in hierarchy. */
45
- export type TaskType = 'epic' | 'task' | 'subtask';
44
+ /**
45
+ * Task type in hierarchy.
46
+ *
47
+ * Per ADR-083 §2.5, `'saga'` is a first-class tier discriminator above
48
+ * Epic — a Saga groups N Epics across multiple releases. Hierarchy is now
49
+ * Saga (depth 0) → Epic (1) → Task (2) → Subtask (3), with `maxDepth=3`
50
+ * preserved under each Saga member.
51
+ *
52
+ * @adr ADR-083 §2.5
53
+ * @saga T10326
54
+ * @task T10328
55
+ */
56
+ export type TaskType = 'saga' | 'epic' | 'task' | 'subtask';
46
57
 
47
58
  /**
48
59
  * Task kind axis — orthogonal to {@link TaskType}, describes the intent of work.