feat: Allow starting multiple crew members at once

gt crew start beads/grip beads/fang beads/wolf now works
This commit is contained in:
Steve Yegge
2025-12-30 10:23:33 -08:00
parent afb7b85b35
commit f492aac19b
2 changed files with 37 additions and 27 deletions

View File

@@ -233,9 +233,9 @@ var crewPrevCmd = &cobra.Command{
} }
var crewStartCmd = &cobra.Command{ var crewStartCmd = &cobra.Command{
Use: "start [name]", Use: "start [name...]",
Short: "Start a crew workspace (creates if needed)", Short: "Start crew workspace(s) (creates if needed)",
Long: `Start a crew workspace, creating it if it doesn't exist. Long: `Start one or more crew workspaces, creating them if they don't exist.
This is an alias for 'gt start crew'. It combines 'gt crew add' and 'gt crew at --detached'. This is an alias for 'gt start crew'. It combines 'gt crew add' and 'gt crew at --detached'.
The crew session starts in the background with Claude running and ready. The crew session starts in the background with Claude running and ready.
@@ -249,11 +249,11 @@ Role Discovery:
workspace automatically. workspace automatically.
Examples: Examples:
gt crew start joe # Start joe in current rig gt crew start joe # Start joe in current rig
gt crew start gastown/joe # Start joe in gastown rig gt crew start gastown/joe # Start joe in gastown rig
gt crew start joe --rig beads # Start joe in beads rig gt crew start beads/grip beads/fang # Start multiple crew members
gt crew start # Auto-detect from cwd`, gt crew start joe --rig beads # Start joe in beads rig
Args: cobra.MaximumNArgs(1), gt crew start # Auto-detect from cwd`,
RunE: runCrewStart, RunE: runCrewStart,
} }

View File

@@ -176,12 +176,28 @@ func runCrewRefresh(cmd *cobra.Command, args []string) error {
// runCrewStart is an alias for runStartCrew, handling multiple input formats. // runCrewStart is an alias for runStartCrew, handling multiple input formats.
// It supports: "name", "rig/name", "rig/crew/name" formats, or auto-detection from cwd. // It supports: "name", "rig/name", "rig/crew/name" formats, or auto-detection from cwd.
// Multiple names can be provided to start multiple crew members at once.
func runCrewStart(cmd *cobra.Command, args []string) error { func runCrewStart(cmd *cobra.Command, args []string) error {
var name string // If no args, try to detect from current directory
if len(args) == 0 {
detected, err := detectCrewFromCwd()
if err != nil {
return fmt.Errorf("could not detect crew workspace from current directory: %w\n\nUsage: gt crew start <name>", err)
}
name := detected.crewName
if crewRig == "" {
crewRig = detected.rigName
}
fmt.Printf("Detected crew workspace: %s/%s\n", detected.rigName, name)
// Determine crew name: from arg, or auto-detect from cwd startCrewRig = crewRig
if len(args) > 0 { startCrewAccount = crewAccount
name = args[0] return runStartCrew(cmd, []string{name})
}
// Process each name
var lastErr error
for _, name := range args {
// Handle rig/crew/name format (e.g., "gastown/crew/joe" -> "gastown/joe") // Handle rig/crew/name format (e.g., "gastown/crew/joe" -> "gastown/joe")
if strings.Contains(name, "/crew/") { if strings.Contains(name, "/crew/") {
parts := strings.SplitN(name, "/crew/", 2) parts := strings.SplitN(name, "/crew/", 2)
@@ -189,24 +205,18 @@ func runCrewStart(cmd *cobra.Command, args []string) error {
name = parts[0] + "/" + parts[1] name = parts[0] + "/" + parts[1]
} }
} }
} else {
// Try to detect from current directory // Set the start.go flags from crew.go flags before calling
detected, err := detectCrewFromCwd() startCrewRig = crewRig
if err != nil { startCrewAccount = crewAccount
return fmt.Errorf("could not detect crew workspace from current directory: %w\n\nUsage: gt crew start <name>", err)
if err := runStartCrew(cmd, []string{name}); err != nil {
fmt.Printf("Error starting %s: %v\n", name, err)
lastErr = err
} }
name = detected.crewName
if crewRig == "" {
crewRig = detected.rigName
}
fmt.Printf("Detected crew workspace: %s/%s\n", detected.rigName, name)
} }
// Set the start.go flags from crew.go flags before calling return lastErr
startCrewRig = crewRig
startCrewAccount = crewAccount
return runStartCrew(cmd, []string{name})
} }
func runCrewRestart(cmd *cobra.Command, args []string) error { func runCrewRestart(cmd *cobra.Command, args []string) error {