@d5render/cli 0.1.44 → 0.1.50
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/d5cli +16 -17
- package/package.json +1 -1
- package/.skills/code-review/version +0 -1
package/bin/d5cli
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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,
|
|
5
|
+
import { argv, env, platform } from "node:process";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
|
|
8
8
|
//#region copilot/server/config.ts
|
|
@@ -108,7 +108,7 @@ function installCopilot() {
|
|
|
108
108
|
//#endregion
|
|
109
109
|
//#region package.json
|
|
110
110
|
var name = "@d5render/cli";
|
|
111
|
-
var version = "0.1.
|
|
111
|
+
var version = "0.1.50";
|
|
112
112
|
|
|
113
113
|
//#endregion
|
|
114
114
|
//#region packages/gitlab/url.ts
|
|
@@ -197,22 +197,21 @@ async function deploy() {
|
|
|
197
197
|
rmSync(config);
|
|
198
198
|
console.log("removed config cache.");
|
|
199
199
|
}
|
|
200
|
-
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
201
|
-
const versiono = readFileSync(join(RUNTIME_CWD, ".skills/code-review/version"), "utf8");
|
|
202
200
|
const changelog = readFileSync(join(RUNTIME_CWD, "CHANGELOG.md"), "utf8");
|
|
203
201
|
const cachepath = join(TEMP, "CHANGELOG-" + env.CI_RUNNER_ID || "0");
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
let cache = "";
|
|
203
|
+
if (existsSync(cachepath)) cache = readFileSync(cachepath, "utf8");
|
|
204
|
+
else if (!existsSync(TEMP)) mkdirSync(TEMP, { recursive: true });
|
|
205
|
+
if (changelog !== cache) {
|
|
206
206
|
writeFileSync(cachepath, changelog, "utf8");
|
|
207
207
|
console.log("updated CHANGELOG cache.");
|
|
208
|
-
await dingding("NOTICE", `code-review/SKILL.md
|
|
208
|
+
await dingding("NOTICE", `code-review/SKILL.md 更新\n\n细节请参考 [线上文档内容.skills](https://www.npmjs.com/package/@d5render/cli?activeTab=code)`);
|
|
209
209
|
}
|
|
210
|
-
const versionnPath = join(dir, "version");
|
|
211
|
-
if ((existsSync(versionnPath) ? readFileSync(versionnPath, "utf8") : "") === versiono) return;
|
|
212
210
|
if (existsSync(dir)) rmSync(dir, {
|
|
213
211
|
recursive: true,
|
|
214
212
|
force: true
|
|
215
213
|
});
|
|
214
|
+
mkdirSync(dir, { recursive: true });
|
|
216
215
|
const skillRoot = join(RUNTIME_CWD, ".skills/code-review");
|
|
217
216
|
readdirSync(skillRoot).forEach((skill) => copyFileSync(join(skillRoot, skill), join(dir, skill)));
|
|
218
217
|
const instructionsRoot = join(RUNTIME_CWD, ".github/instructions");
|
|
@@ -259,12 +258,10 @@ async function need() {
|
|
|
259
258
|
|
|
260
259
|
//#endregion
|
|
261
260
|
//#region copilot/bin/index.ts
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
} catch (error) {
|
|
265
|
-
dingding("CRITICAL", "CI ERROR: 未知错误,请自行检查日志");
|
|
261
|
+
codereview().catch(async (error) => {
|
|
262
|
+
await dingding("CRITICAL", "CI ERROR: 未知错误,请自行检查日志");
|
|
266
263
|
throw error;
|
|
267
|
-
}
|
|
264
|
+
});
|
|
268
265
|
async function codereview() {
|
|
269
266
|
await deploy();
|
|
270
267
|
if (!await need()) {
|
|
@@ -292,9 +289,11 @@ Otherwise, use chinese as default language to call the mcp tool '${name$1}-${rep
|
|
|
292
289
|
});
|
|
293
290
|
copilot.stdout.on("data", (chunk) => console.log(String(chunk)));
|
|
294
291
|
copilot.stderr.on("data", (chunk) => console.error(String(chunk)));
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
292
|
+
return new Promise((res, rej) => {
|
|
293
|
+
copilot.on("close", (code) => {
|
|
294
|
+
if (!code) rej(/* @__PURE__ */ new Error("CI ERROR: 代码审查任务失败,请自行检查日志"));
|
|
295
|
+
else res();
|
|
296
|
+
});
|
|
298
297
|
});
|
|
299
298
|
}
|
|
300
299
|
function findCopilopt() {
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.0.1
|