fix(sdk): reject mismatched Bun generation

This commit is contained in:
marius-kilocode
2026-06-08 12:17:29 +02:00
parent 4550e0d883
commit cc2167fc52
+8
View File
@@ -9,6 +9,14 @@ import path from "path"
import { createClient } from "@hey-api/openapi-ts"
// kilocode_change start - prevent runtime-dependent generated SDK ordering
const root = path.resolve(dir, "../../..")
const pkg = await Bun.file(path.join(root, "package.json")).text()
const version = pkg.match(/"packageManager":\s*"bun@([^"]+)"/)?.[1]
if (!version) throw new Error("Root packageManager must specify bun@<version>")
if (Bun.version !== version) throw new Error(`SDK generation requires Bun ${version}, but is running Bun ${Bun.version}`)
// kilocode_change end
const opencode = path.resolve(dir, "../../opencode")
await $`bun dev generate > ${dir}/openapi.json`.cwd(opencode)