Skip to content

refactor(ghostty): move the engine file to shared/ - #4397

Merged
devswha merged 1 commit into
mainfrom
tui/2h-engine-file
Nov 21, 2026
Merged

devswha merged 1 commit into
mainfrom
tui/2h-engine-file

Conversation

@devswha

@devswha devswha commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Change

Move-only. libghostty-vt's wasm moves from src/lib/ghostty/ to shared/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...HEAD is 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) becomes new URL("../../../shared/ghostty/ghostty-vt.wasm", import.meta.url).
  • scripts/ghostty-vt/build.sh: its header, cp and sha256sum name shared/ghostty/ghostty-vt.wasm.
  • THIRD_PARTY_NOTICES.md: the libghostty-vt notice names shared/ghostty/ghostty-vt.wasm.

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 74e92d42d) and after (this head), from scripts/design-gate-qa.ts on 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.

Before After
terminal view at 1440, dark, before terminal view at 1440, dark, after
terminal view at 390, light, before terminal view at 390, light, after

Validation

  • bun run check fast at 24b7a28cb, 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.
  • The browser scripts in scripts/ci-browser.sh that name the ghostty engine or the terminal view, in the self-hosted CI runner image as its own user, the way ci.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.ts and ui-terminal-regression.ts among them, so the built app finds the file at its new place.
  • scripts/design-gate-qa.ts --surfaces terminal-view,split-panes at this head and at main 74e92d42d, 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.
  • Skipped: bun run check full.
  • No changelog fragment: users notice nothing.

Slice: 2h

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
@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 059ff50 and 24b7a28.

Files ignored due to path filters: 1

  • shared/ghostty/ghostty-vt.wasm is excluded by !**/*.wasm
Files selected for processing: 3

  • THIRD_PARTY_NOTICES.md
  • scripts/ghostty-vt/build.sh
  • src/lib/ghostty/vt.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@devswha
devswha merged commit 8b1d31c into main Nov 21, 2026
26 checks passed
@devswha

devswha commented Nov 21, 2026

Copy link
Copy Markdown
Owner Author

Merged through pr-merge at head 24b7a28cb. Seen before the merge was asked for: required checks green, no unresolved thread, no conflict, no hold, main not red, no release in progress. CodeRabbit said it did not review (a limit or a skip) since this head.

reviews: dori review CLEAR at 24b7a28; omo gate reviewer (GPT-6 Astra) CLEAR at 24b7a28; CodeRabbit: review limit reached

@devswha
devswha deleted the tui/2h-engine-file branch November 21, 2026 00:14
devswha added a commit that referenced this pull request Nov 21, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant