watch

package
v0.0.77 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package watch implements the fabrik watch TUI for monitoring a single issue.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(m WatchModel) error

Run runs the bubbletea program with the WatchModel. It injects p.Send into the log follower goroutines before starting.

func StartLogFollower

func StartLogFollower(logDir string, send func(tea.Msg), done <-chan struct{}, getActiveStage func() string)

StartLogFollower launches two goroutines:

  1. A file-follow goroutine that reads the newest .log file in logDir in real time, calling send(LogLineMsg) for each rendered line.
  2. A directory-poll goroutine (2s interval) that detects when a new .log file appears (stage transition) and calls send(NewLogFileMsg).

getActiveStage is called by the follow goroutine to determine which stage's log to follow; "" means fall back to the globally newest log file. Both goroutines run until the done channel is closed.

Types

type ClaudeFinishedMsg

type ClaudeFinishedMsg struct {
	Err error
}

ClaudeFinishedMsg is sent when the inline Claude subprocess launched via tea.ExecProcess exits. Err is non-nil if Claude exited with an error.

type GitHubOptions

type GitHubOptions struct {
	Owner        string
	Repo         string
	Client       *gh.Client
	PollInterval time.Duration
	PluginDir    string
}

GitHubOptions holds the GitHub API configuration for the watch TUI.

type GitHubPollMsg

type GitHubPollMsg struct{}

GitHubPollMsg is sent by the GitHub poll ticker to trigger a refresh of issue metadata, PR status, CI check runs, and comment count.

type LogLineMsg

type LogLineMsg struct {
	Text string
}

LogLineMsg carries a single rendered line of Claude output from the log follower.

type NewLogFileMsg

type NewLogFileMsg struct {
	Path string
}

NewLogFileMsg is sent when the log follower detects a new .log file in the issue's log directory, indicating a stage transition.

type StatusMsgMsg

type StatusMsgMsg struct {
	Text string
}

StatusMsgMsg carries a transient status message to display in the status bar.

type TickMsg

type TickMsg struct{}

TickMsg is the generic ticker message used for periodic UI refreshes (e.g. elapsed-time display).

type TurnCountMsg

type TurnCountMsg struct {
	TurnsUsed int
}

TurnCountMsg is sent by the log follower each time it detects a user event (logical turn start) in the live NDJSON stream, carrying the cumulative per-invocation count.

type WatchModel

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

WatchModel is the bubbletea model for the fabrik watch TUI.

func NewModel

func NewModel(issueNumber int, opts GitHubOptions, stagesDir string) WatchModel

NewModel creates a WatchModel for the given issue number. stagesDir is the path to the stages YAML directory; used to build the pipeline order map for tab sorting. If stagesDir is empty or LoadAll fails, tabs fall back to chronological ordering.

func (WatchModel) Init

func (m WatchModel) Init() tea.Cmd

Init starts the GitHub poll ticker and the one-second UI refresh ticker. The log follower goroutines are launched in Run() via p.Send, which is the correct bubbletea pattern for goroutines that need to send messages back.

func (WatchModel) Update

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

Update handles all bubbletea messages.

func (WatchModel) View

func (m WatchModel) View() string

View renders the TUI.

Jump to

Keyboard shortcuts

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