@isaacriehm/cairn-core 0.4.3 → 0.6.0

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 (186) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/align-undo/index.d.ts +6 -0
  3. package/dist/align-undo/index.js +6 -0
  4. package/dist/align-undo/index.js.map +1 -0
  5. package/dist/align-undo/log.d.ts +53 -0
  6. package/dist/align-undo/log.js +162 -0
  7. package/dist/align-undo/log.js.map +1 -0
  8. package/dist/align-undo/undo.d.ts +65 -0
  9. package/dist/align-undo/undo.js +397 -0
  10. package/dist/align-undo/undo.js.map +1 -0
  11. package/dist/attention/bulk-accept.js +9 -22
  12. package/dist/attention/bulk-accept.js.map +1 -1
  13. package/dist/attention/dedup.js +1 -47
  14. package/dist/attention/dedup.js.map +1 -1
  15. package/dist/attention/serve/api.js +3 -17
  16. package/dist/attention/serve/api.js.map +1 -1
  17. package/dist/attention/serve/index.js +3 -3
  18. package/dist/attention/serve/index.js.map +1 -1
  19. package/dist/drain/drain.d.ts +77 -0
  20. package/dist/drain/drain.js +464 -0
  21. package/dist/drain/drain.js.map +1 -0
  22. package/dist/drain/index.d.ts +5 -0
  23. package/dist/drain/index.js +5 -0
  24. package/dist/drain/index.js.map +1 -0
  25. package/dist/fix-align/index.d.ts +7 -0
  26. package/dist/fix-align/index.js +6 -0
  27. package/dist/fix-align/index.js.map +1 -0
  28. package/dist/fix-align/run.d.ts +99 -0
  29. package/dist/fix-align/run.js +258 -0
  30. package/dist/fix-align/run.js.map +1 -0
  31. package/dist/fix-align/sentinel.d.ts +59 -0
  32. package/dist/fix-align/sentinel.js +149 -0
  33. package/dist/fix-align/sentinel.js.map +1 -0
  34. package/dist/fs.d.ts +5 -0
  35. package/dist/fs.js +11 -0
  36. package/dist/fs.js.map +1 -0
  37. package/dist/gc/apply.js +4 -4
  38. package/dist/gc/apply.js.map +1 -1
  39. package/dist/ground/alignment-pending.d.ts +28 -0
  40. package/dist/ground/alignment-pending.js +83 -0
  41. package/dist/ground/alignment-pending.js.map +1 -0
  42. package/dist/ground/anchor-map.d.ts +14 -0
  43. package/dist/ground/anchor-map.js +56 -0
  44. package/dist/ground/anchor-map.js.map +1 -0
  45. package/dist/ground/frontmatter.d.ts +12 -0
  46. package/dist/ground/frontmatter.js +28 -0
  47. package/dist/ground/frontmatter.js.map +1 -1
  48. package/dist/ground/index.d.ts +10 -3
  49. package/dist/ground/index.js +9 -3
  50. package/dist/ground/index.js.map +1 -1
  51. package/dist/ground/paths.d.ts +21 -0
  52. package/dist/ground/paths.js +43 -0
  53. package/dist/ground/paths.js.map +1 -1
  54. package/dist/ground/schemas.d.ts +201 -0
  55. package/dist/ground/schemas.js +135 -10
  56. package/dist/ground/schemas.js.map +1 -1
  57. package/dist/ground/scope-index.js +4 -4
  58. package/dist/ground/scope-index.js.map +1 -1
  59. package/dist/ground/slug.d.ts +60 -0
  60. package/dist/ground/slug.js +103 -0
  61. package/dist/ground/slug.js.map +1 -0
  62. package/dist/ground/sot-bindings.d.ts +14 -0
  63. package/dist/ground/sot-bindings.js +79 -0
  64. package/dist/ground/sot-bindings.js.map +1 -0
  65. package/dist/ground/sot-cache.d.ts +18 -0
  66. package/dist/ground/sot-cache.js +62 -0
  67. package/dist/ground/sot-cache.js.map +1 -0
  68. package/dist/ground/topic-index.d.ts +27 -0
  69. package/dist/ground/topic-index.js +82 -0
  70. package/dist/ground/topic-index.js.map +1 -0
  71. package/dist/hooks/post-tool-use/index.d.ts +2 -0
  72. package/dist/hooks/post-tool-use/index.js +1 -0
  73. package/dist/hooks/post-tool-use/index.js.map +1 -1
  74. package/dist/hooks/post-tool-use/sot-align.d.ts +166 -0
  75. package/dist/hooks/post-tool-use/sot-align.js +1306 -0
  76. package/dist/hooks/post-tool-use/sot-align.js.map +1 -0
  77. package/dist/hooks/pre-commit/index.d.ts +8 -0
  78. package/dist/hooks/pre-commit/index.js +8 -0
  79. package/dist/hooks/pre-commit/index.js.map +1 -0
  80. package/dist/hooks/pre-commit/sot-align-precommit.d.ts +60 -0
  81. package/dist/hooks/pre-commit/sot-align-precommit.js +221 -0
  82. package/dist/hooks/pre-commit/sot-align-precommit.js.map +1 -0
  83. package/dist/hooks/runners/session-start.js +41 -0
  84. package/dist/hooks/runners/session-start.js.map +1 -1
  85. package/dist/hooks/sot-align-common.d.ts +39 -0
  86. package/dist/hooks/sot-align-common.js +152 -0
  87. package/dist/hooks/sot-align-common.js.map +1 -0
  88. package/dist/index.d.ts +5 -0
  89. package/dist/index.js +5 -0
  90. package/dist/index.js.map +1 -1
  91. package/dist/init/index.d.ts +4 -2
  92. package/dist/init/index.js +2 -1
  93. package/dist/init/index.js.map +1 -1
  94. package/dist/init/ingest-docs.d.ts +30 -47
  95. package/dist/init/ingest-docs.js +113 -410
  96. package/dist/init/ingest-docs.js.map +1 -1
  97. package/dist/init/init.d.ts +8 -0
  98. package/dist/init/init.js +58 -29
  99. package/dist/init/init.js.map +1 -1
  100. package/dist/init/mapper.js +6 -6
  101. package/dist/init/mapper.js.map +1 -1
  102. package/dist/init/phases/5-brand.js +1 -1
  103. package/dist/init/phases/5-brand.js.map +1 -1
  104. package/dist/init/phases/5b-topic-index.d.ts +30 -0
  105. package/dist/init/phases/5b-topic-index.js +62 -0
  106. package/dist/init/phases/5b-topic-index.js.map +1 -0
  107. package/dist/init/phases/6-docs-ingest.d.ts +4 -5
  108. package/dist/init/phases/6-docs-ingest.js +5 -6
  109. package/dist/init/phases/6-docs-ingest.js.map +1 -1
  110. package/dist/init/phases/index.d.ts +2 -0
  111. package/dist/init/phases/index.js +1 -0
  112. package/dist/init/phases/index.js.map +1 -1
  113. package/dist/init/phases/parallel-678.d.ts +14 -17
  114. package/dist/init/phases/parallel-678.js +77 -98
  115. package/dist/init/phases/parallel-678.js.map +1 -1
  116. package/dist/init/phases/source-comments-output-io.d.ts +16 -10
  117. package/dist/init/phases/source-comments-output-io.js +7 -10
  118. package/dist/init/phases/source-comments-output-io.js.map +1 -1
  119. package/dist/init/phases/types.d.ts +1 -1
  120. package/dist/init/phases/types.js +1 -0
  121. package/dist/init/phases/types.js.map +1 -1
  122. package/dist/init/rules-merge/discover.d.ts +8 -3
  123. package/dist/init/rules-merge/discover.js +7 -3
  124. package/dist/init/rules-merge/discover.js.map +1 -1
  125. package/dist/init/rules-merge/ingest.d.ts +81 -28
  126. package/dist/init/rules-merge/ingest.js +456 -162
  127. package/dist/init/rules-merge/ingest.js.map +1 -1
  128. package/dist/init/sot-emit.d.ts +84 -0
  129. package/dist/init/sot-emit.js +214 -0
  130. package/dist/init/sot-emit.js.map +1 -0
  131. package/dist/init/source-comments/classify.d.ts +12 -10
  132. package/dist/init/source-comments/classify.js +13 -25
  133. package/dist/init/source-comments/classify.js.map +1 -1
  134. package/dist/init/source-comments/index.d.ts +1 -1
  135. package/dist/init/source-comments/index.js +1 -1
  136. package/dist/init/source-comments/index.js.map +1 -1
  137. package/dist/init/source-comments/ingest.d.ts +91 -67
  138. package/dist/init/source-comments/ingest.js +392 -361
  139. package/dist/init/source-comments/ingest.js.map +1 -1
  140. package/dist/init/topic-index/index.d.ts +36 -0
  141. package/dist/init/topic-index/index.js +46 -0
  142. package/dist/init/topic-index/index.js.map +1 -0
  143. package/dist/init/topic-index/judge.d.ts +20 -0
  144. package/dist/init/topic-index/judge.js +65 -0
  145. package/dist/init/topic-index/judge.js.map +1 -0
  146. package/dist/init/topic-index/resolve.d.ts +50 -0
  147. package/dist/init/topic-index/resolve.js +196 -0
  148. package/dist/init/topic-index/resolve.js.map +1 -0
  149. package/dist/init/topic-index/walk.d.ts +43 -0
  150. package/dist/init/topic-index/walk.js +293 -0
  151. package/dist/init/topic-index/walk.js.map +1 -0
  152. package/dist/mcp/schemas.d.ts +45 -8
  153. package/dist/mcp/schemas.js +43 -7
  154. package/dist/mcp/schemas.js.map +1 -1
  155. package/dist/mcp/tools/align-drain.d.ts +7 -0
  156. package/dist/mcp/tools/align-drain.js +26 -0
  157. package/dist/mcp/tools/align-drain.js.map +1 -0
  158. package/dist/mcp/tools/index.d.ts +1 -1
  159. package/dist/mcp/tools/index.js +3 -0
  160. package/dist/mcp/tools/index.js.map +1 -1
  161. package/dist/mcp/tools/init-phases.js +4 -1
  162. package/dist/mcp/tools/init-phases.js.map +1 -1
  163. package/dist/mcp/tools/record-decision.js +5 -2
  164. package/dist/mcp/tools/record-decision.js.map +1 -1
  165. package/dist/mcp/tools/resolve-attention.d.ts +2 -2
  166. package/dist/mcp/tools/resolve-attention.js +781 -5
  167. package/dist/mcp/tools/resolve-attention.js.map +1 -1
  168. package/dist/status-line/event-queue.d.ts +40 -0
  169. package/dist/status-line/event-queue.js +195 -0
  170. package/dist/status-line/event-queue.js.map +1 -0
  171. package/dist/status-line/format.d.ts +1 -1
  172. package/dist/status-line/format.js +49 -6
  173. package/dist/status-line/format.js.map +1 -1
  174. package/dist/status-line/index.d.ts +41 -0
  175. package/dist/status-line/index.js +14 -0
  176. package/dist/status-line/index.js.map +1 -1
  177. package/dist/status-line/reader.js +23 -18
  178. package/dist/status-line/reader.js.map +1 -1
  179. package/dist/status-line/writer.d.ts +1 -1
  180. package/dist/status-line/writer.js +5 -0
  181. package/dist/status-line/writer.js.map +1 -1
  182. package/dist/text/jaccard.d.ts +19 -0
  183. package/dist/text/jaccard.js +68 -0
  184. package/dist/text/jaccard.js.map +1 -0
  185. package/package.json +1 -1
  186. package/templates/.cairn/git-hooks/pre-commit +16 -3
