ghsource

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 35 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

Index

Constants

View Source
const (
	MarkReviewed          = "reviewed"
	MarkAddressedReviews  = "addressed.reviews"
	MarkAddressedChecks   = "addressed.checks"
	MarkAddressedConflict = "addressed.conflict"
	MarkFirstSkipped      = "first.skipped"
)

The GitHub plugin's round marks, as the host's in-process GitHub paths still write and read them: the removal's skip, a held review run by hand and an address round's reason.

View Source
const (
	// CommandClone clones a repository: clone <owner>/<name> <path>.
	CommandClone = "clone"
	// CommandAuth checks that gh is installed and logged in; it exits
	// ExitNoGH when gh is not installed.
	CommandAuth = "auth"
	// CommandReviewedRepos lists the repositories of the pull requests the
	// viewer reviewed since a date: reviewed-repos <yyyy-mm-dd>, one
	// owner/name a line, once per pull request.
	CommandReviewedRepos = "reviewed-repos"
	// CommandTeams lists the viewer's teams, one org/slug a line.
	CommandTeams = "teams"
)

The commands plugin.toml declares, which the host runs through the GitHub plugin.

View Source
const (
	// ActionBasics reads a pull request's basics: its answer is the
	// pr.PullRequest as JSON.
	ActionBasics = "pr.basics"
	// ActionAdopt takes a pull request over into the loop.
	ActionAdopt = "pr.adopt"
	// ActionRefresh reads a pull request in full into the plugin's store
	// and reports it.
	ActionRefresh = "pr.refresh"
)

The GitHub plugin's actions the host calls.

View Source
const EffectNudged = "pr.nudged"

EffectNudged is the GitHub plugin's draft effect the in-process publisher and proposals read, as its manifest declares it.

View Source
const ExitNoGH = 127

ExitNoGH is the exit of a command that found no gh to run, the shell's "command not found".

View Source
const ViewBudget = "budget"

ViewBudget is the GitHub plugin's view of its API budget.

Variables

This section is empty.

Functions

func CardOf added in v0.3.0

func CardOf(r api.Row, s prrow.Report) (card.Card, error)

CardOf is the card the plugin reported in s, under the overlays of r, the pull request's row: the row says why, on whom and since when, its situation signal is the row's kind, a mute snoozes it, and a stall the row shows is a note on it counting from when the situation began.

func FactsOf added in v0.3.0

func FactsOf(d FactsDeps) *factsgithub.Provider

FactsOf are GitHub's workflow facts over d: the plugin's reports under the host's overlays.

func IdentityOf added in v0.3.0

func IdentityOf(st viewerStore) func(context.Context) (items.Person, error)

IdentityOf is the user as GitHub knows them: the stored viewer login.

func ItemsOf added in v0.3.0

func ItemsOf(r api.Row, s prrow.Report) []items.Item

ItemsOf are the items the plugin reported in s, under the overlays of r, the pull request's row, every one keyed on the pull request so they are the asks of its one task. A pending round asks through its plan gate, so it keeps the items of the situation under it, as a muted row keeps those of its unmuted one. Where the host's turn overlays a situation the plugin did not report, the pull request waits on the loop while it works and on the user when it stopped or waits with no question, which its gate asks; it asks nothing once done.

func KeepIdentity added in v0.3.0

func KeepIdentity(ctx context.Context, st *inventory.Store, id src.Identity) error

KeepIdentity keeps id, the viewer as the GitHub plugin names them, in st: the login and the teams the in-process rows and facts read.

func MyTeams

func MyTeams(ctx context.Context, st *inventory.Store) ([]string, error)

MyTeams are the scope teams the viewer belongs to, as the GitHub plugin last named them; nil before it named any or when they are unreadable.

func ReviewedMarks added in v0.3.0

func ReviewedMarks(in change.ReviewerInput) map[string]string

ReviewedMarks cover the reviews a review round that went out saw; nil when they leave nothing to cover.

Types

type Budget added in v0.3.0

type Budget struct{ Limiter Limiter }

Budget is the GitHub budget as the daemon reads it.

func (Budget) Low added in v0.3.0

func (b Budget) Low() bool

Low says the budget refuses background reads.

func (Budget) RateLimit added in v0.3.0

func (b Budget) RateLimit() api.RateLimit

RateLimit is the GraphQL bucket, which the searches and the sweeps spend.

type Cards added in v0.3.0

type Cards struct{ Reports readmodel.Reports }

Cards are the pull requests' cards and items: the ones the GitHub plugin reported, under the overlays the host laid on their rows.

func (Cards) Card added in v0.3.0

func (c Cards) Card(ctx context.Context, r api.Row) (card.Card, error)

Card is the card of the pull request of r.

func (Cards) Items added in v0.3.0

func (c Cards) Items(ctx context.Context, r api.Row) ([]items.Item, error)

Items are the items of the pull request of r.

type FactsDeps added in v0.3.0

type FactsDeps struct {
	Reports readmodel.Reports
	Store   *inventory.Store
	WS      *workspace.Set
	Git     gitx.Git
	Cfg     config.Config
	Clock   port.Clock
	Intents func() *dintent.Registry
	Changes port.Changes
	Rounds  sweep.Rounds
	Books   sweep.Books
	// Mutes are the user's mutes of pull requests; nil mutes none.
	Mutes readmodel.Mutes
}

FactsDeps are what GitHub's workflow facts read in the host's process.

type Holdings added in v0.3.0

type Holdings struct {
	PRs       WorkspaceRows
	Overrides WorkspaceOverrides
}

