forked from aiolabs/libra
Rename Castle Accounting extension to Libra
Full identifier rename: module path lnbits.extensions.castle →
lnbits.extensions.libra, DB ext_castle → ext_libra, URL prefix
/castle/ → /libra/, manifest id castle → libra, fava ledger slug
default castle-ledger → libra-ledger, Beancount source metadata
castle-api → libra-api and link prefixes castle-{entry,tx}- →
libra-{entry,tx}-, column castle_wallet_id → libra_wallet_id, all
Python/JS/HTML identifiers (castle_ext, CastleSettings,
castle_reference, castleWalletConfigured, etc.).
Display name "Castle Accounting" → "Libra" (the scales/balance
metaphor — fits double-entry bookkeeping).
No backward compat: production hosts will be force-updated. Old
castle-prefixed Beancount metadata in existing Fava ledgers is
historical; new entries use libra-* prefixes going forward.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9c577c740c
commit
c174cda48d
44 changed files with 953 additions and 953 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Castle Beancount Import Helper
|
||||
# Libra Beancount Import Helper
|
||||
|
||||
Import Beancount ledger transactions into Castle accounting extension.
|
||||
Import Beancount ledger transactions into Libra accounting extension.
|
||||
|
||||
## 📁 Files
|
||||
|
||||
|
|
@ -40,14 +40,14 @@ USER_MAPPINGS = {
|
|||
### 3. Set API Key
|
||||
|
||||
```bash
|
||||
export CASTLE_ADMIN_KEY="your_lnbits_admin_invoice_key"
|
||||
export LIBRA_ADMIN_KEY="your_lnbits_admin_invoice_key"
|
||||
export LNBITS_URL="http://localhost:5000" # Optional
|
||||
```
|
||||
|
||||
## 📖 Usage
|
||||
|
||||
```bash
|
||||
cd /path/to/castle/helper
|
||||
cd /path/to/libra/helper
|
||||
|
||||
# Test with dry run
|
||||
python import_beancount.py ledger.beancount --dry-run
|
||||
|
|
@ -72,30 +72,30 @@ Your Beancount transactions must have an `Equity:<name>` account:
|
|||
|
||||
**Requirements:**
|
||||
- Every transaction must have an `Equity:<name>` account
|
||||
- Account names must match exactly what's in Castle
|
||||
- Account names must match exactly what's in Libra
|
||||
- The name after `Equity:` must be in `USER_MAPPINGS`
|
||||
|
||||
## 🔄 How It Works
|
||||
|
||||
1. **Loads rates** from `btc_eur_rates.csv`
|
||||
2. **Loads accounts** from Castle API automatically
|
||||
2. **Loads accounts** from Libra API automatically
|
||||
3. **Maps users** - Extracts user name from `Equity:Name` accounts
|
||||
4. **Parses** Beancount transactions
|
||||
5. **Converts** EUR → sats using daily rate
|
||||
6. **Uploads** to Castle with metadata
|
||||
6. **Uploads** to Libra with metadata
|
||||
|
||||
## 📊 Example Output
|
||||
|
||||
```bash
|
||||
$ python import_beancount.py ledger.beancount
|
||||
======================================================================
|
||||
🏰 Beancount to Castle Import Script
|
||||
🏰 Beancount to Libra Import Script
|
||||
======================================================================
|
||||
|
||||
📊 Loaded 15 daily rates from btc_eur_rates.csv
|
||||
Date range: 2025-07-01 to 2025-07-15
|
||||
|
||||
🏦 Loaded 28 accounts from Castle
|
||||
🏦 Loaded 28 accounts from Libra
|
||||
|
||||
👥 User ID mappings:
|
||||
- Pat → wallet_abc123
|
||||
|
|
@ -112,15 +112,15 @@ $ python import_beancount.py ledger.beancount
|
|||
📊 Summary: 25 succeeded, 0 failed, 0 skipped
|
||||
======================================================================
|
||||
|
||||
✅ Successfully imported 25 transactions to Castle!
|
||||
✅ Successfully imported 25 transactions to Libra!
|
||||
```
|
||||
|
||||
## ❓ Troubleshooting
|
||||
|
||||
### "No account found in Castle"
|
||||
**Error:** `No account found in Castle with name 'Expenses:XYZ'`
|
||||
### "No account found in Libra"
|
||||
**Error:** `No account found in Libra with name 'Expenses:XYZ'`
|
||||
|
||||
**Solution:** Create the account in Castle first with that exact name.
|
||||
**Solution:** Create the account in Libra first with that exact name.
|
||||
|
||||
### "No user ID mapping found"
|
||||
**Error:** `No user ID mapping found for 'Pat'`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue