From 88f106fe17a3833da2a939c0b428c619a78ea197 Mon Sep 17 00:00:00 2001 From: Andrey Taranov <86911+antigremlin@users.noreply.github.com> Date: Thu, 8 Jan 2026 04:45:33 +0000 Subject: [PATCH] fix(hooks): add --no-daemon to git hook sync commands (bd-tyyn) (#948) Fix git hooks failing when daemon is running Git hooks were calling bd sync without --no-daemon, causing inline import to fail with 'no database store available' because daemon mode only initializes daemonClient. Fix: Add --no-daemon to all bd sync calls in git hooks to ensure direct mode. --- cmd/bd/hooks.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/bd/hooks.go b/cmd/bd/hooks.go index 4709b85e..656d0552 100644 --- a/cmd/bd/hooks.go +++ b/cmd/bd/hooks.go @@ -499,7 +499,8 @@ func runPreCommitHook() int { // Flush pending changes to JSONL // Use --flush-only to skip git operations (we're already in a git hook) - cmd := exec.Command("bd", "sync", "--flush-only") + // Use --no-daemon to ensure direct mode (inline import requires local store) + cmd := exec.Command("bd", "sync", "--flush-only", "--no-daemon") if err := cmd.Run(); err != nil { fmt.Fprintln(os.Stderr, "Warning: Failed to flush bd changes to JSONL") fmt.Fprintln(os.Stderr, "Run 'bd sync --flush-only' manually to diagnose") @@ -572,7 +573,8 @@ func runPostMergeHook() int { } // Run bd sync --import-only --no-git-history - cmd := exec.Command("bd", "sync", "--import-only", "--no-git-history") + // Use --no-daemon to ensure direct mode (inline import requires local store) + cmd := exec.Command("bd", "sync", "--import-only", "--no-git-history", "--no-daemon") output, err := cmd.CombinedOutput() if err != nil { fmt.Fprintln(os.Stderr, "Warning: Failed to sync bd changes after merge") @@ -613,7 +615,8 @@ func runPrePushHook() int { } // Flush pending bd changes - flushCmd := exec.Command("bd", "sync", "--flush-only") + // Use --no-daemon to ensure direct mode (inline import requires local store) + flushCmd := exec.Command("bd", "sync", "--flush-only", "--no-daemon") _ = flushCmd.Run() // Ignore errors // Check for uncommitted JSONL changes @@ -710,7 +713,8 @@ func runPostCheckoutHook(args []string) int { } // Run bd sync --import-only --no-git-history - cmd := exec.Command("bd", "sync", "--import-only", "--no-git-history") + // Use --no-daemon to ensure direct mode (inline import requires local store) + cmd := exec.Command("bd", "sync", "--import-only", "--no-git-history", "--no-daemon") output, err := cmd.CombinedOutput() if err != nil { fmt.Fprintln(os.Stderr, "Warning: Failed to sync bd changes after checkout")