compiling
v0.1.3
Published
Local companion for compiling.games — play snake, 2048, and rain right in your terminal, and let the site chime when your agent finishes.
Maintainers
Readme
compiling
Local companion for compiling.games — cozy browser games for the gaps while your code compiles or your coding agent runs.
npx compilingopens a cozy arrow-key menu of everything right in your terminal — one
row per game (·d marks a daily: Enter free-plays, d plays the
daily), what plays right here, what opens in your browser, and the
recorded ambience beds. A "got 2 minutes?" row up top names a pick
(got 2 minutes? → Golf) — Enter runs it in the terminal when nothing
is linked, r re-rolls. / filters the list live (same fuzzy matching
as the site's ⌘K palette; Esc clears), and D/2/5/3 are canned
views: dailies, 2-minute, 5-minute, 30-second games. Enter does the
best available thing: a linked tab gets driven (the status line then
shows what it's playing), a terminal-playable game runs right here, an
ambience bed loops locally while the menu stays open (+/- nudge
the volume — local bed or driven site mixer alike — Enter stops it,
quitting stops it — no daemons), anything else opens the site. When no
relay or tab is linked, a quiet Setup section offers to fix it in place
(s jumps to it); once healthy it disappears. The list comes from the
site's own catalog.json, so it's never stale — and it carries the
current CLI version, so quitting the menu prints one quiet line when a
newer compiling exists (npx caches forever; nothing else would tell
you). q quits; piped or --help prints plain usage instead. Point it
at a dev server with COMPILING_SITE=http://localhost:3000.
npx compiling setupwalks you to a linked, chiming browser without leaving the terminal: it
starts the relay (and leaves it up — a wizard that un-does its own work
is a worse surprise), opens the site's setup page, flips to "● tab
linked" the moment your browser connects, and offers to install the
Claude Code hooks. The install (compiling hook claude --install)
merges into ~/.claude/settings.json non-destructively: existing hooks
kept, a timestamped .bak written first, the change shown before
writing, and running it twice is a friendly no-op. compiling hook
claude alone prints the JSON for hand-merging; compiling setup on a
pipe prints the manual steps and exits 0.
npx compiling play snakeplays real games in your terminal — no browser, no setup, no
dependencies. Snake and 2048 run on the exact same rules modules the
site ships (arrows, WASD, or hjkl; q/Esc/Ctrl-C always restore your
terminal; Ctrl-Z suspends clean and resumes paused). Recorded ambience
loops here too: compiling play rain 40 fetches the site's rain bed
once, caches it, and loops it at volume 40 until Ctrl-C (macOS afplay,
or mpg123/ffplay on Linux; Windows audio is a fast-follow — the
games already work in Windows Terminal). Bare compiling play lists
what plays here.
npx compiling relaystarts a tiny relay on http://127.0.0.1:8303 (8303 for xkcd #303). Your
coding agent's hooks POST an event when a run finishes or needs your
input; every linked compiling.games tab gets a soft chime, the ambience
ducks, and your game pauses — the site hands you back to work.
Full setup (Claude Code hook JSON, linking a tab): https://compiling.games/setup/
Protocol
POST /eventwith{"type": "done" | "waiting" | "started", "source"?: string, "detail"?: string}→ broadcast to every connected tab. Fire-and-forget friendly: usecurl -s -m 1 … || truein hooks so a stopped relay never slows anything.GET /health→{"clients": n}- WebSocket on the same port — this is what site tabs connect to. When several tabs are linked, the relay tags the most recently focused one; only that tab chimes, the rest just duck their ambience.
Security posture
The relay binds 127.0.0.1 only and uses no tokens, deliberately:
- Nothing leaves the machine, and nothing off the machine can reach it.
- Any local process can POST an event — and the worst that does is play a soft chime in your own browser. The event vocabulary carries no secrets (a type, an optional source label, an optional short detail string), so there is nothing worth protecting with a token handshake.
- The WebSocket side checks the
Originheader, so arbitrary web pages you visit can't listen to your events either.
If the vocabulary ever grows beyond "chime, please", this posture gets revisited before it ships.
