@d5render/cli 0.1.18 → 0.1.22
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 +23 -20
- package/bin/d5cli +59 -25
- package/package.json +3 -3
package/bin/copilot.js
CHANGED
|
@@ -19046,6 +19046,29 @@ const reportSchema = {
|
|
|
19046
19046
|
})).optional().describe("After gaining a comprehensive understanding of the files involved in the commits, propose suggestions for code corrections beyond the diff.")
|
|
19047
19047
|
};
|
|
19048
19048
|
|
|
19049
|
+
//#endregion
|
|
19050
|
+
//#region packages/message/sendding.ts
|
|
19051
|
+
async function sendding(title, text) {
|
|
19052
|
+
if (!envUsed.DINGTALK_WEBHOOK) throw new Error("non DINGTALK_WEBHOOK");
|
|
19053
|
+
let res = new Response();
|
|
19054
|
+
for (const url of envUsed.DINGTALK_WEBHOOK.split(",")) res = await fetch(url, {
|
|
19055
|
+
method: "POST",
|
|
19056
|
+
headers: { "Content-Type": "application/json" },
|
|
19057
|
+
body: JSON.stringify({
|
|
19058
|
+
msgtype: "markdown",
|
|
19059
|
+
markdown: {
|
|
19060
|
+
title,
|
|
19061
|
+
text
|
|
19062
|
+
},
|
|
19063
|
+
at: {
|
|
19064
|
+
atMobiles: ["17856104313"],
|
|
19065
|
+
isAtAll: false
|
|
19066
|
+
}
|
|
19067
|
+
})
|
|
19068
|
+
});
|
|
19069
|
+
return res;
|
|
19070
|
+
}
|
|
19071
|
+
|
|
19049
19072
|
//#endregion
|
|
19050
19073
|
//#region packages/message/report.ts
|
|
19051
19074
|
const lastComment = { value: {} };
|
|
@@ -19229,26 +19252,6 @@ function toCode(code$1) {
|
|
|
19229
19252
|
const ct = code$1.trim();
|
|
19230
19253
|
return ct.startsWith("```") && ct.endsWith("```") ? code$1 : `\`\`\`\n${code$1}\n\`\`\``;
|
|
19231
19254
|
}
|
|
19232
|
-
async function sendding(title, text) {
|
|
19233
|
-
if (!envUsed.DINGTALK_WEBHOOK) throw new Error("non DINGTALK_WEBHOOK");
|
|
19234
|
-
let res = new Response();
|
|
19235
|
-
for (const url of envUsed.DINGTALK_WEBHOOK.split(",")) res = await fetch(url, {
|
|
19236
|
-
method: "POST",
|
|
19237
|
-
headers: { "Content-Type": "application/json" },
|
|
19238
|
-
body: JSON.stringify({
|
|
19239
|
-
msgtype: "markdown",
|
|
19240
|
-
markdown: {
|
|
19241
|
-
title,
|
|
19242
|
-
text
|
|
19243
|
-
},
|
|
19244
|
-
at: {
|
|
19245
|
-
atMobiles: ["17856104313"],
|
|
19246
|
-
isAtAll: false
|
|
19247
|
-
}
|
|
19248
|
-
})
|
|
19249
|
-
});
|
|
19250
|
-
return res;
|
|
19251
|
-
}
|
|
19252
19255
|
|
|
19253
19256
|
//#endregion
|
|
19254
19257
|
//#region packages/message/index.ts
|
package/bin/d5cli
CHANGED
|
@@ -7,7 +7,7 @@ import { fileURLToPath } from "node:url";
|
|
|
7
7
|
|
|
8
8
|
//#region package.json
|
|
9
9
|
var name$1 = "@d5render/cli";
|
|
10
|
-
var version = "0.1.
|
|
10
|
+
var version = "0.1.22";
|
|
11
11
|
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region copilot/server/config.ts
|
|
@@ -60,6 +60,29 @@ function buildEnv() {
|
|
|
60
60
|
return envJson$1;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region packages/message/sendding.ts
|
|
65
|
+
async function sendding(title, text) {
|
|
66
|
+
if (!envUsed.DINGTALK_WEBHOOK) throw new Error("non DINGTALK_WEBHOOK");
|
|
67
|
+
let res = new Response();
|
|
68
|
+
for (const url of envUsed.DINGTALK_WEBHOOK.split(",")) res = await fetch(url, {
|
|
69
|
+
method: "POST",
|
|
70
|
+
headers: { "Content-Type": "application/json" },
|
|
71
|
+
body: JSON.stringify({
|
|
72
|
+
msgtype: "markdown",
|
|
73
|
+
markdown: {
|
|
74
|
+
title,
|
|
75
|
+
text
|
|
76
|
+
},
|
|
77
|
+
at: {
|
|
78
|
+
atMobiles: ["17856104313"],
|
|
79
|
+
isAtAll: false
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
return res;
|
|
84
|
+
}
|
|
85
|
+
|
|
63
86
|
//#endregion
|
|
64
87
|
//#region copilot/bin/install.ts
|
|
65
88
|
function install() {
|
|
@@ -197,31 +220,42 @@ function need() {
|
|
|
197
220
|
|
|
198
221
|
//#endregion
|
|
199
222
|
//#region copilot/bin/index.ts
|
|
200
|
-
|
|
223
|
+
try {
|
|
224
|
+
main();
|
|
225
|
+
} catch (error) {
|
|
226
|
+
sendding("CRITICAL", "未知错误,请自行检查日志");
|
|
227
|
+
throw error;
|
|
228
|
+
}
|
|
229
|
+
function main() {
|
|
230
|
+
const prompt = `Load skills, then call the mcp tool '${name}-${getHash}' to load code-review commits, if the task encounters an error, throw that.
|
|
201
231
|
Otherwise, use chinese as default language to call the mcp tool '${name}-${report}'`;
|
|
202
|
-
deploy();
|
|
203
|
-
if (need()) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
232
|
+
deploy();
|
|
233
|
+
if (need()) {
|
|
234
|
+
install();
|
|
235
|
+
const copilot = spawn("node", [
|
|
236
|
+
findCopilopt(),
|
|
237
|
+
...tools,
|
|
238
|
+
"--stream",
|
|
239
|
+
"off",
|
|
240
|
+
"-p",
|
|
241
|
+
prompt
|
|
242
|
+
], {
|
|
243
|
+
cwd: env.CI_PROJECT_DIR,
|
|
244
|
+
stdio: [
|
|
245
|
+
"inherit",
|
|
246
|
+
"pipe",
|
|
247
|
+
"pipe"
|
|
248
|
+
],
|
|
249
|
+
...platform === "win32" && { windowsHide: true }
|
|
250
|
+
});
|
|
251
|
+
copilot.stdout.on("data", (chunk) => console.log(String(chunk)));
|
|
252
|
+
copilot.stderr.on("data", (chunk) => console.error(String(chunk)));
|
|
253
|
+
copilot.on("close", (code) => {
|
|
254
|
+
sendding("CRITICAL", "Copilot 运行过程发生错误,请自行检查日志");
|
|
255
|
+
exit(code);
|
|
256
|
+
});
|
|
257
|
+
} else console.log("重复提交,进程跳过");
|
|
258
|
+
}
|
|
225
259
|
function findCopilopt() {
|
|
226
260
|
let copilot = execSync("npm list @github/copilot -g -p").toString().trim();
|
|
227
261
|
if (!copilot) {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "jasirou",
|
|
6
6
|
"main": "./bin/d5cli",
|
|
7
|
-
"version": "0.1.
|
|
7
|
+
"version": "0.1.22",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
10
10
|
"@types/node": "^25.0.3",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build:copilot": "node ./setup.js build",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
30
|
+
"release": "node ./setup.js publish",
|
|
31
|
+
"setup": "node ./setup.js"
|
|
32
32
|
}
|
|
33
33
|
}
|