Refinery as worktree: local MR integration (gt-4u5z)

Architecture changes:
- Refinery created as worktree of mayor clone (shares .git)
- Polecat branches stay local (never pushed to origin)
- MRs stored as wisps in .beads-wisp/mq/ (ephemeral)
- Only main gets pushed to origin after merge

New mrqueue package for wisp-based MR storage.
Updated spawn, done, mq_submit, refinery, molecule templates.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-23 21:24:42 -08:00
parent e895e51ee4
commit b685879b63
11 changed files with 378 additions and 142 deletions
+17 -14
View File
@@ -217,20 +217,7 @@ func (m *Manager) AddRig(opts AddRigOptions) (*Rig, error) {
return nil, fmt.Errorf("saving rig config: %w", err)
}
// Clone repository for refinery (canonical main)
refineryRigPath := filepath.Join(rigPath, "refinery", "rig")
if err := os.MkdirAll(filepath.Dir(refineryRigPath), 0755); err != nil {
return nil, fmt.Errorf("creating refinery dir: %w", err)
}
if err := m.git.Clone(opts.GitURL, refineryRigPath); err != nil {
return nil, fmt.Errorf("cloning for refinery: %w", err)
}
// Create refinery CLAUDE.md (overrides any from cloned repo)
if err := m.createRoleCLAUDEmd(refineryRigPath, "refinery", opts.Name, ""); err != nil {
return nil, fmt.Errorf("creating refinery CLAUDE.md: %w", err)
}
// Clone repository for mayor
// Clone repository for mayor (must be first - serves as base for worktrees)
mayorRigPath := filepath.Join(rigPath, "mayor", "rig")
if err := os.MkdirAll(filepath.Dir(mayorRigPath), 0755); err != nil {
return nil, fmt.Errorf("creating mayor dir: %w", err)
@@ -243,6 +230,22 @@ func (m *Manager) AddRig(opts AddRigOptions) (*Rig, error) {
return nil, fmt.Errorf("creating mayor CLAUDE.md: %w", err)
}
// Create refinery as a worktree of mayor's clone.
// This allows refinery to see polecat branches locally (shared .git).
// Refinery uses the "refinery" branch which tracks main.
refineryRigPath := filepath.Join(rigPath, "refinery", "rig")
if err := os.MkdirAll(filepath.Dir(refineryRigPath), 0755); err != nil {
return nil, fmt.Errorf("creating refinery dir: %w", err)
}
mayorGit := git.NewGit(mayorRigPath)
if err := mayorGit.WorktreeAdd(refineryRigPath, "refinery"); err != nil {
return nil, fmt.Errorf("creating refinery worktree: %w", err)
}
// Create refinery CLAUDE.md (overrides any from cloned repo)
if err := m.createRoleCLAUDEmd(refineryRigPath, "refinery", opts.Name, ""); err != nil {
return nil, fmt.Errorf("creating refinery CLAUDE.md: %w", err)
}
// Clone repository for default crew workspace
crewPath := filepath.Join(rigPath, "crew", opts.CrewName)
if err := os.MkdirAll(filepath.Dir(crewPath), 0755); err != nil {