fix: extract semver before comparing CLI versions

The installed version string includes a suffix like '(Claude Code)'
which caused Number() to parse the third segment as NaN, making the
comparison always return 0 (current) instead of the correct result.
Now extracts the semver portion with a regex before comparing.
This commit is contained in:
2026-02-24 12:57:39 -08:00
committed by Naomi Carrigan
parent 302963f6c0
commit b914240d20
+3 -1
View File
@@ -22,7 +22,9 @@
if (installedVersion === "Loading..." || installedVersion === "Unknown") {
return "neutral";
}
const cmp = compareVersions(installedVersion, SUPPORTED_CLI_VERSION);
const semverMatch = /(\d+\.\d+\.\d+)/.exec(installedVersion);
if (!semverMatch) return "neutral";
const cmp = compareVersions(semverMatch[1], SUPPORTED_CLI_VERSION);
if (cmp > 0) return "ahead";
if (cmp < 0) return "behind";
return "current";