chore: update plan with implemented changes

Co-authored-by: aider (openai/andrew/openrouter/google/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-25 00:05:35 -03:00
parent 7a5bcf2722
commit 89fa9bee6f

64
PLAN.md
View File

@@ -1,19 +1,19 @@
# Refactoring Plan to Reduce Code Duplication
## Implementation Order:
1. Create core module structure and error types
2. Create common data structures
3. Update database layer for batch operations
4. Create core services with clear boundaries (synchronous)
5. Add async wrappers for API use
6. Refactor CLI modes to use services
7. Refactor REST API to use async services
8. Refactor MCP tools to use services
9. Create unified error handling
10. Add integration tests
11. Add performance optimization guidelines
- [x] 1. Create core module structure and error types
- [x] 2. Create common data structures
- [x] 3. Update database layer for batch operations
- [x] 4. Create core services with clear boundaries (synchronous)
- [ ] 5. Add async wrappers for API use
- [ ] 6. Refactor CLI modes to use services (partially done)
- [ ] 7. Refactor REST API to use async services
- [ ] 8. Refactor MCP tools to use services
- [x] 9. Create unified error handling
- [ ] 10. Add integration tests
- [ ] 11. Add performance optimization guidelines (partially done)
## 1. Create Core Module Structure and Error Types
## 1. Create Core Module Structure and Error Types (DONE)
**Files:**
- Add: `src/core/error.rs`
- Add: `src/core/mod.rs`
@@ -28,7 +28,7 @@
- Use `#[derive(thiserror::Error)]` for easy `Display` and `Error` implementations
- Provide user-friendly error messages with error codes
## 2. Create Common Data Structures
## 2. Create Common Data Structures (DONE)
**Files:**
- Add: `src/core/types.rs`
@@ -46,7 +46,7 @@
- Add serialization/deserialization support for JSON/YAML
- Ensure all fields are properly documented
## 3. Update Database Layer for Batch Operations
## 3. Update Database Layer for Batch Operations (DONE)
**Files:**
- Change: `src/db.rs`
@@ -64,7 +64,7 @@
- Add transaction support for atomic operations
- Optimize queries for common access patterns
## 4. Create Core Service Layer with Clear Boundaries
## 4. Create Core Service Layer with Clear Boundaries (DONE)
**Files:**
- Add: `src/core/item_service.rs`
- Add: `src/core/compression_service.rs`
@@ -107,24 +107,24 @@
- Provide examples for safe async/sync boundaries
- Use `tokio::task::spawn_blocking` for CPU-bound or blocking I/O operations
## 6. Refactor CLI Modes to Use Services
## 6. Refactor CLI Modes to Use Services (PARTIALLY DONE)
**Files:**
- Change: `src/modes/get.rs`
- Change: `src/modes/save.rs`
- Change: `src/modes/list.rs`
- Change: `src/modes/info.rs`
- Change: `src/modes/delete.rs`
- Change: `src/modes/diff.rs`
- Change: `src/modes/status.rs`
- Change: `src/modes/get.rs` (DONE)
- Change: `src/modes/save.rs` (DONE)
- Change: `src/modes/list.rs` (DONE)
- Change: `src/modes/info.rs` (DONE)
- Change: `src/modes/delete.rs` (DONE)
- Change: `src/modes/diff.rs` (NOT DONE)
- Change: `src/modes/status.rs` (DONE, uses shared function)
**Functions:**
- Change: `mode_get` to use `item_service::get_item_full`
- Change: `mode_save` to use `item_service::save_item`
- Change: `mode_list` to use `item_service::list_items`
- Change: `mode_info` to use `item_service::get_item_full`
- Change: `mode_delete` to use `item_service::delete_item`
- Change: `mode_diff` to use `item_service::get_item_full` for both items
- Change: `mode_status` to use new status service functions
- Change: `mode_get` to use `item_service` (DONE)
- Change: `mode_save` to use `item_service` (DONE)
- Change: `mode_list` to use `item_service` (DONE)
- Change: `mode_info` to use `item_service` (DONE)
- Change: `mode_delete` to use `item_service` (DONE)
- Change: `mode_diff` to use `item_service` (NOT DONE)
- Change: `mode_status` to use new status service functions (DONE, uses shared function)
**Reason:** Remove direct database and file system access from modes
**Implementation:**
@@ -173,7 +173,7 @@
- Use synchronous services directly (MCP is typically local/short-lived)
- Standardize response format to match API/CLI
## 9. Create Unified Error Handling
## 9. Create Unified Error Handling (DONE)
**Files:**
- Change: All files that handle errors
@@ -217,7 +217,7 @@
- Use in-memory databases and tempfiles for isolation
- Test both sync and async service implementations
## 11. Performance Optimization Guidelines
## 11. Performance Optimization Guidelines (PARTIALLY DONE)
**Files:**
- Change: All core service files
- Change: All mode files