tools/jev-history

nix run .#jev-history -- <song>: Jev's decision history for one song, from the performances the site has stored (worker/src/listening.ts; every play of a song as written that ended, or got past its opening, is one). For each choice Jev makes, it prints how often Jev picked each option, section by section:

nix run .#jev-history -- lightning-in-a-bottle        the local dev database
nix run .#jev-history -- jev/dial-up --current        only the song's current code
nix run .#jev-history -- jev/dial-up --remote         the deployed database
jev/dial-up: 3 performances (3 finished, 0 stopped), 2 versions of its code (2 of the current one)

section: what Jev picks next, at each section (Jev's own picks)
  intro  → drop2d 100% (3)
  drop2d → outro 50% (1) · verse 50% (1)   + 1 fallback
  verse  → outro 100% (1)

into: what Jev picks, in each section (Jev's own picks)
  drop2d fill 100% (2)   + 1 fallback

The form's question (the choice walk() is over) is counted at the section playing when Jev picked what comes next; every other choice in the section it plays in. Only Jev's own picks are in the percentages: a fallback (Jev unreachable, unsure, or late), a forced section and a part absent from its section are counted beside them. --current keeps only performances of the song's code as it is now (its SHA-256, as the page hashes it, website/src/jev/songCode.mjs).

The local database is //:dev's (worker/.wrangler/state) in the working tree the command runs in, read with the devshell's wrangler. --remote reads the real one through the deploy's wrangler, which reads the Cloudflare token from 1Password itself; the tool only looks the database up by name and reads it.

For any other question, the rows are one SQL query away: performance_segments has a row per segment per jev() with its section, the after_section before it, its status, and answers as JSON (worker/migrations/0003_listening.sql). For example, from the repo root:

wrangler d1 execute jevstrudel --local --env dev --config worker/wrangler.json --command \
  "SELECT json_extract(answers, '$.section.choice') AS pick, count(*) FROM performance_segments
   WHERE after_section = 'drop2d' GROUP BY pick"
FileWhat it is
history.mjsThe command: the two queries, and the report.
history.test.mjsThe queries against the real schema (worker/test/d1.ts), with performances stored as the Worker stores them.