@isaacriehm/cairn-core 0.7.3 → 0.9.1

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 (229) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/attention/bulk-accept.d.ts +0 -2
  3. package/dist/attention/bulk-accept.js +0 -3
  4. package/dist/attention/bulk-accept.js.map +1 -1
  5. package/dist/attention/scoring.d.ts +1 -3
  6. package/dist/attention/scoring.js +1 -12
  7. package/dist/attention/scoring.js.map +1 -1
  8. package/dist/claude/cache.js +1 -0
  9. package/dist/claude/cache.js.map +1 -1
  10. package/dist/claude/runner.js +25 -1
  11. package/dist/claude/runner.js.map +1 -1
  12. package/dist/claude/types.d.ts +8 -0
  13. package/dist/doctor/index.js +57 -0
  14. package/dist/doctor/index.js.map +1 -1
  15. package/dist/gc/citation-integrity.js +3 -1
  16. package/dist/gc/citation-integrity.js.map +1 -1
  17. package/dist/gc/doc-claims.d.ts +31 -0
  18. package/dist/gc/doc-claims.js +213 -0
  19. package/dist/gc/doc-claims.js.map +1 -0
  20. package/dist/gc/doc-source-drift.d.ts +31 -0
  21. package/dist/gc/doc-source-drift.js +190 -0
  22. package/dist/gc/doc-source-drift.js.map +1 -0
  23. package/dist/gc/index.d.ts +4 -0
  24. package/dist/gc/index.js +2 -0
  25. package/dist/gc/index.js.map +1 -1
  26. package/dist/gc/sweep.js +18 -0
  27. package/dist/gc/sweep.js.map +1 -1
  28. package/dist/gc/types.d.ts +2 -2
  29. package/dist/hooks/runners/context-threshold.d.ts +63 -0
  30. package/dist/hooks/runners/context-threshold.js +179 -0
  31. package/dist/hooks/runners/context-threshold.js.map +1 -0
  32. package/dist/hooks/runners/gc-autotrigger.d.ts +49 -0
  33. package/dist/hooks/runners/gc-autotrigger.js +87 -0
  34. package/dist/hooks/runners/gc-autotrigger.js.map +1 -0
  35. package/dist/hooks/runners/index.d.ts +2 -0
  36. package/dist/hooks/runners/index.js +1 -0
  37. package/dist/hooks/runners/index.js.map +1 -1
  38. package/dist/hooks/runners/payload.d.ts +10 -0
  39. package/dist/hooks/runners/payload.js +13 -0
  40. package/dist/hooks/runners/payload.js.map +1 -1
  41. package/dist/hooks/runners/session-end.js +2 -4
  42. package/dist/hooks/runners/session-end.js.map +1 -1
  43. package/dist/hooks/runners/session-start.js +157 -9
  44. package/dist/hooks/runners/session-start.js.map +1 -1
  45. package/dist/hooks/runners/stop.js +119 -0
  46. package/dist/hooks/runners/stop.js.map +1 -1
  47. package/dist/init/brand-derive.js +6 -1
  48. package/dist/init/brand-derive.js.map +1 -1
  49. package/dist/init/brand-setup.d.ts +12 -1
  50. package/dist/init/brand-setup.js +36 -1
  51. package/dist/init/brand-setup.js.map +1 -1
  52. package/dist/init/curator/corpus.d.ts +92 -0
  53. package/dist/init/curator/corpus.js +171 -0
  54. package/dist/init/curator/corpus.js.map +1 -0
  55. package/dist/init/curator/emit.d.ts +42 -0
  56. package/dist/init/curator/emit.js +230 -0
  57. package/dist/init/curator/emit.js.map +1 -0
  58. package/dist/init/curator/index.d.ts +1 -0
  59. package/dist/init/curator/index.js +2 -0
  60. package/dist/init/curator/index.js.map +1 -0
  61. package/dist/init/curator/regex-prefilter.d.ts +54 -0
  62. package/dist/init/curator/regex-prefilter.js +185 -0
  63. package/dist/init/curator/regex-prefilter.js.map +1 -0
  64. package/dist/init/curator/validate.d.ts +46 -0
  65. package/dist/init/curator/validate.js +100 -0
  66. package/dist/init/curator/validate.js.map +1 -0
  67. package/dist/init/curator/walker.d.ts +36 -0
  68. package/dist/init/curator/walker.js +380 -0
  69. package/dist/init/curator/walker.js.map +1 -0
  70. package/dist/init/eta-calibration.d.ts +39 -0
  71. package/dist/init/eta-calibration.js +143 -0
  72. package/dist/init/eta-calibration.js.map +1 -0
  73. package/dist/init/index.d.ts +8 -3
  74. package/dist/init/index.js +4 -1
  75. package/dist/init/index.js.map +1 -1
  76. package/dist/init/ingest-docs.d.ts +6 -1
  77. package/dist/init/ingest-docs.js.map +1 -1
  78. package/dist/init/init.js +15 -26
  79. package/dist/init/init.js.map +1 -1
  80. package/dist/init/mapper-merge.d.ts +4 -6
  81. package/dist/init/mapper-merge.js +11 -34
  82. package/dist/init/mapper-merge.js.map +1 -1
  83. package/dist/init/mapper-parallel.d.ts +0 -1
  84. package/dist/init/mapper-parallel.js +20 -12
  85. package/dist/init/mapper-parallel.js.map +1 -1
  86. package/dist/init/mapper-prompts.d.ts +1 -4
  87. package/dist/init/mapper-prompts.js +2 -6
  88. package/dist/init/mapper-prompts.js.map +1 -1
  89. package/dist/init/mapper.d.ts +8 -7
  90. package/dist/init/mapper.js +23 -15
  91. package/dist/init/mapper.js.map +1 -1
  92. package/dist/init/overlay.js +0 -1
  93. package/dist/init/overlay.js.map +1 -1
  94. package/dist/init/phases/1-detect.d.ts +17 -4
  95. package/dist/init/phases/1-detect.js +48 -4
  96. package/dist/init/phases/1-detect.js.map +1 -1
  97. package/dist/init/phases/10-rules-merge.d.ts +7 -2
  98. package/dist/init/phases/10-rules-merge.js +17 -32
  99. package/dist/init/phases/10-rules-merge.js.map +1 -1
  100. package/dist/init/phases/11-baseline.js.map +1 -1
  101. package/dist/init/phases/12-strip.js +14 -1
  102. package/dist/init/phases/12-strip.js.map +1 -1
  103. package/dist/init/phases/13-multidev.d.ts +5 -1
  104. package/dist/init/phases/13-multidev.js +23 -2
  105. package/dist/init/phases/13-multidev.js.map +1 -1
  106. package/dist/init/phases/3-mapper.js.map +1 -1
  107. package/dist/init/phases/4-seed.js +2 -3
  108. package/dist/init/phases/4-seed.js.map +1 -1
  109. package/dist/init/phases/5-preflight.d.ts +42 -0
  110. package/dist/init/phases/5-preflight.js +244 -0
  111. package/dist/init/phases/5-preflight.js.map +1 -0
  112. package/dist/init/phases/6-brand.js +2 -4
  113. package/dist/init/phases/6-brand.js.map +1 -1
  114. package/dist/init/phases/7-topic-index.d.ts +6 -0
  115. package/dist/init/phases/7-topic-index.js +13 -0
  116. package/dist/init/phases/7-topic-index.js.map +1 -1
  117. package/dist/init/phases/8-docs-ingest.d.ts +6 -5
  118. package/dist/init/phases/8-docs-ingest.js +16 -43
  119. package/dist/init/phases/8-docs-ingest.js.map +1 -1
  120. package/dist/init/phases/9a-walker.d.ts +15 -0
  121. package/dist/init/phases/9a-walker.js +63 -0
  122. package/dist/init/phases/9a-walker.js.map +1 -0
  123. package/dist/init/phases/9b-curate.d.ts +19 -0
  124. package/dist/init/phases/9b-curate.js +79 -0
  125. package/dist/init/phases/9b-curate.js.map +1 -0
  126. package/dist/init/phases/9c-emit.d.ts +13 -0
  127. package/dist/init/phases/9c-emit.js +57 -0
  128. package/dist/init/phases/9c-emit.js.map +1 -0
  129. package/dist/init/phases/index.d.ts +6 -5
  130. package/dist/init/phases/index.js +4 -4
  131. package/dist/init/phases/index.js.map +1 -1
  132. package/dist/init/phases/mapper-output-io.d.ts +5 -5
  133. package/dist/init/phases/mapper-output-io.js +5 -5
  134. package/dist/init/phases/orchestrator.d.ts +10 -0
  135. package/dist/init/phases/orchestrator.js +13 -1
  136. package/dist/init/phases/orchestrator.js.map +1 -1
  137. package/dist/init/phases/state-io.js +1 -1
  138. package/dist/init/phases/types.d.ts +115 -9
  139. package/dist/init/phases/types.js +4 -2
  140. package/dist/init/phases/types.js.map +1 -1
  141. package/dist/init/post-git-init.d.ts +53 -0
  142. package/dist/init/post-git-init.js +74 -0
  143. package/dist/init/post-git-init.js.map +1 -0
  144. package/dist/init/preflight-guards.d.ts +11 -2
  145. package/dist/init/preflight-guards.js +27 -5
  146. package/dist/init/preflight-guards.js.map +1 -1
  147. package/dist/init/rules-merge/index.d.ts +1 -1
  148. package/dist/init/rules-merge/ingest.d.ts +6 -1
  149. package/dist/init/rules-merge/ingest.js.map +1 -1
  150. package/dist/init/skill-budget.d.ts +39 -0
  151. package/dist/init/skill-budget.js +99 -0
  152. package/dist/init/skill-budget.js.map +1 -0
  153. package/dist/init/source-comments/ingest.d.ts +0 -2
  154. package/dist/init/source-comments/ingest.js.map +1 -1
  155. package/dist/init/source-comments/walker.js +2 -2
  156. package/dist/init/topic-index/index.d.ts +8 -0
  157. package/dist/init/topic-index/index.js +10 -2
  158. package/dist/init/topic-index/index.js.map +1 -1
  159. package/dist/init/topic-index/judge.d.ts +15 -0
  160. package/dist/init/topic-index/judge.js +15 -1
  161. package/dist/init/topic-index/judge.js.map +1 -1
  162. package/dist/init/topic-index/resolve.js +41 -14
  163. package/dist/init/topic-index/resolve.js.map +1 -1
  164. package/dist/init/types.d.ts +9 -0
  165. package/dist/init/walker.d.ts +1 -1
  166. package/dist/init/walker.js +1 -1
  167. package/dist/init/workflow-block.d.ts +5 -6
  168. package/dist/init/workflow-block.js +5 -9
  169. package/dist/init/workflow-block.js.map +1 -1
  170. package/dist/mcp/bootstrap-guard.js +2 -2
  171. package/dist/mcp/bootstrap-guard.js.map +1 -1
  172. package/dist/mcp/schemas.d.ts +34 -0
  173. package/dist/mcp/schemas.js +50 -0
  174. package/dist/mcp/schemas.js.map +1 -1
  175. package/dist/mcp/telemetry.d.ts +1 -1
  176. package/dist/mcp/tools/bootstrap-retry.d.ts +23 -0
  177. package/dist/mcp/tools/bootstrap-retry.js +53 -0
  178. package/dist/mcp/tools/bootstrap-retry.js.map +1 -0
  179. package/dist/mcp/tools/bulk-accept-attention.d.ts +1 -1
  180. package/dist/mcp/tools/bulk-accept-attention.js +4 -6
  181. package/dist/mcp/tools/bulk-accept-attention.js.map +1 -1
  182. package/dist/mcp/tools/index.js +10 -0
  183. package/dist/mcp/tools/index.js.map +1 -1
  184. package/dist/mcp/tools/init-phases.d.ts +7 -6
  185. package/dist/mcp/tools/init-phases.js +36 -65
  186. package/dist/mcp/tools/init-phases.js.map +1 -1
  187. package/dist/mcp/tools/resume.d.ts +21 -0
  188. package/dist/mcp/tools/resume.js +88 -0
  189. package/dist/mcp/tools/resume.js.map +1 -0
  190. package/dist/mcp/tools/task-complete.d.ts +23 -0
  191. package/dist/mcp/tools/task-complete.js +51 -0
  192. package/dist/mcp/tools/task-complete.js.map +1 -0
  193. package/dist/mcp/tools/task-create.js +17 -11
  194. package/dist/mcp/tools/task-create.js.map +1 -1
  195. package/dist/mcp/tools/task-journal-append.d.ts +22 -0
  196. package/dist/mcp/tools/task-journal-append.js +44 -0
  197. package/dist/mcp/tools/task-journal-append.js.map +1 -0
  198. package/dist/paths/index.js +1 -1
  199. package/dist/paths/index.js.map +1 -1
  200. package/dist/status-line/format.js +20 -0
  201. package/dist/status-line/format.js.map +1 -1
  202. package/dist/tasks/index.d.ts +2 -0
  203. package/dist/tasks/index.js +2 -0
  204. package/dist/tasks/index.js.map +1 -0
  205. package/dist/tasks/lifecycle.d.ts +107 -0
  206. package/dist/tasks/lifecycle.js +302 -0
  207. package/dist/tasks/lifecycle.js.map +1 -0
  208. package/dist/trace/index.d.ts +1 -1
  209. package/dist/trace/index.js +2 -2
  210. package/dist/trace/index.js.map +1 -1
  211. package/package.json +2 -2
  212. package/templates/.cairn/config/trust-policy.yaml +0 -3
  213. package/templates/.cairn/config/workflow.md +0 -1
  214. package/templates/.cairn/ground/canonical-map/topics.yaml +0 -12
  215. package/dist/init/phases/5-pilot.d.ts +0 -10
  216. package/dist/init/phases/5-pilot.js +0 -108
  217. package/dist/init/phases/5-pilot.js.map +0 -1
  218. package/dist/init/phases/9-source-comments.d.ts +0 -6
  219. package/dist/init/phases/9-source-comments.js +0 -55
  220. package/dist/init/phases/9-source-comments.js.map +0 -1
  221. package/dist/init/phases/parallel-8910.d.ts +0 -27
  222. package/dist/init/phases/parallel-8910.js +0 -172
  223. package/dist/init/phases/parallel-8910.js.map +0 -1
  224. package/dist/init/phases/source-comments-output-io.d.ts +0 -84
  225. package/dist/init/phases/source-comments-output-io.js +0 -81
  226. package/dist/init/phases/source-comments-output-io.js.map +0 -1
  227. package/templates/.cairn/ground/capabilities/mcp-tools.yaml +0 -29
  228. package/templates/.cairn/ground/capabilities/skills.yaml +0 -25
  229. package/templates/.cairn/ground/capabilities/snippets.yaml +0 -29
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Every cairn surface (Claude Code hooks, MCP tools, `claude --print`
5
5
  * subprocess calls, init phases) appends a single jsonl row per event
