fix(auto-update): treat only explicit semver pins as user-pinned
Fixes #1920 Installer-written exact versions (e.g., oh-my-opencode@3.5.2) were incorrectly treated as user-pinned, blocking auto-updates for all installer users. Fix isPinned to only block auto-update when pinnedVersion is an explicit semver string (user's intent). Channel tags (latest, beta, next) and bare package name all allow auto-update. Fix installer fallback to return bare PACKAGE_NAME for stable versions and PACKAGE_NAME@{channel} for prerelease versions, preserving channel tracking.
This commit is contained in:
@@ -3,6 +3,15 @@ import { fetchNpmDistTags } from "./npm-dist-tags"
|
||||
const PACKAGE_NAME = "oh-my-opencode"
|
||||
const PRIORITIZED_TAGS = ["latest", "beta", "next"] as const
|
||||
|
||||
function getFallbackEntry(version: string): string {
|
||||
const prereleaseMatch = version.match(/-([a-zA-Z][a-zA-Z0-9]*)\./)
|
||||
if (prereleaseMatch) {
|
||||
return `${PACKAGE_NAME}@${prereleaseMatch[1]}`
|
||||
}
|
||||
|
||||
return PACKAGE_NAME
|
||||
}
|
||||
|
||||
export async function getPluginNameWithVersion(currentVersion: string): Promise<string> {
|
||||
const distTags = await fetchNpmDistTags(PACKAGE_NAME)
|
||||
|
||||
@@ -15,5 +24,5 @@ export async function getPluginNameWithVersion(currentVersion: string): Promise<
|
||||
}
|
||||
}
|
||||
|
||||
return `${PACKAGE_NAME}@${currentVersion}`
|
||||
return getFallbackEntry(currentVersion)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user