From eea1562a0c7189e8b4300d5cef7f1b88db16bd17 Mon Sep 17 00:00:00 2001 From: Mickey Lazarevic Date: Thu, 30 Apr 2026 12:18:14 +0200 Subject: [PATCH] feat(kilo-vscode): add shared package version tracking and update app name Add version tracking for the shared package alongside the opencode package to improve cache invalidation. Also update the app name from "opencode" to "kilo" in the shared global configuration. This change ensures that the local binary build process tracks both the opencode and shared package versions, allowing for more accurate cache invalidation when either package changes. The app name update reflects the correct project branding. --- packages/kilo-vscode/script/local-bin.ts | 20 ++++++++++++++++---- packages/shared/src/global.ts | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/packages/kilo-vscode/script/local-bin.ts b/packages/kilo-vscode/script/local-bin.ts index ee31c76a666..4f3963bb775 100644 --- a/packages/kilo-vscode/script/local-bin.ts +++ b/packages/kilo-vscode/script/local-bin.ts @@ -20,11 +20,13 @@ 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" const targetBinPath = join(targetBinDir, binName) const versionFile = join(targetBinDir, ".cli-version") +const sharedVersionFile = join(targetBinDir, ".shared-version") function log(msg: string) { console.log(`[local-bin] ${msg}`) @@ -32,8 +34,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 +44,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 } @@ -183,6 +187,14 @@ async function main() { const hash = await cliSourceHash() if (hash) await Bun.write(versionFile, hash + "\n") + // Also record shared package version for cache invalidation + try { + const sharedHash = await $`git log -1 --format=%H -- .`.cwd(sharedDir).quiet() + await Bun.write(sharedVersionFile, sharedHash.text().trim() + "\n") + } catch { + // ignore errors for shared package + } + log(`Copied CLI binary from ${relative(packagesDir, sourceBinPath)} -> ${relative(kiloVscodeDir, targetBinPath)}`) } diff --git a/packages/shared/src/global.ts b/packages/shared/src/global.ts index 4bc0ec93bf4..280f09324e4 100644 --- a/packages/shared/src/global.ts +++ b/packages/shared/src/global.ts @@ -19,7 +19,7 @@ export namespace Global { export const layer = Layer.effect( Service, Effect.gen(function* () { - const app = "opencode" + const app = "kilo" // kilocode_change const home = process.env.KILO_TEST_HOME ?? os.homedir() const data = path.join(xdgData!, app) const cache = path.join(xdgCache!, app)