fix: Role detection reads GT_RIG/GT_CREW env vars for crew identity
When GT_ROLE is set to a simple value like "crew", the role detection was not reading GT_RIG and GT_CREW to get the full identity. This caused gt mol status to show "/crew/" instead of "gastown/crew/max". Now GetRoleWithContext checks these additional env vars when the rig or polecat fields are empty after parsing the role string. Generated with Claude Code Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -155,6 +155,21 @@ func GetRoleWithContext(cwd, townRoot string) (RoleInfo, error) {
|
||||
info.Polecat = polecat
|
||||
info.Source = "env"
|
||||
|
||||
// For simple role strings like "crew" or "polecat", also check
|
||||
// GT_RIG and GT_CREW/GT_POLECAT env vars for the full identity
|
||||
if info.Rig == "" {
|
||||
if envRig := os.Getenv("GT_RIG"); envRig != "" {
|
||||
info.Rig = envRig
|
||||
}
|
||||
}
|
||||
if info.Polecat == "" {
|
||||
if envCrew := os.Getenv("GT_CREW"); envCrew != "" {
|
||||
info.Polecat = envCrew
|
||||
} else if envPolecat := os.Getenv("GT_POLECAT"); envPolecat != "" {
|
||||
info.Polecat = envPolecat
|
||||
}
|
||||
}
|
||||
|
||||
// Check for mismatch with cwd detection
|
||||
if cwdCtx.Role != RoleUnknown && cwdCtx.Role != parsedRole {
|
||||
info.Mismatch = true
|
||||
|
||||
Reference in New Issue
Block a user