board

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package board implements `zen board`, a live view of the user's own open pull requests and the PRs they've been asked to review.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Focus

type Focus int

Focus identifies which of the two tables has keyboard focus.

const (
	FocusMyPRs Focus = iota
	FocusReview
)

type Model

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

Model is the zen board bubbletea model: two live tables — the user's own open PRs grouped by status, and PRs they've been asked to review.

func NewModel

func NewModel(cfg *config.Config) Model

NewModel builds the initial board model for cfg. Data is fetched once Init()'s command runs; until then the tables render empty.

func (Model) Init

func (m Model) Init() tea.Cmd

Init starts the first fetch and the auto-refresh ticker.

func (Model) Update

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

func (Model) View

func (m Model) View() string

type MyPRRow

type MyPRRow struct {
	Status Status
	Number int
	Repo   string // short config name
	Title  string
	URL    string
	Age    string

	BaseRef string
	HeadRef string
	// Depth is 0 for an independent PR or the root of a dependency chain,
	// and increases by 1 per level for PRs stacked on top of another.
	Depth int
	// contains filtered or unexported fields
}

MyPRRow is one row of the "My Pull Requests" table.

func FetchMyPRs

func FetchMyPRs(ctx context.Context, cfg *config.Config) ([]MyPRRow, error)

FetchMyPRs fetches the user's own open PRs across all configured repos, classifies each into a status bucket, and orders them by dependency chain (a PR immediately followed by anything stacked on top of it), with chains and independent PRs ranked by status priority then age (oldest first).

type ReviewRow

type ReviewRow struct {
	Kind   string // github.ReviewKindNew or github.ReviewKindRereview
	Number int
	Repo   string // short config name
	Title  string
	Author string
	URL    string
	Age    string
	// contains filtered or unexported fields
}

ReviewRow is one row of the "Needs Your Review" table.

func FetchReviewRequests

func FetchReviewRequests(ctx context.Context, cfg *config.Config) ([]ReviewRow, error)

FetchReviewRequests fetches PRs the user has been asked to review across all configured repos, unfiltered by the `authors` config — a "don't miss anything" dashboard shouldn't hide a review request just because the author isn't in the curated inbox list. Sorted into three tiers — configured authors, PRs touching a configured watch_paths entry, then everyone else — and by age (most recent first) within each tier.

type Status

type Status string

Status is a display bucket for one of the user's own open pull requests.

const (
	StatusDraft            Status = "draft"
	StatusFailingCI        Status = "failing_ci"
	StatusChangesRequested Status = "changes_requested"
	StatusReady            Status = "ready"
	StatusInReview         Status = "in_review"
	StatusInFlight         Status = "in_flight"
)

The status buckets for "My PRs", in display priority order (most actionable-by-you first).

func ClassifyMyPR

func ClassifyMyPR(pr github.MyPR) Status

ClassifyMyPR maps a MyPR's draft/review/CI state into a single display bucket, checked in this order:

  1. Draft — not ready for review, everything else is moot
  2. Failing CI — checks broke, the most urgent thing to fix regardless of review state
  3. Changes requested — a reviewer is waiting on you
  4. Ready to merge — approved and nothing blocking
  5. In review — reviewers requested, no verdict yet
  6. In flight — open, nobody's been asked to review yet

func (Status) Icon

func (s Status) Icon() string

Icon returns the status's display icon.

func (Status) Label

func (s Status) Label() string

Label returns the status's human-readable label.

func (Status) Priority

func (s Status) Priority() int

Priority returns the status's sort order — lower sorts first.

Jump to

Keyboard shortcuts

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