The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { defineScene } from "../capture/scene.ts"; |
| 2 | |
| 3 | export default defineScene({ |
| 4 | title: "A dashboard as code", |
| 5 | chapter: "08-dashboard", |
| 6 | notes: |
| 7 | "An Axiom.Dashboard declared next to the code it observes: requests by route, p95 latency, clicks by link, errors. Every stage gets its own dashboard over its own datasets, and a chart change is a reviewable diff.", |
| 8 | async run(s) { |
| 9 | await s.sync({ except: ["src/Dashboard.ts", "alchemy.run.ts"] }); |
| 10 | await s.editor.show("src/Dashboard.ts"); |
| 11 | s.pause(1); |
| 12 | await s.editor.show("alchemy.run.ts"); |
| 13 | s.pause(1); |
| 14 | |
| 15 | await s.terminal(async (t) => { |
| 16 | await t.waitDev({ timeout: 240_000 }); |
| 17 | await t.sleep(800); |
| 18 | await t.run( |
| 19 | "deploy", |
| 20 | `for i in $(seq 5); do curl -s -o /dev/null localhost:1337/$CODE; done`, |
| 21 | ); |
| 22 | }); |
| 23 | |
| 24 | await s.diagram({ |
| 25 | stage: `dev_${process.env.USER}`, |
| 26 | nodes: ["Dashboard"], |
| 27 | edges: ["Dashboard->Traces"], |
| 28 | }); |
| 29 | s.pause(1.5); |
| 30 | |
| 31 | await s.terminal(async (t) => { |
| 32 | await t.run("test", "pnpm test", { |
| 33 | until: /Ran \d+ tests? across[\s\S]*❯\s*$/, |
| 34 | timeout: 300_000, |
| 35 | }); |
| 36 | await t.sleep(1500); |
| 37 | }); |
| 38 | }, |
| 39 | }); |