feat: Implement SSH client with authentication support (Task 5)

- Add SSH client with Connect/Execute/Close/IsConnected
- Implement password, key, and both authentication methods
- Support default key discovery (~/.ssh/id_ed25519, id_rsa, etc.)
- Support passphrase-protected keys via ParsePrivateKeyWithPassphrase
- Path expansion for ~ in KeyID
- Integrate with HandleSSHError for user-friendly errors
- All 4 SSH tests passing + 5 error tests still passing (9 total)

Progress: Tasks 1-5 complete (~40%)
This commit is contained in:
swanadiva
2026-06-22 16:16:16 +07:00
parent 6fd25e4d02
commit 8ea4b6e990
4 changed files with 367 additions and 12 deletions
+12 -12
View File
@@ -3,7 +3,7 @@
> **Purpose**: Enable seamless continuation of development by any agent/LLM across sessions
>
> **Last Updated**: 2024-06-22 (Session 2)
> **Current Status**: Implementation In Progress - Tasks 1-4 Complete
> **Current Status**: Implementation In Progress - Tasks 1-5 Complete
> **Phase**: MVP Development (Phase 1)
---
@@ -26,9 +26,9 @@
**Task 2**: Core data models (`internal/models/models.go`) + JSON storage (`pkg/storage/`)
**Task 3**: Configuration management (`pkg/config/config.go`)
**Task 4**: Error handling framework (`internal/errors/`) + tests passing
**Task 5**: SSH client (`pkg/ssh/`) + tests passing
### What Needs to Happen Next
🔄 **Task 5**: SSH Client Implementation (`pkg/ssh/`)
🔄 **Task 6**: CLI Framework Setup (Cobra commands in `cmd/hostkeeper/`)
🔄 Build and test core features
🔄 Prepare MVP release
@@ -46,13 +46,13 @@
| **Core Models** | ✅ 100% | Host, KeyPair, Snippet, AppConfig models + JSON storage |
| **Config** | ✅ 100% | Cross-platform config management |
| **Errors** | ✅ 100% | AppError + ConnectionError + SSH error handler |
| **SSH Client** | 🔲 0% | Connection and authentication |
| **SSH Client** | ✅ 100% | Password + key auth, Execute, Connect/Close |
| **CLI Commands** | 🔲 0% | User interface commands |
| **TUI** | 🔲 0% | Terminal user interface |
| **Testing** | 🔲 0% | Test suite and integration |
| **Documentation** | 🔲 0% | Usage guides and API docs |
### Overall Progress: **~30% Complete** (Tasks 1-4 done)
### Overall Progress: **~40% Complete** (Tasks 1-5 done)
---
@@ -94,14 +94,14 @@
- `internal/errors/connection_errors.go` — ConnectionError, HandleSSHError, FormatConnectionError
- `test/errors_test.go` — 5 test functions, all passing
#### 🔲 Task 5: SSH Client Implementation
- **Status**: Not Started
#### Task 5: SSH Client Implementation
- **Status**: ✅ Completed (all tests passing)
- **Priority**: CRITICAL
- **Estimated Time**: 3-4 hours
- **Dependencies**: Task 4 complete
- **Deliverables**: SSH connection client
- **Files to Create**:
- `pkg/ssh/*.go`
- **Deliverables**: SSH connection client with auth
- **Files Created**:
- `pkg/ssh/client.go` — Client struct, Connect, Execute, Close, IsConnected
- `pkg/ssh/auth.go` — Password/key/both auth, default key discovery
- `test/ssh/ssh_test.go` — 4 test functions, all passing
#### 🔲 Task 6: CLI Framework Setup
- **Status**: Not Started
@@ -128,7 +128,7 @@
- [x] Core data models and storage
- [x] Configuration management
- [x] Error handling framework
- [ ] SSH client implementation
- [x] SSH client implementation
- [ ] CLI framework setup
### Next Sprint