Start of the full Rust rewrite of Ghostty 1.3.1 (reference source in
../ghostty). Sets up a workspace whose crates mirror Ghostty's Zig modules
(vt, unicode, datastruct, os, input, config, terminal, font, renderer,
termio, core, apprt-gtk) so porting work can proceed in parallel per crate.
Also adds:
- docs/rewrite/{ARCHITECTURE,PLAN,STATUS,AGENT_GUIDE}.md: crate map, core
design decisions (safe Rust, slab-based PageList, logical capacity
accounting), phased plan, progress tracker, and porting rules.
- Workspace clippy config relaxing pedantic lints that are pure noise for
low-level terminal code (casts, long functions).
- Shared vt types needed by several work packages up front: kitty
keyboard flags (kitty/key.rs) and the CSI separator bitset (SepList).
Test Plan:
- cargo test -p ghostty-vt (3 tests pass)
- cargo clippy -p ghostty-vt --all-targets -- -D warnings
44 lines
2.3 KiB
Markdown
44 lines
2.3 KiB
Markdown
# Rewrite plan
|
|
|
|
Orchestrator: Opus (plans, designs core abstractions, reviews, integrates,
|
|
commits). Bulk porting: Sonnet subagents. Hard algorithmic cores: Codex
|
|
(gpt-6-astra) or Opus. Progress lives in `STATUS.md`.
|
|
|
|
## Phases
|
|
|
|
### Phase 0 — scaffolding (done)
|
|
Workspace, crate skeletons, docs, lints.
|
|
|
|
### Phase 1 — leaf crates (parallel)
|
|
- W1 `ghostty-vt` part A: Parser, parse_table, UTF8Decoder, osc + osc/parsers/*, osc/encoding, color, x11_color, kitty/color.
|
|
- W2 `ghostty-vt` part B: csi (incl. `SepList`), sgr, modes, charsets, ansi, device_status, mouse_shape, kitty/key, kitty/graphics_command, apc, dcs.
|
|
- W3 `ghostty-unicode` + `ghostty-datastruct`.
|
|
- W4 `ghostty-os`.
|
|
- W5 `ghostty-input`.
|
|
- W6 `ghostty-config` (+ cli/args, CommaSplitter, diagnostics).
|
|
- W7 `ghostty-font`: Metrics + sprite/*.
|
|
|
|
### Phase 2 — terminal core
|
|
- `ghostty-vt::stream` (stream.zig) once W1/W2 land.
|
|
- `ghostty-terminal`: style, hyperlink, size, point, ref_counted_set, page, PageList (Codex/Opus: hardest part), then Screen, Tabstops, Terminal, ScreenSet, Selection, stream_readonly, formatter, render, highlight, search/*, kitty graphics storage/image/exec/unicode, tmux.
|
|
|
|
### Phase 3 — font engine
|
|
discovery (fontconfig), freetype face, harfbuzz shaper (+run, feature, Cache), opentype tables, Collection, CodepointResolver, CodepointMap, DeferredFace, SharedGrid, SharedGridSet, Atlas, embedded fonts, nerd_font_attributes.
|
|
|
|
### Phase 4 — termio
|
|
pty, Command (fork/exec), Exec backend, Termio, Thread, mailbox, stream_handler, shell_integration (+ copy `ZIG/src/shell-integration`).
|
|
|
|
### Phase 5 — renderer
|
|
OpenGL backend (glow), generic renderer logic, cells, cursor, image, link, size, State, Thread, Overlay, shadertoy custom shaders.
|
|
|
|
### Phase 6 — core + GTK app
|
|
ghostty-core: App, Surface, surface_mouse, apprt action/structs, CLI actions. ghostty-apprt-gtk: application, windows, tabs, splits, surface widget (GLArea, input, IME, clipboard), config reload, dialogs, notifications, quick terminal, IPC (+new-window), CSS/UI.
|
|
|
|
### Phase 7 — integration and polish
|
|
End-to-end run, vttest-ish smoke tests, perf, inspector (maybe), docs, CHANGELOG.
|
|
|
|
## Review protocol
|
|
After each work package: orchestrator reads the agent report + notes, spot-checks
|
|
code (esp. tricky logic), runs quality gate on the workspace, commits. Larger
|
|
cores get an `/astrareview` or Codex review pass.
|