Files
gastown/internal/cmd/commit_test.go
gastown/crew/jack 60da5de104 feat(identity): add gt commit wrapper and gt trail command
gt-f6mkz: Agent git identity
- Add `gt commit` wrapper that sets git author from agent identity
- Identity mapping: gastown/crew/jack → gastown.crew.jack@gastown.local
- Add `agent_email_domain` to TownSettings (default: gastown.local)
- Add `gt config agent-email-domain` command to manage domain

gt-j1m5v: gt trail command
- Add `gt trail` with aliases `gt recent` and `gt recap`
- Subcommands: commits, beads, hooks
- Flags: --since, --limit, --json, --all
- Filter commits by agent email domain

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 19:34:29 -08:00

72 lines
1.6 KiB
Go

package cmd
import "testing"
func TestIdentityToEmail(t *testing.T) {
tests := []struct {
name string
identity string
domain string
want string
}{
{
name: "crew member",
identity: "gastown/crew/jack",
domain: "gastown.local",
want: "gastown.crew.jack@gastown.local",
},
{
name: "polecat",
identity: "gastown/polecats/max",
domain: "gastown.local",
want: "gastown.polecats.max@gastown.local",
},
{
name: "witness",
identity: "gastown/witness",
domain: "gastown.local",
want: "gastown.witness@gastown.local",
},
{
name: "refinery",
identity: "gastown/refinery",
domain: "gastown.local",
want: "gastown.refinery@gastown.local",
},
{
name: "mayor with trailing slash",
identity: "mayor/",
domain: "gastown.local",
want: "mayor@gastown.local",
},
{
name: "deacon with trailing slash",
identity: "deacon/",
domain: "gastown.local",
want: "deacon@gastown.local",
},
{
name: "custom domain",
identity: "myrig/crew/alice",
domain: "example.com",
want: "myrig.crew.alice@example.com",
},
{
name: "deeply nested",
identity: "rig/polecats/nested/deep",
domain: "test.io",
want: "rig.polecats.nested.deep@test.io",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := identityToEmail(tt.identity, tt.domain)
if got != tt.want {
t.Errorf("identityToEmail(%q, %q) = %q, want %q",
tt.identity, tt.domain, got, tt.want)
}
})
}
}