@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
|
@@ -1,20 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Phase 7b orchestrator — walker → classifier →
|
|
2
|
+
* Phase 7b orchestrator (v0.5.0 SoT model) — walker → classifier →
|
|
3
|
+
* topic-index lookup → emit-or-cite → strip-replace.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
5
|
+
* Plan §5.3 algorithm:
|
|
6
|
+
* 1. Walk source files for prose-bearing comments (existing logic).
|
|
7
|
+
* 2. Classify via Haiku, kind only — `rationale` / `constraint` /
|
|
8
|
+
* `citation` / `license` / `other`. No paraphrased title, no rewritten
|
|
9
|
+
* invariant body, no canonical-topic suggestion.
|
|
10
|
+
* 3. Build a content-fingerprint slug for every rationale + constraint
|
|
11
|
+
* block. Look it up in the existing topic-index:
|
|
12
|
+
* a. **Cite-existing** — slug already owned by a docs/CLAUDE.md/
|
|
13
|
+
* AGENTS.md/rule entry that has been emitted. Strip-replace
|
|
14
|
+
* inserts `// §DEC-<existing>` (or `§INV-<existing>`) at the
|
|
15
|
+
* comment's offset. No new ground-state file is written.
|
|
16
|
+
* b. **Novel** — slug not in the topic-index, or owned by an
|
|
17
|
+
* un-emitted entry. Add the block to the topic-index as a
|
|
18
|
+
* new source-comment SoT entry; emit a verbatim DEC/INV via
|
|
19
|
+
* `emitFromTopicIndex` with `sot_kind: "ledger"`. After emit,
|
|
20
|
+
* strip-replace inserts `§DEC-<new>` / `§INV-<new>`.
|
|
21
|
+
* 4. Auto-promote — every newly-emitted entity ships with
|
|
22
|
+
* `status: accepted` (no `_inbox/` draft queue). Plan §1's pivot:
|
|
23
|
+
* the inbox-as-blocker was the bug; verbatim bodies + auto-promote
|
|
24
|
+
* remove the manual review step.
|
|
25
|
+
* 5. License + citation + other classifications → no-op (no DEC, no
|
|
26
|
+
* strip-replace). License blocks stay verbatim in source.
|
|
27
|
+
*
|
|
28
|
+
* Output side-effects (all relative to repoRoot):
|
|
29
|
+
* - `.cairn/ground/decisions/<DEC-id>.md` (one per novel rationale)
|
|
30
|
+
* - `.cairn/ground/invariants/<INV-id>.md` (one per novel constraint)
|
|
31
|
+
* - `.cairn/ground/topic-index.yaml` (extended with source-comment SoT entries)
|
|
32
|
+
* - `.cairn/ground/anchor-map.yaml` (one anchor per novel slug)
|
|
33
|
+
* - `.cairn/ground/sot-bindings.yaml` (forward+reverse for new ids)
|
|
34
|
+
* - `.cairn/ground/sot-cache.yaml` (token cache for Layer A)
|
|
35
|
+
* - `.cairn/ground/scope-index.yaml` (file → ids that landed in source)
|
|
36
|
+
* - `.cairn/baseline/source-comments-<ISO>.yaml` (full audit — every block + verdict)
|
|
37
|
+
* - source files (stripped & cited per replacement)
|
|
18
38
|
*/
|
|
19
39
|
import type { ProjectGlobs } from "../../sensors/types.js";
|
|
20
40
|
import type { ClassifyArgs, CommentClassification, CommentClassKind } from "./classify.js";
|
|
@@ -32,77 +52,81 @@ export interface IngestSourceCommentsArgs {
|
|
|
32
52
|
/** When set, override `Date.now()` for deterministic test outputs. */
|
|
33
53
|
nowIso?: string;
|
|
34
54
|
/**
|
|
35
|
-
* Project globs from `.cairn/config.yaml
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
55
|
+
* Project globs from `.cairn/config.yaml`. Carried through for
|
|
56
|
+
* compatibility with the parallel-678 caller; phase 7b under v0.5.0
|
|
57
|
+
* doesn't gate behavior on these (every novel rationale/constraint
|
|
58
|
+
* auto-promotes without scoring).
|
|
39
59
|
*/
|
|
40
60
|
globs?: ProjectGlobs;
|
|
41
|
-
/** Pilot module path (workflow.md `pilot_module`)
|
|
61
|
+
/** Pilot module path (workflow.md `pilot_module`). Same compat note. */
|
|
42
62
|
pilotModule?: string;
|
|
43
63
|
/**
|
|
44
|
-
* Caller-supplied DEC id Set
|
|
45
|
-
*
|
|
64
|
+
* Caller-supplied DEC id Set — kept for symmetry with phases 6 / 7c.
|
|
65
|
+
* Plan §3.2.1 derives content-addressed ids; collisions across phases
|
|
66
|
+
* are vanishingly unlikely so the Set is informational.
|
|
46
67
|
*/
|
|
47
68
|
existingDecIds?: Set<string>;
|
|
48
|
-
/**
|
|
49
|
-
* Caller-supplied INV id Set. Only 7b allocates invariant ids today,
|
|
50
|
-
* but the optional arg matches the DEC pattern for symmetry and lets
|
|
51
|
-
* future phases share the allocator.
|
|
52
|
-
*/
|
|
69
|
+
/** Caller-supplied INV id Set. Same compat note. */
|
|
53
70
|
existingInvIds?: Set<string>;
|
|
54
71
|
}
|
|
72
|
+
interface IngestEmittedRecord {
|
|
73
|
+
id: string;
|
|
74
|
+
path: string;
|
|
75
|
+
sourceFile: string;
|
|
76
|
+
slug: string;
|
|
77
|
+
status: "accepted";
|
|
78
|
+
}
|
|
79
|
+
interface IngestCiteRecord {
|
|
80
|
+
/** Pre-existing DEC/INV id the source comment was bound to. */
|
|
81
|
+
id: string;
|
|
82
|
+
/** Source file the cite landed in. */
|
|
83
|
+
sourceFile: string;
|
|
84
|
+
/** 1-indexed inclusive line range of the original source comment. */
|
|
85
|
+
lineRange: [number, number];
|
|
86
|
+
/** Slug that resolved the topic-index lookup. */
|
|
87
|
+
slug: string;
|
|
88
|
+
}
|
|
89
|
+
interface IngestSkipRecord {
|
|
90
|
+
blockId: string;
|
|
91
|
+
reason: string;
|
|
92
|
+
}
|
|
93
|
+
interface StripOutcomePersisted {
|
|
94
|
+
file: string;
|
|
95
|
+
applied: number;
|
|
96
|
+
skipped: {
|
|
97
|
+
blockId: string;
|
|
98
|
+
reason: string;
|
|
99
|
+
}[];
|
|
100
|
+
fileSkipReason: string | null;
|
|
101
|
+
}
|
|
55
102
|
export interface IngestSourceCommentsResult {
|
|
56
103
|
walk: WalkResult;
|
|
57
104
|
classifications: CommentClassification[];
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}[];
|
|
63
|
-
/**
|
|
64
|
-
* INV-<NNNN>.md files written directly to `.cairn/ground/invariants/`
|
|
65
|
-
* with `status: active`. The cairn-adopt summary surfaces the count.
|
|
66
|
-
*/
|
|
67
|
-
invariantsWritten: {
|
|
68
|
-
id: string;
|
|
69
|
-
path: string;
|
|
70
|
-
sourceFile: string;
|
|
71
|
-
}[];
|
|
72
|
-
/** Files where the source comment was successfully replaced with `// §INV-NNNN`. */
|
|
73
|
-
invariantStripFilesModified: number;
|
|
74
|
-
/** Number of strip items that landed (one per invariant comment). */
|
|
75
|
-
invariantStripItemsApplied: number;
|
|
76
|
-
/** Number of strip items that skipped (range-mismatch, dirty, missing, etc.). */
|
|
77
|
-
invariantStripItemsSkipped: number;
|
|
78
|
-
/** Per-file strip outcomes — debug surface for "wrote ground state but not source". */
|
|
79
|
-
invariantStripOutcomes: {
|
|
80
|
-
file: string;
|
|
81
|
-
applied: number;
|
|
82
|
-
skipped: {
|
|
83
|
-
blockId: string;
|
|
84
|
-
reason: string;
|
|
85
|
-
}[];
|
|
86
|
-
fileSkipReason: string | null;
|
|
87
|
-
}[];
|
|
88
|
-
/** Set when applyStripReplace threw — null on the happy path. */
|
|
89
|
-
invariantStripError: string | null;
|
|
105
|
+
/** Verbatim DEC files written under `.cairn/ground/decisions/`. */
|
|
106
|
+
decsWritten: IngestEmittedRecord[];
|
|
107
|
+
/** Verbatim INV files written under `.cairn/ground/invariants/`. */
|
|
108
|
+
invsWritten: IngestEmittedRecord[];
|
|
90
109
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
110
|
+
* Source comments that resolved to an already-emitted DEC/INV via the
|
|
111
|
+
* topic-index lookup. Strip-replace still fires for these — the source
|
|
112
|
+
* file gets the existing `§DEC-<hash>` / `§INV-<hash>` token.
|
|
94
113
|
*/
|
|
95
|
-
|
|
96
|
-
|
|
114
|
+
citesEmitted: IngestCiteRecord[];
|
|
115
|
+
/** Blocks the ingest stage skipped (license, citation, other, errors). */
|
|
116
|
+
skipped: IngestSkipRecord[];
|
|
117
|
+
stripFilesModified: number;
|
|
118
|
+
stripItemsApplied: number;
|
|
119
|
+
stripItemsSkipped: number;
|
|
120
|
+
stripOutcomes: StripOutcomePersisted[];
|
|
121
|
+
stripError: string | null;
|
|
97
122
|
auditPath: string;
|
|
98
123
|
auditRelPath: string;
|
|
99
|
-
invariantProposalsPath: string | null;
|
|
100
|
-
canonicalCitationsPath: string | null;
|
|
101
124
|
inputTokens: number;
|
|
102
125
|
outputTokens: number;
|
|
103
126
|
batchesRun: number;
|
|
104
127
|
batchesFailed: number;
|
|
105
|
-
/** Distribution by classifier kind. */
|
|
128
|
+
/** Distribution by classifier kind (rationale / constraint / etc.). */
|
|
106
129
|
kindCounts: Record<CommentClassKind, number>;
|
|
107
130
|
}
|
|
108
131
|
export declare function runSourceCommentsIngestion(args: IngestSourceCommentsArgs): Promise<IngestSourceCommentsResult>;
|
|
132
|
+
export {};
|