fix: Auto-export to JSONL now works correctly [fixes #23]

Fixed bug where PersistentPostRun was clearing isDirty flag before
calling flushToJSONL(), causing the flush to abort immediately.

The fix ensures flushToJSONL() handles the isDirty flag itself,
allowing the JSONL export to complete successfully.

Also added Arch Linux AUR installation instructions to README.

Changes:
- cmd/bd/main.go: Fixed PersistentPostRun flush logic
- README.md: Added Arch Linux (AUR) installation section
- .beads/bd.jsonl: Auto-exported issue bd-169 (init -q flag bug)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-10-14 12:35:48 -07:00
parent b74f57c087
commit ccdacf087b
3 changed files with 197 additions and 101 deletions

File diff suppressed because one or more lines are too long

View File

@@ -71,6 +71,17 @@ go build -o bd ./cmd/bd
sudo mv bd /usr/local/bin/ # or anywhere in your PATH
```
#### Arch Linux
```bash
# Install from AUR
yay -S beads-git
# or
paru -S beads-git
```
Thanks to [@v4rgas](https://github.com/v4rgas) for maintaining the AUR package!
#### Windows 11
For Windows you must build from source.
Assumes git, go-lang and mingw-64 installed and in path.

View File

@@ -102,11 +102,6 @@ var rootCmd = &cobra.Command{
}
},
PersistentPostRun: func(cmd *cobra.Command, args []string) {
// Signal that store is closing (prevents background flush from accessing closed store)
storeMutex.Lock()
storeActive = false
storeMutex.Unlock()
// Flush any pending changes before closing
flushMutex.Lock()
needsFlush := isDirty && autoFlushEnabled
@@ -116,7 +111,7 @@ var rootCmd = &cobra.Command{
flushTimer.Stop()
flushTimer = nil
}
isDirty = false
// Don't clear isDirty here - let flushToJSONL do it
}
flushMutex.Unlock()
@@ -125,6 +120,11 @@ var rootCmd = &cobra.Command{
flushToJSONL()
}
// Signal that store is closing (prevents background flush from accessing closed store)
storeMutex.Lock()
storeActive = false
storeMutex.Unlock()
if store != nil {
_ = store.Close()
}