@d5render/cli 0.1.1 → 0.1.4

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/CHANGELOG.md CHANGED
@@ -1,9 +1,14 @@
1
- ## 0.1.1 (2026-01-08)
1
+ ## 0.1.4 (2026-01-08)
2
+ 评审流程转移至skills内 codereview 0.0.1
3
+ 增加去重功能
4
+
5
+
6
+ ## 0.1.3 (2026-01-08)
2
7
  skills:review 0.0.0
3
8
 
4
9
  评审流程转移至skills内
5
10
  增加去重功能
6
11
 
7
12
 
8
- ## 0.1.0 (2026-01-07)
9
- 基础评审能力
13
+ ## 0.1.0 (2026-01-07)
14
+ 基础评审能力
package/bin/CHANGELOG.md CHANGED
@@ -1,4 +1,2 @@
1
- skills:review 0.0.0
2
-
3
- 评审流程转移至skills内
1
+ 评审流程转移至skills codereview 0.0.1
4
2
  增加去重功能
package/bin/d5cli CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import { execSync, spawn } from "node:child_process";
3
- import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
3
+ import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, 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, platform } from "node:process";
6
6
  import { fileURLToPath } from "node:url";
7
7
 
8
8
  //#region package.json
9
9
  var name = "@d5render/cli";
10
- var version = "0.1.1";
10
+ var version = "0.1.4";
11
11
 
12
12
  //#endregion
13
13
  //#region copilot/server/config.ts
@@ -116,17 +116,21 @@ function send(title, text) {
116
116
  //#endregion
117
117
  //#region copilot/bin/deploy.ts
118
118
  const root = () => {
119
- const dir = env.HOME || env.HOMEPATH;
119
+ const dir = env.HOME ?? env.HOMEPATH;
120
120
  if (!dir) throw new Error("cannot find home directory");
121
121
  return dir;
122
122
  };
123
123
  const cwd = join(dirname(fileURLToPath(import.meta.url)), "../");
124
124
  function deploy() {
125
- const cl = join(cwd, "bin/CHANGELOG.md");
126
- if (existsSync(cl)) {
127
- let clt = readFileSync(cl, "utf8");
128
- rmSync(cl);
129
- if (env.DINGTALK_WEBHOOK) send("NOTICE", `#### cli upgrade\n\n${clt}\n\n##### [HISTORY CHANGELOG](https://www.npmjs.com/package/${name}/v/${version}?activeTab=code)`).catch(() => {});
125
+ if (env.CI) {
126
+ const cl = join(cwd, "bin/CHANGELOG.md");
127
+ const clt = existsSync(cl) ? readFileSync(cl, "utf8") : "";
128
+ const clr = join(cwd, name.split("/").map(() => "..").join("/"), `${name.replaceAll("/", "-")}-notice`);
129
+ let need = !!clt;
130
+ if (existsSync(clr)) {
131
+ if (readFileSync(clr, "utf8") === version) need = false;
132
+ }
133
+ if (need && env.DINGTALK_WEBHOOK) send("NOTICE", `#### cli upgrade\n\n${clt}\n\n##### [HISTORY CHANGELOG](https://www.npmjs.com/package/${name}/v/${version}?activeTab=code)`).then(() => writeFileSync(clr, version)).catch(() => {});
130
134
  }
131
135
  const dir = join(root(), ".copilot/skills/codereview");
132
136
  if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
@@ -227,20 +231,24 @@ function installCopilot() {
227
231
 
228
232
  //#endregion
229
233
  //#region copilot/bin/index.ts
230
- function review() {
234
+ const prompt = `call the mcp tool '${name$1}-${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.
235
+ Then, use chinese as default language to organize the report into JSON format and call the mcp tool '${name$1}-${report}', please ignore error encountered when calling this and report title should not contain words such as MCP or "中文".`;
236
+ deploy();
237
+ if (canireview()) {
231
238
  install();
232
239
  const copilot = spawn("node", [
233
240
  findCopilopt(),
234
241
  ...tools,
242
+ "--stream",
243
+ "off",
235
244
  "-p",
236
245
  prompt
237
246
  ], {
238
247
  cwd: env.CI_PROJECT_DIR,
239
248
  ...platform === "win32" && { windowsHide: true }
240
249
  });
241
- copilot.stdout.on("data", (data) => console.log(String(data)));
242
- copilot.stderr.on("data", (data) => console.error(String(data)));
243
- copilot.on("close", (code) => exit(code));
250
+ copilot.stdout.on("data", (data) => console.log(data.toString()));
251
+ copilot.stderr.on("data", (data) => console.error(data.toString()));
244
252
  }
245
253
  function findCopilopt() {
246
254
  let copilot = execSync("npm list @github/copilot -g -p").toString().trim();
@@ -265,9 +273,5 @@ copilot:
265
273
  path: ${copilotPath}`);
266
274
  return copilotPath;
267
275
  }
268
- const prompt = `call the mcp tool '${name$1}-${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.
269
- Then, use chinese as default language to organize the report into JSON format and call the mcp tool '${name$1}-${report}', please ignore error encountered when calling this and report title should not contain words such as MCP or "中文".`;
270
- deploy();
271
- if (canireview()) review();
272
276
 
273
277
  //#endregion
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.1",
7
+ "version": "0.1.4",
8
8
  "devDependencies": {
9
9
  "@modelcontextprotocol/sdk": "^1.25.1",
10
10
  "@types/node": "^25.0.3",