mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-16 13:05:14 +03:00
fix(cli): reject stale platform binaries during install (#53845)
This commit is contained in:
@@ -116,6 +116,10 @@ function copyBinary(source) {
|
||||
|
||||
function resolveBinary(name) {
|
||||
const packagePath = require.resolve(`${name}/package.json`)
|
||||
// Package managers keep an older platform package when the matching version is not yet on the registry,
|
||||
// which would silently install the previous release under the new launcher.
|
||||
const version = JSON.parse(fs.readFileSync(packagePath, "utf8")).version
|
||||
if (version !== dependencies[name]) throw new Error(`${name} is ${version}, expected ${dependencies[name]}`)
|
||||
return path.join(path.dirname(packagePath), "bin", sourceBinary)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user