provider

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWatchStatusUnsupported = errors.New("review provider does not support watch status")

Functions

func ActivateOverlay

func ActivateOverlay(entries []OverlayEntry) (func(), error)

ActivateOverlay installs a command-scoped review-provider overlay and returns a restore function.

Types

type CatalogEntry

type CatalogEntry struct {
	Name        string
	DisplayName string
}

CatalogEntry captures the user-facing review-provider catalog shape.

func Catalog

func Catalog(base RegistryReader) []CatalogEntry

Catalog returns the active provider catalog layered on top of the supplied base registry.

type ExtensionBridge

type ExtensionBridge interface {
	FetchReviews(ctx context.Context, providerName string, req FetchRequest) ([]ReviewItem, error)
	ResolveIssues(ctx context.Context, providerName string, pr string, issues []ResolvedIssue) error
	Close() error
}

ExtensionBridge lazily bridges one extension-backed review provider to the extension subprocess protocol.

type FetchRequest

type FetchRequest struct {
	PR              string `json:"pr"`
	IncludeNitpicks bool   `json:"include_nitpicks,omitempty"`
}

type OverlayEntry

type OverlayEntry struct {
	Name        string
	DisplayName string
	Kind        OverlayKind
	Target      string
	Command     string
	Bridge      ExtensionBridge
	Metadata    map[string]string
}

OverlayEntry captures one declarative review-provider overlay entry assembled during command bootstrap.

type OverlayKind

type OverlayKind string

OverlayKind declares the runtime behavior of one review-provider overlay entry.

const (
	// OverlayKindAlias delegates to another provider by name.
	OverlayKindAlias OverlayKind = "alias"
	// OverlayKindExtension is implemented by the declaring extension subprocess.
	OverlayKindExtension OverlayKind = "extension"
)

type OverlayRegistry

type OverlayRegistry struct {
	// contains filtered or unexported fields
}

OverlayRegistry layers overlay providers on top of a base registry without mutating the base catalog.

func NewOverlayRegistry

func NewOverlayRegistry(base RegistryReader) *OverlayRegistry

NewOverlayRegistry constructs a provider overlay on top of a base registry.

func (*OverlayRegistry) Get

func (r *OverlayRegistry) Get(name string) (Provider, error)

Get resolves an overlay provider first, then falls back to the base registry.

func (*OverlayRegistry) List

func (r *OverlayRegistry) List() []Provider

func (*OverlayRegistry) Register

func (r *OverlayRegistry) Register(p Provider)

Register adds or replaces one overlay provider without mutating the base registry.

type Provider

type Provider interface {
	Name() string
	FetchReviews(ctx context.Context, req FetchRequest) ([]ReviewItem, error)
	ResolveIssues(ctx context.Context, pr string, issues []ResolvedIssue) error
}

Provider abstracts review fetching and thread resolution for a specific source.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry maps provider names to implementations.

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Get

func (r *Registry) Get(name string) (Provider, error)

func (*Registry) List

func (r *Registry) List() []Provider

List returns the registered providers in deterministic name order.

func (*Registry) Register

func (r *Registry) Register(p Provider)

type RegistryReader

type RegistryReader interface {
	Get(name string) (Provider, error)
}

RegistryReader captures the provider lookup surface used by runtime code and overlays.

func BuildOverlayRegistry

func BuildOverlayRegistry(base RegistryReader, entries []OverlayEntry) (RegistryReader, error)

BuildOverlayRegistry applies the supplied overlay entries to the provided base registry without mutating the process-global overlay state.

func ResolveRegistry

func ResolveRegistry(base RegistryReader) RegistryReader

ResolveRegistry applies the active command-scoped overlay to the provided base registry.

type ResolvedIssue

type ResolvedIssue struct {
	FilePath    string `json:"file_path"`
	ProviderRef string `json:"provider_ref,omitempty"`
}

ResolvedIssue identifies an issue file that the agent marked as resolved.

type ReviewItem

type ReviewItem struct {
	Title       string `json:"title"`
	File        string `json:"file"`
	Line        int    `json:"line,omitempty"`
	Severity    string `json:"severity,omitempty"`
	Author      string `json:"author,omitempty"`
	Body        string `json:"body"`
	ProviderRef string `json:"provider_ref,omitempty"`

	ReviewHash              string `json:"review_hash,omitempty"`
	SourceReviewID          string `json:"source_review_id,omitempty"`
	SourceReviewSubmittedAt string `json:"source_review_submitted_at,omitempty"`
}

ReviewItem is the normalized output of a provider fetch operation.

type WatchStatus

type WatchStatus struct {
	PRHeadSHA                 string           `json:"pr_head_sha"`
	ReviewCommitSHA           string           `json:"review_commit_sha,omitempty"`
	ReviewID                  string           `json:"review_id,omitempty"`
	ReviewState               string           `json:"review_state,omitempty"`
	ProviderStatusState       string           `json:"provider_status_state,omitempty"`
	ProviderStatusDescription string           `json:"provider_status_description,omitempty"`
	ProviderStatusUpdatedAt   time.Time        `json:"provider_status_updated_at,omitempty"`
	State                     WatchStatusState `json:"state"`
	SubmittedAt               time.Time        `json:"submitted_at,omitempty"`
}

WatchStatus reports whether a provider review covers the current PR head.

func FetchWatchStatus

func FetchWatchStatus(ctx context.Context, p Provider, req WatchStatusRequest) (WatchStatus, error)

type WatchStatusProvider

type WatchStatusProvider interface {
	Provider
	WatchStatus(ctx context.Context, req WatchStatusRequest) (WatchStatus, error)
}

WatchStatusProvider is an optional review-provider capability used by watch mode.

type WatchStatusRequest

type WatchStatusRequest struct {
	PR string `json:"pr"`
}

type WatchStatusState

type WatchStatusState string
const (
	WatchStatusPending         WatchStatusState = "pending"
	WatchStatusStale           WatchStatusState = "stale"
	WatchStatusCurrentReviewed WatchStatusState = "current_reviewed"
	WatchStatusCurrentSettled  WatchStatusState = "current_settled"
	WatchStatusUnsupported     WatchStatusState = "unsupported"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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