@isaacriehm/cairn-core 0.22.4 → 0.22.5

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.
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Bin entrypoint — `node cairn-core/dist/hooks/read-enrich.js`.
4
+ * PostToolUse on Read; injects citation legend.
5
+ */
6
+ export {};
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Bin entrypoint — `node cairn-core/dist/hooks/read-enrich.js`.
4
+ * PostToolUse on Read; injects citation legend.
5
+ */
6
+ import { runReadEnricher } from "./post-tool-use/index.js";
7
+ runReadEnricher().catch((err) => {
8
+ process.stderr.write(`[cairn read-enrich] ${err instanceof Error ? err.message : String(err)}\n`);
9
+ process.exit(1);
10
+ });
11
+ //# sourceMappingURL=read-enrich.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-enrich.js","sourceRoot":"","sources":["../../src/hooks/read-enrich.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,eAAe,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IACvC,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,uBAAuB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAC5E,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Bin entrypoint — `node cairn-core/dist/hooks/write-guard.js`.
4
+ * PostToolUse on Write/Edit; copy-safety + scope reminder.
5
+ */
6
+ export {};
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Bin entrypoint — `node cairn-core/dist/hooks/write-guard.js`.
4
+ * PostToolUse on Write/Edit; copy-safety + scope reminder.
5
+ */
6
+ import { runWriteGuardian } from "./post-tool-use/index.js";
7
+ runWriteGuardian().catch((err) => {
8
+ process.stderr.write(`[cairn write-guard] ${err instanceof Error ? err.message : String(err)}\n`);
9
+ process.exit(1);
10
+ });
11
+ //# sourceMappingURL=write-guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write-guard.js","sourceRoot":"","sources":["../../src/hooks/write-guard.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,gBAAgB,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IACxC,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,uBAAuB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAC5E,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Phase 12-strip — per-module strip-replace consent.
3
+ *
4
+ * Surfaces each ingestion-flagged module as an A/B/C choice (strip /
5
+ * keep / skip). Tracks remaining modules in
6
+ * `outputs["12-strip"].pending` and emits one question at a time
7
+ * until the queue is empty.
8
+ */
9
+ import type { PhaseResult, PhaseState } from "./types.js";
10
+ export declare function runPhase12Strip(state: PhaseState): Promise<PhaseResult>;
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Phase 12-strip — per-module strip-replace consent.
3
+ *
4
+ * Surfaces each ingestion-flagged module as an A/B/C choice (strip /
5
+ * keep / skip). Tracks remaining modules in
6
+ * `outputs["12-strip"].pending` and emits one question at a time
7
+ * until the queue is empty.
8
+ */
9
+ import { advancePhase, isSelfAdoptState } from "./orchestrator.js";
10
+ export async function runPhase12Strip(state) {
11
+ if (isSelfAdoptState(state)) {
12
+ const skipped = { pending: [], decisions: {} };
13
+ const next = {
14
+ ...state,
15
+ outputs: { ...state.outputs, "12-strip": skipped },
16
+ answer: undefined,
17
+ };
18
+ return {
19
+ status: "complete",
20
+ nextPhase: "13-multidev",
21
+ state: advancePhase(next),
22
+ };
23
+ }
24
+ const existing = state.outputs["12-strip"];
25
+ const modules = computeFlaggedModules(state);
26
+ // Initialize on first entry.
27
+ let s = existing ?? { pending: [...modules], decisions: {} };
28
+ // Operator just answered → record + dequeue.
29
+ if (state.answer !== undefined && state.answer.length > 0 && s.pending.length > 0) {
30
+ const head = s.pending[0];
31
+ const choice = normalizeChoice(state.answer);
32
+ s = {
33
+ pending: s.pending.slice(1),
34
+ decisions: { ...s.decisions, [head]: choice },
35
+ };
36
+ }
37
+ if (s.pending.length === 0) {
38
+ const next = {
39
+ ...state,
40
+ outputs: { ...state.outputs, "12-strip": s },
41
+ answer: undefined,
42
+ };
43
+ return {
44
+ status: "complete",
45
+ nextPhase: "13-multidev",
46
+ state: advancePhase(next),
47
+ };
48
+ }
49
+ const head = s.pending[0];
50
+ const question = {
51
+ id: `12-strip:${head}`,
52
+ prompt: `Strip the source-comment essay in ${head}?`,
53
+ options: [
54
+ {
55
+ id: "strip",
56
+ label: "strip — DEC is the source of truth",
57
+ },
58
+ {
59
+ id: "keep",
60
+ label: "keep — leave comment alongside DEC",
61
+ },
62
+ {
63
+ id: "skip",
64
+ label: "skip — decide later",
65
+ },
66
+ ],
67
+ default: "skip",
68
+ };
69
+ return {
70
+ status: "needs_input",
71
+ question,
72
+ state: { ...state, outputs: { ...state.outputs, "12-strip": s }, answer: undefined },
73
+ };
74
+ }
75
+ function normalizeChoice(answer) {
76
+ switch (answer) {
77
+ case "strip":
78
+ case "keep":
79
+ case "skip":
80
+ return answer;
81
+ default:
82
+ return "skip";
83
+ }
84
+ }
85
+ function computeFlaggedModules(_state) {
86
+ return [];
87
+ }
88
+ //# sourceMappingURL=12-strip.js.map
@@ -0,0 +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AAM,CAAC;QACZ,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;QAChB;YACE,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAkB;IAC/C,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -11,8 +11,8 @@ export declare const invariantGetInput: {
11
11
  export declare const inScopeInput: {
12
12
  path_globs: z.ZodArray<z.ZodString>;
13
13
  types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
14
- decision: "decision";
15
14
  invariant: "invariant";
15
+ decision: "decision";
16
16
  }>>>;
17
17
  status: z.ZodOptional<z.ZodArray<z.ZodString>>;
18
18
  };
