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