tui-check
Validate a terminal UI change cell by cell (glyph, FG, BG) against its .ansi sketch, in tests and live in tmux. Use for TUI layout or colour checks.
Check a Terminal UI Change
Validate a TUI change against its .ansi sketch per cell: glyph, foreground, and background. Use this for layout or colour checks; it covers tests and a live tmux view.
Prerequisites
This workflow assumes loom and tmux are installed. Stop and report if command -v loom fails; do not switch tools. Locate the widget's .ansi sketch, when present, under docs/data/; see docs/TUIDesign.md §“.ansi visual mockups”.
1. Sketch first
Before implementation, inspect and validate the sketch:
loom eval docs/data/<Widget>.ansi
loom measure docs/data/<Widget>.ansi
loom check-box docs/data/<Widget>.ansi
Fix row geometry, display widths, and borders in the sketch before changing code.
2. Canvas tests per cell
Compare rendered output with the sketch at picks at the start, inside, and past every layout boundary. Assert glyph, FG, and BG for every relevant cell. Pin the colour environment (for example, LOOMCOLOR=truecolor in TestMain). Locate text by rune column or display width, never byte offset.
3. PTY tests
Exercise key paths through a real pseudo-terminal when terminal lifecycle or styled output matters. Cover Shift+arrow in PTY tests; tmux send-keys does not deliver those keys to the app. Use the full test tier for PTY coverage; see docs/TestTiers.md.
4. Live tmux check
The host runs a private socket and fixed terminal size. Use a wait helper, not sleep; timeout 0.8 tail -f /dev/null waits, while timeout 0.1 true does not. Capture rendered colours as text, compare the relevant cells against the sketch, and kill only the private socket you started.
tmux -L tNNN new-session -d -x 80 -y 24 '<app command>'
timeout 0.8 tail -f /dev/null
tmux -L tNNN capture-pane -pe | perl -pe 's/\e\[([0-9;]*)m/<$1>/g'
tmux -L tNNN kill-server
Never print raw ANSI escapes into the agent output; convert them to readable text first.
5. Goldens
Render the widget with loom widgets --show <Name> and save or update its diffable golden at docs/progress/<Widget>.ansi. Use the sketch-versus-capture cell diff when loom ticket 362 provides it.
loom widgets --show opens /dev/tty, so run it inside the private tmux session of step 4. A sketch can be an abbreviated schematic (fewer columns than the widget); then compare the live capture cell by cell with the golden, and the sketch only for structure.
6. Final visual check
Ask the user to inspect a screenshot for font-dependent glyph rendering, such as ▂ versus 🮂. Treat this as the final look check after cell tests and live comparison.
Pitfalls
- Green glyph assertions do not prove FG or BG are correct.
- Do not use byte offsets to locate terminal cells.
- Do not use
sleeportimeout 0.1 trueas a wait. - Follow
docs/Bash.mdanddocs/ProcessHygiene.mdforHTO=0and process cleanup.
- Content
- file-backed
- License:
- AGPL-3.0-or-later
- Origin
- first-party
- Source:
- docs/commands/tui-check.md
- Source revision
3cb914dfaf6c43cbbbc43868d6b47c2cc7516c22- Requires
- Targets
- codex, claude
- Invocation
- /tui-check
Related skills
- bug-hunt — Run a bug hunt over active P1/P2 bug tickets: re-verify each against live code, close obsolete ones, fix the rest the way forward. Only on explicit /bug-hunt or 'bug hunt'.
- decide — Session-scoped autonomy for the orchestrating agent: answer simple questions yourself, consult cheap or smart advisors, push ready work without asking, and stop only for very critical questions. Only on explicit /decide.
- docup — Review and update bounded repository documentation by category (testing, architecture)
- epic — Plan, refine and run epics with open-epic checks, affinity grouping, internal goal setting, and file/run/next modifiers. Only on explicit /epic or 'epic'.