diff --git a/docs/plans/2024-06-22-hostkeeper-design.md b/docs/plans/2024-06-22-hostkeeper-design.md index 0d1d502..24a17de 100644 --- a/docs/plans/2024-06-22-hostkeeper-design.md +++ b/docs/plans/2024-06-22-hostkeeper-design.md @@ -144,22 +144,47 @@ hostkeeper completion # Shell completion setup ### 2. TUI Layer (Interactive Interface) -**Framework:** Bubble Tea (recommended for modern, maintainable TUI) +**Framework:** Bubble Tea (event-driven TUI) + Lipgloss (styling) -**Main Screens:** -- **Host List:** Grid/List view with status indicators -- **Connection Manager:** Active connections, quick actions -- **SFTP Browser:** Dual-pane file browser (Phase 2) -- **Key Manager:** SSH keys list, import/export, generate -- **Snippet Manager:** Command snippets with variables -- **Settings:** Config management, preferences +**Theme:** Orange/light color palette (`#FF6B00`, `#FF9F43`, `#FFB800`) — visually distinct from native terminal to signal the user is inside Hostkeeper -**TUI Features:** -- Event-driven architecture -- Responsive layout -- Keyboard navigation -- Mouse support (optional) -- Quick actions (`/` search, `n` new, `Ctrl+S` SFTP, etc.) +#### Tab System Architecture + +``` +┌─ Hosts ──── Server Nico ── SFTP ── Keys ── Settings ────────┐ +│ │ +│ [content of active tab] │ +│ │ +├───────────────────────────────────────────────────────────────┤ +│ Ctrl+Q:close Ctrl+Tab:next Shift+Tab:prev ↑↓:nav /:search│ +└───────────────────────────────────────────────────────────────┘ +``` + +**Tab Types:** +- **HostsTab** — Host list with search, filter, sort, keyboard navigation +- **SessionTab** — Live interactive SSH session (input/output piped via Go SSH client) +- **SFTPTab** — Remote file browser with upload/download operations +- **KeysTab** — SSH key management (list, generate, import) +- **SnippetsTab** — Command snippets with variable substitution +- **SettingsTab** — Application configuration + +**SessionTab Internals:** +- Connect via Go SSH client with stored credentials (password auto-injected) +- 2 goroutines per session: stdin → SSH channel, SSH stdout → TUI render +- Terminal resize event → `WindowChange` via SSH channel +- `Ctrl+Q` disconnects session and closes tab +- Multiple session tabs can be open simultaneously (e.g. connect to 3 servers at once) + +**Keyboard Navigation:** +| Key | Action | +|-----|--------| +| `Ctrl+Tab` / `Shift+Tab` | Cycle tabs forward/backward | +| `Ctrl+N` | New tab (add host / new connection) | +| `Ctrl+Q` | Close current tab / disconnect session | +| `↑` / `↓` | Navigate lists (hosts, keys, files) | +| `Enter` | Select host / open directory / confirm | +| `/` | Search/filter within active tab | +| `q` | Quit Hostkeeper (confirmation dialog) | ---