kodevu 0.1.43 → 0.1.45
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 +31 -19
- package/package.json +1 -1
- package/src/config.js +8 -3
- package/src/review-runner.js +3 -0
package/README.md
CHANGED
|
@@ -12,25 +12,13 @@ Kodevu is designed to be stateless and requires no configuration files. It relie
|
|
|
12
12
|
|
|
13
13
|
## Quick Start
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Get a review of your latest commit in seconds:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
npx kodevu .
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Review
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npx kodevu . --last 3
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Review a specific commit:
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
npx kodevu . --rev abc1234
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Reports are written to `~/.kodevu/` by default.
|
|
21
|
+
Review reports are saved to `~/.kodevu/` by default.
|
|
34
22
|
|
|
35
23
|
## Usage
|
|
36
24
|
|
|
@@ -43,7 +31,7 @@ npx kodevu [target] [options]
|
|
|
43
31
|
- `target`: Repository path (Git) or SVN URL/Working copy (default: `.`).
|
|
44
32
|
- `--reviewer, -r`: `codex`, `gemini`, `copilot`, or `auto` (default: `auto`).
|
|
45
33
|
- `--rev, -v`: A specific revision or commit hash to review.
|
|
46
|
-
- `--last, -n`: Number of latest revisions to review (default: 1).
|
|
34
|
+
- `--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.
|
|
47
35
|
- `--lang, -l`: Output language (e.g., `zh`, `en`, `auto`).
|
|
48
36
|
- `--prompt, -p`: Additional instructions for the reviewer. Use `@file.txt` to read from a file.
|
|
49
37
|
- `--output, -o`: Report output directory (default: `~/.kodevu`).
|
|
@@ -51,6 +39,9 @@ npx kodevu [target] [options]
|
|
|
51
39
|
- `--debug, -d`: Print debug information.
|
|
52
40
|
- `--version, -V`: Print the current version and exit.
|
|
53
41
|
|
|
42
|
+
> [!IMPORTANT]
|
|
43
|
+
> `--rev` and `--last` are mutually exclusive. Specifying both will result in an error.
|
|
44
|
+
|
|
54
45
|
### Environment Variables
|
|
55
46
|
|
|
56
47
|
You can set these in your shell to change default behavior without typing flags every time:
|
|
@@ -63,17 +54,38 @@ You can set these in your shell to change default behavior without typing flags
|
|
|
63
54
|
|
|
64
55
|
## Examples
|
|
65
56
|
|
|
66
|
-
|
|
57
|
+
### Selecting Revisions
|
|
58
|
+
|
|
59
|
+
Review the **latest 3** commits:
|
|
60
|
+
```bash
|
|
61
|
+
npx kodevu . --last 3
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Review **only the 3rd** latest commit:
|
|
65
|
+
```bash
|
|
66
|
+
npx kodevu . --last -3
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Review a **specific commit** hash:
|
|
70
|
+
```bash
|
|
71
|
+
npx kodevu . --rev abc1234
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Options & Formatting
|
|
75
|
+
|
|
76
|
+
Review using **custom instructions** from a file:
|
|
67
77
|
```bash
|
|
68
78
|
npx kodevu . --prompt @my-rules.txt
|
|
69
79
|
```
|
|
70
80
|
|
|
71
|
-
|
|
81
|
+
Generate **JSON reports** in a local folder:
|
|
72
82
|
```bash
|
|
73
|
-
npx kodevu . --format json --output ./
|
|
83
|
+
npx kodevu . --format json --output ./reports
|
|
74
84
|
```
|
|
75
85
|
|
|
76
|
-
|
|
86
|
+
### Environment Variables
|
|
87
|
+
|
|
88
|
+
Set a **persistent reviewer** for your shell session:
|
|
77
89
|
```bash
|
|
78
90
|
export KODEVU_REVIEWER=gemini
|
|
79
91
|
npx kodevu .
|
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -161,7 +161,8 @@ export function parseCliArgs(argv) {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
if (value === "--last" || value === "-n") {
|
|
164
|
-
|
|
164
|
+
const hasLastValue = nextValue !== undefined && /^-?\d+$/.test(nextValue);
|
|
165
|
+
if (!hasLastValue) throw new Error(`Missing value for ${value}`);
|
|
165
166
|
args.last = nextValue;
|
|
166
167
|
index += 1;
|
|
167
168
|
continue;
|
|
@@ -220,6 +221,10 @@ export async function resolveConfig(cliArgs = {}) {
|
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
223
|
|
|
224
|
+
if (cliArgs.rev && cliArgs.last) {
|
|
225
|
+
throw new Error("Parameters --rev and --last are mutually exclusive. Please specify only one.");
|
|
226
|
+
}
|
|
227
|
+
|
|
223
228
|
if (!config.target) {
|
|
224
229
|
config.target = process.cwd();
|
|
225
230
|
}
|
|
@@ -258,7 +263,7 @@ export async function resolveConfig(cliArgs = {}) {
|
|
|
258
263
|
config.last = Number(config.last);
|
|
259
264
|
config.outputFormats = normalizeOutputFormats(config.outputFormats);
|
|
260
265
|
|
|
261
|
-
if (!config.rev && (isNaN(config.last) || config.last
|
|
266
|
+
if (!config.rev && (isNaN(config.last) || config.last === 0)) {
|
|
262
267
|
config.last = 1;
|
|
263
268
|
}
|
|
264
269
|
|
|
@@ -277,7 +282,7 @@ Options:
|
|
|
277
282
|
--prompt, -p Additional instructions or @file.txt to read from file
|
|
278
283
|
--lang, -l Output language (e.g. zh, en, auto)
|
|
279
284
|
--rev, -v Review specific revision(s), hashes, branches or ranges (comma-separated)
|
|
280
|
-
--last, -n Review the latest N revisions (
|
|
285
|
+
--last, -n Review the latest N revisions; use negative (-N) to review only the Nth-from-last revision (default: 1)
|
|
281
286
|
--output, -o Output directory (default: ~/.kodevu)
|
|
282
287
|
--format, -f Output formats (markdown, json, comma-separated)
|
|
283
288
|
--debug, -d Print extra debug information
|
package/src/review-runner.js
CHANGED
|
@@ -159,6 +159,9 @@ export async function runReviewCycle(config) {
|
|
|
159
159
|
|
|
160
160
|
if (config.rev) {
|
|
161
161
|
changeIdsToReview = await backend.resolveChangeIds(config, targetInfo, config.rev);
|
|
162
|
+
} else if (config.last < 0) {
|
|
163
|
+
const candidates = await backend.getLatestChangeIds(config, targetInfo, Math.abs(config.last));
|
|
164
|
+
changeIdsToReview = candidates.length > 0 ? [candidates[0]] : [];
|
|
162
165
|
} else {
|
|
163
166
|
changeIdsToReview = await backend.getLatestChangeIds(config, targetInfo, config.last || 1);
|
|
164
167
|
}
|