mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-10-24 01:24:18 +08:00
A clean checkout no longer needs a manual `bun run build:tui` for `packages/kilo-cli`'s `bun run test` to pass: the live interactive/TUI proofs skip with a named reason instead of hard-asserting, silently returning, or crashing ENOENT. - `test/fixture.ts` gains `interactiveArtifactDir()`, `interactiveBun()`, `interactiveKilo2()`, and `interactiveSkipReason()` (resolved from `KILO_CLI_INTERACTIVE_DIR`, default `dist/interactive`) plus a one-time banner naming `bun run build:tui`. - Fourteen gated proofs (28 tests) now use `test.skipIf(!binary)`; the two `console.warn`+`return` silent skips and three hard existence asserts are gone. - New `test/interactive-artifact-registry.test.ts` fails the default run when the gated set drifts from the registry. - New package-only `test:interactive` script verifies the runtime and delegates to the unchanged `script/test.ts`, failing loudly when absent. The interactive runtime cannot be a mandatory default: `build-tui.ts` copies a Bun >= 1.4 runtime and builds a large portable bundle plus the ACP bridge, is platform-sensitive, and throws on Windows. CI runs the package `test` script directly (no `@kilocode/cli#test` turbo task), so the proofs skip there and run developer-local via `bun run build:tui` then `bun run test:interactive`.
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import { expect, test } from "bun:test"
|
|
import { fileURLToPath } from "node:url"
|
|
import path from "node:path"
|
|
import { fixture, interactiveBun } from "./fixture"
|
|
|
|
const bundledBun = interactiveBun()
|
|
|
|
test.skipIf(!bundledBun)("launched Kilo gateway records actual Auto response model without changing the request", async () => {
|
|
await using input = await fixture()
|
|
const child = Bun.spawn(
|
|
[
|
|
bundledBun!,
|
|
"--no-env-file",
|
|
"--preload",
|
|
fileURLToPath(import.meta.resolve("@opentui/solid/preload")),
|
|
path.join(import.meta.dir, "routed-model-integration-fixture.ts"),
|
|
],
|
|
{
|
|
cwd: input.cwd,
|
|
env: input.env,
|
|
stdout: "pipe",
|
|
stderr: "pipe",
|
|
stdin: "ignore",
|
|
timeout: 120000,
|
|
killSignal: "SIGKILL",
|
|
},
|
|
)
|
|
try {
|
|
const [code, stdout, stderr] = await Promise.all([
|
|
child.exited,
|
|
new Response(child.stdout).text(),
|
|
new Response(child.stderr).text(),
|
|
])
|
|
expect(code, `${stdout}\n${stderr}`).toBe(0)
|
|
expect(stdout).toContain("ROUTED_MODEL_INTEGRATION_OK")
|
|
} finally {
|
|
child.kill()
|
|
await child.exited
|
|
}
|
|
}, 150000)
|