@reposkein/mcp 0.2.7 → 0.3.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/binary-digests.json +4 -4
- package/dist/SKILL.md +44 -1
- package/dist/cli/adr.d.ts +37 -0
- package/dist/cli/adr.js +231 -0
- package/dist/cli/adr.js.map +1 -0
- package/dist/cli/doctor.js +3 -0
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/doctorDecisions.d.ts +5 -0
- package/dist/cli/doctorDecisions.js +83 -0
- package/dist/cli/doctorDecisions.js.map +1 -0
- package/dist/guard/decisionValidation.d.ts +29 -0
- package/dist/guard/decisionValidation.js +51 -0
- package/dist/guard/decisionValidation.js.map +1 -0
- package/dist/guard/summaryValidation.d.ts +3 -0
- package/dist/guard/summaryValidation.js +5 -3
- package/dist/guard/summaryValidation.js.map +1 -1
- package/dist/index.d.ts +40 -0
- package/dist/index.js +119 -5
- package/dist/index.js.map +1 -1
- package/dist/indexer/decisionsAffected.d.ts +42 -0
- package/dist/indexer/decisionsAffected.js +149 -0
- package/dist/indexer/decisionsAffected.js.map +1 -0
- package/dist/indexer/runIndexer.d.ts +3 -0
- package/dist/indexer/runIndexer.js.map +1 -1
- package/dist/profile/decisions.d.ts +37 -0
- package/dist/profile/decisions.js +112 -0
- package/dist/profile/decisions.js.map +1 -0
- package/dist/profile/types.d.ts +8 -0
- package/dist/store/GraphStore.d.ts +5 -0
- package/dist/store/JsonlGraphStore.d.ts +1 -0
- package/dist/store/JsonlGraphStore.js +11 -2
- package/dist/store/JsonlGraphStore.js.map +1 -1
- package/dist/store/decisions.d.ts +113 -0
- package/dist/store/decisions.js +288 -0
- package/dist/store/decisions.js.map +1 -0
- package/dist/tools/getContextProfile.d.ts +1 -1
- package/dist/tools/getContextProfile.js +9 -1
- package/dist/tools/getContextProfile.js.map +1 -1
- package/dist/tools/getDecision.d.ts +6 -0
- package/dist/tools/getDecision.js +59 -0
- package/dist/tools/getDecision.js.map +1 -0
- package/dist/tools/impact.d.ts +1 -1
- package/dist/tools/impact.js +13 -1
- package/dist/tools/impact.js.map +1 -1
- package/dist/tools/indexerTools.d.ts +2 -0
- package/dist/tools/indexerTools.js +27 -0
- package/dist/tools/indexerTools.js.map +1 -1
- package/dist/tools/listDecisions.d.ts +19 -0
- package/dist/tools/listDecisions.js +93 -0
- package/dist/tools/listDecisions.js.map +1 -0
- package/dist/tools/reaffirmDecision.d.ts +11 -0
- package/dist/tools/reaffirmDecision.js +55 -0
- package/dist/tools/reaffirmDecision.js.map +1 -0
- package/dist/tools/recordDecision.d.ts +24 -0
- package/dist/tools/recordDecision.js +130 -0
- package/dist/tools/recordDecision.js.map +1 -0
- package/dist/tools/semanticFind.d.ts +9 -2
- package/dist/tools/semanticFind.js +44 -2
- package/dist/tools/semanticFind.js.map +1 -1
- package/dist/tools/setDecisionStatus.d.ts +8 -0
- package/dist/tools/setDecisionStatus.js +34 -0
- package/dist/tools/setDecisionStatus.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { neutralizeSummary } from "../guard/summaryValidation.js";
|
|
2
|
+
import { loadDecisions, nodeIdRepo, nodeIdSuffix, } from "../store/decisions.js";
|
|
3
|
+
const MAX_GOVERNING = 5;
|
|
4
|
+
/** Only these statuses govern: rejected never held; superseded is history
|
|
5
|
+
* (reachable through the chain, not worth profile budget). */
|
|
6
|
+
const GOVERNING_ORDER = {
|
|
7
|
+
accepted: 0,
|
|
8
|
+
proposed: 1,
|
|
9
|
+
deprecated: 2,
|
|
10
|
+
};
|
|
11
|
+
function directAnchor(rec, targetId) {
|
|
12
|
+
const targetSuffix = nodeIdSuffix(targetId);
|
|
13
|
+
return rec.anchors.find((a) => a.node_id === targetId || (targetSuffix !== null && nodeIdSuffix(a.node_id) === targetSuffix));
|
|
14
|
+
}
|
|
15
|
+
/** Path governance for one node. Anchor paths match only within the anchored
|
|
16
|
+
* node's own repo; authored `paths` are ROOT-relative and never cross into
|
|
17
|
+
* nested child repos (child file_paths are child-relative — same-looking
|
|
18
|
+
* strings, different coordinate system; anchor child code directly instead).
|
|
19
|
+
* `rootRepoId` undefined → unscoped (single-repo callers/tests). */
|
|
20
|
+
function coversPath(rec, filePath, nodeRepo, rootRepoId) {
|
|
21
|
+
if (filePath === "")
|
|
22
|
+
return false;
|
|
23
|
+
for (const a of rec.anchors) {
|
|
24
|
+
if (a.path === filePath && (nodeRepo === null || nodeIdRepo(a.node_id) === nodeRepo)) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (rootRepoId !== undefined && nodeRepo !== null && nodeRepo !== rootRepoId)
|
|
29
|
+
return false;
|
|
30
|
+
for (const p of rec.paths) {
|
|
31
|
+
if (p === filePath)
|
|
32
|
+
return true;
|
|
33
|
+
if (p.endsWith("/") && filePath.startsWith(p))
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
/** Pure filesystem + target-row computation (no store round-trips): which
|
|
39
|
+
* decisions govern this node, and which of them the node has drifted under. */
|
|
40
|
+
export function governingDecisionsFor(repoPath, target, rootRepoId) {
|
|
41
|
+
const { decisions } = loadDecisions(repoPath);
|
|
42
|
+
const matched = [];
|
|
43
|
+
const needing_review = [];
|
|
44
|
+
for (const rec of decisions) {
|
|
45
|
+
const order = GOVERNING_ORDER[rec.status];
|
|
46
|
+
if (order === undefined)
|
|
47
|
+
continue;
|
|
48
|
+
const anchor = directAnchor(rec, target.id);
|
|
49
|
+
let entry = null;
|
|
50
|
+
if (anchor) {
|
|
51
|
+
entry = {
|
|
52
|
+
id: rec.id,
|
|
53
|
+
title: neutralizeSummary(rec.title) ?? "",
|
|
54
|
+
status: rec.status,
|
|
55
|
+
via: "direct",
|
|
56
|
+
};
|
|
57
|
+
if (anchor.hash !== null && target.content_hash !== null) {
|
|
58
|
+
entry.anchor_state = anchor.hash === target.content_hash ? "current" : "stale";
|
|
59
|
+
if (entry.anchor_state === "stale" && rec.status === "accepted") {
|
|
60
|
+
needing_review.push(rec.id);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else if (coversPath(rec, target.file_path, target.repo_id || nodeIdRepo(target.id), rootRepoId)) {
|
|
65
|
+
entry = {
|
|
66
|
+
id: rec.id,
|
|
67
|
+
title: neutralizeSummary(rec.title) ?? "",
|
|
68
|
+
status: rec.status,
|
|
69
|
+
via: "contains",
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (entry)
|
|
73
|
+
matched.push(entry);
|
|
74
|
+
}
|
|
75
|
+
matched.sort((a, b) => {
|
|
76
|
+
const oa = GOVERNING_ORDER[a.status];
|
|
77
|
+
const ob = GOVERNING_ORDER[b.status];
|
|
78
|
+
if (oa !== ob)
|
|
79
|
+
return oa - ob;
|
|
80
|
+
// Ids embed the date — newest first, then lexicographic.
|
|
81
|
+
return a.id < b.id ? 1 : a.id > b.id ? -1 : 0;
|
|
82
|
+
});
|
|
83
|
+
const truncated = matched.length > MAX_GOVERNING;
|
|
84
|
+
return { decisions: matched.slice(0, MAX_GOVERNING), needing_review, truncated };
|
|
85
|
+
}
|
|
86
|
+
/** Impact-shaped governance: for each decision, which of the given nodes it
|
|
87
|
+
* governs (the target plus impacted rows). */
|
|
88
|
+
export function governingDecisionsForNodes(repoPath, nodes, rootRepoId) {
|
|
89
|
+
const { decisions } = loadDecisions(repoPath);
|
|
90
|
+
const out = [];
|
|
91
|
+
for (const rec of decisions) {
|
|
92
|
+
if (GOVERNING_ORDER[rec.status] === undefined)
|
|
93
|
+
continue;
|
|
94
|
+
const governs = [];
|
|
95
|
+
for (const n of nodes) {
|
|
96
|
+
if (directAnchor(rec, n.node_id) ||
|
|
97
|
+
coversPath(rec, n.file_path, nodeIdRepo(n.node_id), rootRepoId)) {
|
|
98
|
+
governs.push(n.node_id);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (governs.length > 0) {
|
|
102
|
+
out.push({
|
|
103
|
+
id: rec.id,
|
|
104
|
+
title: neutralizeSummary(rec.title) ?? "",
|
|
105
|
+
status: rec.status,
|
|
106
|
+
governs,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return out;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=decisions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decisions.js","sourceRoot":"","sources":["../../src/profile/decisions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EACL,aAAa,EACb,UAAU,EACV,YAAY,GAGb,MAAM,uBAAuB,CAAC;AAyB/B,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB;+DAC+D;AAC/D,MAAM,eAAe,GAA4C;IAC/D,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;IACX,UAAU,EAAE,CAAC;CACd,CAAC;AAEF,SAAS,YAAY,CAAC,GAAmB,EAAE,QAAgB;IACzD,MAAM,YAAY,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC5C,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,CACrB,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,OAAO,KAAK,QAAQ,IAAI,CAAC,YAAY,KAAK,IAAI,IAAI,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,YAAY,CAAC,CAChG,CAAC;AACJ,CAAC;AAED;;;;qEAIqE;AACrE,SAAS,UAAU,CACjB,GAAmB,EACnB,QAAgB,EAChB,QAAuB,EACvB,UAAmB;IAEnB,IAAI,QAAQ,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IAClC,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;QAC5B,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,UAAU,CAAC,CA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AC;AACb,CAAC"}
|
package/dist/profile/types.d.ts
CHANGED
|
@@ -32,6 +32,9 @@ export interface ProfileTarget {
|
|
|
32
32
|
summary: string | null;
|
|
33
33
|
stale: boolean;
|
|
34
34
|
repo_id?: string;
|
|
35
|
+
/** ADRs governing this node (max 5) — see profile/decisions.ts. Absent when
|
|
36
|
+
* the repo has no decisions touching it. */
|
|
37
|
+
decisions?: import("./decisions.js").GoverningDecision[];
|
|
35
38
|
}
|
|
36
39
|
export interface ContextProfile {
|
|
37
40
|
target: ProfileTarget;
|
|
@@ -39,6 +42,11 @@ export interface ContextProfile {
|
|
|
39
42
|
downstream: NeighborEntry[];
|
|
40
43
|
inlined_context: string;
|
|
41
44
|
enrichment_needed: string[];
|
|
45
|
+
/** Accepted decisions whose anchor on the target went stale. Deliberately
|
|
46
|
+
* NOT folded into enrichment_needed — that field's contract is node ids
|
|
47
|
+
* fed to write_semantic_summary. Re-read these and conform / supersede /
|
|
48
|
+
* reaffirm instead. */
|
|
49
|
+
decisions_needing_review?: string[];
|
|
42
50
|
truncated?: {
|
|
43
51
|
upstream: boolean;
|
|
44
52
|
downstream: boolean;
|
|
@@ -67,6 +67,11 @@ export interface GraphStore {
|
|
|
67
67
|
/** Function/Class/Interface/Enum corpus nodes for all repoIds, sorted by id.
|
|
68
68
|
* Used by the shared BM25F scorer for semantic_find. */
|
|
69
69
|
searchCorpus(repoIds: string[]): Promise<CorpusNode[]>;
|
|
70
|
+
/** Optional: live nodes whose content_hash equals hash, ordered by id.
|
|
71
|
+
* Used by decision-anchor recovery ("moved" state) — the recorded hash is
|
|
72
|
+
* the only signal that survives a rename. Stores that don't implement it
|
|
73
|
+
* degrade those anchors to "orphaned". */
|
|
74
|
+
findByContentHash?(repoIds: string[], hash: string): Promise<TargetRow[]>;
|
|
70
75
|
/** Raw read-only Cypher (read_cypher tool only). Stores without a Cypher
|
|
71
76
|
* engine throw CypherUnsupportedError. */
|
|
72
77
|
runRead(query: string, params?: Record<string, unknown>, opts?: {
|
|
@@ -25,6 +25,7 @@ export declare class JsonlGraphStore implements GraphStore {
|
|
|
25
25
|
/** Reloads the graph if either ROOT file's mtime changed since last load. */
|
|
26
26
|
private ensureFresh;
|
|
27
27
|
getNode(repoIds: string[], id: string): Promise<TargetRow | null>;
|
|
28
|
+
findByContentHash(repoIds: string[], hash: string): Promise<TargetRow[]>;
|
|
28
29
|
resolveByPathAndName(repoIds: string[], filePath: string, name: string): Promise<TargetRow[]>;
|
|
29
30
|
resolveByName(repoIds: string[], name: string): Promise<TargetRow[]>;
|
|
30
31
|
callers(repoIds: string[], id: string, limit: number): Promise<NeighborRow[]>;
|
|
@@ -29,7 +29,8 @@ function toTargetRow(n) {
|
|
|
29
29
|
repo_id: n.repoId,
|
|
30
30
|
name,
|
|
31
31
|
qualified_name: str(n.props.qualified_name) ?? name,
|
|
32
|
-
|
|
32
|
+
// File/Directory nodes carry `path` instead of `file_path`.
|
|
33
|
+
file_path: str(n.props.file_path) ?? str(n.props.path) ?? "",
|
|
33
34
|
start_line: num(n.props.start_line),
|
|
34
35
|
end_line: num(n.props.end_line),
|
|
35
36
|
semantic_summary: str(n.props.semantic_summary),
|
|
@@ -173,6 +174,13 @@ export class JsonlGraphStore {
|
|
|
173
174
|
const n = this.graph.byId.get(id);
|
|
174
175
|
return n && repoIds.includes(n.repoId) ? toTargetRow(n) : null;
|
|
175
176
|
}
|
|
177
|
+
async findByContentHash(repoIds, hash) {
|
|
178
|
+
this.ensureFresh();
|
|
179
|
+
return this.graph.nodes
|
|
180
|
+
.filter((n) => repoIds.includes(n.repoId) && str(n.props.content_hash) === hash)
|
|
181
|
+
.sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0))
|
|
182
|
+
.map(toTargetRow);
|
|
183
|
+
}
|
|
176
184
|
async resolveByPathAndName(repoIds, filePath, name) {
|
|
177
185
|
this.ensureFresh();
|
|
178
186
|
return this.graph.nodes
|
|
@@ -285,7 +293,8 @@ export class JsonlGraphStore {
|
|
|
285
293
|
qualified_name: str(n.props.qualified_name) ?? name,
|
|
286
294
|
signature: str(n.props.signature) ?? "",
|
|
287
295
|
summary: str(n.props.semantic_summary) ?? "",
|
|
288
|
-
|
|
296
|
+
// File/Directory nodes carry `path` instead of `file_path`.
|
|
297
|
+
file_path: str(n.props.file_path) ?? str(n.props.path) ?? "",
|
|
289
298
|
repo_id: n.repoId,
|
|
290
299
|
});
|
|
291
300
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonlGraphStore.js","sourceRoot":"","sources":["../../src/store/JsonlGraphStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EACL,sBAAsB,GAMvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,mBAAmB,EACnB,UAAU,GAIX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEvE,SAAS,GAAG,CAAC,CAAU;IACrB,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1C,CAAC;AACD,SAAS,GAAG,CAAC,CAAU;IACrB,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC;AAED;oEACoE;AACpE,SAAS,YAAY,CAAC,IAAY,EAAE,QAAgB;IAClD,IAAI,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,IAAI,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACxD,MAAM,OAAO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ed one file per decision at
|
|
3
|
+
* .reposkein/decisions/<date>-<slug>.json. File-per-decision (not a single
|
|
4
|
+
* JSONL) so parallel branches recording decisions never merge-conflict on
|
|
5
|
+
* forges, which compute mergeability in a bare repo where .gitattributes
|
|
6
|
+
* union-merge is never consulted — the #35 lesson.
|
|
7
|
+
*
|
|
8
|
+
* Ids are portable `adr:<date>-<slug>` (no repo_id: date+slug already
|
|
9
|
+
* disambiguates, and repo_id differs across forks/no-remote clones unless
|
|
10
|
+
* meta.json is committed). Anchor node_ids keep the full rs1: form but are
|
|
11
|
+
* matched tolerantly by suffix. Bodies are immutable after creation (checked
|
|
12
|
+
* via body_hash); only status/supersession/anchor re-stamping may change,
|
|
13
|
+
* and records are never machine-deleted — a decision about deleted code is
|
|
14
|
+
* still history. */
|
|
15
|
+
export type DecisionStatus = "proposed" | "accepted" | "rejected" | "deprecated" | "superseded";
|
|
16
|
+
export interface DecisionAnchor {
|
|
17
|
+
node_id: string;
|
|
18
|
+
path: string;
|
|
19
|
+
name: string;
|
|
20
|
+
kind: string;
|
|
21
|
+
/** content_hash of the anchored node at record (or reaffirm) time; null if
|
|
22
|
+
* the node had none. */
|
|
23
|
+
hash: string | null;
|
|
24
|
+
}
|
|
25
|
+
export type DecisionTriggerKind = "manual" | "graph_delta" | "drift";
|
|
26
|
+
export interface DecisionRecord {
|
|
27
|
+
id: string;
|
|
28
|
+
title: string;
|
|
29
|
+
status: DecisionStatus;
|
|
30
|
+
context: string;
|
|
31
|
+
decision: string;
|
|
32
|
+
consequences?: string;
|
|
33
|
+
alternatives?: string;
|
|
34
|
+
anchors: DecisionAnchor[];
|
|
35
|
+
/** Literal file paths or directory prefixes ending "/" (no globs). */
|
|
36
|
+
paths: string[];
|
|
37
|
+
supersedes: string[];
|
|
38
|
+
superseded_by?: string;
|
|
39
|
+
decided_at: string;
|
|
40
|
+
decided_by: string;
|
|
41
|
+
trigger: {
|
|
42
|
+
kind: DecisionTriggerKind;
|
|
43
|
+
};
|
|
44
|
+
/** Hash of the immutable body fields (see computeBodyHash). Lets doctor
|
|
45
|
+
* detect hand-edited bodies. */
|
|
46
|
+
body_hash: string;
|
|
47
|
+
}
|
|
48
|
+
/** Anchor lifecycle at read time. Never deletes: the worst state is a flag. */
|
|
49
|
+
export type AnchorState = "current" | "stale" | "moved" | "orphaned";
|
|
50
|
+
export interface ResolvedAnchor extends DecisionAnchor {
|
|
51
|
+
state: AnchorState;
|
|
52
|
+
/** The live node id the anchor resolved to (differs from node_id for
|
|
53
|
+
* moved anchors and suffix matches across repo_ids). */
|
|
54
|
+
resolved_node_id?: string;
|
|
55
|
+
}
|
|
56
|
+
export declare function decisionsDir(repoPath: string): string;
|
|
57
|
+
/** The ordinal-free id a (date, title) pair maps to. */
|
|
58
|
+
export declare function decisionBaseId(date: string, title: string): string;
|
|
59
|
+
/** Mints `adr:<date>-<slug>`, appending `.1`, `.2`, … while taken. */
|
|
60
|
+
export declare function mintDecisionId(date: string, title: string, taken: ReadonlySet<string>): string;
|
|
61
|
+
/** Every id that must not be minted again: parsed record ids PLUS ids implied
|
|
62
|
+
* by existing filenames. The filename side matters when a file is damaged
|
|
63
|
+
* (conflict markers): its record doesn't parse, but minting its id anyway
|
|
64
|
+
* would let writeDecision rename over the hand-recoverable file — violating
|
|
65
|
+
* "records are never machine-deleted". */
|
|
66
|
+
export declare function takenDecisionIds(repoPath: string): Set<string>;
|
|
67
|
+
/** SHA-256 over the immutable body. Excludes status/superseded_by (lifecycle)
|
|
68
|
+
* and anchor hash values (re-stamped by reaffirm) — but covers WHICH nodes
|
|
69
|
+
* and paths the decision governs, and every prose field. */
|
|
70
|
+
export declare function computeBodyHash(rec: Omit<DecisionRecord, "body_hash">): string;
|
|
71
|
+
/** File name for a decision id (`adr:` prefix stripped). */
|
|
72
|
+
export declare function decisionFileName(id: string): string;
|
|
73
|
+
/** Canonical bytes: `id` first, then sorted keys, 2-space indent, trailing LF.
|
|
74
|
+
* Pretty-printed (unlike the derived JSONL) because these files are authored
|
|
75
|
+
* history that humans review in PR diffs. */
|
|
76
|
+
export declare function canonicalizeDecision(rec: DecisionRecord): string;
|
|
77
|
+
/** Atomic write: temp file in the same dir, then rename. */
|
|
78
|
+
export declare function writeDecision(repoPath: string, rec: DecisionRecord): void;
|
|
79
|
+
export interface LoadedDecisions {
|
|
80
|
+
/** Sorted by id; deduped by id with status precedence. */
|
|
81
|
+
decisions: DecisionRecord[];
|
|
82
|
+
warnings: string[];
|
|
83
|
+
}
|
|
84
|
+
export interface DecisionFileEntry {
|
|
85
|
+
file: string;
|
|
86
|
+
/** null when the file is malformed (bad JSON, conflict markers, missing
|
|
87
|
+
* required fields). */
|
|
88
|
+
record: DecisionRecord | null;
|
|
89
|
+
}
|
|
90
|
+
/** Raw per-file scan (no dedupe) — the substrate for loadDecisions and for
|
|
91
|
+
* doctor's duplicate/integrity checks. */
|
|
92
|
+
export declare function loadDecisionFiles(repoPath: string): DecisionFileEntry[];
|
|
93
|
+
/** Loads every decision file. Tolerant: malformed files (conflict markers,
|
|
94
|
+
* bad JSON, missing fields) are skipped with a warning, never thrown — a
|
|
95
|
+
* damaged file must not take recall down. */
|
|
96
|
+
export declare function loadDecisions(repoPath: string): LoadedDecisions;
|
|
97
|
+
/** Repo ids for anchor resolution: the root plus its federated children —
|
|
98
|
+
* decisions live at the root but may govern nodes in nested repos. Falls
|
|
99
|
+
* back to the root alone if federation lookup fails. */
|
|
100
|
+
export declare function anchorRepoIds(store: GraphStore, repoId: string): Promise<string[]>;
|
|
101
|
+
/** The portion of a node id that survives repo_id drift: `:<kind>:<rest>`.
|
|
102
|
+
* Shared by every decision surface — anchor resolution, profile governance,
|
|
103
|
+
* list filtering, and drift cross-referencing must agree on tolerance. */
|
|
104
|
+
export declare function nodeIdSuffix(nodeId: string): string | null;
|
|
105
|
+
/** The repo_id embedded in an rs1: node id, or null. */
|
|
106
|
+
export declare function nodeIdRepo(nodeId: string): string | null;
|
|
107
|
+
/** Resolves each anchor against the live graph:
|
|
108
|
+
* - current: node id live (exact or repo_id-suffix match), hash unchanged
|
|
109
|
+
* - stale: node id live, content differs since record time
|
|
110
|
+
* - moved: id dead, but the recorded content hash matches a live node —
|
|
111
|
+
* the only signal that survives renames
|
|
112
|
+
* - orphaned: nothing matches; kept and flagged, never deleted */
|
|
113
|
+
export declare function resolveAnchorStates(store: GraphStore, repoIds: string[], anchors: DecisionAnchor[]): Promise<ResolvedAnchor[]>;
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, writeFileSync, } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
const STATUSES = [
|
|
5
|
+
"proposed",
|
|
6
|
+
"accepted",
|
|
7
|
+
"rejected",
|
|
8
|
+
"deprecated",
|
|
9
|
+
"superseded",
|
|
10
|
+
];
|
|
11
|
+
/** Merge-damage tiebreak when the same id appears in two files: the more
|
|
12
|
+
* terminal status wins (a lost supersede flip is worse than a lost flag). */
|
|
13
|
+
const STATUS_PRECEDENCE = {
|
|
14
|
+
superseded: 4,
|
|
15
|
+
deprecated: 3,
|
|
16
|
+
rejected: 2,
|
|
17
|
+
accepted: 1,
|
|
18
|
+
proposed: 0,
|
|
19
|
+
};
|
|
20
|
+
export function decisionsDir(repoPath) {
|
|
21
|
+
return join(repoPath, ".reposkein", "decisions");
|
|
22
|
+
}
|
|
23
|
+
/** Kebab-cases a title into the id slug: lowercase [a-z0-9-], capped. */
|
|
24
|
+
function slugify(title) {
|
|
25
|
+
const slug = title
|
|
26
|
+
.toLowerCase()
|
|
27
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
28
|
+
.replace(/^-+|-+$/g, "")
|
|
29
|
+
.slice(0, 60)
|
|
30
|
+
.replace(/-+$/, "");
|
|
31
|
+
return slug || "decision";
|
|
32
|
+
}
|
|
33
|
+
/** The ordinal-free id a (date, title) pair maps to. */
|
|
34
|
+
export function decisionBaseId(date, title) {
|
|
35
|
+
return `adr:${date}-${slugify(title)}`;
|
|
36
|
+
}
|
|
37
|
+
/** Mints `adr:<date>-<slug>`, appending `.1`, `.2`, … while taken. */
|
|
38
|
+
export function mintDecisionId(date, title, taken) {
|
|
39
|
+
const base = decisionBaseId(date, title);
|
|
40
|
+
if (!taken.has(base))
|
|
41
|
+
return base;
|
|
42
|
+
for (let i = 1;; i++) {
|
|
43
|
+
const candidate = `${base}.${i}`;
|
|
44
|
+
if (!taken.has(candidate))
|
|
45
|
+
return candidate;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Every id that must not be minted again: parsed record ids PLUS ids implied
|
|
49
|
+
* by existing filenames. The filename side matters when a file is damaged
|
|
50
|
+
* (conflict markers): its record doesn't parse, but minting its id anyway
|
|
51
|
+
* would let writeDecision rename over the hand-recoverable file — violating
|
|
52
|
+
* "records are never machine-deleted". */
|
|
53
|
+
export function takenDecisionIds(repoPath) {
|
|
54
|
+
const taken = new Set();
|
|
55
|
+
for (const { file, record } of loadDecisionFiles(repoPath)) {
|
|
56
|
+
if (record)
|
|
57
|
+
taken.add(record.id);
|
|
58
|
+
taken.add(`adr:${file.replace(/\.json$/, "")}`);
|
|
59
|
+
}
|
|
60
|
+
return taken;
|
|
61
|
+
}
|
|
62
|
+
/** SHA-256 over the immutable body. Excludes status/superseded_by (lifecycle)
|
|
63
|
+
* and anchor hash values (re-stamped by reaffirm) — but covers WHICH nodes
|
|
64
|
+
* and paths the decision governs, and every prose field. */
|
|
65
|
+
export function computeBodyHash(rec) {
|
|
66
|
+
const body = {
|
|
67
|
+
alternatives: rec.alternatives ?? "",
|
|
68
|
+
anchor_node_ids: rec.anchors.map((a) => a.node_id),
|
|
69
|
+
consequences: rec.consequences ?? "",
|
|
70
|
+
context: rec.context,
|
|
71
|
+
decided_at: rec.decided_at,
|
|
72
|
+
decided_by: rec.decided_by,
|
|
73
|
+
decision: rec.decision,
|
|
74
|
+
paths: rec.paths,
|
|
75
|
+
supersedes: rec.supersedes,
|
|
76
|
+
title: rec.title,
|
|
77
|
+
trigger: rec.trigger.kind,
|
|
78
|
+
};
|
|
79
|
+
return createHash("sha256").update(JSON.stringify(body)).digest("hex");
|
|
80
|
+
}
|
|
81
|
+
/** File name for a decision id (`adr:` prefix stripped). */
|
|
82
|
+
export function decisionFileName(id) {
|
|
83
|
+
return `${id.replace(/^adr:/, "")}.json`;
|
|
84
|
+
}
|
|
85
|
+
function sortedKeys(value) {
|
|
86
|
+
if (Array.isArray(value))
|
|
87
|
+
return value.map(sortedKeys);
|
|
88
|
+
if (value !== null && typeof value === "object") {
|
|
89
|
+
const out = {};
|
|
90
|
+
for (const k of Object.keys(value).sort()) {
|
|
91
|
+
out[k] = sortedKeys(value[k]);
|
|
92
|
+
}
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
/** Canonical bytes: `id` first, then sorted keys, 2-space indent, trailing LF.
|
|
98
|
+
* Pretty-printed (unlike the derived JSONL) because these files are authored
|
|
99
|
+
* history that humans review in PR diffs. */
|
|
100
|
+
export function canonicalizeDecision(rec) {
|
|
101
|
+
const { id, ...rest } = rec;
|
|
102
|
+
const sorted = sortedKeys(rest);
|
|
103
|
+
const withOptionalsDropped = {};
|
|
104
|
+
for (const [k, v] of Object.entries(sorted)) {
|
|
105
|
+
if (v === undefined)
|
|
106
|
+
continue;
|
|
107
|
+
withOptionalsDropped[k] = v;
|
|
108
|
+
}
|
|
109
|
+
return JSON.stringify({ id, ...withOptionalsDropped }, null, 2) + "\n";
|
|
110
|
+
}
|
|
111
|
+
/** Atomic write: temp file in the same dir, then rename. */
|
|
112
|
+
export function writeDecision(repoPath, rec) {
|
|
113
|
+
const dir = decisionsDir(repoPath);
|
|
114
|
+
mkdirSync(dir, { recursive: true });
|
|
115
|
+
const file = join(dir, decisionFileName(rec.id));
|
|
116
|
+
const tmp = join(dir, `.${decisionFileName(rec.id)}.tmp`);
|
|
117
|
+
writeFileSync(tmp, canonicalizeDecision(rec));
|
|
118
|
+
renameSync(tmp, file);
|
|
119
|
+
}
|
|
120
|
+
function parseDecision(obj) {
|
|
121
|
+
if (typeof obj.id !== "string" || !obj.id.startsWith("adr:"))
|
|
122
|
+
return null;
|
|
123
|
+
if (typeof obj.title !== "string" || typeof obj.context !== "string")
|
|
124
|
+
return null;
|
|
125
|
+
if (typeof obj.decision !== "string" || typeof obj.decided_at !== "string")
|
|
126
|
+
return null;
|
|
127
|
+
const status = obj.status;
|
|
128
|
+
if (typeof status !== "string" || !STATUSES.includes(status))
|
|
129
|
+
return null;
|
|
130
|
+
const anchorsRaw = Array.isArray(obj.anchors) ? obj.anchors : [];
|
|
131
|
+
const anchors = [];
|
|
132
|
+
for (const a of anchorsRaw) {
|
|
133
|
+
if (a === null || typeof a !== "object")
|
|
134
|
+
continue;
|
|
135
|
+
const o = a;
|
|
136
|
+
if (typeof o.node_id !== "string")
|
|
137
|
+
continue;
|
|
138
|
+
anchors.push({
|
|
139
|
+
node_id: o.node_id,
|
|
140
|
+
path: typeof o.path === "string" ? o.path : "",
|
|
141
|
+
name: typeof o.name === "string" ? o.name : "",
|
|
142
|
+
kind: typeof o.kind === "string" ? o.kind : "",
|
|
143
|
+
hash: typeof o.hash === "string" ? o.hash : null,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
const strArray = (v) => Array.isArray(v) ? v.filter((x) => typeof x === "string") : [];
|
|
147
|
+
const triggerKind = obj.trigger !== null &&
|
|
148
|
+
typeof obj.trigger === "object" &&
|
|
149
|
+
typeof obj.trigger.kind === "string"
|
|
150
|
+
? obj.trigger.kind
|
|
151
|
+
: "manual";
|
|
152
|
+
const rec = {
|
|
153
|
+
id: obj.id,
|
|
154
|
+
title: obj.title,
|
|
155
|
+
status: status,
|
|
156
|
+
context: obj.context,
|
|
157
|
+
decision: obj.decision,
|
|
158
|
+
anchors,
|
|
159
|
+
paths: strArray(obj.paths),
|
|
160
|
+
supersedes: strArray(obj.supersedes),
|
|
161
|
+
decided_at: obj.decided_at,
|
|
162
|
+
decided_by: typeof obj.decided_by === "string" ? obj.decided_by : "unknown",
|
|
163
|
+
trigger: {
|
|
164
|
+
kind: ["manual", "graph_delta", "drift"].includes(triggerKind)
|
|
165
|
+
? triggerKind
|
|
166
|
+
: "manual",
|
|
167
|
+
},
|
|
168
|
+
body_hash: typeof obj.body_hash === "string" ? obj.body_hash : "",
|
|
169
|
+
};
|
|
170
|
+
if (typeof obj.consequences === "string")
|
|
171
|
+
rec.consequences = obj.consequences;
|
|
172
|
+
if (typeof obj.alternatives === "string")
|
|
173
|
+
rec.alternatives = obj.alternatives;
|
|
174
|
+
if (typeof obj.superseded_by === "string")
|
|
175
|
+
rec.superseded_by = obj.superseded_by;
|
|
176
|
+
return rec;
|
|
177
|
+
}
|
|
178
|
+
/** Raw per-file scan (no dedupe) — the substrate for loadDecisions and for
|
|
179
|
+
* doctor's duplicate/integrity checks. */
|
|
180
|
+
export function loadDecisionFiles(repoPath) {
|
|
181
|
+
const dir = decisionsDir(repoPath);
|
|
182
|
+
if (!existsSync(dir))
|
|
183
|
+
return [];
|
|
184
|
+
let files;
|
|
185
|
+
try {
|
|
186
|
+
files = readdirSync(dir).filter((f) => f.endsWith(".json") && !f.startsWith("."));
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
return files.sort().map((f) => {
|
|
192
|
+
let record = null;
|
|
193
|
+
try {
|
|
194
|
+
record = parseDecision(JSON.parse(readFileSync(join(dir, f), "utf8")));
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
record = null;
|
|
198
|
+
}
|
|
199
|
+
return { file: f, record };
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/** Loads every decision file. Tolerant: malformed files (conflict markers,
|
|
203
|
+
* bad JSON, missing fields) are skipped with a warning, never thrown — a
|
|
204
|
+
* damaged file must not take recall down. */
|
|
205
|
+
export function loadDecisions(repoPath) {
|
|
206
|
+
const warnings = [];
|
|
207
|
+
const byId = new Map();
|
|
208
|
+
for (const { file, record } of loadDecisionFiles(repoPath)) {
|
|
209
|
+
if (!record) {
|
|
210
|
+
warnings.push(`skipped malformed decision file: ${file}`);
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
const existing = byId.get(record.id);
|
|
214
|
+
if (!existing || STATUS_PRECEDENCE[record.status] > STATUS_PRECEDENCE[existing.status]) {
|
|
215
|
+
byId.set(record.id, record);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
const decisions = [...byId.values()].sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
219
|
+
return { decisions, warnings };
|
|
220
|
+
}
|
|
221
|
+
/** Repo ids for anchor resolution: the root plus its federated children —
|
|
222
|
+
* decisions live at the root but may govern nodes in nested repos. Falls
|
|
223
|
+
* back to the root alone if federation lookup fails. */
|
|
224
|
+
export async function anchorRepoIds(store, repoId) {
|
|
225
|
+
try {
|
|
226
|
+
return [repoId, ...(await store.federatedRepoIds(repoId))];
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
return [repoId];
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/** The portion of a node id that survives repo_id drift: `:<kind>:<rest>`.
|
|
233
|
+
* Shared by every decision surface — anchor resolution, profile governance,
|
|
234
|
+
* list filtering, and drift cross-referencing must agree on tolerance. */
|
|
235
|
+
export function nodeIdSuffix(nodeId) {
|
|
236
|
+
const m = /^rs1:[^:]+(:.+)$/.exec(nodeId);
|
|
237
|
+
return m ? m[1] : null;
|
|
238
|
+
}
|
|
239
|
+
/** The repo_id embedded in an rs1: node id, or null. */
|
|
240
|
+
export function nodeIdRepo(nodeId) {
|
|
241
|
+
const m = /^rs1:([^:]+):.+$/.exec(nodeId);
|
|
242
|
+
return m ? m[1] : null;
|
|
243
|
+
}
|
|
244
|
+
const idSuffix = nodeIdSuffix;
|
|
245
|
+
/** Resolves each anchor against the live graph:
|
|
246
|
+
* - current: node id live (exact or repo_id-suffix match), hash unchanged
|
|
247
|
+
* - stale: node id live, content differs since record time
|
|
248
|
+
* - moved: id dead, but the recorded content hash matches a live node —
|
|
249
|
+
* the only signal that survives renames
|
|
250
|
+
* - orphaned: nothing matches; kept and flagged, never deleted */
|
|
251
|
+
export async function resolveAnchorStates(store, repoIds, anchors) {
|
|
252
|
+
const out = [];
|
|
253
|
+
for (const anchor of anchors) {
|
|
254
|
+
let live = await store.getNode(repoIds, anchor.node_id);
|
|
255
|
+
if (!live) {
|
|
256
|
+
// Fork tolerance: the anchor may carry a different repo_id than the
|
|
257
|
+
// local checkout computes. Retry with each live repo id + the suffix.
|
|
258
|
+
const suffix = idSuffix(anchor.node_id);
|
|
259
|
+
if (suffix) {
|
|
260
|
+
for (const repoId of repoIds) {
|
|
261
|
+
const candidate = `rs1:${repoId}${suffix}`;
|
|
262
|
+
if (candidate === anchor.node_id)
|
|
263
|
+
continue;
|
|
264
|
+
live = await store.getNode(repoIds, candidate);
|
|
265
|
+
if (live)
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
if (live) {
|
|
271
|
+
const state = anchor.hash === null || live.content_hash === null || anchor.hash === live.content_hash
|
|
272
|
+
? "current"
|
|
273
|
+
: "stale";
|
|
274
|
+
out.push({ ...anchor, state, resolved_node_id: live.id });
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
if (anchor.hash && store.findByContentHash) {
|
|
278
|
+
const matches = await store.findByContentHash(repoIds, anchor.hash);
|
|
279
|
+
if (matches.length > 0) {
|
|
280
|
+
out.push({ ...anchor, state: "moved", resolved_node_id: matches[0].id });
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
out.push({ ...anchor, state: "orphaned" });
|
|
285
|
+
}
|
|
286
|
+
return out;
|
|
287
|
+
}
|
|
288
|
+
//# sourceMappingURL=decisions.js.map
|