fix: Make Mayor/Deacon session names include town name
Session names `gt-mayor` and `gt-deacon` were hardcoded, causing tmux
session name collisions when running multiple towns simultaneously.
Changed to `gt-{town}-mayor` and `gt-{town}-deacon` format (e.g.,
`gt-ai-mayor`) to allow concurrent multi-town operation.
Key changes:
- session.MayorSessionName() and DeaconSessionName() now take townName param
- Added workspace.GetTownName() helper to load town name from config
- Updated all callers in cmd/, daemon/, doctor/, mail/, rig/, templates/
- Updated tests with new session name format
- Bead IDs remain unchanged (already scoped by .beads/ directory)
Fixes #60
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,18 +8,42 @@ import (
|
||||
)
|
||||
|
||||
func TestMayorSessionName(t *testing.T) {
|
||||
want := "gt-mayor"
|
||||
got := MayorSessionName()
|
||||
if got != want {
|
||||
t.Errorf("MayorSessionName() = %q, want %q", got, want)
|
||||
tests := []struct {
|
||||
townName string
|
||||
want string
|
||||
}{
|
||||
{"ai", "gt-ai-mayor"},
|
||||
{"alpha", "gt-alpha-mayor"},
|
||||
{"gastown", "gt-gastown-mayor"},
|
||||
{"", "gt--mayor"}, // empty town name
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.townName, func(t *testing.T) {
|
||||
got := MayorSessionName(tt.townName)
|
||||
if got != tt.want {
|
||||
t.Errorf("MayorSessionName(%q) = %q, want %q", tt.townName, got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeaconSessionName(t *testing.T) {
|
||||
want := "gt-deacon"
|
||||
got := DeaconSessionName()
|
||||
if got != want {
|
||||
t.Errorf("DeaconSessionName() = %q, want %q", got, want)
|
||||
tests := []struct {
|
||||
townName string
|
||||
want string
|
||||
}{
|
||||
{"ai", "gt-ai-deacon"},
|
||||
{"alpha", "gt-alpha-deacon"},
|
||||
{"gastown", "gt-gastown-deacon"},
|
||||
{"", "gt--deacon"}, // empty town name
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.townName, func(t *testing.T) {
|
||||
got := DeaconSessionName(tt.townName)
|
||||
if got != tt.want {
|
||||
t.Errorf("DeaconSessionName(%q) = %q, want %q", tt.townName, got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user