Add static mailing list support (list:name syntax) (gt-2rfvq)
Implement static mailing list expansion for the mail system: - Add list:name address syntax (e.g., list:oncall) - Load lists from ~/gt/config/messaging.json - Fan-out delivery: each list member gets their own message copy - Clear error handling for unknown list names - Add tests for list detection, parsing, and expansion - Update gt mail send help text with list:name documentation - Show recipients in output when sending to a list Example: gt mail send list:oncall -s "Alert" -m "System down" # Expands to: mayor/, gastown/witness # Creates 2 message copies 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -93,6 +93,11 @@ Addresses:
|
||||
<rig>/refinery - Send to a rig's Refinery
|
||||
<rig>/<polecat> - Send to a specific polecat
|
||||
<rig>/ - Broadcast to a rig
|
||||
list:<name> - Send to a mailing list (fans out to all members)
|
||||
|
||||
Mailing lists are defined in ~/gt/config/messaging.json and allow
|
||||
sending to multiple recipients at once. Each recipient gets their
|
||||
own copy of the message.
|
||||
|
||||
Message types:
|
||||
task - Required processing
|
||||
@@ -117,7 +122,8 @@ Examples:
|
||||
gt mail send gastown/Toast -s "Urgent" -m "Help!" --urgent
|
||||
gt mail send mayor/ -s "Re: Status" -m "Done" --reply-to msg-abc123
|
||||
gt mail send --self -s "Handoff" -m "Context for next session"
|
||||
gt mail send gastown/Toast -s "Update" -m "Progress report" --cc overseer`,
|
||||
gt mail send gastown/Toast -s "Update" -m "Progress report" --cc overseer
|
||||
gt mail send list:oncall -s "Alert" -m "System down"`,
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: runMailSend,
|
||||
}
|
||||
@@ -381,6 +387,17 @@ func runMailSend(cmd *cobra.Command, args []string) error {
|
||||
|
||||
// Send via router
|
||||
router := mail.NewRouter(workDir)
|
||||
|
||||
// Check if this is a list address to show fan-out details
|
||||
var listRecipients []string
|
||||
if strings.HasPrefix(to, "list:") {
|
||||
var err error
|
||||
listRecipients, err = router.ExpandListAddress(to)
|
||||
if err != nil {
|
||||
return fmt.Errorf("sending message: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := router.Send(msg); err != nil {
|
||||
return fmt.Errorf("sending message: %w", err)
|
||||
}
|
||||
@@ -390,6 +407,12 @@ func runMailSend(cmd *cobra.Command, args []string) error {
|
||||
|
||||
fmt.Printf("%s Message sent to %s\n", style.Bold.Render("✓"), to)
|
||||
fmt.Printf(" Subject: %s\n", mailSubject)
|
||||
|
||||
// Show fan-out recipients for list addresses
|
||||
if len(listRecipients) > 0 {
|
||||
fmt.Printf(" Recipients: %s\n", strings.Join(listRecipients, ", "))
|
||||
}
|
||||
|
||||
if len(msg.CC) > 0 {
|
||||
fmt.Printf(" CC: %s\n", strings.Join(msg.CC, ", "))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user