1# tools/jev-history 2 3`nix run .#jev-history -- <song>`: Jev's decision history for one song, from 4the performances the site has stored (`worker/src/listening.ts`; every play 5of a song as written that ended, or got past its opening, is one). For each 6choice Jev makes, it prints how often Jev picked each option, section by 7section: 8 9 nix run .#jev-history -- lightning-in-a-bottle the local dev database 10 nix run .#jev-history -- jev/dial-up --current only the song's current code 11 nix run .#jev-history -- jev/dial-up --remote the deployed database 12 13``` 14jev/dial-up: 3 performances (3 finished, 0 stopped), 2 versions of its code (2 of the current one) 15 16section: what Jev picks next, at each section (Jev's own picks) 17 intro → drop2d 100% (3) 18 drop2d → outro 50% (1) · verse 50% (1) + 1 fallback 19 verse → outro 100% (1) 20 21into: what Jev picks, in each section (Jev's own picks) 22 drop2d fill 100% (2) + 1 fallback 23``` 24 25The form's question (the choice `walk()` is over) is counted at the section 26playing when Jev picked what comes next; every other choice in the section 27it plays in. Only Jev's own picks are in the percentages: a fallback (Jev 28unreachable, unsure, or late), a forced section and a part absent from its 29section are counted beside them. `--current` keeps only performances of the 30song's code as it is now (its SHA-256, as the page hashes it, 31`website/src/jev/songCode.mjs`). 32 33The local database is `//:dev`'s (`worker/.wrangler/state`) in the working 34tree the command runs in, read with the devshell's wrangler. `--remote` 35reads the real one through the deploy's wrangler, which reads the 36Cloudflare token from 1Password itself; the tool only looks the database 37up by name and reads it. 38 39For any other question, the rows are one SQL query away: `performance_segments` 40has a row per segment per jev() with its `section`, the `after_section` 41before it, its `status`, and `answers` as JSON 42(`worker/migrations/0003_listening.sql`). For example, from the repo root: 43 44 wrangler d1 execute jevstrudel --local --env dev --config worker/wrangler.json --command \ 45 "SELECT json_extract(answers, '$.section.choice') AS pick, count(*) FROM performance_segments 46 WHERE after_section = 'drop2d' GROUP BY pick" 47 48| File | What it is | 49|---|---| 50| `history.mjs` | The command: the two queries, and the report. | 51| `history.test.mjs` | The queries against the real schema (`worker/test/d1.ts`), with performances stored as the Worker stores them. |