fix: harden OpenCode v1.14.48 integration

This commit is contained in:
marius-kilocode
2026-06-08 14:38:13 +02:00
parent 5706abce76
commit cc03ffc581
25 changed files with 658 additions and 66 deletions
@@ -0,0 +1,47 @@
// kilocode_change - new file
import { describe, expect, test } from "bun:test"
import { TuiConfig } from "../../../../src/cli/cmd/tui/config/tui"
import * as AppExit from "../../../../src/kilocode/tui/app-exit"
const prompt = (focused: boolean, input: string): AppExit.Prompt => ({
focused,
current: { input },
})
describe("app_exit", () => {
test("blocks every configured exit binding when the command matcher is disabled", () => {
const bindings = TuiConfig.resolve({}).keybinds.gather("app_exit", ["app.exit"])
expect(bindings.length).toBeGreaterThan(0)
for (const binding of bindings) expect(AppExit.enabled(false)).toBe(false)
})
test("permits exit without a prompt ref", () => {
expect(AppExit.enabled(true)).toBe(true)
})
test("blocks focused prompts with non-empty input including whitespace", () => {
expect(AppExit.enabled(true, prompt(true, "keep typing"))).toBe(false)
expect(AppExit.enabled(true, prompt(true, " "))).toBe(false)
})
test("permits focused empty and unfocused prompts", () => {
expect(AppExit.enabled(true, prompt(true, ""))).toBe(true)
expect(AppExit.enabled(true, prompt(false, "keep typing"))).toBe(true)
})
test("registers slash exit independently of binding enablement", () => {
let exited = false
const command = AppExit.command(() => {
exited = true
})
expect(command).toMatchObject({
name: "app.exit",
slashName: "exit",
slashAliases: ["quit", "q"],
})
command.run()
expect(exited).toBe(true)
})
})