fix(polecat): Require rig/polecat format for nuke and remove commands

Previously, when running `gt polecat nuke <name> <rig>`, 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
`<rig>/<polecat>` format and preventing this misinterpretation.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
capable
2026-01-02 13:51:42 -08:00
committed by Steve Yegge
parent 2199bdffea
commit 579c11379a

View File

@@ -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)