statusview

package
v0.58.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 45 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package statusview reads where tasks and runs stand and renders it: the status reader, the gates of each run, the stage of each task and the shipment a run left.

Index

Constants

View Source
const (
	GateOff      = "not in this flow"
	GateUpcoming = state.Upcoming
	GateRunning  = "running"

	GateDone = "done"
)

Gate states. A plain step also takes a run's stop status (failed, blocked, partial) on the step it stopped at.

View Source
const (
	ViaShip = "in ship"

	ViaDrive = "drive" // finish, which drive runs in its own process

)

How a running gate was started.

View Source
const (
	StageDone         = "done"
	StageShipped      = "shipped"
	StageAsking       = "asking"
	StageHalted       = "halted"
	StageImplementing = "implementing"
	StageReviewing    = "reviewing"
	StageResolving    = "resolving"
	StageJudging      = "judging"
	StagePlanning     = "planning"
	StagePlanned      = "planned"
	StageWaiting      = "waiting"
	StageQueued       = "queued"
	StageNotStarted   = "not started"
)

Stages, as `status <parent>` names them, one per row.

View Source
const LaunchesHead = "launched here"

LaunchesHead heads the tree of what this session launched.

Variables

View Source
var ErrNoRunToRead = errors.New("no run to read")

ErrNoRunToRead is a task with no branch, or a branch checked out nowhere: no run to read, though a finished one still reports.

Functions

func BareStatus

func BareStatus(ctx context.Context, v StatusView, dir string, scoped bool, sid string, all bool) (bool, error)

BareStatus is what `status` with no task id prints, and whether it printed a question a driven agent waits on.

func CheckoutTaskID

func CheckoutTaskID(ctx context.Context, t *target.Target) string

CheckoutTaskID is the task the branch names, else the one a linked worktree's directory names on a detached HEAD, "" for none.

func CompactGates

func CompactGates(gates []Gate) string

CompactGates is the parent rows' gate column.

func CurrentPhase

func CurrentPhase(r *state.Run) string

CurrentPhase is the furthest phase a run has reached, with its status: `capture running`, `ship blocked at judge`.

func DriveFlows

func DriveFlows(active []drives.Live) map[string]DriveFlow

DriveFlows maps each task of a drive neither cancelled nor done to the flow the drive took, the newest drive winning. A drive without --flow records none, read as default: an area's pick is ship's to make.

func DrivenTasks

func DrivenTasks(active []drives.Live) map[string]bool

DrivenTasks is every task a drive lists while its driver runs, by id, each bundle member on its own. A stopped drive holds nothing until it resumes, as its queue does not.

func GateLines

func GateLines(gates []Gate) [][2]string

func InRoot

func InRoot(runs []*state.Run, root string) []*state.Run

InRoot keeps the runs recorded against root. The hook stores git's toplevel and the layout package stores the physical path, so both sides are compared in physical form.

func NewStatusReader

func NewStatusReader(t *target.Target, now time.Time) (*statusReader, error)

func PRColumn

func PRColumn(r TaskRow) string

PRColumn is `#128`, with the state beside it unless the PR is open, an open or merged PR's icon before it so the number reads as a PR.

func RenderRows

func RenderRows(w io.Writer, rows []TaskRow, v RowView) error

RenderRows prints the rows as a task tree under the parent's heading.

func RunFact

func RunFact(label, value string, style lipgloss.Style) render.Fact

func RunRows

func RunRows(w io.Writer, r *state.Run, v RunView)

RunRows prints one run in the headless colon-less shape; every run block without a facts head, `f10 state show` included, prints through it.

func SessionTaskID

func SessionTaskID(sid string) string

SessionTaskID is the task the session's run names, "" for none.

func ShipFiles

func ShipFiles(root, id string) ([]VerdictPath, []ReviewPath)

ShipFiles is the task's verdict and findings files. Verdicts from before the open series are an earlier PR's, dropped as the judge row drops them.

func ShipSteps

func ShipSteps(events []ledger.Event, session string, until time.Time) []string

ShipSteps is the steps the session's last ship run claimed before until. Only a phase skill begins a run, so resolve or catchup mid-pipeline does not end it; a step claimed again right after itself is one entry.

func StageLooks

func StageLooks() map[string]Look

StageLooks is the palette by stage, a copy, for the board's page.

func StageOf

func StageOf(f lookaround.TaskFacts, baseDone bool) (string, string)

StageOf is the one mapping from a task's facts to its stage and step; baseDone says the base the task waits on is done.

func StageStyle

