feat(web): add shell-first runbook UI and mock demo (#2)

Add notebook parameters, literal highlighted scripts, copy helpers, streamed runs, host-key confirmation, artifacts, conditional notes, login and optimistic Markdown editing. Keep the temporary core renderer isolated to mock mode.

Use React and Vite for the UI, react-markdown for safe Markdown rendering, highlight.js for shell syntax, and CodeMirror 6 for Markdown editing. Add Testing Library, jsdom and Vitest for component and event-state coverage.

Validate pnpm install, root typecheck and test (29 web tests, 1 server test), plus normal and mock web builds. Core contracts remain unchanged; real backend execution awaits the parallel core/server implementations.
This commit is contained in:
Florian Schmidt
2026-11-16 00:08:30 +01:00
parent d06f4336ae
commit 443bf944b8
25 changed files with 4510 additions and 2 deletions
+35
View File
@@ -0,0 +1,35 @@
# ShellBook web
From the repository root, install with `npx -y [email protected] install`.
PowerShell demo (no server or core implementation required):
```powershell
$env:VITE_MOCK = '1'
npx -y pnpm@9.15.0 --filter @shellbook/web dev
```
Open the Vite URL (normally http://localhost:5173). Select staging, run the checks
(one deliberately fails), generate demo artifacts, and authorize the key to try
confirmation. Production demonstrates the **changed host key** warning. No commands
execute and downloaded artifacts contain dummy text. Mock frontmatter parameters
are fixed to the spec example; body edits preview and save in memory only.
Normal backend mode:
```powershell
Remove-Item Env:VITE_MOCK -ErrorAction SilentlyContinue
npx -y pnpm@9.15.0 --filter @shellbook/web dev
```
Vite proxies `/api`, including WebSocket upgrades, to 127.0.0.1:8080. Normal builds
use core directly. `src/mock/core.ts` is a temporary fixture renderer selected
only by the VITE_MOCK alias; remove it and that alias when core lands. Never deploy
a build made with VITE_MOCK=1. The terminal slot is intentionally empty until M4.
`npx -y [email protected] --filter @shellbook/web test` runs jsdom component and reducer
tests. `... --filter @shellbook/web build` builds production assets. Clipboard APIs
require HTTPS or localhost. SSH copy uses a quoted heredoc (a multiline paste),
with strict bash flags matching server execution; secret env values are never copied.
Steps using secret environment variables require the operator to provide them when
pasting manually. WebSocket disconnects disable execution and require a page reload.