fix(cli): Remove unwanted and unimplemented clear-cache

This commit is contained in:
2025-12-06 18:07:39 +01:00
parent 758a16bd73
commit 7034799926
7 changed files with 85 additions and 42 deletions

View File

@@ -4,6 +4,14 @@
This document outlines a phased plan to refactor the `banks2ff` CLI from a tightly coupled, single-purpose sync tool into a modular, multi-source financial synchronization application. The refactor maintains the existing hexagonal architecture while enabling inspection of accounts, transactions, and sync status, support for multiple data sources (GoCardless, CSV, CAMT.053, MT940), and preparation for web API exposure.
## Current Status Summary
- **Completed Phases**: 1, 2, 3, 4, 4.5, 9.5 (6/10 phases complete)
- **Partially Complete**: Phase 5 (Status/Cache Management - 50% done)
- **Remaining Phases**: 6, 7, 8, 10 (4 phases pending)
- **Core Functionality**: CLI structure, account linking, transaction inspection all working
- **Next Priority**: Fix cache-status to scan disk for all transaction caches
## Goals
- **Decouple CLI Architecture**: Separate CLI logic from core business logic to enable multiple entry points (CLI, web API)
@@ -42,6 +50,8 @@ COMMANDS:
**Objective**: Establish new subcommand architecture while preserving existing sync functionality.
**Completion Date**: Early implementation
**Steps:**
1. ✅ Refactor `main.rs` to use `clap::Subcommand` with nested enums for commands and subcommands
2. ✅ Extract environment loading and client initialization into a `cli::setup` module
@@ -142,7 +152,7 @@ COMMANDS:
4. ✅ Ensure sensitive data masking in all outputs
5. Add progress indicators for long-running operations (pending)
6. ✅ Implement `accounts` command with `list` and `status` subcommands
7. ✅ Implement `transactions` command with `list`, `cache-status`, and `clear-cache` subcommands
7. ✅ Implement `transactions` command with `list` and `cache-status` subcommands
8. ✅ Add account and transaction inspection methods to adapter traits
### Phase 4.5: Enhanced Transaction List UX ✅ COMPLETED
@@ -182,15 +192,20 @@ COMMANDS:
- Added `print_list_output` function for displaying collections of data
- All code formatted with `cargo fmt` and linted with `cargo clippy`
### Phase 5: Status and Cache Management
### Phase 5: Status and Cache Management 🔄 PARTIALLY COMPLETED
**Objective**: Implement status overview and cache management commands.
**Objective**: Implement status overview and cache inspection commands.
**Steps:**
1. Implement `status` command aggregating data from all adapters
2. Add cache inspection and clearing functionality to `transactions cache-status` and `transactions clear-cache`
3. Create status models for sync health metrics
4. Integrate with existing debug logging infrastructure
1. Implement `accounts status` command aggregating account data from adapters
2. Add cache inspection functionality to `transactions cache-status` (shows in-memory caches only)
3. ❌ Fix `transactions cache-status` to scan disk for all transaction caches (currently missing disk-based caches)
4. ❌ Create status models for sync health metrics
5. ❌ Integrate with existing debug logging infrastructure
**Current Status:**
- `accounts status` works and shows account sync status
- `transactions cache-status` exists but only shows in-memory caches; needs disk scanning to be useful
**Testing:**
- Unit tests for status aggregation logic
@@ -313,10 +328,17 @@ COMMANDS:
## Success Criteria
- All existing sync functionality preserved
- New commands work with all supported sources/destinations
- Core logic remains adapter-agnostic
- Comprehensive test coverage maintained
- Performance meets or exceeds current benchmarks
- Architecture supports future web API development</content>
- All existing sync functionality preserved
- New commands work with all supported sources/destinations
- Core logic remains adapter-agnostic
- Comprehensive test coverage maintained
- Performance meets or exceeds current benchmarks
- Architecture supports future web API development
## Completion Notes
- **Phase 5 Fix Required**: Update `GoCardlessAdapter::get_cache_info()` to scan cache directory and load all transaction caches from disk (similar to `get_transaction_info()` fix)
- **Remove Cache Clearing**: ✅ COMPLETED - Removed `transactions clear-cache` command from CLI as it's not useful
- **Status Metrics**: Consider adding sync health metrics beyond account status
- **Multi-Source Ready**: Architecture supports adding CSV, CAMT.053, MT940 adapters when needed</content>
<parameter name="filePath">specs/cli-refactor-plan.md