func StageStyle(stage string) lipgloss.Style

StageStyle is the stage's look in the terminal.

func StatusText

func StatusText(ctx context.Context, dir, session string) (string, bool)

StatusText is what a bare `f10 status` prints for session in dir, with no color and no links, and whether it printed a question to relay.

func TaskFallback

func TaskFallback(in TaskStatusInput, others []*state.Run, ship Shipment) fallback

TaskFallback lays the task's shipment out as the fallback.

func TaskRefsFor

func TaskRefsFor(t *target.Target,
	ctx context.Context,
	refs []ref.Ref,
	md, fresh bool,
	warn io.Writer,
) map[string]ledger.TaskRef

TaskRefsFor asks the tracker only for a task the ledger lacks (or lacks a url for, with md), or for every task with fresh; a tracker that cannot answer leaves the task out, with a note on warn.

func TaskRuns

func TaskRuns(runs []*state.Run, id string) ([]*state.Run, []*state.Run)

TaskRuns splits the checkout's runs into the task's own and the rest, since every skill call reseeds its run and the agent may be on another task by now; an empty task is the task's only in a phase skill's run that fetch has not named yet, since a catchup's run names no task either.

func WriteRuns

func WriteRuns(v StatusView, runs []*state.Run, gates [][]Gate, head *Shipment, showRoot bool, agent string,
	now time.Time,
) error

WriteRuns prints runs, each with its gates, or encodes them under --json. head is the task's shipment, printed once above the runs in place of each run's task and url rows; nil for runs listed without a task. agent is the profile the task's branch records, "" for the kind's default.

Types

type Color

type Color struct{ ANSI, CSS string }

A Color is one palette color: its code in the terminal's 256 colors and the CSS variable the board's page defines for it.

type DriveFlow

type DriveFlow struct {
	Name string

	Running bool
	// contains filtered or unexported fields
}

A DriveFlow is the flow and the --pace a drive record names, and whether that drive's driver still runs: only a running one can be opening a branch right now.

type Gate

type Gate struct {
	Step    string                `json:"step"`
	Label   string                `json:"label,omitempty"`  // the entry's display name, shown in place of Step
	State   string                `json:"state,omitempty"`  // plain steps and judges
	Via     string                `json:"via,omitempty"`    // a running gate: in ship, driven or manual
	Action  string                `json:"action,omitempty"` // drive's finish: what it is doing
	Judged  string                `json:"judged,omitempty"` // a judge: task, plan or change
	Outcome *archive.JudgeOutcome `json:"outcome,omitempty"`
	Local   *ReviewHalf           `json:"local,omitempty"`
	Remote  *ReviewHalf           `json:"remote,omitempty"`
}

A Gate is one row of a task's flow: a plain step, its review or a judge.

func TaskGates

func TaskGates(ctx context.Context, in GateInput) []Gate

TaskGates builds the gates, nil when nothing declares a flow.

func (Gate) CompactState

func (g Gate) CompactState() string

func (Gate) Shown

func (g Gate) Shown() string

Shown is the gate's name as a person reads it: its label, else its step.

func (Gate) StateText

func (g Gate) StateText() string

func (Gate) Text

func (g Gate) Text() string

type GateInput

type GateInput struct {
	Task, Branch, Checkout string

	Run      *state.Run // live, or the ledger's last claim; nil for none
	Events   []ledger.Event
	Driven   string                 // the last skill drive saw finish: plan, ship or finish
	Finishes bool                   // drive finishes the branch: its finish record is there
	Finish   branchmeta.DriveFinish // drive's record of running finish, zero for none or a drive gone
	Pipeline flow.Flow              // ship's entries of the branch's flow, when the run recorded none
	// RemoteFlow is a remote reviewer declared: it reviews every PR
	RemoteFlow bool

	Outcomes Outcomes
	Remote   func(ctx context.Context) RemoteState // nil: no host to ask
	Now      time.Time
}

func (GateInput) ClaimedAt

func (in GateInput) ClaimedAt(session, step string) time.Time

type GateSource

type GateSource struct {
	Main string           // where the branch config lives
	Eff  *facts.Effective // the flows, the paces and the review every task resolves against

	Shared string // the storage root every checkout shares
	// contains filtered or unexported fields
}

GateSource is what every task's gates read alike.

func (GateSource) Pipeline

func (src GateSource) Pipeline(ctx context.Context, name, branch, pace string) flow.Flow

Pipeline is what ship runs of the named flow under the task's pace: pace when given, else the one its branch records, else the default. A pace that no longer resolves leaves the flow as declared, since status must still show the task.

