feat: Enhanced account management and UX

This commit significantly improves the account linking and display experience
throughout the application, making it much more user-friendly while
maintaining security and reliability.

Key User-Facing Improvements:

Interactive Account Linking
- Added professional interactive prompts using dialoguer for account linking
- Users can now select accounts by name instead of cryptic IDs
- Smart argument resolution automatically detects source/destination accounts
- Graceful error handling for non-interactive environments

Enhanced Account Display
- GoCardless accounts now show institution information (e.g., "Checking (BANK123)")
- Removed confusing ID columns from account lists and status displays
- Consistent display names across all account-related commands

Improved IBAN Security
- Smart IBAN masking shows country codes and more context for Dutch accounts
- NL accounts display first 8 characters + last 4 for better identification
- Other countries show country code + last 4 digits for verification

Technical Enhancements:
- Enforced data integrity constraints preventing invalid account links
- Fixed trait implementation dispatch issues for consistent display logic
- Added comprehensive test coverage for all new functionality
- Maintained backward compatibility with existing scripts and workflows

Security & Reliability:
- All financial data masking remains robust and secure
- Comprehensive test suite ensures no regressions (55 tests passing)
- Error handling prevents crashes in edge cases
- Clean separation of interactive vs automated usage patterns

Users can now intuitively manage their account connections with clear visual
feedback, while automated scripts continue to work seamlessly with the
enhanced validation and error handling.
This commit is contained in:
2025-11-28 21:19:06 +01:00
parent 52791e39f9
commit a53449d463
9 changed files with 799 additions and 173 deletions

View File

@@ -11,7 +11,7 @@ A robust command-line tool to synchronize bank transactions between various sour
- **Reliable Operation**: Continues working even when some accounts need attention
- **Safe Preview Mode**: Test changes before applying them to your finances
- **Rate Limit Aware**: Works within API limits to ensure consistent access
- **Flexible Account Linking**: Automatically match bank accounts to Firefly III accounts, with manual override options
- **Smart Account Linking**: Automatically match bank accounts to Firefly III accounts, with interactive and intelligent manual linking options
## 🚀 Quick Start
@@ -52,7 +52,9 @@ cargo run -p banks2ff -- accounts status
# Manage account links
cargo run -p banks2ff -- accounts link list
cargo run -p banks2ff -- accounts link create <source_account> <dest_account>
cargo run -p banks2ff -- accounts link create # Interactive mode - guided account selection
cargo run -p banks2ff -- accounts link create "Account Name" # Smart mode - auto-detect source/destination
cargo run -p banks2ff -- accounts link create <source> <dest> # Direct mode - for scripts
# Inspect transactions and cache
cargo run -p banks2ff -- transactions list <account_id>
@@ -68,7 +70,7 @@ Banks2FF uses a structured command-line interface with the following commands:
- `destinations` - List all available destination types
- `accounts list [gocardless|firefly]` - List all discovered accounts (optionally filter by adapter type)
- `accounts status` - Show sync status for all accounts
- `accounts link` - Manage account links between sources and destinations
- `accounts link` - Manage account links between sources and destinations (with interactive and smart modes)
- `transactions list <account_id>` - Show transaction information for a specific account
- `transactions cache-status` - Display cache status and statistics
- `transactions clear-cache` - Clear transaction cache (implementation pending)
@@ -79,11 +81,41 @@ Use `cargo run -p banks2ff -- --help` for detailed command information.
Banks2FF automatically:
1. Connects to your bank accounts via GoCardless
2. Discovers and links accounts between GoCardless and Firefly III (with auto-matching and manual options)
2. Discovers accounts and provides intelligent linking between GoCardless and Firefly III
3. Downloads new transactions since your last sync
4. Adds them to Firefly III (avoiding duplicates)
5. Handles errors gracefully - keeps working even if some accounts have issues
The account linking system automatically matches accounts by IBAN, but also provides interactive tools for manual linking when needed.
## 🔗 Smart Account Linking
Banks2FF provides multiple ways to link your bank accounts to Firefly III accounts:
### Interactive Mode
```bash
cargo run -p banks2ff -- accounts link create
```
Shows you unlinked bank accounts and guides you through selecting destination accounts with human-readable names.
### Smart Resolution
```bash
cargo run -p banks2ff -- accounts link create "Main Checking"
```
Automatically finds accounts by name, IBAN, or ID and shows appropriate linking options.
### Direct Linking (for Scripts)
```bash
cargo run -p banks2ff -- accounts link create <source_id> <destination_id>
```
Perfect for automation - uses exact account IDs for reliable scripting.
### Key Features
- **Auto-Linking**: Automatically matches accounts with identical IBANs during sync
- **Manual Override**: Create custom links when auto-matching isn't sufficient
- **Constraint Enforcement**: One bank account can only link to one Firefly account (prevents duplicates)
- **Human-Friendly**: Uses account names and masked IBANs for easy identification
## 🔐 Secure Transaction Caching
Banks2FF automatically caches your transaction data to make future syncs much faster:
@@ -98,7 +130,9 @@ The cache requires `BANKS2FF_CACHE_KEY` to be set in your `.env` file for secure
## 🔧 Troubleshooting
- **Unknown source/destination?** Use `sources` and `destinations` commands to see what's available
- **Account not syncing?** Check that the IBAN matches between GoCardless and Firefly III, or use `accounts link` to create manual links
- **Account not syncing?** Check that the IBAN matches between GoCardless and Firefly III, or use `accounts link create` for interactive linking
- **Can't find account by name?** Use `accounts list` to see all available accounts with their IDs and names
- **Link creation failed?** Each bank account can only link to one Firefly account - check existing links with `accounts link list`
- **Missing transactions?** The tool syncs from the last transaction date forward
- **Rate limited?** The tool automatically handles API limits and retries appropriately