Add support for displaying gt events (from ~/gt/.events.jsonl) in the gt feed TUI, including witness patrol activity: - Add event symbols for patrol events (patrol_started, patrol_complete, polecat_checked, polecat_nudged, escalation_sent), merge events, and general gt events (sling, hook, handoff, mail, spawn, etc.) - Create GtEventsSource that parses .events.jsonl format with proper extraction of rig/role from actor paths and human-readable message generation from event payloads - Create CombinedSource that merges multiple event sources (bd activity and gt events) using fan-in pattern - Update feed command to use combined source for TUI mode - Add appropriate styling for new event types (nudges/escalations in red, patrol complete in green, etc.) Example gt feed output now shows: 09:45 ✓ witness: All polecats healthy 09:44 ⚡ witness: nudged nux (idle 10m) 09:40 🎯 mayor: slung gt-rbncw to furiosa (gt-rbncw) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
157 lines
3.5 KiB
Go
157 lines
3.5 KiB
Go
// Package feed provides a TUI for the Gas Town activity feed.
|
|
package feed
|
|
|
|
import "github.com/charmbracelet/lipgloss"
|
|
|
|
// Color palette
|
|
var (
|
|
colorPrimary = lipgloss.Color("12") // Blue
|
|
colorSuccess = lipgloss.Color("10") // Green
|
|
colorWarning = lipgloss.Color("11") // Yellow
|
|
colorError = lipgloss.Color("9") // Red
|
|
colorDim = lipgloss.Color("8") // Gray
|
|
colorHighlight = lipgloss.Color("14") // Cyan
|
|
colorAccent = lipgloss.Color("13") // Magenta
|
|
)
|
|
|
|
// Styles for the feed TUI
|
|
var (
|
|
// Header styles
|
|
HeaderStyle = lipgloss.NewStyle().
|
|
Bold(true).
|
|
Foreground(colorPrimary).
|
|
Padding(0, 1)
|
|
|
|
TitleStyle = lipgloss.NewStyle().
|
|
Bold(true).
|
|
Foreground(lipgloss.Color("15"))
|
|
|
|
FilterStyle = lipgloss.NewStyle().
|
|
Foreground(colorDim)
|
|
|
|
// Agent tree styles
|
|
TreePanelStyle = lipgloss.NewStyle().
|
|
Border(lipgloss.RoundedBorder()).
|
|
BorderForeground(colorDim).
|
|
Padding(0, 1)
|
|
|
|
RigStyle = lipgloss.NewStyle().
|
|
Bold(true).
|
|
Foreground(colorPrimary)
|
|
|
|
RoleStyle = lipgloss.NewStyle().
|
|
Foreground(colorAccent)
|
|
|
|
AgentNameStyle = lipgloss.NewStyle().
|
|
Foreground(lipgloss.Color("15"))
|
|
|
|
AgentActiveStyle = lipgloss.NewStyle().
|
|
Foreground(colorSuccess)
|
|
|
|
AgentIdleStyle = lipgloss.NewStyle().
|
|
Foreground(colorDim)
|
|
|
|
// Event stream styles
|
|
StreamPanelStyle = lipgloss.NewStyle().
|
|
Border(lipgloss.RoundedBorder()).
|
|
BorderForeground(colorDim).
|
|
Padding(0, 1)
|
|
|
|
TimestampStyle = lipgloss.NewStyle().
|
|
Foreground(colorDim)
|
|
|
|
EventCreateStyle = lipgloss.NewStyle().
|
|
Foreground(colorSuccess)
|
|
|
|
EventUpdateStyle = lipgloss.NewStyle().
|
|
Foreground(colorPrimary)
|
|
|
|
EventCompleteStyle = lipgloss.NewStyle().
|
|
Foreground(colorSuccess).
|
|
Bold(true)
|
|
|
|
EventFailStyle = lipgloss.NewStyle().
|
|
Foreground(colorError).
|
|
Bold(true)
|
|
|
|
EventDeleteStyle = lipgloss.NewStyle().
|
|
Foreground(colorWarning)
|
|
|
|
// Status bar styles
|
|
StatusBarStyle = lipgloss.NewStyle().
|
|
Background(lipgloss.Color("236")).
|
|
Foreground(colorDim).
|
|
Padding(0, 1)
|
|
|
|
HelpKeyStyle = lipgloss.NewStyle().
|
|
Foreground(colorHighlight).
|
|
Bold(true)
|
|
|
|
HelpDescStyle = lipgloss.NewStyle().
|
|
Foreground(colorDim)
|
|
|
|
// Focus indicator
|
|
FocusedBorderStyle = lipgloss.NewStyle().
|
|
Border(lipgloss.RoundedBorder()).
|
|
BorderForeground(colorPrimary).
|
|
Padding(0, 1)
|
|
|
|
// Role icons
|
|
RoleIcons = map[string]string{
|
|
"mayor": "🎩",
|
|
"witness": "👁",
|
|
"refinery": "🏭",
|
|
"crew": "👷",
|
|
"polecat": "😺",
|
|
"deacon": "🔔",
|
|
}
|
|
|
|
// MQ event styles
|
|
EventMergeStartedStyle = lipgloss.NewStyle().
|
|
Foreground(colorPrimary)
|
|
|
|
EventMergedStyle = lipgloss.NewStyle().
|
|
Foreground(colorSuccess).
|
|
Bold(true)
|
|
|
|
EventMergeFailedStyle = lipgloss.NewStyle().
|
|
Foreground(colorError).
|
|
Bold(true)
|
|
|
|
EventMergeSkippedStyle = lipgloss.NewStyle().
|
|
Foreground(colorWarning)
|
|
|
|
// Event symbols
|
|
EventSymbols = map[string]string{
|
|
"create": "+",
|
|
"update": "→",
|
|
"complete": "✓",
|
|
"fail": "✗",
|
|
"delete": "⊘",
|
|
"pin": "📌",
|
|
// Witness patrol events
|
|
"patrol_started": "👁",
|
|
"patrol_complete": "✓",
|
|
"polecat_checked": "·",
|
|
"polecat_nudged": "⚡",
|
|
"escalation_sent": "⬆",
|
|
// Merge events
|
|
"merge_started": "⚙",
|
|
"merged": "✓",
|
|
"merge_failed": "✗",
|
|
"merge_skipped": "⊘",
|
|
// General gt events
|
|
"sling": "🎯",
|
|
"hook": "🪝",
|
|
"unhook": "↩",
|
|
"handoff": "🤝",
|
|
"done": "✓",
|
|
"mail": "✉",
|
|
"spawn": "🚀",
|
|
"kill": "💀",
|
|
"nudge": "⚡",
|
|
"boot": "🔌",
|
|
"halt": "⏹",
|
|
}
|
|
)
|