Skip to content

Add React play screen with a live system map - #3

Merged
royalpriest merged 1 commit into
feat/scenario-enginefrom
feat/play-screen
Nov 20, 2026
Merged

royalpriest merged 1 commit into
feat/scenario-enginefrom
feat/play-screen

Conversation

@royalpriest

@royalpriest royalpriest commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

What this adds

A React + TypeScript frontend in frontend/ using the "System map" design.

  • Chapter picker: all five chapters in story order. Linux and Monitoring are playable; the others are marked as coming soon.
  • Play screen:
    • A live map of the shop (laptop, nginx, shop-web, shop-worker, postgresql, disk). The part in trouble glows amber or red, and the wires into it animate. Clicking a box puts a matching command (systemctl status …, df -h) on the prompt without running it.
    • A step card with progress dots, the full step list and a "Show a hint" button.
    • A memory or disk gauge (depending on the chapter) with an alert threshold line and recent alerts.
    • An xterm.js terminal drawer with a line editor (history, cursor keys, Ctrl+C, Ctrl+L, paste) and a Logs tab per service.
    • A toast when a step completes, and a "Chapter complete" card with a link to the next chapter.
  • Time: the screen ticks every 4 seconds, pausing while the tab is hidden, so incidents keep evolving while you read.
  • Live updates: panels also follow RunChannel over Action Cable. Terminal output always comes from the HTTP response, so a dropped socket never loses output.
  • Phones: one section at a time (Map, Terminal, Steps, Alerts) from a bottom dock, with a stacked map layout.
  • Theme: light and dark, following the system setting, with a toggle. Reduced motion is respected.

Backend changes

  • The run payload now includes map (nodes, edges, status per node), logs (recent journal lines per service), hint and current_host. Scenarios also declare a focus_metric.
  • Monitoring now starts with the leak already under way, so the alert fires about a minute after starting instead of two.

Repo

  • CI gains a frontend job that runs lint, type check and build. It uses actions/checkout@v7, matching the Dependabot bump.
  • README has run instructions for both apps. CLAUDE.md lists the frontend checks and notes that this app has its own theme.

Checks

  • bin/rails test: 33 runs, 0 failures. bin/rubocop: clean. bin/brakeman: 0 warnings.
  • npm run lint: clean. npm run build: passes.
  • I played both chapters end to end in Chromium at desktop size and checked the phone layout at 390px wide. There were no console errors and no horizontal scrolling.

The frontend (Vite + React + TypeScript) has a chapter picker and a play
screen: a map of the shop's system where the part in trouble glows, a step
card with hints, a memory or disk gauge with alerts, and an xterm.js
terminal with a logs tab. Time ticks every 4 seconds so incidents evolve
while the player reads. Phones get one section at a time from a bottom dock.

The API now returns the map, recent logs and the current hint. The
Monitoring chapter starts with the leak already under way so the alert
fires within a minute. CI also lints and builds the frontend.
@royalpriest
royalpriest merged commit 2daa394 into feat/scenario-engine Nov 20, 2026
2 checks passed
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