fix(cli): avoid narrow shutdown runtime load

This commit is contained in:
marius-kilocode
2026-08-25 16:32:33 +02:00
parent 184ed23007
commit 9af0f67c00
3 changed files with 10 additions and 1 deletions
@@ -19,6 +19,10 @@ export function hasLazyCommandSelection() {
return selected
}
export function resetLazyCommandSelection() {
selected = false
}
export function markLazyCommandSelection() {
selected = true
}
@@ -153,6 +153,7 @@ export namespace KiloCli {
if (narrow) {
const { KiloCliBootstrapRuntime } = await import("@/kilocode/cli/bootstrap-runtime")
await KiloCliBootstrapRuntime.dispose()
return
}
const { InstanceRuntime } = await import("@/project/instance-runtime")
await InstanceRuntime.disposeAllInstances() // safety net (no-op if already disposed)
@@ -1,9 +1,13 @@
import { describe, expect, test } from "bun:test"
import { afterEach, beforeEach, describe, expect, test } from "bun:test"
import { KiloCli } from "../../../src/kilocode/cli/setup"
import { createHelpCommand } from "../../../src/kilocode/help-command"
import { resetLazyCommandSelection } from "../../../src/kilocode/cli/lazy-commands"
import yargs from "yargs"
describe("CLI bootstrap runtime selection", () => {
beforeEach(resetLazyCommandSelection)
afterEach(resetLazyCommandSelection)
test("uses the narrow runtime for worker-backed TUI launches", () => {
expect(KiloCli.workerTui({ _: [] })).toBe(true)
expect(KiloCli.workerTui({ _: ["./project"] })).toBe(true)