dashboard

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClampRefresh

func ClampRefresh(seconds int) int

ClampRefresh clamps the user-supplied refresh interval (seconds) to [5, 300].

func Hyperlink(url, text string) string

Hyperlink wraps text in an OSC 8 escape sequence pointing at url. Modern terminals render this as a clickable link; terminals that do not support it strip the sequence cleanly and show only the text. We emit unconditionally — detection across the long tail of terminals is unreliable.

func OpenURL

func OpenURL(url string) error

OpenURL launches the user's default browser. Returns nil if the spawn succeeds; the dashboard treats failures as non-fatal.

func SortBatches

func SortBatches(batches []BatchEntry)

SortBatches orders batches: stable-disagreement first, then cascade-failed, then attention items, then by LatestActivity desc, then by MilestoneNumber asc. Sorts in place.

func TierProgressGlyphs

func TierProgressGlyphs(done, inProgress, ready, failed int) string

TierProgressGlyphs returns a glyph string for the supplied counts using the order: done (●), in-progress (◐), ready/blocked (○), failed (✗). The total number of glyphs equals done+inProgress+ready+failed.

Types

type BatchEntry

type BatchEntry struct {
	MilestoneNumber int
	MilestoneTitle  string
	MilestoneURL    string
	PRNumber        int // 0 if no PR yet
	PRURL           string
	CIStatus        string // "", "success", "failure", "pending", "error"
	ReviewState     string // "", "approved", "changes_requested", "commented"
	Tier            int    // current tier (1-indexed for display)
	TotalTiers      int
	Done            int
	InProgress      int
	Ready           int
	Failed          int
	Blocked         int
	LatestActivity  time.Time // max issue.UpdatedAt across milestone
	HasAttention    bool      // any failed issue || CIStatus==failure || ReviewState==changes_requested
	// CascadeFailed is true when the batch PR carries the herd/cascade-failed
	// label, indicating the conflict-resolution cascade exhausted and is
	// awaiting manual intervention.
	CascadeFailed bool
	// StableDisagreement is true when the batch PR carries the
	// herd/stable-disagreement label. Implies HasAttention.
	StableDisagreement bool
}

BatchEntry is one open milestone with at least one herd/* labelled issue.

ReviewState is reserved for a future task: the platform package does not currently expose a list-reviews API, so Fetch leaves it empty in v1.

type FailureEntry

type FailureEntry struct {
	Number    int
	Title     string
	Label     string // primary type label, e.g. "herd/type:feature"
	UpdatedAt time.Time
}

FailureEntry is one issue with herd/status:failed updated in the last 24h.

type Model

type Model struct {
	Platform   platform.Platform
	Owner      string
	Repo       string
	RefreshSec int
	// contains filtered or unexported fields
}

Model is the bubbletea model. Exported so cli/dashboard.go can construct it.

func NewModel

func NewModel(p platform.Platform, owner, repo string, refreshSec int) Model

NewModel constructs a Model with the supplied platform client and config.

func (Model) Init

func (m Model) Init() tea.Cmd

Init starts the initial fetch and tick loop.

func (Model) Update

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

Update implements tea.Model.

func (Model) View

func (m Model) View() string

View implements tea.Model.

type State

type State struct {
	Owner       string
	Repo        string
	Workers     []WorkerEntry
	Batches     []BatchEntry
	Failures    []FailureEntry
	LastRefresh time.Time
	FetchError  string // last non-fatal error, displayed in status area
}

State is the snapshot the TUI renders on each tick. All fields are populated by Fetch; on partial failure, the previous State is reused and FetchError is set on a copy by the caller.

func Fetch

func Fetch(ctx context.Context, p platform.Platform, owner, repo string) (State, string)

Fetch builds a fresh State by calling platform APIs in parallel. Individual failures are captured as a non-fatal error string (returned as the second value); the State is still returned with whatever data was retrieved.

type WorkerEntry

type WorkerEntry struct {
	RunID       int64
	IssueNumber int    // parsed from run inputs ("issue") if present, else 0
	IssueTitle  string // populated by Fetch via Issues().Get when IssueNumber>0; truncated by view
	URL         string // workflow run URL
	StartedAt   time.Time
}

WorkerEntry is one in-progress run of herd-worker.yml.

Jump to

Keyboard shortcuts

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