Fix bd-73: Add git worktree detection and warnings

- Implement robust worktree detection using git-dir vs git-common-dir comparison
- Add prominent warning when daemon mode is active in a worktree
- Warn in 3 places: initial connection, auto-start, and daemon start command
- Show shared database path and clarify BEADS_AUTO_START_DAEMON behavior
- Document limitations and solutions in README.md and AGENTS.md
- Add comprehensive tests for detection and path truncation

Fixes #55

Amp-Thread-ID: https://ampcode.com/threads/T-254eb9e3-1a42-42d7-afdf-b7ca2d2dcb8b
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-22 23:05:00 -07:00
parent 3fae41cb35
commit 5a6177b4bc
7 changed files with 302 additions and 0 deletions

View File

@@ -117,6 +117,19 @@ Use --health to check daemon health and metrics.`,
os.Exit(1)
}
// Warn if starting daemon in a git worktree
if !global {
// Ensure dbPath is set for warning
if dbPath == "" {
if foundDB := beads.FindDatabasePath(); foundDB != "" {
dbPath = foundDB
}
}
if dbPath != "" {
warnWorktreeDaemon(dbPath)
}
}
// Start daemon
scope := "local"
if global {