kodevu 0.1.64 → 0.1.66
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/README.md +1 -1
- package/package.json +1 -1
- package/src/config.js +3 -3
- package/src/reviewers.js +34 -0
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ npx kodevu [target] [options]
|
|
|
42
42
|
### Options
|
|
43
43
|
|
|
44
44
|
- `target`: Repository path (Git) or SVN URL/Working copy (default: `.`).
|
|
45
|
-
- `--reviewer, -r`: `codex`, `gemini`, `copilot`, `openai`, or `auto` (default: `auto`).
|
|
45
|
+
- `--reviewer, -r`: `codex`, `gemini`, `copilot`, `openai`, `opencode` or `auto` (default: `auto`).
|
|
46
46
|
- `--rev, -v`: A specific revision or commit hash to review.
|
|
47
47
|
- `--last, -n`: Number of latest revisions to review (default: 1). Use negative values (e.g., `-3`) to review only the 3rd commit from the top.
|
|
48
48
|
- `--uncommitted, -u`: Review current uncommitted changes in the target working tree.
|
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -8,8 +8,8 @@ const require = createRequire(import.meta.url);
|
|
|
8
8
|
const { version: packageVersion } = require("../package.json");
|
|
9
9
|
|
|
10
10
|
const defaultStorageDir = path.join(os.homedir(), ".kodevu");
|
|
11
|
-
const SUPPORTED_REVIEWERS = ["codex", "gemini", "copilot", "openai"];
|
|
12
|
-
const AUTO_SUPPORTED_REVIEWERS = ["codex", "gemini", "copilot"];
|
|
11
|
+
const SUPPORTED_REVIEWERS = ["codex", "gemini", "copilot", "openai", "opencode"];
|
|
12
|
+
const AUTO_SUPPORTED_REVIEWERS = ["codex", "gemini", "copilot", "opencode"];
|
|
13
13
|
|
|
14
14
|
const defaultConfig = {
|
|
15
15
|
reviewer: "auto",
|
|
@@ -405,7 +405,7 @@ Usage:
|
|
|
405
405
|
|
|
406
406
|
Options:
|
|
407
407
|
--target, <path> Target repository path (default: current directory)
|
|
408
|
-
--reviewer, -r Reviewer (codex | gemini | copilot | openai | auto, default: auto)
|
|
408
|
+
--reviewer, -r Reviewer (codex | gemini | copilot | openai | opencode | auto, default: auto)
|
|
409
409
|
--prompt, -p Additional instructions or @file.txt to read from file
|
|
410
410
|
--lang, -l Output language (e.g. zh, en, auto)
|
|
411
411
|
--rev, -v Review specific revision(s), hashes, branches or ranges (comma-separated)
|
package/src/reviewers.js
CHANGED
|
@@ -165,6 +165,40 @@ export const REVIEWERS = {
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
},
|
|
168
|
+
opencode: {
|
|
169
|
+
displayName: "OpenCode",
|
|
170
|
+
responseSectionTitle: "OpenCode Response",
|
|
171
|
+
emptyResponseText: "_No final response returned from opencode._",
|
|
172
|
+
async run(config, workingDir, promptText, diffText) {
|
|
173
|
+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "kodevu-opencode-"));
|
|
174
|
+
const reviewInputFile = path.join(tempDir, "review-input.md");
|
|
175
|
+
|
|
176
|
+
try {
|
|
177
|
+
await fs.writeFile(
|
|
178
|
+
reviewInputFile,
|
|
179
|
+
[promptText, "### Unified Diff", "```diff", diffText, "```"].join("\n\n"),
|
|
180
|
+
"utf8"
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
// Use a short message on the command line and pass full instructions via -f file
|
|
184
|
+
const args = ["run", "Review attached file", "-f", reviewInputFile, "--pure"];
|
|
185
|
+
|
|
186
|
+
const execResult = await runCommand("opencode", args, {
|
|
187
|
+
cwd: workingDir,
|
|
188
|
+
allowFailure: true,
|
|
189
|
+
timeoutMs: config.commandTimeoutMs,
|
|
190
|
+
debug: config.debug
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
return {
|
|
194
|
+
...execResult,
|
|
195
|
+
message: execResult.stdout || execResult.stderr || ""
|
|
196
|
+
};
|
|
197
|
+
} finally {
|
|
198
|
+
await fs.rm(tempDir, { recursive: true, force: true });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
},
|
|
168
202
|
openai: {
|
|
169
203
|
displayName: "OpenAI API",
|
|
170
204
|
responseSectionTitle: "OpenAI Response",
|