feat(prime): add no-git-ops config to disable git ops in session close (GH#593)

Users who want manual control over git commits can now set:

  bd config set no-git-ops true

This makes `bd prime` output the stealth-mode session close protocol
(just `bd sync --flush-only`) instead of the full git add/commit/push
workflow. Useful when:

- You want to verify work before committing
- Claude tries to auto-commit after context compaction
- You have a custom git workflow

The --stealth flag still works as before for one-off use.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-25 14:25:45 -08:00
parent 6d23689736
commit 2ff17686d0
2 changed files with 12 additions and 2 deletions

View File

@@ -31,7 +31,12 @@ Automatically detects if MCP server is active and adapts output:
- CLI mode: Full command reference (~1-2k tokens)
Designed for Claude Code hooks (SessionStart, PreCompact) to prevent
agents from forgetting bd workflow after context compaction.`,
agents from forgetting bd workflow after context compaction.
Config options:
- no-git-ops: When true, outputs stealth mode (no git commands in session close protocol).
Set via: bd config set no-git-ops true
Useful when you want to control when commits happen manually.`,
Run: func(cmd *cobra.Command, args []string) {
// Find .beads/ directory (supports both database and JSONL-only mode)
beadsDir := beads.FindBeadsDir()
@@ -51,8 +56,12 @@ agents from forgetting bd workflow after context compaction.`,
mcpMode = true
}
// Check for stealth mode: flag OR config (GH#593)
// This allows users to disable git ops in session close protocol via config
stealthMode := primeStealthMode || config.GetBool("no-git-ops")
// Output workflow context (adaptive based on MCP and stealth mode)
if err := outputPrimeContext(os.Stdout, mcpMode, primeStealthMode); err != nil {
if err := outputPrimeContext(os.Stdout, mcpMode, stealthMode); err != nil {
// Suppress all errors - silent exit with success
// Never write to stderr (breaks Windows compatibility)
os.Exit(0)