docs: rewrite TUI Layer — tab system, orange theme, multi-session SSH

This commit is contained in:
swanadiva
2026-06-23 14:47:30 +07:00
parent 9c1bbd4eac
commit e99a6ac347
+39 -14
View File
@@ -144,22 +144,47 @@ hostkeeper completion # Shell completion setup
### 2. TUI Layer (Interactive Interface) ### 2. TUI Layer (Interactive Interface)
**Framework:** Bubble Tea (recommended for modern, maintainable TUI) **Framework:** Bubble Tea (event-driven TUI) + Lipgloss (styling)
**Main Screens:** **Theme:** Orange/light color palette (`#FF6B00`, `#FF9F43`, `#FFB800`) — visually distinct from native terminal to signal the user is inside Hostkeeper
- **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
**TUI Features:** #### Tab System Architecture
- Event-driven architecture
- Responsive layout ```
- Keyboard navigation ┌─ Hosts ──── Server Nico ── SFTP ── Keys ── Settings ────────┐
- Mouse support (optional) │ │
- Quick actions (`/` search, `n` new, `Ctrl+S` SFTP, etc.) │ [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) |
--- ---