{"modulePath":"github.com/wloophq/wloop","version":"v0.7.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package github\n\nPackage github is the GitHub source plugin: what its binary serves through the SDK, over its own store in the state directory the host gives it.\n\n## Constants\n\n```go\nconst (\n\t// ActionBasics reads a pull request's basics: its answer is the\n\t// pull request as JSON.\n\tActionBasics = \"pr.basics\"\n\t// ActionRefresh reads a pull request in full into the store and\n\t// reports it.\n\tActionRefresh = \"pr.refresh\"\n\t// ActionAdopt takes a pull request over into the loop: the store keeps\n\t// it taken over, and the reviews its address rounds covered are\n\t// forgotten, so its triage starts from none of them. Its args are the\n\t// pull request's basics as the host read them, which the store keeps\n\t// until its next read when it holds none of it.\n\tActionAdopt = \"pr.adopt\"\n)\n```\nThe actions the host calls.\n\n```go\nconst (\n\tEffectReviewed  = \"pr.reviewed\"\n\tEffectAddressed = \"pr.addressed\"\n)\n```\nThe effects plugin.toml declares.\n\n```go\nconst (\n\tJobFast = \"fast\"\n\tJobSlow = \"slow\"\n)\n```\nThe jobs plugin.toml declares, which Ingest runs.\n\n```go\nconst (\n\t// CommandClone clones a repository: clone \u003cowner\u003e/\u003cname\u003e \u003cpath\u003e.\n\tCommandClone = \"clone\"\n\t// CommandAuth checks that gh is installed and logged in; it exits\n\t// ExitNoGH when gh is not installed.\n\tCommandAuth = \"auth\"\n\t// CommandReviewedRepos lists the repositories of the pull requests the\n\t// viewer reviewed since a date: reviewed-repos \u003cyyyy-mm-dd\u003e, one\n\t// owner/name a line, once per pull request.\n\tCommandReviewedRepos = \"reviewed-repos\"\n\t// CommandTeams lists the viewer's teams, one org/slug a line.\n\tCommandTeams = \"teams\"\n)\n```\n\n```go\nconst (\n\tToolPost    = \"github_post\"\n\tToolThreads = \"github_threads\"\n)\n```\nThe tools of the plugin's manifest.\n\n```go\nconst (\n\tViewExplore       = \"explore\"\n\tViewExploreRecent = \"explore.recent\"\n\tViewChecks        = \"checks\"\n\tViewBudget        = \"budget\"\n\t// ViewCandidate reads one pull request from GitHub as Explore shows\n\t// it, in any state; its query is a ChecksQuery.\n\tViewCandidate = \"candidate\"\n)\n```\nThe views the host asks for: a search of GitHub for Explore, the recent searches, the failed steps of a pull request's failing checks and the API's budget.\n\n```go\nconst ActionNudgePrepare = \"nudge.prepare\"\n```\nActionNudgePrepare is the nudge's prepare: it refuses a nudge when nobody but the viewer is to be asked or the same wait was nudged already, and fills whom it asks into the call's inputs.\n\n```go\nconst ExitNoGH = 127\n```\nExitNoGH is the exit of a command that found no gh to run, the shell's \"command not found\".\n\n## Variables\n\n```go\nvar Commands = []string{CommandClone, CommandAuth, CommandReviewedRepos, CommandTeams}\n```\nCommands are the commands the plugin serves in CLI mode.\n\n## Functions\n\n```go\nfunc PrepareNudge(ctx context.Context, h src.Host, env NudgeEnv, u sdk.Unit, raw json.RawMessage) (json.RawMessage, error)\n```\nPrepareNudge is the nudge's prepare of u with the daemon's args, reading the unit's events and turns from h.\n\n## Types\n\n```go\ntype BriefParts struct {\n\tChangedFiles int      `json:\"changed_files\"`\n\tFiles        []string `json:\"files,omitempty\"`\n\tTitle        string   `json:\"title,omitempty\"`\n\tBody         string   `json:\"body,omitempty\"`\n\tIssue        string   `json:\"issue,omitempty\"`\n\t// Listed are the changed files as the prompt lists them, with their\n\t// additions and deletions.\n\tListed []string `json:\"listed,omitempty\"`\n\t// DiffError is why GitHub served no diff; \"\" with one.\n\tDiffError string `json:\"diff_error,omitempty\"`\n}\n```\nBriefParts are a pull request's parts of its brief input: what brief\\_runs.input stores, and the facts the prompt lays out besides the diff, which is the input's text.\n\n```go\ntype Budget struct {\n\tLow       bool      `json:\"low\"`\n\tRemaining int       `json:\"remaining\"`\n\tLimit     int       `json:\"limit\"`\n\tResetAt   time.Time `json:\"reset_at,omitzero\"`\n}\n```\nBudget is the API's GraphQL bucket, which the searches and the sweeps spend; Low says it refuses background reads.\n\n```go\ntype Check struct {\n\tName    string   `json:\"name\"`\n\tURL     string   `json:\"url,omitempty\"`\n\tSummary string   `json:\"summary,omitempty\"`\n\tSteps   []string `json:\"steps,omitempty\"`\n}\n```\nCheck is a failing check of a pull request, with the failed steps of its GitHub Actions job when they could be read.\n\n```go\ntype ChecksQuery struct {\n\tOwner  string `json:\"owner\"`\n\tRepo   string `json:\"repo\"`\n\tNumber int    `json:\"number\"`\n}\n```\nChecksQuery names the pull request a view reads.\n\n```go\ntype Data struct {\n\tPR            pr.PR         `json:\"pr\"`\n\tDetail        *store.Detail `json:\"detail,omitempty\"`\n\tDetailVersion int           `json:\"detail_version,omitempty\"`\n\tDetailReadAt  time.Time     `json:\"detail_read_at,omitzero\"`\n\tTracked       bool          `json:\"tracked,omitempty\"`\n\t// Row is the source part of the pull request's row payload.\n\tRow *row.Payload `json:\"row,omitempty\"`\n\t// Adopted says the pull request is taken over into the loop.\n\tAdopted bool `json:\"adopted,omitempty\"`\n\t// Plan is the planner's part.\n\tPlan *PlanData `json:\"plan,omitempty\"`\n}\n```\nData is a pull request's snapshot data: its row, its detail and whether the user tracks it.\n\n```go\ntype ExploreQuery struct {\n\tQuery string `json:\"query\"`\n}\n```\nExploreQuery is what Explore asks for.\n\n```go\ntype NudgeEnv struct {\n\tViewer string\n\tIgnore []string\n\tNow    time.Time\n\tTexts  nudge.Texts\n}\n```\nNudgeEnv is what the nudge's prepare reads besides the host: the viewer, who a nudge never mentions, the time and the profile's texts.\n\n```go\ntype Payload struct {\n\tURL, Owner, Repo  string\n\tNumber            int\n\tTitle, Author     string\n\tState             string\n\tAssociation       string\n\tHead, Base        string\n\tLabels            []string\n\tCrossRepository   bool\n\tVisibility        string\n\tPrior             *PriorReview\n\tReviewRequested   bool\n\tLastReviewVerdict string\n}\n```\nPayload is the data a turn's templates read of a pull request, under the payload root plugin.toml names: its basics as GitHub reads them now and your prior review, anchored to the head the loop's last record covered.\n\n```go\ntype PlanData struct {\n\tRank  plan.Rank  `json:\"rank\"`\n\tBoard plan.Board `json:\"board\"`\n}\n```\nPlanData is the planner's part of a pull request's snapshot data: where its rounds rank and what the board reads of its workspaces.\n\n```go\ntype Plugin struct {\n\t// GH nil is gh on the PATH.\n\tGH gh.Runner\n\t// API are the API client's options; the zero value is GitHub's API at\n\t// the host gh names, with gh's token. The plugin sets its meter and\n\t// user agent.\n\tAPI api.Options\n\t// Now nil is the clock.\n\tNow func() time.Time\n\t// Git nil reads the checkouts with the git binary.\n\tGit plan.Git\n\t// contains filtered or unexported fields\n}\n```\nPlugin is the GitHub source plugin as the SDK serves it.\n\n```go\nfunc (p *Plugin) Action(ctx context.Context, req src.ActionRequest) (json.RawMessage, error)\n```\nAction runs one of the actions the host calls.\n\n```go\nfunc (p *Plugin) ApplyEffect(ctx context.Context, req src.EffectRequest) error\n```\nApplyEffect applies an effect of the plugin's turns, and a draft's pr.nudged, which the publisher recorded as it posted.\n\n```go\nfunc (p *Plugin) Basis(ctx context.Context, u sdk.Unit, _ string) (string, error)\n```\nBasis is u's head commit as GitHub has it now, never the store's: what a review on u would be written against.\n\n```go\nfunc (p *Plugin) BriefDescribe(ctx context.Context, in src.BriefInput) (string, error)\n```\nBriefDescribe is in, one line, as the prompt's header names it.\n\n```go\nfunc (p *Plugin) BriefInput(ctx context.Context, u sdk.Unit) (src.BriefInput, error)\n```\nBriefInput reads what a brief of a pull request reads now: its title, description, first closing issue and changed files, then its diff, under the priority the host's call carries.\n\n```go\nfunc (p *Plugin) BriefRevision(ctx context.Context, u sdk.Unit) (src.BriefRevision, error)\n```\nBriefRevision is what the stored pull request is at: its head and its description's edit time, its changed files, and the attempt key the brief runs have stored since version 4.\n\n```go\nfunc (p *Plugin) BriefStale(_ context.Context, req src.BriefStaleRequest) (bool, error)\n```\nBriefStale is the queue's rule: a failed attempt is due when the pull request moved or its backoff passed, a brief when the pull request moved: its description edited a quiet while ago, or a head that added more than a few files.\n\n```go\nfunc (p *Plugin) BriefWant(context.Context, sdk.Unit) (bool, error)\n```\nBriefWant is false: the host's queue writes a pull request's brief, not the plugin.\n\n```go\nfunc (p *Plugin) CallTool(ctx context.Context, call src.ToolCall) (src.ToolResult, error)\n```\nCallTool runs one of the manifest's tools for the session call.Session.\n\n```go\nfunc (p *Plugin) Checkout(ctx context.Context, u sdk.Unit) (src.Checkout, bool, error)\n```\nCheckout is the repository, head and base a pull request's work checks out, as the store last read them.\n\n```go\nfunc (p *Plugin) Health(context.Context) (sdk.Health, error)\n```\nHealth is loading until the store is open and every stored pull request was reported.\n\n```go\nfunc (p *Plugin) Identity(ctx context.Context) (src.Identity, error)\n```\nIdentity is the viewer: the login the store keeps, else the one GitHub's API names once started, or gh in CLI mode, which the store then keeps; and the scope teams the viewer is in.\n\n```go\nfunc (p *Plugin) Ingest(ctx context.Context, req src.IngestRequest) (src.IngestResult, error)\n```\nIngest runs one of the manifest's jobs, then reports what it changed.\n\n```go\nfunc (p *Plugin) Landed(context.Context, src.Draft) (sdk.Unit, bool, error)\n```\n\n```go\nfunc (p *Plugin) Locate(ctx context.Context, dir string) (sdk.Unit, bool, error)\n```\nLocate is the pull request of the branch the checkout at dir has, as gh reads it.\n\n```go\nfunc (p *Plugin) Notify(ctx context.Context, units []sdk.Unit, topics []sdk.Topic) error\n```\nNotify links the workspaces again when the host's listing moved, reads the configuration again when it changed, and reports again the pull requests whose rows read what changed: their events and turns, the viewer, the configuration.\n\n```go\nfunc (p *Plugin) Payload(ctx context.Context, req src.PayloadRequest) (src.PayloadResult, error)\n```\nPayload is a pull request as a turn reads it.\n\n```go\nfunc (p *Plugin) Place(ctx context.Context, d src.Draft) (src.Placed, error)\n```\n\n```go\nfunc (p *Plugin) Placement(context.Context, sdk.Unit, string) (src.Placements, error)\n```\nPlacement is where a pull request's work runs: the plugin names none, and the host's workspaces place it.\n\n```go\nfunc (p *Plugin) Plan(ctx context.Context, u sdk.Unit, st src.RoundState) (src.Plan, error)\n```\nPlan is the rounds the planner plans on u over st, the host's round state of u: each with the marks the host writes when it sends or skips it.\n\n```go\nfunc (p *Plugin) Proposals(ctx context.Context, now time.Time) (src.Proposed, error)\n```\nProposals are the github-nudge rule's drafts: one per stalled open pull request whose nudge would go now, and its withdrawal on each open one no longer stalled. None before the store knows the viewer.\n\n```go\nfunc (p *Plugin) Publish(ctx context.Context, d src.Draft) (src.Evidence, error)\n```\n\n```go\nfunc (p *Plugin) Resolve(_ context.Context, address string) (sdk.Unit, bool, error)\n```\nResolve is the pull request a page address or a key names.\n\n```go\nfunc (p *Plugin) RunCLI(ctx context.Context, req src.CLIRequest, stdout, stderr io.Writer) (int, error)\n```\nRunCLI runs one of the commands plugin.toml declares, with gh.\n\n```go\nfunc (p *Plugin) Start(ctx context.Context, req src.StartRequest) error\n```\nStart opens the plugin's store in its state directory, importing what the host exported once, and reports every stored pull request; the plugin is loading until it has.\n\n```go\nfunc (p *Plugin) Stop(context.Context) error\n```\nStop ends the first report and closes the store.\n\n```go\nfunc (p *Plugin) Track(ctx context.Context, req src.TrackRequest) (src.Tracked, error)\n```\nTrack reads a pull request in full and follows it once the host, which admitted the read, asks to.\n\n```go\nfunc (p *Plugin) Untrack(ctx context.Context, u sdk.Unit) error\n```\nUntrack stops tracking a pull request.\n\n```go\nfunc (p *Plugin) Validate(ctx context.Context, d src.Draft) error\n```\n\n```go\nfunc (p *Plugin) Verify(ctx context.Context, d src.Draft, startedAt time.Time) (src.Evidence, bool, error)\n```\n\n```go\nfunc (p *Plugin) View(ctx context.Context, req src.ViewRequest) (json.RawMessage, error)\n```\nView serves one of the plugin's views.\n\n```go\nfunc (p *Plugin) Where(ctx context.Context, d src.Draft) (string, error)\n```\n\n```go\nfunc (p *Plugin) Within(ctx context.Context, u sdk.Unit, target string) (bool, error)\n```\nWithin says whether target lies inside u's pull request: the pull request, one of its review comments or one of its review threads.\n\n```go\nfunc (p *Plugin) WriteState(context.Context, src.StateWrite) (src.Evidence, error)\n```\n\n```go\ntype PriorReview struct {\n\tVerdict, Head, Endorsed string\n\tAt                      time.Time\n}\n```\nPriorReview is your latest submitted review: the head it covered, when, its newest verdict that is not a comment, and whether you stand behind the loop's record of it.\n\n","path":"github.com/wloophq/wloop/plugins/github","name":"github","synopsis":"Package github is the GitHub source plugin: what its binary serves through the SDK, over its own store in the state directory the host gives it.","isRedistributable":true}
