feat: implement export and import commands

- Add export command with JSON file output and size summary
- Add import command with replace/merge strategies and dry-run preview
- Add integration test for export/import round-trip via storage layer
- Update project state documentation
This commit is contained in:
swanadiva
2026-06-23 13:58:51 +07:00
parent fbe444c3ab
commit 30b57f6084
4 changed files with 317 additions and 9 deletions
+17 -9
View File
@@ -2,7 +2,7 @@
> **Purpose**: Enable seamless continuation of development by any agent/LLM across sessions
>
> **Last Updated**: 2024-06-23 (Session 7)
> **Last Updated**: 2024-06-23 (Session 8)
> **Current Status**: Implementation In Progress - Tasks 1-8 Complete
> **Phase**: MVP Development (Phase 1)
@@ -33,10 +33,9 @@
**Bug Fix**: Fixed deadlock in JSON storage (RLock within Lock)
### What Needs to Happen Next
🔄 **Task 11**: Export/Import commands
🔄 Key management commands
🔄 Build and test core features
🔄 Prepare MVP release
🔄 **Task 12**: Build and Testing (Makefile, integration tests)
🔄 **Task 13**: Documentation (README, usage docs)
🔄 **Task 14**: Final testing and release prep
---
@@ -53,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** | 🟡 60% | add + list + connect + edit + delete commands done |
| **CLI Commands** | 🟡 70% | add + list + connect + edit + delete + export + import done |
| **TUI** | 🟡 40% | Basic TUI with host list navigation |
| **Testing** | 🟡 50% | Error + SSH + add + list + connect + edit + delete + TUI tests passing |
| **Testing** | 🟡 55% | Error + SSH + add + list + connect + edit + delete + TUI + export/import tests passing |
| **Documentation** | 🔲 0% | Usage guides and API docs |
### Overall Progress: **~70% Complete** (Tasks 1-10 done)
### Overall Progress: **~75% Complete** (Tasks 1-11 done)
---
@@ -169,7 +168,16 @@
- `pkg/tui/tui_test.go` — Tests for TUI initialization and host loading
- `cmd/hostkeeper/tui.go` — CLI `tui` command
#### 🔲 Task 11-14: Remaining Tasks
#### Task 11: Export/Import Commands
- **Status**: ✅ Completed
- **Priority**: HIGH
- **Deliverables**: Export/import hosts, keys, snippets for backup/transfer
- **Files Created**:
- `cmd/hostkeeper/export.go` — Export command with JSON format (default) and include-keys flag
- `cmd/hostkeeper/import.go` — Import command with replace/merge strategies and dry-run preview
- `test/storage/export_import_test.go` — Integration test for export/import round-trip
#### 🔲 Task 12-14: Remaining Tasks
- **Status**: Not Started
- **Details**: See `docs/plans/2024-06-22-hostkeeper-implementation.md`