kodevu 0.1.42 → 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 +1 -0
- package/src/reviewers.js +35 -13
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)
|
package/src/reviewers.js
CHANGED
|
@@ -76,28 +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 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");
|
|
79
88
|
const args = [
|
|
80
89
|
"-p",
|
|
81
|
-
|
|
90
|
+
copilotPrompt,
|
|
82
91
|
"-s",
|
|
83
92
|
"--no-color",
|
|
84
93
|
"--no-ask-user",
|
|
94
|
+
"--no-custom-instructions",
|
|
85
95
|
"--allow-all-tools",
|
|
86
96
|
"--add-dir",
|
|
87
|
-
workingDir
|
|
97
|
+
workingDir,
|
|
98
|
+
"--add-dir",
|
|
99
|
+
tempDir
|
|
88
100
|
];
|
|
89
|
-
const execResult = await runCommand("copilot", args, {
|
|
90
|
-
cwd: workingDir,
|
|
91
|
-
input: ["Unified diff:", diffText].join("\n\n"),
|
|
92
|
-
allowFailure: true,
|
|
93
|
-
timeoutMs: config.commandTimeoutMs,
|
|
94
|
-
debug: config.debug
|
|
95
|
-
});
|
|
96
101
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
+
}
|
|
101
123
|
}
|
|
102
124
|
}
|
|
103
125
|
};
|