fix(coding-agent): add Bun runtime errata guard for OSC sequence width bug

Detects known Bun.stringWidth mishandling of OSC sequences at startup
and exits with a clear upgrade message instead of crashing in the TUI
render path.

Fixes #31
This commit is contained in:
can1357
2026-02-12 15:25:13 +01:00
parent 0b492d9fbb
commit 95b05ca644
+8
View File
@@ -6,6 +6,14 @@
import { type CommandEntry, run } from "@oh-my-pi/pi-utils/cli";
import { APP_NAME, VERSION } from "./config";
// Detect known Bun errata that cause TUI crashes (e.g. Bun.stringWidth mishandling OSC sequences).
if (Bun.stringWidth("\x1b[0m\x1b]8;;\x07") !== 0) {
process.stderr.write(
`error: Bun runtime errata detected (v${Bun.version}). Please update Bun: bun upgrade\n`,
);
process.exit(1);
}
process.title = APP_NAME;
const commands: CommandEntry[] = [