fix(crew): infer rig from cwd for 'gt crew start --all'

The crew start command now infers the rig name from the current
working directory when using --all without specifying a rig. This
matches the behavior of crew stop and other commands.

Before: gt crew start gastown --all (required)
After:  gt crew start --all (infers from cwd)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2026-01-04 22:10:24 -08:00
parent f0c94db99e
commit 1508177d9a
2 changed files with 25 additions and 12 deletions

View File

@@ -240,27 +240,30 @@ var crewPrevCmd = &cobra.Command{
}
var crewStartCmd = &cobra.Command{
Use: "start <rig> [name]",
Use: "start [rig] [name...]",
Aliases: []string{"spawn"},
Short: "Start crew worker(s) in a rig",
Long: `Start crew workers in a rig, creating workspaces if they don't exist.
Takes the rig name as the first argument. Optionally specify a crew member name
to start just that worker, or use --all to start all crew members in the rig.
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.
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 beads # Error: specify name or --all
gt crew start --all # Start all crew (rig inferred from cwd)
gt crew start beads grip fang # Start grip and fang in beads rig`,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("requires at least 1 argument: the rig name")
// With --all, we can have 0 args (infer rig) or 1+ args (rig specified)
if crewAll {
return nil
}
if len(args) == 1 && !crewAll {
return fmt.Errorf("specify a crew member name or use --all to start all crew in the rig")
// 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")
}
return nil
},

View File

@@ -219,17 +219,27 @@ func runCrewRefresh(cmd *cobra.Command, args []string) error {
}
// runCrewStart starts crew workers in a rig.
// args[0] is the rig name (required)
// args[0] is the rig name (optional if inferrable from cwd)
// args[1:] are crew member names (optional, or use --all flag)
func runCrewStart(cmd *cobra.Command, args []string) error {
rigName := args[0]
crewNames := args[1:]
var rigName string
var crewNames []string
// Get the rig manager and rig
if len(args) == 0 {
// No args - infer rig from cwd (only valid with --all)
rigName = "" // getCrewManager will infer from cwd
} else {
rigName = args[0]
crewNames = args[1:]
}
// Get the rig manager and rig (infers from cwd if rigName is empty)
crewMgr, r, err := getCrewManager(rigName)
if err != nil {
return err
}
// Update rigName in case it was inferred
rigName = r.Name
// If --all flag, get all crew members
if crewAll {