@descryy/mcp 0.5.0 → 0.7.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/action-handshake.d.ts +8 -75
- package/dist/action-handshake.d.ts.map +1 -1
- package/dist/action-handshake.js +9 -79
- package/dist/action-handshake.js.map +1 -1
- package/dist/bin/descry-mcp.d.ts +4 -15
- package/dist/bin/descry-mcp.d.ts.map +1 -1
- package/dist/bin/descry-mcp.js +12 -42
- package/dist/bin/descry-mcp.js.map +1 -1
- package/dist/browser/driver.d.ts +62 -178
- package/dist/browser/driver.d.ts.map +1 -1
- package/dist/browser/driver.js +14 -46
- package/dist/browser/driver.js.map +1 -1
- package/dist/browser/evidence.d.ts +11 -35
- package/dist/browser/evidence.d.ts.map +1 -1
- package/dist/browser/evidence.js +25 -51
- package/dist/browser/evidence.js.map +1 -1
- package/dist/browser/fake-driver.d.ts +12 -16
- package/dist/browser/fake-driver.d.ts.map +1 -1
- package/dist/browser/fake-driver.js +24 -17
- package/dist/browser/fake-driver.js.map +1 -1
- package/dist/browser/graph-write.d.ts +4 -45
- package/dist/browser/graph-write.d.ts.map +1 -1
- package/dist/browser/graph-write.js +8 -53
- package/dist/browser/graph-write.js.map +1 -1
- package/dist/browser/playwright-driver.d.ts +17 -67
- package/dist/browser/playwright-driver.d.ts.map +1 -1
- package/dist/browser/playwright-driver.js +169 -166
- package/dist/browser/playwright-driver.js.map +1 -1
- package/dist/browser/provider.d.ts +5 -34
- package/dist/browser/provider.d.ts.map +1 -1
- package/dist/browser/provider.js +4 -24
- package/dist/browser/provider.js.map +1 -1
- package/dist/browser/registry.d.ts +26 -106
- package/dist/browser/registry.d.ts.map +1 -1
- package/dist/browser/registry.js +20 -77
- package/dist/browser/registry.js.map +1 -1
- package/dist/browser/scenario-resolve.d.ts +10 -44
- package/dist/browser/scenario-resolve.d.ts.map +1 -1
- package/dist/browser/scenario-resolve.js +10 -41
- package/dist/browser/scenario-resolve.js.map +1 -1
- package/dist/browser/scenario-runner.d.ts +12 -70
- package/dist/browser/scenario-runner.d.ts.map +1 -1
- package/dist/browser/scenario-runner.js +33 -91
- package/dist/browser/scenario-runner.js.map +1 -1
- package/dist/browser/stack-parser.d.ts +4 -28
- package/dist/browser/stack-parser.d.ts.map +1 -1
- package/dist/browser/stack-parser.js +12 -39
- package/dist/browser/stack-parser.js.map +1 -1
- package/dist/browser/tool-support.d.ts +20 -67
- package/dist/browser/tool-support.d.ts.map +1 -1
- package/dist/browser/tool-support.js +22 -66
- package/dist/browser/tool-support.js.map +1 -1
- package/dist/browser/url-scheme.d.ts +14 -0
- package/dist/browser/url-scheme.d.ts.map +1 -0
- package/dist/browser/url-scheme.js +38 -0
- package/dist/browser/url-scheme.js.map +1 -0
- package/dist/cancellation.d.ts +11 -46
- package/dist/cancellation.d.ts.map +1 -1
- package/dist/cancellation.js +11 -46
- package/dist/cancellation.js.map +1 -1
- package/dist/capped.d.ts +17 -0
- package/dist/capped.d.ts.map +1 -0
- package/dist/capped.js +15 -0
- package/dist/capped.js.map +1 -0
- package/dist/disclosure-ledger.d.ts +6 -30
- package/dist/disclosure-ledger.d.ts.map +1 -1
- package/dist/disclosure-ledger.js +4 -26
- package/dist/disclosure-ledger.js.map +1 -1
- package/dist/index.d.ts +10 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -17
- package/dist/index.js.map +1 -1
- package/dist/module-trust.d.ts +24 -0
- package/dist/module-trust.d.ts.map +1 -0
- package/dist/module-trust.js +60 -0
- package/dist/module-trust.js.map +1 -0
- package/dist/path-confinement.d.ts +31 -0
- package/dist/path-confinement.d.ts.map +1 -0
- package/dist/path-confinement.js +44 -0
- package/dist/path-confinement.js.map +1 -0
- package/dist/protocol.d.ts +10 -53
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +14 -60
- package/dist/protocol.js.map +1 -1
- package/dist/registry.d.ts +10 -58
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +38 -90
- package/dist/registry.js.map +1 -1
- package/dist/render.d.ts +79 -11
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +126 -14
- package/dist/render.js.map +1 -1
- package/dist/runtime-registry.d.ts +8 -49
- package/dist/runtime-registry.d.ts.map +1 -1
- package/dist/runtime-registry.js +72 -63
- package/dist/runtime-registry.js.map +1 -1
- package/dist/scenarios/index.d.ts +1 -1
- package/dist/scenarios/index.d.ts.map +1 -1
- package/dist/scenarios/index.js +1 -1
- package/dist/scenarios/index.js.map +1 -1
- package/dist/scenarios/parse.d.ts +4 -18
- package/dist/scenarios/parse.d.ts.map +1 -1
- package/dist/scenarios/parse.js +14 -34
- package/dist/scenarios/parse.js.map +1 -1
- package/dist/scenarios/scenario.d.ts +18 -74
- package/dist/scenarios/scenario.d.ts.map +1 -1
- package/dist/scenarios/scenario.js +7 -34
- package/dist/scenarios/scenario.js.map +1 -1
- package/dist/scenarios/storage.d.ts +11 -41
- package/dist/scenarios/storage.d.ts.map +1 -1
- package/dist/scenarios/storage.js +57 -47
- package/dist/scenarios/storage.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +55 -13
- package/dist/server.js.map +1 -1
- package/dist/session.d.ts +69 -239
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +76 -231
- package/dist/session.js.map +1 -1
- package/dist/tools/analyze.d.ts +27 -101
- package/dist/tools/analyze.d.ts.map +1 -1
- package/dist/tools/analyze.js +58 -148
- package/dist/tools/analyze.js.map +1 -1
- package/dist/tools/browser-click.d.ts +3 -21
- package/dist/tools/browser-click.d.ts.map +1 -1
- package/dist/tools/browser-click.js +10 -31
- package/dist/tools/browser-click.js.map +1 -1
- package/dist/tools/browser-close-session.d.ts +4 -13
- package/dist/tools/browser-close-session.d.ts.map +1 -1
- package/dist/tools/browser-close-session.js +4 -13
- package/dist/tools/browser-close-session.js.map +1 -1
- package/dist/tools/browser-fill.d.ts +5 -36
- package/dist/tools/browser-fill.d.ts.map +1 -1
- package/dist/tools/browser-fill.js +9 -44
- package/dist/tools/browser-fill.js.map +1 -1
- package/dist/tools/browser-navigate.d.ts +6 -27
- package/dist/tools/browser-navigate.d.ts.map +1 -1
- package/dist/tools/browser-navigate.js +6 -23
- package/dist/tools/browser-navigate.js.map +1 -1
- package/dist/tools/browser-run-scenario.d.ts +5 -31
- package/dist/tools/browser-run-scenario.d.ts.map +1 -1
- package/dist/tools/browser-run-scenario.js +10 -46
- package/dist/tools/browser-run-scenario.js.map +1 -1
- package/dist/tools/browser-save-scenario.d.ts +3 -28
- package/dist/tools/browser-save-scenario.d.ts.map +1 -1
- package/dist/tools/browser-save-scenario.js +102 -55
- package/dist/tools/browser-save-scenario.js.map +1 -1
- package/dist/tools/browser-snapshot.d.ts +6 -39
- package/dist/tools/browser-snapshot.d.ts.map +1 -1
- package/dist/tools/browser-snapshot.js +4 -31
- package/dist/tools/browser-snapshot.js.map +1 -1
- package/dist/tools/browser-start-session.d.ts +4 -23
- package/dist/tools/browser-start-session.d.ts.map +1 -1
- package/dist/tools/browser-start-session.js +38 -51
- package/dist/tools/browser-start-session.js.map +1 -1
- package/dist/tools/browser-type.d.ts +5 -35
- package/dist/tools/browser-type.d.ts.map +1 -1
- package/dist/tools/browser-type.js +10 -45
- package/dist/tools/browser-type.js.map +1 -1
- package/dist/tools/contracts.d.ts +17 -63
- package/dist/tools/contracts.d.ts.map +1 -1
- package/dist/tools/contracts.js +91 -47
- package/dist/tools/contracts.js.map +1 -1
- package/dist/tools/cross-pr.d.ts +56 -15
- package/dist/tools/cross-pr.d.ts.map +1 -1
- package/dist/tools/cross-pr.js +141 -38
- package/dist/tools/cross-pr.js.map +1 -1
- package/dist/tools/git-diff.d.ts +18 -2
- package/dist/tools/git-diff.d.ts.map +1 -1
- package/dist/tools/git-diff.js +143 -23
- package/dist/tools/git-diff.js.map +1 -1
- package/dist/tools/git-history.d.ts +5 -16
- package/dist/tools/git-history.d.ts.map +1 -1
- package/dist/tools/git-history.js +3 -10
- package/dist/tools/git-history.js.map +1 -1
- package/dist/tools/history.d.ts +4 -33
- package/dist/tools/history.d.ts.map +1 -1
- package/dist/tools/history.js +6 -31
- package/dist/tools/history.js.map +1 -1
- package/dist/tools/impact.d.ts +7 -51
- package/dist/tools/impact.d.ts.map +1 -1
- package/dist/tools/impact.js +15 -67
- package/dist/tools/impact.js.map +1 -1
- package/dist/tools/index.d.ts +3 -8
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +3 -8
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/kit.d.ts +66 -113
- package/dist/tools/kit.d.ts.map +1 -1
- package/dist/tools/kit.js +60 -28
- package/dist/tools/kit.js.map +1 -1
- package/dist/tools/link-workspace.d.ts +7 -45
- package/dist/tools/link-workspace.d.ts.map +1 -1
- package/dist/tools/link-workspace.js +10 -48
- package/dist/tools/link-workspace.js.map +1 -1
- package/dist/tools/lookup.d.ts +4 -14
- package/dist/tools/lookup.d.ts.map +1 -1
- package/dist/tools/lookup.js +4 -14
- package/dist/tools/lookup.js.map +1 -1
- package/dist/tools/mark-incident.d.ts +7 -54
- package/dist/tools/mark-incident.d.ts.map +1 -1
- package/dist/tools/mark-incident.js +15 -68
- package/dist/tools/mark-incident.js.map +1 -1
- package/dist/tools/observe-runtime.d.ts +27 -210
- package/dist/tools/observe-runtime.d.ts.map +1 -1
- package/dist/tools/observe-runtime.js +258 -436
- package/dist/tools/observe-runtime.js.map +1 -1
- package/dist/tools/observe-tests.d.ts +9 -88
- package/dist/tools/observe-tests.d.ts.map +1 -1
- package/dist/tools/observe-tests.js +34 -108
- package/dist/tools/observe-tests.js.map +1 -1
- package/dist/tools/pr-analysis.d.ts +18 -2
- package/dist/tools/pr-analysis.d.ts.map +1 -1
- package/dist/tools/pr-analysis.js +73 -23
- package/dist/tools/pr-analysis.js.map +1 -1
- package/dist/tools/pre-push.d.ts +94 -9
- package/dist/tools/pre-push.d.ts.map +1 -1
- package/dist/tools/pre-push.js +139 -34
- package/dist/tools/pre-push.js.map +1 -1
- package/dist/tools/propagation.d.ts +11 -53
- package/dist/tools/propagation.d.ts.map +1 -1
- package/dist/tools/propagation.js +14 -57
- package/dist/tools/propagation.js.map +1 -1
- package/dist/tools/questions.d.ts +13 -63
- package/dist/tools/questions.d.ts.map +1 -1
- package/dist/tools/questions.js +33 -105
- package/dist/tools/questions.js.map +1 -1
- package/dist/tools/refusal-fetch.d.ts +4 -40
- package/dist/tools/refusal-fetch.d.ts.map +1 -1
- package/dist/tools/refusal-fetch.js +4 -40
- package/dist/tools/refusal-fetch.js.map +1 -1
- package/dist/tools/runtime-incident.d.ts +4 -63
- package/dist/tools/runtime-incident.d.ts.map +1 -1
- package/dist/tools/runtime-incident.js +10 -87
- package/dist/tools/runtime-incident.js.map +1 -1
- package/dist/tools/scope.d.ts +7 -25
- package/dist/tools/scope.d.ts.map +1 -1
- package/dist/tools/scope.js +17 -20
- package/dist/tools/scope.js.map +1 -1
- package/dist/tools/similar-incidents.d.ts +11 -86
- package/dist/tools/similar-incidents.d.ts.map +1 -1
- package/dist/tools/similar-incidents.js +7 -71
- package/dist/tools/similar-incidents.js.map +1 -1
- package/dist/tools/validate.d.ts +31 -47
- package/dist/tools/validate.d.ts.map +1 -1
- package/dist/tools/validate.js +133 -61
- package/dist/tools/validate.js.map +1 -1
- package/dist/tools/verification-status.d.ts +9 -64
- package/dist/tools/verification-status.d.ts.map +1 -1
- package/dist/tools/verification-status.js +9 -62
- package/dist/tools/verification-status.js.map +1 -1
- package/dist/tools/verify-claim.d.ts +5 -52
- package/dist/tools/verify-claim.d.ts.map +1 -1
- package/dist/tools/verify-claim.js +6 -56
- package/dist/tools/verify-claim.js.map +1 -1
- package/dist/transport.d.ts +15 -52
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +16 -60
- package/dist/transport.js.map +1 -1
- package/package.json +33 -16
package/dist/tools/git-diff.js
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* plus the unified-diff patch text when it is cheap enough to hand to a
|
|
10
10
|
* model (§4: the client's context window is not this tool's to spend).
|
|
11
11
|
*/
|
|
12
|
-
import { applyReplySizeBudget, gitDiff, TOTAL_PATCH_BUDGET_REASON_PREFIX } from "@descryy/core";
|
|
13
|
-
import { answer, optionalInteger, optionalString,
|
|
12
|
+
import { applyReplySizeBudget, changedFiles, gitDiff, gitWorkingTreeChange, TOTAL_PATCH_BUDGET_REASON_PREFIX, } from "@descryy/core";
|
|
13
|
+
import { answer, optionalInteger, descryOwnState, optionalString, ToolInputError, optionalStringArray, } from "./kit.js";
|
|
14
14
|
const DEFAULT_LIMIT = 200;
|
|
15
15
|
/**
|
|
16
16
|
* The stable prefix of `patchOmittedReason` when the *reply's* size ceiling,
|
|
@@ -37,8 +37,8 @@ function fileBytes(file) {
|
|
|
37
37
|
* happened, so the caller re-requests narrowed instead of reading a short list
|
|
38
38
|
* as the whole diff.
|
|
39
39
|
*/
|
|
40
|
-
function fitDiff(
|
|
41
|
-
const scaffold = Buffer.byteLength(JSON.stringify({
|
|
40
|
+
function fitDiff(identity, shown, filesTotal, budgetBytes) {
|
|
41
|
+
const scaffold = Buffer.byteLength(JSON.stringify({ ...identity, files: [], filesTotal }), "utf8");
|
|
42
42
|
const fitted = applyReplySizeBudget(shown, {
|
|
43
43
|
maxTotalBytes: budgetBytes,
|
|
44
44
|
overheadBytes: scaffold,
|
|
@@ -68,7 +68,7 @@ function fitDiff(base, head, shown, filesTotal, budgetBytes) {
|
|
|
68
68
|
'"files" to see them.');
|
|
69
69
|
}
|
|
70
70
|
return {
|
|
71
|
-
data: {
|
|
71
|
+
data: { ...identity, files: fitted.items, filesTotal },
|
|
72
72
|
notes,
|
|
73
73
|
...(fitted.droppedCount > 0
|
|
74
74
|
? {
|
|
@@ -86,8 +86,22 @@ const SCHEMA = {
|
|
|
86
86
|
properties: {
|
|
87
87
|
base: {
|
|
88
88
|
type: "string",
|
|
89
|
-
description: "The ref to diff against. Required
|
|
90
|
-
"silently changes which diff the answer describes.",
|
|
89
|
+
description: "The ref to diff against. Required unless \"workingTree\" is given — there is no " +
|
|
90
|
+
"defensible default, and guessing one silently changes which diff the answer describes.",
|
|
91
|
+
},
|
|
92
|
+
workingTree: {
|
|
93
|
+
type: "string",
|
|
94
|
+
enum: ["unstaged", "staged", "all"],
|
|
95
|
+
description: "Diff uncommitted state instead of two refs. \"unstaged\" is the working tree against " +
|
|
96
|
+
"the index, \"staged\" the index against HEAD, \"all\" everything not yet committed. " +
|
|
97
|
+
"Mutually exclusive with \"base\", and never inferred: a working tree and a ref range " +
|
|
98
|
+
"answer different questions, so the caller declares which one they are asking.",
|
|
99
|
+
},
|
|
100
|
+
includeUntracked: {
|
|
101
|
+
type: "boolean",
|
|
102
|
+
description: "With \"workingTree\", also report files git has never seen, as new-file patches. On " +
|
|
103
|
+
"by default, because they are part of the change about to be committed. Pass false to " +
|
|
104
|
+
"restrict the answer to files git already tracks; the narrowing is stated in the reply.",
|
|
91
105
|
},
|
|
92
106
|
head: { type: "string", description: "The tip being diffed. Default HEAD." },
|
|
93
107
|
files: {
|
|
@@ -113,12 +127,32 @@ const SCHEMA = {
|
|
|
113
127
|
},
|
|
114
128
|
limit: { type: "integer", minimum: 1, description: "Cap on files in the reply. Default 200." },
|
|
115
129
|
},
|
|
116
|
-
required: ["base"],
|
|
117
130
|
additionalProperties: false,
|
|
118
131
|
};
|
|
119
132
|
async function run(args, ctx) {
|
|
120
|
-
const
|
|
121
|
-
|
|
133
|
+
const workingTree = optionalString(args, "workingTree");
|
|
134
|
+
// Defaults **on**, unlike the core primitive it calls. That one is a library
|
|
135
|
+
// function whose existing callers must not change behaviour by upgrading;
|
|
136
|
+
// this is the product surface, and a caller who asks for "the working tree"
|
|
137
|
+
// and is not shown the file they just created has been answered about
|
|
138
|
+
// something narrower than they asked for.
|
|
139
|
+
const includeUntracked = args["includeUntracked"] !== false;
|
|
140
|
+
const baseArg = optionalString(args, "base");
|
|
141
|
+
if (workingTree === undefined && baseArg === undefined) {
|
|
142
|
+
// The rule survives the new mode rather than being relaxed by it: one of
|
|
143
|
+
// the two questions has to be chosen, and neither has a defensible default.
|
|
144
|
+
throw new ToolInputError('Give either "base" (a ref range) or "workingTree" (uncommitted state). There is no ' +
|
|
145
|
+
"defensible default, and guessing one silently changes which diff the answer describes.");
|
|
146
|
+
}
|
|
147
|
+
if (workingTree !== undefined && baseArg !== undefined) {
|
|
148
|
+
throw new ToolInputError('"base" and "workingTree" are mutually exclusive — they are two different questions. ' +
|
|
149
|
+
"Ask one.");
|
|
150
|
+
}
|
|
151
|
+
if (workingTree !== undefined && !["unstaged", "staged", "all"].includes(workingTree)) {
|
|
152
|
+
throw new ToolInputError(`"workingTree" must be "unstaged", "staged" or "all" — got "${workingTree}".`);
|
|
153
|
+
}
|
|
154
|
+
const base = baseArg ?? null;
|
|
155
|
+
const head = base === null ? null : optionalString(args, "head") ?? "HEAD";
|
|
122
156
|
const files = optionalStringArray(args, "files");
|
|
123
157
|
const maxPatchBytes = optionalInteger(args, "maxPatchBytes", 1);
|
|
124
158
|
const maxTotalPatchBytes = optionalInteger(args, "maxTotalPatchBytes", 1);
|
|
@@ -135,29 +169,85 @@ async function run(args, ctx) {
|
|
|
135
169
|
// the diff, not a claim about program shape.
|
|
136
170
|
nameLevel: true,
|
|
137
171
|
};
|
|
138
|
-
|
|
172
|
+
const scope = (workingTree ?? "all");
|
|
173
|
+
const subject = base === null ? `the working tree (${scope})` : `${base}...${head}`;
|
|
174
|
+
const mode = base === null ? "working-tree" : "range";
|
|
175
|
+
ctx.progress(`Diffing ${subject}`);
|
|
139
176
|
let all;
|
|
177
|
+
let untrackedTotal = 0;
|
|
178
|
+
let untrackedTruncated = false;
|
|
140
179
|
try {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
180
|
+
if (base === null) {
|
|
181
|
+
const change = await gitWorkingTreeChange(session.repoPath, {
|
|
182
|
+
scope,
|
|
183
|
+
includeUntracked,
|
|
184
|
+
exclude: descryOwnState(session.config.graph),
|
|
185
|
+
...(files === undefined ? {} : { files }),
|
|
186
|
+
...(maxPatchBytes === undefined ? {} : { maxPatchBytes }),
|
|
187
|
+
...(maxTotalPatchBytes === undefined ? {} : { maxTotalPatchBytes }),
|
|
188
|
+
});
|
|
189
|
+
all = change.files;
|
|
190
|
+
untrackedTotal = change.untrackedTotal;
|
|
191
|
+
untrackedTruncated = change.untrackedTruncated;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
all = await gitDiff(session.repoPath, base, head, {
|
|
195
|
+
...(files === undefined ? {} : { files }),
|
|
196
|
+
...(maxPatchBytes === undefined ? {} : { maxPatchBytes }),
|
|
197
|
+
...(maxTotalPatchBytes === undefined ? {} : { maxTotalPatchBytes }),
|
|
198
|
+
});
|
|
199
|
+
}
|
|
146
200
|
}
|
|
147
201
|
catch (error) {
|
|
148
202
|
return answer({
|
|
149
203
|
...envelope,
|
|
150
|
-
headline: `Could not diff ${
|
|
204
|
+
headline: `Could not diff ${subject}.`,
|
|
151
205
|
state: "refused",
|
|
152
|
-
data: {
|
|
206
|
+
data: {
|
|
207
|
+
mode,
|
|
208
|
+
base,
|
|
209
|
+
head,
|
|
210
|
+
files: [],
|
|
211
|
+
filesTotal: 0,
|
|
212
|
+
...(base === null
|
|
213
|
+
? { workingTree: { scope, includeUntracked, untrackedTotal: 0, untrackedTruncated: false } }
|
|
214
|
+
: {}),
|
|
215
|
+
},
|
|
153
216
|
notes: [
|
|
154
|
-
`git rejected
|
|
217
|
+
`git rejected it: ${error.message.trim()}.`,
|
|
155
218
|
"No diff was read, which is not a finding that nothing changed.",
|
|
156
219
|
],
|
|
157
220
|
});
|
|
158
221
|
}
|
|
222
|
+
// UAT round 3, Suggestion 5, audited into get_git_diff too: `options.files`
|
|
223
|
+
// is passed straight to `git diff -- <pathspec>` (`sources/git/diff.ts`),
|
|
224
|
+
// so a filter naming a path with no change in this diff comes back with
|
|
225
|
+
// zero entries exactly the way a genuinely empty base...head does — the
|
|
226
|
+
// same `all.length === 0` either way. Reporting both as "has no changes"
|
|
227
|
+
// would be the contracts/validate collapse one level down: a false
|
|
228
|
+
// statement about the whole diff when it was really the named files that
|
|
229
|
+
// matched nothing. Checked against the unfiltered file list — cheap,
|
|
230
|
+
// name-only, no patch content — so a real empty diff is not confused with
|
|
231
|
+
// one that has changes the named files simply do not include.
|
|
232
|
+
// Range mode only: working-tree mode has no second ref to re-diff without
|
|
233
|
+
// "files", and `changedFiles` needs both.
|
|
234
|
+
let filesMatchedNothing = false;
|
|
235
|
+
let wholeDiffCount = 0;
|
|
236
|
+
if (base !== null && all.length === 0 && files !== undefined && files.length > 0) {
|
|
237
|
+
ctx.progress(`Checking whether ${base}...${head} has any changes at all`);
|
|
238
|
+
const wholeDiff = await changedFiles(session.repoPath, base, head).catch(() => null);
|
|
239
|
+
if (wholeDiff !== null && wholeDiff.length > 0) {
|
|
240
|
+
filesMatchedNothing = true;
|
|
241
|
+
wholeDiffCount = wholeDiff.length;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
159
244
|
const shown = all.slice(0, limit);
|
|
160
245
|
const notes = [];
|
|
246
|
+
if (filesMatchedNothing) {
|
|
247
|
+
notes.push(`0 of the ${(files ?? []).length} named file(s) have any change in ${subject}, which ` +
|
|
248
|
+
`changes ${wholeDiffCount} file(s) in total when read without "files". This is not a ` +
|
|
249
|
+
"statement that the diff itself is empty.");
|
|
250
|
+
}
|
|
161
251
|
if (shown.length < all.length) {
|
|
162
252
|
notes.push(`${all.length - shown.length} further changed file(s) exist but are not listed — the reply ` +
|
|
163
253
|
`is capped at ${limit}.`);
|
|
@@ -176,20 +266,50 @@ async function run(args, ctx) {
|
|
|
176
266
|
'own size — their stats above are complete. Re-request them with a narrowed "files" to ' +
|
|
177
267
|
"read their patches.");
|
|
178
268
|
}
|
|
269
|
+
if (base === null && !includeUntracked) {
|
|
270
|
+
// The half not looked at, named. A working-tree answer that quietly omitted
|
|
271
|
+
// every never-added file would read as "nothing new here" on exactly the
|
|
272
|
+
// change that is most often entirely new files.
|
|
273
|
+
notes.push("Untracked files were not included — no form of git diff reports them, so a file written " +
|
|
274
|
+
'and not yet added is absent from this answer. Pass "includeUntracked" to see them.');
|
|
275
|
+
}
|
|
276
|
+
if (untrackedTruncated) {
|
|
277
|
+
notes.push(`${untrackedTotal} untracked file(s) exist and only some were diffed. The rest were counted, ` +
|
|
278
|
+
"not examined.");
|
|
279
|
+
}
|
|
179
280
|
return answer({
|
|
180
281
|
...envelope,
|
|
181
282
|
headline: all.length === 0
|
|
182
|
-
?
|
|
183
|
-
|
|
283
|
+
? filesMatchedNothing
|
|
284
|
+
? `0 of the ${(files ?? []).length} named file(s) have any change in ${subject}. ` +
|
|
285
|
+
"Not empty, not checked for those files."
|
|
286
|
+
: `${subject} has no changes.`
|
|
287
|
+
: `${subject} changes ${all.length} file(s)` +
|
|
184
288
|
(shown.length < all.length ? `, showing the first ${shown.length}.` : "."),
|
|
185
289
|
...(all.length === 0 ? { state: "empty" } : {}),
|
|
186
|
-
data: {
|
|
290
|
+
data: {
|
|
291
|
+
mode,
|
|
292
|
+
base,
|
|
293
|
+
head,
|
|
294
|
+
files: shown,
|
|
295
|
+
filesTotal: all.length,
|
|
296
|
+
...(base === null
|
|
297
|
+
? { workingTree: { scope, includeUntracked, untrackedTotal, untrackedTruncated } }
|
|
298
|
+
: {}),
|
|
299
|
+
},
|
|
187
300
|
truncated: shown.length < all.length,
|
|
188
301
|
...(shown.length < all.length
|
|
189
302
|
? { truncatedDetail: { shown: shown.length, total: all.length, more: null } }
|
|
190
303
|
: {}),
|
|
191
304
|
notes,
|
|
192
|
-
fitToBudget: (budgetBytes) => fitDiff(
|
|
305
|
+
fitToBudget: (budgetBytes) => fitDiff({
|
|
306
|
+
mode,
|
|
307
|
+
base,
|
|
308
|
+
head,
|
|
309
|
+
...(base === null
|
|
310
|
+
? { workingTree: { scope, includeUntracked, untrackedTotal, untrackedTruncated } }
|
|
311
|
+
: {}),
|
|
312
|
+
}, shown, all.length, budgetBytes),
|
|
193
313
|
});
|
|
194
314
|
}
|
|
195
315
|
export const gitDiffTool = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-diff.js","sourceRoot":"","sources":["../../src/tools/git-diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"git-diff.js","sourceRoot":"","sources":["../../src/tools/git-diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,OAAO,EACP,oBAAoB,EACpB,gCAAgC,GACjC,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,MAAM,EACN,eAAe,EACf,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,GAGpB,MAAM,UAAU,CAAC;AAGlB,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B;;;;;;GAMG;AACH,MAAM,0BAA0B,GAAG,kCAAkC,CAAC;AAEtE,sFAAsF;AACtF,SAAS,SAAS,CAAC,IAAkB;IACnC,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;AAC7D,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAS,OAAO,CACd,QAAqE,EACrE,KAA8B,EAC9B,UAAkB,EAClB,WAAmB;IAEnB,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAChC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EACtD,MAAM,CACP,CAAC;IAEF,MAAM,MAAM,GAAG,oBAAoB,CAAC,KAAK,EAAE;QACzC,aAAa,EAAE,WAAW;QAC1B,aAAa,EAAE,QAAQ;QACvB,MAAM,EAAE,SAAS;QACjB,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI;QACnC,y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EAA2E;IAC3E,0EAA0E;IAC1E,2EAA2E;IAC3E,8DAA8D;IAC9D,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,oCAAoC;IAC3C,WAAW,EACT,uFAAuF;QACvF,8FAA8F;QAC9F,2FAA2F;QAC3F,+FAA+F;QAC/F,4FAA4F;QAC5F,8FAA8F;QAC9F,4FAA4F;QAC5F,oEAAoE;IACtE,WAAW,EAAE,MAA4C;IACzD,GAAG;CACJ,CAAC"}
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* `history.ts`'s own `history` tool answers a different question — "which
|
|
6
|
-
* files does this one tend to change alongside", from the graph's stored
|
|
7
|
-
* `CHANGES_WITH` ledger, built once at `analyze` time. This tool answers
|
|
8
|
-
* "what commits touched this file" — a live `git log --follow`, with no
|
|
9
|
-
* graph involved and no staleness relative to the last `analyze` run.
|
|
10
|
-
*/
|
|
1
|
+
/** `get_git_history`, §18. Live `git log --follow` for one file — no graph, no staleness. Distinct
|
|
2
|
+
* from `history`'s stored `CHANGES_WITH` co-change ledger (built once at `analyze` time); this
|
|
3
|
+
* reads the working repository directly. */
|
|
11
4
|
import type { PathLogCommit } from "@descryy/core";
|
|
12
5
|
import { type ToolDefinition } from "./kit.ts";
|
|
13
6
|
export type GitHistoryCommit = PathLogCommit;
|
|
@@ -15,12 +8,8 @@ export interface GitHistoryData {
|
|
|
15
8
|
readonly file: string;
|
|
16
9
|
/** Capped by `maxCommits`, newest-first. */
|
|
17
10
|
readonly commits: readonly GitHistoryCommit[];
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* cheap `git log` count, not `commits.length`. Lets a caller tell "here
|
|
21
|
-
* are the 20 most recent" from "here are all 3 there are" without
|
|
22
|
-
* guessing from the cap.
|
|
23
|
-
*/
|
|
11
|
+
/** Every commit touching this file, independent of `maxCommits` — a separate count, not
|
|
12
|
+
* `commits.length`, so a caller can tell "20 most recent" from "all 3 there are". */
|
|
24
13
|
readonly totalTouching: number;
|
|
25
14
|
}
|
|
26
15
|
export declare const gitHistoryTool: ToolDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-history.d.ts","sourceRoot":"","sources":["../../src/tools/git-history.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"git-history.d.ts","sourceRoot":"","sources":["../../src/tools/git-history.ts"],"names":[],"mappings":"AAAA;;6CAE6C;AAG7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAA6D,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAK1G,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE7C,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C;0FACsF;IACtF,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AA2ED,eAAO,MAAM,cAAc,EAAE,cAa5B,CAAC"}
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* `history.ts`'s own `history` tool answers a different question — "which
|
|
6
|
-
* files does this one tend to change alongside", from the graph's stored
|
|
7
|
-
* `CHANGES_WITH` ledger, built once at `analyze` time. This tool answers
|
|
8
|
-
* "what commits touched this file" — a live `git log --follow`, with no
|
|
9
|
-
* graph involved and no staleness relative to the last `analyze` run.
|
|
10
|
-
*/
|
|
1
|
+
/** `get_git_history`, §18. Live `git log --follow` for one file — no graph, no staleness. Distinct
|
|
2
|
+
* from `history`'s stored `CHANGES_WITH` co-change ledger (built once at `analyze` time); this
|
|
3
|
+
* reads the working repository directly. */
|
|
11
4
|
import { logForPath } from "@descryy/core";
|
|
12
5
|
import { answer, optionalInteger, requiredString } from "./kit.js";
|
|
13
6
|
const DEFAULT_MAX_COMMITS = 20;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-history.js","sourceRoot":"","sources":["../../src/tools/git-history.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"git-history.js","sourceRoot":"","sources":["../../src/tools/git-history.ts"],"names":[],"mappings":"AAAA;;6CAE6C;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,cAAc,EAAyC,MAAM,UAAU,CAAC;AAG1G,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAa/B,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2DAA2D,EAAE;QAClG,UAAU,EAAE;YACV,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,oDAAoD;SAClE;KACF;IACD,QAAQ,EAAE,CAAC,MAAM,CAAC;IAClB,oBAAoB,EAAE,KAAK;CACnB,CAAC;AAEX,KAAK,UAAU,GAAG,CAAC,IAA6B,EAAE,GAAgB;IAChE,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC,IAAI,mBAAmB,CAAC;IAEjF,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC;IACxB,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC;IAC7C,MAAM,QAAQ,GAAG;QACf,eAAe,EAAE,CAAU,EAAE,mDAAmD;QAChF,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,eAAe,EAAE,KAAK,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MAAM,eAAe;oBACvD,CAAC,CAAC,GAAG,CAAC;QACd,GAAG,CAAC,MAAM,CAAC,aAAa,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,CAAC,aAAa,EAAE;QAC5E,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,aAAa;QACvD,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,aAAa;YAC9C,CAAC,CAAC,EAAE,eAAe,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;YAChG,CAAC,CAAC,EAAE,CAAC;QACP,KAAK;KACN,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,kCAAkC;IACzC,WAAW,EACT,6FAA6F;QAC7F,uFAAuF;QACvF,4FAA4F;QAC5F,iCAAiC;IACnC,WAAW,EAAE,MAA4C;IACzD,GAAG;CACJ,CAAC"}
|
package/dist/tools/history.d.ts
CHANGED
|
@@ -1,30 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `history
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* edges have existed in the graph since Step 11, produced by `analyze`'s git
|
|
6
|
-
* source when history reading is on (the default) — nothing queried them per
|
|
7
|
-
* node until this tool and `changesWith` (`@descryy/core`) beneath it.
|
|
8
|
-
*
|
|
9
|
-
* **Scoped to the stored co-change graph, not a live `git log`/`git diff`
|
|
10
|
-
* call.** §18's own line says "the tool names are implementation details" —
|
|
11
|
-
* what matters is the AI layer can ask a deterministic question about
|
|
12
|
-
* history and get a graph-backed answer, and the graph already holds exactly
|
|
13
|
-
* one such fact: which files changed together, how often, in the window
|
|
14
|
-
* `analyze` read. A raw diff or commit log is a different capability this
|
|
15
|
-
* tool does not claim.
|
|
16
|
-
*
|
|
17
|
-
* ## Why the lookup does not go through `resolveOneNode`
|
|
18
|
-
*
|
|
19
|
-
* `resolveOneNode({ file })` matches every node whose `file` column equals
|
|
20
|
-
* the given path — the `FILE` node the git source mints *and* every
|
|
21
|
-
* `MODULE`/`FUNCTION`/`CLASS` the language adapter mints from the same file.
|
|
22
|
-
* For a symbol lookup that ambiguity is the point; for a file-scoped
|
|
23
|
-
* question it is noise; `CHANGES_WITH` only ever connects `FILE` nodes
|
|
24
|
-
* (`packages/core/src/sources/git/source.ts`), so this tool resolves the
|
|
25
|
-
* path directly against the store and keeps only `type === "FILE"`, rather
|
|
26
|
-
* than reporting a spurious multi-candidate ambiguity for every file that
|
|
27
|
-
* has been parsed at all.
|
|
2
|
+
* `history`: co-change (`CHANGES_WITH`) lookup over the stored graph, not a
|
|
3
|
+
* live `git log`/`diff` — §18's `get_git_history`. Resolves the path
|
|
4
|
+
* directly, keeping only `type === "FILE"` — `resolveOneNode` would add noise since `CHANGES_WITH` only ever connects FILE nodes.
|
|
28
5
|
*/
|
|
29
6
|
import { type BriefNode, type ToolDefinition } from "./kit.ts";
|
|
30
7
|
/** A file this one moves with, and how strongly. */
|
|
@@ -43,13 +20,7 @@ export interface HistoryFileUnresolved {
|
|
|
43
20
|
readonly resolved: false;
|
|
44
21
|
readonly path: string;
|
|
45
22
|
}
|
|
46
|
-
/**
|
|
47
|
-
* One key, one shape, always. `resolved` tells a caller whether the
|
|
48
|
-
* `BriefNode` fields are meaningful — replacing an earlier design where
|
|
49
|
-
* `file` was a bare path string on this branch and a `BriefNode` on the
|
|
50
|
-
* other: same key, two types, so a caller reading `data.file.name` on the
|
|
51
|
-
* unresolved branch got `undefined` back with no error.
|
|
52
|
-
*/
|
|
23
|
+
/** One key, one shape: `resolved` says whether `BriefNode` fields are meaningful — replaces a design where `file` was a bare string on one branch, `undefined` with no error on the other. */
|
|
53
24
|
export type HistoryFile = HistoryFileResolved | HistoryFileUnresolved;
|
|
54
25
|
export interface HistoryReport {
|
|
55
26
|
readonly file: HistoryFile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/tools/history.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/tools/history.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAKL,KAAK,SAAS,EAEd,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;AAGlB,oDAAoD;AACpD,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,mEAAmE;IACnE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,8BAA8B;AAC9B,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;CACzB;AAED,8EAA8E;AAC9E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,8LAA8L;AAC9L,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,qBAAqB,CAAC;AAEtE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B;+EAC2E;IAC3E,QAAQ,CAAC,SAAS,EAAE,SAAS,aAAa,EAAE,CAAC;IAC7C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC;AAgFxC,eAAO,MAAM,WAAW,EAAE,cAYzB,CAAC"}
|
package/dist/tools/history.js
CHANGED
|
@@ -1,30 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `history
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* edges have existed in the graph since Step 11, produced by `analyze`'s git
|
|
6
|
-
* source when history reading is on (the default) — nothing queried them per
|
|
7
|
-
* node until this tool and `changesWith` (`@descryy/core`) beneath it.
|
|
8
|
-
*
|
|
9
|
-
* **Scoped to the stored co-change graph, not a live `git log`/`git diff`
|
|
10
|
-
* call.** §18's own line says "the tool names are implementation details" —
|
|
11
|
-
* what matters is the AI layer can ask a deterministic question about
|
|
12
|
-
* history and get a graph-backed answer, and the graph already holds exactly
|
|
13
|
-
* one such fact: which files changed together, how often, in the window
|
|
14
|
-
* `analyze` read. A raw diff or commit log is a different capability this
|
|
15
|
-
* tool does not claim.
|
|
16
|
-
*
|
|
17
|
-
* ## Why the lookup does not go through `resolveOneNode`
|
|
18
|
-
*
|
|
19
|
-
* `resolveOneNode({ file })` matches every node whose `file` column equals
|
|
20
|
-
* the given path — the `FILE` node the git source mints *and* every
|
|
21
|
-
* `MODULE`/`FUNCTION`/`CLASS` the language adapter mints from the same file.
|
|
22
|
-
* For a symbol lookup that ambiguity is the point; for a file-scoped
|
|
23
|
-
* question it is noise; `CHANGES_WITH` only ever connects `FILE` nodes
|
|
24
|
-
* (`packages/core/src/sources/git/source.ts`), so this tool resolves the
|
|
25
|
-
* path directly against the store and keeps only `type === "FILE"`, rather
|
|
26
|
-
* than reporting a spurious multi-candidate ambiguity for every file that
|
|
27
|
-
* has been parsed at all.
|
|
2
|
+
* `history`: co-change (`CHANGES_WITH`) lookup over the stored graph, not a
|
|
3
|
+
* live `git log`/`diff` — §18's `get_git_history`. Resolves the path
|
|
4
|
+
* directly, keeping only `type === "FILE"` — `resolveOneNode` would add noise since `CHANGES_WITH` only ever connects FILE nodes.
|
|
28
5
|
*/
|
|
29
6
|
import { changesWith, findNodes } from "@descryy/core";
|
|
30
7
|
import { briefNode, optionalInteger, optionalString, ToolInputError, } from "./kit.js";
|
|
@@ -73,11 +50,9 @@ async function run(args, ctx) {
|
|
|
73
50
|
notes.push(`${history.data.length - shown.length} further co-changed file(s) exist but are not listed — ` +
|
|
74
51
|
`the reply is capped at ${limit}.`);
|
|
75
52
|
}
|
|
76
|
-
// `history.truncated`
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
-
// just in prose — the exact defect P27's truncation-cursor pass exists to
|
|
80
|
-
// close (§4 technique 5).
|
|
53
|
+
// `history.truncated` is the query layer's own cap; it says nothing about
|
|
54
|
+
// this tool's `limit` slice, which can cap further — the defect P27's
|
|
55
|
+
// truncation-cursor pass exists to close (§4 technique 5).
|
|
81
56
|
const cappedByLimit = shown.length < history.data.length;
|
|
82
57
|
return {
|
|
83
58
|
result: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/tools/history.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/tools/history.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EACL,SAAS,EACT,eAAe,EACf,cAAc,EACd,cAAc,GAIf,MAAM,UAAU,CAAC;AAmClB,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oDAAoD,EAAE;QAC3F,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,mDAAmD,EAAE;KACzG;IACD,QAAQ,EAAE,CAAC,MAAM,CAAC;IAClB,oBAAoB,EAAE,KAAK;CACnB,CAAC;AAEX,KAA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5
|
-
* implementation details") — but three of the functions it names were already
|
|
6
|
-
* built and correct in the query layer with no MCP tool ever calling them:
|
|
7
|
-
* `impactOf` (blast radius — find_dependents/find_callers/find_usages),
|
|
8
|
-
* `testsCovering` (find_tests) and `rootCauseSearch` (find_related_incidents,
|
|
9
|
-
* find_fix_patterns). This wires all three under one call, the same way
|
|
10
|
-
* `validate` bundles env, rollback and the config graph — a developer asking
|
|
11
|
-
* "what does changing this touch" wants the blast radius, what already tests
|
|
12
|
-
* it and what has broken near it before in one answer, not three round trips.
|
|
13
|
-
*
|
|
14
|
-
* A fourth, `traceApi` (find_dependencies read the other direction, or "how
|
|
15
|
-
* does this reach that"), runs only when a second node is given — it answers
|
|
16
|
-
* a different question (a path between two specific symbols) and forcing it
|
|
17
|
-
* into every call would mean walking the graph for a question nobody asked.
|
|
18
|
-
*
|
|
19
|
-
* ## Direction, and why the default is structural rather than data-carrying
|
|
20
|
-
*
|
|
21
|
-
* `propagation` already owns PROPAGATES_TO/READS/WRITES/RETURNS — what data
|
|
22
|
-
* carries. This tool defaults to CALLS, IMPORTS, IMPLEMENTS, INHERITS,
|
|
23
|
-
* USES_API and SERVES_API — what structure depends on what. The two tools
|
|
24
|
-
* answer different questions over the same primitives; a caller after "who
|
|
25
|
-
* calls this" should never have to remember that CALLS lives in a tool named
|
|
26
|
-
* for propagation.
|
|
2
|
+
* `impact` wires §18's `impactOf`/`testsCovering`/`rootCauseSearch` (blast
|
|
3
|
+
* radius, tests, incidents) into one call, plus `traceApi` when `to` is
|
|
4
|
+
* given. Defaults to structural edges (CALLS/IMPORTS/IMPLEMENTS/INHERITS/USES_API/SERVES_API) — data-flow is `propagation`'s job.
|
|
27
5
|
*/
|
|
28
6
|
import type { EdgeType } from "@descryy/ir";
|
|
29
7
|
import { type BriefNode, type NodeCandidates, type ToolDefinition } from "./kit.ts";
|
|
@@ -33,12 +11,7 @@ export interface ImpactedNode extends BriefNode {
|
|
|
33
11
|
readonly score: number;
|
|
34
12
|
/** 1-based position in this answer, highest score first. */
|
|
35
13
|
readonly rank: number;
|
|
36
|
-
/**
|
|
37
|
-
* `top` / `notable` / `rest` by rank, never by an absolute score threshold.
|
|
38
|
-
* This score comes from `weightedBfs`'s confidence decay, not from
|
|
39
|
-
* `scoping/`'s designed weights, so §12.7's calibrated tiers do not apply to
|
|
40
|
-
* it — see `prominence.ts`'s header.
|
|
41
|
-
*/
|
|
14
|
+
/** `top`/`notable`/`rest` by rank, never an absolute score threshold — this score is `weightedBfs`'s confidence decay, not `scoping/`'s calibrated tiers. */
|
|
42
15
|
readonly prominence: "top" | "notable" | "rest";
|
|
43
16
|
}
|
|
44
17
|
/** An INCIDENT or FIX_PATTERN linked to the start node, and by which edge. */
|
|
@@ -57,34 +30,17 @@ export interface ImpactReport {
|
|
|
57
30
|
readonly affected: readonly ImpactedNode[];
|
|
58
31
|
readonly affectedTotal: number;
|
|
59
32
|
readonly coveringTests: readonly BriefNode[];
|
|
60
|
-
/**
|
|
61
|
-
* Incidents and fix patterns joined to this node by a graph edge.
|
|
62
|
-
*
|
|
63
|
-
* Structural only — `rootCauseSearch` walks edges and runs no similarity
|
|
64
|
-
* search, so an empty list is never evidence that no similar incident
|
|
65
|
-
* exists. For a failure with no node yet, `similar_incidents` is the tool.
|
|
66
|
-
*/
|
|
33
|
+
/** Incidents/fix patterns joined by a graph edge — structural only, no similarity search; an empty list is never evidence none exists (`similar_incidents` is that tool). */
|
|
67
34
|
readonly related: readonly RelatedNode[];
|
|
68
35
|
/** Null when no `to` was given, or when the one given did not resolve. */
|
|
69
36
|
readonly path: TracedPath | null;
|
|
70
|
-
/**
|
|
71
|
-
* False when no edge of any walked type touches the start node.
|
|
72
|
-
*
|
|
73
|
-
* **An empty `affected` with `analysed: false` means the walk did not run**,
|
|
74
|
-
* not that nothing depends on this symbol.
|
|
75
|
-
*/
|
|
37
|
+
/** False when no edge of any walked type touches the start node — an empty `affected` here means the walk didn't run, not that nothing depends on this symbol. */
|
|
76
38
|
readonly analysed: boolean;
|
|
77
39
|
readonly edgeTypesWalked: readonly EdgeType[];
|
|
78
40
|
/** The subset of `edgeTypesWalked` actually found on an edge touching this node. */
|
|
79
41
|
readonly edgeTypesPresent: readonly string[];
|
|
80
42
|
}
|
|
81
|
-
/**
|
|
82
|
-
* One call, two shapes.
|
|
83
|
-
*
|
|
84
|
-
* `NodeCandidates` arrives when the symbol did not resolve to exactly one
|
|
85
|
-
* node; narrow on `"from" in data`. Nothing was walked in that case, so none
|
|
86
|
-
* of `ImpactReport`'s counts exist rather than reading zero.
|
|
87
|
-
*/
|
|
43
|
+
/** One call, two shapes: `NodeCandidates` when the symbol didn't resolve to exactly one node (narrow on `"from" in data`) — nothing was walked, so `ImpactReport`'s counts don't exist rather than reading zero. */
|
|
88
44
|
export type ImpactData = ImpactReport | NodeCandidates;
|
|
89
45
|
export declare const impactTool: ToolDefinition;
|
|
90
46
|
//# sourceMappingURL=impact.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impact.d.ts","sourceRoot":"","sources":["../../src/tools/impact.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"impact.d.ts","sourceRoot":"","sources":["../../src/tools/impact.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,cAAc,EAEnB,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;AAIlB,2EAA2E;AAC3E,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,6JAA6J;IAC7J,QAAQ,CAAC,UAAU,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;CACjD;AAED,8EAA8E;AAC9E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