@isaacriehm/cairn-core 0.3.4 → 0.3.6

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.
@@ -1,19 +1,32 @@
1
1
  /**
2
- * MCP tools for the v0.2.0 init pipeline.
2
+ * MCP tools for the v0.3.5 init pipeline.
3
3
  *
4
- * Eleven `cairn_init_phase_<id>` tools — one per PHASE_IDS entry —
4
+ * Twelve `cairn_init_phase_<id>` tools — one per PHASE_IDS entry —
5
5
  * plus `cairn_init_resume`. The cairn-adopt skill drives the
6
6
  * pipeline by:
7
- * 1. cairn_init_resume → { nextPhase, state }
8
- * 2. cairn_init_phase_<next> → { complete | needs_input | error, state }
9
- * 3. AskUserQuestion if needs_input → re-call same tool with state.answer
7
+ * 1. cairn_init_resume → { status, nextPhase, repoRoot }
8
+ * 2. cairn_init_phase_<next>() → { status, nextPhase | question | error }
9
+ * 3. AskUserQuestion if needs_input → re-call same tool with { answer }
10
10
  * 4. loop on complete + advance until nextPhase === null
11
11
  *
12
- * State persists to .cairn/init-state.json after every phase result
13
- * (whether complete or needs_input) so the operator can crash-recover.
12
+ * State persists to .cairn/init-state.json after every successful
13
+ * phase result so the operator can crash-recover. The skill no longer
14
+ * threads state through arguments — phase tools read state from disk
15
+ * and only need an optional `answer` field for needs_input phases.
16
+ *
17
+ * Why no state echo: returning the full state in tool responses
18
+ * triggered MCP-level spillover-to-file once mapper output landed,
19
+ * which broke the skill's state machine (see v0.3.5 incident report).
20
+ * Skinny responses keep the conversation cache warm and let the LLM
21
+ * progress through phases without re-reading 90KB JSON each round.
22
+ *
23
+ * Why no clobber on error: prior versions persisted `result.state`
24
+ * unconditionally. An error path that echoed the input state with
25
+ * `outputs: {}` would overwrite the on-disk state and lose all prior
26
+ * phase outputs — a single bad call could nuke a 90KB mapper run.
14
27
  */
15
28
  import { z } from "zod";
16
- import { PHASE_IDS, freshPhaseState, resumePhases, runPhase10Strip, runPhase12Multidev, runPhase1Detect, runPhase2Walker, runPhase3Mapper, runPhase3bSeed, runPhase4Pilot, runPhase5Brand, runPhase6DocsIngest, runPhase7bSourceComments, runPhase7cRulesMerge, runPhase8Baseline, writePhaseState, clearPhaseState, } from "../../init/index.js";
29
+ import { PHASE_IDS, freshPhaseState, readPhaseState, resumePhases, runPhase10Strip, runPhase12Multidev, runPhase1Detect, runPhase2Walker, runPhase3Mapper, runPhase3bSeed, runPhase4Pilot, runPhase5Brand, runPhase6DocsIngest, runPhase7bSourceComments, runPhase7cRulesMerge, runPhase8Baseline, writePhaseState, } from "../../init/index.js";
17
30
  import { mcpError } from "../errors.js";
18
31
  const phaseIdEnum = z.enum(PHASE_IDS);
