Documentation
¶
Overview ¶
Package agents loads trusted review agent definitions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalid identifies malformed agent definitions or unsafe agent names. ErrInvalid = errors.New("agents: invalid") // ErrNotFound identifies a requested agent absent from a loaded catalog. ErrNotFound = errors.New("agents: not found") )
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
ID string `json:"id"`
Name string `json:"name"`
Category Category `json:"category"`
Description string `json:"description,omitempty"`
Model string `json:"model,omitempty"`
Effort string `json:"effort,omitempty"`
FileGlobs []string `json:"file_globs,omitempty"`
AppliesWhen []string `json:"applies_when,omitempty"`
NeedsFullFileContent bool `json:"needs_full_file_content"`
Prompt string `json:"prompt,omitempty"`
Provenance Provenance `json:"provenance"`
Overridden []string `json:"overridden,omitempty"`
}
Agent is one loaded review agent.
type Catalog ¶
Catalog is the merged, precedence-resolved agent catalog.
type Category ¶
type Category struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Owner string `json:"owner,omitempty"`
}
Category is one agent category definition.
type LoadOptions ¶
type LoadOptions struct {
ProfileDirs []string
Repo *RepoSource
FlagDirs []string
}
LoadOptions configures catalog loading.
type Provenance ¶
type Provenance struct {
Kind SourceKind `json:"kind"`
Label string `json:"label,omitempty"`
Ref string `json:"ref,omitempty"`
SHA string `json:"sha,omitempty"`
Index int `json:"index,omitempty"`
}
Provenance identifies the winning source for one loaded agent.
func (Provenance) String ¶
func (p Provenance) String() string
String returns the user-facing provenance label.
type RepoInfo ¶
type RepoInfo struct {
Ref string `json:"ref"`
SHA string `json:"sha"`
Provenance string `json:"provenance"`
}
RepoInfo describes the trusted repo-local source, when one was considered.
type RepoReader ¶
type RepoReader interface {
ListTreeAtRef(ctx context.Context, ref gitprovider.PRRef, gitRef string, treePath string) ([]gitprovider.TreeEntry, error)
GetFileAtRef(ctx context.Context, ref gitprovider.PRRef, gitRef string, filePath string) ([]byte, error)
}
RepoReader is the narrow read seam needed to load repo-local agent files.
type RepoSource ¶
type RepoSource struct {
Reader RepoReader
Ref gitprovider.PRRef
PR gitprovider.PR
}
RepoSource pins repo-local agents to a resolved pull request base SHA.
type SourceKind ¶
type SourceKind string
SourceKind identifies where an agent definition came from.
const ( SourceProfile SourceKind = "profile" SourceRepo SourceKind = "repo" SourceFlag SourceKind = "flag" )
Supported source kinds.
Click to show internal directories.
Click to hide internal directories.