feat: configure sync.remote for contributor fork workflows

When bd init --contributor detects a fork setup (upstream remote exists),
it now configures sync.remote = upstream. This ensures bd sync pulls
beads from the source repo (upstream/main) rather than the fork's
potentially outdated origin/main.

Changes:
- Add sync.remote config in contributor wizard when fork detected
- Modify doSyncFromMain() to use configured sync.remote
- Add getDefaultBranchForRemote() to support any remote name
- Verify configured remote exists before fetching

Fixes bd-bx9

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-11-29 23:22:52 -08:00
parent 099e4f5fc3
commit 80ec809473
3 changed files with 52 additions and 19 deletions

View File

@@ -179,6 +179,16 @@ Created by: bd init --contributor
fmt.Printf("%s Auto-routing enabled\n", green("✓"))
// If this is a fork, configure sync to pull beads from upstream (bd-bx9)
// This ensures `bd sync` gets the latest issues from the source repo,
// not from the fork's potentially outdated origin/main
if isFork {
if err := store.SetConfig(ctx, "sync.remote", "upstream"); err != nil {
return fmt.Errorf("failed to set sync remote: %w", err)
}
fmt.Printf("%s Sync configured to pull from upstream (source repo)\n", green("✓"))
}
// Step 5: Summary
fmt.Printf("\n%s %s\n\n", green("✓"), bold("Contributor setup complete!"))