mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 02:10:22 +08:00
fix: 本机只标当前,下线 1.1.11-beta,Skill 仅 1.1.12 测试版
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
6639031e29
commit
8de3fdf2d8
2 files changed
+94
-59
No files matched your search
+14
-4
@@ -70,6 +70,11 @@ function isBetaName(name) {
|
||||
return /(?:^|[-._])(beta|rc|pre|preview|test)(?:\d|$|[-._])/i.test(String(name || ""));
|
||||
}
|
||||
|
||||
function withdrawnVersion(item) {
|
||||
const text = [item?.version, item?.ref, item?.id].filter(Boolean).join(" ");
|
||||
return /(?:^|[\sv])1\.1\.11-beta/i.test(String(text).replace(/^v/i, " "));
|
||||
}
|
||||
|
||||
function splitVersion(raw) {
|
||||
const text = String(raw || "").trim().replace(/^v/i, "");
|
||||
const cut = text.split("-");
|
||||
@@ -124,7 +129,8 @@ function currentChannelRef(state = readChannelState()) {
|
||||
|
||||
function readHistory() {
|
||||
const raw = readJson(historyPath());
|
||||
return Array.isArray(raw) ? raw : [];
|
||||
const rows = Array.isArray(raw) ? raw : [];
|
||||
return rows.filter((item) => item && !withdrawnVersion(item));
|
||||
}
|
||||
|
||||
function pushHistory(entry) {
|
||||
@@ -547,9 +553,11 @@ async function listRemoteVersions() {
|
||||
latest: true,
|
||||
});
|
||||
}
|
||||
for (const tag of tags) add(tag);
|
||||
for (const tag of tags) {
|
||||
if (!withdrawnVersion(tag)) add(tag);
|
||||
}
|
||||
for (const item of readHistory()) {
|
||||
if (!item || !item.ref) continue;
|
||||
if (!item || !item.ref || withdrawnVersion(item)) continue;
|
||||
add({
|
||||
...item,
|
||||
label: item.label || versionLabel(item.version, item.channel, item.sha),
|
||||
@@ -560,7 +568,7 @@ async function listRemoteVersions() {
|
||||
const localVer = localVersion();
|
||||
const localSha = (gitOk() ? gitHead(PLUGIN_ROOT) : "") || readStamp();
|
||||
return {
|
||||
versions: markCurrent(out, state, localVer, localSha),
|
||||
versions: markCurrent(out.filter((item) => !withdrawnVersion(item)), state, localVer, localSha),
|
||||
hasBeta: Boolean(betaSha || out.some((item) => item.channel === "beta" && item.kind === "tag")),
|
||||
stableSha,
|
||||
betaSha,
|
||||
@@ -887,8 +895,10 @@ export async function switchChannel(channel, { apply = true } = {}) {
|
||||
export async function switchVersion(ref) {
|
||||
const target = String(ref || "").trim();
|
||||
if (!target) throw new Error("请选择要回退的版本");
|
||||
if (withdrawnVersion({ ref: target, version: target })) throw new Error("该版本已下线");
|
||||
const listed = await listRemoteVersions();
|
||||
const hit = listed.versions.find((item) => item.ref === target || item.id === target || item.version === target || item.sha === target);
|
||||
if (hit && withdrawnVersion(hit)) throw new Error("该版本已下线");
|
||||
const resolved = hit?.ref || target;
|
||||
const channel = hit?.channel || readChannelState().channel;
|
||||
const pin = hit?.latest ? "" : resolved;
|
||||
|
||||
Reference in new issue
Block a user