Documentation
¶
Index ¶
- type BranchContext
- type BranchContextOptions
- type DiffStats
- type FileChange
- type Finding
- type FixResult
- type Grade
- type PRCheck
- type PRComment
- type PRContext
- type PRInfo
- type PRTools
- type ParsedReview
- type ProjectContext
- type ProjectContextOptions
- type RunResult
- type Runner
- func (r *Runner) FixFinding(ctx context.Context, finding *Finding, prompt string) (*FixResult, error)
- func (r *Runner) ReviewBranch(ctx context.Context, opts BranchContextOptions) (*RunResult, error)
- func (r *Runner) ReviewPR(ctx context.Context, prRef string) (*RunResult, error)
- func (r *Runner) ReviewProject(ctx context.Context, opts ProjectContextOptions) (*RunResult, error)
- type RunnerConfig
- type Severity
- type VerificationTools
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BranchContext ¶
type BranchContext struct {
RepoRoot string
Branch string
BaseBranch string
Files []FileChange
Stats DiffStats
Diff string
Unstaged string
RecentLog string
AgentsMD string
}
BranchContext contains context for branch review.
func AssembleBranchContext ¶
func AssembleBranchContext(opts BranchContextOptions) (*BranchContext, *transparency.ContextAudit, error)
AssembleBranchContext gathers context for branch review.
type BranchContextOptions ¶
type BranchContextOptions struct {
MaxDiffBytes int
IncludeUnstaged bool
IncludeAgents bool
BaseBranch string // Defaults to main or master
}
BranchContextOptions configures branch context assembly.
func DefaultBranchContextOptions ¶
func DefaultBranchContextOptions() BranchContextOptions
DefaultBranchContextOptions returns sensible defaults.
type DiffStats ¶
DiffStats contains diff statistics.
func (DiffStats) TotalChanges ¶
TotalChanges returns total lines changed.
type FileChange ¶
FileChange represents a file change.
type Finding ¶
type Finding struct {
ID string // e.g., "FINDING-001"
Severity Severity // CRITICAL, MAJOR, MINOR
Title string // Brief description
File string // File path
Line int // Line number (0 if not specified)
Evidence string // Proof of the issue
Impact string // Business/technical impact
Fix string // Description of fix
SuggestedFix string // Code block with suggested fix
}
Finding represents a single issue found during review.
type FixResult ¶
type FixResult struct {
// Summary describes what was changed
Summary string
// FilesChanged lists files that were modified
FilesChanged []string
// Trace contains transparency data
Trace *transparency.Trace
// Error if fix failed
Error error
}
FixResult contains the result of fixing a finding.
type PRContext ¶
type PRContext struct {
PR *PRInfo
Diff string
Comments []PRComment
Checks []PRCheck
Files []string
}
PRContext contains context for PR review.
func AssemblePRContext ¶
func AssemblePRContext(prRef string) (*PRContext, *transparency.ContextAudit, error)
AssemblePRContext gathers context for PR review using gh CLI.
type PRInfo ¶
type PRInfo struct {
Number int
Title string
Author string
State string
URL string
Body string
CIStatus string
Labels []string
BaseBranch string
HeadBranch string
Additions int
Deletions int
ChangedFiles int
}
PRInfo contains parsed PR metadata.
type PRTools ¶
type PRTools struct {
// contains filtered or unexported fields
}
PRTools provides tools for PR review verification.
func NewPRTools ¶
NewPRTools creates PR tools with the given context.
func (*PRTools) Definitions ¶
func (p *PRTools) Definitions() []tools.Definition
Definitions returns the tool definitions for PR review.
type ParsedReview ¶
type ParsedReview struct {
Grade Grade
Summary string
BuildStatus string
TestStatus string
Findings []Finding
Remarks []string
Approved bool
Blockers []string // Finding IDs
Suggestions []string // Finding IDs
RawReview string
}
ParsedReview contains the structured review data.
func ParseReview ¶
func ParseReview(review string) *ParsedReview
ParseReview extracts structured data from review markdown.
func (*ParsedReview) BlockingFindings ¶
func (p *ParsedReview) BlockingFindings() []Finding
BlockingFindings returns findings that block approval (Critical + Major).
func (*ParsedReview) CriticalFindings ¶
func (p *ParsedReview) CriticalFindings() []Finding
CriticalFindings returns only critical severity findings.
func (*ParsedReview) FindingByID ¶
func (p *ParsedReview) FindingByID(id string) *Finding
FindingByID returns a finding by its ID.
func (*ParsedReview) HasBlockers ¶
func (p *ParsedReview) HasBlockers() bool
HasBlockers returns true if there are blocking findings.
func (*ParsedReview) MajorFindings ¶
func (p *ParsedReview) MajorFindings() []Finding
MajorFindings returns only major severity findings.
func (*ParsedReview) MinorFindings ¶
func (p *ParsedReview) MinorFindings() []Finding
MinorFindings returns only minor severity findings.
type ProjectContext ¶
type ProjectContext struct {
RepoRoot string
Branch string
Tree string
GoMod string
PackageJSON string
ReadmeMD string
AgentsMD string
RecentLog string
}
ProjectContext contains context for project review.
func AssembleProjectContext ¶
func AssembleProjectContext(opts ProjectContextOptions) (*ProjectContext, *transparency.ContextAudit, error)
AssembleProjectContext gathers context for project review.
type ProjectContextOptions ¶
ProjectContextOptions configures project context assembly.
func DefaultProjectContextOptions ¶
func DefaultProjectContextOptions() ProjectContextOptions
DefaultProjectContextOptions returns sensible defaults.
type RunResult ¶
type RunResult struct {
// Review is the generated review (markdown)
Review string
// Parsed contains the structured review data (populated by Parse())
Parsed *ParsedReview
// Trace contains transparency data
Trace *transparency.Trace
// ContextAudit shows what context was sent
ContextAudit *transparency.ContextAudit
// PRInfo contains PR metadata (for PR reviews)
PRInfo *PRInfo
// Error if generation failed
Error error
}
RunResult contains the results of a review.
func (*RunResult) Parse ¶
func (r *RunResult) Parse() *ParsedReview
Parse parses the review markdown into structured data.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner executes the review flow.
func NewRunner ¶
func NewRunner(cfg RunnerConfig) *Runner
NewRunner creates a review runner. If Models and Registry are provided, uses RLM for full tool access. Otherwise falls back to legacy invoker with limited tools.
func (*Runner) FixFinding ¶
func (r *Runner) FixFinding(ctx context.Context, finding *Finding, prompt string) (*FixResult, error)
FixFinding applies a fix for a single finding using RLM.
func (*Runner) ReviewBranch ¶
ReviewBranch reviews the current branch against base using the full tool ecosystem.
func (*Runner) ReviewProject ¶
ReviewProject reviews the project as a whole using the full tool ecosystem.
type RunnerConfig ¶
type RunnerConfig struct {
// For RLM-based execution (preferred)
Models *model.Manager
Registry *tool.Registry
ModelID string
// Legacy config (used if Models not provided)
Invoker *oneshot.DefaultInvoker
Ledger *transparency.CostLedger
}
RunnerConfig configures the review runner.
type VerificationTools ¶
type VerificationTools struct {
// contains filtered or unexported fields
}
VerificationTools provides read-only tools for code review verification.
func NewVerificationTools ¶
func NewVerificationTools(workDir string) *VerificationTools
NewVerificationTools creates verification tools rooted at workDir.
func (*VerificationTools) Definitions ¶
func (v *VerificationTools) Definitions() []tools.Definition
Definitions returns the tool definitions for verification.
func (*VerificationTools) Execute ¶
func (v *VerificationTools) Execute(name string, args json.RawMessage) (string, error)
Execute runs a verification tool and returns its output.