@reposkein/mcp 0.2.7 → 0.4.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.
Files changed (140) hide show
  1. package/README.md +73 -1
  2. package/binary-digests.json +4 -4
  3. package/dist/SKILL.md +63 -1
  4. package/dist/cli/adr.d.ts +37 -0
  5. package/dist/cli/adr.js +231 -0
  6. package/dist/cli/adr.js.map +1 -0
  7. package/dist/cli/agentAdapters.d.ts +68 -0
  8. package/dist/cli/agentAdapters.js +223 -0
  9. package/dist/cli/agentAdapters.js.map +1 -0
  10. package/dist/cli/ansi.d.ts +24 -0
  11. package/dist/cli/ansi.js +40 -0
  12. package/dist/cli/ansi.js.map +1 -0
  13. package/dist/cli/doctor.d.ts +34 -2
  14. package/dist/cli/doctor.js +53 -5
  15. package/dist/cli/doctor.js.map +1 -1
  16. package/dist/cli/doctorDecisions.d.ts +5 -0
  17. package/dist/cli/doctorDecisions.js +83 -0
  18. package/dist/cli/doctorDecisions.js.map +1 -0
  19. package/dist/cli/doctorFreshness.d.ts +43 -0
  20. package/dist/cli/doctorFreshness.js +111 -0
  21. package/dist/cli/doctorFreshness.js.map +1 -0
  22. package/dist/cli/doctorSummaries.d.ts +2 -0
  23. package/dist/cli/doctorSummaries.js +95 -0
  24. package/dist/cli/doctorSummaries.js.map +1 -0
  25. package/dist/cli/federatedDiscovery.d.ts +16 -0
  26. package/dist/cli/federatedDiscovery.js +75 -0
  27. package/dist/cli/federatedDiscovery.js.map +1 -0
  28. package/dist/cli/init.d.ts +69 -6
  29. package/dist/cli/init.js +194 -28
  30. package/dist/cli/init.js.map +1 -1
  31. package/dist/cli/sourceSlices.d.ts +17 -0
  32. package/dist/cli/sourceSlices.js +59 -0
  33. package/dist/cli/sourceSlices.js.map +1 -0
  34. package/dist/cli/stats.d.ts +29 -0
  35. package/dist/cli/stats.js +180 -0
  36. package/dist/cli/stats.js.map +1 -0
  37. package/dist/cli/view.d.ts +71 -3
  38. package/dist/cli/view.js +147 -12
  39. package/dist/cli/view.js.map +1 -1
  40. package/dist/guard/decisionValidation.d.ts +29 -0
  41. package/dist/guard/decisionValidation.js +51 -0
  42. package/dist/guard/decisionValidation.js.map +1 -0
  43. package/dist/guard/summaryValidation.d.ts +3 -0
  44. package/dist/guard/summaryValidation.js +5 -3
  45. package/dist/guard/summaryValidation.js.map +1 -1
  46. package/dist/index.d.ts +48 -0
  47. package/dist/index.js +355 -78
  48. package/dist/index.js.map +1 -1
  49. package/dist/indexer/decisionsAffected.d.ts +42 -0
  50. package/dist/indexer/decisionsAffected.js +149 -0
  51. package/dist/indexer/decisionsAffected.js.map +1 -0
  52. package/dist/indexer/fetchBinary.d.ts +14 -0
  53. package/dist/indexer/fetchBinary.js +81 -40
  54. package/dist/indexer/fetchBinary.js.map +1 -1
  55. package/dist/indexer/runIndexer.d.ts +3 -2
  56. package/dist/indexer/runIndexer.js +8 -4
  57. package/dist/indexer/runIndexer.js.map +1 -1
  58. package/dist/profile/decisions.d.ts +37 -0
  59. package/dist/profile/decisions.js +112 -0
  60. package/dist/profile/decisions.js.map +1 -0
  61. package/dist/profile/types.d.ts +8 -0
  62. package/dist/store/GraphStore.d.ts +5 -0
  63. package/dist/store/JsonlGraphStore.d.ts +14 -3
  64. package/dist/store/JsonlGraphStore.js +66 -19
  65. package/dist/store/JsonlGraphStore.js.map +1 -1
  66. package/dist/store/decisions.d.ts +131 -0
  67. package/dist/store/decisions.js +321 -0
  68. package/dist/store/decisions.js.map +1 -0
  69. package/dist/store/indexedAt.d.ts +18 -0
  70. package/dist/store/indexedAt.js +56 -0
  71. package/dist/store/indexedAt.js.map +1 -0
  72. package/dist/store/instrumentTool.d.ts +40 -0
  73. package/dist/store/instrumentTool.js +82 -0
  74. package/dist/store/instrumentTool.js.map +1 -0
  75. package/dist/store/repoContextCache.d.ts +15 -0
  76. package/dist/store/repoContextCache.js +26 -0
  77. package/dist/store/repoContextCache.js.map +1 -0
  78. package/dist/store/repoSession.d.ts +63 -0
  79. package/dist/store/repoSession.js +123 -0
  80. package/dist/store/repoSession.js.map +1 -0
  81. package/dist/store/resolveRepoPath.d.ts +31 -0
  82. package/dist/store/resolveRepoPath.js +85 -0
  83. package/dist/store/resolveRepoPath.js.map +1 -0
  84. package/dist/store/sessionLog.d.ts +98 -0
  85. package/dist/store/sessionLog.js +216 -0
  86. package/dist/store/sessionLog.js.map +1 -0
  87. package/dist/store/sessionStats.d.ts +55 -0
  88. package/dist/store/sessionStats.js +140 -0
  89. package/dist/store/sessionStats.js.map +1 -0
  90. package/dist/store/sidecar.d.ts +39 -3
  91. package/dist/store/sidecar.js +89 -5
  92. package/dist/store/sidecar.js.map +1 -1
  93. package/dist/store/summaryShards.d.ts +117 -0
  94. package/dist/store/summaryShards.js +291 -0
  95. package/dist/store/summaryShards.js.map +1 -0
  96. package/dist/store/teamConfig.d.ts +13 -0
  97. package/dist/store/teamConfig.js +49 -0
  98. package/dist/store/teamConfig.js.map +1 -0
  99. package/dist/tools/getContextProfile.d.ts +1 -1
  100. package/dist/tools/getContextProfile.js +9 -1
  101. package/dist/tools/getContextProfile.js.map +1 -1
  102. package/dist/tools/getDecision.d.ts +6 -0
  103. package/dist/tools/getDecision.js +59 -0
  104. package/dist/tools/getDecision.js.map +1 -0
  105. package/dist/tools/impact.d.ts +1 -1
  106. package/dist/tools/impact.js +13 -1
  107. package/dist/tools/impact.js.map +1 -1
  108. package/dist/tools/indexerTools.d.ts +16 -2
  109. package/dist/tools/indexerTools.js +44 -5
  110. package/dist/tools/indexerTools.js.map +1 -1
  111. package/dist/tools/listDecisions.d.ts +19 -0
  112. package/dist/tools/listDecisions.js +93 -0
  113. package/dist/tools/listDecisions.js.map +1 -0
  114. package/dist/tools/reaffirmDecision.d.ts +11 -0
  115. package/dist/tools/reaffirmDecision.js +55 -0
  116. package/dist/tools/reaffirmDecision.js.map +1 -0
  117. package/dist/tools/recordDecision.d.ts +24 -0
  118. package/dist/tools/recordDecision.js +135 -0
  119. package/dist/tools/recordDecision.js.map +1 -0
  120. package/dist/tools/semanticFind.d.ts +9 -2
  121. package/dist/tools/semanticFind.js +44 -2
  122. package/dist/tools/semanticFind.js.map +1 -1
  123. package/dist/tools/setDecisionStatus.d.ts +8 -0
  124. package/dist/tools/setDecisionStatus.js +34 -0
  125. package/dist/tools/setDecisionStatus.js.map +1 -0
  126. package/dist/viz/assets/{graph.worker-CC7BeE-8.js → graph.worker-DkH6-lMU.js} +1 -1
  127. package/dist/viz/assets/index-CxqeGuRS.css +1 -0
  128. package/dist/viz/assets/index-DiNZyrXx.js +9 -0
  129. package/dist/viz/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  130. package/dist/viz/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  131. package/dist/viz/assets/jetbrains-mono-latin-700-normal-BYuf6tUa.woff2 +0 -0
  132. package/dist/viz/assets/r3f-BZY3QR6_.js +336 -0
  133. package/dist/viz/assets/tanstack-CjXr-L-s.js +62 -0
  134. package/dist/viz/assets/three-Cpu5RUEM.js +4116 -0
  135. package/dist/viz/index.html +5 -4
  136. package/package.json +5 -4
  137. package/dist/viz/assets/index-C_8UkiJ8.js +0 -9
  138. package/dist/viz/assets/r3f-Cku1OhB-.js +0 -277
  139. package/dist/viz/assets/tanstack-DyXcNRWk.js +0 -77
  140. package/dist/viz/assets/three-Z8XaLGmf.js +0 -3839
