Documentation
¶
Overview ¶
Package source is where a source registers: its unit codec, its ingestion job, its rows and its workflow facts. Only the composition root and the sources import it.
Index ¶
Constants ¶
const ( CapabilityCheckouts = api.CapabilityCheckouts CapabilityBriefs = api.CapabilityBriefs CapabilityPublishes = api.CapabilityPublishes CapabilityReacts = api.CapabilityReacts CapabilityItems = api.CapabilityItems CapabilityDetail = api.CapabilityDetail )
The capability names Module.Capabilities lists and api.Plugin serves.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLI ¶
type CLI struct {
Name, Usage string
Run func(ctx context.Context, args []string, out, errw io.Writer) error
}
CLI is a plugin's own command, run as <command> <Name> ... when Name is not a core command.
type Checkout ¶ added in v0.2.0
type Checkout struct {
Repo string // owner/name
// Branch is the unit's own branch; "" for the repository's default.
Branch string
// Head is the commit the unit's work is on; "" when unknown.
Head string
}
Checkout is the repository a unit's work checks out.
type Checkouts ¶ added in v0.2.0
type Checkouts interface {
Checkout(ctx context.Context, u unit.Unit) (c Checkout, ok bool, err error)
}
Checkouts is an optional capability of a plugin: the repository of a unit, which a worktree checks out; ok is false for a unit with none.
type Deps ¶
type Deps struct {
DB *sqlite.DB
Inventory *inventory.Store
GitHub *github.Client
WS *workspace.Set
// Sink is the view sink whose columns WS reports as workspace statuses.
Sink string
Turns *turns.Service
Briefs *brief.Queue
Changes *change.Log
Clock port.Clock
Log func(format string, args ...any)
// Git reads the local checkouts; Agents are the agents by name and
// Intents the loaded intents' registry, nil before a profile loads.
Git gitx.Git
Agents map[string]turns.Agent
Intents func() *dintent.Registry
// Units is the daemon's registry, built after the modules; Links the link store.
Units func() *unit.Registry
Links port.LinkStore
}
Deps are the shared handles a source builds from. Briefs is nil when the brief is off, WS when no workspace manager is configured.
type LinkResolver ¶ added in v0.2.0
type LinkResolver interface {
Resolve(ctx context.Context, url string) (u unit.Unit, ok bool, err error)
}
LinkResolver is an optional capability of a plugin: the units of other plugins a link of its units names, such as a pull request a thread links.
type Module ¶
type Module struct {
ID unit.ProviderID
Codec unit.Codec
Ingest ingest.Job
// Rows builds the source's read model provider with the daemon's row deps.
Rows func(d readmodel.RowDeps) readmodel.Provider
// Facts are the source's workflow facts; nil until the source offers any.
Facts automation.Units
// Track reads a unit about to be tracked, wrapping a failed read in
// port.ErrNotFound or port.ErrGitHub when it can tell which; nil tracks
// the source's units unread.
Track func(ctx context.Context, u unit.Unit) (port.TrackRead, error)
// Untrack stops following a unit Track followed; set, the source keeps
// its own follows and the daemon sends it every track and untrack of
// its units.
Untrack func(ctx context.Context, u unit.Unit) error
// Slow is the source's slow job, which rebuilds what the ingestion job
// keeps cheap; nil is none.
Slow func(ctx context.Context) (summary, skipped string, err error)
// Items are the derived items of a row: deterministic, stable ids, no I/O; the viewer comes from the row's payload.
Items func(row api.Row) []items.Item
// Card is required when Items is set or the plugin's units carry items.
Card func(ctx context.Context, row api.Row) (card.Card, error)
// Identity is the user as this plugin knows them.
Identity func(ctx context.Context) (items.Person, error)
UnitEvents links.EventReader
UI *api.PluginUI
// WebAssets are served under /plugins/<id>/.
WebAssets fs.FS
CLI *CLI
// Run is a long-running stream; the daemon runs it for an enabled plugin until ctx ends, restarting after 30 s on error.
Run func(ctx context.Context) error
Health func(ctx context.Context) (api.SourceHealth, error)
// Jobs are extra daemon jobs of the plugin.
Jobs []Job
Publisher port.Effects
// Reacts says Publisher posts drafts of kind react.
Reacts bool
// Proposals is called by the proposals job; a provider with Proposals gets no generic stalled nudge.
Proposals func(ctx context.Context, now time.Time) ([]outbox.Proposal, error)
Payload turn.PayloadReader
PlacementDefaults placement.Defaults
PlacementHints placement.Hints
// OnPosted are the draft effects the plugin applies once a draft of its
// units is sent, by effect name (builtin.Effects), such as unit.closed.
OnPosted map[string]outbox.Effect
// Checkouts says which repository a unit's work checks out.
Checkouts Checkouts
// Briefs is how the brief queue reads the plugin's units; nil when the
// plugin's units are briefed by no queue.
Briefs brief.BriefSource
// Links resolves the units of other plugins the plugin's units link to.
Links LinkResolver
// Detail says the cockpit shows a detail of the plugin's units.
Detail bool
}
Module is one source as the daemon runs it.
func (Module) Capabilities ¶ added in v0.2.0
Capabilities are what a plugin can do, as clients read them.