@@ -1,24 +1,21 @@
1
1
  /**
2
- * Phases 6 / 7b / 7c parallel orchestrator.
2
+ * Phases 6 / 7b / 7c sequential orchestrator.
3
3
  *
4
4
  * The three post-pilot ingestion phases (docs-ingest, source-comments,
5
- * rules-merge) are each I/O-bound on Haiku; running them sequentially
6
- * adds the smaller two phases' wall-clock to the long 7b run for no
7
- * good reason. This runner fires all three concurrently inside a single
8
- * MCP call.
5
+ * rules-merge) all read + write the same v0.5.0 ground-state files —
6
+ * `topic-index.yaml`, `anchor-map.yaml`, `sot-bindings.yaml`,
7
+ * `sot-cache.yaml`. Concurrent execution races on those writes: each
8
+ * phase reads at start, mutates in memory, writes at end → last writer
9
+ * wipes the others. The v0.4.x parallel orchestrator was safe because
10
+ * only DEC/INV files (uniquely named per id) were on the write path.
9
11
  *
10
- * Concurrency-safety:
11
- * - DEC + INV id allocators race-free via shared `Set<string>` threads
12
- * (each phase's allocation loop is sync within JS turn boundaries,
13
- * so mutations to the shared Set are atomic per turn). The pre-scan
14
- * happens once, here; phases mutate the Set as they allocate.
15
- * - Filesystem mutations are non-overlapping by design: phase 6 writes
16
- * to `decisions/_inbox/`, phase 7b writes to `decisions/_inbox/` +
17
- * `invariants/` + applies strip-replace to source, phase 7c writes
18
- * to `decisions/_inbox/`. Different filenames per phase (DEC ids
19
- * are unique across the shared Set), so no race.
20
- * - Ledger rebuilds: only 7b rebuilds the invariants ledger; the
21
- * decisions ledger is rebuilt later by `bulkAcceptObvious`. Safe.
12
+ * v0.5.0 fix: run the phases sequentially in canonical order
13
+ * (6 7b 7c). Each phase still uses Haiku internally (with its own
14
+ * concurrency for batching + per-section workers), so the wall-clock
15
+ * cost vs. the v0.4.x parallel pipeline is bounded by the longest
16
+ * phase plus the smaller two historically <5s combined for the
17
+ * smaller phases. Heartbeats fire per phase so the operator sees
18
+ * motion across all three.
22
19
  *
23
20
  * State machine:
24
21
  * - The runner enters expecting `currentPhase === "6-docs-ingest"` and
@@ -1,24 +1,21 @@
1
1
  /**
2
- * Phases 6 / 7b / 7c parallel orchestrator.
2
+ * Phases 6 / 7b / 7c sequential orchestrator.
3
3
  *
4
4
  * The three post-pilot ingestion phases (docs-ingest, source-comments,
5
- * rules-merge) are each I/O-bound on Haiku; running them sequentially
6
- * adds the smaller two phases' wall-clock to the long 7b run for no
7
- * good reason. This runner fires all three concurrently inside a single
8
- * MCP call.
5
+ * rules-merge) all read + write the same v0.5.0 ground-state files —
6
+ * `topic-index.yaml`, `anchor-map.yaml`, `sot-bindings.yaml`,
7
+ * `sot-cache.yaml`. Concurrent execution races on those writes: each
8
+ * phase reads at start, mutates in memory, writes at end → last writer
9
+ * wipes the others. The v0.4.x parallel orchestrator was safe because
10
+ * only DEC/INV files (uniquely named per id) were on the write path.
9
11
  *
10
- * Concurrency-safety:
11
- * - DEC + INV id allocators race-free via shared `Set<string>` threads
12
- * (each phase's allocation loop is sync within JS turn boundaries,
13
- * so mutations to the shared Set are atomic per turn). The pre-scan
14
- * happens once, here; phases mutate the Set as they allocate.
15
- * - Filesystem mutations are non-overlapping by design: phase 6 writes
16
- * to `decisions/_inbox/`, phase 7b writes to `decisions/_inbox/` +
17
- * `invariants/` + applies strip-replace to source, phase 7c writes
18
- * to `decisions/_inbox/`. Different filenames per phase (DEC ids
19
- * are unique across the shared Set), so no race.
20
- * - Ledger rebuilds: only 7b rebuilds the invariants ledger; the
21
- * decisions ledger is rebuilt later by `bulkAcceptObvious`. Safe.
12
+ * v0.5.0 fix: run the phases sequentially in canonical order
13
+ * (6 7b 7c). Each phase still uses Haiku internally (with its own
14
+ * concurrency for batching + per-section workers), so the wall-clock
15
+ * cost vs. the v0.4.x parallel pipeline is bounded by the longest
16
+ * phase plus the smaller two historically <5s combined for the
17
+ * smaller phases. Heartbeats fire per phase so the operator sees
18
+ * motion across all three.
22
19
  *
23
20
  * State machine:
24
21
  * - The runner enters expecting `currentPhase === "6-docs-ingest"` and
@@ -70,94 +67,62 @@ export async function runPhases678Parallel(state) {
70
67
  preScannedDecIds: sharedDecIds.size,
71
68
  preScannedInvIds: sharedInvIds.size,
72
69
  }, "parallel-678 starting");
73
- // Fire all three phases. Each phase's loop is synchronous between
74
- // await points, so shared-Set mutations stay atomic per JS turn.
75
- // The 7b heartbeat dominates statusline output (it runs longest), but
76
- // 6 and 7c also write progress so the operator sees motion across
77
- // all three.
70
+ // Run the three phases sequentially. v0.5.0 ground-state files
71
+ // (topic-index, anchor-map, sot-bindings, sot-cache) are the shared
72
+ // mutable surface; serializing 6 7b 7c removes the last-writer-
73
+ // wins race that Promise.allSettled had under v0.4.x.
78
74
  const t0 = performance.now();
79
75
  const startedAt = Date.now();
80
- const settled = await Promise.allSettled([
81
- runDocsIngestion({
82
- repoRoot: state.repoRoot,
83
- existingDecIds: sharedDecIds,
84
- onGroupProgress: (row) => writeProgress(state.repoRoot, {
85
- phase: "6-docs-ingest",
86
- batch: row.total > 0 ? row.total : 1,
87
- total: row.total,
88
- startedAt,
89
- }),
76
+ const docsRes = await runPhaseSafely("docs-ingest-failed", async () => runDocsIngestion({
77
+ repoRoot: state.repoRoot,
78
+ existingDecIds: sharedDecIds,
79
+ onEntryProgress: (row) => writeProgress(state.repoRoot, {
80
+ phase: "6-docs-ingest",
81
+ batch: row.total > 0 ? row.total : 1,
82
+ total: row.total,
83
+ startedAt,
90
84
  }),
91
- runSourceCommentsIngestion({
92
- repoRoot: state.repoRoot,
93
- globs,
94
- ...(pilotModule !== undefined ? { pilotModule } : {}),
95
- existingDecIds: sharedDecIds,
96
- existingInvIds: sharedInvIds,
97
- onBatchProgress: (row) => writeProgress(state.repoRoot, {
98
- phase: "7b-source-comments",
99
- batch: row.index + 1,
100
- total: row.total,
101
- classified: row.classified,
102
- failed: row.failed,
103
- startedAt,
104
- }),
85
+ }));
86
+ if ("error" in docsRes) {
87
+ clearProgress(state.repoRoot);
88
+ return { status: "error", error: docsRes.error, state };
89
+ }
90
+ const srcRes = await runPhaseSafely("source-comments-failed", async () => runSourceCommentsIngestion({
91
+ repoRoot: state.repoRoot,
92
+ globs,
93
+ ...(pilotModule !== undefined ? { pilotModule } : {}),
94
+ existingDecIds: sharedDecIds,
95
+ existingInvIds: sharedInvIds,
96
+ onBatchProgress: (row) => writeProgress(state.repoRoot, {
97
+ phase: "7b-source-comments",
98
+ batch: row.index + 1,
99
+ total: row.total,
100
+ classified: row.classified,
101
+ failed: row.failed,
102
+ startedAt,
105
103
  }),
106
- runRulesMerge({
107
- repoRoot: state.repoRoot,
108
- existingDecIds: sharedDecIds,
109
- onSectionProgress: (row) => writeProgress(state.repoRoot, {
110
- phase: "7c-rules-merge",
111
- batch: row.index,
112
- total: row.total,
113
- startedAt,
114
- }),
104
+ }));
105
+ if ("error" in srcRes) {
106
+ clearProgress(state.repoRoot);
107
+ return { status: "error", error: srcRes.error, state };
108
+ }
109
+ const rulesRes = await runPhaseSafely("rules-merge-failed", async () => runRulesMerge({
110
+ repoRoot: state.repoRoot,
111
+ existingDecIds: sharedDecIds,
112
+ existingInvIds: sharedInvIds,
113
+ onSectionProgress: (row) => writeProgress(state.repoRoot, {
114
+ phase: "7c-rules-merge",
115
+ batch: row.index,
116
+ total: row.total,
117
+ startedAt,
115
118
  }),
116
- ]);
119
+ }));
120
+ if ("error" in rulesRes) {
121
+ clearProgress(state.repoRoot);
122
+ return { status: "error", error: rulesRes.error, state };
123
+ }
117
124
  const durationMs = Math.round(performance.now() - t0);
118
125
  clearProgress(state.repoRoot);
119
- const [docsRes, srcRes, rulesRes] = settled;
120
- // Any phase failure = whole-block failure. Surface the first error so
121
- // the operator knows which Haiku batch died and can `/exit` + resume.
122
- if (docsRes.status !== "fulfilled") {
123
- return {
124
- status: "error",
125
- error: {
126
- code: "docs-ingest-failed",
127
- message: "Docs ingestion failed in parallel pipeline",
128
- detail: docsRes.reason instanceof Error
129
- ? docsRes.reason.stack ?? docsRes.reason.message
130
- : String(docsRes.reason),
131
- },
132
- state,
133
- };
134
- }
135
- if (srcRes.status !== "fulfilled") {
136
- return {
137
- status: "error",
138
- error: {
139
- code: "source-comments-failed",
140
- message: "Source-comment ingestion failed in parallel pipeline",
141
- detail: srcRes.reason instanceof Error
142
- ? srcRes.reason.stack ?? srcRes.reason.message
143
- : String(srcRes.reason),
144
- },
145
- state,
146
- };
147
- }
148
- if (rulesRes.status !== "fulfilled") {
149
- return {
150
- status: "error",
151
- error: {
152
- code: "rules-merge-failed",
153
- message: "Rules merge failed in parallel pipeline",
154
- detail: rulesRes.reason instanceof Error
155
- ? rulesRes.reason.stack ?? rulesRes.reason.message
156
- : String(rulesRes.reason),
157
- },
158
- state,
159
- };
160
- }
161
126
  writeSourceCommentsWalkFile(state.repoRoot, srcRes.value);
162
127
  const persistedSrc = to7bResultPersisted(srcRes.value);
163
128
  const outputs = {
@@ -202,4 +167,18 @@ export async function runPhases678Parallel(state) {
202
167
  state: next,
203
168
  };
204
169
  }
170
+ async function runPhaseSafely(code, fn) {
171
+ try {
172
+ return { value: await fn() };
173
+ }
174
+ catch (err) {
175
+ const detail = err instanceof Error ? err.stack ?? err.message : String(err);
176
+ const message = code === "docs-ingest-failed"
177
+ ? "Docs ingestion failed"
178
+ : code === "source-comments-failed"
179
+ ? "Source-comment ingestion failed"
180
+ : "Rules merge failed";
181
+ return { error: { code, message, detail } };
182
+ }
183
+ }
205
184
  //# sourceMappingURL=parallel-678.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"parallel-678.js","sourceRoot":"","sources":["../../../src/init/phases/parallel-678.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAA4B,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAGzE,OAAO,EACL,mBAAmB,EACnB,2BAA2B,GAE5B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,MAAM,GAAG,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAQ/C,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,KAAiB;IAEjB,kEAAkE;IAClE,mEAAmE;IACnE,+DAA+D;IAC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AAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IAC/B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,MAAM,GACV,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChE,MAAM,OAAO,GACX,IAAI,KAAK,oBAAoB;YAC3B,CAAC,CAAC,uBAAuB;YACzB,CAAC,CAAC,IAAI,KAAK,wBAAwB;gBACjC,CAAC,CAAC,iCAAiC;gBACnC,CAAC,CAAC,oBAAoB,CAAC;QAC7B,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;IAC9C,CAAC;AACH,CAAC"}
@@ -48,26 +48,32 @@ export interface IngestSourceCommentsResultPersisted {
48
48
  filesAvailable: number;
49
49
  truncatedAtFileCap: boolean;
50
50
  };
51
- decDraftsWritten: {
51
+ decsWritten: {
52
52
  id: string;
53
53
  path: string;
54
54
  sourceFile: string;
55
+ slug: string;
56
+ status: "accepted";
55
57
  }[];
56
- invariantsWritten: {
58
+ invsWritten: {
57
59
  id: string;
58
60
  path: string;
59
61
  sourceFile: string;
62
+ slug: string;
63
+ status: "accepted";
60
64
  }[];
61
- invariantStripFilesModified: number;
62
- invariantStripItemsApplied: number;
63
- invariantStripItemsSkipped: number;
64
- invariantStripError: string | null;
65
- invariantProposalsAdded: number;
66
- canonicalCitationsAdded: number;
65
+ citesEmitted: {
66
+ id: string;
67
+ sourceFile: string;
68
+ lineRange: [number, number];
69
+ slug: string;
70
+ }[];
71
+ stripFilesModified: number;
72
+ stripItemsApplied: number;
73
+ stripItemsSkipped: number;
74
+ stripError: string | null;
67
75
  auditPath: string;
68
76
  auditRelPath: string;
69
- invariantProposalsPath: string | null;
70
- canonicalCitationsPath: string | null;
71
77
  inputTokens: number;
72
78
  outputTokens: number;
73
79
  batchesRun: number;
@@ -62,18 +62,15 @@ export function to7bResultPersisted(full) {
62
62
  filesAvailable: full.walk.filesAvailable,
63
63
  truncatedAtFileCap: full.walk.truncatedAtFileCap,
64
64
  },
65
- decDraftsWritten: full.decDraftsWritten,
66
- invariantsWritten: full.invariantsWritten,
67
- invariantStripFilesModified: full.invariantStripFilesModified,
68
- invariantStripItemsApplied: full.invariantStripItemsApplied,
69
- invariantStripItemsSkipped: full.invariantStripItemsSkipped,
70
- invariantStripError: full.invariantStripError,
71
- invariantProposalsAdded: full.invariantProposalsAdded,
72
- canonicalCitationsAdded: full.canonicalCitationsAdded,
65
+ decsWritten: full.decsWritten,
66
+ invsWritten: full.invsWritten,
67
+ citesEmitted: full.citesEmitted,
68
+ stripFilesModified: full.stripFilesModified,
69
+ stripItemsApplied: full.stripItemsApplied,
70
+ stripItemsSkipped: full.stripItemsSkipped,
71
+ stripError: full.stripError,
73
72
  auditPath: full.auditPath,
74
73
  auditRelPath: full.auditRelPath,
75
- invariantProposalsPath: full.invariantProposalsPath,
76
- canonicalCitationsPath: full.canonicalCitationsPath,
77
74
  inputTokens: full.inputTokens,
78
75
  outputTokens: full.outputTokens,
79
76
  batchesRun: full.batchesRun,
@@ -1 +1 @@
1
- {"version":3,"file":"source-comments-output-io.js","sourceRoot":"","sources":["../../../src/init/phases/source-comments-output-io.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAI1C,qCAAqC;AACrC,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAC3C,QAAQ,EACR,MAAM,EACN,2BAA2B,CAC5B,CAAC;AAEF,MAAM,UAAU,yBAAyB,CAAC,QAAgB;IACxD,OAAO,IAAI,CAAC,QAAQ,EAAE,yBAAyB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kBAAkB,EAAE,IAAI,CAAC,IAAI,CAAC,kBAAkB;SACjD;QACD,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;QACvC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,2BAA2B,EAAE,IAAI,CAAC,2BAA2B;QAC7D,0BAA0B,EAAE,IAAI,CAAC,0BAA0B;QAC3D,0BAA0B,EAAE,IAAI,CAAC,0BAA0B;QAC3D,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;QAC7C,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;QACrD,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;QACrD,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;QACnD,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;QACnD,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"source-comments-output-io.js","sourceRoot":"","sources":["../../../src/init/phases/source-comments-output-io.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAI1C,qCAAqC;AACrC,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAC3C,QAAQ,EACR,MAAM,EACN,2BAA2B,CAC5B,CAAC;AAEF,MAAM,UAAU,yBAAyB,CAAC,QAAgB;IACxD,OAAO,IAAI,CAAC,QAAQ,EAAE,yBAAyB,CAAC,CAAC;AACnD,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,CAAC,IAAI,CAAC,kBAAkB;SACjD;QACD,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;QAC3C,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC;AACJ,CAAC"}
@@ -13,7 +13,7 @@
13
13
  * and pick up at the same phase on the next session.
14
14
  */
