fix(rig): infer rig name from cwd for 'gt rig status'

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 <noreply@anthropic.com>
This commit is contained in:
dave
2026-01-04 22:26:49 -08:00
committed by beads/crew/dave
parent cfdce55770
commit a455016361

View File

@@ -177,10 +177,12 @@ Examples:
}
var rigStatusCmd = &cobra.Command{
Use: "status <rig>",
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)