func (GateSource) StorageFor

func (src GateSource) StorageFor(ctx context.Context, root string) string

StorageFor is where a task's findings and verdicts are: its checkout's storage root, else the shared one.

type Look

type Look struct {
	Color  Color
	Weight Weight
}

A Look is a stage's color and weight, on the terminal and the page alike.

type Outcomes

type Outcomes struct {
	Local, Remote                     []ReviewRound
	TaskJudge, PlanJudge, ChangeJudge *archive.JudgeOutcome

	LocalAt, RemoteAt time.Time

	// every finding the files raised, each counted in its first round only
	LocalRaised, RemoteRaised int
	// contains filtered or unexported fields
}

Outcomes is what the reviews and judges of a task left, with the time of the newest of each, so a later call reads as running.

func FileOutcomes

func FileOutcomes(storageRoot, task string, since time.Time) Outcomes

FileOutcomes reads the task's findings and verdict files: a round is the remote half's when its reviewer is not local (a file both halves wrote counts once each), and a verdict goes by its subject: task, plan or change. Verdict files written before since are dropped: the judge writes them per task, so an earlier PR's verdicts share the directory.

func ReadOutcomes

func ReadOutcomes(store *lore.Store, storageRoot, task string) Outcomes

ReadOutcomes reads lore first when store is set, and the findings and verdict files for whatever lore holds nothing of: runs from before the steps wrote lore. A nil store reads the files alone.

func SeriesOutcomes

func SeriesOutcomes(store *lore.Store, storageRoot, task string, open bool) Outcomes

SeriesOutcomes reads the open series of a task with a branch, so a follow-up PR never shows the first one's gates; a task with no branch left reads the newest series lore holds, its open one being empty.

type RemoteState

type RemoteState struct {
	Found, Done, Handled, Settled bool
	Err                           error
}

type ReviewHalf

type ReviewHalf struct {
	State  string        `json:"state"`
	Via    string        `json:"via,omitempty"`
	Action string        `json:"action,omitempty"` // running: review, or resolve settling it
	Detail string        `json:"detail,omitempty"` // unknown: why
	Rounds []ReviewRound `json:"rounds,omitempty"`
}

type ReviewPath

type ReviewPath struct {
	Round string `json:"round"`
	Path  string `json:"path"`
}

ReviewPath is a findings file the facts block links, by its round.

type ReviewRound

type ReviewRound struct {
	Round   string `json:"round"`
	Found   int    `json:"found"`
	Fixed   int    `json:"fixed"`
	Skipped int    `json:"skipped"`
	Ask     int    `json:"ask"`
}

ReviewRound counts one findings file. Ask is a finding still waiting on a verdict: an `ask`, or none written yet.

type RowSource

type RowSource struct {
	Live   []*state.Run
	Events []ledger.Event

	// Checkout is the task's branch and the checkout holding it, "" for none
	Checkout func(ctx context.Context, id, suffix string) (string, string)
	// Resolve is a reference as typed, in the project's id format; nil
	// takes it as written
	Resolve func(token string) string

	// Driven holds every task id a running drive lists, bundle riders too
	Driven map[string]bool

	// Requests is every child's requests by upper-cased id, read once
	Requests map[string][]lookaround.PR
	// contains filtered or unexported fields
}

RowSource is what gathering rows reads from, bound once per status call.

func (RowSource) Gather

