Files
Kilo-Org_kilocode/packages/opencode/src/cli/upgrade.ts
T
Catriel Müller 1eedad9213 Refactor publish workflow and environment variables (#261)
* feat: changelog generation

* refactor: rename all ENV variables to KILO prefix

* refactor: publish rework

* refactor: publish rework

* refactor: unify git commiter action

* refactor: add all kilobots to the team
2026-02-12 09:00:51 +01:00

28 lines
980 B
TypeScript

import { Bus } from "@/bus"
import { Config } from "@/config/config"
import { Flag } from "@/flag/flag"
import { Installation } from "@/installation"
export async function upgrade() {
const config = await Config.global()
const method = await Installation.method()
// kilocode_change start - only auto-upgrade for npm/pnpm/bun (we only publish @kilocode/cli via npm registry)
if (method !== "npm" && method !== "pnpm" && method !== "bun") return
// kilocode_change end
const latest = await Installation.latest(method).catch(() => {})
if (!latest) return
if (Installation.VERSION === latest) return
if (config.autoupdate === false || Flag.KILO_DISABLE_AUTOUPDATE) {
return
}
if (config.autoupdate === "notify") {
await Bus.publish(Installation.Event.UpdateAvailable, { version: latest })
return
}
await Installation.upgrade(method, latest)
.then(() => Bus.publish(Installation.Event.Updated, { version: latest }))
.catch(() => {})
}