Support non-main default branches in rig add

- Add DefaultBranch() method to git package to detect repo's default branch
- Store default_branch in rig config.json
- Use detected branch for refinery worktree instead of hardcoding 'main'
- Add LoadRigConfig() to read rig config
- Display correct branch name in rig add output

Fixes wyvern rig creation (uses 'master' not 'main').
This commit is contained in:
Steve Yegge
2025-12-30 19:16:17 -08:00
parent 8c80ad0aff
commit 38bf896296
3 changed files with 55 additions and 13 deletions

View File

@@ -262,6 +262,12 @@ func runRigAdd(cmd *cobra.Command, args []string) error {
elapsed := time.Since(startTime)
// Read default branch from rig config
defaultBranch := "main"
if rigCfg, err := rig.LoadRigConfig(filepath.Join(townRoot, name)); err == nil && rigCfg.DefaultBranch != "" {
defaultBranch = rigCfg.DefaultBranch
}
fmt.Printf("\n%s Rig created in %.1fs\n", style.Success.Render("✓"), elapsed.Seconds())
fmt.Printf("\nStructure:\n")
fmt.Printf(" %s/\n", name)
@@ -269,8 +275,8 @@ func runRigAdd(cmd *cobra.Command, args []string) error {
fmt.Printf(" ├── .repo.git/ (shared bare repo for refinery+polecats)\n")
fmt.Printf(" ├── .beads/ (prefix: %s)\n", newRig.Config.Prefix)
fmt.Printf(" ├── plugins/ (rig-level plugins)\n")
fmt.Printf(" ├── mayor/rig/ (clone: main)\n")
fmt.Printf(" ├── refinery/rig/ (worktree: main, sees polecat branches)\n")
fmt.Printf(" ├── mayor/rig/ (clone: %s)\n", defaultBranch)
fmt.Printf(" ├── refinery/rig/ (worktree: %s, sees polecat branches)\n", defaultBranch)
fmt.Printf(" ├── crew/%s/ (your workspace)\n", crewName)
fmt.Printf(" ├── witness/\n")
fmt.Printf(" └── polecats/\n")