@@ -0,0 +1,291 @@
1
+ import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync, } from "node:fs";
2
+ import { basename, join } from "node:path";
3
+ export function summariesDir(repoPath) {
4
+ return join(repoPath, ".reposkein", "summaries");
5
+ }
6
+ /** The pre-sharding committed file. Still read (dual-read) for one release. */
7
+ export function legacySummariesPath(repoPath) {
8
+ return join(repoPath, ".reposkein", "summaries.jsonl");
9
+ }
10
+ export function conflictsPath(repoPath) {
11
+ return join(repoPath, ".reposkein", "local", "conflicts.jsonl");
12
+ }
13
+ /** Mirrors the Rust `is_shard_file_name`: exactly two lowercase hex chars. */
14
+ export function isShardFileName(name) {
15
+ return /^[0-9a-f]{2}\.jsonl$/.test(name);
16
+ }
17
+ /** A line git left behind from an unresolved textual merge. A canonical
18
+ * summary line always starts with `{`, so a marker run is damage, not data. */
19
+ export function isConflictMarker(line) {
20
+ return (line.startsWith("<<<<<<<") ||
21
+ line.startsWith("=======") ||
22
+ line.startsWith(">>>>>>>") ||
23
+ line.startsWith("|||||||"));
24
+ }
25
+ /** True for a value that is actually authored prose: a non-empty string.
26
+ * `null`, a number, or `""` all mean "the field is present but says nothing". */
27
+ function isProse(v) {
28
+ return typeof v === "string" && v !== "";
29
+ }
30
+ /** Whether these props carry an authored summary worth keeping.
31
+ *
32
+ * Deliberately identical to the Rust `has_summary`. The two languages read the
33
+ * same committed shards, so a record one accepts and the other rejects is a
34
+ * divergence between what the server serves and what the indexer writes — and
35
+ * a record with nothing in it must never displace one that has prose, in
36
+ * either language. Pinned by the `null-valued`/`non-string` fixture vectors. */
37
+ export function hasSummary(props) {
38
+ return isProse(props.semantic_summary) || isProse(props.purpose_summary);
39
+ }
40
+ function summaryAt(rec) {
41
+ const v = rec.props.summary_at;
42
+ return typeof v === "string" ? v : "";
43
+ }
44
+ /** Byte-lexicographic comparison. JavaScript's `<` compares UTF-16 code units,
45
+ * which orders some astral/BMP pairs differently from the UTF-8 byte order
46
+ * Rust uses. Comparing the encoded bytes is what makes the two languages
47
+ * agree on every input, not just ASCII ones. */
48
+ function lineIsSmaller(a, b) {
49
+ return Buffer.compare(Buffer.from(a, "utf8"), Buffer.from(b, "utf8")) < 0;
50
+ }
51
+ /** Deterministic winner between two records claiming the same node id, when
52
+ * nothing is known about where either came from:
53
+ * newer `summary_at`, then smaller raw line by UTF-8 byte order. Both are
54
+ * pure functions of bytes on disk, so every machine — and the Rust indexer —
55
+ * picks the same winner without coordinating. Kept in lockstep with the Rust
56
+ * `beats` by the shared vectors in `fixtures/summary-shard-vectors.json`.
57
+ *
58
+ * This is the rule for records found in the SAME source (two lines of one
59
+ * merged shard, two agents' sidecars). Across sources of known provenance,
60
+ * use `supersedes`. */
61
+ export function beats(candidate, incumbent) {
62
+ const ca = summaryAt(candidate);
63
+ const ia = summaryAt(incumbent);
64
+ if (ca !== ia)
65
+ return ca > ia;
66
+ return lineIsSmaller(candidate.line, incumbent.line);
67
+ }
68
+ /** Whether a record from a strictly NEWER-provenance source displaces one
69
+ * already held from an older source.
70
+ *
71
+ * `summary_at` is day-precision (PRD §6.2.5 keeps wall-clock time out of
72
+ * committed bytes), so re-summarising a node already summarised today TIES.
73
+ * Resolving that tie by byte order would silently discard the rewrite. A
74
+ * newer source therefore wins unless it is *strictly older* — which is the
75
+ * case that matters, because that is a stale local record about to clobber a
76
+ * teammate's newer one. Mirrors the Rust `supersedes`. */
77
+ export function supersedes(candidate, incumbent) {
78
+ return summaryAt(candidate) >= summaryAt(incumbent);
79
+ }
80
+ export function emptyAccumulator() {
81
+ return { summaries: new Map(), conflicts: [], warnings: [] };
82
+ }
83
+ /** Folds one candidate in, keeping whichever record `wins` selects and
84
+ * preserving the other. The single place a record can be displaced, so no
85
+ * caller can bypass conflict recording by accident. */
86
+ function offer(acc, rec, wins) {
87
+ const existing = acc.summaries.get(rec.id);
88
+ if (!existing) {
89
+ acc.summaries.set(rec.id, rec);
90
+ return;
91
+ }
92
+ // A union merge duplicating an unchanged line is not a conflict.
93
+ if (existing.line === rec.line)
94
+ return;
95
+ if (wins(rec, existing)) {
96
+ acc.summaries.set(rec.id, rec);
97
+ acc.conflicts.push(existing);
98
+ }
99
+ else {
100
+ acc.conflicts.push(rec);
101
+ }
102
+ }
103
+ /** Folds a whole source of strictly NEWER provenance into `acc`. Mirrors the
104
+ * Rust `absorb_source`: displacement uses `supersedes`, and every displaced
105
+ * record is preserved. */
106
+ export function absorbSummarySource(acc, other) {
107
+ for (const rec of other.summaries.values())
108
+ offer(acc, rec, supersedes);
109
+ acc.conflicts.push(...other.conflicts);
110
+ acc.warnings.push(...other.warnings);
111
+ }
112
+ /** Folds one file's text in, resolving same-source records with `beats`.
113
+ * Exported for the shared vectors. */
114
+ export function absorbSummaryLines(acc, source, text) {
115
+ let markers = 0;
116
+ let malformed = 0;
117
+ for (const raw of text.split("\n")) {
118
+ const line = raw.endsWith("\r") ? raw.slice(0, -1) : raw;
119
+ if (line.trim() === "")
120
+ continue;
121
+ if (isConflictMarker(line)) {
122
+ markers++;
123
+ continue;
124
+ }
125
+ let obj;
126
+ try {
127
+ const parsed = JSON.parse(line);
128
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
129
+ malformed++;
130
+ continue;
131
+ }
132
+ obj = parsed;
133
+ }
134
+ catch {
135
+ malformed++;
136
+ continue;
137
+ }
138
+ const id = obj.id;
139
+ if (typeof id !== "string" || id === "") {
140
+ malformed++;
141
+ continue;
142
+ }
143
+ const { id: _drop, ...props } = obj;
144
+ // A line with no authored prose is not a summary. Letting it into the map
145
+ // would let it WIN a tiebreak against a real summary and evict it — see
146
+ // `hasSummary` for the null-valued case that did exactly that.
147
+ if (!hasSummary(props)) {
148
+ malformed++;
149
+ continue;
150
+ }
151
+ offer(acc, { id, props, line }, beats);
152
+ }
153
+ if (markers > 0) {
154
+ acc.warnings.push(`${source}: skipped ${markers} git conflict-marker line(s); run \`reposkein-indexer index\` to rewrite the shard cleanly`);
155
+ }
156
+ if (malformed > 0) {
157
+ acc.warnings.push(`${source}: skipped ${malformed} malformed line(s)`);
158
+ }
159
+ }
160
+ /** Reads every committed shard plus the pre-sharding file, tolerantly.
161
+ * A missing directory is the normal state for a repo with no authored prose,
162
+ * and returns an empty result rather than an error. */
163
+ export function loadSummaryShards(repoPath) {
164
+ const acc = emptyAccumulator();
165
+ const dir = summariesDir(repoPath);
166
+ let names = [];
167
+ try {
168
+ names = readdirSync(dir).filter(isShardFileName).sort();
169
+ }
170
+ catch {
171
+ names = [];
172
+ }
173
+ for (const name of names) {
174
+ try {
175
+ absorbSummaryLines(acc, `summaries/${name}`, readFileSync(join(dir, name), "utf8"));
176
+ }
177
+ catch {
178
+ acc.warnings.push(`summaries/${name}: unreadable`);
179
+ }
180
+ }
181
+ const legacy = legacySummariesPath(repoPath);
182
+ const legacyFilePresent = existsSync(legacy);
183
+ if (legacyFilePresent) {
184
+ try {
185
+ absorbSummaryLines(acc, "summaries.jsonl", readFileSync(legacy, "utf8"));
186
+ }
187
+ catch {
188
+ acc.warnings.push("summaries.jsonl: unreadable");
189
+ }
190
+ }
191
+ // Sorted by id so callers iterate deterministically.
192
+ const summaries = new Map([...acc.summaries.entries()].sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0)));
193
+ return { summaries, conflicts: acc.conflicts, warnings: acc.warnings, legacyFilePresent };
194
+ }
195
+ /** A cheap fingerprint of everything the summary overlay reads on disk.
196
+ *
197
+ * The store keys its reload on this, so a `git pull` that brings in a
198
+ * teammate's shards — or another agent's sidecar write on this machine — is
199
+ * visible without restarting the process. Stat calls only, O(shards +
200
+ * sidecars), no content read, because this runs on every read and not just on
201
+ * change. mtime alone is not enough on filesystems with coarse timestamps, so
202
+ * size rides along.
203
+ *
204
+ * `sidecarFiles` is injected rather than imported to keep this module free of
205
+ * a cycle with sidecar.ts, which imports the fold from here. */
206
+ export function summaryShardsStamp(repoPath, sidecarFiles = () => []) {
207
+ const parts = [];
208
+ const dir = summariesDir(repoPath);
209
+ let names = [];
210
+ try {
211
+ names = readdirSync(dir).filter(isShardFileName).sort();
212
+ }
213
+ catch {
214
+ names = [];
215
+ }
216
+ for (const name of names) {
217
+ try {
218
+ const s = statSync(join(dir, name));
219
+ parts.push(`${name}:${s.mtimeMs}:${s.size}`);
220
+ }
221
+ catch {
222
+ parts.push(`${name}:?`);
223
+ }
224
+ }
225
+ try {
226
+ const s = statSync(legacySummariesPath(repoPath));
227
+ parts.push(`legacy:${s.mtimeMs}:${s.size}`);
228
+ }
229
+ catch {
230
+ // absent, which is the post-migration norm
231
+ }
232
+ // Sidecars too. Without them a second agent's write on the same checkout was
233
+ // invisible to an already-open server for the life of the process — which
234
+ // the overlay explicitly promises to surface.
235
+ for (const p of sidecarFiles(repoPath)) {
236
+ try {
237
+ const s = statSync(p);
238
+ parts.push(`sc/${basename(p)}:${s.mtimeMs}:${s.size}`);
239
+ }
240
+ catch {
241
+ parts.push(`sc/${basename(p)}:?`);
242
+ }
243
+ }
244
+ return parts.join("|");
245
+ }
246
+ /** Merges divergence losers into the git-ignored `local/conflicts.jsonl`.
247
+ *
248
+ * Deduped and sorted, so repeated reads converge instead of growing the file,
249
+ * and never truncating: a loser recorded by an earlier run (or by the indexer)
250
+ * stays. Best-effort — failing to record a conflict must not break a tool
251
+ * call. Mirrors the Rust `conflicts_to_jsonl`. */
252
+ export function recordSummaryConflicts(repoPath, losers) {
253
+ if (losers.length === 0)
254
+ return;
255
+ const path = conflictsPath(repoPath);
256
+ const lines = new Set();
257
+ try {
258
+ for (const raw of readFileSync(path, "utf8").split("\n")) {
259
+ const line = raw.endsWith("\r") ? raw.slice(0, -1) : raw;
260
+ if (line.trim() !== "" && !isConflictMarker(line))
261
+ lines.add(line);
262
+ }
263
+ }
264
+ catch {
265
+ // no existing file
266
+ }
267
+ const before = lines.size;
268
+ for (const l of losers)
269
+ lines.add(l.line);
270
+ if (lines.size === before)
271
+ return;
272
+ try {
273
+ mkdirSync(join(repoPath, ".reposkein", "local"), { recursive: true });
274
+ writeFileSync(path, [...lines].sort().join("\n") + "\n");
275
+ }
276
+ catch {
277
+ // best-effort
278
+ }
279
+ }
280
+ /** How many divergence losers are on record. Doctor surfaces this. */
281
+ export function countRecordedConflicts(repoPath) {
282
+ try {
283
+ return readFileSync(conflictsPath(repoPath), "utf8")
284
+ .split("\n")
285
+ .filter((l) => l.trim() !== "").length;
286
+ }
287
+ catch {
288
+ return 0;
289
+ }
290
+ }
291
+ //# sourceMappingURL=summaryShards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summaryShards.js","sourceRoot":"","sources":["../../src/store/summaryShards.ts"],"names":[],"mappings":"A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+1,13 @@
1
+ /** Reads `pages_url` from the `[team]` section of `.reposkein/config.toml`,
2
+ * or null when the file/section/key is absent (the common case — this is
3
+ * an opt-in field a team adds after publishing a hosted constellation, see
4
+ * docs/HOSTING.md). Points the viewer's header at wherever the team's
5
+ * canonical/CI-published constellation lives (e.g. a GitHub Pages URL),
6
+ * distinct from whatever ad-hoc `view`/`view --export` a given machine
7
+ * happens to be looking at right now.
8
+ *
9
+ * A deliberate ~20-line scanner rather than a TOML dependency — mirrors
10
+ * `config_bool` in indexer/crates/cli/src/main.rs: this reads exactly one
11
+ * setting, and its config is a file `reposkein-indexer init` writes.
12
+ * Absent file, section, or key all mean `null`. */
13
+ export declare function readTeamPagesUrl(repoPath: string): string | null;
@@ -0,0 +1,49 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ /** Reads `pages_url` from the `[team]` section of `.reposkein/config.toml`,
4
+ * or null when the file/section/key is absent (the common case — this is
5
+ * an opt-in field a team adds after publishing a hosted constellation, see
6
+ * docs/HOSTING.md). Points the viewer's header at wherever the team's
7
+ * canonical/CI-published constellation lives (e.g. a GitHub Pages URL),
8
+ * distinct from whatever ad-hoc `view`/`view --export` a given machine
9
+ * happens to be looking at right now.
10
+ *
11
+ * A deliberate ~20-line scanner rather than a TOML dependency — mirrors
12
+ * `config_bool` in indexer/crates/cli/src/main.rs: this reads exactly one
13
+ * setting, and its config is a file `reposkein-indexer init` writes.
14
+ * Absent file, section, or key all mean `null`. */
15
+ export function readTeamPagesUrl(repoPath) {
16
+ const path = join(repoPath, ".reposkein", "config.toml");
17
+ if (!existsSync(path))
18
+ return null;
19
+ let text;
20
+ try {
21
+ text = readFileSync(path, "utf8");
22
+ }
23
+ catch {
24
+ return null;
25
+ }
26
+ let inTeamSection = false;
27
+ for (const rawLine of text.split(/\r?\n/)) {
28
+ const line = rawLine.trim();
29
+ if (line === "" || line.startsWith("#"))
30
+ continue;
31
+ if (line.startsWith("[")) {
32
+ inTeamSection = line === "[team]";
33
+ continue;
34
+ }
35
+ if (!inTeamSection)
36
+ continue;
37
+ const eq = line.indexOf("=");
38
+ if (eq === -1)
39
+ continue;
40
+ const key = line.slice(0, eq).trim();
41
+ if (key !== "pages_url")
42
+ continue;
43
+ const rawValue = line.slice(eq + 1).split("#")[0].trim();
44
+ const quoted = rawValue.match(/^"([^"]*)"$/) ?? rawValue.match(/^'([^']*)'$/);
45
+ return quoted ? quoted[1] : null;
46
+ }
47
+ return null;
48
+ }
49
+ //# sourceMappingURL=teamConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"teamConfig.js","sourceRoot":"","sources":["../../src/store/teamConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;;;;;;oDAWoD;AACpD,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;IACzD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,aAAa,GAAG,KAAK,CAAC;IAC1B,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,IAAI,KAAK,EAAE,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAClD,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,aAAa,GAAG,IAAI,KAAK,QAAQ,CAAC;YAClC,SAAS;QACX,CAAC;QACD,IAAI,CAAC,aAAa;YAAE,SAAS;QAC7B,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,EAAE,KAAK,CAAC,CAAC;YAAE,SAAS;QACxB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACrC,IAAI,GAAG,KAAK,WAAW;YAAE,SAAS;QAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAC,IAAI,EAAE,CAAC;QAC1D,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAC9E,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACpC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -7,4 +7,4 @@ export interface GetContextProfileArgs {
7
7
  hops?: number;
