|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Build & Run |
| 6 | + |
| 7 | +```bash |
| 8 | +go build -o sshto . # Build binary |
| 9 | +go run . # Run directly |
| 10 | +go mod tidy # Update dependencies |
| 11 | +``` |
| 12 | + |
| 13 | +## Architecture |
| 14 | + |
| 15 | +``` |
| 16 | +cmd/ # Cobra CLI commands (thin layer, orchestrates app) |
| 17 | +internal/ |
| 18 | + app/ # Application orchestration, dependency injection |
| 19 | + config/ # YAML config load/save, Server/Group models |
| 20 | + ssh/ # SSH command execution |
| 21 | + ui/ # Bubbletea TUI components (list, form, styles) |
| 22 | +``` |
| 23 | + |
| 24 | +**Flow**: `cmd` → `app.App` → `config.Config` + `ssh.Client` + `ui.*` |
| 25 | + |
| 26 | +## Key Patterns |
| 27 | + |
| 28 | +- **Config location**: `~/.config/sshto/config.yaml` |
| 29 | +- **Models**: `config.Server` and `config.Group` with YAML tags |
| 30 | +- **App struct**: Holds Config and SSHClient, resolves defaults/overrides |
| 31 | +- **TUI**: Bubbletea models in `internal/ui/` with Lipgloss styling |
| 32 | + |
| 33 | +## CLI Usage |
| 34 | + |
| 35 | +```bash |
| 36 | +sshto # Interactive fuzzy finder |
| 37 | +sshto <server> # Direct connect |
| 38 | +sshto <server> -u root # Connect with user override |
| 39 | +sshto list -g production # Filter by group |
| 40 | +sshto add # Interactive add form |
| 41 | +sshto edit <server> # Interactive edit form |
| 42 | +sshto remove <server> # Remove with confirmation |
| 43 | +sshto groups # List groups |
| 44 | +sshto groups add <name> # Add group |
| 45 | +``` |
| 46 | + |
| 47 | +## Config Schema |
| 48 | + |
| 49 | +```yaml |
| 50 | +groups: |
| 51 | + - name: production |
| 52 | + color: red # red, green, yellow, blue, magenta, cyan, white, gray |
| 53 | + |
| 54 | +servers: |
| 55 | + - name: web-prod |
| 56 | + host: 192.168.1.10 |
| 57 | + user: deploy |
| 58 | + port: 22 |
| 59 | + key: ~/.ssh/id_rsa |
| 60 | + group: production |
| 61 | + |
| 62 | +defaults: |
| 63 | + user: "" |
| 64 | + port: 22 |
| 65 | + key: "" |
| 66 | +``` |
0 commit comments