feat: add & list commands with deadlock fix
- Add 'add' command: register hosts via flags or interactive prompts Supports password/key/both auth, groups, tags, notes, port override - Add 'list' command: display hosts with filtering and formatting Supports --group, --tag filters, --sort, table/json/wide output - Fix deadlock bug in JSON storage (RLock within Lock) Introduced internal list functions that don't lock Affects: ListHosts/GetHost/SaveHost/DeleteHost + KeyPair + Snippet - Add comprehensive tests for add and list commands - Update PROJECT_STATE.md (Tasks 1-8 complete, ~55% done)
This commit is contained in:
+26
-7
@@ -2,8 +2,8 @@
|
||||
|
||||
> **Purpose**: Enable seamless continuation of development by any agent/LLM across sessions
|
||||
>
|
||||
> **Last Updated**: 2024-06-22 (Session 3)
|
||||
> **Current Status**: Implementation In Progress - Tasks 1-6 Complete
|
||||
> **Last Updated**: 2024-06-23 (Session 4)
|
||||
> **Current Status**: Implementation In Progress - Tasks 1-8 Complete
|
||||
> **Phase**: MVP Development (Phase 1)
|
||||
|
||||
---
|
||||
@@ -28,9 +28,12 @@
|
||||
✅ **Task 4**: Error handling framework (`internal/errors/`) + tests passing
|
||||
✅ **Task 5**: SSH client (`pkg/ssh/`) + tests passing
|
||||
✅ **Task 6**: CLI Framework Setup - Cobra root, version, completion (`cmd/hostkeeper/`)
|
||||
✅ **Task 7**: Add command (`cmd/hostkeeper/add.go`) - add hosts with flags/interactive + tests
|
||||
✅ **Task 8**: List command (`cmd/hostkeeper/list.go`) - list/filter/sort hosts + tests
|
||||
✅ **Bug Fix**: Fixed deadlock in JSON storage (RLock within Lock)
|
||||
|
||||
### What Needs to Happen Next
|
||||
🔄 **Task 7+**: CLI commands (add, list, connect, etc.)
|
||||
🔄 **Task 9+**: Connect command, edit/remove commands
|
||||
🔄 Build and test core features
|
||||
🔄 Prepare MVP release
|
||||
|
||||
@@ -49,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** | 🔲 0% | add, list, connect subcommands |
|
||||
| **CLI Commands** | � 25% | add + list commands done; connect/edit/remove pending |
|
||||
| **TUI** | 🔲 0% | Terminal user interface |
|
||||
| **Testing** | 🟡 30% | Error + SSH tests passing |
|
||||
| **Testing** | 🟡 40% | Error + SSH + add + list tests passing |
|
||||
| **Documentation** | 🔲 0% | Usage guides and API docs |
|
||||
|
||||
### Overall Progress: **~45% Complete** (Tasks 1-6 done)
|
||||
### Overall Progress: **~55% Complete** (Tasks 1-8 done)
|
||||
|
||||
---
|
||||
|
||||
@@ -115,7 +118,23 @@
|
||||
- `cmd/hostkeeper/completion.go` — Shell completion (bash/zsh/fish/powershell)
|
||||
- Includes `version` subcommand and `-v/--verbose`, `--debug` flags
|
||||
|
||||
#### 🔲 Task 7-14: Remaining Tasks
|
||||
#### ✅ Task 7: Add Command
|
||||
- **Status**: ✅ Completed (all tests passing)
|
||||
- **Priority**: CRITICAL
|
||||
- **Deliverables**: `add` command for registering hosts
|
||||
- **Files Created**:
|
||||
- `cmd/hostkeeper/add.go` — add host with flags/interactive, password/key auth, groups, tags, notes
|
||||
- `cmd/hostkeeper/add_test.go` — tests for add command (flag parsing, storage integration)
|
||||
|
||||
#### ✅ Task 8: List Command
|
||||
- **Status**: ✅ Completed (all tests passing)
|
||||
- **Priority**: CRITICAL
|
||||
- **Deliverables**: `list` command for displaying hosts
|
||||
- **Files Created**:
|
||||
- `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
|
||||
- **Status**: Not Started
|
||||
- **Details**: See `docs/plans/2024-06-22-hostkeeper-implementation.md`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user