@d5render/cli 0.0.80 → 0.0.83
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/bin/copilot.js +18975 -18971
- package/bin/d5cli +12 -7
- package/package.json +3 -1
package/bin/d5cli
CHANGED
|
@@ -9,12 +9,12 @@ import { errorMessage, getHash, name, report, tools } from "../copilot.config.js
|
|
|
9
9
|
const prompt = `call the mcp tool '${name}-${getHash}' to load review commits, if the task encounters an error, throw that, otherwise, you can decide for yourself which tools to use to enrich context and determine whether a specific commit needs to be reviewed.
|
|
10
10
|
Then, use chinese as default language to organize the report into JSON format and call the mcp tool '${name}-${report}', please ignore error encountered when calling this and report title should not contain words such as MCP or "中文".`;
|
|
11
11
|
|
|
12
|
+
// TODO: 只支持保护分支触发
|
|
12
13
|
install();
|
|
13
14
|
const copilot = spawn("node", [findCopilopt(), "--stream", "off", ...tools, "-p", prompt], {
|
|
14
15
|
cwd: env.CI_PROJECT_DIR,
|
|
15
16
|
...(platform === "win32" && { windowsHide: true }),
|
|
16
17
|
});
|
|
17
|
-
|
|
18
18
|
let hasError = false;
|
|
19
19
|
const errorRegex = new RegExp(errorMessage, "i");
|
|
20
20
|
copilot.stdout.on("data", (data) => {
|
|
@@ -33,12 +33,9 @@ function install() {
|
|
|
33
33
|
if (!env.CI) return;
|
|
34
34
|
console.log("install dependencies...");
|
|
35
35
|
try {
|
|
36
|
-
const local =
|
|
37
|
-
platform !== "win32"
|
|
38
|
-
? execSync("npm i -g @github/copilot --registry=https://registry.npmmirror.com --force")
|
|
39
|
-
: execSync("npm list @github/copilot -g --depth=0 --json").toString();
|
|
36
|
+
const local = execSync("npm list @github/copilot -g --depth=0 --json").toString();
|
|
40
37
|
const localInfo = JSON.parse(local);
|
|
41
|
-
const localVersion = localInfo.dependencies?.["@github/copilot"]?.version;
|
|
38
|
+
const localVersion = localInfo.dependencies ? localInfo.dependencies?.["@github/copilot"]?.version : null;
|
|
42
39
|
const remoteVersion = execSync("npm view @github/copilot version --registry=https://registry.npmmirror.com")
|
|
43
40
|
.toString()
|
|
44
41
|
.trim();
|
|
@@ -49,11 +46,18 @@ function install() {
|
|
|
49
46
|
});
|
|
50
47
|
}
|
|
51
48
|
} catch (error) {
|
|
49
|
+
console.error("install dependencies error");
|
|
52
50
|
console.error(error);
|
|
51
|
+
if (error.status === 1 && error.stdout) {
|
|
52
|
+
execSync("npm install -g @github/copilot --registry=https://registry.npmmirror.com", {
|
|
53
|
+
stdio: "inherit",
|
|
54
|
+
});
|
|
55
|
+
console.log("install dependencies success");
|
|
56
|
+
}
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
function findCopilopt() {
|
|
56
|
-
let copilot =
|
|
60
|
+
let copilot = execSync("npm list @github/copilot -g -p").toString().trim();
|
|
57
61
|
if (!copilot) {
|
|
58
62
|
try {
|
|
59
63
|
const pathEnv = env.PATH || env.Path || "";
|
|
@@ -72,5 +76,6 @@ function findCopilopt() {
|
|
|
72
76
|
? copilotPackage.bin
|
|
73
77
|
: copilotPackage.bin?.copilot || copilotPackage.bin?.["@github/copilot"];
|
|
74
78
|
if (!binPath) throw new Error("找不到 copilot 可执行文件路径");
|
|
79
|
+
console.log(join(copilot, binPath), "copilot 已经被发现");
|
|
75
80
|
return join(copilot, binPath);
|
|
76
81
|
}
|
package/package.json
CHANGED
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "jasirou",
|
|
6
6
|
"main": "./bin/d5cli",
|
|
7
|
-
"version": "0.0.
|
|
7
|
+
"version": "0.0.83",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@modelcontextprotocol/sdk": "^1.24.3",
|
|
10
10
|
"@types/node": "22.18.1",
|
|
11
11
|
"@types/vscode": "^1.88.0",
|
|
12
12
|
"@vscode/vsce": "^3.2.2",
|
|
13
|
+
"oxfmt": "^0.21.0",
|
|
14
|
+
"oxlint": "^1.36.0",
|
|
13
15
|
"rolldown": "^1.0.0-beta.53",
|
|
14
16
|
"zod": "^4.1.13"
|
|
15
17
|
},
|