@fuzzle/opencode-accountant 0.4.1 → 0.4.2-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.
@@ -97,11 +97,71 @@ The `import-pipeline` tool provides an **atomic, safe workflow** using git workt
97
97
  - Deletes processed CSV files from main repo's import/incoming
98
98
  - Cleans up the worktree
99
99
  4. **Handle Failures**: If any step fails (e.g., unknown postings found):
100
- - Worktree is discarded, main branch remains untouched
100
+ - Worktree is preserved by default at `/tmp/import-worktree-<uuid>` for debugging
101
+ - Main branch remains untouched
101
102
  - Review error output for unknown postings with full CSV row data
102
103
  - Update rules file with `if` directives to match the transaction
103
104
  - Re-run `import-pipeline`
104
105
 
106
+ ### Error Recovery and Worktree Preservation
107
+
108
+ **Default Behavior:**
109
+
110
+ - On success: Worktrees are automatically cleaned up
111
+ - On error: Worktrees are preserved in `/tmp/import-worktree-<uuid>` for debugging
112
+ - Worktrees in `/tmp` are automatically cleaned up on system reboot
113
+
114
+ **Manual Recovery from Failed Import:**
115
+
116
+ If an import fails and the worktree is preserved, you can:
117
+
118
+ 1. **Inspect the worktree:**
119
+
120
+ ```bash
121
+ cd /tmp/import-worktree-<uuid>
122
+ hledger check # Validate journal
123
+ hledger balance # Check balances
124
+ cat ledger/2026.journal # View imported transactions
125
+ ```
126
+
127
+ 2. **Continue the import manually:**
128
+
129
+ ```bash
130
+ cd /tmp/import-worktree-<uuid>
131
+ # Fix any issues (edit rules, fix transactions, etc.)
132
+ git add .
133
+ git commit -m "Fix import issues"
134
+ git checkout main
135
+ git merge --no-ff import-<uuid>
136
+ ```
137
+
138
+ 3. **Clean up when done:**
139
+
140
+ ```bash
141
+ git worktree remove /tmp/import-worktree-<uuid>
142
+ ```
143
+
144
+ 4. **Or use the cleanup tool:**
145
+ ```bash
146
+ cleanup-worktrees # Removes worktrees >24h old
147
+ cleanup-worktrees --all true # Removes all import worktrees
148
+ cleanup-worktrees --dryRun true # Preview without removing
149
+ ```
150
+
151
+ **Logs:**
152
+
153
+ - Every import run generates a detailed log: `.memory/import-<timestamp>.md`
154
+ - Log includes all commands, output, timing, and errors
155
+ - Log path is included in import-pipeline output
156
+ - Review the log to understand what failed and why
157
+
158
+ **Force Cleanup on Error:**
159
+ If you prefer the old behavior (always cleanup, even on error):
160
+
161
+ ```bash
162
+ import-pipeline --keepWorktreeOnError false
163
+ ```
164
+
105
165
  ### Rules Files
106
166
 
107
167
  - The location of the rules files is configured in `config/import/providers.yaml`