fix: Detect mayor role from any rig's mayor/ folder (gt-0nh8)

Previously gt prime only detected the Mayor role from town root (~/gt) or
~/gt/mayor/. Now it also detects Mayor from <rig>/mayor/ paths like
~/gt/gastown/mayor/rig, enabling mayor sessions to work correctly
regardless of which rig directory they're attached to.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-29 23:56:07 -08:00
parent c435058f98
commit efaa344d6f

View File

@@ -38,7 +38,7 @@ var primeCmd = &cobra.Command{
Long: `Detect the agent role from the current directory and output context.
Role detection:
- Town root or mayor/rig/ → Mayor context
- Town root, mayor/, or <rig>/mayor/ → Mayor context
- <rig>/witness/rig/ → Witness context
- <rig>/refinery/rig/ → Refinery context
- <rig>/polecats/<name>/ → Polecat context
@@ -186,6 +186,12 @@ func detectRole(cwd, townRoot string) RoleInfo {
rigName := parts[0]
ctx.Rig = rigName
// Check for mayor: <rig>/mayor/ or <rig>/mayor/rig/
if len(parts) >= 2 && parts[1] == "mayor" {
ctx.Role = RoleMayor
return ctx
}
// Check for witness: <rig>/witness/rig/
if len(parts) >= 2 && parts[1] == "witness" {
ctx.Role = RoleWitness