@isaacriehm/cairn-core 0.4.2 → 0.5.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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/align-undo/index.d.ts +6 -0
- package/dist/align-undo/index.js +6 -0
- package/dist/align-undo/index.js.map +1 -0
- package/dist/align-undo/log.d.ts +53 -0
- package/dist/align-undo/log.js +99 -0
- package/dist/align-undo/log.js.map +1 -0
- package/dist/align-undo/undo.d.ts +66 -0
- package/dist/align-undo/undo.js +187 -0
- package/dist/align-undo/undo.js.map +1 -0
- package/dist/attention/bulk-accept.js +1 -1
- package/dist/attention/bulk-accept.js.map +1 -1
- package/dist/attention/dedup.d.ts +2 -2
- package/dist/attention/dedup.js +16 -51
- package/dist/attention/dedup.js.map +1 -1
- package/dist/attention/index.d.ts +1 -0
- package/dist/attention/index.js +1 -0
- package/dist/attention/index.js.map +1 -1
- package/dist/attention/restore.js +1 -1
- package/dist/attention/restore.js.map +1 -1
- package/dist/attention/serve/api.d.ts +23 -0
- package/dist/attention/serve/api.js +344 -0
- package/dist/attention/serve/api.js.map +1 -0
- package/dist/attention/serve/index.d.ts +62 -0
- package/dist/attention/serve/index.js +205 -0
- package/dist/attention/serve/index.js.map +1 -0
- package/dist/decision-capture/id.d.ts +62 -25
- package/dist/decision-capture/id.js +78 -57
- package/dist/decision-capture/id.js.map +1 -1
- package/dist/decision-capture/index.d.ts +3 -3
- package/dist/decision-capture/index.js +3 -3
- package/dist/decision-capture/index.js.map +1 -1
- package/dist/drain/drain.d.ts +77 -0
- package/dist/drain/drain.js +464 -0
- package/dist/drain/drain.js.map +1 -0
- package/dist/drain/index.d.ts +5 -0
- package/dist/drain/index.js +5 -0
- package/dist/drain/index.js.map +1 -0
- package/dist/fix-align/index.d.ts +5 -0
- package/dist/fix-align/index.js +5 -0
- package/dist/fix-align/index.js.map +1 -0
- package/dist/fix-align/run.d.ts +99 -0
- package/dist/fix-align/run.js +258 -0
- package/dist/fix-align/run.js.map +1 -0
- package/dist/ground/alignment-pending.d.ts +28 -0
- package/dist/ground/alignment-pending.js +83 -0
- package/dist/ground/alignment-pending.js.map +1 -0
- package/dist/ground/anchor-map.d.ts +14 -0
- package/dist/ground/anchor-map.js +57 -0
- package/dist/ground/anchor-map.js.map +1 -0
- package/dist/ground/index.d.ts +9 -2
- package/dist/ground/index.js +8 -2
- package/dist/ground/index.js.map +1 -1
- package/dist/ground/paths.d.ts +21 -0
- package/dist/ground/paths.js +43 -0
- package/dist/ground/paths.js.map +1 -1
- package/dist/ground/schemas.d.ts +201 -0
- package/dist/ground/schemas.js +128 -3
- package/dist/ground/schemas.js.map +1 -1
- package/dist/ground/scope-index.js +2 -2
- package/dist/ground/scope-index.js.map +1 -1
- package/dist/ground/slug.d.ts +60 -0
- package/dist/ground/slug.js +103 -0
- package/dist/ground/slug.js.map +1 -0
- package/dist/ground/sot-bindings.d.ts +14 -0
- package/dist/ground/sot-bindings.js +80 -0
- package/dist/ground/sot-bindings.js.map +1 -0
- package/dist/ground/sot-cache.d.ts +18 -0
- package/dist/ground/sot-cache.js +63 -0
- package/dist/ground/sot-cache.js.map +1 -0
- package/dist/ground/topic-index.d.ts +20 -0
- package/dist/ground/topic-index.js +60 -0
- package/dist/ground/topic-index.js.map +1 -0
- package/dist/hooks/post-tool-use/citation-scanner.d.ts +1 -1
- package/dist/hooks/post-tool-use/citation-scanner.js +3 -3
- package/dist/hooks/post-tool-use/citation-scanner.js.map +1 -1
- package/dist/hooks/post-tool-use/copy-scanner.js +1 -1
- package/dist/hooks/post-tool-use/copy-scanner.js.map +1 -1
- package/dist/hooks/post-tool-use/index.d.ts +2 -0
- package/dist/hooks/post-tool-use/index.js +1 -0
- package/dist/hooks/post-tool-use/index.js.map +1 -1
- package/dist/hooks/post-tool-use/legend-builder.d.ts +1 -1
- package/dist/hooks/post-tool-use/legend-builder.js +2 -2
- package/dist/hooks/post-tool-use/legend-builder.js.map +1 -1
- package/dist/hooks/post-tool-use/sot-align.d.ts +166 -0
- package/dist/hooks/post-tool-use/sot-align.js +1311 -0
- package/dist/hooks/post-tool-use/sot-align.js.map +1 -0
- package/dist/hooks/pre-commit/index.d.ts +8 -0
- package/dist/hooks/pre-commit/index.js +8 -0
- package/dist/hooks/pre-commit/index.js.map +1 -0
- package/dist/hooks/pre-commit/sot-align-precommit.d.ts +60 -0
- package/dist/hooks/pre-commit/sot-align-precommit.js +221 -0
- package/dist/hooks/pre-commit/sot-align-precommit.js.map +1 -0
- package/dist/hooks/runners/session-start.js +41 -0
- package/dist/hooks/runners/session-start.js.map +1 -1
- package/dist/hooks/sot-align-common.d.ts +39 -0
- package/dist/hooks/sot-align-common.js +152 -0
- package/dist/hooks/sot-align-common.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/init/index.d.ts +4 -2
- package/dist/init/index.js +2 -1
- package/dist/init/index.js.map +1 -1
- package/dist/init/ingest-docs.d.ts +30 -47
- package/dist/init/ingest-docs.js +113 -406
- package/dist/init/ingest-docs.js.map +1 -1
- package/dist/init/init.d.ts +8 -0
- package/dist/init/init.js +58 -29
- package/dist/init/init.js.map +1 -1
- package/dist/init/mapper-parallel.js +1 -1
- package/dist/init/mapper-parallel.js.map +1 -1
- package/dist/init/phases/5-brand.js +1 -1
- package/dist/init/phases/5-brand.js.map +1 -1
- package/dist/init/phases/5b-topic-index.d.ts +30 -0
- package/dist/init/phases/5b-topic-index.js +62 -0
- package/dist/init/phases/5b-topic-index.js.map +1 -0
- package/dist/init/phases/6-docs-ingest.d.ts +4 -5
- package/dist/init/phases/6-docs-ingest.js +5 -6
- package/dist/init/phases/6-docs-ingest.js.map +1 -1
- package/dist/init/phases/index.d.ts +2 -0
- package/dist/init/phases/index.js +1 -0
- package/dist/init/phases/index.js.map +1 -1
- package/dist/init/phases/parallel-678.d.ts +14 -17
- package/dist/init/phases/parallel-678.js +77 -98
- package/dist/init/phases/parallel-678.js.map +1 -1
- package/dist/init/phases/source-comments-output-io.d.ts +16 -10
- package/dist/init/phases/source-comments-output-io.js +7 -10
- package/dist/init/phases/source-comments-output-io.js.map +1 -1
- package/dist/init/phases/types.d.ts +1 -1
- package/dist/init/phases/types.js +1 -0
- package/dist/init/phases/types.js.map +1 -1
- package/dist/init/rules-merge/discover.d.ts +8 -3
- package/dist/init/rules-merge/discover.js +7 -3
- package/dist/init/rules-merge/discover.js.map +1 -1
- package/dist/init/rules-merge/ingest.d.ts +81 -28
- package/dist/init/rules-merge/ingest.js +456 -155
- package/dist/init/rules-merge/ingest.js.map +1 -1
- package/dist/init/sot-emit.d.ts +84 -0
- package/dist/init/sot-emit.js +218 -0
- package/dist/init/sot-emit.js.map +1 -0
- package/dist/init/source-comments/classify.d.ts +12 -10
- package/dist/init/source-comments/classify.js +13 -25
- package/dist/init/source-comments/classify.js.map +1 -1
- package/dist/init/source-comments/index.d.ts +1 -1
- package/dist/init/source-comments/index.js +1 -1
- package/dist/init/source-comments/index.js.map +1 -1
- package/dist/init/source-comments/ingest.d.ts +91 -67
- package/dist/init/source-comments/ingest.js +392 -349
- package/dist/init/source-comments/ingest.js.map +1 -1
- package/dist/init/topic-index/index.d.ts +36 -0
- package/dist/init/topic-index/index.js +46 -0
- package/dist/init/topic-index/index.js.map +1 -0
- package/dist/init/topic-index/judge.d.ts +20 -0
- package/dist/init/topic-index/judge.js +65 -0
- package/dist/init/topic-index/judge.js.map +1 -0
- package/dist/init/topic-index/resolve.d.ts +50 -0
- package/dist/init/topic-index/resolve.js +196 -0
- package/dist/init/topic-index/resolve.js.map +1 -0
- package/dist/init/topic-index/walk.d.ts +43 -0
- package/dist/init/topic-index/walk.js +293 -0
- package/dist/init/topic-index/walk.js.map +1 -0
- package/dist/mcp/history/summarizer.js +1 -1
- package/dist/mcp/history/summarizer.js.map +1 -1
- package/dist/mcp/schemas.d.ts +46 -9
- package/dist/mcp/schemas.js +48 -12
- package/dist/mcp/schemas.js.map +1 -1
- package/dist/mcp/tools/align-drain.d.ts +7 -0
- package/dist/mcp/tools/align-drain.js +26 -0
- package/dist/mcp/tools/align-drain.js.map +1 -0
- package/dist/mcp/tools/archive.js +1 -1
- package/dist/mcp/tools/archive.js.map +1 -1
- package/dist/mcp/tools/attention-restore.js +1 -1
- package/dist/mcp/tools/attention-restore.js.map +1 -1
- package/dist/mcp/tools/attention-serve.d.ts +23 -0
- package/dist/mcp/tools/attention-serve.js +78 -0
- package/dist/mcp/tools/attention-serve.js.map +1 -0
- package/dist/mcp/tools/attention-wait.d.ts +18 -0
- package/dist/mcp/tools/attention-wait.js +74 -0
- package/dist/mcp/tools/attention-wait.js.map +1 -0
- package/dist/mcp/tools/index.js +7 -0
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/init-phases.js +4 -1
- package/dist/mcp/tools/init-phases.js.map +1 -1
- package/dist/mcp/tools/record-decision.js +14 -2
- package/dist/mcp/tools/record-decision.js.map +1 -1
- package/dist/mcp/tools/resolve-attention.d.ts +2 -2
- package/dist/mcp/tools/resolve-attention.js +830 -7
- package/dist/mcp/tools/resolve-attention.js.map +1 -1
- package/dist/status-line/event-queue.d.ts +40 -0
- package/dist/status-line/event-queue.js +195 -0
- package/dist/status-line/event-queue.js.map +1 -0
- package/dist/status-line/format.d.ts +1 -1
- package/dist/status-line/format.js +49 -6
- package/dist/status-line/format.js.map +1 -1
- package/dist/status-line/index.d.ts +41 -0
- package/dist/status-line/index.js +14 -0
- package/dist/status-line/index.js.map +1 -1
- package/dist/status-line/reader.js +23 -18
- package/dist/status-line/reader.js.map +1 -1
- package/dist/status-line/writer.d.ts +1 -1
- package/dist/status-line/writer.js +5 -0
- package/dist/status-line/writer.js.map +1 -1
- package/dist/text/jaccard.d.ts +19 -0
- package/dist/text/jaccard.js +68 -0
- package/dist/text/jaccard.js.map +1 -0
- package/package.json +1 -1
- package/templates/.cairn/git-hooks/pre-commit +16 -3
- package/templates/attention-ui/app.css +406 -0
- package/templates/attention-ui/app.js +384 -0
- package/templates/attention-ui/index.html +56 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/init/phases/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,GASV,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,eAAe,GAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,GAExB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,eAAe,EACf,YAAY,EACZ,cAAc,EACd,YAAY,GACb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,GAEpB,MAAM,gCAAgC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AM,gCAAgC,CAAC"}
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Phases 6 / 7b / 7c
|
|
2
|
+
* Phases 6 / 7b / 7c sequential orchestrator.
|
|
3
3
|
*
|
|
4
4
|
* The three post-pilot ingestion phases (docs-ingest, source-comments,
|
|
5
|
-
* rules-merge)
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
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
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
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
|
|
2
|
+
* Phases 6 / 7b / 7c sequential orchestrator.
|
|
3
3
|
*
|
|
4
4
|
* The three post-pilot ingestion phases (docs-ingest, source-comments,
|
|
5
|
-
* rules-merge)
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
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
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
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
|
-
//
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
//
|
|
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
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
|
1
|
+
{"version":3,"file":"parallel-678.js","sourceRoot":"","sources":["../../../src/init/phases/parallel-678.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;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/D,IAAI,KAAK,CAAC,YAAY,KAAK,eAAe,EAAE,CAAC;QAC3C,OAAO;YACL,MAAM,EAAE,OAAO;YACf,KAAK,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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
|
-
|
|
51
|
+
decsWritten: {
|
|
52
52
|
id: string;
|
|
53
53
|
path: string;
|
|
54
54
|
sourceFile: string;
|
|
55
|
+
slug: string;
|
|
56
|
+
status: "accepted";
|
|
55
57
|
}[];
|
|
56
|
-
|
|
58
|
+
invsWritten: {
|
|
57
59
|
id: string;
|
|
58
60
|
path: string;
|
|
59
61
|
sourceFile: string;
|
|
62
|
+
slug: string;
|
|
63
|
+
status: "accepted";
|
|
60
64
|
}[];
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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,CAAC,CAAC;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CACzC,QAAgB,EAChB,IAAgC;IAEhC,MAAM,GAAG,GAAG,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IAChD,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,MAAM,GAAG,GAAG,GAAG,GAAG,MAAM,CAAC;IACzB,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAC1D,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACrB,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,QAAgB;IAEhB,MAAM,GAAG,GAAG,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IAChD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAClC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAA+B,CAAC;IAC7E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,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,C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EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;YAC/B,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY;YACpC,eAAe,EAAE,IAAI,CAAC,IAAI,CAAC,eAAe;YAC1C,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,cAAc;YACxC,kBAAkB,EAAE,IAAI,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 {
|
|
@@ -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
|
-
*
|
|
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" | "
|
|
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
|
-
*
|
|
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
|
|
1
|
+
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../../../src/init/rules-merge/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;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,GAAqB,EAAE,CAAC;IACjC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,IAA4B,EAAQ,EAAE;QAClE,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAChC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,OAAO;QAC7B,IAAI,EAAE,CAAC;QACP,IAAI,CAAC;YACH,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;QACT,CAAC;QACD,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE;YAAE,OAAO;QACzB,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IACtE,CAAC,CAAC;IACF,OAAO,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;IACvC,OAAO,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC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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
|
|
2
|
+
* Phase 7c orchestrator (v0.5.0 SoT model).
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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
|
-
*
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
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 = "
|
|
38
|
+
export type RuleClassKind = "decision" | "domain-rule" | "constraint" | "informational" | "operator-keep";
|
|
22
39
|
export interface RuleClassification {
|
|
23
40
|
source: string;
|
|
24
|
-
level:
|
|
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
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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 {};
|