Remove default crew member creation from rig add
- Rig add now creates empty crew/ directory with README - Crew members must be added explicitly with 'gt crew add <name>' - Removed --crew flag from rig add command - Updated help text and output to reflect new behavior This gives users control over crew member names rather than defaulting to 'max'.
This commit is contained in:
@@ -48,7 +48,7 @@ This creates a rig container with:
|
|||||||
- plugins/ Rig-level plugin directory
|
- plugins/ Rig-level plugin directory
|
||||||
- refinery/rig/ Canonical main clone
|
- refinery/rig/ Canonical main clone
|
||||||
- mayor/rig/ Mayor's working clone
|
- mayor/rig/ Mayor's working clone
|
||||||
- crew/max/ Default human workspace
|
- crew/ Empty crew directory (add members with 'gt crew add')
|
||||||
- witness/ Witness agent directory
|
- witness/ Witness agent directory
|
||||||
- polecats/ Worker directory (empty)
|
- polecats/ Worker directory (empty)
|
||||||
|
|
||||||
@@ -155,7 +155,6 @@ Examples:
|
|||||||
// Flags
|
// Flags
|
||||||
var (
|
var (
|
||||||
rigAddPrefix string
|
rigAddPrefix string
|
||||||
rigAddCrew string
|
|
||||||
rigResetHandoff bool
|
rigResetHandoff bool
|
||||||
rigResetMail bool
|
rigResetMail bool
|
||||||
rigResetStale bool
|
rigResetStale bool
|
||||||
@@ -176,7 +175,6 @@ func init() {
|
|||||||
rigCmd.AddCommand(rigShutdownCmd)
|
rigCmd.AddCommand(rigShutdownCmd)
|
||||||
|
|
||||||
rigAddCmd.Flags().StringVar(&rigAddPrefix, "prefix", "", "Beads issue prefix (default: derived from name)")
|
rigAddCmd.Flags().StringVar(&rigAddPrefix, "prefix", "", "Beads issue prefix (default: derived from name)")
|
||||||
rigAddCmd.Flags().StringVar(&rigAddCrew, "crew", "", "Crew workspace name (default: from town config or 'max')")
|
|
||||||
|
|
||||||
rigResetCmd.Flags().BoolVar(&rigResetHandoff, "handoff", false, "Clear handoff content")
|
rigResetCmd.Flags().BoolVar(&rigResetHandoff, "handoff", false, "Clear handoff content")
|
||||||
rigResetCmd.Flags().BoolVar(&rigResetMail, "mail", false, "Clear stale mail messages")
|
rigResetCmd.Flags().BoolVar(&rigResetMail, "mail", false, "Clear stale mail messages")
|
||||||
@@ -200,18 +198,6 @@ func runRigAdd(cmd *cobra.Command, args []string) error {
|
|||||||
return fmt.Errorf("not in a Gas Town workspace: %w", err)
|
return fmt.Errorf("not in a Gas Town workspace: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve crew name: --crew flag > town config > default constant
|
|
||||||
crewName := rigAddCrew
|
|
||||||
if crewName == "" {
|
|
||||||
// Try loading MayorConfig for default_crew_name
|
|
||||||
mayorConfigPath := filepath.Join(townRoot, "mayor", "config.json")
|
|
||||||
if mayorCfg, err := config.LoadMayorConfig(mayorConfigPath); err == nil && mayorCfg.DefaultCrewName != "" {
|
|
||||||
crewName = mayorCfg.DefaultCrewName
|
|
||||||
} else {
|
|
||||||
crewName = config.DefaultCrewName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load rigs config
|
// Load rigs config
|
||||||
rigsPath := filepath.Join(townRoot, "mayor", "rigs.json")
|
rigsPath := filepath.Join(townRoot, "mayor", "rigs.json")
|
||||||
rigsConfig, err := config.LoadRigsConfig(rigsPath)
|
rigsConfig, err := config.LoadRigsConfig(rigsPath)
|
||||||
@@ -237,7 +223,6 @@ func runRigAdd(cmd *cobra.Command, args []string) error {
|
|||||||
Name: name,
|
Name: name,
|
||||||
GitURL: gitURL,
|
GitURL: gitURL,
|
||||||
BeadsPrefix: rigAddPrefix,
|
BeadsPrefix: rigAddPrefix,
|
||||||
CrewName: crewName,
|
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("adding rig: %w", err)
|
return fmt.Errorf("adding rig: %w", err)
|
||||||
@@ -277,13 +262,13 @@ func runRigAdd(cmd *cobra.Command, args []string) error {
|
|||||||
fmt.Printf(" ├── plugins/ (rig-level plugins)\n")
|
fmt.Printf(" ├── plugins/ (rig-level plugins)\n")
|
||||||
fmt.Printf(" ├── mayor/rig/ (clone: %s)\n", defaultBranch)
|
fmt.Printf(" ├── mayor/rig/ (clone: %s)\n", defaultBranch)
|
||||||
fmt.Printf(" ├── refinery/rig/ (worktree: %s, sees polecat branches)\n", defaultBranch)
|
fmt.Printf(" ├── refinery/rig/ (worktree: %s, sees polecat branches)\n", defaultBranch)
|
||||||
fmt.Printf(" ├── crew/%s/ (your workspace)\n", crewName)
|
fmt.Printf(" ├── crew/ (empty - add crew with 'gt crew add')\n")
|
||||||
fmt.Printf(" ├── witness/\n")
|
fmt.Printf(" ├── witness/\n")
|
||||||
fmt.Printf(" └── polecats/\n")
|
fmt.Printf(" └── polecats/\n")
|
||||||
|
|
||||||
fmt.Printf("\nNext steps:\n")
|
fmt.Printf("\nNext steps:\n")
|
||||||
fmt.Printf(" cd %s/crew/%s # Work in your clone\n", filepath.Join(townRoot, name), crewName)
|
fmt.Printf(" gt crew add <name> %s # Create your workspace\n", name)
|
||||||
fmt.Printf(" bd ready # See available work\n")
|
fmt.Printf(" cd %s/crew/<name> # Work in your clone\n", filepath.Join(townRoot, name))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,6 @@ type AddRigOptions struct {
|
|||||||
Name string // Rig name (directory name)
|
Name string // Rig name (directory name)
|
||||||
GitURL string // Repository URL
|
GitURL string // Repository URL
|
||||||
BeadsPrefix string // Beads issue prefix (defaults to derived from name)
|
BeadsPrefix string // Beads issue prefix (defaults to derived from name)
|
||||||
CrewName string // Default crew workspace name (defaults to "main")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddRig creates a new rig as a container with clones for each agent.
|
// AddRig creates a new rig as a container with clones for each agent.
|
||||||
@@ -186,9 +185,6 @@ func (m *Manager) AddRig(opts AddRigOptions) (*Rig, error) {
|
|||||||
if opts.BeadsPrefix == "" {
|
if opts.BeadsPrefix == "" {
|
||||||
opts.BeadsPrefix = deriveBeadsPrefix(opts.Name)
|
opts.BeadsPrefix = deriveBeadsPrefix(opts.Name)
|
||||||
}
|
}
|
||||||
if opts.CrewName == "" {
|
|
||||||
opts.CrewName = "main"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create container directory
|
// Create container directory
|
||||||
if err := os.MkdirAll(rigPath, 0755); err != nil {
|
if err := os.MkdirAll(rigPath, 0755); err != nil {
|
||||||
@@ -271,17 +267,32 @@ func (m *Manager) AddRig(opts AddRigOptions) (*Rig, error) {
|
|||||||
fmt.Printf(" Warning: Could not create refinery hooks: %v\n", err)
|
fmt.Printf(" Warning: Could not create refinery hooks: %v\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clone repository for default crew workspace
|
// Create empty crew directory with README (crew members added via gt crew add)
|
||||||
crewPath := filepath.Join(rigPath, "crew", opts.CrewName)
|
crewPath := filepath.Join(rigPath, "crew")
|
||||||
if err := os.MkdirAll(filepath.Dir(crewPath), 0755); err != nil {
|
if err := os.MkdirAll(crewPath, 0755); err != nil {
|
||||||
return nil, fmt.Errorf("creating crew dir: %w", err)
|
return nil, fmt.Errorf("creating crew dir: %w", err)
|
||||||
}
|
}
|
||||||
if err := m.git.Clone(opts.GitURL, crewPath); err != nil {
|
// Create README with instructions
|
||||||
return nil, fmt.Errorf("cloning for crew: %w", err)
|
readmePath := filepath.Join(crewPath, "README.md")
|
||||||
}
|
readmeContent := `# Crew Directory
|
||||||
// Create crew CLAUDE.md (overrides any from cloned repo)
|
|
||||||
if err := m.createRoleCLAUDEmd(crewPath, "crew", opts.Name, opts.CrewName); err != nil {
|
This directory contains crew worker workspaces.
|
||||||
return nil, fmt.Errorf("creating crew CLAUDE.md: %w", err)
|
|
||||||
|
## Adding a Crew Member
|
||||||
|
|
||||||
|
` + "```bash" + `
|
||||||
|
gt crew add <name> # Creates crew/<name>/ with a git clone
|
||||||
|
` + "```" + `
|
||||||
|
|
||||||
|
## Crew vs Polecats
|
||||||
|
|
||||||
|
- **Crew**: Persistent, user-managed workspaces (never auto-garbage-collected)
|
||||||
|
- **Polecats**: Transient, witness-managed workers (cleaned up after work completes)
|
||||||
|
|
||||||
|
Use crew for your own workspace. Polecats are for batch work dispatch.
|
||||||
|
`
|
||||||
|
if err := os.WriteFile(readmePath, []byte(readmeContent), 0644); err != nil {
|
||||||
|
return nil, fmt.Errorf("creating crew README: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create witness directory (no clone needed)
|
// Create witness directory (no clone needed)
|
||||||
|
|||||||
Reference in New Issue
Block a user