diff --git a/cmd/bd/doctor/gitignore.go b/cmd/bd/doctor/gitignore.go index 0a3a90a7..8bf0458b 100644 --- a/cmd/bd/doctor/gitignore.go +++ b/cmd/bd/doctor/gitignore.go @@ -6,6 +6,8 @@ import ( "os/exec" "path/filepath" "strings" + + "github.com/steveyegge/beads/internal/syncbranch" ) // GitignoreTemplate is the canonical .beads/.gitignore content @@ -133,6 +135,7 @@ func FixGitignore() error { // CheckIssuesTracking verifies that issues.jsonl is tracked by git. // This catches cases where global gitignore patterns (e.g., *.jsonl) would // cause issues.jsonl to be ignored, breaking bd sync. +// In sync-branch mode, the file may be intentionally ignored in working branches (GH#858). func CheckIssuesTracking() DoctorCheck { issuesPath := filepath.Join(".beads", "issues.jsonl") @@ -146,6 +149,17 @@ func CheckIssuesTracking() DoctorCheck { } } + // In sync-branch mode, JSONL files may be intentionally ignored in working branches. + // They are tracked only in the dedicated sync branch. + if branch := syncbranch.GetFromYAML(); branch != "" { + return DoctorCheck{ + Name: "Issues Tracking", + Status: StatusOK, + Message: "N/A (sync-branch mode)", + Detail: fmt.Sprintf("JSONL files tracked in '%s' branch only", branch), + } + } + // Check if git considers this file ignored // git check-ignore exits 0 if ignored, 1 if not ignored, 128 if error cmd := exec.Command("git", "check-ignore", "-q", issuesPath) // #nosec G204 - args are hardcoded paths diff --git a/cmd/bd/doctor/installation.go b/cmd/bd/doctor/installation.go index a4734049..5e6b0132 100644 --- a/cmd/bd/doctor/installation.go +++ b/cmd/bd/doctor/installation.go @@ -13,6 +13,7 @@ import ( "github.com/steveyegge/beads/cmd/bd/doctor/fix" "github.com/steveyegge/beads/internal/beads" "github.com/steveyegge/beads/internal/git" + "github.com/steveyegge/beads/internal/syncbranch" ) // CheckInstallation verifies that .beads directory exists @@ -142,7 +143,9 @@ func CheckPermissions(path string) DoctorCheck { } } -// CheckUntrackedBeadsFiles checks for untracked .beads/*.jsonl files that should be committed +// CheckUntrackedBeadsFiles checks for untracked .beads/*.jsonl files that should be committed. +// In sync-branch mode, JSONL files are intentionally untracked in working branches +// and only committed to the dedicated sync branch (GH#858). func CheckUntrackedBeadsFiles(path string) DoctorCheck { beadsDir := filepath.Join(path, ".beads") @@ -155,6 +158,17 @@ func CheckUntrackedBeadsFiles(path string) DoctorCheck { } } + // In sync-branch mode, JSONL files are intentionally untracked in working branches. + // They are committed only to the dedicated sync branch via bd sync. + if branch := syncbranch.GetFromYAML(); branch != "" { + return DoctorCheck{ + Name: "Untracked Files", + Status: StatusOK, + Message: "N/A (sync-branch mode)", + Detail: fmt.Sprintf("JSONL files tracked in '%s' branch only", branch), + } + } + // Check if we're in a git repository using worktree-aware detection _, err := git.GetGitDir() if err != nil {