fix(auto-update): use semantic version comparison instead of string equality
The update checker was using strict string comparison (===) to compare current and latest versions. This caused false-positive update notifications when versions were semantically equal but had different string representations (e.g., with/without 'v' prefix, different formatting). Changed to use compareVersions() which properly parses and compares semver versions, handling 'v' prefixes and other variations correctly. Fixes: incorrect 'v3.17.2 available' notifications when already on latest version
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { log } from "../../../shared/logger"
|
||||
import { compareVersions } from "../../../shared/opencode-version"
|
||||
import type { UpdateCheckResult } from "../types"
|
||||
import { extractChannel } from "../version-channel"
|
||||
import { isLocalDevMode } from "./local-dev-path"
|
||||
@@ -55,7 +56,7 @@ export async function checkForUpdate(directory: string): Promise<UpdateCheckResu
|
||||
}
|
||||
}
|
||||
|
||||
const needsUpdate = currentVersion !== latestVersion
|
||||
const needsUpdate = compareVersions(currentVersion, latestVersion) !== 0
|
||||
log(
|
||||
`[auto-update-checker] Current: ${currentVersion}, Latest (${channel}): ${latestVersion}, NeedsUpdate: ${needsUpdate}`
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user