feat(daemons): implement discovery and list command (bd-146, bd-147)

- Add daemon discovery mechanism with socket scanning
- Implement depth-limited filesystem walk to avoid hangs
- Add DaemonInfo struct with metadata collection
- Create 'bd daemons list' command with table and JSON output
- Add FindDaemonByWorkspace and CleanupStaleSockets utilities
- Fix workspace path to be parent of .beads directory
- Add comprehensive tests for discovery functionality

Closes bd-146
Closes bd-147
This commit is contained in:
Steve Yegge
2025-10-26 18:10:24 -07:00
parent 75c959e69c
commit c61ca494fe
5 changed files with 453 additions and 4 deletions

View File

@@ -1079,8 +1079,11 @@ func runDaemonLoop(interval time.Duration, autoCommit, autoPush bool, logPath, p
defer func() { _ = store.Close() }()
log.log("Database opened: %s", daemonDBPath)
workspacePath := filepath.Dir(daemonDBPath)
socketPath := filepath.Join(workspacePath, "bd.sock")
// Get workspace path (.beads directory)
beadsDir := filepath.Dir(daemonDBPath)
// Get actual workspace root (parent of .beads)
workspacePath := filepath.Dir(beadsDir)
socketPath := filepath.Join(beadsDir, "bd.sock")
ctx, cancel := context.WithCancel(context.Background())
defer cancel()