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:
joe
2026-01-05 16:32:22 -08:00
committed by Steve Yegge
parent 5be232ff8c
commit d34e9b006c
2 changed files with 39 additions and 24 deletions

View File

@@ -246,25 +246,23 @@ var crewStartCmd = &cobra.Command{
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
current directory. Optionally specify crew member names to start specific
workers, or use --all to start all crew members in the rig.
current directory. If no crew names are specified, starts all crew in the rig.
The crew session starts in the background with Claude running and ready.
Examples:
gt crew start gastown joe # Start joe in gastown rig
gt crew start gastown --all # Start all crew in gastown rig
gt crew start --all # Start all crew (rig inferred from cwd)
gt crew start beads grip fang # Start grip and fang in beads rig`,
gt crew start beads # Start all crew in beads rig
gt crew start # Start all crew (rig inferred from cwd)
gt crew start beads grip fang # Start specific crew in beads rig
gt crew start gastown joe # Start joe in gastown rig`,
Args: func(cmd *cobra.Command, args []string) error {
// With --all, we can have 0 args (infer rig) or 1+ args (rig specified)
if crewAll {
return nil
}
// Without --all, need at least rig and one crew name
if len(args) < 2 {
return fmt.Errorf("requires rig and crew name, or use --all")
}
// Allow: 0 args (infer rig, default to --all)
// 1 arg (rig specified, default to --all)
// 2+ args (rig + specific crew names)
return nil
},
RunE: runCrewStart,
@@ -275,8 +273,8 @@ var crewStopCmd = &cobra.Command{
Short: "Stop crew workspace session(s)",
Long: `Stop one or more running crew workspace sessions.
Kills the tmux session(s) for the specified crew member(s). Use --all to
stop all running crew sessions across all rigs.
If a rig name is given alone, stops all crew in that rig. Otherwise stops
the specified crew member(s).
The name can include the rig in slash format (e.g., beads/emma).
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).
Examples:
gt crew stop dave # Stop dave's session
gt crew stop beads/emma beads/grip # Stop multiple from specific rig
gt crew stop beads # Stop all crew in beads 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 --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`,
Args: func(cmd *cobra.Command, args []string) error {
if crewAll {
@@ -298,9 +296,9 @@ Examples:
}
return nil
}
if len(args) < 1 {
return fmt.Errorf("requires at least 1 argument (or --all)")
}
// Allow: 0 args (infer rig, default to --all)
// 1 arg (rig name → all in that rig, or crew name → specific crew)
// 1+ args (specific crew names)
return nil
},
RunE: runCrewStop,

View File

@@ -220,13 +220,13 @@ func runCrewRefresh(cmd *cobra.Command, args []string) error {
// runCrewStart starts crew workers in a rig.
// 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 {
var rigName string
var crewNames []string
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
} else {
rigName = args[0]
@@ -241,8 +241,8 @@ func runCrewStart(cmd *cobra.Command, args []string) error {
// Update rigName in case it was inferred
rigName = r.Name
// If --all flag, get all crew members
if crewAll {
// If --all flag OR no crew names specified, get all crew members
if crewAll || len(crewNames) == 0 {
workers, err := crewMgr.List()
if err != nil {
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.
// 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 {
// Handle --all flag
if crewAll {
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
t := tmux.NewTmux()