Help us shape the future of Go! Take the 2026 Go Developer Survey

progress

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package progress works out how far along the developer loop a piece of work is — pick an issue, branch, commit, open a review, announce it — from what the repository and the services report. It keeps no state of its own: every stage is derived fresh, not read from the store. It is the one place the stage rules are written: the terminal interface's spine and `workflow status` read it, and the web server ships its stages in every frame of the stream, which the web's work story draws.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Turn added in v0.12.0

func Turn(ascii bool) []string

Turn is the frames the in-flight mark turns through while work is out — the terminal's panes and the command line's live line alike, each at its own rate whichever frames it draws: a quarter turn a frame from InFlight's own glyph; with ascii, which has no shape that turns by quarters, a line spinning. Held still, by ui.motion, the mark is InFlight's glyph instead, which in Unicode is the first frame.

Types

type PullState added in v0.4.0

type PullState int

PullState is where the branch's pull request stands, as far as the loop is concerned: there is none to follow, it is open for review, or it has merged.

const (
	// NoPullRequest is a branch with no pull request to follow: none was found,
	// or the one found was closed without merging.
	NoPullRequest PullState = iota
	// PullRequestOpen is a pull request open for review.
	PullRequestOpen
	// PullRequestMerged is a pull request that has merged, so its review is over
	// and it has no CI left to pass.
	PullRequestMerged
)

func PullStateOf added in v0.4.0

func PullStateOf(state forge.PullState) PullState

PullStateOf is where a found pull request stands for the loop. One closed without merging counts as none: its review neither goes on nor ended in a merge. A map, so exhaustive keeps it complete and gobco sees no arm unrun.

type Stage

type Stage struct {
	Step   Step
	Name   string
	System System
	State  State
}

Stage is one step of the loop, as it is named, the system its work happens in, and how far it has got.

func Stages

func Stages(work Work, messagingService string) []Stage

Stages is the loop's five stages, in order, each with its system and how far it has got. The last is named for the messaging service the work is announced on — Slack, Teams, Discord or Webhook — as the configuration names it.

type State

type State int

State is how far a stage has got.

const (
	// NotStarted is a stage not begun.
	NotStarted State = iota
	// InFlight is a stage under way.
	InFlight
	// Done is a stage complete.
	Done
	// Failed is a stage to go back to: a CI failure, or changes requested.
	Failed
)

func (State) Glyph added in v0.9.0

func (s State) Glyph(ascii bool) string

Glyph is the mark a stage in the state is drawn with — the terminal's spine and the command line's status line alike — or, with ascii, the stand-in ui.ascii draws instead. A map, not a switch, so there is no last-case arm gobco can never see; exhaustive keeps it complete.

type Step added in v0.9.0

type Step int

Step is which stage of the loop a stage is, whatever it is named: the last is named for the messaging service the work is announced on.

const (
	// StepIssue is the issue the work is for.
	StepIssue Step = iota
	// StepBranch is the branch made for it.
	StepBranch
	// StepCommits is the work committed on it.
	StepCommits
	// StepReview is its pull request's review and CI.
	StepReview
	// StepAnnounce is the pull request announced on the messaging service.
	StepAnnounce
)

type System added in v0.4.0

type System int

System is where a stage's work happens, which the terminal's spine colors it by.

const (
	// Tracker is the issue tracker: Jira, or the forge's own issues.
	Tracker System = iota
	// Git is the repository.
	Git
	// Forge is the pull request's host: GitHub or GitLab.
	Forge
	// Messaging is the service the work is announced on.
	Messaging
)

type Work

type Work struct {
	// OnFeatureBranch is a named branch other than the base.
	OnFeatureBranch bool
	// IssueNamed is that the branch name carries an issue key.
	IssueNamed bool
	// IssueSelected is that an issue is picked but not yet branched for. Session
	// knowledge.
	IssueSelected bool
	// Commits is how many commits the branch has that the base does not.
	Commits int
	// UncommittedChanges is how many files have uncommitted changes.
	UncommittedChanges int
	// PullRequest is where the branch's pull request stands.
	PullRequest PullState
	// CI is how the pull request's CI stands.
	CI forge.CIState
	// ChangesRequested is that a reviewer asked for changes.
	ChangesRequested bool
	// Announced is that the pull request was announced on the messaging
	// service at the moment it is at now, in this session or, as the store
	// remembers, an earlier one — as loop's AnnounceMemory.HoldsNow reads it,
	// so never while there is no pull request to follow.
	Announced bool
	// PostPending is that an announcement is waiting for CI. Session knowledge.
	PostPending bool
}

Work is everything the stages are derived from. The two session fields, IssueSelected and PostPending, are knowledge the terminal interface has and a one-shot command does not; a command leaves them false, so neither its Issue stage nor its messaging stage ever reads in-flight.

Jump to

Keyboard shortcuts

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