feat(daemon): Add --global flag for multi-repo support

Implements bd-121: Global daemon with system-wide socket

Changes:
- Add --global flag to daemon command
- Use ~/.beads/bd.sock when --global is set
- Skip git repo validation for global daemon
- Update daemon discovery to check ~/.beads/ as fallback
- Both Go CLI and Python MCP client check global socket
- Update all tests to pass global parameter

Benefits:
- Single daemon serves all repos on system
- No per-repo daemon management needed
- Better resource usage for users with many repos
- Automatic fallback when local daemon not running

Usage:
  bd daemon --global         # Start global daemon
  bd daemon --status --global # Check global status
  bd daemon --stop --global   # Stop global daemon

Related: bd-73 (multi-repo epic)
Amp-Thread-ID: https://ampcode.com/threads/T-ea606216-b886-4af0-bba8-56d000362d01
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-17 22:45:33 -07:00
parent ad8f52eb87
commit 958bbc0853
5 changed files with 126 additions and 35 deletions

View File

@@ -23,7 +23,7 @@ func TestGetPIDFilePath(t *testing.T) {
defer func() { dbPath = oldDBPath }()
dbPath = filepath.Join(tmpDir, ".beads", "test.db")
pidFile, err := getPIDFilePath()
pidFile, err := getPIDFilePath(false) // test local daemon
if err != nil {
t.Fatalf("getPIDFilePath failed: %v", err)
}
@@ -65,7 +65,7 @@ func TestGetLogFilePath(t *testing.T) {
defer func() { dbPath = oldDBPath }()
dbPath = tt.dbPath
result, err := getLogFilePath(tt.userPath)
result, err := getLogFilePath(tt.userPath, false) // test local daemon
if err != nil {
t.Fatalf("getLogFilePath failed: %v", err)
}