From 579c11379aba7244d3448d71dffa80d1d8f2e1a4 Mon Sep 17 00:00:00 2001 From: capable Date: Fri, 2 Jan 2026 13:51:42 -0800 Subject: [PATCH] fix(polecat): Require rig/polecat format for nuke and remove commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, when running `gt polecat nuke `, the parseAddress function would infer the rig from cwd for each argument, causing a plain rig name to be misinterpreted as a polecat name. For example, running from a gastown directory: gt polecat nuke angharad gastown --force Would try to nuke both gastown/angharad AND gastown/gastown. Now both runPolecatNuke and runPolecatRemove validate that each address argument contains "/" before parsing, enforcing the documented `/` format and preventing this misinterpretation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- internal/cmd/polecat.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/internal/cmd/polecat.go b/internal/cmd/polecat.go index 18f068fc..a5862426 100644 --- a/internal/cmd/polecat.go +++ b/internal/cmd/polecat.go @@ -523,8 +523,13 @@ func runPolecatRemove(cmd *cobra.Command, args []string) error { }) } } else { - // Multiple rig/polecat arguments + // Multiple rig/polecat arguments - require explicit rig/polecat format for _, arg := range args { + // Validate format: must contain "/" to avoid misinterpreting rig names as polecat names + if !strings.Contains(arg, "/") { + return fmt.Errorf("invalid address '%s': must be in 'rig/polecat' format (e.g., 'gastown/Toast')", arg) + } + rigName, polecatName, err := parseAddress(arg) if err != nil { return fmt.Errorf("invalid address '%s': %w", arg, err) @@ -1324,8 +1329,13 @@ func runPolecatNuke(cmd *cobra.Command, args []string) error { }) } } else { - // Multiple rig/polecat arguments + // Multiple rig/polecat arguments - require explicit rig/polecat format for _, arg := range args { + // Validate format: must contain "/" to avoid misinterpreting rig names as polecat names + if !strings.Contains(arg, "/") { + return fmt.Errorf("invalid address '%s': must be in 'rig/polecat' format (e.g., 'gastown/Toast')", arg) + } + rigName, polecatName, err := parseAddress(arg) if err != nil { return fmt.Errorf("invalid address '%s': %w", arg, err)