@d5render/cli 0.1.27 → 0.1.30
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 +26 -6
- package/bin/d5cli +11 -14
- package/package.json +1 -1
package/bin/copilot.js
CHANGED
|
@@ -18916,6 +18916,8 @@ const tools = [
|
|
|
18916
18916
|
"--deny-tool",
|
|
18917
18917
|
"github-mcp-server"
|
|
18918
18918
|
];
|
|
18919
|
+
console.log("production");
|
|
18920
|
+
tools.push("--model", "claude-sonnet-4.5");
|
|
18919
18921
|
function toEnv(key, defaultValue) {
|
|
18920
18922
|
return envJson[key] || process.env[key] || defaultValue;
|
|
18921
18923
|
}
|
|
@@ -18934,11 +18936,27 @@ const getCommits = () => {
|
|
|
18934
18936
|
if (url) return fetch(`${url}/commits`, { headers: buildHeaders() }).then((res) => {
|
|
18935
18937
|
if (!res.ok) throw new Error("");
|
|
18936
18938
|
return res.json();
|
|
18937
|
-
}).then((commits$1) =>
|
|
18938
|
-
|
|
18939
|
-
|
|
18940
|
-
|
|
18941
|
-
|
|
18939
|
+
}).then((commits$1) => {
|
|
18940
|
+
console.log(`[调试] 从 GitLab API 获取了 ${commits$1.length} 个提交记录`);
|
|
18941
|
+
commits$1.forEach((commit, index) => {
|
|
18942
|
+
console.log(`[调试] 提交记录 ${index + 1}:`, {
|
|
18943
|
+
提交ID: commit.id,
|
|
18944
|
+
短ID: commit.short_id,
|
|
18945
|
+
标题: commit.title,
|
|
18946
|
+
消息: commit.message?.substring(0, 50),
|
|
18947
|
+
作者姓名: commit.author_name,
|
|
18948
|
+
作者邮箱: commit.author_email,
|
|
18949
|
+
提交日期: commit.authored_date,
|
|
18950
|
+
提交者姓名: commit.committer_name,
|
|
18951
|
+
提交者邮箱: commit.committer_email
|
|
18952
|
+
});
|
|
18953
|
+
});
|
|
18954
|
+
return { content: [{
|
|
18955
|
+
type: "text",
|
|
18956
|
+
description: "commits from `merge pipeline`",
|
|
18957
|
+
text: `${commits$1.map((commit) => commit.id).join(",")}, the above review is from \`merge pipeline\` commits.`
|
|
18958
|
+
}] };
|
|
18959
|
+
}).catch((error) => ({
|
|
18942
18960
|
content: [{
|
|
18943
18961
|
type: "text",
|
|
18944
18962
|
text: "error" + error.message ? ", reason: " + error.message || "请求GitLab API失败" : ""
|
|
@@ -19140,12 +19158,13 @@ function distReports(input) {
|
|
|
19140
19158
|
}
|
|
19141
19159
|
}
|
|
19142
19160
|
for (const issue$1 of issues) {
|
|
19143
|
-
const { file: file$1 = "NON", commitSha = "", severity: severity$1 = "NON", commitSha: NCommitSha = "NON" } = issue$1;
|
|
19161
|
+
const { file: file$1 = "NON", commitSha = "", severity: severity$1 = "NON", commitSha: NCommitSha = "NON", commitAuthor = "" } = issue$1;
|
|
19144
19162
|
const fileList = fileMap.get(file$1) || [], issueList = severityMap.get(severity$1) || [];
|
|
19145
19163
|
fileList.push(issue$1);
|
|
19146
19164
|
fileMap.set(file$1, fileList);
|
|
19147
19165
|
issueList.push(issue$1);
|
|
19148
19166
|
severityMap.set(severity$1, issueList);
|
|
19167
|
+
if (commitSha || commitAuthor) console.log(`[调试] 问题提交信息 - 提交SHA: ${commitSha}, 作者: ${commitAuthor}, 文件: ${file$1}`);
|
|
19149
19168
|
if (commitSha) commitsSet.add(commitSha);
|
|
19150
19169
|
commitsMap.set(NCommitSha, issue$1);
|
|
19151
19170
|
distCommitComments(issue$1);
|
|
@@ -19210,6 +19229,7 @@ function distReports(input) {
|
|
|
19210
19229
|
break;
|
|
19211
19230
|
}
|
|
19212
19231
|
const { title: issueTitle = "NON", commitSha = "", file: file$1 = "NON", line = "NON", commitAuthor = "" } = issue$1;
|
|
19232
|
+
console.log(`[调试] 在钉钉报告中使用作者信息 - 提交SHA: ${commitSha}, 作者: ${commitAuthor}, 标题: ${issueTitle}`);
|
|
19213
19233
|
const shortSha = (commitSha || "").slice(0, 8);
|
|
19214
19234
|
const commitLink = linkBase && commitSha ? `${linkBase}/${commitSha}` : void 0;
|
|
19215
19235
|
dingdingReportMessage += `\n- ${issueTitle}\n\n - hash: ${commitLink ? `[${shortSha}](${commitLink}) ` : shortSha}\n\n - author: ${commitAuthor}\n\n - file: ${file$1}\n\n - line: ${line}`;
|
package/bin/d5cli
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { execSync, spawn } from "node:child_process";
|
|
3
3
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
|
-
import { argv, env, exit, platform } from "node:process";
|
|
5
|
+
import { argv, env, exit, platform, stdout } from "node:process";
|
|
6
6
|
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.30";
|
|
11
11
|
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region packages/gitlab/url.ts
|
|
@@ -178,6 +178,8 @@ const tools = [
|
|
|
178
178
|
"--deny-tool",
|
|
179
179
|
"github-mcp-server"
|
|
180
180
|
];
|
|
181
|
+
console.log("production");
|
|
182
|
+
tools.push("--model", "claude-sonnet-4.5");
|
|
181
183
|
function toEnv(key, defaultValue) {
|
|
182
184
|
return envJson[key] || process.env[key] || defaultValue;
|
|
183
185
|
}
|
|
@@ -238,8 +240,12 @@ function installCopilot() {
|
|
|
238
240
|
|
|
239
241
|
//#endregion
|
|
240
242
|
//#region copilot/bin/index.ts
|
|
243
|
+
function logImmediate(message) {
|
|
244
|
+
const text = typeof message === "string" ? message : String(message);
|
|
245
|
+
stdout.write(text + "\n");
|
|
246
|
+
if (!stdout.isTTY && stdout._flush) stdout._flush();
|
|
247
|
+
}
|
|
241
248
|
try {
|
|
242
|
-
console.log("开始代码审查-1");
|
|
243
249
|
codereview();
|
|
244
250
|
} catch (error) {
|
|
245
251
|
sendding("CRITICAL", "CRITICAL CI ERROR: 未知错误,请自行检查日志");
|
|
@@ -248,11 +254,10 @@ try {
|
|
|
248
254
|
function codereview() {
|
|
249
255
|
deploy();
|
|
250
256
|
if (!need()) {
|
|
251
|
-
|
|
257
|
+
logImmediate("重复提交,进程跳过");
|
|
252
258
|
return;
|
|
253
259
|
}
|
|
254
260
|
install();
|
|
255
|
-
console.log("开始代码审查-2");
|
|
256
261
|
const prompt = `Load skills, then call the mcp tool '${name}-${getHash}' to load code-review commits, if the task encounters an error, throw that.
|
|
257
262
|
Otherwise, use chinese as default language to call the mcp tool '${name}-${report}'`;
|
|
258
263
|
const copilot = spawn("node", [
|
|
@@ -278,19 +283,11 @@ Otherwise, use chinese as default language to call the mcp tool '${name}-${repor
|
|
|
278
283
|
});
|
|
279
284
|
copilot.stdout.setEncoding("utf8");
|
|
280
285
|
copilot.stderr.setEncoding("utf8");
|
|
281
|
-
let str = "";
|
|
282
|
-
function write(chunk) {
|
|
283
|
-
console.log(String(chunk));
|
|
284
|
-
}
|
|
285
286
|
copilot.stdout.on("data", (chunk) => {
|
|
286
|
-
str += chunk;
|
|
287
287
|
process.stdout.write(chunk);
|
|
288
|
-
write(chunk);
|
|
289
288
|
});
|
|
290
289
|
copilot.stderr.on("data", (chunk) => {
|
|
291
|
-
str += chunk;
|
|
292
290
|
process.stderr.write(chunk);
|
|
293
|
-
write(chunk);
|
|
294
291
|
});
|
|
295
292
|
copilot.on("close", (code) => {
|
|
296
293
|
sendding("CRITICAL", "CRITICAL CI ERROR: 代码审查任务失败,请自行检查日志");
|
|
@@ -313,7 +310,7 @@ function findCopilopt() {
|
|
|
313
310
|
if (!binPath) throw new Error("non copilot executable found");
|
|
314
311
|
const copilotVersion = copilotPackage.version || "unknown";
|
|
315
312
|
const copilotPath = join(copilot, binPath);
|
|
316
|
-
|
|
313
|
+
logImmediate(`${NAME} server:
|
|
317
314
|
version: ${VERSION}
|
|
318
315
|
path: ${serveFile}
|
|
319
316
|
copilot:
|