@handong66/evidoc-patcher 0.1.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/src/index.d.ts +47 -0
- package/dist/src/index.js +287 -0
- package/dist/src/index.js.map +1 -0
- package/package.json +27 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { DriftFinding, DriftReport } from "@handong66/evidoc-core";
|
|
2
|
+
export type PatchKind = "safe_deterministic" | "llm_draft" | "human_only";
|
|
3
|
+
export type PatchClassification = "safe" | "review" | "blocked";
|
|
4
|
+
export interface PatchProposal {
|
|
5
|
+
kind: PatchKind;
|
|
6
|
+
classification?: PatchClassification;
|
|
7
|
+
rationale?: string;
|
|
8
|
+
findingId: string;
|
|
9
|
+
docPath: string;
|
|
10
|
+
unifiedDiff?: string;
|
|
11
|
+
requiresHumanReview: true;
|
|
12
|
+
}
|
|
13
|
+
export interface PatchValidation {
|
|
14
|
+
ok: boolean;
|
|
15
|
+
errors: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface LlmPatchRequest {
|
|
18
|
+
findingId: string;
|
|
19
|
+
allowedPaths: string[];
|
|
20
|
+
prompt: string;
|
|
21
|
+
evidence: DriftFinding["evidence"];
|
|
22
|
+
}
|
|
23
|
+
export interface LlmPatchResponse {
|
|
24
|
+
findingId: string;
|
|
25
|
+
docPath: string;
|
|
26
|
+
unifiedDiff: string;
|
|
27
|
+
}
|
|
28
|
+
export interface PatchApplyResult {
|
|
29
|
+
docPath: string;
|
|
30
|
+
bytesWritten: number;
|
|
31
|
+
}
|
|
32
|
+
export interface OpenAiCompatiblePatchProviderOptions {
|
|
33
|
+
endpoint: string;
|
|
34
|
+
apiKey: string;
|
|
35
|
+
model: string;
|
|
36
|
+
fetch?: typeof fetch;
|
|
37
|
+
}
|
|
38
|
+
export declare function assertPatchWritesAllowed(allowWrites: boolean): void;
|
|
39
|
+
export declare function createPatchProposals(report: DriftReport, documents: Record<string, string>): PatchProposal[];
|
|
40
|
+
export declare function validatePatchProposal(proposal: PatchProposal, report: DriftReport): PatchValidation;
|
|
41
|
+
export declare function createLlmPatchRequest(_report: DriftReport, finding: DriftFinding): LlmPatchRequest;
|
|
42
|
+
export declare function validateLlmPatchResponse(response: LlmPatchResponse, report: DriftReport): PatchValidation;
|
|
43
|
+
export declare function applyPatchProposal(root: string, proposal: PatchProposal, options: {
|
|
44
|
+
allowWrites: boolean;
|
|
45
|
+
}): Promise<PatchApplyResult>;
|
|
46
|
+
export declare function validatePatchByRescan(root: string, proposal: PatchProposal): Promise<PatchValidation>;
|
|
47
|
+
export declare function callOpenAiCompatiblePatchProvider(request: LlmPatchRequest, options: OpenAiCompatiblePatchProviderOptions): Promise<LlmPatchResponse>;
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { checkRepository, resolveExistingPathInsideRoot } from "@handong66/evidoc-core";
|
|
3
|
+
export function assertPatchWritesAllowed(allowWrites) {
|
|
4
|
+
if (!allowWrites) {
|
|
5
|
+
throw new Error("Patch writing is disabled unless explicitly enabled.");
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export function createPatchProposals(report, documents) {
|
|
9
|
+
return report.findings.map((finding) => {
|
|
10
|
+
const deterministic = createDeterministicProposal(finding, documents[finding.docPath]);
|
|
11
|
+
if (deterministic)
|
|
12
|
+
return deterministic;
|
|
13
|
+
return {
|
|
14
|
+
kind: "human_only",
|
|
15
|
+
classification: classifyFindingForPatch(finding, documents[finding.docPath]),
|
|
16
|
+
rationale: patchRationale(finding, documents[finding.docPath]),
|
|
17
|
+
findingId: finding.id,
|
|
18
|
+
docPath: finding.docPath,
|
|
19
|
+
requiresHumanReview: true
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export function validatePatchProposal(proposal, report) {
|
|
24
|
+
const errors = [];
|
|
25
|
+
const finding = report.findings.find((candidate) => candidate.id === proposal.findingId);
|
|
26
|
+
if (!finding) {
|
|
27
|
+
errors.push("proposal findingId is not present in the report");
|
|
28
|
+
}
|
|
29
|
+
if (finding && proposal.docPath !== finding.docPath) {
|
|
30
|
+
errors.push("proposal docPath does not match finding docPath");
|
|
31
|
+
}
|
|
32
|
+
if (proposal.kind !== "human_only" && !proposal.unifiedDiff) {
|
|
33
|
+
errors.push("non-human proposal must include a unifiedDiff");
|
|
34
|
+
}
|
|
35
|
+
if (proposal.unifiedDiff && !diffTouchesOnly(proposal.unifiedDiff, proposal.docPath)) {
|
|
36
|
+
errors.push("unifiedDiff touches files outside the evidence document");
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
ok: errors.length === 0,
|
|
40
|
+
errors
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export function createLlmPatchRequest(_report, finding) {
|
|
44
|
+
const prompt = [
|
|
45
|
+
"You are drafting a documentation patch for Evidoc.",
|
|
46
|
+
`Finding: ${finding.id}`,
|
|
47
|
+
`Allowed path: ${finding.docPath}`,
|
|
48
|
+
"Do not touch files outside the allowed path.",
|
|
49
|
+
"Return a unified diff only when the evidence fully supports the edit.",
|
|
50
|
+
"Evidence:",
|
|
51
|
+
JSON.stringify({
|
|
52
|
+
ruleId: finding.ruleId,
|
|
53
|
+
status: finding.status,
|
|
54
|
+
severity: finding.severity,
|
|
55
|
+
docPath: finding.docPath,
|
|
56
|
+
line: finding.line,
|
|
57
|
+
message: finding.message,
|
|
58
|
+
evidence: finding.evidence,
|
|
59
|
+
suggestedAction: finding.suggestedAction
|
|
60
|
+
}, null, 2)
|
|
61
|
+
].join("\n\n");
|
|
62
|
+
return {
|
|
63
|
+
findingId: finding.id,
|
|
64
|
+
allowedPaths: [finding.docPath],
|
|
65
|
+
prompt,
|
|
66
|
+
evidence: finding.evidence
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export function validateLlmPatchResponse(response, report) {
|
|
70
|
+
const errors = [];
|
|
71
|
+
const finding = report.findings.find((candidate) => candidate.id === response.findingId);
|
|
72
|
+
if (!finding) {
|
|
73
|
+
errors.push("LLM response findingId is not present in the report");
|
|
74
|
+
}
|
|
75
|
+
if (finding && response.docPath !== finding.docPath) {
|
|
76
|
+
errors.push("LLM response touches a file outside allowed evidence path");
|
|
77
|
+
}
|
|
78
|
+
if (!response.unifiedDiff.includes(`--- a/${response.docPath}`)) {
|
|
79
|
+
errors.push("LLM response does not include an expected old-file header");
|
|
80
|
+
}
|
|
81
|
+
if (!response.unifiedDiff.includes(`+++ b/${response.docPath}`)) {
|
|
82
|
+
errors.push("LLM response does not include an expected new-file header");
|
|
83
|
+
}
|
|
84
|
+
if (!diffTouchesOnly(response.unifiedDiff, response.docPath)) {
|
|
85
|
+
errors.push("LLM response touches a file outside allowed evidence path");
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
ok: errors.length === 0,
|
|
89
|
+
errors
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export async function applyPatchProposal(root, proposal, options) {
|
|
93
|
+
assertPatchWritesAllowed(options.allowWrites);
|
|
94
|
+
if (!proposal.unifiedDiff) {
|
|
95
|
+
throw new Error("Patch proposal does not include a unifiedDiff.");
|
|
96
|
+
}
|
|
97
|
+
if (!diffTouchesOnly(proposal.unifiedDiff, proposal.docPath)) {
|
|
98
|
+
throw new Error("Patch proposal diff touches files outside the evidence document.");
|
|
99
|
+
}
|
|
100
|
+
const target = await resolveExistingPathInsideRoot(root, proposal.docPath);
|
|
101
|
+
if (!target) {
|
|
102
|
+
throw new Error("Patch proposal targets a file outside repository root.");
|
|
103
|
+
}
|
|
104
|
+
const current = await readFile(target, "utf8");
|
|
105
|
+
const next = applySimpleUnifiedDiff(current, proposal.unifiedDiff);
|
|
106
|
+
await writeFile(target, next, "utf8");
|
|
107
|
+
return {
|
|
108
|
+
docPath: proposal.docPath,
|
|
109
|
+
bytesWritten: Buffer.byteLength(next)
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
export async function validatePatchByRescan(root, proposal) {
|
|
113
|
+
const report = await checkRepository(root);
|
|
114
|
+
const stillPresent = report.findings.some((finding) => finding.id === proposal.findingId);
|
|
115
|
+
return {
|
|
116
|
+
ok: !stillPresent,
|
|
117
|
+
errors: stillPresent ? ["finding is still present after applying patch"] : []
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export async function callOpenAiCompatiblePatchProvider(request, options) {
|
|
121
|
+
const fetchImpl = options.fetch ?? fetch;
|
|
122
|
+
const response = await fetchImpl(options.endpoint, {
|
|
123
|
+
method: "POST",
|
|
124
|
+
headers: {
|
|
125
|
+
"content-type": "application/json",
|
|
126
|
+
authorization: `Bearer ${options.apiKey}`
|
|
127
|
+
},
|
|
128
|
+
body: JSON.stringify({
|
|
129
|
+
model: options.model,
|
|
130
|
+
messages: [
|
|
131
|
+
{
|
|
132
|
+
role: "system",
|
|
133
|
+
content: "Return only JSON with findingId, docPath, and unifiedDiff. Do not include markdown."
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
role: "user",
|
|
137
|
+
content: request.prompt
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
})
|
|
141
|
+
});
|
|
142
|
+
if (!response.ok) {
|
|
143
|
+
throw new Error(`LLM provider request failed with HTTP ${response.status}.`);
|
|
144
|
+
}
|
|
145
|
+
const payload = (await response.json());
|
|
146
|
+
const content = payload.choices?.[0]?.message?.content;
|
|
147
|
+
if (!content) {
|
|
148
|
+
throw new Error("LLM provider response did not include message content.");
|
|
149
|
+
}
|
|
150
|
+
return JSON.parse(content);
|
|
151
|
+
}
|
|
152
|
+
function createDeterministicProposal(finding, documentText) {
|
|
153
|
+
if (!documentText)
|
|
154
|
+
return undefined;
|
|
155
|
+
if (finding.ruleId !== "command.package-manager-mismatch" &&
|
|
156
|
+
finding.ruleId !== "agent_instruction.package-manager-mismatch") {
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
const evidence = finding.evidence.find((item) => item.kind === "command" || item.kind === "agent_instruction");
|
|
160
|
+
if (!evidence?.expected || !evidence.actual)
|
|
161
|
+
return undefined;
|
|
162
|
+
const original = evidence.subject;
|
|
163
|
+
const replacement = original.replace(new RegExp(`\\b${escapeRegExp(evidence.actual)}\\b`, "i"), evidence.expected);
|
|
164
|
+
if (original === replacement || !documentText.includes(original))
|
|
165
|
+
return undefined;
|
|
166
|
+
const nextText = documentText.replace(original, replacement);
|
|
167
|
+
return {
|
|
168
|
+
kind: "safe_deterministic",
|
|
169
|
+
classification: "safe",
|
|
170
|
+
rationale: "Deterministic command rewrite is fully supported by package-manager evidence.",
|
|
171
|
+
findingId: finding.id,
|
|
172
|
+
docPath: finding.docPath,
|
|
173
|
+
unifiedDiff: createUnifiedDiff(finding.docPath, documentText, nextText),
|
|
174
|
+
requiresHumanReview: true
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function classifyFindingForPatch(finding, documentText) {
|
|
178
|
+
if (!documentText || finding.evidence.length === 0 || finding.ruleId === "review_log.override-expired") {
|
|
179
|
+
return "blocked";
|
|
180
|
+
}
|
|
181
|
+
return "review";
|
|
182
|
+
}
|
|
183
|
+
function patchRationale(finding, documentText) {
|
|
184
|
+
if (!documentText) {
|
|
185
|
+
return "Blocked because the evidence document could not be read.";
|
|
186
|
+
}
|
|
187
|
+
if (finding.evidence.length === 0) {
|
|
188
|
+
return "Blocked because there is insufficient evidence to draft a bounded patch.";
|
|
189
|
+
}
|
|
190
|
+
if (finding.ruleId === "review_log.override-expired") {
|
|
191
|
+
return "Blocked because an expired review override requires a fresh human decision.";
|
|
192
|
+
}
|
|
193
|
+
return "Requires human review because the evidence supports a change, but the exact wording needs judgment.";
|
|
194
|
+
}
|
|
195
|
+
function createUnifiedDiff(path, before, after) {
|
|
196
|
+
const beforeLines = before.replace(/\n$/, "").split("\n");
|
|
197
|
+
const afterLines = after.replace(/\n$/, "").split("\n");
|
|
198
|
+
const lines = [
|
|
199
|
+
`--- a/${path}`,
|
|
200
|
+
`+++ b/${path}`,
|
|
201
|
+
`@@ -1,${beforeLines.length} +1,${afterLines.length} @@`
|
|
202
|
+
];
|
|
203
|
+
const max = Math.max(beforeLines.length, afterLines.length);
|
|
204
|
+
for (let index = 0; index < max; index += 1) {
|
|
205
|
+
const left = beforeLines[index];
|
|
206
|
+
const right = afterLines[index];
|
|
207
|
+
if (left === right && left !== undefined) {
|
|
208
|
+
lines.push(` ${left}`);
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
if (left !== undefined)
|
|
212
|
+
lines.push(`-${left}`);
|
|
213
|
+
if (right !== undefined)
|
|
214
|
+
lines.push(`+${right}`);
|
|
215
|
+
}
|
|
216
|
+
return `${lines.join("\n")}\n`;
|
|
217
|
+
}
|
|
218
|
+
function diffTouchesOnly(diff, docPath) {
|
|
219
|
+
const touched = [...diff.matchAll(/^(?:---|\+\+\+) [ab]\/(.+)$/gm)].map((match) => match[1]);
|
|
220
|
+
return touched.length > 0 && touched.every((path) => path === docPath);
|
|
221
|
+
}
|
|
222
|
+
function applySimpleUnifiedDiff(current, diff) {
|
|
223
|
+
const currentLines = current.replace(/\n$/, "").split("\n");
|
|
224
|
+
const nextLines = [];
|
|
225
|
+
const diffLines = diff.split(/\r?\n/);
|
|
226
|
+
let currentIndex = 0;
|
|
227
|
+
let sawHunk = false;
|
|
228
|
+
let sawChange = false;
|
|
229
|
+
for (const line of diffLines) {
|
|
230
|
+
if (line.startsWith("--- ") || line.startsWith("+++ "))
|
|
231
|
+
continue;
|
|
232
|
+
if (line.startsWith("@@")) {
|
|
233
|
+
const hunk = parseHunkHeader(line);
|
|
234
|
+
const oldStart = hunk?.oldStart ?? 1;
|
|
235
|
+
const targetIndex = Math.max(0, oldStart - 1);
|
|
236
|
+
while (currentIndex < targetIndex && currentIndex < currentLines.length) {
|
|
237
|
+
nextLines.push(currentLines[currentIndex]);
|
|
238
|
+
currentIndex += 1;
|
|
239
|
+
}
|
|
240
|
+
sawHunk = true;
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
if (!sawHunk || line === "")
|
|
244
|
+
continue;
|
|
245
|
+
if (line.startsWith("-")) {
|
|
246
|
+
const expected = line.slice(1);
|
|
247
|
+
if (currentLines[currentIndex] !== expected) {
|
|
248
|
+
throw new Error("Unified diff deletion did not match the current file.");
|
|
249
|
+
}
|
|
250
|
+
currentIndex += 1;
|
|
251
|
+
sawChange = true;
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
if (line.startsWith("+")) {
|
|
255
|
+
nextLines.push(line.slice(1));
|
|
256
|
+
sawChange = true;
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
if (line.startsWith(" ")) {
|
|
260
|
+
const expected = line.slice(1);
|
|
261
|
+
if (currentLines[currentIndex] !== expected) {
|
|
262
|
+
throw new Error("Unified diff context did not match the current file.");
|
|
263
|
+
}
|
|
264
|
+
nextLines.push(expected);
|
|
265
|
+
currentIndex += 1;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if (!sawHunk || !sawChange) {
|
|
269
|
+
throw new Error("Unified diff did not contain an applicable hunk.");
|
|
270
|
+
}
|
|
271
|
+
while (currentIndex < currentLines.length) {
|
|
272
|
+
nextLines.push(currentLines[currentIndex]);
|
|
273
|
+
currentIndex += 1;
|
|
274
|
+
}
|
|
275
|
+
const trailingNewline = current.endsWith("\n") ? "\n" : "";
|
|
276
|
+
return `${nextLines.join("\n")}${trailingNewline}`;
|
|
277
|
+
}
|
|
278
|
+
function parseHunkHeader(line) {
|
|
279
|
+
const match = line.match(/^@@ -(\d+)(?:,\d+)? \+\d+(?:,\d+)? @@/);
|
|
280
|
+
if (!match)
|
|
281
|
+
return undefined;
|
|
282
|
+
return { oldStart: Number.parseInt(match[1], 10) };
|
|
283
|
+
}
|
|
284
|
+
function escapeRegExp(value) {
|
|
285
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 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
+
{
|
|
2
|
+
"name": "@handong66/evidoc-patcher",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"prepublishOnly": "node ../../scripts/ensure-built-package.mjs"
|
|
7
|
+
},
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/src/index.js"
|
|
10
|
+
},
|
|
11
|
+
"types": "./dist/src/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/src"
|
|
14
|
+
],
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@handong66/evidoc-core": "0.1.0"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/handong66/Evidoc.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/handong66/Evidoc/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/handong66/Evidoc#readme"
|
|
27
|
+
}
|