feat: implement connect host command with native SSH

- Add connect command with native SSH (default) and direct Go SSH (--direct) modes
- Support host lookup by name or ID
- Build SSH arguments for system SSH client
- Include timeout configuration flag
- Add comprehensive tests for command and SSH arg building
- Update project state documentation
This commit is contained in:
swanadiva
2026-06-23 13:48:05 +07:00
parent 4087c5fdc7
commit 368b7cdadb
3 changed files with 278 additions and 10 deletions
+22 -10
View File
@@ -2,7 +2,7 @@
> **Purpose**: Enable seamless continuation of development by any agent/LLM across sessions
>
> **Last Updated**: 2024-06-23 (Session 4)
> **Last Updated**: 2024-06-23 (Session 5)
> **Current Status**: Implementation In Progress - Tasks 1-8 Complete
> **Phase**: MVP Development (Phase 1)
@@ -33,7 +33,7 @@
**Bug Fix**: Fixed deadlock in JSON storage (RLock within Lock)
### What Needs to Happen Next
🔄 **Task 9+**: Connect command, edit/remove commands
🔄 **Task 10+**: Edit/remove commands, TUI implementation
🔄 Build and test core features
🔄 Prepare MVP release
@@ -52,12 +52,12 @@
| **Errors** | ✅ 100% | AppError + ConnectionError + SSH error handler |
| **SSH Client** | ✅ 100% | Password + key auth, Execute, Connect/Close |
| **CLI Framework** | ✅ 100% | Cobra root, version, completion commands |
| **CLI Commands** | 25% | add + list commands done; connect/edit/remove pending |
| **CLI Commands** | 🟡 40% | add + list + connect commands done; edit/remove pending |
| **TUI** | 🔲 0% | Terminal user interface |
| **Testing** | 🟡 40% | Error + SSH + add + list tests passing |
| **Testing** | 🟡 45% | Error + SSH + add + list + connect tests passing |
| **Documentation** | 🔲 0% | Usage guides and API docs |
### Overall Progress: **~55% Complete** (Tasks 1-8 done)
### Overall Progress: **~60% Complete** (Tasks 1-9 done)
---
@@ -134,7 +134,15 @@
- `cmd/hostkeeper/list.go` — list hosts with filter (group/tag), sort, table/JSON/wide output formats
- `cmd/hostkeeper/list_test.go` — tests for list command (filtering, formatting)
#### 🔲 Task 9-14: Remaining Tasks
#### Task 9: Connect Host Command
- **Status**: ✅ Completed
- **Priority**: CRITICAL
- **Deliverables**: Connect to saved SSH hosts via native SSH or Go SSH client
- **Files Created**:
- `cmd/hostkeeper/connect.go` — Connect command with native SSH (default) and direct Go SSH (--direct) modes
- `cmd/hostkeeper/connect_test.go` — Tests for command existence, flags, and SSH arg building
#### 🔲 Task 10-14: Remaining Tasks
- **Status**: Not Started
- **Details**: See `docs/plans/2024-06-22-hostkeeper-implementation.md`
@@ -143,7 +151,7 @@
## 🗺️ Development Roadmap
### Current Week Focus
**Target**: Complete Tasks 7+ (Core CLI Commands)
**Target**: Complete Tasks 9+ (Core CLI Commands)
### This Sprint
- [x] Project setup and dependencies
@@ -152,9 +160,12 @@
- [x] Error handling framework
- [x] SSH client implementation
- [x] CLI framework setup
- [x] Add host command
- [x] List hosts command
- [x] Connect host command
### Next Sprint
- [ ] CLI commands (add, list, connect)
- [ ] CLI commands (edit, remove)
- [ ] Basic TUI implementation
- [ ] Export/import functionality
@@ -348,7 +359,7 @@ go test ./... -watch
## 🎯 Success Criteria
### MVP Success Metrics
- ✅ Can establish SSH connections
- ✅ Can establish SSH connections (via native SSH)
- ✅ Can manage multiple hosts
- ✅ Can perform SFTP operations
- ✅ Can export/import credentials
@@ -516,7 +527,8 @@ cat go.mod
### Milestone Tracking
- [x] Milestone 1: Foundation (Tasks 1-6) - Week 1 ✅ COMPLETE
- [ ] Milestone 2: Core Features (Tasks 7-10) - Week 2-3
- [x] Task 7-9: Add, List, Connect commands ✅ COMPLETE
- [ ] Milestone 2: Core Features (Tasks 7-10) - Week 2-3 (80% complete)
- [ ] Milestone 3: Polish & Release (Tasks 11-14) - Week 4
---