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:
@@ -11,6 +11,10 @@ export interface PluginEntryInfo {
|
||||
configPath: string
|
||||
}
|
||||
|
||||
function isExplicitVersionPin(pinnedVersion: string): boolean {
|
||||
return /^\d+\.\d+\.\d+/.test(pinnedVersion)
|
||||
}
|
||||
|
||||
export function findPluginEntry(directory: string): PluginEntryInfo | null {
|
||||
for (const configPath of getConfigPaths(directory)) {
|
||||
try {
|
||||
@@ -25,8 +29,8 @@ export function findPluginEntry(directory: string): PluginEntryInfo | null {
|
||||
}
|
||||
if (entry.startsWith(`${PACKAGE_NAME}@`)) {
|
||||
const pinnedVersion = entry.slice(PACKAGE_NAME.length + 1)
|
||||
const isPinned = pinnedVersion !== "latest"
|
||||
return { entry, isPinned, pinnedVersion: isPinned ? pinnedVersion : null, configPath }
|
||||
const isPinned = isExplicitVersionPin(pinnedVersion)
|
||||
return { entry, isPinned, pinnedVersion, configPath }
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user