Documentation
¶
Overview ¶
Package catalog is the action catalog: the actions a pull request's row offers, the builtin ones and the intents', derived from facts the daemon gathers.
Index ¶
- Constants
- func CheckPluginKeys(id unit.ProviderID, ui *api.PluginUI) error
- func DraftStates(f DraftFacts) []api.ActionState
- func FirstProblem(p intentload.Problems) string
- func JoinDiffers(d dintent.Def, open, req map[string]any) string
- func JoinRefusalText(seq int64, intent, how string) string
- func Origin(s api.ActionSpec) int
- func PlanSpecs() []api.ActionSpec
- func PlanStates(it api.PlanItem, row []api.ActionState) []api.ActionState
- func Rank(s api.ActionSpec, provider unit.ProviderID) int
- func ResolveRun(reg *dintent.Registry, role string) (dintent.Def, bool)
- func RunNowIntent(reg *dintent.Registry, w api.Workspace, o api.Override, mine bool) (string, error)
- func SessionWithout(seq int64) string
- func Specs(l *intentload.Loaded) []api.ActionSpec
- func SpecsFor(l *intentload.Loaded, disabled []unit.ProviderID) []api.ActionSpec
- func States(f Facts) []api.ActionState
- func UnitStates(f Facts) []api.ActionState
- func Version(specs []api.ActionSpec) string
- func VersionFor(l *intentload.Loaded, disabled []unit.ProviderID) string
- func VersionOf(l *intentload.Loaded) string
- func WorkspaceRole(f RoleFacts) string
- type Asked
- type Config
- type DraftFacts
- type Facts
- type Intake
- type RoleFacts
Constants ¶
const ( SurfaceRow = "row" SurfaceDetail = "detail" SurfaceTUI = "tui" SurfaceMenubar = "menubar" SurfaceNotification = "notification" SurfaceCLI = "cli" SurfaceExplore = "explore" )
The surfaces an action spec names.
const ( OriginBuiltin = iota OriginBundled OriginUser )
The origins of an action spec, in the order a shared gtd verb ranks them.
const ( BasisPending = "pending:" BasisHeld = "held:" )
BasisPending and BasisHeld prefix a run_now basis.
const ( PlanApply = "plan_apply" PlanDismiss = "plan_dismiss" )
The ids of a plan item's own actions.
const ( ScopeUnit = "unit" ScopeItem = "item" ScopeDraft = "draft" )
The scopes of an action spec: what the action acts on.
const ( RoleReview = "review" RoleAuthor = "author" )
The workspace roles a held round resolves its intent by, as a manifest's workspace names them.
const (
// ReasonYours disables take_over on a pull request that is the user's.
ReasonYours = "It is yours already"
)
const SourceBuiltin = "builtin"
SourceBuiltin is the Source of an action spec Go declares.
const StartBlocked = "round blocked: "
StartBlocked prefixes the reason of a turn.start item a start block holds.
Variables ¶
This section is empty.
Functions ¶
func CheckPluginKeys ¶
func CheckPluginKeys(id unit.ProviderID, ui *api.PluginUI) error
CheckPluginKeys refuses the plugin's declared keys that the core or a built-in action holds on the binding's surface, or that two of its actions share; a binding with no surface binds every surface. The error starts with the plugin id.
func DraftStates ¶
func DraftStates(f DraftFacts) []api.ActionState
DraftStates are the draft actions in catalog order as they stand on a draft: all disabled naming the plugin when it is off.
func FirstProblem ¶
func FirstProblem(p intentload.Problems) string
FirstProblem is the first line of the problems, sorted.
func JoinDiffers ¶
JoinDiffers is how the open intake's inputs differ from a request's on the intent's join.differs_on, from the open intake's view: "with --self-review" or "without --self-review"; "" when they agree.
func JoinRefusalText ¶
JoinRefusalText is why open intake seq of intent refuses a request that differs from it as how says.
func Origin ¶
func Origin(s api.ActionSpec) int
Origin is where s comes from: Go (Source "builtin"), a bundled manifest (a relative path) or a user's (an absolute path).
func PlanSpecs ¶
func PlanSpecs() []api.ActionSpec
PlanSpecs are the actions a plan item may offer, in render order. The slice is shared: callers must not change it.
func PlanStates ¶
func PlanStates(it api.PlanItem, row []api.ActionState) []api.ActionState
PlanStates are the actions plan item it offers now. A turn.start item a start block holds offers the row's trust_run and unblock, from row, the actions its pull request's row offers: no plan action trusts a folder.
func Rank ¶
func Rank(s api.ActionSpec, provider unit.ProviderID) int
Rank orders the specs whose gtd verb an entry runs on a unit of provider, the lowest first: the built-in actions, then the intents of the unit's own provider, then those of any provider, a user's intent before a bundled one within each.
func ResolveRun ¶
ResolveRun is run.resolve: the drives_row intent whose workspace is the role of the held round's workspace; false when none or more than one is.
func RunNowIntent ¶
func RunNowIntent(reg *dintent.Registry, w api.Workspace, o api.Override, mine bool) (string, error)
RunNowIntent is the intent a held round runs as on a pull request with workspace w and override o, or the error that says why no single one does.
func SessionWithout ¶
SessionWithout is why a turn by hand's intake does not start without its brief.
func Specs ¶
func Specs(l *intentload.Loaded) []api.ActionSpec
Specs are the specs in render order: the built-in round group, the intents of l, then the other built-ins. The slice is shared: callers must not change it.
func SpecsFor ¶
func SpecsFor(l *intentload.Loaded, disabled []unit.ProviderID) []api.ActionSpec
SpecsFor are Specs of l without the actions of the disabled plugins, memoized per l and disabled set. The slice is shared: callers must not change it.
func States ¶
func States(f Facts) []api.ActionState
States are every action the row offers now, in the order of the specs.
func UnitStates ¶
func UnitStates(f Facts) []api.ActionState
UnitStates are the intents' actions a row of a provider other than GitHub offers now, in the order of the specs: the built-in actions act on pull requests or on the loop's rounds, which such a row has none of.
func Version ¶
func Version(specs []api.ActionSpec) string
Version names the specs, so a client refetches them when it changes.
func VersionFor ¶
func VersionFor(l *intentload.Loaded, disabled []unit.ProviderID) string
VersionFor is Version of SpecsFor.
func VersionOf ¶
func VersionOf(l *intentload.Loaded) string
VersionOf is Version of the specs of l.
func WorkspaceRole ¶
WorkspaceRole is the role of the pull request's workspace: the linked one's, else the author's for a pull request that is the user's to develop.
Types ¶
type Config ¶
type Config struct {
AddressReviews, AddressChecks bool
FollowupsWithoutWorkspace, AddressWithoutWorkspace bool
}
Config is the configuration the action slot reads.
type DraftFacts ¶
type DraftFacts struct {
State string
Provider unit.ProviderID
// Disabled is a draft whose plugin is off; NoPublisher one whose plugin posts nothing.
Disabled, NoPublisher bool
// MayHaveBeenPosted is a failed draft whose post may have reached its provider.
MayHaveBeenPosted bool
}
DraftFacts are what a draft's actions depend on.
type Facts ¶
type Facts struct {
Ref pr.Ref
Row api.Row
// Author, Workspace and Override are the pull request's, from its row's
// payload.
Author string
Workspace api.Workspace
Override api.Override
// HeldByCap is a row whose automatic round the daily cap held.
HeldByCap bool
Tracked bool
Open bool
Mine bool
Muted bool
// MutedStored is a mute kept in the override, active or not.
MutedStored bool
Draft bool
CrossRepository bool
ReviewRequestedMe bool
State, Base string
Question bool
// StartBlocked is a round a start block holds until the user acts.
StartBlocked bool
// TrustFolder is the folder whose trust lifts the start block, "" for
// a block on another question, and TrustHomes the agent homes trusting
// it writes in.
TrustFolder string
TrustHomes []string
// Intakes are the open intakes, the oldest first.
Intakes []Intake
NudgeWho []string
NudgeWhy string
NudgeRefusal string
GateOn, BriefOn bool
Forceable string
Config Config
// Asked is the action a request asks for, whose inputs an open intake
// joins on; zero for a row served to a client.
Asked Asked
Intents *intentload.Loaded
// Recommended is the execution mode recommended for the row's items ("session", "headless"), "" none;
// the row offers every mode's action whatever it says.
Recommended string
}
Facts are what decides the actions a row offers; the action slot of manifest predicates reads the same values through Get.