From 1556dd5e06bc0c39c93da812299375da43119f10 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 24 Jul 2026 12:34:07 +0000 Subject: [PATCH 1/2] =?UTF-8?q?fix(pack-update):=20=E4=BF=AE=E5=A4=8D=20me?= =?UTF-8?q?rge=20=E5=90=8E=20bindOk=20=E9=87=8D=E5=A4=8D=20enabled=20?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=20TS1117?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ootb@baff02a 在 Build 阶段因 probeSourceAfterInstall 的 bindOk 对象字面量合并留下两个 enabled 键而失败。保留实际写入的 binding.enabled 文案(LSP),并让 sources list 复用同一 helper(DRY); 顺带收敛 lastFileId/lastApplied 的重复 setBinding 分支。 Co-authored-by: Shiroha --- sfmc/src/pack-update/service.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/sfmc/src/pack-update/service.ts b/sfmc/src/pack-update/service.ts index a105188c..8a0d14c7 100644 --- a/sfmc/src/pack-update/service.ts +++ b/sfmc/src/pack-update/service.ts @@ -54,8 +54,9 @@ function fmtVer(v: SemVer3): string { return v.join("."); } +/** 绑定启用态文案:bindOk / sources list 共用(DRY),走 packs.list i18n */ function bindingEnabledLabel(enabled: boolean): string { - return enabled ? "on" : "off"; + return enabled ? t("packs.list.on").trim() : t("packs.list.off").trim(); } function providerShortLabel(id: PackProviderId): string { @@ -218,9 +219,9 @@ export async function probeSourceAfterInstall(opts: { t("packUpdate.bindOk", { uuid: opts.info.uuid, slug: best.hit.slug, + /* 报告实际写入的 binding.enabled(LSP),勿再并列一份 cfg 派生字段 */ enabled: bindingEnabledLabel(binding.enabled), path: packSourcesPath(), - enabled: cfg.defaultBindingEnabled ? t("packs.list.on").trim() : t("packs.list.off").trim(), }), "success" ); @@ -289,7 +290,8 @@ export function formatSourcesList(): string { return lines.join("\n"); } for (const { bpUuid, binding } of bindings) { - const en = binding.enabled ? c.green(t("packs.list.on").trim()) : c.dim(t("packs.list.off").trim()); + const label = bindingEnabledLabel(binding.enabled); + const en = binding.enabled ? c.green(label) : c.dim(label); const tag = providerShortLabel(binding.provider); lines.push( ` [${en}] ${bpUuid} ${tag}:${binding.slug || binding.projectId} ${c.dim(binding.websiteUrl || "")}` @@ -429,14 +431,11 @@ async function prepareCheck( * 远程 BP 版本未更高:无需覆盖安装,但仍记下 fileId, * 否则每次启动都会重复下载同一归档(lastApplied 一直为空)。 */ + binding.lastFileId = file.fileId; if (!decision.remoteNewer) { binding.lastAppliedFileId = file.fileId; - binding.lastFileId = file.fileId; - setBinding(bpUuid, binding); - } else { - binding.lastFileId = file.fileId; - setBinding(bpUuid, binding); } + setBinding(bpUuid, binding); return withLocalBp( { From 912268e81f9a5fbb5fb059730a7307ed4f676cef Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 24 Jul 2026 12:34:57 +0000 Subject: [PATCH 2/2] =?UTF-8?q?docs(pack-update):=20=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E5=8E=BB=E9=87=8D=E5=AD=97=E6=AE=B5=E8=A1=A8=EF=BC=88DRY?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit baff02a 合并 #63 与「修复更新相关内容」后,字段说明表同时保留了 顶层 match.* 与旧版裸 nameMinScore/stripFolderTags,以及两份 defaultBindingEnabled。收敛为单一权威描述。 Co-authored-by: Shiroha --- docs/guide/pack-update.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/guide/pack-update.md b/docs/guide/pack-update.md index 645f43e0..3703bbba 100644 --- a/docs/guide/pack-update.md +++ b/docs/guide/pack-update.md @@ -123,16 +123,13 @@ flowchart TD | 字段 | 含义 | |------|------| -| `defaultBindingEnabled` | 新建绑定的默认 `enabled`;`false` 时仍写入 `pack-sources.json`,但不会自动检查/更新。 | +| `defaultBindingEnabled` | 新建绑定的默认 `enabled`(**默认 `false`**)。仍写入 `pack-sources.json`,但需手改为 `true`(或改此默认)才参与启动检查/自动更新。 | | `match.nameMinScore` | 安装后自动绑定的最低相似度阈值(源无关,顶层)。 | | `match.stripFolderTags` | 清洗时是否去掉方括号标签(如 `[BP]`/`[玩法]`)。 | | `gameId` | **Minecraft Bedrock = `78022`**。历史误用 `459` 无效,加载时会纠正。Java Minecraft 是 `432`,不要混用。 | | `classId` | Bedrock **Addons = `4984`**;`null` 时用 `/v1/categories?classesOnly=true` 解析「Addons」。 | | `baseUrl` | 官方 Core API:getMod / files / download-url。 | | `searchBaseUrl` | 搜索镜像;官方 search 403 时回退。 | -| `nameMinScore` | 安装后自动绑定的最低相似度阈值。 | -| `stripFolderTags` | 清洗时是否去掉方括号标签(如 `[BP]`/`[玩法]`)。 | -| `defaultBindingEnabled` | 新建绑定的默认 `enabled`(**默认 `false`**)。需手改为 `true` 才参与启动检查/自动更新。 | ### 3.4 绑定文件示例