@d5render/cli 0.1.49 → 0.1.51
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 +15 -18
- package/package.json +1 -1
package/bin/d5cli
CHANGED
|
@@ -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.51";
|
|
112
112
|
|
|
113
113
|
//#endregion
|
|
114
114
|
//#region packages/gitlab/url.ts
|
|
@@ -191,27 +191,27 @@ async function deploy() {
|
|
|
191
191
|
if (!env.CI) return;
|
|
192
192
|
const HOME = env.USERPROFILE ?? env.HOME ?? env.HOMEPATH;
|
|
193
193
|
if (!HOME) throw new Error("cannot find `USERPROFILE` directory");
|
|
194
|
+
const changelog = readFileSync(join(RUNTIME_CWD, "CHANGELOG.md"), "utf8");
|
|
195
|
+
const cachepath = join(TEMP, "CHANGELOG-" + env.CI_RUNNER_ID || "0");
|
|
196
|
+
let cache = "";
|
|
197
|
+
if (existsSync(cachepath)) cache = readFileSync(cachepath, "utf8");
|
|
198
|
+
else if (!existsSync(TEMP)) mkdirSync(TEMP, { recursive: true });
|
|
199
|
+
if (changelog !== cache) {
|
|
200
|
+
writeFileSync(cachepath, changelog, "utf8");
|
|
201
|
+
console.log("updated CHANGELOG cache.");
|
|
202
|
+
await dingding("NOTICE", `code-review/SKILL.md 更新\n\n细节请参考 [线上文档内容.skills](https://www.npmjs.com/package/@d5render/cli?activeTab=code)`);
|
|
203
|
+
}
|
|
194
204
|
const config = join(HOME, ".copilot/config.json"), dir = join(HOME, ".copilot/skills/code-review");
|
|
195
205
|
console.log("deploy...");
|
|
196
206
|
if (existsSync(config)) {
|
|
197
207
|
rmSync(config);
|
|
198
208
|
console.log("removed config cache.");
|
|
199
209
|
}
|
|
200
|
-
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
201
|
-
const changelog = readFileSync(join(RUNTIME_CWD, "CHANGELOG.md"), "utf8");
|
|
202
|
-
const cachepath = join(TEMP, "CHANGELOG-" + env.CI_RUNNER_ID || "0");
|
|
203
|
-
if (changelog !== (existsSync(cachepath) ? readFileSync(cachepath, "utf8") : "")) {
|
|
204
|
-
if (!existsSync(TEMP)) mkdirSync(TEMP, { recursive: true });
|
|
205
|
-
writeFileSync(cachepath, changelog, "utf8");
|
|
206
|
-
console.log("updated CHANGELOG cache.");
|
|
207
|
-
await dingding("NOTICE", `code-review/SKILL.md 更新到${VERSION}\n\n请参考[线上文档内容](https://www.npmjs.com/package/@d5render/cli?activeTab=readme)`);
|
|
208
|
-
}
|
|
209
|
-
const versionnPath = join(dir, "version");
|
|
210
|
-
if ((existsSync(versionnPath) ? readFileSync(versionnPath, "utf8") : "") === VERSION) return;
|
|
211
210
|
if (existsSync(dir)) rmSync(dir, {
|
|
212
211
|
recursive: true,
|
|
213
212
|
force: true
|
|
214
213
|
});
|
|
214
|
+
mkdirSync(dir, { recursive: true });
|
|
215
215
|
const skillRoot = join(RUNTIME_CWD, ".skills/code-review");
|
|
216
216
|
readdirSync(skillRoot).forEach((skill) => copyFileSync(join(skillRoot, skill), join(dir, skill)));
|
|
217
217
|
const instructionsRoot = join(RUNTIME_CWD, ".github/instructions");
|
|
@@ -258,8 +258,8 @@ async function need() {
|
|
|
258
258
|
|
|
259
259
|
//#endregion
|
|
260
260
|
//#region copilot/bin/index.ts
|
|
261
|
-
codereview().catch((error) => {
|
|
262
|
-
dingding("CRITICAL", "CI ERROR: 未知错误,请自行检查日志");
|
|
261
|
+
codereview().catch(async (error) => {
|
|
262
|
+
await dingding("CRITICAL", "CI ERROR: 未知错误,请自行检查日志");
|
|
263
263
|
throw error;
|
|
264
264
|
});
|
|
265
265
|
async function codereview() {
|
|
@@ -290,10 +290,7 @@ Otherwise, use chinese as default language to call the mcp tool '${name$1}-${rep
|
|
|
290
290
|
copilot.stdout.on("data", (chunk) => console.log(String(chunk)));
|
|
291
291
|
copilot.stderr.on("data", (chunk) => console.error(String(chunk)));
|
|
292
292
|
return new Promise((res, rej) => {
|
|
293
|
-
copilot.on("close", (code) =>
|
|
294
|
-
if (!code) rej(/* @__PURE__ */ new Error("CI ERROR: 代码审查任务失败,请自行检查日志"));
|
|
295
|
-
else res();
|
|
296
|
-
});
|
|
293
|
+
copilot.on("close", (code) => res());
|
|
297
294
|
});
|
|
298
295
|
}
|
|
299
296
|
function findCopilopt() {
|