fix(sling): resolve crew members correctly with shorthand paths

When using gastown/max style paths, resolvePathToSession was treating
all non-role names as polecats, generating gt-gastown-max instead of
gt-gastown-crew-max.

Now checks if <townRoot>/<rig>/crew/<name> exists before defaulting
to polecat format. This fixes gt sling to crew members using the
shorthand rig/name syntax.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gastown/crew/joe
2026-01-12 03:03:55 -08:00
committed by beads/crew/emma
parent 605eeec84e
commit 716bab396f

View File

@@ -316,7 +316,17 @@ func resolvePathToSession(path string) (string, error) {
// Just "<rig>/polecats" without a name - need more info
return "", fmt.Errorf("polecats path requires name: %s/polecats/<name>", rig)
default:
// Not a known role - treat as polecat name (e.g., gastown/nux)
// Not a known role - check if it's a crew member before assuming polecat.
// Crew members exist at <townRoot>/<rig>/crew/<name>.
// This fixes: gt sling gt-375 gastown/max failing because max is crew, not polecat.
townRoot := detectTownRootFromCwd()
if townRoot != "" {
crewPath := filepath.Join(townRoot, rig, "crew", second)
if info, err := os.Stat(crewPath); err == nil && info.IsDir() {
return fmt.Sprintf("gt-%s-crew-%s", rig, second), nil
}
}
// Not a crew member - treat as polecat name (e.g., gastown/nux)
return fmt.Sprintf("gt-%s-%s", rig, secondLower), nil
}
}