From 9a2345f706c89b77f7110575f6263c38fde13187 Mon Sep 17 00:00:00 2001 From: "Charles P. Cross" <8572939+cpdata@users.noreply.github.com> Date: Sat, 22 Nov 2025 19:57:23 -0500 Subject: [PATCH] Fix: Daemon respects auto-commit/auto-push DB config (#360) Fixes #358 The daemon was ignoring daemon.auto_commit and daemon.auto_push configuration values stored in the database unless the corresponding CLI flags were explicitly provided. This prevented bd init --team configuration from working as expected. Changes: - Modified cmd/bd/daemon.go to check database config when flags are not explicitly set - Uses beads.FindDatabasePath() to locate the database and sqlite.New() to read config - Only applies when starting daemon (skips for --stop, --status, --health, etc.) Co-authored-by: Charles P. Cross --- cmd/bd/daemon.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/cmd/bd/daemon.go b/cmd/bd/daemon.go index ede4d01b..255354e8 100644 --- a/cmd/bd/daemon.go +++ b/cmd/bd/daemon.go @@ -47,6 +47,35 @@ Use --health to check daemon health and metrics.`, logFile, _ := cmd.Flags().GetString("log") global, _ := cmd.Flags().GetBool("global") + // If auto-commit/auto-push flags weren't explicitly provided, read from config + // (skip if --stop, --status, --health, --metrics, or --migrate-to-global) + if !stop && !status && !health && !metrics && !migrateToGlobal && !global { + if !cmd.Flags().Changed("auto-commit") { + if dbPath := beads.FindDatabasePath(); dbPath != "" { + ctx := context.Background() + store, err := sqlite.New(ctx, dbPath) + if err == nil { + if configVal, err := store.GetConfig(ctx, "daemon.auto_commit"); err == nil && configVal == "true" { + autoCommit = true + } + _ = store.Close() + } + } + } + if !cmd.Flags().Changed("auto-push") { + if dbPath := beads.FindDatabasePath(); dbPath != "" { + ctx := context.Background() + store, err := sqlite.New(ctx, dbPath) + if err == nil { + if configVal, err := store.GetConfig(ctx, "daemon.auto_push"); err == nil && configVal == "true" { + autoPush = true + } + _ = store.Close() + } + } + } + } + if interval <= 0 { fmt.Fprintf(os.Stderr, "Error: interval must be positive (got %v)\n", interval) os.Exit(1)