feat: Allow starting multiple crew members at once
gt crew start beads/grip beads/fang beads/wolf now works
This commit is contained in:
@@ -233,9 +233,9 @@ var crewPrevCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
var crewStartCmd = &cobra.Command{
|
||||
Use: "start [name]",
|
||||
Short: "Start a crew workspace (creates if needed)",
|
||||
Long: `Start a crew workspace, creating it if it doesn't exist.
|
||||
Use: "start [name...]",
|
||||
Short: "Start crew workspace(s) (creates if needed)",
|
||||
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'.
|
||||
The crew session starts in the background with Claude running and ready.
|
||||
@@ -249,11 +249,11 @@ Role Discovery:
|
||||
workspace automatically.
|
||||
|
||||
Examples:
|
||||
gt crew start joe # Start joe in current 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 # Auto-detect from cwd`,
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
gt crew start joe # Start joe in current rig
|
||||
gt crew start gastown/joe # Start joe in gastown rig
|
||||
gt crew start beads/grip beads/fang # Start multiple crew members
|
||||
gt crew start joe --rig beads # Start joe in beads rig
|
||||
gt crew start # Auto-detect from cwd`,
|
||||
RunE: runCrewStart,
|
||||
}
|
||||
|
||||
|
||||
@@ -176,12 +176,28 @@ func runCrewRefresh(cmd *cobra.Command, args []string) error {
|
||||
|
||||
// runCrewStart is an alias for runStartCrew, handling multiple input formats.
|
||||
// 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 {
|
||||
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
|
||||
if len(args) > 0 {
|
||||
name = args[0]
|
||||
startCrewRig = crewRig
|
||||
startCrewAccount = crewAccount
|
||||
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")
|
||||
if strings.Contains(name, "/crew/") {
|
||||
parts := strings.SplitN(name, "/crew/", 2)
|
||||
@@ -189,24 +205,18 @@ func runCrewStart(cmd *cobra.Command, args []string) error {
|
||||
name = parts[0] + "/" + parts[1]
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Try to detect from current directory
|
||||
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)
|
||||
|
||||
// Set the start.go flags from crew.go flags before calling
|
||||
startCrewRig = crewRig
|
||||
startCrewAccount = crewAccount
|
||||
|
||||
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
|
||||
startCrewRig = crewRig
|
||||
startCrewAccount = crewAccount
|
||||
|
||||
return runStartCrew(cmd, []string{name})
|
||||
return lastErr
|
||||
}
|
||||
|
||||
func runCrewRestart(cmd *cobra.Command, args []string) error {
|
||||
|
||||
Reference in New Issue
Block a user