feat(rig): Add --branch flag for custom default branch

Add --branch flag to `gt rig add` to specify a custom default branch
instead of auto-detecting from remote. This supports repositories that
use non-standard default branches like `develop` or `release`.

Changes:
- Add --branch flag to `gt rig add` command
- Store default_branch in rig config.json
- Propagate default branch to refinery, witness, daemon, and all commands
- Rename ensureMainBranch to ensureDefaultBranch for clarity
- Add Rig.DefaultBranch() method for consistent access
- Update crew/manager.go and swarm/manager.go to use rig config

Based on PR #49 by @kustrun - rebased and extended with additional fixes.

Co-authored-by: kustrun <kustrun@users.noreply.github.com>

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gastown/crew/jack
2026-01-04 14:00:48 -08:00
committed by Steve Yegge
parent 31df1bb2c1
commit eea4435269
14 changed files with 135 additions and 56 deletions

View File

@@ -79,3 +79,13 @@ func (r *Rig) BeadsPath() string {
}
return r.Path
}
// DefaultBranch returns the configured default branch for this rig.
// Falls back to "main" if not configured or if config cannot be loaded.
func (r *Rig) DefaultBranch() string {
cfg, err := LoadRigConfig(r.Path)
if err != nil || cfg.DefaultBranch == "" {
return "main"
}
return cfg.DefaultBranch
}