fix(costs): derive session name for mayor/deacon without GT_TOWN
Error: Ran 1 stop hook
⎿ Stop hook error: Failed with non-blocking status code: Error: --session flag required (or set GT_SESSION env var, or GT_RIG/GT_ROLE)
Usage:
gt costs record [flags]
deriveSessionName() now falls back to gt-{role} when GT_ROLE is mayor
or deacon but GT_TOWN is not set. Previously this case returned empty
string, causing the Stop hook to fail.
This commit is contained in:
@@ -649,9 +649,13 @@ func deriveSessionName() string {
|
||||
return fmt.Sprintf("gt-%s-crew-%s", rig, crew)
|
||||
}
|
||||
|
||||
// Town-level roles (mayor, deacon): gt-{town}-{role}
|
||||
if (role == "mayor" || role == "deacon") && town != "" {
|
||||
return fmt.Sprintf("gt-%s-%s", town, role)
|
||||
// Town-level roles (mayor, deacon): gt-{town}-{role} or gt-{role}
|
||||
if role == "mayor" || role == "deacon" {
|
||||
if town != "" {
|
||||
return fmt.Sprintf("gt-%s-%s", town, role)
|
||||
}
|
||||
// No town set - use simple gt-{role} pattern
|
||||
return fmt.Sprintf("gt-%s", role)
|
||||
}
|
||||
|
||||
// Rig-based roles (witness, refinery): gt-{rig}-{role}
|
||||
|
||||
Reference in New Issue
Block a user