Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions packages/kilo-vscode/script/local-bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -32,17 +33,19 @@ function log(msg: string) {

async function cliSourceHash(): Promise<string | null> {
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
}
}

async function isDirty(): Promise<boolean> {
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
}
Expand Down Expand Up @@ -119,8 +122,8 @@ async function ensureBuiltBinary(): Promise<string> {
`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.`,
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading