From cefce7e6ec6b549a673499cd13c68bc2e35dbdf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=AB=E6=88=91=E5=B0=8F=E6=9D=A8=E5=90=8C=E5=AD=A6?= <188421097+HunYiSage@users.noreply.github.com> Date: Tue, 6 Oct 2026 23:36:43 +0800 Subject: [PATCH] chore: close-issues script via GitHub API (no gh read:org) Co-authored-by: Cursor --- scripts/close-issues-1.1.60.mjs | 61 +++++++++++++++++++++++++++++++++ scripts/close-issues-1.1.60.ps1 | 12 +++---- 2 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 scripts/close-issues-1.1.60.mjs diff --git a/scripts/close-issues-1.1.60.mjs b/scripts/close-issues-1.1.60.mjs new file mode 100644 index 0000000..38f8d7a --- /dev/null +++ b/scripts/close-issues-1.1.60.mjs @@ -0,0 +1,61 @@ +import { execSync } from "node:child_process"; + +const sha = "af13e8c201b526dc3bbce949351fb46a762eb1eb"; +const owner = "YuJunZhiXue"; +const repo = "dsh-purge"; + +function gitToken() { + const out = execSync("git credential fill", { + input: "protocol=https\nhost=github.com\n\n", + encoding: "utf8", + }); + const m = out.match(/^password=(.+)$/m); + if (!m) throw new Error("no github token from git credential"); + return m[1].trim(); +} + +const token = gitToken(); + +async function gh(path, { method = "GET", body } = {}) { + const res = await fetch(`https://api.github.com${path}`, { + method, + headers: { + Accept: "application/vnd.github+json", + Authorization: `Bearer ${token}`, + "X-GitHub-Api-Version": "2022-11-28", + ...(body ? { "Content-Type": "application/json" } : {}), + }, + body: body ? JSON.stringify(body) : undefined, + }); + const text = await res.text(); + if (!res.ok) throw new Error(`${method} ${path} ${res.status}: ${text.slice(0, 400)}`); + return text ? JSON.parse(text) : null; +} + +const comments = { + 66: `已在 1.1.60 (${sha}) 继续加固:lib/desktop.js 探测 JScript 不可用时走 PowerShell 换包,且不再用 inflight 标记误杀 PS 兜底。请用 tag v1.1.60 验证。`, + 67: `${sha}(1.1.60):lib/desktop.js 的 patchOfficialCliCmdText 优先解包路径、修复 dsh.cmd 自引用;再点一次应用即可。`, + 68: `${sha}(1.1.60):README 写明官方桌面用 dsh plugin --profile desktop add …/master.tar.gz;Hub 市场一键仍走 git(无 prepare),文档已说明。`, + 69: `${sha}(1.1.60):演练台 .rt-dock 默认 position:fixed,嵌入清洗面板时为 relative,见 lib/redteam/client.js。`, + 70: `${sha}(1.1.60):lib/redteam/skill-availability.js 按本机 OS/CPU 判定技能路径,不把其它平台文件名当缺失。`, + 71: `${sha}(1.1.60):lib/identity.js installAssembleGuard 幂等,避免重复 Proxy 栈溢出。`, +}; + +for (const n of [66, 67, 68, 69, 70, 71]) { + const issue = await gh(`/repos/${owner}/${repo}/issues/${n}`); + await gh(`/repos/${owner}/${repo}/issues/${n}/comments`, { + method: "POST", + body: { body: comments[n] }, + }); + if (issue.state === "open") { + await gh(`/repos/${owner}/${repo}/issues/${n}`, { + method: "PATCH", + body: { state: "closed", state_reason: "completed" }, + }); + process.stdout.write(`closed #${n}\n`); + } else { + process.stdout.write(`#${n} already closed (comment added)\n`); + } +} + +process.stdout.write("done 66-71\n"); diff --git a/scripts/close-issues-1.1.60.ps1 b/scripts/close-issues-1.1.60.ps1 index 148067d..1893326 100644 --- a/scripts/close-issues-1.1.60.ps1 +++ b/scripts/close-issues-1.1.60.ps1 @@ -3,12 +3,12 @@ $sha = "af13e8c201b526dc3bbce949351fb46a762eb1eb" $repo = "YuJunZhiXue/dsh-purge" $comments = @{ - 66 = "已在 **1.1.60**(``$sha``)继续加固:`lib/desktop.js` 探测 JScript 不可用时走 PowerShell 换包,且不再用 inflight 标记误杀 PS 兜底。请用 tag **v1.1.60** 验证。" - 67 = "``$sha``(1.1.60):``lib/desktop.js`` 的 ``patchOfficialCliCmdText`` 优先解包路径、修复 ``set `"entry=%entry%`"`` 自引用;再点一次应用即可。" - 68 = "``$sha``(1.1.60):README 写明官方桌面用 ``dsh plugin --profile desktop add …/master.tar.gz``;Hub 市场一键仍走 git(无 ``prepare``),文档已说明,不按 Hub 一键修复关闭。" - 69 = "``$sha``(1.1.60):演练台 ``.rt-dock`` 默认 ``position:fixed``,嵌入清洗面板时为 ``relative``,见 ``lib/redteam/client.js``。" - 70 = "``$sha``(1.1.60):``lib/redteam/skill-availability.js`` 按本机 OS/CPU 判定技能路径,不把其它平台文件名当缺失。" - 71 = "``$sha``(1.1.60):``lib/identity.js`` ``installAssembleGuard`` 幂等,避免重复 Proxy 栈溢出。" + 66 = "已在 1.1.60 ($sha) 继续加固:lib/desktop.js JScript 不可用时走 PowerShell 换包。tag v1.1.60" + 67 = "$sha (1.1.60): lib/desktop.js patchOfficialCliCmdText 解包路径与 dsh.cmd 自引用修复。" + 68 = "$sha (1.1.60): README desktop profile + master.tar.gz;Hub 一键仍 git,文档已说明。" + 69 = "$sha (1.1.60): lib/redteam/client.js .rt-dock position fixed。" + 70 = "$sha (1.1.60): lib/redteam/skill-availability.js 本机 OS 技能路径。" + 71 = "$sha (1.1.60): lib/identity.js installAssembleGuard 幂等。" } foreach ($n in 66, 67, 68, 69, 70, 71) {