From 60176bd9f1ee751e3b69721a5048b33a3dc9c937 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Sun, 28 Dec 2025 02:17:09 -0800 Subject: [PATCH] feat: polecat remove accepts just name when in rig context parseAddress now infers rig from cwd when no slash in address. Makes 'gt polecat remove slit' work from within gastown/. --- internal/cmd/session.go | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/internal/cmd/session.go b/internal/cmd/session.go index e57abb47..9754e12f 100644 --- a/internal/cmd/session.go +++ b/internal/cmd/session.go @@ -182,12 +182,25 @@ func init() { } // parseAddress parses "rig/polecat" format. +// If no "/" is present, attempts to infer rig from current directory. func parseAddress(addr string) (rigName, polecatName string, err error) { parts := strings.SplitN(addr, "/", 2) - if len(parts) != 2 || parts[0] == "" || parts[1] == "" { - return "", "", fmt.Errorf("invalid address format: expected 'rig/polecat', got '%s'", addr) + if len(parts) == 2 && parts[0] != "" && parts[1] != "" { + return parts[0], parts[1], nil } - return parts[0], parts[1], nil + + // No slash - try to infer rig from cwd + if !strings.Contains(addr, "/") && addr != "" { + townRoot, err := workspace.FindFromCwd() + if err == nil && townRoot != "" { + inferredRig, err := inferRigFromCwd(townRoot) + if err == nil && inferredRig != "" { + return inferredRig, addr, nil + } + } + } + + return "", "", fmt.Errorf("invalid address format: expected 'rig/polecat', got '%s'", addr) } // getSessionManager creates a session manager for the given rig.