Gather reads one task's facts: the live run in its checkout, else the ledger's last claim, the requests naming it (its branch's where it has one), and the base its branch records, else the tracker's.

func (RowSource) RowsFrom

func (src RowSource) RowsFrom(ctx context.Context, kids []stack.ChildRow) []TaskRow

RowsFrom builds a row per child from one host read of every child's requests, the local reads for each running beside the others', then decides the stages with each base's before its dependents'.

type RowView

type RowView struct {
	Parent string // the parent's id, heading its children; "" for a task alone
	Width  int    // 0: no limit
	Term   bool
	Plain  bool
}

RowView is how task rows print; plain is cut to a width and carries no urls, since a model reads it and runs `f10 task open --link` for one.

type RunJSON

type RunJSON struct {
	*state.Run

	Agent string `json:"agent,omitempty"`
	Gates []Gate `json:"gates,omitempty"`

	// the task's files and facts, repeated per run as the agent is; the
	// files predate the shipment and repeat what it holds
	Verdicts []VerdictPath `json:"verdicts,omitempty"`
	Reviews  []ReviewPath  `json:"reviews,omitempty"`
	Shipment *Shipment     `json:"shipment,omitempty"`
}

RunJSON is a run as --json prints it, a task's gates beside the state's own keys.

type RunView

type RunView struct {
	Gates    []Gate
	ShowRoot bool   // listing runs: for one session the root is the directory you are in
	Agent    string // the profile the task's branch records, "" for the kind's default
	Now      time.Time
	Limit    int
	Headed   bool // a shipment block above holds the task and url rows
}

RunView is how one run block prints.

type Shipment

type Shipment struct {
	Task    string `json:"task"`
	Title   string `json:"title,omitempty"`
	URL     string `json:"url,omitempty"`
	Branch  string `json:"branch,omitempty"`
	PR      string `json:"pr,omitempty"`
	PRState string `json:"pr_state,omitempty"` // when the host was asked
	Commit  string `json:"commit,omitempty"`
	Plan    string `json:"plan,omitempty"`
	Handoff string `json:"handoff,omitempty"`

	Verdicts []VerdictPath `json:"verdicts,omitempty"`
	Reviews  []ReviewPath  `json:"reviews,omitempty"`
	// contains filtered or unexported fields
}

Shipment is the facts block a ship report opens with, reprinted from what f10 holds locally; only a pushed task with no PR recorded asks the host. --json carries it whole under `shipment`.

func ReadShipment

func ReadShipment(ctx context.Context, in TaskStatusInput, events []ledger.Event, known ledger.TaskRef) Shipment

ReadShipment fills the shipment from the ledger's task ref and PR, git and the storage root. The commit row waits for a commit of the task's own: before one, HEAD is the base's.

func (*Shipment) AskPR

func (s *Shipment) AskPR(ctx context.Context, in TaskStatusInput)

AskPR reads the branch's PR from the host, once: a PR the host does not know leaves the ledger's url standing.

func (*Shipment) Facts

func (s *Shipment) Facts(link bool) []render.Fact

Facts is the block's rows in the ship report's order, empty ones left out. link puts a terminal link on the file paths; --plain passes false, since writeReport links a path fact on any terminal.

type StatusView

type StatusView struct {
	Out, Warn   io.Writer
	JSON, Plain bool
}

StatusView is where a status prints and how: the flags it honours.

type TaskRow

type TaskRow struct {
	ID      string `json:"id"`
	Title   string `json:"title"`
	URL     string `json:"url,omitempty"`
	Depth   int    `json:"depth"`
	After   string `json:"after,omitempty"`
	Stage   string `json:"stage"`
	Step    string `json:"step,omitempty"`
	PR      string `json:"pr,omitempty"`
	PRState string `json:"pr_state,omitempty"`
	Note    string `json:"note,omitempty"`
	Next    string `json:"next,omitempty"`
	Ask     string `json:"ask,omitempty"`
	Gates   []Gate `json:"gates,omitempty"`

	Full bool `json:"-"` // a finished task alone: every gate on a line of its own
}

A TaskRow is one task as `status <parent>` lists it, and the shape its --json prints. A finished task with no branch left prints one alone.

func DropRows

func DropRows(rows []TaskRow, drop func(TaskRow) bool) []TaskRow

DropRows leaves out the rows drop picks, in tree order: what hung under a dropped row moves up to its level.

func (*TaskRow) Finish

func (row *TaskRow) Finish(f lookaround.TaskFacts, baseDone bool)

Finish settles the row's stage and the lines printed under it.

func (*TaskRow) GateColumn

func (row *TaskRow) GateColumn() string

GateColumn is the row's compact gates; a finished task alone prints every gate on a line instead.

type TaskStatusInput

type TaskStatusInput struct {
	ID      string
	Branch  string
	Root    string // the checkout holding branch
	Main    string // the main checkout, where the branch's refs and config live
	Plan    string // where the task's plan would be
	Handoff string // where the task's handoff would be

	Host *hostops.Host // nil without a host CLI: no PR row
	// contains filtered or unexported fields
}

TaskStatusInput is what `status <id>` knows about a task before reading any run.

type VerdictPath

type VerdictPath struct {
	Subject string `json:"subject"` // task, plan or change
	Path    string `json:"path"`
}

VerdictPath is a judge verdict file the facts block links, by its subject.

type Weight

type Weight int

Weight is how loud a stage is drawn: bold where it asks for you or for a next move, faint where it is past.

const (
	Plain Weight = iota
	Bold
	Faint
)

Jump to

Keyboard shortcuts

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