From eff58e494c4ae9d6d765df2a62a4e7bb948044d2 Mon Sep 17 00:00:00 2001 From: Doug Campos Date: Tue, 16 Dec 2025 01:08:29 -0500 Subject: [PATCH] feat: add no-push config to disable automatic git push Wire up the existing --no-push flag to a config option so it can be set as the default, and update bd prime output accordingly. - Add no-push default to config.go, matching existing pattern - Check config in sync.go when --no-push flag not explicitly set - Update bd prime output to omit git push step when enabled --- cmd/bd/prime.go | 21 +++++++++++++++++++++ cmd/bd/sync.go | 5 +++++ docs/CONFIG.md | 1 + internal/config/config.go | 3 +++ 4 files changed, 30 insertions(+) diff --git a/cmd/bd/prime.go b/cmd/bd/prime.go index bd525041..76fc3c1e 100644 --- a/cmd/bd/prime.go +++ b/cmd/bd/prime.go @@ -11,6 +11,7 @@ import ( "github.com/spf13/cobra" "github.com/steveyegge/beads" + "github.com/steveyegge/beads/internal/config" ) var ( @@ -126,6 +127,7 @@ func outputPrimeContext(w io.Writer, mcpMode bool, stealthMode bool) error { // outputMCPContext outputs minimal context for MCP users func outputMCPContext(w io.Writer, stealthMode bool) error { ephemeral := isEphemeralBranch() + noPush := config.GetBool("no-push") var closeProtocol string if stealthMode { @@ -133,6 +135,8 @@ func outputMCPContext(w io.Writer, stealthMode bool) error { closeProtocol = "Before saying \"done\": bd sync --flush-only" } else if ephemeral { closeProtocol = "Before saying \"done\": git status → git add → bd sync --from-main → git commit (no push - ephemeral branch)" + } else if noPush { + closeProtocol = "Before saying \"done\": git status → git add → bd sync → git commit (push disabled - run git push manually)" } else { closeProtocol = "Before saying \"done\": git status → git add → bd sync → git commit → bd sync → git push" } @@ -157,6 +161,7 @@ Start: Check ` + "`ready`" + ` tool for available work. // outputCLIContext outputs full CLI reference for non-MCP users func outputCLIContext(w io.Writer, stealthMode bool) error { ephemeral := isEphemeralBranch() + noPush := config.GetBool("no-push") var closeProtocol string var closeNote string @@ -188,6 +193,22 @@ bd close ... # Close all completed issues at once bd sync --from-main # Pull latest beads from main git add . && git commit -m "..." # Commit your changes # Merge to main when ready (local merge, not push) +` + "```" + } else if noPush { + closeProtocol = `[ ] 1. git status (check what changed) +[ ] 2. git add (stage code changes) +[ ] 3. bd sync (commit beads changes) +[ ] 4. git commit -m "..." (commit code) +[ ] 5. bd sync (commit any new beads changes)` + closeNote = "**Note:** Push disabled via config. Run `git push` manually when ready." + syncSection = `### Sync & Collaboration +- ` + "`bd sync`" + ` - Sync with git remote (run at session end) +- ` + "`bd sync --status`" + ` - Check sync status without syncing` + completingWorkflow = `**Completing work:** +` + "```bash" + ` +bd close ... # Close all completed issues at once +bd sync # Sync beads (push disabled) +# git push # Run manually when ready ` + "```" } else { closeProtocol = `[ ] 1. git status (check what changed) diff --git a/cmd/bd/sync.go b/cmd/bd/sync.go index c48645d0..e6275f4a 100644 --- a/cmd/bd/sync.go +++ b/cmd/bd/sync.go @@ -57,6 +57,11 @@ Use --merge to merge the sync branch back to main branch.`, squash, _ := cmd.Flags().GetBool("squash") checkIntegrity, _ := cmd.Flags().GetBool("check") + // If --no-push not explicitly set, check no-push config + if !cmd.Flags().Changed("no-push") { + noPush = config.GetBool("no-push") + } + // bd-sync-corruption fix: Force direct mode for sync operations. // This prevents stale daemon SQLite connections from corrupting exports. // If the daemon was running but its database file was deleted and recreated diff --git a/docs/CONFIG.md b/docs/CONFIG.md index e93f45bb..a5a4d117 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -34,6 +34,7 @@ Tool-level settings you can configure: | `no-daemon` | `--no-daemon` | `BD_NO_DAEMON` | `false` | Force direct mode, bypass daemon | | `no-auto-flush` | `--no-auto-flush` | `BD_NO_AUTO_FLUSH` | `false` | Disable auto JSONL export | | `no-auto-import` | `--no-auto-import` | `BD_NO_AUTO_IMPORT` | `false` | Disable auto JSONL import | +| `no-push` | `--no-push` | `BD_NO_PUSH` | `false` | Skip pushing to remote in bd sync | | `db` | `--db` | `BD_DB` | (auto-discover) | Database path | | `actor` | `--actor` | `BD_ACTOR` | `$USER` | Actor name for audit trail | | `flush-debounce` | - | `BEADS_FLUSH_DEBOUNCE` | `5s` | Debounce time for auto-flush | diff --git a/internal/config/config.go b/internal/config/config.go index b8a7571a..443f3bfe 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -106,6 +106,9 @@ func Initialize() error { // Sync configuration defaults (bd-4u8) v.SetDefault("sync.require_confirmation_on_mass_delete", false) + // Push configuration defaults + v.SetDefault("no-push", false) + // Read config file if it was found if configFileSet { if err := v.ReadInConfig(); err != nil {