feat(repl): implement native Zig REPL for bun repl

This implements a new REPL in Zig that replaces the previous bunx-based
REPL. The new REPL provides:

- Interactive line editing with cursor movement and history navigation
- Syntax highlighting using QuickAndDirtyJavaScriptSyntaxHighlighter
- Multi-line input with bracket matching detection
- REPL commands (.help, .exit, .clear, .load, .save, .editor, .timing)
- JavaScript evaluation using the global eval() function
- Pretty-printed output for evaluated expressions
- Support for both TTY (interactive) and non-TTY (piped) input

The REPL properly initializes the JSC VirtualMachine with the API lock
held, enabling safe JavaScript execution. It uses Bun's transpiler
infrastructure and output formatting.

TODO:
- Implement REPL transforms for variable persistence across lines
- Integrate package installation
- Add shell mode integration
- Implement JSC-based autocomplete

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Claude Bot
2026-01-20 18:26:35 +00:00
parent 3536e422e9
commit d0bf75f88f
2 changed files with 1263 additions and 6 deletions

1260
src/cli/repl_command.zig Normal file

File diff suppressed because it is too large Load Diff