Skip to content

refactor: simplify to thin picker architecture#13

Merged
alextnetto merged 1 commit intomainfrom
feat/simplify-architecture
Mar 17, 2026
Merged

refactor: simplify to thin picker architecture#13
alextnetto merged 1 commit intomainfrom
feat/simplify-architecture

Conversation

@alextnetto
Copy link
Member

Summary

Complete rewrite from persistent TUI to thin picker.

Before

TUI stays open → runs async tmux commands → refreshes → handles errors inline
→ Complex state machine, mock objects, input bugs in tmux popup

After

Fetch sessions → show picker → user picks action → TUI exits → run tmux command
→ ~300 lines total, zero input handling bugs

Removed (-1,983 lines)

  • internal/setup/ — auto-setup prompt, --setup flag
  • tmux.Client interface, MockClient, integration tests
  • Async command pattern (sessionsMsg, operationMsg)
  • SetupFunc injection

Added (+388 lines)

  • tui.Action struct — TUI returns intent, caller executes
  • Package-level tmux.* functions — no interface indirection
  • 21 focused tests (was 60+, now testing only what matters)

Architecture

main.go:
  sessions := tmux.ListSessions()    // 1. fetch
  model := tui.New(sessions)          // 2. show picker
  action := model.Action()            // 3. get user intent
  execute(action)                     // 4. run tmux command

The TUI is now just a session picker. It collects user intent
and exits. All tmux commands run AFTER the TUI closes.

Before: persistent TUI → async tmux operations → refresh loop
After:  fetch sessions → show picker → exit → run tmux command

Removed:
- setup package (--setup flag, auto-prompt)
- tmux.Client interface and mock
- Async command pattern (sessionsMsg, operationMsg)
- 40+ tests replaced with 21 focused ones

Added:
- Action struct: TUI returns what to do, caller executes
- Package-level tmux functions (no interface indirection)
- Clean separation: TUI knows nothing about tmux execution

The result: ~300 lines of Go total, zero input handling bugs.
@alextnetto alextnetto merged commit f0244e4 into main Mar 17, 2026
6 checks passed
@alextnetto alextnetto deleted the feat/simplify-architecture branch March 17, 2026 14:51
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.

1 participant