Skip to content

TUI polish: alternate screen, safe actions, detail panel, log viewer#17

Merged
chanakyav merged 1 commit intomainfrom
tui-polish
Mar 16, 2026
Merged

TUI polish: alternate screen, safe actions, detail panel, log viewer#17
chanakyav merged 1 commit intomainfrom
tui-polish

Conversation

@chanakyav
Copy link
Copy Markdown
Owner

Summary

Major TUI polish: alternate screen buffer, safe actions, detail panel, built-in log viewer. Closes #11.

Alternate Screen Buffer

  • Uses ESC[?1049h / ESC[?1049l to isolate the TUI from terminal scrollback history
  • Previous renders are no longer visible when scrolling up — the dashboard is a clean, stable screen
  • Cursor hidden during TUI, always restored in a finally block

HEAVY Borders + Row Padding

  • Switched from ROUNDED to HEAVY box style — thick borders that pop on dark terminals
  • Added vertical padding between rows for visual breathing room
  • Session count shown in title: "Sessions (3)"

Safe Action Handlers

Every keybinding action catches errors and shows a temporary status message instead of crashing:

  • Enter on a dead session → "Session not running — task is COMPLETE"
  • x on a completed task → "Already complete"
  • tmux not available → "tmux not available"
  • os.execvp completely removed — all tmux operations use subprocess.run
  • Status messages auto-clear after 3 seconds

Detail Panel (d / Space)

Split-pane preview showing task metadata + log tail:

  • Branch, state, PR, iteration, elapsed time
  • Last 8 lines from orchestrator.log (live tail)
  • Table switches to compact mode when panel is open
  • Press d again or Esc to close

Log Viewer (l)

Full-screen scrollable log viewer:

  • j/k to scroll, G to jump to end, g to jump to top
  • Auto-refreshes log content on timeout (catches new lines from active tasks)
  • Position indicator: "Line 45-80 of 120"
  • q/Esc returns to session list

Dynamic Footer

Changes based on current view mode:

  • Main: j/k navigate Enter attach x stop l logs d detail r refresh q quit
  • Detail: j/k navigate d close detail l full logs q quit
  • Logs: j/k scroll G end g top q back

Tests

  • 39 new tests in test_dashboard.py covering:
    • Spinner animation cycling for all working/waiting states
    • Table building with selection, compact mode, long branch truncation
    • Detail panel rendering with/without PR
    • Log tail reading from disk
    • All footer builders
    • Status message rendering
    • Key reading with deterministic pipe-based input simulation (all 14 key bindings)
  • 136 tests total, all passing, ruff clean

Docs Updated

  • README: Full keybinding tables for session list view and log viewer
  • copilot-instructions: Added TUI safety conventions (no execvp, alternate screen, finally blocks)

- Alternate screen buffer — eliminates scrollback bleed completely
  Uses ESC[?1049h/l to isolate TUI from terminal history.
  Hidden cursor during TUI, restored on exit in a finally block.

- HEAVY borders + row padding for breathing room
  Switched from ROUNDED to HEAVY box style (thick borders).
  Added vertical padding between rows.
  Session count shown in title: "Sessions (3)"

- Safe action handlers — no action crashes out of the TUI
  Enter on dead session: "Session not running" status message
  x on completed task: "Already completed" status message
  Removed os.execvp entirely — all tmux ops use subprocess.run
  Status messages auto-clear after 3 seconds

- Detail panel (d / Space) — split-pane task preview
  Shows task metadata: branch, state, PR, iteration, elapsed
  Tails last 8 lines of orchestrator log
  Table switches to compact mode when panel is open
  Press d again or Esc to close

- Log viewer (l) — full-screen scrollable log view
  j/k scroll, G jump to end, g jump to top
  Auto-refreshes log on timeout (catches new lines)
  Line position indicator: "Line 45-80 of 120"
  q/Esc returns to session list

- Dynamic footer — changes based on current view mode

- New key bindings: l (logs), d/Space (detail), G (end), g (top)

- 39 new tests in test_dashboard.py (136 total, all passing)

- Updated README with full keybinding tables for all views
- Updated copilot-instructions with TUI safety conventions

Closes #11
@chanakyav chanakyav merged commit fd047d7 into main Mar 16, 2026
3 checks passed
@chanakyav chanakyav deleted the tui-polish branch March 16, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interactive TUI dashboard with keybindings

1 participant