autoupgrade

This commit is contained in:
Dax Raad
2025-06-17 01:05:05 -04:00
parent d054f88130
commit 3fe163416d
2 changed files with 35 additions and 1 deletions

View File

@@ -16,6 +16,17 @@ import { AuthCommand, AuthLoginCommand } from "./cli/cmd/auth"
import { UpgradeCommand } from "./cli/cmd/upgrade"
import { Provider } from "./provider/provider"
import { UI } from "./cli/ui"
import { GlobalConfig } from "./global/config"
import { Installation } from "./installation"
;(async () => {
if (Installation.VERSION === "dev") return
const config = await GlobalConfig.get()
if (config.autoupdate === false) return
const latest = await Installation.latest()
if (Installation.VERSION === latest) return
const method = await Installation.method()
await Installation.upgrade(method, latest).catch(() => {})
})()
const cli = yargs(hideBin(process.argv))
.scriptName("opencode")