From 1508177d9a96bbb94a2430f57e172ebe3d2eca29 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Sun, 4 Jan 2026 22:10:24 -0800 Subject: [PATCH] fix(crew): infer rig from cwd for 'gt crew start --all' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- internal/cmd/crew.go | 19 +++++++++++-------- internal/cmd/crew_lifecycle.go | 18 ++++++++++++++---- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/internal/cmd/crew.go b/internal/cmd/crew.go index a62e926b..c7abdf78 100644 --- a/internal/cmd/crew.go +++ b/internal/cmd/crew.go @@ -240,27 +240,30 @@ var crewPrevCmd = &cobra.Command{ } var crewStartCmd = &cobra.Command{ - Use: "start [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 }, diff --git a/internal/cmd/crew_lifecycle.go b/internal/cmd/crew_lifecycle.go index 130ecd4f..4424e0f2 100644 --- a/internal/cmd/crew_lifecycle.go +++ b/internal/cmd/crew_lifecycle.go @@ -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 {