Instrument gt commands to emit events to activity feed (gt-7aw1m)

Add events.LogFeed calls to the following gt commands:
- nudge.go: Log TypeNudge events when nudging agents
- unsling.go: Log TypeUnhook events when removing work from hooks
- up.go: Log TypeBoot events when starting Gas Town services
- down.go: Log TypeHalt events when stopping Gas Town services
- stop.go: Log TypeKill events when stopping polecat sessions
- polecat_spawn.go: Log TypeSpawn events when spawning polecats

Also add helper functions to events package:
- UnhookPayload: Creates payload for unhook events
- KillPayload: Creates payload for kill events
- HaltPayload: Creates payload for halt events

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-30 10:40:54 -08:00
parent 3cd849e981
commit 907eba7194
7 changed files with 57 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import (
"github.com/spf13/cobra"
"github.com/steveyegge/gastown/internal/daemon"
"github.com/steveyegge/gastown/internal/events"
"github.com/steveyegge/gastown/internal/style"
"github.com/steveyegge/gastown/internal/tmux"
"github.com/steveyegge/gastown/internal/workspace"
@@ -112,6 +113,15 @@ func runDown(cmd *cobra.Command, args []string) error {
fmt.Println()
if allOK {
fmt.Printf("%s All services stopped\n", style.Bold.Render("✓"))
// Log halt event with stopped services
stoppedServices := []string{"daemon", "deacon", "mayor"}
for _, rigName := range rigs {
stoppedServices = append(stoppedServices, fmt.Sprintf("%s/witness", rigName))
}
if downAll {
stoppedServices = append(stoppedServices, "tmux-server")
}
_ = events.LogFeed(events.TypeHalt, "gt", events.HaltPayload(stoppedServices))
} else {
fmt.Printf("%s Some services failed to stop\n", style.Bold.Render("✗"))
return fmt.Errorf("not all services stopped")