diff --git a/cmd/bd/daemon_sync_branch.go b/cmd/bd/daemon_sync_branch.go index a0b66d9d..aa9f4805 100644 --- a/cmd/bd/daemon_sync_branch.go +++ b/cmd/bd/daemon_sync_branch.go @@ -64,14 +64,24 @@ func syncBranchCommitAndPush(ctx context.Context, store storage.Storage, autoPus } // Sync JSONL file to worktree - // Use hardcoded relative path since JSONL is always at .beads/beads.jsonl - jsonlRelPath := filepath.Join(".beads", "beads.jsonl") + // Get the actual JSONL path (could be issues.jsonl, beads.base.jsonl, etc.) + jsonlPath := findJSONLPath() + if jsonlPath == "" { + return false, fmt.Errorf("JSONL path not found") + } + + // Convert absolute path to relative path from repo root + jsonlRelPath, err := filepath.Rel(repoRoot, jsonlPath) + if err != nil { + return false, fmt.Errorf("failed to get relative JSONL path: %w", err) + } + if err := wtMgr.SyncJSONLToWorktree(worktreePath, jsonlRelPath); err != nil { return false, fmt.Errorf("failed to sync JSONL to worktree: %w", err) } // Check for changes in worktree - worktreeJSONLPath := filepath.Join(worktreePath, ".beads", "beads.jsonl") + worktreeJSONLPath := filepath.Join(worktreePath, jsonlRelPath) hasChanges, err := gitHasChangesInWorktree(ctx, worktreePath, worktreeJSONLPath) if err != nil { return false, fmt.Errorf("failed to check for changes in worktree: %w", err) @@ -225,9 +235,21 @@ func syncBranchPull(ctx context.Context, store storage.Storage, log daemonLogger log.log("Pulled sync branch %s", syncBranch) + // Get the actual JSONL path + jsonlPath := findJSONLPath() + if jsonlPath == "" { + return false, fmt.Errorf("JSONL path not found") + } + + // Convert to relative path + jsonlRelPath, err := filepath.Rel(repoRoot, jsonlPath) + if err != nil { + return false, fmt.Errorf("failed to get relative JSONL path: %w", err) + } + // Copy JSONL back to main repo - worktreeJSONLPath := filepath.Join(worktreePath, ".beads", "beads.jsonl") - mainJSONLPath := filepath.Join(repoRoot, ".beads", "beads.jsonl") + worktreeJSONLPath := filepath.Join(worktreePath, jsonlRelPath) + mainJSONLPath := jsonlPath // Check if worktree JSONL exists if _, err := os.Stat(worktreeJSONLPath); os.IsNotExist(err) {