Documentation
¶
Overview ¶
Package provider defines the Provider interface and URL-based registry that selects a GitHub or GitLab adapter. Lands in M2.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PRSummary ¶
type PRSummary struct {
Number int
Title string
Author string
URL string // canonical, ready to hand to runReview
UpdatedAt time.Time
Draft bool
}
PRSummary is one row in the inbox list. URL is the only field the review pipeline strictly needs; the rest are display-only.
type Provider ¶
type Provider interface {
Supports(rawURL string) bool
Preflight(ctx context.Context) error
Fetch(ctx context.Context, rawURL string) (*review.ReviewInput, error)
// PreflightList is a stricter preflight required for List(). The
// public-URL Fetch flow doesn't need auth, but listing typically
// does. Implementations should verify `gh auth status` / `glab auth
// status` (or equivalent) succeeds and return an actionable error
// otherwise.
PreflightList(ctx context.Context) error
// List enumerates open PRs/MRs for the given repo. Returns at most
// 30 results in v1 (no pagination).
List(ctx context.Context, repo RepoCoord) ([]PRSummary, error)
}
Provider fetches review target data for one host family.
Callers must invoke Preflight before Fetch. Preflight verifies the runtime environment (required CLI present, authenticated) so the model is never invoked when the fetch path is doomed to fail.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry dispatches a URL to the first Provider that supports it.
The order of providers passed to NewRegistry is the dispatch order; for v1 the order doesn't matter because GitHub and GitLab URLs don't overlap, but stable ordering keeps error messages deterministic.
func NewRegistry ¶
NewRegistry builds a Registry from a list of providers.
type RepoCoord ¶
type RepoCoord struct {
Host string // "github.com", "gitlab.com", "gitlab.example.com"
Owner string // "selyafi" or "my-group/sub-group" (GitLab nested)
Name string // "diffsmith"
}
RepoCoord identifies a repository hosted on a Git forge. Used by the inbox flow to enumerate PRs/MRs for a specific repo without first constructing a URL.
type Runner ¶
Runner executes an external command and returns its stdout.
Modeled as a function type so tests inject canned responses without implementing an interface. Real implementations should use argv form (variadic args) — passing user-controlled values through `sh -c` is forbidden by docs/architecture.md § Process Execution.
Pass stdin as nil when the command takes no input. Adapters that pipe data to the child (e.g. codex via ADR 0007) provide a Reader here.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package githubgh implements the GitHub provider adapter by shelling out to the `gh` CLI.
|
Package githubgh implements the GitHub provider adapter by shelling out to the `gh` CLI. |
|
Package gitlabglab implements the GitLab provider adapter by shelling out to the `glab` CLI.
|
Package gitlabglab implements the GitLab provider adapter by shelling out to the `glab` CLI. |