Holdings are the pull requests the workspaces hold, matched as the sweep matches them: by the manager's link, else by the head branch.

func (Holdings) Held added in v0.3.0

type Limiter added in v0.3.0

type Limiter interface {
	Allow(p dgh.Priority) bool
	Budget() map[dgh.Resource]dgh.Limit
}

Limiter is a GitHub client's budget.

type PRStates added in v0.4.0

type PRStates interface {
	PR(ctx context.Context, ref pr.Ref) (dinv.PR, bool, error)
}

PRStates are the pull requests as the GitHub plugin last reported them.

type Refresher added in v0.4.0

type Refresher struct {
	PRs   PRStates
	Read  func(ctx context.Context, ref pr.Ref) error
	Every time.Duration
	Now   func() time.Time
}

Refresher reads a pull request in full again when the plugin's last report of it may be stale: never reported, or not seen for Every. A merge is final, so a merged one is never read again.

func (Refresher) Refresh added in v0.4.0

func (r Refresher) Refresh(ctx context.Context, u unit.Unit) (bool, error)

type ReportedInputs added in v0.3.0

type ReportedInputs struct {
	Reports readmodel.Reports
	Store   *inventory.Store
}

ReportedInputs are the pull requests the GitHub plugin last reported, as the facts, the holdings and a round's send read them: each row and its full read from its snapshot, the viewer the host keeps, the ended events from the host's log.

func (ReportedInputs) Ended added in v0.3.0

func (r ReportedInputs) Ended(ctx context.Context, kind string, units []unit.Unit) (map[unit.Unit]bool, error)

func (ReportedInputs) Facts added in v0.3.0

func (r ReportedInputs) Facts(ctx context.Context, rows []dinv.PR, viewer string) (map[unit.Unit]dinv.PlanFacts, error)

Facts are rows as their reported full reads hold them; a read of another version gives a zero ReadAt, as the plugin has yet to read it again.

func (ReportedInputs) PR added in v0.3.0

func (r ReportedInputs) PR(ctx context.Context, ref pr.Ref) (dinv.PR, bool, error)

PR is ref as the plugin last reported it; false when it reported none.

func (ReportedInputs) Rows added in v0.3.0

func (r ReportedInputs) Rows(ctx context.Context) ([]dinv.PR, error)

Rows are every reported pull request, in ref order.

func (ReportedInputs) Viewer added in v0.3.0

func (r ReportedInputs) Viewer(ctx context.Context) (string, error)

type TurnPayloads added in v0.3.0

type TurnPayloads struct{ Plugin turn.PayloadReader }

TurnPayloads is GitHub's turn payload: the GitHub plugin's, which Plugin reads, and the pull request a host round hands the turn, its prior review anchored to the head the loop's last record covered.

func (TurnPayloads) CompletePayload added in v0.3.0

func (TurnPayloads) CompletePayload(r turn.Request, p turn.Payload) (turn.Payload, error)

CompletePayload is the caller's pull request at the request's unit, its prior review anchored; a payload of another kind stays as it is.

func (TurnPayloads) Payload added in v0.3.0

func (g TurnPayloads) Payload(ctx context.Context, r turn.Request) (turn.Payload, error)

func (TurnPayloads) SyntheticPayload added in v0.3.0

func (TurnPayloads) SyntheticPayload(u unit.Unit, probe bool) (turn.Payload, error)

SyntheticPayload is the pull request u names, read from nowhere; a probe's carries the probe's title.

type UnitEvents added in v0.3.0

type UnitEvents struct {
	Store *inventory.Store
	PRs   PRStates
	// Fresh is how recently the plugin must have seen a closed pull request
	// for its close to count.
	Fresh time.Duration
	Now   func() time.Time
}

UnitEvents reads a pull request's stored reviews and merge, and its close from its reported state, as the resolver's events.

func (UnitEvents) UnitEvents added in v0.3.0

func (e UnitEvents) UnitEvents(ctx context.Context, u unit.Unit, since time.Time) ([]link.Event, error)

UnitEvents are u's events at or after since, oldest first. A dismissal is no review. A close is the reported pull request's, while it is closed and seen within Fresh: the stored close events outlive a reopening, which records no event, and a report goes stale on one no sweep reads.

type WorkspaceOverrides added in v0.3.0

type WorkspaceOverrides interface {
	Overrides(ctx context.Context) (map[unit.Unit]dinv.Override, error)
}

WorkspaceOverrides are the user's overrides, read for a taken-over pull request.

type WorkspaceRows added in v0.3.0

type WorkspaceRows interface {
	Rows(ctx context.Context) ([]dinv.PR, error)
	Viewer(ctx context.Context) (string, error)
}

WorkspaceRows are the stored pull requests, open or not, and the user's login on GitHub ("" when not known yet).

Directories

Path Synopsis
Package ghsourcetest holds the GitHub plugin's synthetic rows: one per situation kind, viewer's or others' pull request, in or out of scope, muted or not, each derived by prrow's real deriver.
Package ghsourcetest holds the GitHub plugin's synthetic rows: one per situation kind, viewer's or others' pull request, in or out of scope, muted or not, each derived by prrow's real deriver.
Package present is the GitHub plugin's source logic the daemon reaches through Action and View: the user's mutes, the rows of pull requests the read model does not list, the detail, the checks, Explore and the timings; and its bookkeeping on each snapshot of the rows.
Package present is the GitHub plugin's source logic the daemon reaches through Action and View: the user's mutes, the rows of pull requests the read model does not list, the detail, the checks, Explore and the timings; and its bookkeeping on each snapshot of the rows.

Jump to

Keyboard shortcuts

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