@d5render/cli 0.1.3 → 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 +5 -0
- package/bin/CHANGELOG.md +1 -3
- package/bin/d5cli +20 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/bin/CHANGELOG.md
CHANGED
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,
|
|
3
|
+
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
|
-
import { argv, env,
|
|
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.
|
|
10
|
+
var version = "0.1.4";
|
|
11
11
|
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region copilot/server/config.ts
|
|
@@ -122,10 +122,15 @@ const root = () => {
|
|
|
122
122
|
};
|
|
123
123
|
const cwd = join(dirname(fileURLToPath(import.meta.url)), "../");
|
|
124
124
|
function deploy() {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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(() => {});
|
|
129
134
|
}
|
|
130
135
|
const dir = join(root(), ".copilot/skills/codereview");
|
|
131
136
|
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
@@ -226,20 +231,24 @@ function installCopilot() {
|
|
|
226
231
|
|
|
227
232
|
//#endregion
|
|
228
233
|
//#region copilot/bin/index.ts
|
|
229
|
-
|
|
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()) {
|
|
230
238
|
install();
|
|
231
239
|
const copilot = spawn("node", [
|
|
232
240
|
findCopilopt(),
|
|
233
241
|
...tools,
|
|
242
|
+
"--stream",
|
|
243
|
+
"off",
|
|
234
244
|
"-p",
|
|
235
245
|
prompt
|
|
236
246
|
], {
|
|
237
247
|
cwd: env.CI_PROJECT_DIR,
|
|
238
248
|
...platform === "win32" && { windowsHide: true }
|
|
239
249
|
});
|
|
240
|
-
copilot.stdout.on("data", (data) => console.log(
|
|
241
|
-
copilot.stderr.on("data", (data) => console.error(
|
|
242
|
-
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()));
|
|
243
252
|
}
|
|
244
253
|
function findCopilopt() {
|
|
245
254
|
let copilot = execSync("npm list @github/copilot -g -p").toString().trim();
|
|
@@ -264,9 +273,5 @@ copilot:
|
|
|
264
273
|
path: ${copilotPath}`);
|
|
265
274
|
return copilotPath;
|
|
266
275
|
}
|
|
267
|
-
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.
|
|
268
|
-
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 "中文".`;
|
|
269
|
-
deploy();
|
|
270
|
-
if (canireview()) review();
|
|
271
276
|
|
|
272
277
|
//#endregion
|