kodevu 0.1.7 → 0.1.9
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 +3 -3
- package/config.example.json +1 -1
- package/package.json +1 -2
- package/src/config.js +33 -1
- package/src/review-runner.js +1 -1
- package/src/vcs-client.js +20 -2
package/README.md
CHANGED
|
@@ -66,7 +66,7 @@ npx kodevu /path/to/your/repo --config ./config.current.json
|
|
|
66
66
|
|
|
67
67
|
- `target`: required repository target; can be provided by config or as the CLI positional argument
|
|
68
68
|
- `reviewer`: `codex`, `gemini`, or `auto`; default `auto`
|
|
69
|
-
- `
|
|
69
|
+
- `prompt`: saved into the report as review context
|
|
70
70
|
- `outputDir`: report output directory; default `~/.kodevu`
|
|
71
71
|
- `stateFilePath`: review state file path; default `~/.kodevu/state.json`
|
|
72
72
|
- `commandTimeoutMs`: timeout for a single review command execution in milliseconds
|
|
@@ -92,7 +92,7 @@ Internal defaults:
|
|
|
92
92
|
- Large diffs are truncated before being sent to the reviewer or written into the report once they exceed the configured line or character limits.
|
|
93
93
|
- For Git targets and local SVN working copies, the reviewer command runs from the repository workspace so it can inspect related files beyond the diff when needed.
|
|
94
94
|
- For remote SVN URLs without a local working copy, the review still relies on the diff and change metadata only.
|
|
95
|
-
- SVN reports
|
|
96
|
-
- Git reports are written as
|
|
95
|
+
- SVN reports are written as `<YYYYMMDD-HHmmss>-svn-r<revision>.md`.
|
|
96
|
+
- Git reports are written as `<YYYYMMDD-HHmmss>-git-<short-commit-hash>.md`.
|
|
97
97
|
- `~/.kodevu/state.json` stores per-project checkpoints keyed by repository identity; only the v2 multi-project structure is supported.
|
|
98
98
|
- If the reviewer command exits non-zero or times out, the report is still written, but the state is not advanced so the change can be retried later.
|
package/config.example.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"target": "C:/path/to/your/repository-or-subdirectory",
|
|
3
3
|
"reviewer": "auto",
|
|
4
|
-
"
|
|
4
|
+
"prompt": "请严格审查当前变更,优先指出 bug、回归风险、兼容性问题、安全问题、边界条件缺陷和缺失测试。请使用简体中文输出 Markdown;如果没有明确缺陷,请写“未发现明确缺陷”,并补充剩余风险。",
|
|
5
5
|
"outputDir": "~/.kodevu",
|
|
6
6
|
"stateFilePath": "~/.kodevu/state.json",
|
|
7
7
|
"commandTimeoutMs": 600000,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kodevu",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Poll SVN revisions or Git commits, send each change diff to a reviewer CLI, and write Markdown review reports.",
|
|
6
6
|
"bin": {
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
15
|
"start": "node src/index.js",
|
|
16
|
-
"once": "node src/index.js",
|
|
17
16
|
"check": "node --check src/index.js && node --check src/config.js && node --check src/review-runner.js && node --check src/svn-client.js && node --check src/git-client.js && node --check src/vcs-client.js && node --check src/shell.js"
|
|
18
17
|
},
|
|
19
18
|
"engines": {
|
package/src/config.js
CHANGED
|
@@ -14,7 +14,7 @@ const defaultConfig = {
|
|
|
14
14
|
outputDir: defaultStorageDir,
|
|
15
15
|
stateFilePath: path.join(defaultStorageDir, "state.json"),
|
|
16
16
|
commandTimeoutMs: 600000,
|
|
17
|
-
|
|
17
|
+
prompt:
|
|
18
18
|
"请严格审查当前变更,优先指出 bug、回归风险、兼容性问题、安全问题、边界条件缺陷和缺失测试。请使用简体中文输出 Markdown;如果没有明确缺陷,请写“未发现明确缺陷”,并补充剩余风险。",
|
|
19
19
|
maxRevisionsPerRun: 20
|
|
20
20
|
};
|
|
@@ -68,6 +68,8 @@ export function parseCliArgs(argv) {
|
|
|
68
68
|
target: "",
|
|
69
69
|
debug: false,
|
|
70
70
|
help: false,
|
|
71
|
+
reviewer: "",
|
|
72
|
+
prompt: "",
|
|
71
73
|
commandExplicitlySet: false
|
|
72
74
|
};
|
|
73
75
|
|
|
@@ -101,6 +103,26 @@ export function parseCliArgs(argv) {
|
|
|
101
103
|
continue;
|
|
102
104
|
}
|
|
103
105
|
|
|
106
|
+
if (value === "--reviewer" || value === "-r") {
|
|
107
|
+
const reviewer = argv[index + 1];
|
|
108
|
+
if (!reviewer || reviewer.startsWith("-")) {
|
|
109
|
+
throw new Error(`Missing value for ${value}`);
|
|
110
|
+
}
|
|
111
|
+
args.reviewer = reviewer;
|
|
112
|
+
index += 1;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (value === "--prompt" || value === "-p") {
|
|
117
|
+
const prompt = argv[index + 1];
|
|
118
|
+
if (!prompt || prompt.startsWith("-")) {
|
|
119
|
+
throw new Error(`Missing value for ${value}`);
|
|
120
|
+
}
|
|
121
|
+
args.prompt = prompt;
|
|
122
|
+
index += 1;
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
|
|
104
126
|
if (!value.startsWith("-") && args.command === "run" && !args.target) {
|
|
105
127
|
args.target = value;
|
|
106
128
|
continue;
|
|
@@ -139,6 +161,14 @@ export async function loadConfig(configPath, cliArgs = {}) {
|
|
|
139
161
|
config.target = cliArgs.target;
|
|
140
162
|
}
|
|
141
163
|
|
|
164
|
+
if (cliArgs.reviewer) {
|
|
165
|
+
config.reviewer = cliArgs.reviewer;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (cliArgs.prompt) {
|
|
169
|
+
config.prompt = cliArgs.prompt;
|
|
170
|
+
}
|
|
171
|
+
|
|
142
172
|
if (!config.target) {
|
|
143
173
|
throw new Error('Missing target. Pass `npx kodevu <repo-path>` or set "target" in config.json.');
|
|
144
174
|
}
|
|
@@ -188,6 +218,8 @@ Usage:
|
|
|
188
218
|
|
|
189
219
|
Options:
|
|
190
220
|
--config, -c Optional config json path. If omitted, ./config.json is loaded only when present
|
|
221
|
+
--reviewer, -r Override reviewer (codex | gemini | auto)
|
|
222
|
+
--prompt, -p Override prompt
|
|
191
223
|
--debug, -d Print extra debug information to the console
|
|
192
224
|
--help, -h Show help
|
|
193
225
|
|
package/src/review-runner.js
CHANGED
|
@@ -284,7 +284,7 @@ function buildPrompt(config, backend, targetInfo, details, reviewDiffPayload) {
|
|
|
284
284
|
const canReadRelatedFiles = backend.kind === "git" || Boolean(targetInfo.workingCopyPath);
|
|
285
285
|
|
|
286
286
|
return [
|
|
287
|
-
config.
|
|
287
|
+
config.prompt,
|
|
288
288
|
canReadRelatedFiles
|
|
289
289
|
? `You are running inside a read-only workspace rooted at: ${workspaceRoot}`
|
|
290
290
|
: "No local repository workspace is available for this review run.",
|
package/src/vcs-client.js
CHANGED
|
@@ -25,8 +25,17 @@ function createSvnBackend() {
|
|
|
25
25
|
return `r${revision}`;
|
|
26
26
|
},
|
|
27
27
|
getReportFileName(revision) {
|
|
28
|
-
|
|
28
|
+
const now = new Date();
|
|
29
|
+
const datePrefix = now.getFullYear() +
|
|
30
|
+
String(now.getMonth() + 1).padStart(2, '0') +
|
|
31
|
+
String(now.getDate()).padStart(2, '0') +
|
|
32
|
+
'-' +
|
|
33
|
+
String(now.getHours()).padStart(2, '0') +
|
|
34
|
+
String(now.getMinutes()).padStart(2, '0') +
|
|
35
|
+
String(now.getSeconds()).padStart(2, '0');
|
|
36
|
+
return `${datePrefix}-svn-r${revision}.md`;
|
|
29
37
|
},
|
|
38
|
+
|
|
30
39
|
async getTargetInfo(config) {
|
|
31
40
|
return await svnClient.getTargetInfo(config);
|
|
32
41
|
},
|
|
@@ -86,8 +95,17 @@ function createGitBackend() {
|
|
|
86
95
|
return commitHash.slice(0, 12);
|
|
87
96
|
},
|
|
88
97
|
getReportFileName(commitHash) {
|
|
89
|
-
|
|
98
|
+
const now = new Date();
|
|
99
|
+
const datePrefix = now.getFullYear() +
|
|
100
|
+
String(now.getMonth() + 1).padStart(2, '0') +
|
|
101
|
+
String(now.getDate()).padStart(2, '0') +
|
|
102
|
+
'-' +
|
|
103
|
+
String(now.getHours()).padStart(2, '0') +
|
|
104
|
+
String(now.getMinutes()).padStart(2, '0') +
|
|
105
|
+
String(now.getSeconds()).padStart(2, '0');
|
|
106
|
+
return `${datePrefix}-git-${commitHash.slice(0, 12)}.md`;
|
|
90
107
|
},
|
|
108
|
+
|
|
91
109
|
async getTargetInfo(config) {
|
|
92
110
|
return await gitClient.getTargetInfo(config);
|
|
93
111
|
},
|