kodevu 0.1.20 → 0.1.21
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 +2 -3
- package/src/config.js +15 -6
- package/config.example.json +0 -12
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ If you want a config file, run `npx kodevu init` to create `./config.json` in th
|
|
|
32
32
|
npx kodevu init
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
This creates `config.json` in the current directory from
|
|
35
|
+
This creates `config.json` in the current directory from built-in defaults.
|
|
36
36
|
You only need this when you want to override defaults such as `reviewer` or output paths.
|
|
37
37
|
|
|
38
38
|
If you want a different path:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kodevu",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Poll SVN revisions or Git commits, send each change diff to a reviewer CLI, and write configurable review reports.",
|
|
6
6
|
"bin": {
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"src",
|
|
11
|
-
"README.md"
|
|
12
|
-
"config.example.json"
|
|
11
|
+
"README.md"
|
|
13
12
|
],
|
|
14
13
|
"scripts": {
|
|
15
14
|
"start": "node src/index.js",
|
package/src/config.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
|
-
import { constants as fsConstants } from "node:fs";
|
|
3
2
|
import os from "node:os";
|
|
4
3
|
import path from "node:path";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
4
|
import { findCommandOnPath } from "./shell.js";
|
|
7
5
|
|
|
8
6
|
const defaultStorageDir = path.join(os.homedir(), ".kodevu");
|
|
@@ -16,10 +14,21 @@ const defaultConfig = {
|
|
|
16
14
|
commandTimeoutMs: 600000,
|
|
17
15
|
prompt:
|
|
18
16
|
"请严格审查当前变更,优先指出 bug、回归风险、兼容性问题、安全问题、边界条件缺陷和缺失测试。请使用简体中文输出 Markdown;如果没有明确缺陷,请写“未发现明确缺陷”,并补充剩余风险。",
|
|
19
|
-
maxRevisionsPerRun:
|
|
17
|
+
maxRevisionsPerRun: 5,
|
|
20
18
|
outputFormats: ["markdown"]
|
|
21
19
|
};
|
|
22
20
|
|
|
21
|
+
const configTemplate = {
|
|
22
|
+
target: "C:/path/to/your/repository-or-subdirectory",
|
|
23
|
+
reviewer: defaultConfig.reviewer,
|
|
24
|
+
prompt: defaultConfig.prompt,
|
|
25
|
+
outputDir: "~/.kodevu",
|
|
26
|
+
stateFilePath: "~/.kodevu/state.json",
|
|
27
|
+
commandTimeoutMs: defaultConfig.commandTimeoutMs,
|
|
28
|
+
maxRevisionsPerRun: defaultConfig.maxRevisionsPerRun,
|
|
29
|
+
outputFormats: defaultConfig.outputFormats
|
|
30
|
+
};
|
|
31
|
+
|
|
23
32
|
function resolveConfigPath(baseDir, value) {
|
|
24
33
|
if (!value) {
|
|
25
34
|
return value;
|
|
@@ -264,12 +273,12 @@ Config highlights:
|
|
|
264
273
|
|
|
265
274
|
export async function initConfig(targetPath = "config.json") {
|
|
266
275
|
const absoluteTargetPath = path.resolve(targetPath);
|
|
267
|
-
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
268
|
-
const templatePath = path.join(packageRoot, "config.example.json");
|
|
269
276
|
|
|
270
277
|
await fs.mkdir(path.dirname(absoluteTargetPath), { recursive: true });
|
|
278
|
+
|
|
279
|
+
const content = JSON.stringify(configTemplate, null, 2) + "\n";
|
|
271
280
|
try {
|
|
272
|
-
await fs.
|
|
281
|
+
await fs.writeFile(absoluteTargetPath, content, { flag: "wx" });
|
|
273
282
|
} catch (error) {
|
|
274
283
|
if (error?.code === "EEXIST") {
|
|
275
284
|
throw new Error(`Config file already exists: ${absoluteTargetPath}`);
|
package/config.example.json
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"target": "C:/path/to/your/repository-or-subdirectory",
|
|
3
|
-
"reviewer": "auto",
|
|
4
|
-
"prompt": "请严格审查当前变更,优先指出 bug、回归风险、兼容性问题、安全问题、边界条件缺陷和缺失测试。请使用简体中文输出 Markdown;如果没有明确缺陷,请写“未发现明确缺陷”,并补充剩余风险。",
|
|
5
|
-
"outputDir": "~/.kodevu",
|
|
6
|
-
"stateFilePath": "~/.kodevu/state.json",
|
|
7
|
-
"commandTimeoutMs": 600000,
|
|
8
|
-
"maxRevisionsPerRun": 5,
|
|
9
|
-
"outputFormats": [
|
|
10
|
-
"markdown"
|
|
11
|
-
]
|
|
12
|
-
}
|