@@ -50,11 +50,11 @@ export declare const searchInput: {
50
50
  query: z.ZodString;
51
51
  scope: z.ZodOptional<z.ZodArray<z.ZodString>>;
52
52
  kinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
53
- decision: "decision";
54
53
  invariant: "invariant";
55
- doc: "doc";
54
+ decision: "decision";
56
55
  task: "task";
57
56
  run: "run";
57
+ doc: "doc";
58
58
  manifest: "manifest";
59
59
  }>>>;
60
60
  limit: z.ZodOptional<z.ZodNumber>;
@@ -109,9 +109,9 @@ export declare const resumeInput: {
109
109
  export declare const taskCompleteInput: {
110
110
  task_id: z.ZodOptional<z.ZodString>;
111
111
  outcome: z.ZodEnum<{
112
+ aborted: "aborted";
112
113
  succeeded: "succeeded";
113
114
  failed: "failed";
114
- aborted: "aborted";
115
115
  }>;
116
116
  summary: z.ZodOptional<z.ZodString>;
117
117
  };
@@ -177,9 +177,9 @@ export declare const resolveAttentionInput: {
177
177
  * kinds reject `d`.
178
178
  */
179
179
  choice: z.ZodEnum<{
180
+ c: "c";
180
181
  d: "d";
181
182
  a: "a";
182
- c: "c";
183
183
  b: "b";
184
184
  }>;
185
185
  /**
@@ -208,12 +208,12 @@ export declare const resolveAttentionInput: {
208
208
  * d=none-of-these (drop pending, leave source untouched).
209
209
  */
210
210
  kind: z.ZodEnum<{
211
- bypass: "bypass";
212
- review: "review";
213
211
  decision_draft: "decision_draft";
214
212
  baseline_finding: "baseline_finding";
215
213
  invalidation_event: "invalidation_event";
216
214
  drift: "drift";
215
+ bypass: "bypass";
216
+ review: "review";
217
217
  conflict: "conflict";
218
218
  alignment_pending: "alignment_pending";
219
219
  }>;
@@ -311,10 +311,10 @@ export declare const missionPlanPhaseInput: {
311
311
  export declare const missionAdvanceInput: {
312
312
  phase_id: z.ZodString;
313
313
  choice: z.ZodEnum<{
314
- force: "force";
315
314
  exit: "exit";
316
315
  not_yet: "not_yet";
317
316
  defer: "defer";
317
+ force: "force";
318
318
  drop: "drop";
319
319
  }>;
320
320
  defer_hours: z.ZodOptional<z.ZodNumber>;
@@ -21,8 +21,8 @@ import { z } from "zod";
21
21
  import type { ToolDef } from "./types.js";
22
22
  export declare const missionSetExitGateInput: {
23
23
  exit_gate: z.ZodEnum<{
24
- prompt: "prompt";
25
24
  auto: "auto";
25
+ prompt: "prompt";
26
26
  manual: "manual";
27
27
  }>;
28
28
  mission_id: z.ZodOptional<z.ZodString>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isaacriehm/cairn-core",
3
- "version": "0.22.4",
3
+ "version": "0.22.5",
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.9.0",
41
41
  "zod": "^4.4.3",
42
- "@isaacriehm/cairn-state": "0.22.4"
42
+ "@isaacriehm/cairn-state": "0.22.5"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/cli-progress": "^3.11.6",