fix(about): handle prerelease tools in version check

Use semver comparison instead of string inequality so locally-ahead prerelease builds aren't misreported as outdated; backend now fetches the full npm dist-tags and, when the local version leads latest, surfaces the tool's prerelease channel (claude=next) as latest.
This commit is contained in:
Jason
2026-05-29 08:47:54 +08:00
parent 8302f1e36c
commit d7a34f4247
4 changed files with 357 additions and 30 deletions
+6 -11
View File
@@ -40,6 +40,7 @@ import { APP_ICON_MAP } from "@/config/appConfig";
import type { AppId } from "@/lib/api/types";
import { extractErrorMessage } from "@/utils/errorUtils";
import { isWindows } from "@/lib/platform";
import { isUpdateAvailable } from "@/lib/version";
import { ToolUpgradeConfirmDialog } from "./ToolUpgradeConfirmDialog";
import { ToolInstallRow } from "./ToolInstallRow";
@@ -238,11 +239,7 @@ export function AboutSection({ isPortable }: AboutSectionProps) {
() =>
TOOL_NAMES.filter((toolName) => {
const tool = toolVersionByName.get(toolName);
return Boolean(
tool?.version &&
tool.latest_version &&
tool.version !== tool.latest_version,
);
return isUpdateAvailable(tool?.version, tool?.latest_version);
}),
[toolVersionByName],
);
@@ -545,8 +542,7 @@ export function AboutSection({ isPortable }: AboutSectionProps) {
action === "update" &&
Boolean(previousVersion) &&
tool.version === previousVersion &&
Boolean(latestVersion) &&
tool.version !== latestVersion;
isUpdateAvailable(tool.version, latestVersion);
if (versionUnchangedAfterUpdate) {
// 有些上游 updater 会在未实际改动版本时仍返回 0。这里用刷新后的
@@ -949,10 +945,9 @@ export function AboutSection({ isPortable }: AboutSectionProps) {
const displayName = TOOL_DISPLAY_NAMES[toolName];
const isToolVersionLoading =
isLoadingTools || Boolean(loadingTools[toolName]);
const isOutdated = Boolean(
tool?.version &&
tool.latest_version &&
tool.version !== tool.latest_version,
const isOutdated = isUpdateAvailable(
tool?.version,
tool?.latest_version,
);
// 已安装却跑不起来(如 Node 版本不达标):用它区分卡片文案与按钮,避免把
// "装了跑不起来"误判成"未安装"而给出无用的安装按钮(重装同一版本解决不了)。