From 1c8e936172deb7f0b336dd244766f5c7dfb0fccd Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Mon, 29 Dec 2025 12:44:17 -0800 Subject: [PATCH] fix: Add refinery/witness identity detection to detectSender (gt-agtwd) --- internal/cmd/mail.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/internal/cmd/mail.go b/internal/cmd/mail.go index 74d8f54c..5ee667e4 100644 --- a/internal/cmd/mail.go +++ b/internal/cmd/mail.go @@ -726,6 +726,24 @@ func detectSender() string { } } + // If in a rig's refinery directory, extract address (format: rig/refinery) + if strings.Contains(cwd, "/refinery") { + parts := strings.Split(cwd, "/refinery") + if len(parts) >= 1 { + rigName := filepath.Base(parts[0]) + return fmt.Sprintf("%s/refinery", rigName) + } + } + + // If in a rig's witness directory, extract address (format: rig/witness) + if strings.Contains(cwd, "/witness") { + parts := strings.Split(cwd, "/witness") + if len(parts) >= 1 { + rigName := filepath.Base(parts[0]) + return fmt.Sprintf("%s/witness", rigName) + } + } + // Default to mayor return "mayor/" }