@fuzzle/opencode-accountant 0.8.0 → 0.8.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/agent/accountant.md +21 -10
- package/dist/index.js +3 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -261,7 +261,7 @@ See the hledger documentation for details on rules file format and syntax.
|
|
|
261
261
|
The pipeline automatically manages account declarations:
|
|
262
262
|
|
|
263
263
|
- Scans rules files matched to the CSVs being imported
|
|
264
|
-
- Extracts all accounts (account1
|
|
264
|
+
- Extracts all accounts (account1, account2, account3, etc. directives)
|
|
265
265
|
- Creates or updates year journal files with sorted account declarations
|
|
266
266
|
- Ensures `hledger check --strict` validation passes
|
|
267
267
|
|
package/agent/accountant.md
CHANGED
|
@@ -8,7 +8,7 @@ tools:
|
|
|
8
8
|
bash: true
|
|
9
9
|
edit: true
|
|
10
10
|
write: true
|
|
11
|
-
# MCP tools available: import-pipeline, fetch-currency-prices
|
|
11
|
+
# MCP tools available: import-pipeline, fetch-currency-prices, hledger-mcp (read-only queries)
|
|
12
12
|
permissions:
|
|
13
13
|
bash: allow
|
|
14
14
|
edit: allow
|
|
@@ -45,7 +45,7 @@ before performing any accounting task.**
|
|
|
45
45
|
When working with accounting tasks:
|
|
46
46
|
|
|
47
47
|
1. **Follow conventions precisely** - Use the exact patterns from `config/conventions/*.md`
|
|
48
|
-
1. **Always validate** - Run hledger
|
|
48
|
+
1. **Always validate** - Run hledger check after changes
|
|
49
49
|
1. **Balance checking** - Ensure all transactions balance with `@ price` notation for conversions
|
|
50
50
|
1. **File organization** - Keep transactions in appropriate year journals
|
|
51
51
|
1. **Duplicate checking** - Take extra care to avoid duplicate transactions
|
|
@@ -60,25 +60,32 @@ You have access to specialized MCP tools that MUST be used for their designated
|
|
|
60
60
|
| ----------------------- | ---------------------------------------------------- | --------------------------------------------------------- |
|
|
61
61
|
| `import-pipeline` | Full import workflow (classify → import → reconcile) | Manual file moves, `hledger import`, manual journal edits |
|
|
62
62
|
| `fetch-currency-prices` | Fetching exchange rates | `curl` to price APIs, manual price entries |
|
|
63
|
+
| hledger MCP tools | Read-only queries (balance, register, accounts, etc.) | `hledger bal`, `hledger reg`, `hledger print` via bash |
|
|
63
64
|
|
|
64
65
|
These tools handle validation, deduplication, error checking, and file organization automatically. Bypassing them risks data corruption, duplicate transactions, and inconsistent state.
|
|
65
66
|
|
|
66
67
|
## Bash Usage Policy
|
|
67
68
|
|
|
68
|
-
Bash is allowed ONLY for
|
|
69
|
+
Bash is allowed ONLY for:
|
|
69
70
|
|
|
70
|
-
- **Validation**: `hledger check
|
|
71
|
-
- **Formatting check**: `hledger-fmt` (WITHOUT `--fix` - shows diff only)
|
|
72
|
-
- **Queries**: `hledger print`, `hledger reg`, `hledger accounts`
|
|
71
|
+
- **Validation**: `hledger check`
|
|
73
72
|
- **File inspection**: `cat`, `head`, `tail`, `grep`
|
|
74
73
|
|
|
74
|
+
For all hledger queries, use the hledger MCP tools instead of bash:
|
|
75
|
+
|
|
76
|
+
- `balance` / `balancesheet` / `incomestatement` / `cashflow` for reports
|
|
77
|
+
- `register` / `aregister` for transaction history
|
|
78
|
+
- `print` for displaying transactions
|
|
79
|
+
- `accounts` for listing accounts
|
|
80
|
+
- `stats` / `activity` / `payees` / `descriptions` for analysis
|
|
81
|
+
|
|
75
82
|
Bash is **FORBIDDEN** for:
|
|
76
83
|
|
|
77
|
-
- **`hledger-fmt --fix`** - Mass-reformats files, destroys formatting
|
|
78
84
|
- **`hledger import`** - Use `import-pipeline` tool instead
|
|
79
85
|
- **Moving/copying CSV files** - Use `import-pipeline` tool instead
|
|
80
86
|
- **Writing to files** - Use `edit`/`write` tools with user approval only
|
|
81
87
|
- **Fetching prices** - Use `fetch-currency-prices` tool instead
|
|
88
|
+
- **`hledger -f <file>`** - Never specify journal files explicitly; `.hledger.journal` includes all journals automatically
|
|
82
89
|
|
|
83
90
|
## Manual Editing Policy
|
|
84
91
|
|
|
@@ -97,7 +104,6 @@ Bash is **FORBIDDEN** for:
|
|
|
97
104
|
|
|
98
105
|
### Absolutely Forbidden
|
|
99
106
|
|
|
100
|
-
❌ **NEVER run `hledger-fmt --fix`** - mass-reformats entire files
|
|
101
107
|
❌ **NEVER reformat existing transactions** - preserve exact spacing/separators
|
|
102
108
|
❌ **NEVER use `hledger print` to rewrite transactions** - changes formatting
|
|
103
109
|
|
|
@@ -105,7 +111,7 @@ Bash is **FORBIDDEN** for:
|
|
|
105
111
|
|
|
106
112
|
1. **Use edit tool surgically** - change only necessary lines
|
|
107
113
|
2. **Preserve formatting exactly** - match spacing, indentation, separators
|
|
108
|
-
3. **Validate after**: Run `hledger check
|
|
114
|
+
3. **Validate after**: Run `hledger check` to verify no unintended changes
|
|
109
115
|
|
|
110
116
|
## Statement Import Workflow
|
|
111
117
|
|
|
@@ -128,6 +134,11 @@ The `import-pipeline` tool operates directly on the working directory:
|
|
|
128
134
|
- Update rules file with `if` directives to match the transaction
|
|
129
135
|
- Re-run `import-pipeline` (use `--skipClassify true` if files are already classified)
|
|
130
136
|
|
|
137
|
+
⚠️ **On import failure, your role is investigator only:**
|
|
138
|
+
- Investigate the error using read-only tools (hledger check, print, reg, file inspection)
|
|
139
|
+
- Present findings and root cause analysis to the user
|
|
140
|
+
- **NEVER manually edit journal files to fix import issues** — suggest the fix, wait for approval
|
|
141
|
+
|
|
131
142
|
**Logs:**
|
|
132
143
|
|
|
133
144
|
- Every import run generates a detailed log: `.memory/import-<timestamp>.md`
|
|
@@ -148,7 +159,7 @@ The `import-pipeline` tool operates directly on the working directory:
|
|
|
148
159
|
|
|
149
160
|
The import pipeline automatically:
|
|
150
161
|
|
|
151
|
-
- Scans matched rules files for all account references (account1, account2 directives)
|
|
162
|
+
- Scans matched rules files for all account references (account1, account2, account3, etc. directives)
|
|
152
163
|
- Creates/updates year journal files (e.g., ledger/2026.journal) with sorted account declarations
|
|
153
164
|
- Prevents `hledger check --strict` failures due to missing account declarations
|
|
154
165
|
- No manual account setup required
|
package/dist/index.js
CHANGED
|
@@ -24098,15 +24098,11 @@ function extractAccountsFromRulesFile(rulesPath) {
|
|
|
24098
24098
|
if (trimmed.startsWith("#") || trimmed.startsWith(";") || trimmed === "") {
|
|
24099
24099
|
continue;
|
|
24100
24100
|
}
|
|
24101
|
-
const
|
|
24102
|
-
if (
|
|
24103
|
-
accounts.add(
|
|
24101
|
+
const accountMatch = trimmed.match(/^account\d+\s+(.+?)(?:\s+|$)/);
|
|
24102
|
+
if (accountMatch) {
|
|
24103
|
+
accounts.add(accountMatch[1].trim());
|
|
24104
24104
|
continue;
|
|
24105
24105
|
}
|
|
24106
|
-
const account2Match = trimmed.match(/account2\s+(.+?)(?:\s+|$)/);
|
|
24107
|
-
if (account2Match) {
|
|
24108
|
-
accounts.add(account2Match[1].trim());
|
|
24109
|
-
}
|
|
24110
24106
|
}
|
|
24111
24107
|
return accounts;
|
|
24112
24108
|
}
|