19
32
  const phaseStateSchema = z.object({
@@ -25,7 +38,13 @@ const phaseStateSchema = z.object({
25
38
  schemaVersion: z.literal(1),
26
39
  });
27
40
  const initPhaseInput = {
28
- state: phaseStateSchema,
41
+ // State is optional — phase tools read .cairn/init-state.json by
42
+ // default. Callers can still pass an explicit state object (e.g.
43
+ // smoke tests) but the cairn-adopt skill should pass nothing here.
44
+ state: phaseStateSchema.optional(),
45
+ // Operator answer for needs_input phases. The wrapper splices this
46
+ // into state.answer before invoking the phase runner.
47
+ answer: z.string().optional(),
29
48
  };
30
49
  const initResumeInput = {};
31
50
  const RUNNERS = {
@@ -42,62 +61,85 @@ const RUNNERS = {
42
61
  "10-strip": runPhase10Strip,
43
62
  "12-multidev": runPhase12Multidev,
44
63
  };
64
+ function toSlim(result) {
65
+ if (result.status === "complete") {
66
+ return { status: "complete", nextPhase: result.nextPhase };
67
+ }
68
+ if (result.status === "needs_input") {
69
+ return { status: "needs_input", question: result.question };
70
+ }
71
+ return { status: "error", error: result.error };
72
+ }
45
73
  function makePhaseTool(id) {
46
74
  return {
47
75
  name: `cairn_init_phase_${normalizeId(id)}`,
48
76
  description: phaseDescription(id),
49
77
  inputSchema: initPhaseInput,
50
78
  handler: async (ctx, input) => {
79
+ // Resolve state: prefer the explicit arg (smoke tests, debug
80
+ // tooling), fall back to disk (cairn-adopt skill default).
81
+ let state = input.state ?? null;
82
+ if (state === null) {
83
+ state = readPhaseState(ctx.repoRoot);
84
+ }
85
+ if (state === null) {
86
+ return mcpError("VALIDATION_FAILED", `cairn_init_phase_${normalizeId(id)} found no init state at .cairn/init-state.json. Call cairn_init_resume to start a fresh pipeline.`);
87
+ }
51
88
  // Sanity: the tool's id must match the phase id baked into state.
52
- if (input.state.currentPhase !== id) {
53
- return mcpError("VALIDATION_FAILED", `cairn_init_phase_${normalizeId(id)} requires state.currentPhase=${id}, got ${input.state.currentPhase}`);
89
+ if (state.currentPhase !== id) {
90
+ return mcpError("VALIDATION_FAILED", `cairn_init_phase_${normalizeId(id)} requires state.currentPhase=${id}, got ${state.currentPhase}`);
54
91
  }
55
92
  // The state's repoRoot drives the phase, but we sanity-check it
56
93
  // against the MCP context's repoRoot so a misaddressed call
57
94
  // (e.g. an old state file from a different repo) gets caught.
58
- if (input.state.repoRoot !== ctx.repoRoot) {
59
- return mcpError("VALIDATION_FAILED", `state.repoRoot ${input.state.repoRoot} does not match MCP context ${ctx.repoRoot}`);
95
+ if (state.repoRoot !== ctx.repoRoot) {
96
+ return mcpError("VALIDATION_FAILED", `state.repoRoot ${state.repoRoot} does not match MCP context ${ctx.repoRoot}`);
60
97
  }
98
+ // Splice the operator's answer into state for needs_input phases.
99
+ // The runner clears `state.answer` once it has consumed it (via
100
+ // `advancePhase`), so passing an answer to a phase that doesn't
101
+ // expect one is a no-op rather than a hazard.
102
+ const stateForRun = input.answer !== undefined && input.answer.length > 0
103
+ ? { ...state, answer: input.answer }
104
+ : state;
61
105
  const runner = RUNNERS[id];
62
- const result = await runner(input.state);
63
- // Persist state after every phase result so the operator can
64
- // /exit Claude Code mid-init and resume on the next session.
65
- try {
66
- writePhaseState(result.state);
67
- }
68
- catch (err) {
69
- return mcpError("INTERNAL_ERROR", `failed to persist init state: ${err instanceof Error ? err.message : String(err)}`);
70
- }
71
- // Pipeline complete — clean up the state file so the next init
72
- // starts fresh rather than resuming.
73
- if (result.status === "complete" && result.nextPhase === null) {
106
+ const result = await runner(stateForRun);
107
+ // Persist state ONLY on non-error results. An error path returns
108
+ // the input state echo unchanged; persisting it would clobber
109
+ // the on-disk state file with whatever shape the caller sent in
110
+ // (in v0.3.4 a malformed state nuked a 90KB mapper run this way).
111
+ if (result.status !== "error") {
74
112
  try {
75
- clearPhaseState(ctx.repoRoot);
113
+ writePhaseState(result.state);
76
114
  }
77
- catch {
78
- // best-effort cleanup
115
+ catch (err) {
116
+ return mcpError("INTERNAL_ERROR", `failed to persist init state: ${err instanceof Error ? err.message : String(err)}`);
79
117
  }
80
118
  }
81
- return result;
119
+ // The state file lingers after terminal phase 12-multidev so the
120
+ // cairn-adopt skill can read outputs for its final summary
121
+ // banner. Cleanup is a manual concern (cairn doctor / re-init).
122
+ return toSlim(result);
82
123
  },
83
124
  };
84
125
  }
85
126
  function makeResumeTool() {
86
127
  return {
87
128
  name: "cairn_init_resume",
88
- description: "Read the on-disk init state for the current repo and return the next phase to invoke. The cairn-adopt skill calls this once at the start of the pipeline (and after any operator interruption) to find where to pick up. Returns { status: 'ready' | 'done', nextPhase: PhaseId | null, state: PhaseState }.",
129
+ description: "Read the on-disk init state for the current repo and return the next phase to invoke. The cairn-adopt skill calls this once at the start of the pipeline (and after any operator interruption) to find where to pick up. Returns { status: 'ready' | 'done', nextPhase: PhaseId | null, repoRoot }.",
89
130
  inputSchema: initResumeInput,
90
131
  handler: async (ctx) => {
91
132
  const report = resumePhases(ctx.repoRoot);
92
133
  // For a fresh start, ensure state.repoRoot matches ctx.repoRoot
93
134
  // (resumePhases uses freshPhaseState(ctx.repoRoot) for this case).
94
- if (report.state.repoRoot !== ctx.repoRoot) {
95
- return {
96
- ...report,
97
- state: { ...freshPhaseState(ctx.repoRoot), startedAt: report.state.startedAt },
98
- };
99
- }
100
- return report;
135
+ const repoRoot = report.state.repoRoot !== ctx.repoRoot
136
+ ? freshPhaseState(ctx.repoRoot).repoRoot
137
+ : report.state.repoRoot;
138
+ return {
139
+ status: report.status,
140
+ nextPhase: report.nextPhase,
141
+ repoRoot,
142
+ };
101
143
  },
102
144
  };
103
145
  }
@@ -1 +1 @@
1
- {"version":3,"file":"init-phases.js","sourceRoot":"","sources":["../../../src/mcp/tools/init-phases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,SAAS,EACT,eAAe,EACf,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,eAAe,GAIhB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGxC,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CACxB,SAA+C,CAChD,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,YAAY,EAAE,WAAW;IACzB,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IAC1C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;CAC5B,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG;IACrB,KAAK,EAAE,gBAAgB;CACxB,CAAC;AAEF,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,MAAM,OAAO,GAA6D;IACxE,UAAU,EAAE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,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,gBAAgB,CAAC,EAAW;IACnC,QAAQ,EAAE,EAAE,CAAC;QACX,KAAK,UAAU;YACb,OAAO,yGAAyG,CAAC;QACnH,KAAK,UAAU;YACb,OAAO,uHAAuH,CAAC;QACjI,KAAK,UAAU;YACb,OAAO,4GAA4G,CAAC;QACtH,KAAK,SAAS;YACZ,OAAO,0IAA0I,CAAC;QACpJ,KAAK,SAAS;YACZ,OAAO,2FAA2F,CAAC;QACrG,KAAK,SAAS;YACZ,OAAO,8GAA8G,CAAC;QACxH,KAAK,eAAe;YAClB,OAAO,+GAA+G,CAAC;QACzH,KAAK,oBAAoB;YACvB,OAAO,gHAAgH,CAAC;QAC1H,KAAK,gBAAgB;YACnB,OAAO,2HAA2H,CAAC;QACrI,KAAK,YAAY;YACf,OAAO,4FAA4F,CAAC;QACtG,KAAK,UAAU;YACb,OAAO,qIAAqI,CAAC;QAC/I,KAAK,aAAa;YAChB,OAAO,0IAA0I,CAAC;IACtJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAA8B,SAAS,CAAC,GAAG,CACpE,CAAC,EAAE,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,CAC1B,CAAC;AACF,MAAM,CAAC,MAAM,cAAc,GAA6B,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"init-phases.js","sourceRoot":"","sources":["../../../src/mcp/tools/init-phases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,SAAS,EACT,eAAe,EACf,cAAc,EACd,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,iBAAiB,E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K,aAAa;YAChB,OAAO,0IAA0I,CAAC;IACtJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAA8B,SAAS,CAAC,GAAG,CACpE,CAAC,EAAE,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,CAC1B,CAAC;AACF,MAAM,CAAC,MAAM,cAAc,GAA6B,cAAc,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isaacriehm/cairn-core",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
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",
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Bin entrypoint — `node cairn-core/dist/hooks/user-prompt-submit.js`.
4
- * UserPromptSubmit hook; resolves §INV/§DEC/TODO(TSK-) citations in
5
- * `@`-attached files (Read-bypass path).
6
- */
7
- export {};
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Bin entrypoint — `node cairn-core/dist/hooks/user-prompt-submit.js`.
4
- * UserPromptSubmit hook; resolves §INV/§DEC/TODO(TSK-) citations in
5
- * `@`-attached files (Read-bypass path).
6
- */
7
- import { runUserPromptSubmitHook } from "./runners/index.js";
8
- runUserPromptSubmitHook().catch((err) => {
9
- process.stderr.write(`[cairn user-prompt-submit] ${err instanceof Error ? err.message : String(err)}\n`);
10
- process.exit(1);
11
- });
12
- //# sourceMappingURL=user-prompt-submit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-prompt-submit.js","sourceRoot":"","sources":["../../src/hooks/user-prompt-submit.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,uBAAuB,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC/C,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,8BAA8B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CACnF,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}