tools/worktree-samples

Lets the headless tools that play songs on the dev server (tools/measure, tools/check-songs) hear a worktree's own samples/ when they are run from one.

The dev server (buck2 run //:dev) serves one checkout, usually the main one, and its sample map (website/src/pages/jev-samples/strudel.json.js) points every sound at that checkout's files (/@fs/<checkout>/samples/…). A review that re-renders a vocal in its worktree, then measures it on that server, would hear the old file.

worktreeSamples({ url, root }) reads the server's map to see which checkout it serves. When that is not root, its route(page) makes a Playwright page:

  • get a sample map built from root's samples/, by the site's own builder (website/src/jev/sampleMap.mjs), so sounds only the worktree has are listed and sounds it deleted are not;
  • get every sample file it asks for under either checkout's samples/ from root's file, or a 404 when root has none.

Each tool prints a line when it does this, naming both checkouts. Run from the checkout the server serves, nothing changes.

FileWhat it is
worktree-samples.mjsworktreeSamples and routingNote, used by both tools.