Repository navigation
refactor(ghostty): move the engine file to shared/ - #4397
Conversation
The libghostty-vt wasm moves to shared/ghostty/ so a later terminal screen can embed the same file the browser loads. vt.ts, scripts/ghostty-vt/build.sh and the libghostty-vt notice name the new path; the file's bytes are unchanged. Slice: 2h
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 13 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Merged through reviews: dori review CLEAR at 24b7a28; omo gate reviewer (GPT-6 Astra) CLEAR at 24b7a28; CodeRabbit: review limit reached |
…der (#4402) ## Change `shared/ghostty/engine.ts` is the wrapper core of libghostty-vt: it takes an instantiated module, reads every enum value and struct field it uses from the module's `ghostty_type_json()` by name instead of the numbers copied from the headers, and holds the terminal, the render state, the frame and cell decode, the cursor and the Kitty images. It has no fetch, no DOM type and no xterm rule, so a terminal screen outside the browser can use it. `src/lib/ghostty/vt.ts` keeps its name and exports as the browser's loader: it fetches and instantiates the wasm and adds the browser's choices (graphemes in xterm's cells, Kitty images kept, the theme's palette, pictures as `ImageData`). What the browser draws is unchanged. - `shared/ghostty/engine.test.ts` checks that every function and name the core uses exists in the module, that the wasm is the one `scripts/ghostty-vt/build.sh` expects, and that the core draws what was written. - `tui/tsconfig.json` includes the core and its test, so `bun run typecheck` compiles the core without the DOM library and fails if a DOM-only type comes back. For that, `readTypeLayout` takes the two exports it reads, and `GhosttyModule` takes an instance or its exports. `git diff --color-moved=zebra origin/main...HEAD`: 572 of the 1044 changed lines are code moved from `vt.ts` into `engine.ts`. `shared/` is a remote-bundle input (`scripts/release-guards.ts`). This pull request leaves `REMOTE_BUNDLE_VERSION` at 51; the next release PR raises it. ## Captures Before (main `31853b562`) and after (this head), from `scripts/design-gate-qa.ts` on the demo build in the self-hosted CI runner image. The demo draws every pane with libghostty, so the after shots are drawn through the new core. At 390 the two are pixel-identical; at 1440 the only differing pixels are the status line's live CPU reading. | Before | After | | --- | --- | | <img src="https://gist.githubusercontent.com/devswha/6bc3699a28cf0602410f015de54c302e/raw/terminal-view--1440--dark-before.png" width="420" alt="terminal view at 1440, dark, before"> | <img src="https://gist.githubusercontent.com/devswha/6bc3699a28cf0602410f015de54c302e/raw/terminal-view--1440--dark-after.png" width="420" alt="terminal view at 1440, dark, after"> | | <img src="https://gist.githubusercontent.com/devswha/6bc3699a28cf0602410f015de54c302e/raw/terminal-view--390--light-before.png" width="220" alt="terminal view at 390, light, before"> | <img src="https://gist.githubusercontent.com/devswha/6bc3699a28cf0602410f015de54c302e/raw/terminal-view--390--light-after.png" width="220" alt="terminal view at 390, light, after"> | ## Validation - `bun run check fast` at `ac7454e90`, on the heavy host (hosthatch), with its own hc: exit 0. Workflow syntax, generated types, generated themes, typecheck and build ok; unit tests 21629 pass, 0 fail, 45 skip in 1100 files, `shared/ghostty/engine.test.ts` among them. - The ten browser scripts in `scripts/ci-browser.sh` that name the terminal view or the ghostty engine, in the self-hosted CI runner image as its own user, the way `ci.yml`'s browser jobs run them: 10 of 10 pass, `terminal-ghostty-demo-regression.ts` and `ui-terminal-regression.ts` among them. - The three that name them but are not in `scripts/ci-browser.sh`, so CI never runs them, in the same image at this head: - `terminal-composition-regression.ts` and `terminal-ipad-ime-regression.ts`: pass. - `design-gate-qa.ts`, every surface, at this head and at main `31853b562`: the same 319 findings at both, none new and none resolved, and no fixed control moved in the 152 visits it lays out. Both runs exit 1 on those findings, as main does: the repository keeps no allow list for the gate. Across its 160 shots, the pixels that differ from main's are the status line's live CPU reading (71 shots), one clock time (12:02 against 12:03, 2 shots), one to three levels of antialiasing on a few edges (25 shots), and a few pixels in one shot's header. - Rebased onto main after the engine file moved to `shared/` (#4397); both commits apply unchanged (same patch-ids). - Skipped: `bun run check full`. - No changelog fragment: users notice nothing. Slice: 2i
Change
Move-only. libghostty-vt's wasm moves from
src/lib/ghostty/toshared/ghostty/, so a terminal screen outside the browser can embed the same file the browser loads. Its bytes are unchanged: git sees a 100% rename.git diff -M --color-moved origin/main...HEADis the rename and the five lines that name the file's path:src/lib/ghostty/vt.ts:new URL("./ghostty-vt.wasm", import.meta.url)becomesnew URL("../../../shared/ghostty/ghostty-vt.wasm", import.meta.url).scripts/ghostty-vt/build.sh: its header,cpandsha256sumnameshared/ghostty/ghostty-vt.wasm.THIRD_PARTY_NOTICES.md: the libghostty-vt notice namesshared/ghostty/ghostty-vt.wasm.shared/is a remote-bundle input (scripts/release-guards.ts). This pull request leavesREMOTE_BUNDLE_VERSIONat 51; the next release PR raises it.Captures
Before (main
74e92d42d) and after (this head), fromscripts/design-gate-qa.tson the demo build in the self-hosted CI runner image. The demo draws its terminal with libghostty, so the after shots come from the wasm at its new place. At 390 the two are pixel-identical; at 1440 the only differing pixels are the status line's live CPU reading.Validation
bun run check fastat24b7a28cb, on the heavy host (hosthatch), with its own hc: exit 0. Workflow syntax, generated types, generated themes, typecheck and build ok; unit tests 21514 pass, 0 fail, 45 skip in 1097 files.scripts/ci-browser.shthat name the ghostty engine or the terminal view, in the self-hosted CI runner image as its own user, the wayci.yml's browser jobs run them (bun run build,bun run build:shell,bun run check run -- bun scripts/ci-browser-parallel.ts): 10 of 10 pass,terminal-ghostty-demo-regression.tsandui-terminal-regression.tsamong them, so the built app finds the file at its new place.scripts/design-gate-qa.ts --surfaces terminal-view,split-panesat this head and at main74e92d42d, in the same image: the same 229 findings at both, none new and none resolved, and no fixed control moved in its 6 visits. Both runs exit 1 on those findings, as main does: the repository keeps no allow list for the gate.bun run check full.Slice: 2h