8
8
  federated?: boolean;
9
9
  }
10
- export declare function makeGetContextProfile(store: GraphStore, repoId: string): (args: GetContextProfileArgs) => Promise<ToolResult>;
10
+ export declare function makeGetContextProfile(store: GraphStore, repoId: string, repoPath?: string): (args: GetContextProfileArgs) => Promise<ToolResult>;
@@ -1,7 +1,8 @@
1
1
  import { resolveTarget } from "../profile/resolve.js";
2
2
  import { assembleProfile } from "../profile/assemble.js";
3
+ import { governingDecisionsFor } from "../profile/decisions.js";
3
4
  import { federationIds } from "../store/federation.js";
4
- export function makeGetContextProfile(store, repoId) {
5
+ export function makeGetContextProfile(store, repoId, repoPath) {
5
6
  return async (args) => {
6
7
  const sel = { node_id: args.node_id, file_path: args.file_path, name: args.name };
7
8
  if (!sel.node_id && !sel.name && !sel.file_path) {
@@ -34,6 +35,13 @@ export function makeGetContextProfile(store, repoId) {
34
35
  };
35
36
  }
36
37
  const profile = await assembleProfile(store, repoIds, resolved.target, hops);
38
+ if (repoPath) {
39
+ const gov = governingDecisionsFor(repoPath, resolved.target, repoId);
40
+ if (gov.decisions.length > 0)
41
+ profile.target.decisions = gov.decisions;
42
+ if (gov.needing_review.length > 0)
43
+ profile.decisions_needing_review = gov.needing_review;
44
+ }
37
45
  return { content: [{ type: "text", text: JSON.stringify(profile) }] };
38
46
  }
39
47
  catch (e) {
@@ -1 +1 @@
1
- {"version":3,"file":"getContextProfile.js","sourceRoot":"","sources":["../../src/tools/getContextProfile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAiB,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAWvD,MAAM,UAAU,qBAAqB,CAAC,KAAiB,EAAE,MAAc;IACrE,OAAO,KAAK,EAAE,IAA2B,EAAuB,EAAE;QAChE,MAAM,GAAG,GAAa,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5F,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;YAChD,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kDAAkD,EAAE,CAAC;gBACrF,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,GAAU,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC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AAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;gBACvE,IAAI,GAAG,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC;oBAAE,OAAO,CAAC,wBAAwB,GAAG,GAAG,CAAC,cAAc,CAAC;YAC3F,CAAC;YACD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;QACxE,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAG,CAAW,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACpF,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { GraphStore } from "../store/GraphStore.js";
2
+ import type { ToolResult } from "./readCypher.js";
3
+ export interface GetDecisionArgs {
4
+ decision_id: string;
5
+ }
6
+ export declare function makeGetDecision(store: GraphStore, repoId: string, repoPath: string): (args: GetDecisionArgs) => Promise<ToolResult>;
@@ -0,0 +1,59 @@
1
+ import { neutralizeSummary } from "../guard/summaryValidation.js";
2
+ import { anchorRepoIds, loadDecisions, resolveAnchorStates } from "../store/decisions.js";
3
+ const err = (text) => ({ content: [{ type: "text", text }], isError: true });
4
+ function neutralize(s) {
5
+ if (s === undefined)
6
+ return undefined;
7
+ return neutralizeSummary(s) ?? "";
8
+ }
9
+ export function makeGetDecision(store, repoId, repoPath) {
10
+ return async (args) => {
11
+ try {
12
+ const { decisions } = loadDecisions(repoPath);
13
+ const rec = decisions.find((d) => d.id === args.decision_id);
14
+ if (!rec)
15
+ return err(`unknown decision: ${args.decision_id}`);
16
+ const resolved = await resolveAnchorStates(store, await anchorRepoIds(store, repoId), rec.anchors);
17
+ // The chain in both directions: what this supersedes (recorded) and
18
+ // what supersedes it (recorded on flip, recovered from siblings if the
19
+ // flip was lost to merge damage).
20
+ const supersededBy = rec.superseded_by ??
21
+ decisions.find((d) => d.supersedes.includes(rec.id))?.id;
22
+ return {
23
+ content: [
24
+ {
25
+ type: "text",
26
+ text: JSON.stringify({
27
+ id: rec.id,
28
+ title: neutralize(rec.title),
29
+ status: rec.status,
30
+ context: neutralize(rec.context),
31
+ decision: neutralize(rec.decision),
32
+ ...(rec.consequences !== undefined ? { consequences: neutralize(rec.consequences) } : {}),
33
+ ...(rec.alternatives !== undefined ? { alternatives: neutralize(rec.alternatives) } : {}),
34
+ anchors: resolved.map((a) => ({
35
+ node_id: a.node_id,
36
+ path: a.path,
37
+ kind: a.kind,
38
+ state: a.state,
39
+ ...(a.resolved_node_id && a.resolved_node_id !== a.node_id
40
+ ? { resolved_node_id: a.resolved_node_id }
41
+ : {}),
42
+ })),
43
+ paths: rec.paths,
44
+ supersedes: rec.supersedes,
45
+ ...(supersededBy ? { superseded_by: supersededBy } : {}),
46
+ decided_at: rec.decided_at,
47
+ decided_by: rec.decided_by,
48
+ trigger: rec.trigger,
49
+ }),
50
+ },
51
+ ],
52
+ };
53
+ }
54
+ catch (e) {
55
+ return err(e.message);
56
+ }
57
+ };
58
+ }
59
+ //# sourceMappingURL=getDecision.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDecision.js","sourceRoot":"","sources":["../../src/tools/getDecision.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAM1F,MAAM,GAAG,GAAG,CAAC,IAAY,EAAc,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;AAEjG,SAAS,UAAU,CAAC,CAAqB;IACvC,IAAI,CAAC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 -13,4 +13,4 @@ export interface ImpactArgs {
13
13
  * edges are captured in the committed graph for read_cypher/visualization but are
14
14
  * intentionally NOT traversed here (recorded decision, matched across both
15
15
  * backends) — instantiation sites are not treated as impact-bearing callers. */
16
- export declare function makeImpact(store: GraphStore, repoId: string): (args: ImpactArgs) => Promise<ToolResult>;
16
+ export declare function makeImpact(store: GraphStore, repoId: string, repoPath?: string): (args: ImpactArgs) => Promise<ToolResult>;
@@ -1,5 +1,6 @@
1
1
  import { resolveTarget } from "../profile/resolve.js";
2
2
  import { computeImpact } from "../profile/impact.js";
3
+ import { governingDecisionsForNodes } from "../profile/decisions.js";
3
4
  import { federationIds } from "../store/federation.js";
4
5
  function clamp(val, min, max) {
5
6
  return Math.min(Math.max(val, min), max);
@@ -10,7 +11,7 @@ function clamp(val, min, max) {
10
11
  * edges are captured in the committed graph for read_cypher/visualization but are
11
12
  * intentionally NOT traversed here (recorded decision, matched across both
12
13
  * backends) — instantiation sites are not treated as impact-bearing callers. */
13
- export function makeImpact(store, repoId) {
14
+ export function makeImpact(store, repoId, repoPath) {
14
15
  return async (args) => {
15
16
  const sel = {
16
17
  node_id: args.node_id,
@@ -53,6 +54,17 @@ export function makeImpact(store, repoId) {
53
54
  const target = resolved.target;
54
55
  const depth = clamp(args.depth ?? 3, 1, 5);
55
56
  const result = await computeImpact(store, repoIds, target.id, target.qualified_name, target.file_path, { depth, maxNodes: 500 });
57
+ if (repoPath) {
58
+ const gov = governingDecisionsForNodes(repoPath, [
59
+ { node_id: target.id, file_path: target.file_path, content_hash: target.content_hash },
60
+ ...result.impacted.map((r) => ({ node_id: r.node_id, file_path: r.file_path })),
61
+ ], repoId);
62
+ if (gov.length > 0) {
63
+ return {
64
+ content: [{ type: "text", text: JSON.stringify({ ...result, governing_decisions: gov }) }],
65
+ };
66
+ }
67
+ }
56
68
  return {
57
69
  content: [{ type: "text", text: JSON.stringify(result) }],
58
70
  };
@@ -1 +1 @@
1
- {"version":3,"file":"impact.js","sourceRoot":"","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E,CAAC;gBACb,MAAM,GAAG,GAAG,0BAA0B,CACpC,QAAQ,EACR;oBACE,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE;oBACtF,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;iBAChF,EACD,MAAM,CACP,CAAC;gBACF,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACnB,OAAO;wBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,MAAM,EAAE,mBAAmB,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;qBAC3F,CAAC;gBACJ,CAAC;YACH,CAAC;YACD,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;aAC1D,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAG,CAAW,CAAC,OAAO,EAAE,CAAC;gBACvD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -1,10 +1,12 @@
1
1
  import type { ToolResult } from "./readCypher.js";
2
+ import { type GraphDeltaJson } from "../indexer/decisionsAffected.js";
2
3
  export type RunResult = {
3
4
  ok: true;
4
5
  nodes: number;
5
6
  edges: number;
6
7
  files: number;
7
8
  warnings: string[];
9
+ graph_delta?: GraphDeltaJson;
8
10
  } | {
9
11
  ok: false;
10
12
  error: string;
@@ -20,8 +22,20 @@ export interface InitArgs {
20
22
  path?: string;
21
23
  full?: boolean;
22
24
  }
23
- export declare function makeInitCpgSkeleton(repoId: string, deps?: Partial<IndexerDeps>): (args: InitArgs) => Promise<ToolResult>;
25
+ /** `path` (the repo to index) MUST come from the caller's already-resolved
26
+ * active repo (mcp/src/store/repoSession.ts), not re-derived here — this
27
+ * tool used to default to REPOSKEIN_REPO_PATH/cwd internally via
28
+ * runIndexer.js's `repoPath()`, which bypassed session.select_repo entirely
29
+ * and could index the wrong repo in workspace mode. Args-supplied `path`
30
+ * still wins, matching the original "explicit arg beats everything" rule. */
31
+ export declare function makeInitCpgSkeleton(repoId: string, repoPath: string, deps?: Partial<IndexerDeps>): (args: InitArgs) => Promise<ToolResult>;
24
32
  export interface ReindexArgs {
25
33
  path: string;
26
34
  }
27
- export declare function makeReindexFile(repoId: string, deps?: Partial<IndexerDeps>): (args: ReindexArgs) => Promise<ToolResult>;
35
+ /** `path` has no override `reindex_file`'s args only carry the file being
36
+ * reindexed, not a repo root — so this ALWAYS targets the caller's resolved
37
+ * active repo. Same reasoning as `makeInitCpgSkeleton` above: previously
38
+ * this read REPOSKEIN_REPO_PATH/cwd internally, independent of
39
+ * session.select_repo — the exact "reindex the wrong repo" bug class this
40
+ * parameter exists to close. */
41
+ export declare function makeReindexFile(repoId: string, repoPath: string, deps?: Partial<IndexerDeps>): (args: ReindexArgs) => Promise<ToolResult>;