@isaacriehm/cairn-core 0.4.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +162 -0
- package/dist/align-undo/log.js.map +1 -0
- package/dist/align-undo/undo.d.ts +65 -0
- package/dist/align-undo/undo.js +397 -0
- package/dist/align-undo/undo.js.map +1 -0
- package/dist/attention/bulk-accept.js +9 -22
- package/dist/attention/bulk-accept.js.map +1 -1
- package/dist/attention/dedup.js +1 -47
- package/dist/attention/dedup.js.map +1 -1
- package/dist/attention/serve/api.js +3 -17
- package/dist/attention/serve/api.js.map +1 -1
- package/dist/attention/serve/index.js +3 -3
- package/dist/attention/serve/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 +7 -0
- package/dist/fix-align/index.js +6 -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/fix-align/sentinel.d.ts +59 -0
- package/dist/fix-align/sentinel.js +149 -0
- package/dist/fix-align/sentinel.js.map +1 -0
- package/dist/fs.d.ts +5 -0
- package/dist/fs.js +11 -0
- package/dist/fs.js.map +1 -0
- package/dist/gc/apply.js +4 -4
- package/dist/gc/apply.js.map +1 -1
- 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 +56 -0
- package/dist/ground/anchor-map.js.map +1 -0
- package/dist/ground/frontmatter.d.ts +12 -0
- package/dist/ground/frontmatter.js +28 -0
- package/dist/ground/frontmatter.js.map +1 -1
- package/dist/ground/index.d.ts +10 -3
- package/dist/ground/index.js +9 -3
- 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 +135 -10
- package/dist/ground/schemas.js.map +1 -1
- package/dist/ground/scope-index.js +4 -4
- 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 +79 -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 +62 -0
- package/dist/ground/sot-cache.js.map +1 -0
- package/dist/ground/topic-index.d.ts +27 -0
- package/dist/ground/topic-index.js +82 -0
- package/dist/ground/topic-index.js.map +1 -0
- 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/sot-align.d.ts +166 -0
- package/dist/hooks/post-tool-use/sot-align.js +1306 -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 -410
- 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.js +6 -6
- package/dist/init/mapper.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 -162
- 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 +214 -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 -361
- 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/schemas.d.ts +45 -8
- package/dist/mcp/schemas.js +43 -7
- 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/index.d.ts +1 -1
- package/dist/mcp/tools/index.js +3 -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 +5 -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 +781 -5
- 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
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared SoT-alignment helpers used by both Layer A (PostToolUse hook,
|
|
3
|
+
* `hooks/post-tool-use/sot-align.ts`) and Layer B (git pre-commit
|
|
4
|
+
* hook, `hooks/pre-commit/sot-align-precommit.ts`). The Tier 1
|
|
5
|
+
* deterministic match (Jaccard ≥ 0.85, 3-shingle ≥ 0.6, length ratio
|
|
6
|
+
* 0.5–2.0) and the Jaccard top-K candidate pre-filter live here so
|
|
7
|
+
* both layers compare against the same calibrated thresholds.
|
|
8
|
+
*/
|
|
9
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
import { jaccard } from "../text/jaccard.js";
|
|
12
|
+
import { walkSourceComments } from "../init/source-comments/index.js";
|
|
13
|
+
import { decisionsDir, invariantsDir } from "../ground/index.js";
|
|
14
|
+
/* -------------------------------------------------------------------------- */
|
|
15
|
+
/* Tunables — shared between Layer A and Layer B */
|
|
16
|
+
/* -------------------------------------------------------------------------- */
|
|
17
|
+
// Tier 1 deterministic floors — internal to `tier1PickWithBody`.
|
|
18
|
+
const TIER1_JACCARD_FLOOR = 0.85;
|
|
19
|
+
const TIER1_SHINGLE_FLOOR = 0.6;
|
|
20
|
+
const TIER1_LENGTH_RATIO_MIN = 0.5;
|
|
21
|
+
const TIER1_LENGTH_RATIO_MAX = 2.0;
|
|
22
|
+
// Jaccard pre-filter floors — exposed because Layer A and Layer B
|
|
23
|
+
// both pass them into `topKCandidates`.
|
|
24
|
+
export const TIER2_JACCARD_FLOOR = 0.3;
|
|
25
|
+
export const TOP_K_CANDIDATES = 5;
|
|
26
|
+
/* -------------------------------------------------------------------------- */
|
|
27
|
+
/* File-type guard */
|
|
28
|
+
/* -------------------------------------------------------------------------- */
|
|
29
|
+
export function isMarkdownPath(filePath) {
|
|
30
|
+
return filePath.endsWith(".md") || filePath.endsWith(".mdx");
|
|
31
|
+
}
|
|
32
|
+
/* -------------------------------------------------------------------------- */
|
|
33
|
+
/* Block extraction — wraps phase 7b's walker */
|
|
34
|
+
/* -------------------------------------------------------------------------- */
|
|
35
|
+
/**
|
|
36
|
+
* Extract prose blocks from the given file. License headers are
|
|
37
|
+
* filtered out — they are operator-supplied legal text and never the
|
|
38
|
+
* subject of a decision/invariant cite.
|
|
39
|
+
*/
|
|
40
|
+
export function extractBlocks(repoRoot, filePath) {
|
|
41
|
+
const walk = walkSourceComments({
|
|
42
|
+
repoRoot,
|
|
43
|
+
onlyFiles: [filePath],
|
|
44
|
+
});
|
|
45
|
+
return walk.blocks.filter((b) => b.kind !== "license");
|
|
46
|
+
}
|
|
47
|
+
export function topKCandidates(blockTokens, entries, threshold, topK) {
|
|
48
|
+
const scored = [];
|
|
49
|
+
for (const e of entries) {
|
|
50
|
+
const candidateTokens = new Set(e.tokens);
|
|
51
|
+
const score = jaccard(blockTokens, candidateTokens);
|
|
52
|
+
if (score < threshold)
|
|
53
|
+
continue;
|
|
54
|
+
scored.push({
|
|
55
|
+
id: e.dec_id,
|
|
56
|
+
similarity: score,
|
|
57
|
+
body_hash: e.body_hash,
|
|
58
|
+
sot_path: e.sot_path,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
scored.sort((a, b) => b.similarity - a.similarity);
|
|
62
|
+
return scored.slice(0, topK);
|
|
63
|
+
}
|
|
64
|
+
/* -------------------------------------------------------------------------- */
|
|
65
|
+
/* Tier 1 deterministic match */
|
|
66
|
+
/* -------------------------------------------------------------------------- */
|
|
67
|
+
function shingleSet(text, n) {
|
|
68
|
+
const cleaned = text
|
|
69
|
+
.toLowerCase()
|
|
70
|
+
.replace(/[^a-z0-9\s]/g, " ")
|
|
71
|
+
.replace(/\s+/g, " ")
|
|
72
|
+
.trim();
|
|
73
|
+
const tokens = cleaned.split(" ").filter((w) => w.length > 0);
|
|
74
|
+
if (tokens.length < n)
|
|
75
|
+
return new Set([cleaned]);
|
|
76
|
+
const out = new Set();
|
|
77
|
+
for (let i = 0; i <= tokens.length - n; i += 1) {
|
|
78
|
+
out.add(tokens.slice(i, i + n).join(" "));
|
|
79
|
+
}
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
function shingleOverlap(a, b) {
|
|
83
|
+
if (a.size === 0 || b.size === 0)
|
|
84
|
+
return 0;
|
|
85
|
+
let inter = 0;
|
|
86
|
+
for (const s of a)
|
|
87
|
+
if (b.has(s))
|
|
88
|
+
inter += 1;
|
|
89
|
+
// Symmetric Jaccard — `min(|a|,|b|)` would let a short fragment of a
|
|
90
|
+
// long DEC pass Tier 1 even though the bodies aren't really verbatim
|
|
91
|
+
// duplicates. The length-ratio bound (0.5-2.0) constrains this, but
|
|
92
|
+
// Jaccard makes the threshold mean the same thing in both directions.
|
|
93
|
+
const union = a.size + b.size - inter;
|
|
94
|
+
return union === 0 ? 0 : inter / union;
|
|
95
|
+
}
|
|
96
|
+
function lengthRatio(a, b) {
|
|
97
|
+
if (b.length === 0)
|
|
98
|
+
return Number.POSITIVE_INFINITY;
|
|
99
|
+
return a.length / b.length;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Walk the top-K candidates and return the first one whose body
|
|
103
|
+
* passes all Tier 1 floors against the block prose. Returns null when
|
|
104
|
+
* no candidate qualifies. Reads the candidate body from the live
|
|
105
|
+
* ledger via `readEntityBody`.
|
|
106
|
+
*/
|
|
107
|
+
export function tier1PickWithBody(repoRoot, block, candidates) {
|
|
108
|
+
if (candidates.length === 0)
|
|
109
|
+
return null;
|
|
110
|
+
const blockShingles = shingleSet(block.prose, 3);
|
|
111
|
+
for (const cand of candidates) {
|
|
112
|
+
if (cand.similarity < TIER1_JACCARD_FLOOR)
|
|
113
|
+
continue;
|
|
114
|
+
const candBody = readEntityBody(repoRoot, cand.id);
|
|
115
|
+
if (candBody === null)
|
|
116
|
+
continue;
|
|
117
|
+
const overlap = shingleOverlap(blockShingles, shingleSet(candBody, 3));
|
|
118
|
+
if (overlap < TIER1_SHINGLE_FLOOR)
|
|
119
|
+
continue;
|
|
120
|
+
const ratio = lengthRatio(block.prose, candBody);
|
|
121
|
+
if (ratio < TIER1_LENGTH_RATIO_MIN || ratio > TIER1_LENGTH_RATIO_MAX)
|
|
122
|
+
continue;
|
|
123
|
+
return cand;
|
|
124
|
+
}
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
/* -------------------------------------------------------------------------- */
|
|
128
|
+
/* Ledger body reader */
|
|
129
|
+
/* -------------------------------------------------------------------------- */
|
|
130
|
+
/**
|
|
131
|
+
* Read the body (post-frontmatter) of a DEC/INV by id. Returns null
|
|
132
|
+
* when the entity file is missing or unreadable. Strips the leading
|
|
133
|
+
* `---\n…\n---\n?` frontmatter block when present.
|
|
134
|
+
*/
|
|
135
|
+
export function readEntityBody(repoRoot, id) {
|
|
136
|
+
if (repoRoot.length === 0)
|
|
137
|
+
return null;
|
|
138
|
+
const dir = id.startsWith("INV-") ? invariantsDir(repoRoot) : decisionsDir(repoRoot);
|
|
139
|
+
const abs = join(dir, `${id}.md`);
|
|
140
|
+
if (!existsSync(abs))
|
|
141
|
+
return null;
|
|
142
|
+
let raw;
|
|
143
|
+
try {
|
|
144
|
+
raw = readFileSync(abs, "utf8");
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
const m = raw.match(/^---\n[\s\S]*?\n---\n?/);
|
|
150
|
+
return m === null ? raw.trim() : raw.slice(m[0].length).trim();
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=sot-align-common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sot-align-common.js","sourceRoot":"","sources":["../../src/hooks/sot-align-common.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAqB,MAAM,kCAAkC,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAsB,MAAM,oBAAoB,CAAC;AAErF,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF,iEAAiE;AACjE,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAEnC,kEAAkE;AAClE,wCAAwC;AACxC,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AACvC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,OAAO,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC/D,CAAC;AAED,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,QAAgB,EAAE,QAAgB;IAC9D,MA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AC,CAAC;IACrF,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAClC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAClC,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC9C,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;AACjE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,11 @@ export * from "./gc/index.js";
|
|
|
16
16
|
export * from "./ground/index.js";
|
|
17
17
|
export { clearDeferState, deferStatePath, isDeferActive, readDeferState, writeDeferState, } from "./hooks/defer.js";
|
|
18
18
|
export type { DeferKind, DeferState } from "./hooks/defer.js";
|
|
19
|
+
export * from "./align-undo/index.js";
|
|
20
|
+
export * from "./drain/index.js";
|
|
21
|
+
export * from "./fix-align/index.js";
|
|
19
22
|
export * from "./hooks/post-tool-use/index.js";
|
|
23
|
+
export * from "./hooks/pre-commit/index.js";
|
|
20
24
|
export * from "./init/index.js";
|
|
21
25
|
export * from "./join/index.js";
|
|
22
26
|
export * from "./mcp/index.js";
|
|
@@ -29,3 +33,4 @@ export * from "./session/index.js";
|
|
|
29
33
|
export * from "./session-start/index.js";
|
|
30
34
|
export * from "./status-line/index.js";
|
|
31
35
|
export { appendTrace, nowEvent, traceDir, traceFilePath, type TraceEvent, type TraceSource, } from "./trace/index.js";
|
|
36
|
+
export { jaccard, tokenize } from "./text/jaccard.js";
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,11 @@ export * from "./doctor/index.js";
|
|
|
30
30
|
export * from "./gc/index.js";
|
|
31
31
|
export * from "./ground/index.js";
|
|
32
32
|
export { clearDeferState, deferStatePath, isDeferActive, readDeferState, writeDeferState, } from "./hooks/defer.js";
|
|
33
|
+
export * from "./align-undo/index.js";
|
|
34
|
+
export * from "./drain/index.js";
|
|
35
|
+
export * from "./fix-align/index.js";
|
|
33
36
|
export * from "./hooks/post-tool-use/index.js";
|
|
37
|
+
export * from "./hooks/pre-commit/index.js";
|
|
34
38
|
export * from "./init/index.js";
|
|
35
39
|
export * from "./join/index.js";
|
|
36
40
|
export * from "./mcp/index.js";
|
|
@@ -43,4 +47,5 @@ export * from "./session/index.js";
|
|
|
43
47
|
export * from "./session-start/index.js";
|
|
44
48
|
export * from "./status-line/index.js";
|
|
45
49
|
export { appendTrace, nowEvent, traceDir, traceFilePath, } from "./trace/index.js";
|
|
50
|
+
export { jaccard, tokenize } from "./text/jaccard.js";
|
|
46
51
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,2EAA2E;AAC3E,0EAA0E;AAC1E,yEAAyE;AACzE,wEAAwE;AACxE,wEAAwE;AACxE,oDAAoD;AACpD,SAAS,WAAW;IAClB,IAAI,OAAO,iBAAiB,KAAK,QAAQ;QAAE,OAAO,iBAAiB,CAAC;IACpE,MAAM,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CA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B,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,aAAa,GAGd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/init/index.d.ts
CHANGED
|
@@ -34,5 +34,7 @@ export { buildRepoSummary } from "./walker.js";
|
|
|
34
34
|
export type { BuildRepoSummaryOptions, ManifestPreview, RepoSummary, } from "./walker.js";
|
|
35
35
|
export { updateWorkflowSlugBlock } from "./workflow-block.js";
|
|
36
36
|
export type { UpdateResult as WorkflowSlugUpdateResult, WorkflowSlugBlockUpdate, } from "./workflow-block.js";
|
|
37
|
-
export { PHASE_IDS, INIT_STATE_PATH, phaseStateAbsPath, readPhaseState, writePhaseState, clearPhaseState, freshPhaseState, resumePhases, nextPhaseAfter, advancePhase, MAPPER_OUTPUT_PATH, mapperOutputAbsPath, readMapperOutputFile, writeMapperOutputFile, toMapperResultPersisted, runPhase1Detect, runPhase2Walker, runPhase3Mapper, runPhase3bSeed, runPhase4Pilot, runPhase5Brand, runPhase6DocsIngest, runPhase7bSourceComments, runPhase7cRulesMerge, runPhase8Baseline, runPhase10Strip, runPhase12Multidev, runPhases678Parallel, SOURCE_COMMENTS_WALK_PATH, sourceCommentsWalkAbsPath, readSourceCommentsWalkFile, writeSourceCommentsWalkFile, to7bResultPersisted, } from "./phases/index.js";
|
|
38
|
-
export type { PhaseId, PhaseState, PhaseOutputs, PhaseResult, PhaseQuestion, PhaseOption, PhaseError, ResumeReport, MapperResultPersisted, IngestSourceCommentsResultPersisted, } from "./phases/index.js";
|
|
37
|
+
export { PHASE_IDS, INIT_STATE_PATH, phaseStateAbsPath, readPhaseState, writePhaseState, clearPhaseState, freshPhaseState, resumePhases, nextPhaseAfter, advancePhase, MAPPER_OUTPUT_PATH, mapperOutputAbsPath, readMapperOutputFile, writeMapperOutputFile, toMapperResultPersisted, runPhase1Detect, runPhase2Walker, runPhase3Mapper, runPhase3bSeed, runPhase4Pilot, runPhase5Brand, runPhase5bTopicIndex, runPhase6DocsIngest, runPhase7bSourceComments, runPhase7cRulesMerge, runPhase8Baseline, runPhase10Strip, runPhase12Multidev, runPhases678Parallel, SOURCE_COMMENTS_WALK_PATH, sourceCommentsWalkAbsPath, readSourceCommentsWalkFile, writeSourceCommentsWalkFile, to7bResultPersisted, } from "./phases/index.js";
|
|
38
|
+
export type { PhaseId, PhaseState, PhaseOutputs, PhaseResult, PhaseQuestion, PhaseOption, PhaseError, ResumeReport, MapperResultPersisted, IngestSourceCommentsResultPersisted, TopicIndexPhaseOutput, } from "./phases/index.js";
|
|
39
|
+
export { buildTopicIndex, walkProseBlocks, resolveTopics, makeHaikuJudge, } from "./topic-index/index.js";
|
|
40
|
+
export type { BuildTopicIndexArgs, BuildTopicIndexResult, ProseBlock, ProseBlockKind, ResolveOptions, ResolveResult, SemanticJudge, SemanticVerdict, JudgeOptions, } from "./topic-index/index.js";
|
package/dist/init/index.js
CHANGED
|
@@ -18,5 +18,6 @@ export { seedCairnLayout, templatesRoot } from "./seed.js";
|
|
|
18
18
|
export { editYaml, freeTextWithDefault, squareIntoSquareHole, yesNo, } from "./prompts.js";
|
|
19
19
|
export { buildRepoSummary } from "./walker.js";
|
|
20
20
|
export { updateWorkflowSlugBlock } from "./workflow-block.js";
|
|
21
|
-
export { PHASE_IDS, INIT_STATE_PATH, phaseStateAbsPath, readPhaseState, writePhaseState, clearPhaseState, freshPhaseState, resumePhases, nextPhaseAfter, advancePhase, MAPPER_OUTPUT_PATH, mapperOutputAbsPath, readMapperOutputFile, writeMapperOutputFile, toMapperResultPersisted, runPhase1Detect, runPhase2Walker, runPhase3Mapper, runPhase3bSeed, runPhase4Pilot, runPhase5Brand, runPhase6DocsIngest, runPhase7bSourceComments, runPhase7cRulesMerge, runPhase8Baseline, runPhase10Strip, runPhase12Multidev, runPhases678Parallel, SOURCE_COMMENTS_WALK_PATH, sourceCommentsWalkAbsPath, readSourceCommentsWalkFile, writeSourceCommentsWalkFile, to7bResultPersisted, } from "./phases/index.js";
|
|
21
|
+
export { PHASE_IDS, INIT_STATE_PATH, phaseStateAbsPath, readPhaseState, writePhaseState, clearPhaseState, freshPhaseState, resumePhases, nextPhaseAfter, advancePhase, MAPPER_OUTPUT_PATH, mapperOutputAbsPath, readMapperOutputFile, writeMapperOutputFile, toMapperResultPersisted, runPhase1Detect, runPhase2Walker, runPhase3Mapper, runPhase3bSeed, runPhase4Pilot, runPhase5Brand, runPhase5bTopicIndex, runPhase6DocsIngest, runPhase7bSourceComments, runPhase7cRulesMerge, runPhase8Baseline, runPhase10Strip, runPhase12Multidev, runPhases678Parallel, SOURCE_COMMENTS_WALK_PATH, sourceCommentsWalkAbsPath, readSourceCommentsWalkFile, writeSourceCommentsWalkFile, to7bResultPersisted, } from "./phases/index.js";
|
|
22
|
+
export { buildTopicIndex, walkProseBlocks, resolveTopics, makeHaikuJudge, } from "./topic-index/index.js";
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
package/dist/init/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/init/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,yBAAyB,EACzB,aAAa,EACb,YAAY,EACZ,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,E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KN,MAAM,cAAc,CAAC;AAStB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAM/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAK9D,OAAO,EACL,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/init/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,yBAAyB,EACzB,aAAa,EACb,YAAY,EACZ,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKpE,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAO7B,OAAO,EACL,YAAY,EACZ,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,SAAS,IAAI,wBAAwB,EACrC,iBAAiB,EACjB,cAA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B,uBAAuB,EACvB,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAe3B,OAAO,EACL,eAAe,EACf,eAAe,EACf,aAAa,EACb,cAAc,GACf,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,81 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Phase 6 — docs ingestion
|
|
2
|
+
* Phase 6 — docs ingestion (v0.5.0 SoT model).
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* Reads the topic-index built by phase 5b, filters to entries whose SoT
|
|
5
|
+
* source lives under `docs/*`, and emits verbatim DEC files under
|
|
6
|
+
* `.cairn/ground/decisions/`. Auto-promoted to `status: accepted`. No
|
|
7
|
+
* draft inbox, no LLM paraphrase — the doc paragraph itself IS the
|
|
8
|
+
* canonical body, recorded with `sot_kind: path` so the lens renders
|
|
9
|
+
* the live source on every read.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
11
|
+
* Per-entry Haiku call decides `kind` only (decision / domain-rule /
|
|
12
|
+
* voice-guidelines / api-docs / other). The first two emit a DEC; the
|
|
13
|
+
* rest are skipped at this layer (voice + canonical-topic flows are
|
|
14
|
+
* handled by other tooling now — they were file-level concerns under
|
|
15
|
+
* the v0.4.x model and have no clean paragraph-level analogue).
|
|
12
16
|
*/
|
|
17
|
+
import { type TopicIndexEntry } from "../ground/index.js";
|
|
13
18
|
export interface DocCandidate {
|
|
14
|
-
/** Repo-relative path. */
|
|
15
19
|
path: string;
|
|
16
|
-
/** Byte count for largest-first ordering. */
|
|
17
20
|
size: number;
|
|
18
|
-
/** Bucket reported on the per-folder progress display. */
|
|
19
21
|
group: string;
|
|
20
22
|
}
|
|
21
23
|
export type DocClassificationKind = "decision" | "domain-rule" | "voice-guidelines" | "api-docs" | "other";
|
|
22
24
|
export interface DocClassification {
|
|
23
25
|
kind: DocClassificationKind;
|
|
24
26
|
proposedTitle: string;
|
|
25
|
-
proposedRationale: string;
|
|
26
|
-
topicSlug: string;
|
|
27
27
|
}
|
|
28
28
|
export interface ClassifiedDoc {
|
|
29
29
|
candidate: DocCandidate;
|
|
30
30
|
classification: DocClassification;
|
|
31
|
-
/** Set when the Haiku call failed; the doc is skipped downstream. */
|
|
32
31
|
failed: boolean;
|
|
33
32
|
errorMessage?: string;
|
|
34
33
|
}
|
|
35
34
|
export interface IngestionResult {
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
/** DEC drafts written to decisions/_inbox/. */
|
|
39
|
-
decDraftsWritten: {
|
|
35
|
+
/** Verbatim DEC files written under `.cairn/ground/decisions/`. */
|
|
36
|
+
decsWritten: {
|
|
40
37
|
id: string;
|
|
41
38
|
path: string;
|
|
42
39
|
sourceFile: string;
|
|
40
|
+
slug: string;
|
|
43
41
|
}[];
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}[];
|
|
49
|
-
/** brand/voice.md was rewritten from the placeholder. */
|
|
50
|
-
voiceUpdated: boolean;
|
|
51
|
-
/** Group → progress row text shown during ingestion. */
|
|
52
|
-
groupCounts: {
|
|
53
|
-
group: string;
|
|
54
|
-
drafts: number;
|
|
55
|
-
total: number;
|
|
42
|
+
/** Topic-index entries that were not emitted, with reasons. */
|
|
43
|
+
skipped: {
|
|
44
|
+
slug: string;
|
|
45
|
+
reason: string;
|
|
56
46
|
}[];
|
|
47
|
+
/** Number of topic-index entries considered (sot_source under docs/). */
|
|
48
|
+
scannedEntries: number;
|
|
57
49
|
}
|
|
58
50
|
export interface RunDocsIngestionArgs {
|
|
59
51
|
repoRoot: string;
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
/** Smoke override — feed canned classifications keyed by slug. */
|
|
53
|
+
mockClassify?: (entry: TopicIndexEntry, body: string) => DocClassification;
|
|
54
|
+
/** Caller-supplied id collision Set (parallel pipeline). */
|
|
55
|
+
existingDecIds?: Set<string>;
|
|
56
|
+
/** Progress callback fired once per emitted entry. */
|
|
57
|
+
onEntryProgress?: (row: {
|
|
58
|
+
slug: string;
|
|
59
|
+
emitted: boolean;
|
|
64
60
|
total: number;
|
|
65
|
-
ok: boolean;
|
|
66
61
|
}) => void;
|
|
67
|
-
/**
|
|
68
|
-
* Skip the LLM round-trip — used by smokes. When set, every candidate is
|
|
69
|
-
* classified as "other" with empty fields; nothing is written.
|
|
70
|
-
*/
|
|
71
|
-
mockClassify?: (candidate: DocCandidate, body: string) => DocClassification;
|
|
72
|
-
/**
|
|
73
|
-
* Caller-supplied DEC id Set. When provided, skips the local
|
|
74
|
-
* `scanExistingDecisionIds` and mutates the supplied Set as ids are
|
|
75
|
-
* allocated. The parallel pipeline orchestrator passes one Set across
|
|
76
|
-
* all 3 phases so concurrent allocations don't collide on disk.
|
|
77
|
-
*/
|
|
78
|
-
existingDecIds?: Set<string>;
|
|
79
62
|
}
|
|
80
63
|
export declare function discoverDocs(repoRoot: string): DocCandidate[];
|
|
81
64
|
export declare function runDocsIngestion(args: RunDocsIngestionArgs): Promise<IngestionResult>;
|