15
15
  /** Phase ids in execution order. */
16
- export declare const PHASE_IDS: readonly ["1-detect", "2-walker", "3-mapper", "3b-seed", "4-pilot", "5-brand", "6-docs-ingest", "7b-source-comments", "7c-rules-merge", "8-baseline", "10-strip", "12-multidev"];
16
+ export declare const PHASE_IDS: readonly ["1-detect", "2-walker", "3-mapper", "3b-seed", "4-pilot", "5-brand", "5b-topic-index", "6-docs-ingest", "7b-source-comments", "7c-rules-merge", "8-baseline", "10-strip", "12-multidev"];
17
17
  export type PhaseId = (typeof PHASE_IDS)[number];
18
18
  /** Inline A/B/C question rendered via AskUserQuestion in the skill. */
19
19
  export interface PhaseQuestion {
@@ -20,6 +20,7 @@ export const PHASE_IDS = [
20
20
  "3b-seed",
21
21
  "4-pilot",
22
22
  "5-brand",
23
+ "5b-topic-index",
23
24
  "6-docs-ingest",
24
25
  "7b-source-comments",
25
26
  "7c-rules-merge",
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/init/phases/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,oCAAoC;AACpC,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,UAAU;IACV,UAAU;IACV,UAAU;IACV,SAAS;IACT,SAAS;IACT,SAAS;IACT,eAAe;IACf,oBAAoB;IACpB,gBAAgB;IAChB,YAAY;IACZ,UAAU;IACV,aAAa;CACL,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/init/phases/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,oCAAoC;AACpC,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,UAAU;IACV,UAAU;IACV,UAAU;IACV,SAAS;IACT,SAAS;IACT,SAAS;IACT,gBAAgB;IAChB,eAAe;IACf,oBAAoB;IACpB,gBAAgB;IAChB,YAAY;IACZ,UAAU;IACV,aAAa;CACL,CAAC"}
@@ -1,12 +1,17 @@
1
1
  /**
2
2
  * Phase 7c discovery — find existing project-rules sources.
3
3
  *
4
- * Per spec §6 Phase 7c, the four sources cairn reconciles are:
4
+ * Plan §5.4 ownership set (v0.5.0):
5
5
  * - <repoRoot>/CLAUDE.md
6
6
  * - <repoRoot>/AGENTS.md
7
- * - <repoRoot>/.claude/CLAUDE.md
8
7
  * - <repoRoot>/.claude/rules/**.md
9
8
  *
9
+ * `.claude/CLAUDE.md` was previously discovered here too (kind
10
+ * `claude-md-claude-dir`). The phase 5b walker treats every reachable
11
+ * `.md` outside the rule-owned set as `kind="doc"` — so phase 6 already
12
+ * owns `.claude/CLAUDE.md`. Re-discovering it here would race with phase
13
+ * 6's emit and double-bind the slug.
14
+ *
10
15
  * Returns absolute + repo-relative paths that exist. Caller drives the rest.
11
16
  */
12
17
  export interface RuleSourceFile {
@@ -14,7 +19,7 @@ export interface RuleSourceFile {
14
19
  path: string;
15
20
  absPath: string;
16
21
  /** Logical kind drives the regeneration template choice. */
17
- kind: "claude-md-root" | "agents-md-root" | "claude-md-claude-dir" | "rule";
22
+ kind: "claude-md-root" | "agents-md-root" | "rule";
18
23
  /** File size (for largest-first ordering when batched). */
19
24
  size: number;
20
25
  }
@@ -1,12 +1,17 @@
1
1
  /**
2
2
  * Phase 7c discovery — find existing project-rules sources.
3
3
  *
4
- * Per spec §6 Phase 7c, the four sources cairn reconciles are:
4
+ * Plan §5.4 ownership set (v0.5.0):
5
5
  * - <repoRoot>/CLAUDE.md
6
6
  * - <repoRoot>/AGENTS.md
7
- * - <repoRoot>/.claude/CLAUDE.md
8
7
  * - <repoRoot>/.claude/rules/**.md
9
8
  *
9
+ * `.claude/CLAUDE.md` was previously discovered here too (kind
10
+ * `claude-md-claude-dir`). The phase 5b walker treats every reachable
11
+ * `.md` outside the rule-owned set as `kind="doc"` — so phase 6 already
12
+ * owns `.claude/CLAUDE.md`. Re-discovering it here would race with phase
13
+ * 6's emit and double-bind the slug.
14
+ *
10
15
  * Returns absolute + repo-relative paths that exist. Caller drives the rest.
11
16
  */
12
17
  import { existsSync, readdirSync, statSync } from "node:fs";
@@ -30,7 +35,6 @@ export function discoverRuleSources(repoRoot) {
30
35
  };
31
36
  tryFile("CLAUDE.md", "claude-md-root");
32
37
  tryFile("AGENTS.md", "agents-md-root");
33
- tryFile(join(".claude", "CLAUDE.md"), "claude-md-claude-dir");
34
38
  const rulesDir = join(repoRoot, ".claude", "rules");
35
39
  if (existsSync(rulesDir)) {
36
40
  walkRules(rulesDir, repoRoot, out);
@@ -1 +1 @@
1
- {"version":3,"file":"discover.js","sourceRoot":"","sources":["../../../src/init/rules-merge/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAY3C,MAAM,UAAU,mBAAmB,CAAC,QAAgB;IAClD,MAAM,GAAG,GAA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AAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;YACpB,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;YAC9B,SAAS;QACX,CAAC;QACD,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE;YAAE,SAAS;QAC1B,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,SAAS;QACpD,IAAI,EAAE,CAAC;QACP,IAAI,CAAC;YACH,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QACD,GAAG,CAAC,IAAI,CAAC;YACP,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YACtC,OAAO,EAAE,GAAG;YACZ,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,EAAE,CAAC,IAAI;SACd,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,SAAS,OAAO,CAAC,CAAS;IACxB,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC/B,CAAC"}
@@ -1,33 +1,49 @@
1
1
  /**
2
- * Phase 7c orchestrator discover + parse + Haiku classify + persist.
2
+ * Phase 7c orchestrator (v0.5.0 SoT model).
3
3
  *
4
- * Ingests CLAUDE.md, AGENTS.md, .claude/CLAUDE.md, and `.claude/rules/**.md`
5
- * during init. Each H2/H3 section is classified by Haiku as:
4
+ * Plan §5.4 algorithm:
5
+ * 1. Discover sections in `CLAUDE.md`, `AGENTS.md`, `.claude/rules/*.md`.
6
+ * 2. Topic-index lookup (built by phase 5b) before classification:
7
+ * - **Match** — slug already owns a docs/CLAUDE.md/AGENTS.md/rule
8
+ * SoT and was emitted by an earlier phase. Phase 7c records the
9
+ * cite (no source rewrite — operator's narrative stays intact)
10
+ * and skips emit.
11
+ * - **Net-new** — slug is in topic-index but not yet emitted.
12
+ * Phase 7c classifies the section via Haiku (kind only:
13
+ * decision / domain-rule / constraint / informational), emits
14
+ * a verbatim DEC/INV via `sot-emit` with `sot_kind: "path"` +
15
+ * `sot_path: <file>#<anchor>`, auto-promotes (`status: accepted`).
16
+ * 3. Conflict detection — for each freshly emitted entity, scan
17
+ * accepted DECs/INVs in `sot-cache.yaml` for high Jaccard overlap
18
+ * against the new body, then run a Haiku contradiction judge per
19
+ * candidate (`contradict | agree | unrelated`). On `contradict`,
20
+ * write `.cairn/ground/conflicts/<new>__<other>.md` with both
21
+ * prose sides + Haiku reasoning. The cairn-attention skill renders
22
+ * these per §5.4.1; **no source rewrite ever fires from conflicts**.
23
+ * 4. Auto-promote — every novel entity ships `status: accepted`. The
24
+ * `_inbox/` draft queue is gone (the v0.4.x review surface was the
25
+ * v0.5.0 pivot's primary motivation).
6
26
  *
7
- * - "rule-net-new" — section states a rule cairn doesn't have yet (DEC draft to inbox)
8
- * - "rule-conflict" section conflicts with existing cairn state (soft-conflict to attention)
9
- * - "informational" TOC, history, walkthrough — no action
10
- * - "operator-keep" already inside keep-marker block (skipped pre-classification)
11
- *
12
- * Net-new rules become DEC drafts in `.cairn/ground/decisions/_inbox/`.
13
- * Soft conflicts append to `.cairn/baseline/rule-conflicts-<ISO>.yaml`.
14
- *
15
- * Resilient: a single Haiku failure marks the section "informational" and
16
- * continues. All output paths captured in the result so the skill can surface
17
- * them.
27
+ * Output side-effects (all relative to repoRoot):
28
+ * - `.cairn/ground/decisions/<DEC-id>.md` (one per novel decision/domain-rule)
29
+ * - `.cairn/ground/invariants/<INV-id>.md` (one per novel constraint)
30
+ * - `.cairn/ground/topic-index.yaml` (extended w/ dec_id stamps)
31
+ * - `.cairn/ground/sot-bindings.yaml` (forward+reverse for new ids)
32
+ * - `.cairn/ground/sot-cache.yaml` (token cache for Layer A)
33
+ * - `.cairn/ground/conflicts/<a>__<b>.md` (one per contradiction)
34
+ * - `.cairn/baseline/rules-merge-<ISO>.yaml` (full audit)
18
35
  */
19
36
  import type { RuleSourceFile } from "./discover.js";
20
37
  import type { RuleSection } from "./parse-sections.js";
21
- export type RuleClassKind = "rule-net-new" | "rule-conflict" | "informational" | "operator-keep";
38
+ export type RuleClassKind = "decision" | "domain-rule" | "constraint" | "informational" | "operator-keep";
22
39
  export interface RuleClassification {
23
40
  source: string;
24
- level: 2 | 3 | 0;
41
+ level: 0 | 2 | 3;
25
42
  title: string;
26
43
  startOffset: number;
44
+ /** Content-fingerprint slug of the section body (heading excluded). */
45
+ slug: string;
27
46
  kind: RuleClassKind;
28
- proposedDecTitle: string;
29
- proposedRationale: string;
30
- conflictsWith: string;
31
47
  failed: boolean;
32
48
  errorMessage?: string;
33
49
  }
@@ -35,14 +51,28 @@ export interface RunRulesMergeArgs {
35
51
  repoRoot: string;
36
52
  /** When set, every section is classified by this fn — bypasses Haiku. */
37
53
  mockClassify?: (section: RuleSection, source: RuleSourceFile) => RuleClassification;
54
+ /**
55
+ * Mock contradiction judge for smokes. Receives both prose bodies +
56
+ * candidate id, returns one of `contradict | agree | unrelated`.
57
+ * Default off → no Haiku contradiction calls in mock-classify mode.
58
+ */
59
+ mockContradictionJudge?: (args: {
60
+ newBody: string;
61
+ candidateId: string;
62
+ candidateBody: string;
63
+ }) => Promise<"contradict" | "agree" | "unrelated">;
38
64
  dryRun?: boolean;
39
65
  nowIso?: string;
40
66
  /**
41
67
  * Caller-supplied DEC id Set. Same role as in `runDocsIngestion`: when
42
- * the parallel orchestrator runs phases 6 / 7b / 7c concurrently, all
43
- * three share one Set so DEC id allocations don't collide.
68
+ * the parallel orchestrator runs phases 6 / 7b / 7c sequentially, all
69
+ * three share one Set so DEC id allocations don't collide. Content-
70
+ * addressed ids make collisions vanishingly unlikely so the Set is
71
+ * informational.
44
72
  */
45
73
  existingDecIds?: Set<string>;
74
+ /** Caller-supplied INV id Set. Same compat note. */
75
+ existingInvIds?: Set<string>;
46
76
  /**
47
77
  * Optional progress callback fired after each section finishes
48
78
  * classification. Enables the cairn-adopt statusline heartbeat.
@@ -52,19 +82,42 @@ export interface RunRulesMergeArgs {
52
82
  total: number;
53
83
  }) => void;
54
84
  }
85
+ interface RuleEmittedRecord {
86
+ id: string;
87
+ path: string;
88
+ sourceFile: string;
89
+ slug: string;
90
+ status: "accepted";
91
+ }
92
+ interface RuleCiteRecord {
93
+ /** DEC/INV id the section was bound to (already emitted by phase 6 / 7b). */
94
+ id: string;
95
+ /** Section's source file. */
96
+ sourceFile: string;
97
+ /** Slug that resolved the topic-index lookup. */
98
+ slug: string;
99
+ }
100
+ interface RuleConflictRecord {
101
+ /** Newly emitted entity id (DEC or INV from this phase 7c run). */
102
+ newId: string;
103
+ /** Pre-existing accepted entity id the new prose contradicts. */
104
+ otherId: string;
105
+ /** Repo-relative path to the conflict file. */
106
+ conflictPath: string;
107
+ /** Haiku judge's verdict reasoning excerpt. */
108
+ reasoning: string;
109
+ }
55
110
  export interface RunRulesMergeResult {
56
111
  sources: RuleSourceFile[];
57
112
  sectionsTotal: number;
58
113
  classifications: RuleClassification[];
59
- decDraftsWritten: {
60
- id: string;
61
- path: string;
62
- sourceFile: string;
63
- }[];
64
- conflictsRecorded: number;
65
- conflictsPath: string | null;
114
+ decsWritten: RuleEmittedRecord[];
115
+ invsWritten: RuleEmittedRecord[];
116
+ citesEmitted: RuleCiteRecord[];
117
+ conflicts: RuleConflictRecord[];
66
118
  auditPath: string;
67
119
  auditRelPath: string;
68
120
  kindCounts: Record<RuleClassKind, number>;
69
121
  }
70
122
  export declare function runRulesMerge(args: RunRulesMergeArgs): Promise<RunRulesMergeResult>;
123
+ export {};