fix(crew): default to --all when only rig name provided (gt-s8mpt)
gt crew start beads and gt crew stop beads now default to --all behavior when no crew names are specified, matching user expectations. - crew start: accepts 0-1 args (rig only) and starts all crew - crew stop: detects if single arg is a rig name vs crew name - Updated help text with new examples 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -246,25 +246,23 @@ var crewStartCmd = &cobra.Command{
|
|||||||
Long: `Start crew workers in a rig, creating workspaces if they don't exist.
|
Long: `Start crew workers in a rig, creating workspaces if they don't exist.
|
||||||
|
|
||||||
The rig name can be provided as the first argument, or inferred from the
|
The rig name can be provided as the first argument, or inferred from the
|
||||||
current directory. Optionally specify crew member names to start specific
|
current directory. If no crew names are specified, starts all crew in the rig.
|
||||||
workers, or use --all to start all crew members in the rig.
|
|
||||||
|
|
||||||
The crew session starts in the background with Claude running and ready.
|
The crew session starts in the background with Claude running and ready.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
gt crew start gastown joe # Start joe in gastown rig
|
gt crew start beads # Start all crew in beads rig
|
||||||
gt crew start gastown --all # Start all crew in gastown rig
|
gt crew start # Start all crew (rig inferred from cwd)
|
||||||
gt crew start --all # Start all crew (rig inferred from cwd)
|
gt crew start beads grip fang # Start specific crew in beads rig
|
||||||
gt crew start beads grip fang # Start grip and fang in beads rig`,
|
gt crew start gastown joe # Start joe in gastown rig`,
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
// With --all, we can have 0 args (infer rig) or 1+ args (rig specified)
|
// With --all, we can have 0 args (infer rig) or 1+ args (rig specified)
|
||||||
if crewAll {
|
if crewAll {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// Without --all, need at least rig and one crew name
|
// Allow: 0 args (infer rig, default to --all)
|
||||||
if len(args) < 2 {
|
// 1 arg (rig specified, default to --all)
|
||||||
return fmt.Errorf("requires rig and crew name, or use --all")
|
// 2+ args (rig + specific crew names)
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
RunE: runCrewStart,
|
RunE: runCrewStart,
|
||||||
@@ -275,8 +273,8 @@ var crewStopCmd = &cobra.Command{
|
|||||||
Short: "Stop crew workspace session(s)",
|
Short: "Stop crew workspace session(s)",
|
||||||
Long: `Stop one or more running crew workspace sessions.
|
Long: `Stop one or more running crew workspace sessions.
|
||||||
|
|
||||||
Kills the tmux session(s) for the specified crew member(s). Use --all to
|
If a rig name is given alone, stops all crew in that rig. Otherwise stops
|
||||||
stop all running crew sessions across all rigs.
|
the specified crew member(s).
|
||||||
|
|
||||||
The name can include the rig in slash format (e.g., beads/emma).
|
The name can include the rig in slash format (e.g., beads/emma).
|
||||||
If not specified, the rig is inferred from the current directory.
|
If not specified, the rig is inferred from the current directory.
|
||||||
@@ -285,11 +283,11 @@ Output is captured before stopping for debugging purposes (use --force
|
|||||||
to skip capture for faster shutdown).
|
to skip capture for faster shutdown).
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
gt crew stop dave # Stop dave's session
|
gt crew stop beads # Stop all crew in beads rig
|
||||||
gt crew stop beads/emma beads/grip # Stop multiple from specific rig
|
gt crew stop # Stop all crew (rig inferred from cwd)
|
||||||
|
gt crew stop beads/emma # Stop specific crew member
|
||||||
|
gt crew stop dave # Stop dave in current rig
|
||||||
gt crew stop --all # Stop all running crew sessions
|
gt crew stop --all # Stop all running crew sessions
|
||||||
gt crew stop --all --rig beads # Stop all crew in beads rig
|
|
||||||
gt crew stop --all --dry-run # Preview what would be stopped
|
|
||||||
gt crew stop dave --force # Stop without capturing output`,
|
gt crew stop dave --force # Stop without capturing output`,
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
if crewAll {
|
if crewAll {
|
||||||
@@ -298,9 +296,9 @@ Examples:
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if len(args) < 1 {
|
// Allow: 0 args (infer rig, default to --all)
|
||||||
return fmt.Errorf("requires at least 1 argument (or --all)")
|
// 1 arg (rig name → all in that rig, or crew name → specific crew)
|
||||||
}
|
// 1+ args (specific crew names)
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
RunE: runCrewStop,
|
RunE: runCrewStop,
|
||||||
|
|||||||
@@ -220,13 +220,13 @@ func runCrewRefresh(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
// runCrewStart starts crew workers in a rig.
|
// runCrewStart starts crew workers in a rig.
|
||||||
// args[0] is the rig name (optional if inferrable from cwd)
|
// args[0] is the rig name (optional if inferrable from cwd)
|
||||||
// args[1:] are crew member names (optional, or use --all flag)
|
// args[1:] are crew member names (optional - defaults to all if not specified)
|
||||||
func runCrewStart(cmd *cobra.Command, args []string) error {
|
func runCrewStart(cmd *cobra.Command, args []string) error {
|
||||||
var rigName string
|
var rigName string
|
||||||
var crewNames []string
|
var crewNames []string
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
// No args - infer rig from cwd (only valid with --all)
|
// No args - infer rig from cwd
|
||||||
rigName = "" // getCrewManager will infer from cwd
|
rigName = "" // getCrewManager will infer from cwd
|
||||||
} else {
|
} else {
|
||||||
rigName = args[0]
|
rigName = args[0]
|
||||||
@@ -241,8 +241,8 @@ func runCrewStart(cmd *cobra.Command, args []string) error {
|
|||||||
// Update rigName in case it was inferred
|
// Update rigName in case it was inferred
|
||||||
rigName = r.Name
|
rigName = r.Name
|
||||||
|
|
||||||
// If --all flag, get all crew members
|
// If --all flag OR no crew names specified, get all crew members
|
||||||
if crewAll {
|
if crewAll || len(crewNames) == 0 {
|
||||||
workers, err := crewMgr.List()
|
workers, err := crewMgr.List()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("listing crew: %w", err)
|
return fmt.Errorf("listing crew: %w", err)
|
||||||
@@ -543,13 +543,30 @@ func restartCrewSession(rigName, crewName, clonePath string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// runCrewStop stops one or more crew workers.
|
// runCrewStop stops one or more crew workers.
|
||||||
// Supports: "name", "rig/name" formats, or --all to stop all.
|
// Supports: "name", "rig/name" formats, "rig" (to stop all in rig), or --all.
|
||||||
func runCrewStop(cmd *cobra.Command, args []string) error {
|
func runCrewStop(cmd *cobra.Command, args []string) error {
|
||||||
// Handle --all flag
|
// Handle --all flag
|
||||||
if crewAll {
|
if crewAll {
|
||||||
return runCrewStopAll()
|
return runCrewStopAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle 0 args: default to all in inferred rig
|
||||||
|
if len(args) == 0 {
|
||||||
|
return runCrewStopAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle 1 arg without "/": check if it's a rig name
|
||||||
|
// If so, stop all crew in that rig
|
||||||
|
if len(args) == 1 && !strings.Contains(args[0], "/") {
|
||||||
|
// Try to interpret as rig name
|
||||||
|
if _, _, err := getRig(args[0]); err == nil {
|
||||||
|
// It's a valid rig name - stop all crew in that rig
|
||||||
|
crewRig = args[0]
|
||||||
|
return runCrewStopAll()
|
||||||
|
}
|
||||||
|
// Not a rig name - fall through to treat as crew name
|
||||||
|
}
|
||||||
|
|
||||||
var lastErr error
|
var lastErr error
|
||||||
t := tmux.NewTmux()
|
t := tmux.NewTmux()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user