kodevu 0.1.51 → 0.1.53
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/SKILL.md +63 -0
- package/package.json +3 -2
- package/src/git-client.js +9 -2
- package/src/review-runner.js +6 -8
package/SKILL.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kodevu
|
|
3
|
+
description: A tool to fetch Git commits or SVN revisions, send the diff to a supported AI reviewer CLI, and write configurable review reports.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Kodevu Skill
|
|
7
|
+
|
|
8
|
+
Kodevu is a Node.js tool that fetches Git commits or SVN revisions, sends the diff to a supported AI reviewer CLI, and writes review results to report files.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
Use `npx kodevu` to review a codebase. It is designed to be stateless and requires no configuration files.
|
|
13
|
+
|
|
14
|
+
### Reviewing the latest commit
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npx kodevu .
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Reviewing a specific commit
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx kodevu . --rev <commit-hash>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Reviewing the last N commits
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx kodevu . --last 3
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Supported Reviewers
|
|
33
|
+
|
|
34
|
+
`kodevu` supports several AI reviewer CLIs: `auto`, `openai`, `gemini`, `codex`, `copilot`. The default is `auto`. Use the `--reviewer` option to override.
|
|
35
|
+
|
|
36
|
+
Example using OpenAI:
|
|
37
|
+
```bash
|
|
38
|
+
npx kodevu . --reviewer openai --openai-api-key <YOUR_API_KEY> --openai-model gpt-4o
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Generating JSON Reports
|
|
42
|
+
|
|
43
|
+
By default, review reports are generated as Markdown files in `~/.kodevu/`. You can specify `--format json` or change the output directory using `--output <dir>`.
|
|
44
|
+
```bash
|
|
45
|
+
npx kodevu . --format json --output ./reports
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Formatting the Prompt
|
|
49
|
+
|
|
50
|
+
You can provide clear instructions to the reviewer using `--prompt`:
|
|
51
|
+
```bash
|
|
52
|
+
npx kodevu . --prompt "Focus on security issues and suggest optimizations."
|
|
53
|
+
```
|
|
54
|
+
Or from a file: `--prompt @my-rules.txt`
|
|
55
|
+
|
|
56
|
+
## Working with Target Repositories
|
|
57
|
+
|
|
58
|
+
- `target`: Repository path (Git) or SVN URL/Working copy (default: `.`).
|
|
59
|
+
|
|
60
|
+
For example, to run on a specific path, you can use:
|
|
61
|
+
```bash
|
|
62
|
+
npx kodevu /path/to/project --last 1
|
|
63
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kodevu",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.53",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Poll SVN revisions or Git commits, send each change diff to a reviewer CLI, and write configurable review reports.",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"src",
|
|
12
|
-
"README.md"
|
|
12
|
+
"README.md",
|
|
13
|
+
"SKILL.md"
|
|
13
14
|
],
|
|
14
15
|
"scripts": {
|
|
15
16
|
"start": "node src/index.js",
|
package/src/git-client.js
CHANGED
|
@@ -47,13 +47,20 @@ export async function getTargetInfo(config) {
|
|
|
47
47
|
const lookupCwd = targetStat.isDirectory() ? requestedTargetPath : path.dirname(requestedTargetPath);
|
|
48
48
|
const topLevelResult = await runGit(config, ["rev-parse", "--show-toplevel"], {
|
|
49
49
|
cwd: lookupCwd,
|
|
50
|
-
trim: true
|
|
50
|
+
trim: true,
|
|
51
|
+
allowFailure: true
|
|
51
52
|
});
|
|
53
|
+
|
|
54
|
+
if (topLevelResult.code !== 0) {
|
|
55
|
+
throw new Error(`Git target path is not within a Git repository: ${requestedTargetPath}`);
|
|
56
|
+
}
|
|
57
|
+
|
|
52
58
|
const repoRootPath = path.resolve(topLevelResult.stdout);
|
|
53
59
|
const relativeTargetPath = toPosixPath(path.relative(repoRootPath, requestedTargetPath));
|
|
54
60
|
const branchResult = await runGit(config, ["rev-parse", "--abbrev-ref", "HEAD"], {
|
|
55
61
|
cwd: repoRootPath,
|
|
56
|
-
trim: true
|
|
62
|
+
trim: true,
|
|
63
|
+
allowFailure: true
|
|
57
64
|
});
|
|
58
65
|
|
|
59
66
|
return {
|
package/src/review-runner.js
CHANGED
|
@@ -98,6 +98,12 @@ async function reviewChange(config, backend, targetInfo, changeId, progress) {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
if (!reviewerResult || reviewerResult.code !== 0 || reviewerResult.timedOut) {
|
|
102
|
+
throw new Error(
|
|
103
|
+
`${reviewer?.displayName || config.reviewer} failed for ${details.displayId}`
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
101
107
|
progress?.update(0.82, "writing report");
|
|
102
108
|
logger.debug(`Token usage: input=${tokenUsage.inputTokens} output=${tokenUsage.outputTokens} total=${tokenUsage.totalTokens} source=${tokenUsage.source}`);
|
|
103
109
|
const report = buildReport(currentReviewerConfig, backend, targetInfo, details, diffPayloads, reviewer, reviewerResult, tokenUsage);
|
|
@@ -115,14 +121,6 @@ async function reviewChange(config, backend, targetInfo, changeId, progress) {
|
|
|
115
121
|
);
|
|
116
122
|
}
|
|
117
123
|
|
|
118
|
-
if (reviewerResult.code !== 0 || reviewerResult.timedOut) {
|
|
119
|
-
throw new Error(
|
|
120
|
-
`${reviewer.displayName} failed for ${details.displayId}; report written to ${outputFile}${
|
|
121
|
-
shouldWriteFormat(config, "json") ? ` and ${jsonOutputFile}` : ""
|
|
122
|
-
}`
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
124
|
const outputLabels = [
|
|
127
125
|
shouldWriteFormat(config, "markdown") ? `md: ${outputFile}` : null,
|
|
128
126
|
shouldWriteFormat(config, "json") ? `json: ${jsonOutputFile}` : null
|