feat(tui): replace custom ratatui TUI with tmux's native UI#26
Merged
Conversation
Move line cooks from one tmux session per ticket to one shared `yeschef` session with one window per ticket; `yeschef tui` collapses to `tmux attach`. tmux's status line becomes the brigade tab bar — one colour-coded tab per cook, driven by a per-window `@status` user option that a `window-status-format` renders live (no polling, no custom render code). The head chef is window 0 (prefix+0); detach is stock prefix+d. Backend (TmuxBackend) now maps a ticket "window" onto a real tmux window (`yeschef:<window>`): ensure_session creates the session with the head chef at window 0 and is idempotent, new_window/kill_window/list_windows drive real windows, and a new set_window_status pushes @status on every `ticket ... status-set`. Deletes src/commands/tui.rs (the ratatui/vt100 event loop, PseudoTerminal, head-chef pinning, unit tests) and the ratatui/vt100/tui-term deps, plus the styled-capture and bare-head-chef-session backend methods that existed only for the old custom pane. e2e tests are rewritten to the windows-in-session model. Verified: cargo fmt/clippy/test + the --ignored e2e suite + `nix flake check` all pass; manually spawned fake cooks on a throwaway socket, attached, and confirmed the coloured tab bar, window switching, prefix+0, a live status flip (grey -> red), and a clean detach (demo in docs/tui-demo.gif).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the spike recommendation (PR #23, branch
spike-tui— the decision was already made): drop the custom ratatui/vt100 TUI and adopt tmux's native UI. Line cooks move from one tmux session per ticket to one sharedyeschefsession with one window per ticket, andyeschef tuicollapses totmux attach.What changed
Session/window model — the windows are now real. The whole brigade lives in one
yescheftmux session: the head chef at window 0 and one real tmux window per cook, addressed asyeschef:<window>. That's what letstmux attachrender every cook as a native tab.The tmux status line is the TUI.
tmux.confships awindow-status-formatthat renders each tab from a per-window@statususer option — a glyph + colour, re-rendered live by tmux with no polling and no custom render code:CHEF ★magenta ·IN_PROGRESS ●yellow ·DONE ✓green ·BLOCKED ■red ·NEW ○grey.A new backend method
set_window_statuspushes@statuson everyticket … status-set, right next to the existing SQLite write, so an attached tab bar recolours the instant a cook reports. The window name stays the stable ticket id (the send/peek/kill target); status decoration lives only in@status, so they never collide.The 3 requirements the TUI must satisfy, all now stock tmux:
prefix+n/p/<n>,prefix+wtree.prefix+0(plus aprefix+calias).@status.Detach is stock
prefix+d.Backend delta (
TmuxBackend)ensure_sessionnew-session -d -s yeschef -n headchef …(head chef = window 0, idempotent)new_windownew-session -d -s yeschef-<w>new-window -t yeschef: -n <w>send_keys/capture_pane-t yeschef-<w>-t yeschef:<w>list_windowslist-windows -t yeschef(realactive/dead)kill_windowkill-sessionkill-window -t yeschef:<w>attachattach -t yeschef-<w>attach -t yeschef(select window if given)set_window_statusset-window-option -t yeschef:<w> @status <STATUS>Deleted
src/commands/tui.rs— the entire custom TUI (ratatui event loop, vt100render_pane,PseudoTerminal, head-chef pinning, its unit tests).run_tuiis now ~3 lines inorchestrate.rs.ratatui,vt100,tui-term(and transitivecrossterm);Cargo.lockupdated.capture_pane_styled,capture_raw_styled, the sharedcapture_styledhelper, and the bare head-chef-session machinery (ensure_raw_session,attach_raw,names::headchef_session).docs/tui-v2-demo.tape(custom-TUI demo);docs/tui-demo.taperewritten for the native UI.Net: −~960 lines + 3 crates, +~40 lines of tmux config + one backend method.
How I verified
cargo fmt --check,cargo clippy -D warnings -D clippy::pedantic,cargo test --bin yeschef(52 unit tests), the--ignorede2e suite (17 tests, rewritten to the windows-in-session model on a throwaway socket), andnix flake check— all green.YESCHEF_TMUX_SOCKET: spawned 3 fake cooks, set distinct statuses, and confirmed oneyeschefsession with head chef window 0 (@status=CHEF) + 3 cook windows carrying the right@status.docs/tui-demo.gif(VHS, embedded above): the coloured tab bar, switching cooks (prefix+n), jumping to the head chef (prefix+0), a live status flip (db-migrategrey ○ → red ■ while attached), and a cleanprefix+ddetach.Notes
kill-windowis per-cook. Confirmed acceptable in the spike.</>);prefix+wis the escape hatch — noted inAGENTS.md.origin/main(includes the e2e socket-isolation fix, PR fix(tmux): isolate e2e tests on a throwaway socket, never the liveyeschefserver #24); no rebase needed.