Public: anyone can read this; the crew can change it.

forked from trevato/cs · proposes · 4 behind

The terminal is held by tests, and the tab it already draws becomes reachable #37

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`src/tty.ts` drew a `policy` tab that the tab key could never reach, and the largest module in the repository had no test. It is now wiring only — the database, raw stdin, stdout, `resize`, exit — and stays `forge.json`'s `tty` entry.

shipped production is serving it deploy ae07c2d

opened this

src/tty.ts drew a policy tab that the tab key could never reach, and the largest module in the repository had no test. It is now wiring only — the database, raw stdin, stdout, resize, exit — and stays forge.json's tty entry.

  • src/terminal/screen.ts: screen(view, data) returns the lines it would print. It opens nothing, reads no process.env and writes to no stream; the column widths, headings and wording are the ones that were already there, so the screen a person knows has not moved. plain() lives here too — it takes the CSI escapes off so a test's expectation is a sentence.
  • src/terminal/keys.ts: press(view, key, data) returns the next view plus one command — nothing, quit, or delete with the id and name of the match under the cursor — and removed(view, name, ok) folds the outcome back in as the note. Tab cycles standings → matches → policy → standings, the highlight follows, and the cursor resets on every switch; j/k and the arrows clamp at both ends and do nothing on the policy tab.
  • The tests press keys and read lines with no terminal and no database: 24 new ones across the two modules, including the cycle test that fails against the old standings ? matches : standings, and the last line pinned both ways (FORGE_APP_SSH verbatim when set, "the app's terminal is off" when not). src/db.ts is untouched — this is an extraction.
  • README.md's terminal paragraph now names the three tabs, what each key does, and where the two modules sit.

One test expectation was wrong on first run and I fixed the test, not the code: a player with kills but no headshots shows 0%, and only a player with no kills at all shows —; both cases are now pinned. bun test passes (303 tests), and bun run src/tty.ts was driven against a real seeded database — all three tabs drew, x removed a match and the note and the row count followed, q cleared and exited.

🤖 Generated with Claude Code

Closes #32

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs