feed

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package feed provides a TUI for the Gas Town activity feed.

Index

Constants

This section is empty.

Variables

View Source
var (
	ConvoyPanelStyle = lipgloss.NewStyle().
						Border(lipgloss.RoundedBorder()).
						BorderForeground(colorDim).
						Padding(0, 1)

	ConvoyTitleStyle = lipgloss.NewStyle().
						Bold(true).
						Foreground(colorPrimary)

	ConvoySectionStyle = lipgloss.NewStyle().
						Foreground(colorDim).
						Bold(true)

	ConvoyIDStyle = lipgloss.NewStyle().
					Foreground(colorHighlight)

	ConvoyNameStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color("15"))

	ConvoyProgressStyle = lipgloss.NewStyle().
						Foreground(colorSuccess)

	ConvoyLandedStyle = lipgloss.NewStyle().
						Foreground(colorSuccess).
						Bold(true)

	ConvoyAgeStyle = lipgloss.NewStyle().
					Foreground(colorDim)
)

Convoy panel styles

View Source
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 - uses centralized icons from constants package
	RoleIcons = map[string]string{
		constants.RoleMayor:    constants.IconMayor,
		constants.RoleWitness:  constants.IconWitness,
		constants.RoleRefinery: constants.IconRefinery,
		constants.RoleCrew:     constants.IconCrew,
		constants.RolePolecat:  constants.IconPolecat,
		constants.RoleDeacon:   constants.IconDeacon,
	}

	// 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":     "x",
		"delete":   "-",
		"pin":      "^",

		"patrol_started":  constants.IconWitness,
		"patrol_complete": "*",
		"polecat_checked": ".",
		"polecat_nudged":  "!",
		"escalation_sent": "^",

		"merge_started": "#",
		"merged":        "*",
		"merge_failed":  "x",
		"merge_skipped": "-",

		"sling":   ">",
		"hook":    "[hook]",
		"unhook":  "[unhook]",
		"handoff": "[handoff]",
		"done":    "*",
		"mail":    "@",
		"spawn":   "[spawn]",
		"kill":    "[kill]",
		"nudge":   "!",
		"boot":    "[boot]",
		"halt":    "[halt]",
	}
)

Styles for the feed TUI

Functions

func FindBeadsDir

func FindBeadsDir(workDir string) (string, error)

FindBeadsDir finds the beads directory for the given working directory

Types

type Agent

type Agent struct {
	ID         string
	Name       string
	Role       string // mayor, witness, refinery, crew, polecat
	Rig        string
	Status     string // running, idle, working, dead
	LastEvent  *Event
	LastUpdate time.Time
	Expanded   bool
}

Agent represents an agent in the tree

type BdActivitySource

type BdActivitySource struct {
	// contains filtered or unexported fields
}

BdActivitySource reads events from bd activity --follow

func NewBdActivitySource

func NewBdActivitySource(workDir string) (*BdActivitySource, error)

NewBdActivitySource creates a new source that tails bd activity

func (*BdActivitySource) Close

func (s *BdActivitySource) Close() error

Close stops the source

func (*BdActivitySource) Events

func (s *BdActivitySource) Events() <-chan Event

Events returns the event channel

type CombinedSource

type CombinedSource struct {
	// contains filtered or unexported fields
}

CombinedSource merges events from multiple sources

func NewCombinedSource

func NewCombinedSource(sources ...EventSource) *CombinedSource

NewCombinedSource creates a source that merges multiple event sources

func (*CombinedSource) Close

func (c *CombinedSource) Close() error

Close stops all sources

func (*CombinedSource) Events

func (c *CombinedSource) Events() <-chan Event

Events returns the combined event channel

type Convoy

type Convoy struct {
	ID        string    `json:"id"`
	Title     string    `json:"title"`
	Status    string    `json:"status"`
	Completed int       `json:"completed"`
	Total     int       `json:"total"`
	CreatedAt time.Time `json:"created_at"`
	ClosedAt  time.Time `json:"closed_at,omitempty"`
}

Convoy represents a convoy's status for the dashboard

type ConvoyState

type ConvoyState struct {
	InProgress []Convoy
	Landed     []Convoy
	LastUpdate time.Time
}

ConvoyState holds all convoy data for the panel

func FetchConvoys

func FetchConvoys(townRoot string) (*ConvoyState, error)

FetchConvoys retrieves convoy status from town-level beads

type Event

type Event struct {
	Time    time.Time
	Type    string // create, update, complete, fail, delete
	Actor   string // who did it (e.g., "gastown/crew/joe")
	Target  string // what was affected (e.g., "gt-xyz")
	Message string // human-readable description
	Rig     string // which rig
	Role    string // actor's role
	Raw     string // raw line for fallback display
}

Event represents an activity event

type EventSource

type EventSource interface {
	Events() <-chan Event
	Close() error
}

EventSource represents a source of events

type GtEvent

type GtEvent struct {
	Timestamp  string                 `json:"ts"`
	Source     string                 `json:"source"`
	Type       string                 `json:"type"`
	Actor      string                 `json:"actor"`
	Payload    map[string]interface{} `json:"payload"`
	Visibility string                 `json:"visibility"`
}

GtEvent is the structure of events in .events.jsonl

type GtEventsSource

type GtEventsSource struct {
	// contains filtered or unexported fields
}

GtEventsSource reads events from ~/gt/.events.jsonl (gt activity log)

func NewGtEventsSource

func NewGtEventsSource(townRoot string) (*GtEventsSource, error)

NewGtEventsSource creates a source that tails ~/gt/.events.jsonl

func (*GtEventsSource) Close

func (s *GtEventsSource) Close() error

Close stops the source

func (*GtEventsSource) Events

func (s *GtEventsSource) Events() <-chan Event

Events returns the event channel

type KeyMap

type KeyMap struct {
	// Navigation
	Up       key.Binding
	Down     key.Binding
	PageUp   key.Binding
	PageDown key.Binding
	Top      key.Binding
	Bottom   key.Binding

	// Panel switching
	Tab         key.Binding
	ShiftTab    key.Binding
	FocusTree   key.Binding
	FocusConvoy key.Binding
	FocusFeed   key.Binding

	// Actions
	Enter   key.Binding
	Expand  key.Binding
	Refresh key.Binding

	// Search/Filter
	Search      key.Binding
	Filter      key.Binding
	ClearFilter key.Binding

	// General
	Help key.Binding
	Quit key.Binding
}

KeyMap defines the key bindings for the feed TUI.

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default key bindings.

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

FullHelp returns key bindings for the full help view.

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

ShortHelp returns key bindings for the short help view.

type MQEventSource

type MQEventSource struct {
	// contains filtered or unexported fields
}

MQEventSource reads MQ lifecycle events from mq_events.jsonl

func NewMQEventSource

func NewMQEventSource(beadsDir string) (*MQEventSource, error)

NewMQEventSource creates a source that tails MQ events from a beads directory.

func NewMQEventSourceFromWorkDir

func NewMQEventSourceFromWorkDir(workDir string) (*MQEventSource, error)

NewMQEventSourceFromWorkDir creates an MQ event source by finding the beads directory.

func (*MQEventSource) Close

func (s *MQEventSource) Close() error

Close stops the source.

func (*MQEventSource) Events

func (s *MQEventSource) Events() <-chan Event

Events returns the event channel.

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is the main bubbletea model for the feed TUI

func NewModel

func NewModel() *Model

NewModel creates a new feed TUI model

func (*Model) Init

func (m *Model) Init() tea.Cmd

Init initializes the model

func (*Model) SetEventChannel

func (m *Model) SetEventChannel(ch <-chan Event)

SetEventChannel sets the channel to receive events from

func (*Model) SetTownRoot

func (m *Model) SetTownRoot(townRoot string)

SetTownRoot sets the town root for convoy fetching

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages

func (*Model) View

func (m *Model) View() string

View renders the TUI

type MultiSource

type MultiSource struct {
	// contains filtered or unexported fields
}

MultiSource combines events from multiple EventSources into a single stream.

func NewMultiSource

func NewMultiSource(sources ...EventSource) *MultiSource

NewMultiSource creates a new multi-source that combines events from all given sources.

func (*MultiSource) Close

func (m *MultiSource) Close() error

Close stops all sources.

func (*MultiSource) Events

func (m *MultiSource) Events() <-chan Event

Events returns the combined event channel.

type Panel

type Panel int

Panel represents which panel has focus

const (
	PanelTree Panel = iota
	PanelConvoy
	PanelFeed
)

type Rig

type Rig struct {
	Name     string
	Agents   map[string]*Agent // keyed by role/name
	Expanded bool
}

Rig represents a rig with its agents

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL