feat: Implement error handling framework (Task 4)

- Add AppError with error codes and hints system
- Implement ConnectionError for SSH-specific errors
- Add HandleSSHError for intelligent SSH error parsing
- Add FormatConnectionError for user-friendly output
- All 5 test functions passing (TestAppError, TestConnectionError,
  TestHandleSSHError, TestHandleSSHErrorNil, TestFormatConnectionError)
- Update PROJECT_STATE.md to reflect Task 4 completion

Progress: Tasks 1-4 complete (~30%)
This commit is contained in:
swanadiva
2026-06-22 16:12:28 +07:00
parent 33947816b7
commit 6fd25e4d02
4 changed files with 306 additions and 10 deletions
+11 -10
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-3 Complete
> **Current Status**: Implementation In Progress - Tasks 1-4 Complete
> **Phase**: MVP Development (Phase 1)
---
@@ -25,9 +25,9 @@
**Task 1**: Project setup (go.mod, Makefile, .gitignore, main.go)
**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
### What Needs to Happen Next
🔄 **Task 4**: Error Handling Framework (`internal/errors/`)
🔄 **Task 5**: SSH Client Implementation (`pkg/ssh/`)
🔄 **Task 6**: CLI Framework Setup (Cobra commands in `cmd/hostkeeper/`)
🔄 Build and test core features
@@ -45,13 +45,14 @@
| **Setup** | ✅ 100% | go.mod, Makefile, .gitignore, main.go |
| **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 |
| **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: **~25% Complete** (Tasks 1-3 done)
### Overall Progress: **~30% Complete** (Tasks 1-4 done)
---
@@ -84,14 +85,14 @@
- **Files Created**:
- `pkg/config/config.go` — Config struct, OS-aware paths (macOS/Linux/Windows), auto-create defaults
#### 🔲 Task 4: Error Handling Framework
- **Status**: Not Started
#### Task 4: Error Handling Framework
- **Status**: ✅ Completed (all tests passing)
- **Priority**: HIGH
- **Estimated Time**: 1-2 hours
- **Dependencies**: Task 2 complete
- **Deliverables**: Error types, SSH error handler
- **Files to Create**:
- `internal/errors/*.go`
- **Files Created**:
- `internal/errors/errors.go` — AppError type with codes, Unwrap support
- `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
@@ -126,7 +127,7 @@
- [x] Project setup and dependencies
- [x] Core data models and storage
- [x] Configuration management
- [ ] Error handling framework
- [x] Error handling framework
- [ ] SSH client implementation
- [ ] CLI framework setup