diff --git a/packages/kilo-vscode/script/local-bin.ts b/packages/kilo-vscode/script/local-bin.ts index ee31c76a666..4da699a36cf 100644 --- a/packages/kilo-vscode/script/local-bin.ts +++ b/packages/kilo-vscode/script/local-bin.ts @@ -20,6 +20,7 @@ const forceRebuild = process.argv.includes("--force") const kiloVscodeDir = join(import.meta.dir, "..") const packagesDir = join(kiloVscodeDir, "..") const opencodeDir = join(packagesDir, "opencode") +const sharedDir = join(packagesDir, "shared") const targetBinDir = join(kiloVscodeDir, "bin") const binName = process.platform === "win32" ? "kilo.exe" : "kilo" @@ -32,8 +33,9 @@ function log(msg: string) { async function cliSourceHash(): Promise { try { - const result = await $`git log -1 --format=%H -- .`.cwd(opencodeDir).quiet() - return result.text().trim() || null + const opencodeResult = await $`git log -1 --format=%H -- .`.cwd(opencodeDir).quiet() + const sharedResult = await $`git log -1 --format=%H -- .`.cwd(sharedDir).quiet() + return `${opencodeResult.text().trim()}-${sharedResult.text().trim()}` || null } catch { return null } @@ -41,8 +43,9 @@ async function cliSourceHash(): Promise { async function isDirty(): Promise { try { - const result = await $`git status --porcelain -- .`.cwd(opencodeDir).quiet() - return result.text().trim().length > 0 + const opencodeResult = await $`git status --porcelain -- .`.cwd(opencodeDir).quiet() + const sharedResult = await $`git status --porcelain -- .`.cwd(sharedDir).quiet() + return opencodeResult.text().trim().length > 0 || sharedResult.text().trim().length > 0 } catch { return false } @@ -119,8 +122,8 @@ async function ensureBuiltBinary(): Promise { `No prebuilt binary found under ${relative(kiloVscodeDir, join(opencodeDir, "dist"))} - attempting build via bun.`, ) - const bunFile = Bun.file(await Bun.which("bun")) - if (!(await bunFile.exists())) { + const bunPath = Bun.which("bun") + if (!bunPath) { throw new Error( `Bun is required to build the CLI binary, but was not found on PATH. ` + `Install bun, or build the CLI separately in ${opencodeDir} and re-run.`, diff --git a/packages/shared/src/global.ts b/packages/shared/src/global.ts index 455021baa40..d476bc8b340 100644 --- a/packages/shared/src/global.ts +++ b/packages/shared/src/global.ts @@ -19,8 +19,8 @@ export namespace Global { export const layer = Layer.effect( Service, Effect.gen(function* () { - const app = "opencode" // kilocode_change start - guard against newline-contaminated HOME/XDG paths + const app = "kilo" const clean = (p: string | undefined) => p?.replace(/[\r\n]+/g, "") const home = clean(process.env.KILO_TEST_HOME ?? os.homedir())! const data = path.join(clean(xdgData)!, app)