ReviewOS

home-lang/home

Implement Bun REPL CLI and terminal behavior

#680
Closed chris opened this 9 days ago ·
9 days ago

Goal

Implement Bun-compatible repl, -e/--eval, and -p/--print behavior in Home against the unchanged test/js/bun/repl/repl.test.ts matrix.

This is a focused child of #202 and contributes to #66. It is distinct from closed #91, which covered only Bun.Transpiler REPL-mode corpus behavior.

Current evidence

With Bun source pin 4982b91e3702094330f3be3883354c52b8c01323 and Home 34873c58c, the exact native suite reports 0 pass / 117 fail. Home currently treats repl as a script path (Script not found "repl"), so noninteractive eval/print cases exit 1 and interactive terminal cases time out waiting for a REPL process.

Required behavior includes:

  • expression evaluation, persistent bindings, _ and _error
  • .help, .exit, .load, .save, .history, .break, .copy, and .editor
  • syntax/runtime error recovery
  • imports, require, TypeScript, multiline input, and top-level await
  • -e/--eval and -p/--print, exit codes, event-loop draining, and beforeExit
  • terminal line editing, history navigation, completion, Ctrl+C/Ctrl+D, UTF-8 editing, and history permissions

Acceptance criteria

  • Run the vendored upstream file unchanged through Home native test execution.
  • All 117 tests pass without relaxing the upstream 5-second deadlines.
  • Do not replace the file with TODO/skip, alter fixtures, reduce coverage, or shell out to Bun.
  • Remove its rewriteNativeTodoCorpus branch only after the exact suite is green.
  • Add focused CLI, terminal, and corpus-gate regression coverage.
9 days ago

Strict unchanged-suite probe recorded from Home 34873c58c: 0 pass / 117 fail in 100.4s. Failures consistently show missing CLI dispatch (Script not found "repl") and terminal waits hitting the unchanged upstream 5-second deadlines. The whole-file TODO rewrite remains until the native implementation passes.

9 days ago

Completed on main in 010a6d8.\n\nThe native Home executable now activates the Bun-compatible REPL rather than routing through the incomplete fallback. The port includes current terminal sizing, safe signal/VM coordination, multi-byte UTF-8 input assembly and validation, codepoint-aware cursor/editing behavior, visible-width cursor placement, and 0600 history-file enforcement.\n\nValidation used the exact untouched Bun fixture at pinned Bun SHA 4982b91. The complete REPL suite passed twice consecutively: 117 pass, 0 fail, 248 assertions each run. This covers PTY behavior, Korean and other UTF-8 editing, malformed UTF-8, Ctrl+C, async/import/require behavior, and history permissions. The copied fixture remains byte-identical to Bun.

Sign in to comment on this issue.