6
- * to `~/.local/cairn/trace/trace-<YYYY-MM-DD>.jsonl`. The `cairn trace`
6
+ * to `~/.cairn/trace/trace-<YYYY-MM-DD>.jsonl`. The `cairn trace`
7
7
  * CLI subcommand reads them back time-sorted across the most recent
8
8
  * day(s) so the operator can post-mortem an entire live session in one
9
9
  * pane.
@@ -15,7 +15,7 @@ import { appendFileSync, existsSync, mkdirSync } from "node:fs";
15
15
  import { homedir } from "node:os";
16
16
  import { join } from "node:path";
17
17
  export function traceDir() {
18
- return join(homedir(), ".local", "cairn", "trace");
18
+ return join(homedir(), ".cairn", "trace");
19
19
  }
20
20
  function todayFilename(now) {
21
21
  const y = now.getUTCFullYear();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/trace/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAuBjC,MAAM,UAAU,QAAQ;IACtB,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,aAAa,CAAC,GAAS;IAC9B,MAAM,CAAC,GAAG,GAAG,CAAC,cAAc,EAAE,CAAC;IAC/B,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACzD,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC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EAAE,CAAC;IAC/B,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACzD,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACpD,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAY,IAAI,IAAI,EAAE;IAClD,OAAO,IAAI,CAAC,QAAQ,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,KAAiB;IAC3C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,QAAQ,EAAE,CAAC;QACvB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1D,cAAc,CAAC,aAAa,EAAE,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxE,CAAC;IAAC,MAAM,CAAC;QACP,cAAc;IAChB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,IAA4B;IACnD,OAAO,EAAE,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC;AACnD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isaacriehm/cairn-core",
3
- "version": "0.7.3",
3
+ "version": "0.9.1",
4
4
  "description": "Cairn core — state + context layer. Curated `.cairn/ground/` (decisions, §INV invariants, canonical-map, brand, quality-grades), MCP server, init wizard, hook runners, sensors, GC drift sweep.",
5
5
  "author": "Isaac Riehm",
6
6
  "license": "MIT",
@@ -39,7 +39,7 @@
39
39
  "simple-git": "^3.36.0",
40
40
  "yaml": "^2.8.4",
41
41
  "zod": "^4.4.3",
42
- "@isaacriehm/cairn-state": "0.7.3"
42
+ "@isaacriehm/cairn-state": "0.9.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/cli-progress": "^3.11.6",
@@ -49,9 +49,6 @@ commands:
49
49
  - id: disable_sensor
50
50
  posture: configuration
51
51
  surface: workflow_yaml_edit
52
- - id: change_pilot_module
53
- posture: configuration
54
- surface: workflow_yaml_edit
55
52
  - id: change_off_limits
56
53
  posture: configuration
57
54
  surface: workflow_yaml_edit
@@ -19,7 +19,6 @@ source-commits:
19
19
  # ──────────────────────────────────────────────────────────────────────────────
20
20
 
21
21
  <project_name>:
22
- pilot_module: ALL # full repo, OR a glob like core/src/integrations/**
23
22
  off_limits:
24
23
  - .git/**
25
24
  - .archive/**
@@ -17,15 +17,3 @@ topics:
17
17
  - topic: claude-md
18
18
  canonical_path: CLAUDE.md
19
19
  audience: dual
20
- - topic: cairn-architecture
21
- canonical_path: docs/ARCHITECTURE.md
22
- audience: dual
23
- - topic: cairn-mcp-surface
24
- canonical_path: docs/MCP_SURFACE.md
25
- audience: dual
26
- - topic: cairn-filesystem-layout
27
- canonical_path: docs/FILESYSTEM_LAYOUT.md
28
- audience: dual
29
- - topic: cairn-plugin-architecture
30
- canonical_path: docs/PLUGIN_ARCHITECTURE.md
31
- audience: dual
@@ -1,10 +0,0 @@
1
- /**
2
- * Phase 5-pilot — operator picks the seed module.
3
- *
4
- * The mapper's `pilot_module` field is the model's first guess; this
5
- * phase surfaces it alongside the next 2 strongest `key_modules` so
6
- * the operator can override. Picking the pilot determines which
7
- * module's globs flow into `.cairn/config.yaml.project_globs` first.
8
- */
9
- import type { PhaseResult, PhaseState } from "./types.js";
10
- export declare function runPhase5Pilot(state: PhaseState): Promise<PhaseResult>;
@@ -1,108 +0,0 @@
1
- /**
2
- * Phase 5-pilot — operator picks the seed module.
3
- *
4
- * The mapper's `pilot_module` field is the model's first guess; this
5
- * phase surfaces it alongside the next 2 strongest `key_modules` so
6
- * the operator can override. Picking the pilot determines which
7
- * module's globs flow into `.cairn/config.yaml.project_globs` first.
8
- */
9
- import { advancePhase } from "./orchestrator.js";
10
- const MAX_OPTIONS = 3;
11
- export async function runPhase5Pilot(state) {
12
- const mapper = state.outputs["3-mapper"];
13
- if (mapper === undefined) {
14
- return {
15
- status: "error",
16
- error: {
17
- code: "missing-prereqs",
18
- message: "Phase 5 needs phase 3-mapper output",
19
- },
20
- state,
21
- };
22
- }
23
- // Operator already picked → consume + advance.
24
- if (state.answer !== undefined && state.answer.length > 0) {
25
- const next = {
26
- ...state,
27
- outputs: { ...state.outputs, "5-pilot": { picked: state.answer } },
28
- answer: undefined,
29
- };
30
- return {
31
- status: "complete",
32
- nextPhase: "6-brand",
33
- state: advancePhase(next),
34
- };
35
- }
36
- const out = mapper.output;
37
- const candidates = [];
38
- // Canonicalize repo-root forms — mapper can emit "" (key_module),
39
- // "." (Haiku merge override), or "ALL" (mapper-merge fallback) for
40
- // the same logical "whole repo" pick. Collapse them so dedup works.
41
- const canonId = (p) => {
42
- const trimmed = p.trim();
43
- if (trimmed.length === 0 || trimmed === "ALL")
44
- return ".";
45
- return trimmed;
46
- };
47
- // Render the repo-root canonical id with a contextual label so the
48
- // operator doesn't see a bare dot or the literal "ALL" between
49
- // backticks.
50
- const labelFor = (p) => (canonId(p) === "." ? "Repo root (.)" : p);
51
- const seen = new Set();
52
- const pushUnique = (opt) => {
53
- if (seen.has(opt.id))
54
- return;
55
- seen.add(opt.id);
56
- candidates.push(opt);
57
- };
58
- // Pilot first (always at least repo-root, even when empty).
59
- pushUnique({
60
- id: canonId(out.pilot_module),
61
- label: labelFor(out.pilot_module),
62
- detail: "Mapper's first pick",
63
- });
64
- // Top 2 key_modules other than pilot — dedup by canonical id so a
65
- // key_module pointing at the same path as the pilot doesn't surface
66
- // as a phantom second option.
67
- for (const km of out.key_modules) {
68
- if (candidates.length >= MAX_OPTIONS)
69
- break;
70
- pushUnique({
71
- id: canonId(km.path),
72
- label: labelFor(km.path),
73
- detail: km.purpose,
74
- });
75
- }
76
- // Fallback if mapper produced nothing.
77
- if (candidates.length === 0) {
78
- pushUnique({
79
- id: ".",
80
- label: "Repo root (.)",
81
- detail: "Whole repo as the pilot scope",
82
- });
83
- }
84
- // Single candidate → no real choice for the operator. Auto-pick and
85
- // skip the prompt rather than burning an interaction on a one-option
86
- // AskUserQuestion.
87
- if (candidates.length === 1) {
88
- const picked = candidates[0].id;
89
- const next = {
90
- ...state,
91
- outputs: { ...state.outputs, "5-pilot": { picked } },
92
- answer: undefined,
93
- };
94
- return {
95
- status: "complete",
96
- nextPhase: "6-brand",
97
- state: advancePhase(next),
98
- };
99
- }
100
- const question = {
101
- id: "5-pilot",
102
- prompt: "Which module should Cairn seed first?",
103
- options: candidates,
104
- default: candidates[0].id,
105
- };
106
- return { status: "needs_input", question, state };
107
- }
108
- //# sourceMappingURL=5-pilot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"5-pilot.js","sourceRoot":"","sources":["../../../src/init/phases/5-pilot.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AASjD,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAAiB;IACpD,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAE1B,CAAC;IACd,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO;YACL,MAAM,EAAE,OAAO;YACf,KAAK,EAAE;gBACL,IAAI,EAAE,iBAAiB;gBACvB,OAAO,EAAE,qCAAqC;aAC/C;YACD,KAAK;SACN,CAAC;IACJ,CAAC;IAED,+CAA+C;IAC/C,IAAI,KAAK,CAAC,MAAM,K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,EAAE,EAAE,SAAS;QACb,MAAM,EAAE,uCAAuC;QAC/C,OAAO,EAAE,UAAU;QACnB,OAAO,EAAE,UAAU,CAAC,CAAC,CAAE,CAAC,EAAE;KAC3B,CAAC;IACF,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACpD,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Phase 9-source-comments — walk every source file's docblock-class
3
- * comment, classify via Haiku, write DEC drafts / invariant proposals.
4
- */
5
- import type { PhaseResult, PhaseState } from "./types.js";
6
- export declare function runPhase9SourceComments(state: PhaseState): Promise<PhaseResult>;
@@ -1,55 +0,0 @@
1
- /**
2
- * Phase 9-source-comments — walk every source file's docblock-class
3
- * comment, classify via Haiku, write DEC drafts / invariant proposals.
4
- */
5
- import { runSourceCommentsIngestion, } from "../source-comments/index.js";
6
- import { clearProgress } from "../progress.js";
7
- import { advancePhase } from "./orchestrator.js";
8
- import { to7bResultPersisted, writeSourceCommentsWalkFile, } from "./source-comments-output-io.js";
9
- export async function runPhase9SourceComments(state) {
10
- const mapper = state.outputs["3-mapper"];
11
- const globs = mapper
12
- ? {
13
- route_handler_globs: mapper.output.route_handler_globs,
14
- dto_globs: mapper.output.dto_globs,
15
- generator_source_globs: mapper.output.generator_source_globs,
16
- high_stakes_globs: mapper.output.high_stakes_globs,
17
- off_limits: mapper.output.off_limits_globs,
18
- }
19
- : {};
20
- const pilotOut = state.outputs["5-pilot"];
21
- const pilotModule = typeof pilotOut?.picked === "string" && pilotOut.picked.length > 0
22
- ? pilotOut.picked
23
- : undefined;
24
- const startedAt = Date.now();
25
- try {
26
- const result = await runSourceCommentsIngestion({
27
- repoRoot: state.repoRoot,
28
- });
29
- writeSourceCommentsWalkFile(state.repoRoot, result);
30
- const persisted = to7bResultPersisted(result);
31
- clearProgress(state.repoRoot);
32
- const next = {
33
- ...state,
34
- outputs: { ...state.outputs, "9-source-comments": persisted },
35
- };
36
- return {
37
- status: "complete",
38
- nextPhase: "10-rules-merge",
39
- state: advancePhase(next),
40
- };
41
- }
42
- catch (err) {
43
- clearProgress(state.repoRoot);
44
- return {
45
- status: "error",
46
- error: {
47
- code: "source-comments-failed",
48
- message: "Source-comment ingestion failed",
49
- detail: err instanceof Error ? err.stack ?? err.message : String(err),
50
- },
51
- state,
52
- };
53
- }
54
- }
55
- //# sourceMappingURL=9-source-comments.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"9-source-comments.js","sourceRoot":"","sources":["../../../src/init/phases/9-source-comments.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,0BAA0B,GAE3B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,aAAa,EAAiB,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EACL,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,gCAAgC,CAAC;AAGxC,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,KAAiB;IAC7D,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAsC,CAAC;IAC9E,MAAM,KAAK,GAAiB,MAAM;QAChC,CAAC,CAAC;YACE,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC,mBAAmB;YACtD,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS;YAClC,sBAAsB,EAAE,MAAM,CAAC,MAAM,CAAC,sBAAsB;YAC5D,iBAAiB,EAAE,MAAM,CAAC,MAAM,CAAC,iBAAiB;YAClD,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB;SAC3C;QACH,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAoC,CAAC;IAC7E,MAAM,WAAW,GACf,OAAO,QAAQ,EAAE,MAAM,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QAChE,CAAC,CAAC,QAAQ,CAAC,MAAM;QACjB,CAAC,CAAC,SAAS,CAAC;IAEhB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,IAAI,CAAC;QACH,MAAM,MAAM,GAA+B,MAAM,0BAA0B,CAAC;YAC1E,QAAQ,EAAE,KAAK,CAAC,QAAQ;SACzB,CAAC,CAAC;QACH,2BAA2B,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACpD,MAAM,SAAS,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAC9C,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC9B,MAAM,IAAI,GAAe;YACvB,GAAG,KAAK;YACR,OAAO,EAAE,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE;SAC9D,CAAC;QACF,OAAO;YACL,MAAM,EAAE,UAAU;YAClB,SAAS,EAAE,gBAAgB;YAC3B,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC;SAC1B,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC9B,OAAO;YACL,MAAM,EAAE,OAAO;YACf,KAAK,EAAE;gBACL,IAAI,EAAE,wBAAwB;gBAC9B,OAAO,EAAE,iCAAiC;gBAC1C,MAAM,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;aACtE;YACD,KAAK;SACN,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,27 +0,0 @@
1
- /**
2
- * Phases 8 / 9 / 10 sequential orchestrator.
3
- *
4
- * The three post-pilot ingestion phases (docs-ingest, source-comments,
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.
10
- *
11
- * v0.5.0 fix: run the phases sequentially in canonical order
12
- * (8 → 9 → 10). Each phase still uses Haiku internally (with its own
13
- * concurrency for batching + per-section workers), so the wall-clock
14
- * cost vs. the v0.4.x parallel pipeline is bounded by the longest
15
- * phase plus the smaller two — historically <5s combined for the
16
- * smaller phases. Heartbeats fire per phase so the operator sees
17
- * motion across all three.
18
- *
19
- * State machine:
20
- * - The runner enters expecting `currentPhase === "8-docs-ingest"` and
21
- * exits with `currentPhase === "11-baseline"`, jumping past the
22
- * individual 9 / 10 slots in PHASE_IDS. The sequential per-phase
23
- * MCP tools remain available; this runner is the optimized path the
24
- * adopt skill prefers.
25
- */
26
- import type { PhaseResult, PhaseState } from "./types.js";
27
- export declare function runPhases8910Parallel(state: PhaseState): Promise<PhaseResult>;
@@ -1,172 +0,0 @@
1
- /**
2
- * Phases 8 / 9 / 10 sequential orchestrator.
3
- *
4
- * The three post-pilot ingestion phases (docs-ingest, source-comments,
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.
10
- *
11
- * v0.5.0 fix: run the phases sequentially in canonical order
12
- * (8 → 9 → 10). Each phase still uses Haiku internally (with its own
13
- * concurrency for batching + per-section workers), so the wall-clock
14
- * cost vs. the v0.4.x parallel pipeline is bounded by the longest
15
- * phase plus the smaller two — historically <5s combined for the
16
- * smaller phases. Heartbeats fire per phase so the operator sees
17
- * motion across all three.
18
- *
19
- * State machine:
20
- * - The runner enters expecting `currentPhase === "8-docs-ingest"` and
21
- * exits with `currentPhase === "11-baseline"`, jumping past the
22
- * individual 9 / 10 slots in PHASE_IDS. The sequential per-phase
23
- * MCP tools remain available; this runner is the optimized path the
24
- * adopt skill prefers.
25
- */
26
- import { scanExistingDecisionIds, scanExistingInvariantIds, } from "../../decision-capture/id.js";
27
- import { logger } from "../../logger.js";
28
- import { runDocsIngestion } from "../ingest-docs.js";
29
- import { clearProgress, writeProgress } from "../progress.js";
30
- import { runRulesMerge } from "../rules-merge/index.js";
31
- import { runSourceCommentsIngestion } from "../source-comments/index.js";
32
- import { to7bResultPersisted, writeSourceCommentsWalkFile, } from "./source-comments-output-io.js";
33
- import { advancePhase } from "./orchestrator.js";
34
- const log = logger("init.phases.parallel-8910");
35
- export async function runPhases8910Parallel(state) {
36
- // Sanity: this runner only enters at the start of the 8 / 9 / 10
37
- // window. If currentPhase is anywhere else, the caller invoked the
38
- // wrong tool — surface as error so we don't mid-pipeline jump.
39
- if (state.currentPhase !== "8-docs-ingest") {
40
- return {
41
- status: "error",
42
- error: {
43
- code: "wrong-phase",
44
- message: `runPhases8910Parallel requires currentPhase=8-docs-ingest, got ${state.currentPhase}`,
45
- },
46
- state,
47
- };
48
- }
49
- const mapper = state.outputs["3-mapper"];
50
- const globs = mapper
51
- ? {
52
- route_handler_globs: mapper.output.route_handler_globs,
53
- dto_globs: mapper.output.dto_globs,
54
- generator_source_globs: mapper.output.generator_source_globs,
55
- high_stakes_globs: mapper.output.high_stakes_globs,
56
- off_limits: mapper.output.off_limits_globs,
57
- }
58
- : {};
59
- const pilotOut = state.outputs["5-pilot"];
60
- const pilotModule = typeof pilotOut?.picked === "string" && pilotOut.picked.length > 0
61
- ? pilotOut.picked
62
- : undefined;
63
- const sharedDecIds = scanExistingDecisionIds(state.repoRoot);
64
- const sharedInvIds = scanExistingInvariantIds(state.repoRoot);
65
- log.info({
66
- preScannedDecIds: sharedDecIds.size,
67
- preScannedInvIds: sharedInvIds.size,
68
- }, "parallel-8910 starting");
69
- // Run the three phases sequentially. v0.5.0 ground-state files
70
- // (topic-index, anchor-map, sot-bindings, sot-cache) are the shared
71
- // mutable surface; serializing 8 → 9 → 10 removes the last-writer-
72
- // wins race that Promise.allSettled had under v0.4.x.
73
- const t0 = performance.now();
74
- const startedAt = Date.now();
75
- // Phase 8 now runs the staged ingest pipeline:
76
- // Stage 3 marker scan (0 Haiku) → Stage 1 file-purpose binary filter
77
- // (batch=30, concurrency=5) → Stage 2 section-level batch classifier
78
- // (batch=30, concurrency=5) → Stage 4 emit drafts to `_inbox/`. Each
79
- // completed batch fires `onChunkProgress` with the active stage label
80
- // so the statusline can render the right ETA window.
81
- const docsRes = await runPhaseSafely("docs-ingest-failed", async () => runDocsIngestion({
82
- repoRoot: state.repoRoot,
83
- existingDecIds: sharedDecIds,
84
- onChunkProgress: (row) => writeProgress(state.repoRoot, {
85
- phase: `8-docs-ingest:${row.stage}`,
86
- batch: row.entriesDone,
87
- total: row.totalEntries,
88
- startedAt,
89
- }),
90
- }));
91
- if ("error" in docsRes) {
92
- clearProgress(state.repoRoot);
93
- return { status: "error", error: docsRes.error, state };
94
- }
95
- const srcRes = await runPhaseSafely("source-comments-failed", async () => runSourceCommentsIngestion({
96
- repoRoot: state.repoRoot,
97
- ...(pilotModule !== undefined ? { pilotModule } : {}),
98
- dryRun: false,
99
- }));
100
- if ("error" in srcRes) {
101
- clearProgress(state.repoRoot);
102
- return { status: "error", error: srcRes.error, state };
103
- }
104
- const rulesRes = await runPhaseSafely("rules-merge-failed", async () => runRulesMerge({
105
- repoRoot: state.repoRoot,
106
- dryRun: false,
107
- }));
108
- if ("error" in rulesRes) {
109
- clearProgress(state.repoRoot);
110
- return { status: "error", error: rulesRes.error, state };
111
- }
112
- const durationMs = Math.round(performance.now() - t0);
113
- clearProgress(state.repoRoot);
114
- writeSourceCommentsWalkFile(state.repoRoot, srcRes.value);
115
- const persistedSrc = to7bResultPersisted(srcRes.value);
116
- const outputs = {
117
- "8-docs-ingest": docsRes.value,
118
- "9-source-comments": persistedSrc,
119
- "10-rules-merge": rulesRes.value,
120
- };
121
- // Advance the state machine all the way past 10 so the next phase
122
- // tool the skill calls is 11-baseline.
123
- let next = {
124
- ...state,
125
- outputs: {
126
- ...state.outputs,
127
- ...outputs,
128
- },
129
- };
130
- const skipTargets = ["8-docs-ingest", "9-source-comments", "10-rules-merge"];
131
- for (const _ of skipTargets) {
132
- next = advancePhase(next);
133
- }
134
- // Stamp aggregate duration for ETA-audit telemetry.
135
- for (const id of skipTargets) {
136
- const out = next.outputs[id];
137
- if (typeof out === "object" && out !== null) {
138
- const obj = out;
139
- if (obj["duration_ms"] === undefined) {
140
- // Approximate per-phase duration via the wall-clock divided
141
- // among the three phases — until each ingest function reports
142
- // its own duration, this is the best we can do.
143
- obj["duration_ms"] = durationMs;
144
- }
145
- }
146
- }
147
- log.info({
148
- durationMs,
149
- decsAfter: sharedDecIds.size,
150
- invsAfter: sharedInvIds.size,
151
- }, "parallel-8910 complete");
152
- return {
153
- status: "complete",
154
- nextPhase: next.currentPhase,
155
- state: next,
156
- };
157
- }
158
- async function runPhaseSafely(code, fn) {
159
- try {
160
- return { value: await fn() };
161
- }
162
- catch (err) {
163
- const detail = err instanceof Error ? err.stack ?? err.message : String(err);
164
- const message = code === "docs-ingest-failed"
165
- ? "Docs ingestion failed"
166
- : code === "source-comments-failed"
167
- ? "Source-comment ingestion failed"
168
- : "Rules merge failed";
169
- return { error: { code, message, detail } };
170
- }
171
- }
172
- //# sourceMappingURL=parallel-8910.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parallel-8910.js","sourceRoot":"","sources":["../../../src/init/phases/parallel-8910.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;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,aA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K,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"}
@@ -1,84 +0,0 @@
1
- /**
2
- * Side-file persistence for the heavy Phase 9 output.
3
- *
4
- * `IngestSourceCommentsResult` carries the full walk (every comment block's
5
- * raw text + prose) and the matching classifications. On a busy monorepo
6
- * this crosses ~1.7 MB — far above what the MCP transport can echo back
7
- * in a tool result. Mirrors the v0.3.5 mapper-output spillover: write the
8
- * full payload to `.cairn/init/source-comments-walk.json` and persist a
9
- * lightweight projection (counts, paths, ledger-relevant lists) into
10
- * `init-state.json`.
11
- *
12
- * Downstream phases consume only the lightweight projection — the
13
- * heavy walk + per-block classifications already live in
14
- * `.cairn/baseline/source-comments-<ISO>.yaml` (the audit YAML), which
15
- * the strip-replace stage and any later debug tools already read.
16
- */
17
- import type { IngestSourceCommentsResult } from "../source-comments/index.js";
18
- import type { CommentClassKind } from "../source-comments/classify.js";
19
- /** Filename relative to repoRoot. */
20
- export declare const SOURCE_COMMENTS_WALK_PATH: string;
21
- export declare function sourceCommentsWalkAbsPath(repoRoot: string): string;
22
- /**
23
- * Atomically write the full Phase 9 result. Creates `.cairn/init/`
24
- * if needed.
25
- */
26
- export declare function writeSourceCommentsWalkFile(repoRoot: string, full: IngestSourceCommentsResult): string;
27
- /**
28
- * Read the full Phase 9 result from `.cairn/init/source-comments-walk.json`.
29
- * Returns null if missing or unreadable. Available for debug tooling and
30
- * post-hoc inspection — phase consumers prefer the lightweight projection
31
- * stored on state.
32
- */
33
- export declare function readSourceCommentsWalkFile(repoRoot: string): IngestSourceCommentsResult | null;
34
- /**
35
- * Lightweight projection persisted into `init-state.json` outputs. Drops
36
- * `walk.blocks` and `classifications` (the heavy fields); keeps ledger /
37
- * triage references that downstream phases + the cairn-adopt summary
38
- * skill query directly.
39
- */
40
- export interface IngestSourceCommentsResultPersisted {
41
- /** Repo-relative path to the spilled full result, or null when not written. */
42
- walkPath: string;
43
- walkSummary: {
44
- files: number;
45
- blocks: number;
46
- bytesScanned: number;
47
- fileCountByLang: Record<string, number>;
48
- filesAvailable: number;
49
- truncatedAtFileCap: boolean;
50
- };
51
- decsWritten: {
52
- id: string;
53
- path: string;
54
- sourceFile: string;
55
- slug: string;
56
- status: "accepted";
57
- }[];
58
- invsWritten: {
59
- id: string;
60
- path: string;
61
- sourceFile: string;
62
- slug: string;
63
- status: "accepted";
64
- }[];
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;
75
- auditPath: string;
76
- auditRelPath: string;
77
- inputTokens: number;
78
- outputTokens: number;
79
- batchesRun: number;
80
- batchesFailed: number;
81
- kindCounts: Record<CommentClassKind, number>;
82
- }
83
- /** Strip the heavy fields from a fresh ingest result for state persistence. */
84
- export declare function to7bResultPersisted(full: IngestSourceCommentsResult): IngestSourceCommentsResultPersisted;
@@ -1,81 +0,0 @@
1
- /**
2
- * Side-file persistence for the heavy Phase 9 output.
3
- *
4
- * `IngestSourceCommentsResult` carries the full walk (every comment block's
5
- * raw text + prose) and the matching classifications. On a busy monorepo
6
- * this crosses ~1.7 MB — far above what the MCP transport can echo back
7
- * in a tool result. Mirrors the v0.3.5 mapper-output spillover: write the
8
- * full payload to `.cairn/init/source-comments-walk.json` and persist a
9
- * lightweight projection (counts, paths, ledger-relevant lists) into
10
- * `init-state.json`.
11
- *
12
- * Downstream phases consume only the lightweight projection — the
13
- * heavy walk + per-block classifications already live in
14
- * `.cairn/baseline/source-comments-<ISO>.yaml` (the audit YAML), which
15
- * the strip-replace stage and any later debug tools already read.
16
- */
17
- import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync, } from "node:fs";
18
- import { dirname, join } from "node:path";
19
- /** Filename relative to repoRoot. */
20
- export const SOURCE_COMMENTS_WALK_PATH = join(".cairn", "init", "source-comments-walk.json");
21
- export function sourceCommentsWalkAbsPath(repoRoot) {
22
- return join(repoRoot, SOURCE_COMMENTS_WALK_PATH);
23
- }
24
- /**
25
- * Atomically write the full Phase 9 result. Creates `.cairn/init/`
26
- * if needed.
27
- */
28
- export function writeSourceCommentsWalkFile(repoRoot, full) {
29
- const abs = sourceCommentsWalkAbsPath(repoRoot);
30
- mkdirSync(dirname(abs), { recursive: true });
31
- const tmp = `${abs}.tmp`;
32
- writeFileSync(tmp, JSON.stringify(full, null, 2), "utf8");
33
- renameSync(tmp, abs);
34
- return abs;
35
- }
36
- /**
37
- * Read the full Phase 9 result from `.cairn/init/source-comments-walk.json`.
38
- * Returns null if missing or unreadable. Available for debug tooling and
39
- * post-hoc inspection — phase consumers prefer the lightweight projection
40
- * stored on state.
41
- */
42
- export function readSourceCommentsWalkFile(repoRoot) {
43
- const abs = sourceCommentsWalkAbsPath(repoRoot);
44
- if (!existsSync(abs))
45
- return null;
46
- try {
47
- return JSON.parse(readFileSync(abs, "utf8"));
48
- }
49
- catch {
50
- return null;
51
- }
52
- }
53
- /** Strip the heavy fields from a fresh ingest result for state persistence. */
54
- export function to7bResultPersisted(full) {
55
- return {
56
- walkPath: SOURCE_COMMENTS_WALK_PATH,
57
- walkSummary: {
58
- files: full.walk.files.length,
59
- blocks: full.walk.blocks.length,
60
- bytesScanned: full.walk.bytesScanned,
61
- fileCountByLang: full.walk.fileCountByLang,
62
- filesAvailable: full.walk.filesAvailable,
63
- truncatedAtFileCap: full.walk.truncatedAtFileCap,
64
- },
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,
72
- auditPath: full.auditPath,
73
- auditRelPath: full.auditRelPath,
74
- inputTokens: full.inputTokens,
75
- outputTokens: full.outputTokens,
76
- batchesRun: full.batchesRun,
77
- batchesFailed: full.batchesFailed,
78
- kindCounts: full.kindCounts,
79
- };
80
- }
81
- //# sourceMappingURL=source-comments-output-io.js.map