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
- Variables
- func BareStatus(ctx context.Context, v StatusView, dir string, scoped bool, sid string, ...) (bool, error)
- func CheckoutTaskID(ctx context.Context, t *target.Target) string
- func CompactGates(gates []Gate) string
- func CurrentPhase(r *state.Run) string
- func DriveFlows(active []drives.Live) map[string]DriveFlow
- func DrivenTasks(active []drives.Live) map[string]bool
- func GateLines(gates []Gate) [][2]string
- func InRoot(runs []*state.Run, root string) []*state.Run
- func NewStatusReader(t *target.Target, now time.Time) (*statusReader, error)
- func PRColumn(r TaskRow) string
- func RenderRows(w io.Writer, rows []TaskRow, v RowView) error
- func RunFact(label, value string, style lipgloss.Style) render.Fact
- func RunRows(w io.Writer, r *state.Run, v RunView)
- func SessionTaskID(sid string) string
- func ShipFiles(root, id string) ([]VerdictPath, []ReviewPath)
- func ShipSteps(events []ledger.Event, session string, until time.Time) []string
- func StageLooks() map[string]Look
- func StageOf(f lookaround.TaskFacts, baseDone bool) (string, string)
- func StageStyle(stage string) lipgloss.Style
- func StatusText(ctx context.Context, dir, session string) (string, bool)
- func TaskFallback(in TaskStatusInput, others []*state.Run, ship Shipment) fallback
- func TaskRefsFor(t *target.Target, ctx context.Context, refs []ref.Ref, md, fresh bool, ...) map[string]ledger.TaskRef
- func TaskRuns(runs []*state.Run, id string) ([]*state.Run, []*state.Run)
- func WriteRuns(v StatusView, runs []*state.Run, gates [][]Gate, head *Shipment, showRoot bool, ...) error
- type Color
- type DriveFlow
- type Gate
- type GateInput
- type GateSource
- type Look
- type Outcomes
- type RemoteState
- type ReviewHalf
- type ReviewPath
- type ReviewRound
- type RowSource
- type RowView
- type RunJSON
- type RunView
- type Shipment
- type StatusView
- type TaskRow
- type TaskStatusInput
- type VerdictPath
- type Weight
Constants ¶
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.
const ( ViaShip = "in ship" ViaDrive = "drive" // finish, which drive runs in its own process )
How a running gate was started.
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.
const LaunchesHead = "launched here"
LaunchesHead heads the tree of what this session launched.
Variables ¶
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 ¶
CheckoutTaskID is the task the branch names, else the one a linked worktree's directory names on a detached HEAD, "" for none.
func CompactGates ¶
CompactGates is the parent rows' gate column.
func CurrentPhase ¶
CurrentPhase is the furthest phase a run has reached, with its status: `capture running`, `ship blocked at judge`.
func DriveFlows ¶
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 ¶
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 InRoot ¶
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 PRColumn ¶
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 ¶
RenderRows prints the rows as a task tree under the parent's heading.
func RunRows ¶
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 ¶
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 ¶
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 ¶
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 ¶
StageStyle is the stage's look in the terminal.
func StatusText ¶
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 ¶
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 ¶
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 (Gate) CompactState ¶
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
}
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
// contains filtered or unexported fields
}
GateSource is what every task's gates read alike.
func (GateSource) Pipeline ¶
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 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 ¶
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 ¶
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 ¶
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 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 ¶
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.
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.
type StatusView ¶
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 ¶
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 ¶
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.