From 9d09a1f540882371e02c174d955054df91888ce3 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Sun, 28 Dec 2025 00:54:27 -0800 Subject: [PATCH] fix: Make sling target path parsing more forgiving (gt-e0u3r) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now accepts: - gastown/nux (polecat shorthand) - gastown/Nux (case-insensitive) - gastown/polecats/nux (explicit path) - gastown/crew/max (unchanged) - gastown/witness (unchanged) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- internal/cmd/handoff.go | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/internal/cmd/handoff.go b/internal/cmd/handoff.go index d5f1bd10..33a9c43b 100644 --- a/internal/cmd/handoff.go +++ b/internal/cmd/handoff.go @@ -236,6 +236,8 @@ func resolveRoleToSession(role string) (string, error) { // - /crew/ -> gt--crew- // - /witness -> gt--witness // - /refinery -> gt--refinery +// - /polecats/ -> gt-- (explicit polecat) +// - / -> gt-- (polecat shorthand, if name isn't a known role) func resolvePathToSession(path string) (string, error) { parts := strings.Split(path, "/") @@ -246,11 +248,21 @@ func resolvePathToSession(path string) (string, error) { return fmt.Sprintf("gt-%s-crew-%s", rig, name), nil } - // Handle / format (witness, refinery) + // Handle /polecats/ format (explicit polecat path) + if len(parts) == 3 && parts[1] == "polecats" { + rig := parts[0] + name := strings.ToLower(parts[2]) // normalize polecat name + return fmt.Sprintf("gt-%s-%s", rig, name), nil + } + + // Handle / format if len(parts) == 2 { rig := parts[0] - role := strings.ToLower(parts[1]) - switch role { + second := parts[1] + secondLower := strings.ToLower(second) + + // Check for known roles first + switch secondLower { case "witness": return fmt.Sprintf("gt-%s-witness", rig), nil case "refinery": @@ -258,10 +270,16 @@ func resolvePathToSession(path string) (string, error) { case "crew": // Just "/crew" without a name - need more info return "", fmt.Errorf("crew path requires name: %s/crew/", rig) + case "polecats": + // Just "/polecats" without a name - need more info + return "", fmt.Errorf("polecats path requires name: %s/polecats/", rig) + default: + // Not a known role - treat as polecat name (e.g., gastown/nux) + return fmt.Sprintf("gt-%s-%s", rig, secondLower), nil } } - return "", fmt.Errorf("cannot parse path '%s' - expected /crew/, /witness, or /refinery", path) + return "", fmt.Errorf("cannot parse path '%s' - expected /, /crew/, /witness, or /refinery", path) } // buildRestartCommand creates the command to run when respawning a session's pane.