kodevu 0.1.41 → 0.1.43
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/package.json +1 -1
- package/src/report-generator.js +7 -0
- package/src/reviewers.js +43 -11
package/package.json
CHANGED
package/src/report-generator.js
CHANGED
|
@@ -208,6 +208,7 @@ export function buildPrompt(config, backend, targetInfo, details, reviewDiffPayl
|
|
|
208
208
|
canReadRelatedFiles
|
|
209
209
|
? `${getPhrase("workspaceRoot", lang)} ${workspaceRoot}\n${getPhrase("besidesDiff", lang)}`
|
|
210
210
|
: getPhrase("noWorkspace", lang),
|
|
211
|
+
getPhrase("reviewFromDiff", lang),
|
|
211
212
|
getPhrase("fileRefs", lang),
|
|
212
213
|
getPhrase("langRule", lang, { langName }),
|
|
213
214
|
getPhrase("outputDirective", lang)
|
|
@@ -258,6 +259,7 @@ export function shouldWriteFormat(config, format) {
|
|
|
258
259
|
}
|
|
259
260
|
|
|
260
261
|
export function buildReport(config, backend, targetInfo, details, diffPayloads, reviewer, reviewerResult, tokenUsage) {
|
|
262
|
+
const stderrText = reviewerResult.stderr?.trim();
|
|
261
263
|
const lines = [
|
|
262
264
|
`# ${backend.displayName} Review Report: ${details.displayId}`,
|
|
263
265
|
"",
|
|
@@ -300,6 +302,10 @@ export function buildReport(config, backend, targetInfo, details, diffPayloads,
|
|
|
300
302
|
diffPayloads.report.text.trim() || "(empty diff)",
|
|
301
303
|
"```",
|
|
302
304
|
"",
|
|
305
|
+
"## Reviewer Diagnostics",
|
|
306
|
+
"",
|
|
307
|
+
stderrText ? "```text\n" + stderrText + "\n```" : "_No stderr output._",
|
|
308
|
+
"",
|
|
303
309
|
`## ${reviewer.responseSectionTitle}`,
|
|
304
310
|
"",
|
|
305
311
|
reviewerResult.message?.trim() ? reviewerResult.message.trim() : reviewer.emptyResponseText
|
|
@@ -351,6 +357,7 @@ export function buildJsonReport(config, backend, targetInfo, details, diffPayloa
|
|
|
351
357
|
}
|
|
352
358
|
},
|
|
353
359
|
diff: diffPayloads.report.text.trim(),
|
|
360
|
+
reviewerDiagnostics: reviewerResult.stderr?.trim() || "",
|
|
354
361
|
reviewerResponse: reviewerResult.message?.trim() ? reviewerResult.message.trim() : reviewer.emptyResponseText
|
|
355
362
|
};
|
|
356
363
|
}
|
package/src/reviewers.js
CHANGED
|
@@ -76,18 +76,50 @@ export const REVIEWERS = {
|
|
|
76
76
|
responseSectionTitle: "Copilot Response",
|
|
77
77
|
emptyResponseText: "_No final response returned from copilot._",
|
|
78
78
|
async run(config, workingDir, promptText, diffText) {
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "kodevu-copilot-"));
|
|
80
|
+
const reviewInputFile = path.join(tempDir, "review-input.md");
|
|
81
|
+
const copilotPrompt = [
|
|
82
|
+
`Use the file-reading tools to open this exact file path: ${reviewInputFile}`,
|
|
83
|
+
"That file contains the full review instructions and the unified diff to review.",
|
|
84
|
+
"Follow the instructions from that file exactly and output the final review directly.",
|
|
85
|
+
"Do not ask clarifying questions. Do not mention tool usage. Do not say you are ready.",
|
|
86
|
+
"Start immediately with the review content."
|
|
87
|
+
].join("\n");
|
|
88
|
+
const args = [
|
|
89
|
+
"-p",
|
|
90
|
+
copilotPrompt,
|
|
91
|
+
"-s",
|
|
92
|
+
"--no-color",
|
|
93
|
+
"--no-ask-user",
|
|
94
|
+
"--no-custom-instructions",
|
|
95
|
+
"--allow-all-tools",
|
|
96
|
+
"--add-dir",
|
|
97
|
+
workingDir,
|
|
98
|
+
"--add-dir",
|
|
99
|
+
tempDir
|
|
100
|
+
];
|
|
86
101
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
102
|
+
try {
|
|
103
|
+
await fs.writeFile(
|
|
104
|
+
reviewInputFile,
|
|
105
|
+
[promptText, "### Unified Diff", "```diff", diffText, "```"].join("\n\n"),
|
|
106
|
+
"utf8"
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
const execResult = await runCommand("copilot", args, {
|
|
110
|
+
cwd: workingDir,
|
|
111
|
+
allowFailure: true,
|
|
112
|
+
timeoutMs: config.commandTimeoutMs,
|
|
113
|
+
debug: config.debug
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
...execResult,
|
|
118
|
+
message: execResult.stdout
|
|
119
|
+
};
|
|
120
|
+
} finally {
|
|
121
|
+
await fs.rm(tempDir, { recursive: true, force: true });
|
|
122
|
+
}
|
|
91
123
|
}
|
|
92
124
|
}
|
|
93
125
|
};
|