Merge beads-sync branch
Sync beads changes and code updates. Generated with Claude Code Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,9 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@@ -129,6 +131,16 @@ func runHandoff(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
fmt.Printf("%s Sent %s request to %s\n", style.Bold.Render("✓"), action, manager)
|
||||
|
||||
// Signal daemon for immediate processing (if manager is deacon)
|
||||
if manager == "deacon/" {
|
||||
if err := signalDaemon(townRoot); err != nil {
|
||||
// Non-fatal: daemon will eventually poll
|
||||
fmt.Printf("%s Could not signal daemon (will poll): %v\n", style.Dim.Render("○"), err)
|
||||
} else {
|
||||
fmt.Printf("%s Signaled daemon for immediate processing\n", style.Bold.Render("✓"))
|
||||
}
|
||||
}
|
||||
|
||||
// Set requesting state
|
||||
if err := setRequestingState(role, action, townRoot); err != nil {
|
||||
fmt.Printf("Warning: failed to set state: %v\n", err)
|
||||
@@ -457,3 +469,28 @@ func setRequestingState(role Role, action HandoffAction, townRoot string) error
|
||||
|
||||
return os.WriteFile(stateFile, data, 0644)
|
||||
}
|
||||
|
||||
// signalDaemon sends SIGUSR1 to the daemon to trigger immediate lifecycle processing.
|
||||
func signalDaemon(townRoot string) error {
|
||||
pidFile := filepath.Join(townRoot, "daemon", "daemon.pid")
|
||||
data, err := os.ReadFile(pidFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("reading daemon PID: %w", err)
|
||||
}
|
||||
|
||||
pid, err := strconv.Atoi(strings.TrimSpace(string(data)))
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing daemon PID: %w", err)
|
||||
}
|
||||
|
||||
process, err := os.FindProcess(pid)
|
||||
if err != nil {
|
||||
return fmt.Errorf("finding daemon process: %w", err)
|
||||
}
|
||||
|
||||
if err := process.Signal(syscall.SIGUSR1); err != nil {
|
||||
return fmt.Errorf("signaling daemon: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ var (
|
||||
mailBody string
|
||||
mailPriority int
|
||||
mailUrgent bool
|
||||
mailPinned bool
|
||||
mailType string
|
||||
mailReplyTo string
|
||||
mailNotify bool
|
||||
@@ -180,6 +181,7 @@ func init() {
|
||||
mailSendCmd.Flags().StringVar(&mailType, "type", "notification", "Message type (task, scavenge, notification, reply)")
|
||||
mailSendCmd.Flags().StringVar(&mailReplyTo, "reply-to", "", "Message ID this is replying to")
|
||||
mailSendCmd.Flags().BoolVarP(&mailNotify, "notify", "n", false, "Send tmux notification to recipient")
|
||||
mailSendCmd.Flags().BoolVar(&mailPinned, "pinned", false, "Pin message (for handoff context that persists)")
|
||||
_ = mailSendCmd.MarkFlagRequired("subject")
|
||||
|
||||
// Inbox flags
|
||||
@@ -250,6 +252,9 @@ func runMailSend(cmd *cobra.Command, args []string) error {
|
||||
// Set message type
|
||||
msg.Type = mail.ParseMessageType(mailType)
|
||||
|
||||
// Set pinned flag
|
||||
msg.Pinned = mailPinned
|
||||
|
||||
// Handle reply-to: auto-set type to reply and look up thread
|
||||
if mailReplyTo != "" {
|
||||
msg.ReplyTo = mailReplyTo
|
||||
@@ -594,7 +599,7 @@ func runMailCheck(cmd *cobra.Command, args []string) error {
|
||||
messages, _ := mailbox.ListUnread()
|
||||
var subjects []string
|
||||
for _, msg := range messages {
|
||||
subjects = append(subjects, fmt.Sprintf("- From %s: %s", msg.From, msg.Subject))
|
||||
subjects = append(subjects, fmt.Sprintf("- %s from %s: %s", msg.ID, msg.From, msg.Subject))
|
||||
}
|
||||
|
||||
fmt.Println("<system-reminder>")
|
||||
|
||||
Reference in New Issue
Block a user