From a4550163616b14c8eceda88353592277296797fe Mon Sep 17 00:00:00 2001 From: dave Date: Sun, 4 Jan 2026 22:26:49 -0800 Subject: [PATCH] fix(rig): infer rig name from cwd for 'gt rig status' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When no rig argument is provided, now uses GetRole() to detect the rig from the current directory or GT_ROLE environment variable. Shows a helpful error message if rig cannot be determined. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- internal/cmd/rig.go | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/internal/cmd/rig.go b/internal/cmd/rig.go index ffdd60bf..93644df2 100644 --- a/internal/cmd/rig.go +++ b/internal/cmd/rig.go @@ -177,10 +177,12 @@ Examples: } var rigStatusCmd = &cobra.Command{ - Use: "status ", + Use: "status [rig]", Short: "Show detailed status for a specific rig", Long: `Show detailed status for a specific rig including all workers. +If no rig is specified, infers the rig from the current directory. + Displays: - Rig information (name, path, beads prefix) - Witness status (running/stopped, uptime) @@ -189,9 +191,10 @@ Displays: - Crew members (name, branch, session status, git status) Examples: + gt rig status # Infer rig from current directory gt rig status gastown gt rig status beads`, - Args: cobra.ExactArgs(1), + Args: cobra.MaximumNArgs(1), RunE: runRigStatus, } @@ -996,7 +999,21 @@ func runRigReboot(cmd *cobra.Command, args []string) error { } func runRigStatus(cmd *cobra.Command, args []string) error { - rigName := args[0] + var rigName string + + if len(args) > 0 { + rigName = args[0] + } else { + // Infer rig from current directory + roleInfo, err := GetRole() + if err != nil { + return fmt.Errorf("detecting rig from current directory: %w", err) + } + if roleInfo.Rig == "" { + return fmt.Errorf("could not detect rig from current directory; please specify rig name") + } + rigName = roleInfo.Rig + } // Get rig townRoot, r, err := getRig(rigName)