Repository navigation
demos: record the interactive picker, and fix the bugs it exposed - #4178
Conversation
The picker is the feature the demos showed least: `wt-switch-picker` lived only on the /switch/ page, and the omnibus glanced at it for three seconds. The picker's forge data had never worked in any demo. wt's CI detection parses the remote URL for an owner/repo before it will call `gh`, and the demo repo's origin was a local filesystem path, which doesn't parse; the mock also exited 1 on `gh --version`, which `CiToolsStatus::detect` gates every forge call on. Both failures are silent — an empty CI column and permanently unavailable `pr` and `comments` tabs. Origin now claims a GitHub URL with `url.<bare>.pushInsteadOf` sending pushes to the local bare repo, so nothing reaches the wire. - `wt-switch-picker` is a full tour on eleven worktrees: CI streaming in behind the list, alt-p revealing the CI column, a paged diff, a PR comment thread, the PR pane. It goes on the homepage and README beside wt-core. - The omnibus opens with a picker beat: streaming CI, the alt-p reveal, then filtering to api and paging its diff. - Per-branch response delays in DEMO_PRS are what make the column stream; the PR bodies and comment threads ride the same responses, and the CI call primes the picker's comments cache so that tab needs no second fetch. Three things this turned up: `build_squash_prompt` diffed `merge_base..HEAD`, but a squash commits the index. `wt merge` on a branch with commits *and* uncommitted work generated a message describing only the pre-existing commits, ignoring the work it had just staged into the same commit. The index is the one span that covers both, and with nothing staged it equals the old one, so there's no second path. VHS delivered `Alt+p` as a bare `p` — ttyd didn't pass `macOptionIsMeta`, so xterm.js handed macOS Option to the browser's own composition. A tape's alt-p typed into the picker's query with no error anywhere. Fixed in the VHS fork; `ensure_vhs_binary` now refuses a clone predating it rather than recording something wrong, since it reuses an existing clone without pulling. The snapshot harness inherited the caller's terminal width and color, so its output reflowed with whichever shell ran the build. Pinned both. Checkpoint windows are calibrated against one target's terminal size: the merge's commit message survives to the end of the ~33-row docs recording and scrolls off the ~24-row social one inside 18 frames. `Checkpoint.targets` scopes a window to where it was measured, and the window is anchored to the end of the recording rather than to an absolute frame, which drifts tens of frames between runs of the same tape. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… CI and summaries The overlay ran about two thirds of a second behind the screen, so every key in the recording appeared after the picker had already answered it. Its events were timed from the first keypress after `Set KeyStrokes Show`, while the overlay is drawn against the finished video — two clocks that only agree when that keypress lands on the video's first frame. The fork now counts recorded frames instead (max-sixty/vhs 2667063), which is the video's own clock, and the fixed 500ms fudge that was compensating for the mismatch goes with it. `_VHS_FORK_MARKER` moves to that commit so a stale clone fails loudly rather than recording the old timing. The picker demo also records at its own size now, `SIZE_DOCS_PICKER`: the same 1600x900 canvas in smaller text, which buys 139x34 instead of 102x25. That is the demo whose subject is a wide table beside a preview pane, and at the usual size the two columns worth watching — CI status and the branch summary — fall off the right edge, while the preview is too short to page a diff through. The Summary column needs an LLM command configured before it renders at all, so `prepare_picker` writes the user config and the `llm` mock moves to `fixtures/llm-mock.sh` beside the forge mock, with a line per branch fixture. Sixteen worktrees rather than eleven fill the taller terminal, and OCR checkpoints now cover the alt-p reveal, the comment thread and the PR pane — the alt-p one asserts the preview's tab bar is *gone*, which is the only evidence the Alt binding reached the picker rather than typing a "p". Two things found on the way: - The preview pane rendered one column wider than skim paints, so a wrapped prose line that happened to break flush against the edge lost its last character — "when" rendered as "whe", mid-sentence, with nothing to suggest clipping. `dimensions_for` now returns the text width and `spec_for` adds the column back for skim's window. - `check_ffmpeg_libass` puts Homebrew's `ffmpeg-full` on PATH itself when the linked `ffmpeg` can't draw subtitles. Installing or upgrading `ffmpeg` silently takes the keystroke overlay away, and the failure lands minutes into a recording as an ffmpeg filter-graph parse error. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ne shape The homepage carried three demos. The omnibus already opens on the picker — `alt-p` widens the rows, the CI cells land one at a time behind them, then `ctrl-d` pages api's diff before it is selected — so the picker's own figure was a second showing of the same thing, and it goes. The full tour stays on /switch/. The overlay drew `Alt+"8"` as two keystrokes: the modifier fell into the greyed history while a bare 8 took the amber reserved for the newest key, reading as a spent ⌥ followed by an unrelated digit. ExecuteAlt and ExecuteShift drove VHS's bare Keyboard, which records every press it is handed, where ExecuteCtrl already went through KeyActions, which buffers a held modifier onto the key it modifies. Fork commit 4240c82 puts all three on one helper and makes the buffer accumulate, so `Ctrl+Shift+d` reads ⌃⇧d rather than dropping the ⌃. `_VHS_FORK_MARKER` names that commit: a clone without it records a wrong overlay and reports nothing. All five affected recordings are re-recorded and OCR-validated. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The homepage bullet was written when the picker had a diff and a log preview. It has eight tabs and a CI column that fills in behind the rows, and with the picker's own figure gone that line is the page's only mention of it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
worktrunk-bot
left a comment
There was a problem hiding this comment.
Two inline fixes, plus one decision on the squash prompt.
The squash prompt still scopes the task to the commits. build_squash_prompt now feeds a diff spanning the index, but the <commits> block it renders is still built from commit_details over merge_base..HEAD, and DEFAULT_SQUASH_TEMPLATE still opens <task>Write a commit message for the combined effect of these commits.</task> (and <style> says "match the style of commits being squashed"). So on exactly the case this PR fixes — wt merge on a dirty worktree — the staged work reaches the model only through <diff>, while both the instruction and the commit list point away from it. Whether that's worth rewording the task line to name the changes rather than the commits is a judgment call about generated-message quality, not something the diff settles; it's outside the diff, so say the word and I'll push it.
The reviewer's two concrete items: `check_ffmpeg_libass` asked brew for `ffmpeg-full` without checking there is a brew, and `subprocess.run` on a missing program raises rather than returning non-zero — so a box with no Homebrew got a traceback in place of the "install ffmpeg-full" message the function had already written. And the llm mock matched the `api` branch on `src/api.rs`, which is the picker environment's file; `prepare_zellij_omnibus` builds its own `api` from `src/health.rs`, so that row fell through to the default and called itself a README change. The mock's comment named two of the three places a branch is defined. Its third was a design question, and it is right: feeding the prompt a diff that spans the index left the task line saying "the combined effect of these commits", which points at the one block that does not carry the staged work. It now names <diff> as what the squash records and <commits> as what it folds in. Following that through found the preview: `wt step commit --dry-run` stages into a temp index so its prompt matches a real run, and `--show-prompt` deliberately shows only what is staged. Making the squash prompt read the index broke that parity for squash, whose `--dry-run` showed neither. It now mirrors `--stage` the same way, with the flag plumbed through from the CLI, and the test covers both halves. `SquashInputs` replaces the argument list the staging index pushed past clippy's limit. All three call sites passed the same values in the same order, which is where a transposed pair goes unnoticed. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
worktrunk-bot
left a comment
There was a problem hiding this comment.
One leftover from the refactor, plus a note inline.
Three comments still name functions this commit deleted. In tests/integration_tests/merge.rs, test_step_squash_show_prompt_malformed_template's doc comment attributes the propagated template error to build_squash_prompt, and test_step_squash_dry_run_llm_failure names generate_squash_message twice — in its doc comment and in the inline comment above the config block ("so generate_squash_message bubbles the failure up"). Neither symbol exists any more; the paths are SquashInputs::prompt and SquashInputs::generate_message, the same rename the commit already applied to the equivalent comment in src/llm.rs ("mirroring SquashInputs::generate_message"). A reader grepping either name to find what those tests pin comes back empty. Outside the diff, so say the word and I'll push it along with the inline point.
Moving `wt.index_base()?` out to `staged_diff`'s callers left both of its arms infallible, so its `anyhow::Result` guarded nothing and three `?`s carried no risk. It returns the `PreparedDiff` now, and takes `impl Into<String>` so the squash site stops building a `String` to hand over a `&str` the callee would clone anyway. Two test doc comments still named `build_squash_prompt` and `generate_squash_message` as the functions under test. They are `SquashInputs::prompt` and `SquashInputs::generate_message`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
0.79.0 was prepared and merged in #4181 but never tagged, so it never shipped. Cargo.toml and Cargo.lock already carry the version, so this reuses it and folds the thirteen commits that landed since into the same changelog section. New entries cover the worktree-side rename fixes (#4190, #4191), the per-project unknown-field warning (#4123), and the unterminated code fence in the picker's preview (#4183, combined with #4178's column fix). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`docs/demos/build` recorded the wrong output whenever it took its parallel path, which it does for any run with more than one non-TUI demo unless `--sequential` is passed. #4178 added a positional `target` parameter to `record_demo`, but only the sequential call site was updated. The `executor.submit(...)` call still passed `args.text` and `args.snapshot` in the old positions, so: - `./build docs --snapshot` wrote `.txt` text output instead of updating `docs/demos/snapshots/*.snap`, because `snapshot_mode` was always `False`. - `./build docs --text` recorded GIFs. - A plain GIF run passed `target=False` to checkpoint validation. The parallel call now passes `target`. Both call sites pass `text_mode=` and `snapshot_mode=` by keyword, so the next positional parameter can't shift them. There's no regression test: the script drives VHS and has no test harness in this repo. The sequential call site, which already passed `target`, shows the intended argument order. I checked the edit by parsing the script; it hasn't been run end to end. Co-authored-by: worktrunk-bot <[email protected]>
The interactive picker had no demo, and the two things that sell it don't survive a still image: rows painting from local git before any network call, and a preview pane you page through without leaving the list. Making that recordable meant giving the demo environment a forge that answers on a schedule, which is what most of this diff is.
The mocked forge
docs/demos/shared/fixtures/gh-mock.shanswers everyghcall from a file thatwrite_gh_mock_datawrites once the branches exist — first line a delay, the rest a JSON body. The per-branch delays are the point: wt runs onegh pr listper branch concurrently, so staggered replies land the CI cells one at a time behind a frame that already painted.fixtures/llm-mock.shdoes the same for the Summary column, picking a sentence from the paths in each branch's diff.Three things have to hold or the CI column silently empties rather than failing, and
docs/demos/CLAUDE.mdnow records all three: a parseable origin (set viaurl.<bare>.pushInsteadOf, sogit remote get-urlstill hands wt the URL while pushes go to the local bare repo),gh --versionandgh auth statusboth exiting 0, andDEMO_PROJECT_IDmatching the URL.The recordings
wt-switch-pickeris the full tour, and it is the one demo that records at its own size —SIZE_DOCS_PICKER, the same 1600x900 canvas in smaller text, giving 139x34 instead of 102x25. At the usual size the CI and Summary columns fall off the right edge and the preview is too short to page a diff. It runs against sixteen worktrees with varied CI, a ten-comment PR thread, and a working tree dirty in several different ways.wt-zellij-omnibusopens on the picker rather than passing through it:alt-pwidens the rows, the CI cells land behind them,ctrl-dpages a diff, then Enter selects. That beat is the picker's showing on the homepage, which stays at two demos.Bugs this turned up
wt mergeon a dirty worktree described the wrong changes.build_squash_promptdiffedmerge_base..HEAD, but the squash commits the index —handle_squashstages the working tree before generating the message and soft-resets afterwards. So the generated message covered the branch's older commits and said nothing about the work just staged into the same commit, which on a dirtywt mergeis the whole reason it ran. It now diffsmerge_baseagainst the index, matching the statshandle_squashprints for that same commit. With nothing staged the two spans are identical, so there is no second path.wt step squash --dry-runpreviewed a different prompt than it would send.wt step commit --dry-runstages into a temp index so its preview spans what a real run would commit, while--show-promptdeliberately shows only what is already staged. Making the squash prompt read the index broke that parity for squash — its--dry-runshowed neither. It now mirrors--stagethe same way, with the flag plumbed through from the CLI. The task line in the default squash template moved with it: "the combined effect of these commits" pointed at the one block that doesn't carry the staged work, and now names<diff>as what the squash records and<commits>as what it folds in.The picker preview dropped a character. The pane rendered one column wider than skim paints, so a wrapped line breaking flush against the right edge lost its last character — "when" as "whe", mid-sentence, with nothing that reads as clipping. Reproduced outside VHS in a pyte PTY at 139 columns before the fix and again after;
PREVIEW_RESERVED_COLSdocuments where the column goes.VHS fork
Three commits on
max-sixty/vhskeypress-overlay, all pushed: passmacOptionIsMetasoAlt+<key>reaches the program at all rather than typing a bare letter into the query; time the keystroke overlay by recorded frames instead of the wall clock, which removed a 640ms lag and the fixed fudge that was hiding it; and record a modified key as one keystroke, soAlt+"8"draws a highlighted⌥8rather than a greyed⌥and an unrelated8._VHS_FORK_MARKERnames the newest of them, because a clone that predates one records a wrong GIF and reports nothing.Checks
All five affected recordings re-recorded and OCR-validated, and published to
worktrunk-assets. New tests:test_squash_prompt_covers_what_its_run_would_commitcovers both preview paths —--show-prompton the real index,--dry-runon the mirrored one.test_preview_width_stops_short_of_the_column_skim_leaves_unpaintedcovers 80/120/139/200.