From c1954b3431b6aedde84eb99b0189c6fd59e7330c Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Thu, 18 Dec 2025 20:41:52 -0800 Subject: [PATCH] fix(crew): use strings.Split instead of filepath.SplitList for path parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit filepath.SplitList is for PATH-like env vars (colon/semicolon separated), not for splitting file paths. This caused inferRigFromCwd to always fail since SplitList returns the whole path as one element, making the fallback logic never trigger. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- internal/cmd/crew.go | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/internal/cmd/crew.go b/internal/cmd/crew.go index 5e21696f..624c3fb8 100644 --- a/internal/cmd/crew.go +++ b/internal/cmd/crew.go @@ -291,19 +291,12 @@ func inferRigFromCwd(townRoot string) (string, error) { return "", fmt.Errorf("not in workspace") } - // First component should be the rig name - parts := filepath.SplitList(rel) - if len(parts) == 0 { - // Split on path separator instead - for i := 0; i < len(rel); i++ { - if rel[i] == filepath.Separator { - return rel[:i], nil - } - } - // No separator found, entire rel is the rig name - if rel != "" && rel != "." { - return rel, nil - } + // Normalize and split path - first component is the rig name + rel = filepath.ToSlash(rel) + parts := strings.Split(rel, "/") + + if len(parts) > 0 && parts[0] != "" && parts[0] != "." { + return parts[0], nil } return "", fmt.Errorf("could not infer rig from current directory")