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
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/steveyegge/beads"
|
"github.com/steveyegge/beads"
|
||||||
|
"github.com/steveyegge/beads/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -126,6 +127,7 @@ func outputPrimeContext(w io.Writer, mcpMode bool, stealthMode bool) error {
|
|||||||
// outputMCPContext outputs minimal context for MCP users
|
// outputMCPContext outputs minimal context for MCP users
|
||||||
func outputMCPContext(w io.Writer, stealthMode bool) error {
|
func outputMCPContext(w io.Writer, stealthMode bool) error {
|
||||||
ephemeral := isEphemeralBranch()
|
ephemeral := isEphemeralBranch()
|
||||||
|
noPush := config.GetBool("no-push")
|
||||||
|
|
||||||
var closeProtocol string
|
var closeProtocol string
|
||||||
if stealthMode {
|
if stealthMode {
|
||||||
@@ -133,6 +135,8 @@ func outputMCPContext(w io.Writer, stealthMode bool) error {
|
|||||||
closeProtocol = "Before saying \"done\": bd sync --flush-only"
|
closeProtocol = "Before saying \"done\": bd sync --flush-only"
|
||||||
} else if ephemeral {
|
} else if ephemeral {
|
||||||
closeProtocol = "Before saying \"done\": git status → git add → bd sync --from-main → git commit (no push - ephemeral branch)"
|
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 {
|
} else {
|
||||||
closeProtocol = "Before saying \"done\": git status → git add → bd sync → git commit → bd sync → git push"
|
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
|
// outputCLIContext outputs full CLI reference for non-MCP users
|
||||||
func outputCLIContext(w io.Writer, stealthMode bool) error {
|
func outputCLIContext(w io.Writer, stealthMode bool) error {
|
||||||
ephemeral := isEphemeralBranch()
|
ephemeral := isEphemeralBranch()
|
||||||
|
noPush := config.GetBool("no-push")
|
||||||
|
|
||||||
var closeProtocol string
|
var closeProtocol string
|
||||||
var closeNote string
|
var closeNote string
|
||||||
@@ -188,6 +193,22 @@ bd close <id1> <id2> ... # Close all completed issues at once
|
|||||||
bd sync --from-main # Pull latest beads from main
|
bd sync --from-main # Pull latest beads from main
|
||||||
git add . && git commit -m "..." # Commit your changes
|
git add . && git commit -m "..." # Commit your changes
|
||||||
# Merge to main when ready (local merge, not push)
|
# Merge to main when ready (local merge, not push)
|
||||||
|
` + "```"
|
||||||
|
} else if noPush {
|
||||||
|
closeProtocol = `[ ] 1. git status (check what changed)
|
||||||
|
[ ] 2. git add <files> (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 <id1> <id2> ... # Close all completed issues at once
|
||||||
|
bd sync # Sync beads (push disabled)
|
||||||
|
# git push # Run manually when ready
|
||||||
` + "```"
|
` + "```"
|
||||||
} else {
|
} else {
|
||||||
closeProtocol = `[ ] 1. git status (check what changed)
|
closeProtocol = `[ ] 1. git status (check what changed)
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ Use --merge to merge the sync branch back to main branch.`,
|
|||||||
squash, _ := cmd.Flags().GetBool("squash")
|
squash, _ := cmd.Flags().GetBool("squash")
|
||||||
checkIntegrity, _ := cmd.Flags().GetBool("check")
|
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.
|
// bd-sync-corruption fix: Force direct mode for sync operations.
|
||||||
// This prevents stale daemon SQLite connections from corrupting exports.
|
// This prevents stale daemon SQLite connections from corrupting exports.
|
||||||
// If the daemon was running but its database file was deleted and recreated
|
// If the daemon was running but its database file was deleted and recreated
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ Tool-level settings you can configure:
|
|||||||
| `no-daemon` | `--no-daemon` | `BD_NO_DAEMON` | `false` | Force direct mode, bypass daemon |
|
| `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-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-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 |
|
| `db` | `--db` | `BD_DB` | (auto-discover) | Database path |
|
||||||
| `actor` | `--actor` | `BD_ACTOR` | `$USER` | Actor name for audit trail |
|
| `actor` | `--actor` | `BD_ACTOR` | `$USER` | Actor name for audit trail |
|
||||||
| `flush-debounce` | - | `BEADS_FLUSH_DEBOUNCE` | `5s` | Debounce time for auto-flush |
|
| `flush-debounce` | - | `BEADS_FLUSH_DEBOUNCE` | `5s` | Debounce time for auto-flush |
|
||||||
|
|||||||
@@ -106,6 +106,9 @@ func Initialize() error {
|
|||||||
// Sync configuration defaults (bd-4u8)
|
// Sync configuration defaults (bd-4u8)
|
||||||
v.SetDefault("sync.require_confirmation_on_mass_delete", false)
|
v.SetDefault("sync.require_confirmation_on_mass_delete", false)
|
||||||
|
|
||||||
|
// Push configuration defaults
|
||||||
|
v.SetDefault("no-push", false)
|
||||||
|
|
||||||
// Read config file if it was found
|
// Read config file if it was found
|
||||||
if configFileSet {
|
if configFileSet {
|
||||||
if err := v.ReadInConfig(); err != nil {
|
if err := v.ReadInConfig(); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user