@cleocode/contracts 2026.5.111 → 2026.5.113

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 (118) hide show
  1. package/dist/__tests__/cli-meta-suggested-next.test.d.ts +21 -0
  2. package/dist/__tests__/cli-meta-suggested-next.test.d.ts.map +1 -0
  3. package/dist/__tests__/cli-meta-suggested-next.test.js +70 -0
  4. package/dist/__tests__/cli-meta-suggested-next.test.js.map +1 -0
  5. package/dist/__tests__/evidence-atom-schema.test.d.ts +16 -0
  6. package/dist/__tests__/evidence-atom-schema.test.d.ts.map +1 -0
  7. package/dist/__tests__/evidence-atom-schema.test.js +394 -0
  8. package/dist/__tests__/evidence-atom-schema.test.js.map +1 -0
  9. package/dist/config/__tests__/manifest.test.d.ts +13 -0
  10. package/dist/config/__tests__/manifest.test.d.ts.map +1 -0
  11. package/dist/config/__tests__/manifest.test.js +143 -0
  12. package/dist/config/__tests__/manifest.test.js.map +1 -0
  13. package/dist/config/manifest.d.ts +158 -0
  14. package/dist/config/manifest.d.ts.map +1 -0
  15. package/dist/config/manifest.js +123 -0
  16. package/dist/config/manifest.js.map +1 -0
  17. package/dist/docs/__tests__/provenance.test.d.ts +14 -0
  18. package/dist/docs/__tests__/provenance.test.d.ts.map +1 -0
  19. package/dist/docs/__tests__/provenance.test.js +579 -0
  20. package/dist/docs/__tests__/provenance.test.js.map +1 -0
  21. package/dist/docs/provenance.d.ts +731 -0
  22. package/dist/docs/provenance.d.ts.map +1 -0
  23. package/dist/docs/provenance.js +258 -0
  24. package/dist/docs/provenance.js.map +1 -0
  25. package/dist/docs-taxonomy.d.ts +24 -0
  26. package/dist/docs-taxonomy.d.ts.map +1 -1
  27. package/dist/docs-taxonomy.js +27 -0
  28. package/dist/docs-taxonomy.js.map +1 -1
  29. package/dist/doctor.d.ts +101 -0
  30. package/dist/doctor.d.ts.map +1 -1
  31. package/dist/errors.d.ts +4 -0
  32. package/dist/errors.d.ts.map +1 -1
  33. package/dist/errors.js +4 -0
  34. package/dist/errors.js.map +1 -1
  35. package/dist/evidence-atom-schema.d.ts +407 -0
  36. package/dist/evidence-atom-schema.d.ts.map +1 -0
  37. package/dist/evidence-atom-schema.js +505 -0
  38. package/dist/evidence-atom-schema.js.map +1 -0
  39. package/dist/exit-codes.d.ts +37 -0
  40. package/dist/exit-codes.d.ts.map +1 -1
  41. package/dist/exit-codes.js +37 -0
  42. package/dist/exit-codes.js.map +1 -1
  43. package/dist/index.d.ts +13 -2
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +8 -1
  46. package/dist/index.js.map +1 -1
  47. package/dist/invariants/__tests__/adr-056-release.test.d.ts +16 -0
  48. package/dist/invariants/__tests__/adr-056-release.test.d.ts.map +1 -0
  49. package/dist/invariants/__tests__/adr-056-release.test.js +88 -0
  50. package/dist/invariants/__tests__/adr-056-release.test.js.map +1 -0
  51. package/dist/invariants/__tests__/adr-070-orchestration.test.d.ts +22 -0
  52. package/dist/invariants/__tests__/adr-070-orchestration.test.d.ts.map +1 -0
  53. package/dist/invariants/__tests__/adr-070-orchestration.test.js +151 -0
  54. package/dist/invariants/__tests__/adr-070-orchestration.test.js.map +1 -0
  55. package/dist/invariants/__tests__/registry.test.d.ts +14 -0
  56. package/dist/invariants/__tests__/registry.test.d.ts.map +1 -0
  57. package/dist/invariants/__tests__/registry.test.js +113 -0
  58. package/dist/invariants/__tests__/registry.test.js.map +1 -0
  59. package/dist/invariants/adr-056-release.d.ts +42 -0
  60. package/dist/invariants/adr-056-release.d.ts.map +1 -0
  61. package/dist/invariants/adr-056-release.js +143 -0
  62. package/dist/invariants/adr-056-release.js.map +1 -0
  63. package/dist/invariants/adr-070-orchestration.d.ts +73 -0
  64. package/dist/invariants/adr-070-orchestration.d.ts.map +1 -0
  65. package/dist/invariants/adr-070-orchestration.js +290 -0
  66. package/dist/invariants/adr-070-orchestration.js.map +1 -0
  67. package/dist/invariants/adr-073-saga.d.ts +32 -0
  68. package/dist/invariants/adr-073-saga.d.ts.map +1 -0
  69. package/dist/invariants/adr-073-saga.js +155 -0
  70. package/dist/invariants/adr-073-saga.js.map +1 -0
  71. package/dist/invariants/index.d.ts +162 -0
  72. package/dist/invariants/index.d.ts.map +1 -0
  73. package/dist/invariants/index.js +118 -0
  74. package/dist/invariants/index.js.map +1 -0
  75. package/dist/operations/__tests__/input-contract.test.d.ts +20 -0
  76. package/dist/operations/__tests__/input-contract.test.d.ts.map +1 -0
  77. package/dist/operations/__tests__/input-contract.test.js +158 -0
  78. package/dist/operations/__tests__/input-contract.test.js.map +1 -0
  79. package/dist/operations/docs.d.ts +16 -0
  80. package/dist/operations/docs.d.ts.map +1 -1
  81. package/dist/operations/input-contract.d.ts +267 -0
  82. package/dist/operations/input-contract.d.ts.map +1 -0
  83. package/dist/operations/input-contract.js +29 -0
  84. package/dist/operations/input-contract.js.map +1 -0
  85. package/dist/templates/__tests__/manifest.test.d.ts +18 -0
  86. package/dist/templates/__tests__/manifest.test.d.ts.map +1 -0
  87. package/dist/templates/__tests__/manifest.test.js +123 -0
  88. package/dist/templates/__tests__/manifest.test.js.map +1 -0
  89. package/dist/templates/manifest.d.ts +186 -0
  90. package/dist/templates/manifest.d.ts.map +1 -0
  91. package/dist/templates/manifest.js +165 -0
  92. package/dist/templates/manifest.js.map +1 -0
  93. package/package.json +2 -2
  94. package/src/__tests__/cli-meta-suggested-next.test.ts +76 -0
  95. package/src/__tests__/evidence-atom-schema.test.ts +499 -0
  96. package/src/config/__tests__/manifest.test.ts +176 -0
  97. package/src/config/manifest.ts +218 -0
  98. package/src/docs/__tests__/__snapshots__/provenance.test.ts.snap +252 -0
  99. package/src/docs/__tests__/provenance.test.ts +648 -0
  100. package/src/docs/provenance.ts +601 -0
  101. package/src/docs-taxonomy.ts +55 -0
  102. package/src/doctor.ts +111 -0
  103. package/src/errors.ts +4 -0
  104. package/src/evidence-atom-schema.ts +628 -0
  105. package/src/exit-codes.ts +39 -0
  106. package/src/index.ts +129 -0
  107. package/src/invariants/__tests__/adr-056-release.test.ts +102 -0
  108. package/src/invariants/__tests__/adr-070-orchestration.test.ts +186 -0
  109. package/src/invariants/__tests__/registry.test.ts +136 -0
  110. package/src/invariants/adr-056-release.ts +154 -0
  111. package/src/invariants/adr-070-orchestration.ts +317 -0
  112. package/src/invariants/adr-073-saga.ts +167 -0
  113. package/src/invariants/index.ts +222 -0
  114. package/src/operations/__tests__/input-contract.test.ts +188 -0
  115. package/src/operations/docs.ts +16 -0
  116. package/src/operations/input-contract.ts +301 -0
  117. package/src/templates/__tests__/manifest.test.ts +140 -0
  118. package/src/templates/manifest.ts +208 -0
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Unit tests for the central invariants registry (T10335).
3
+ *
4
+ * The registry is the SSoT for system-wide invariants surfaced via the
5
+ * SG-SUBSTRATE-RECONCILIATION saga. Downstream R-tasks (R2 ORC codes,
6
+ * R4 CI gate, R5 release refactor, R6 doctor audit, R8 docs renderer)
7
+ * all key off the metadata shape asserted below.
8
+ *
9
+ * @epic T10327 — E-INVARIANT-REGISTRY-SSOT
10
+ * @saga T10326 — SG-SUBSTRATE-RECONCILIATION
11
+ * @task T10335 — R1: registry + ADR-073 I1-I8
12
+ */
13
+ import { describe, expect, it } from 'vitest';
14
+ import { E_SAGA_INVARIANT_VIOLATION_I3, E_SAGA_INVARIANT_VIOLATION_I5, E_SAGA_INVARIANT_VIOLATION_I7, } from '../../errors.js';
15
+ import { ADR_073_INVARIANTS, getInvariant, getInvariantsByAdr, INVARIANTS_REGISTRY, } from '../index.js';
16
+ /**
17
+ * Map from ADR-073 invariant code → expected LAFS error code in
18
+ * `packages/contracts/src/errors.ts`. R2/R4 will extend this mapping with
19
+ * ADR-070 ORC codes once they land — for now the registry only knows
20
+ * about the three saga-runtime guards.
21
+ *
22
+ * NOTE: I4 / I6 / I8 deliberately have no error code today — they are
23
+ * UNENFORCED warnings. The R4 CI gate (T10338) is the right home for the
24
+ * strict "every error has an error code" assertion; this test only
25
+ * validates the subset we already have wired.
26
+ */
27
+ const ADR_073_ERROR_CODE_MAP = {
28
+ I3: E_SAGA_INVARIANT_VIOLATION_I3,
29
+ I5: E_SAGA_INVARIANT_VIOLATION_I5,
30
+ I7: E_SAGA_INVARIANT_VIOLATION_I7,
31
+ };
32
+ describe('INVARIANTS_REGISTRY — central registry shape', () => {
33
+ it('exposes at least 8 entries (ADR-073 I1-I8 baseline)', () => {
34
+ const entries = Object.values(INVARIANTS_REGISTRY);
35
+ expect(entries.length).toBeGreaterThanOrEqual(8);
36
+ });
37
+ it('registers all eight ADR-073 invariants under predictable keys', () => {
38
+ for (let i = 1; i <= 8; i++) {
39
+ const key = `ADR-073.I${i}`;
40
+ expect(INVARIANTS_REGISTRY[key]).toBeDefined();
41
+ expect(INVARIANTS_REGISTRY[key]?.adr).toBe('ADR-073');
42
+ expect(INVARIANTS_REGISTRY[key]?.code).toBe(`I${i}`);
43
+ }
44
+ });
45
+ it('every entry carries a non-empty name and description', () => {
46
+ for (const entry of Object.values(INVARIANTS_REGISTRY)) {
47
+ expect(entry.name.length).toBeGreaterThan(0);
48
+ expect(entry.description.length).toBeGreaterThan(0);
49
+ }
50
+ });
51
+ it('every severity:"error" invariant has a non-null runtimeGate', () => {
52
+ const errorTier = Object.values(INVARIANTS_REGISTRY).filter((e) => e.severity === 'error');
53
+ expect(errorTier.length).toBeGreaterThan(0);
54
+ for (const entry of errorTier) {
55
+ expect(entry.runtimeGate).not.toBeNull();
56
+ // Triple is fully populated when present.
57
+ if (entry.runtimeGate !== null) {
58
+ expect(entry.runtimeGate.module.length).toBeGreaterThan(0);
59
+ expect(entry.runtimeGate.functionName.length).toBeGreaterThan(0);
60
+ }
61
+ }
62
+ });
63
+ });
64
+ describe('getInvariant — lookup helper', () => {
65
+ it('returns the ADR-073.I3 entry with the expected runtime guard', () => {
66
+ const i3 = getInvariant('ADR-073.I3');
67
+ expect(i3).toBeDefined();
68
+ expect(i3?.adr).toBe('ADR-073');
69
+ expect(i3?.code).toBe('I3');
70
+ expect(i3?.severity).toBe('error');
71
+ expect(i3?.runtimeGate?.functionName).toBe('assertSagaInvariantI3');
72
+ expect(i3?.runtimeGate?.module).toBe('packages/core/src/sagas/enforcement.ts');
73
+ });
74
+ it('returns undefined for an unregistered key', () => {
75
+ expect(getInvariant('ADR-999.X1')).toBeUndefined();
76
+ });
77
+ });
78
+ describe('getInvariantsByAdr — per-ADR enumeration', () => {
79
+ it('returns all eight ADR-073 invariants in declaration order', () => {
80
+ const adr073 = getInvariantsByAdr('ADR-073');
81
+ expect(adr073).toHaveLength(8);
82
+ expect(adr073.map((e) => e.code)).toEqual(['I1', 'I2', 'I3', 'I4', 'I5', 'I6', 'I7', 'I8']);
83
+ });
84
+ it('returns an empty array for an unknown ADR', () => {
85
+ expect(getInvariantsByAdr('ADR-DOES-NOT-EXIST')).toEqual([]);
86
+ });
87
+ });
88
+ describe('ADR_073_INVARIANTS — exported convenience binding', () => {
89
+ it('matches the entries surfaced via getInvariantsByAdr', () => {
90
+ expect(ADR_073_INVARIANTS).toHaveLength(8);
91
+ const enumerated = getInvariantsByAdr('ADR-073');
92
+ expect(enumerated).toHaveLength(ADR_073_INVARIANTS.length);
93
+ for (let i = 0; i < ADR_073_INVARIANTS.length; i++) {
94
+ expect(enumerated[i]?.code).toBe(ADR_073_INVARIANTS[i]?.code);
95
+ }
96
+ });
97
+ });
98
+ describe('error-code cross-reference (subset — R4 T10338 owns full strict gate)', () => {
99
+ it('every ADR-073 invariant with a runtimeGate has a known LAFS error code', () => {
100
+ // TODO(T10338 / R4): replace this targeted subset with a strict registry-wide
101
+ // assertion that walks every severity:"error" entry and confirms a matching
102
+ // LAFS error code (E_<ADR>_INVARIANT_VIOLATION_<CODE>) exists in errors.ts.
103
+ const adr073 = getInvariantsByAdr('ADR-073');
104
+ for (const entry of adr073) {
105
+ if (entry.runtimeGate !== null) {
106
+ const expected = ADR_073_ERROR_CODE_MAP[entry.code];
107
+ expect(expected).toBeDefined();
108
+ expect(typeof expected).toBe('string');
109
+ }
110
+ }
111
+ });
112
+ });
113
+ //# sourceMappingURL=registry.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.test.js","sourceRoot":"","sources":["../../../src/invariants/__tests__/registry.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,GAEpB,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;GAUG;AACH,MAAM,sBAAsB,GAA2B;IACrD,EAAE,EAAE,6BAA6B;IACjC,EAAE,EAAE,6BAA6B;IACjC,EAAE,EAAE,6BAA6B;CAClC,CAAC;AAEF,QAAQ,CAAC,8CAA8C,EAAE,GAAG,EAAE;IAC5D,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC7D,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;QACnD,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+DAA+D,EAAE,GAAG,EAAE;QACvE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5B,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,CAAC;YAC5B,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YAC/C,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACtD,MAAM,CAAC,mBAAmB,CAAC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;gBAC/B,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * ADR-056 decisions D1-D6 registered against the central invariants
3
+ * registry (`./index.ts`).
4
+ *
5
+ * The six decisions govern the per-domain SQLite SSoT topology + the
6
+ * release-completion invariant (archiveReason enum + post-release gate).
7
+ *
8
+ * - D1 — Database topology: keep per-domain split (no consolidation).
9
+ * - D2 — Naming convention `<domain>-schema.ts` + `<domain>-sqlite.ts`.
10
+ * - D3 — Migration runner SSoT under `migration-manager.ts`.
11
+ * - D4 — `archiveReason` 6-value enum with tombstone semantics.
12
+ * - D5 — Post-release reconciliation: registry-driven `cleo verify --release`.
13
+ * - D6 — Commit-message lint for release commits.
14
+ *
15
+ * D4 carries a runtime guard (the `assertArchiveReason` function in
16
+ * `@cleocode/contracts` tasks/archive module) and surfaces as the
17
+ * `E_ARCHIVE_REASON_TOMBSTONE` LAFS error code on tombstone-write attempts.
18
+ * D5 carries a registry-driven runtime gate at
19
+ * `packages/core/src/release/invariants/registry.ts` (the per-release
20
+ * executable invariants subsystem this central entry catalogues). D1, D2,
21
+ * D3, D6 are topology / convention / CI-hook decisions — they carry
22
+ * `lintRule` or `runtimeGate:null` markers per the per-decision
23
+ * enforcement surface, matching the ADR-073 pattern for I1, I2, I4, I6, I8.
24
+ *
25
+ * @epic T10327 — E-INVARIANT-REGISTRY-SSOT
26
+ * @saga T10326 — SG-SUBSTRATE-RECONCILIATION
27
+ * @task T10339 — R5: release-registry consumes central substrate
28
+ * @see ADR-056-db-ssot-and-release-completion-invariant.md §Decision
29
+ * @see packages/core/src/release/invariants/registry.ts — D5 executable subsystem
30
+ */
31
+ import type { RegisteredInvariant } from './index.js';
32
+ /**
33
+ * ADR-056 invariants D1-D6 in declaration order.
34
+ *
35
+ * Severity mapping (see `RegisteredInvariant` JSDoc for tier semantics):
36
+ * - D1, D2, D3, D6 → `info` (topology / convention / CI hook concerns).
37
+ * - D4 → `error` (tombstone-write rejection — `E_ARCHIVE_REASON_TOMBSTONE`).
38
+ * - D5 → `warning` (post-release gate produces follow-up tasks rather than
39
+ * throwing — failures are caught + recorded via the audit log).
40
+ */
41
+ export declare const ADR_056_INVARIANTS: readonly RegisteredInvariant[];
42
+ //# sourceMappingURL=adr-056-release.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adr-056-release.d.ts","sourceRoot":"","sources":["../../src/invariants/adr-056-release.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAuBtD;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,mBAAmB,EA0F3D,CAAC"}
@@ -0,0 +1,143 @@
1
+ /**
2
+ * ADR-056 decisions D1-D6 registered against the central invariants
3
+ * registry (`./index.ts`).
4
+ *
5
+ * The six decisions govern the per-domain SQLite SSoT topology + the
6
+ * release-completion invariant (archiveReason enum + post-release gate).
7
+ *
8
+ * - D1 — Database topology: keep per-domain split (no consolidation).
9
+ * - D2 — Naming convention `<domain>-schema.ts` + `<domain>-sqlite.ts`.
10
+ * - D3 — Migration runner SSoT under `migration-manager.ts`.
11
+ * - D4 — `archiveReason` 6-value enum with tombstone semantics.
12
+ * - D5 — Post-release reconciliation: registry-driven `cleo verify --release`.
13
+ * - D6 — Commit-message lint for release commits.
14
+ *
15
+ * D4 carries a runtime guard (the `assertArchiveReason` function in
16
+ * `@cleocode/contracts` tasks/archive module) and surfaces as the
17
+ * `E_ARCHIVE_REASON_TOMBSTONE` LAFS error code on tombstone-write attempts.
18
+ * D5 carries a registry-driven runtime gate at
19
+ * `packages/core/src/release/invariants/registry.ts` (the per-release
20
+ * executable invariants subsystem this central entry catalogues). D1, D2,
21
+ * D3, D6 are topology / convention / CI-hook decisions — they carry
22
+ * `lintRule` or `runtimeGate:null` markers per the per-decision
23
+ * enforcement surface, matching the ADR-073 pattern for I1, I2, I4, I6, I8.
24
+ *
25
+ * @epic T10327 — E-INVARIANT-REGISTRY-SSOT
26
+ * @saga T10326 — SG-SUBSTRATE-RECONCILIATION
27
+ * @task T10339 — R5: release-registry consumes central substrate
28
+ * @see ADR-056-db-ssot-and-release-completion-invariant.md §Decision
29
+ * @see packages/core/src/release/invariants/registry.ts — D5 executable subsystem
30
+ */
31
+ /**
32
+ * Module path that hosts the `assertArchiveReason` runtime guard.
33
+ *
34
+ * Held as a constant so the D4 entry shares one source-of-truth pointer —
35
+ * touching the path once propagates to every guard ref.
36
+ */
37
+ const ARCHIVE_REASON_MODULE = 'packages/contracts/src/tasks/archive.ts';
38
+ /**
39
+ * Module path that hosts the release-invariants registry — the executable
40
+ * subsystem catalogued by D5. The registry exposes `registerInvariant`,
41
+ * `getInvariants`, and `runInvariants`; the archive-reason invariant is its
42
+ * first customer.
43
+ */
44
+ const RELEASE_INVARIANTS_REGISTRY_MODULE = 'packages/core/src/release/invariants/registry.ts';
45
+ /**
46
+ * Repo-rooted path to the release commit-msg lint script (D6 enforcement).
47
+ */
48
+ const RELEASE_COMMIT_MSG_HOOK = 'scripts/hooks/commit-msg-release-lint.mjs';
49
+ /**
50
+ * ADR-056 invariants D1-D6 in declaration order.
51
+ *
52
+ * Severity mapping (see `RegisteredInvariant` JSDoc for tier semantics):
53
+ * - D1, D2, D3, D6 → `info` (topology / convention / CI hook concerns).
54
+ * - D4 → `error` (tombstone-write rejection — `E_ARCHIVE_REASON_TOMBSTONE`).
55
+ * - D5 → `warning` (post-release gate produces follow-up tasks rather than
56
+ * throwing — failures are caught + recorded via the audit log).
57
+ */
58
+ export const ADR_056_INVARIANTS = Object.freeze([
59
+ {
60
+ adr: 'ADR-056',
61
+ code: 'D1',
62
+ name: 'Database topology: keep per-domain split',
63
+ description: 'CLEO retains the six per-domain SQLite databases (tasks, brain, conduit, nexus, signaldock, telemetry) documented in DATABASE-ERDS.md. Consolidation is rejected to preserve per-DB WAL throughput, per-DB rollback granularity, and avoid single-writer contention during multi-agent waves.',
64
+ severity: 'info',
65
+ // D1 is a topology decision; the absence of consolidation is its only
66
+ // enforcement surface. No runtime guard, no lint script.
67
+ runtimeGate: null,
68
+ lintRule: null,
69
+ doctorAudit: null,
70
+ tests: [],
71
+ },
72
+ {
73
+ adr: 'ADR-056',
74
+ code: 'D2',
75
+ name: 'Store-layer naming convention',
76
+ description: 'New always-on store-layer domains MUST use the kebab-case pair `packages/core/src/store/<domain>-schema.ts` (Drizzle defs) + `packages/core/src/store/<domain>-sqlite.ts` (open/init/CRUD). Opt-in / isolated domains MAY use the folder variant `packages/core/src/<domain>/{schema,sqlite}.ts` (currently telemetry only).',
77
+ severity: 'info',
78
+ // D2 is a naming-convention decision; enforced by code review and the
79
+ // ADR-073/ADR-056 doctor audit. No runtime guard.
80
+ runtimeGate: null,
81
+ lintRule: null,
82
+ doctorAudit: null,
83
+ tests: [],
84
+ },
85
+ {
86
+ adr: 'ADR-056',
87
+ code: 'D3',
88
+ name: 'Migration runner SSoT under migration-manager.ts',
89
+ description: 'All six SQLite databases MUST be initialized via `packages/core/src/migration/migration-manager.ts` (`migrateWithRetry()` + `reconcileJournal()`). Per-DB bespoke runners are prohibited for new domains. Rust Diesel migrations for cloud signaldock-storage MUST NOT touch the local SQLite signaldock.db at runtime.',
90
+ severity: 'info',
91
+ // D3 is enforced by the absence of bespoke runners — every domain's
92
+ // `<domain>-sqlite.ts` open path delegates to migration-manager. No
93
+ // single runtime guard; per-DB chokepoints are the enforcement surface.
94
+ runtimeGate: null,
95
+ lintRule: null,
96
+ doctorAudit: null,
97
+ tests: [],
98
+ },
99
+ {
100
+ adr: 'ADR-056',
101
+ code: 'D4',
102
+ name: 'archiveReason 6-value enum with tombstone semantics',
103
+ description: "The tasks.archive_reason column is constrained to exactly six values (verified, reconciled, superseded, shadowed, cancelled, completed-unverified) via SQLite CHECK constraint AND Zod z.enum validation. Writing 'completed-unverified' from non-migration code MUST throw E_ARCHIVE_REASON_TOMBSTONE — the tombstone is reserved for the T1408 backfill migration only.",
104
+ severity: 'error',
105
+ runtimeGate: {
106
+ module: ARCHIVE_REASON_MODULE,
107
+ functionName: 'assertArchiveReason',
108
+ },
109
+ lintRule: null,
110
+ doctorAudit: null,
111
+ tests: ['packages/contracts/src/tasks/__tests__/archive.test.ts'],
112
+ },
113
+ {
114
+ adr: 'ADR-056',
115
+ code: 'D5',
116
+ name: 'Post-release reconciliation: registry-driven cleo verify --release',
117
+ description: 'Post-release reconciliation flows through the executable invariants registry at packages/core/src/release/invariants/registry.ts. Customers register via registerInvariant() and the CLI runs every entry on `cleo verify --release <tag>`. First customer: archive-reason-invariant.ts (stamps verified tasks done; creates follow-up tasks for unverified references).',
118
+ severity: 'warning',
119
+ runtimeGate: {
120
+ module: RELEASE_INVARIANTS_REGISTRY_MODULE,
121
+ functionName: 'runInvariants',
122
+ },
123
+ lintRule: null,
124
+ doctorAudit: null,
125
+ tests: ['packages/core/src/release/invariants/__tests__/archive-reason-invariant.test.ts'],
126
+ },
127
+ {
128
+ adr: 'ADR-056',
129
+ code: 'D6',
130
+ name: 'Commit-message lint for release commits',
131
+ description: 'Every commit whose subject matches `^(chore|feat)\\(release\\):` MUST contain at least one `T\\d+` task reference in the commit body. Enforced by scripts/hooks/commit-msg-release-lint.mjs (T1410). Bypass via CLEO_OWNER_OVERRIDE=1 with audited justification.',
132
+ severity: 'info',
133
+ // D6 is a CI-hook concern. The hook itself is the enforcement surface
134
+ // — represented here via lintRule for cross-reference rendering.
135
+ runtimeGate: null,
136
+ lintRule: {
137
+ lintScript: RELEASE_COMMIT_MSG_HOOK,
138
+ },
139
+ doctorAudit: null,
140
+ tests: [],
141
+ },
142
+ ]);
143
+ //# sourceMappingURL=adr-056-release.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adr-056-release.js","sourceRoot":"","sources":["../../src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,EAAE,OAAO;QACjB,WAAW,EAAE;YACX,MAAM,EAAE,qBAAqB;YAC7B,YAAY,EAAE,qBAAqB;SACpC;QACD,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,IAAI;QACjB,KAAK,EAAE,CAAC,wDAAwD,CAAC;KAClE;IACD;QACE,GAAG,EAAE,SAAS;QACd,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,oEAAoE;QAC1E,WAAW,EACT,0WAA0W;QAC5W,QAAQ,EAAE,SAAS;QACnB,WAAW,EAAE;YACX,MAAM,EAAE,kCAAkC;YAC1C,YAAY,EAAE,eAAe;SAC9B;QACD,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,IAAI;QACjB,KAAK,EAAE,CAAC,iFAAiF,CAAC;KAC3F;IACD;QACE,GAAG,EAAE,SAAS;QACd,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,yCAAyC;QAC/C,WAAW,EACT,mQAAmQ;QACrQ,QAAQ,EAAE,MAAM;QAChB,sEAAsE;QACtE,iEAAiE;QACjE,WAAW,EAAE,IAAI;QACjB,QAAQ,EAAE;YACR,UAAU,EAAE,uBAAuB;SACpC;QACD,WAAW,EAAE,IAAI;QACjB,KAAK,EAAE,EAAE;KACV;CACF,CAAC,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * ADR-070 ORC-### orchestration invariants registered against the central
3
+ * invariants registry (`./index.ts`).
4
+ *
5
+ * ORC codes govern the three-tier spawn topology — Orchestrator (HITL
6
+ * interface) → Lead (phase coordinator) → Worker (leaf task) — defined by
7
+ * ADR-070 and refined by ADR-083 §2 (Cleo persona + recursion bounds).
8
+ *
9
+ * Severity mapping (see `RegisteredInvariant` JSDoc for tier semantics):
10
+ *
11
+ * - **ORC-012** (thin-agent inversion-of-control) is the only ORC rule with
12
+ * a hard-enforced runtime gate today (`enforceThinAgent` +
13
+ * `ThinAgentViolationError`). It surfaces as
14
+ * `E_THIN_AGENT_VIOLATION` (LAFS error code + exit 68). Tier: `error`.
15
+ * - **ORC-001..ORC-009** are the skill-injection rules shipped through
16
+ * `ct-orchestrator/SKILL.md`. They constrain the Orchestrator's runtime
17
+ * behaviour (no code writes, dependency-ordered spawning, 10 K context
18
+ * budget, etc.) but live as prompt-time invariants rather than dispatch
19
+ * guards. Tier: `warning`, `runtimeGate: null` — the gap is documented
20
+ * explicitly so the R6 doctor audit (T10340) can surface it.
21
+ * - **ORC-010** (Lead-interposition: a Worker spawn for an Epic-child Task
22
+ * requires a preceding Lead spawn) and **ORC-011** (Orchestrator-depth
23
+ * ≤ 3) are filed against ADR-083 §2.4 + §6 but the dispatch-time gate
24
+ * has not yet shipped (tracked T10278 + T10279). They are registered
25
+ * here as `warning` with `runtimeGate: null` so the gap surfaces in the
26
+ * audit pipeline.
27
+ * - **ORC-013** (worktree provisioning per ADR-055 / D009) IS enforced at
28
+ * `createWorktree` time via `assertCanonicalWorktreeLocation` — it
29
+ * carries `severity: 'error'` and a runtime gate. The companion CI gate
30
+ * `lint-worktree-location.mjs` is recorded under `lintRule`.
31
+ * - **ORC-014** (Lead-bypass detection at session end) IS enforced by
32
+ * `endSession` via `LeadBypassDetectedError`. Tier: `error`.
33
+ *
34
+ * @epic T10327 — E-INVARIANT-REGISTRY-SSOT
35
+ * @saga T10326 — SG-SUBSTRATE-RECONCILIATION
36
+ * @task T10336 — R2 (ADR-070 ORC codes)
37
+ * @see ADR-070-three-tier-orchestration.md
38
+ * @see ADR-083-section-2.4 — Cleo persona + recursion bounds
39
+ */
40
+ import type { RegisteredInvariant } from './index.js';
41
+ /**
42
+ * ADR-070 ORC-### invariants in declaration order.
43
+ *
44
+ * The 14 entries cover:
45
+ * - ORC-001..ORC-009 — ct-orchestrator skill behavioural constraints.
46
+ * - ORC-010..ORC-011 — ADR-083 §2.4 recursion-bound gaps (filed,
47
+ * runtime gate unimplemented — tracked T10278 / T10279).
48
+ * - ORC-012 — thin-agent inversion-of-control (hard-enforced).
49
+ * - ORC-013 — worktree provisioning per ADR-055 / D009 (hard-enforced).
50
+ * - ORC-014 — Lead-bypass detection at session end (hard-enforced).
51
+ *
52
+ * Every `severity: 'warning'` entry with `runtimeGate: null` carries an
53
+ * explicit description of WHY the gate is absent, satisfying the gap-
54
+ * documentation invariant asserted in the unit test below.
55
+ */
56
+ export declare const ADR_070_INVARIANTS: readonly RegisteredInvariant[];
57
+ /** Sentinel referenced by the unit test — keep in sync with array length. */
58
+ export declare const ADR_070_INVARIANT_COUNT: number;
59
+ /** Sentinel — minimum entries the central registry must merge from this file. */
60
+ export declare const ADR_070_MIN_ENTRIES = 14;
61
+ /**
62
+ * Export the prompt-only module reference so other ADR-070 ORC modules can
63
+ * cross-reference the canonical skill location without restating the path.
64
+ * @internal
65
+ */
66
+ export declare const ADR_070_PROMPT_SOURCE = "packages/skills/skills/ct-orchestrator/SKILL.md";
67
+ /**
68
+ * Re-export for symmetry with the spawn-prompt builder consumers — used by
69
+ * the R8 docs renderer to chase the prompt-injection source for ORC-006.
70
+ * @internal
71
+ */
72
+ export declare const ADR_070_SPAWN_PROMPT_MODULE = "packages/core/src/orchestration/spawn-prompt.ts";
73
+ //# sourceMappingURL=adr-070-orchestration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adr-070-orchestration.d.ts","sourceRoot":"","sources":["../../src/invariants/adr-070-orchestration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AA2CtD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,mBAAmB,EAsM3D,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,QAA4B,CAAC;AAEjE,iFAAiF;AACjF,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,oDAAwB,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,oDAAsB,CAAC"}