Documentation
¶
Index ¶
- type CodeReviewResult
- type CodeReviewService
- func (s *CodeReviewService) GetDefaultAgentClient() api.ClientInterface
- func (s *CodeReviewService) PerformAgenticReview(ctx *ReviewContext, opts *ReviewOptions) (*types.CodeReviewResult, error)
- func (s *CodeReviewService) PerformReview(ctx *ReviewContext, opts *ReviewOptions) (*types.CodeReviewResult, error)
- type ConvergenceStatus
- type NoReviewer
- type ReviewConfiguration
- type ReviewContext
- type ReviewHistory
- type ReviewIteration
- type ReviewMetrics
- type ReviewOptions
- type ReviewResult
- type ReviewType
- type Reviewer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodeReviewResult ¶
type CodeReviewResult = types.CodeReviewResult
CodeReviewResult represents the result of a code review
type CodeReviewService ¶
type CodeReviewService struct {
// contains filtered or unexported fields
}
CodeReviewService provides a unified interface for code review operations
func NewCodeReviewService ¶
func NewCodeReviewService(cfg *configuration.Config, logger *utils.Logger) *CodeReviewService
NewCodeReviewService creates a new code review service instance
func NewCodeReviewServiceWithConfig ¶
func NewCodeReviewServiceWithConfig(cfg *configuration.Config, logger *utils.Logger, reviewConfig *ReviewConfiguration) *CodeReviewService
NewCodeReviewServiceWithConfig creates a new code review service instance with custom configuration
func (*CodeReviewService) GetDefaultAgentClient ¶ added in v0.9.0
func (s *CodeReviewService) GetDefaultAgentClient() api.ClientInterface
GetDefaultAgentClient returns the default agent client for this service
func (*CodeReviewService) PerformAgenticReview ¶ added in v0.10.5
func (s *CodeReviewService) PerformAgenticReview(ctx *ReviewContext, opts *ReviewOptions) (*types.CodeReviewResult, error)
PerformAgenticReview performs a deep evidence-focused code review.
func (*CodeReviewService) PerformReview ¶
func (s *CodeReviewService) PerformReview(ctx *ReviewContext, opts *ReviewOptions) (*types.CodeReviewResult, error)
PerformReview performs a code review based on the provided context and options
type ConvergenceStatus ¶
type ConvergenceStatus struct {
IsConverged bool `json:"is_converged"`
Reason string `json:"reason"`
SimilarIterations []int `json:"similar_iterations"` // Indices of similar iterations
AverageSimilarity float64 `json:"average_similarity"`
MaxSimilarity float64 `json:"max_similarity"`
Recommendation string `json:"recommendation"` // Suggested action
}
ConvergenceStatus represents the convergence analysis of review iterations
type NoReviewer ¶
type NoReviewer struct{}
NoReviewer is a no-op reviewer
func (*NoReviewer) Review ¶
func (r *NoReviewer) Review(cfg *configuration.Config, combinedDiff, originalPrompt, workspaceContext string) (*types.CodeReviewResult, error)
Review performs a no-op review
type ReviewConfiguration ¶
type ReviewConfiguration struct {
EnableAutoFix bool `json:"enable_auto_fix"`
EnableRollback bool `json:"enable_rollback"`
MaxRetries int `json:"max_retries"`
ReviewTimeout int `json:"review_timeout_seconds"`
StrictMode bool `json:"strict_mode"` // Reject on any issues found
RequireApproval bool `json:"require_approval"` // Require explicit approval for all changes
CollectMetrics bool `json:"collect_metrics"`
MaxIterations int `json:"max_iterations"` // Maximum review iterations before fallback
EnableConvergenceDetection bool `json:"enable_convergence_detection"` // Enable detection of oscillating reviews
SimilarityThreshold float64 `json:"similarity_threshold"` // Threshold for detecting similar review feedback
}
ReviewConfiguration contains configuration for the code review service
func DefaultReviewConfiguration ¶
func DefaultReviewConfiguration() *ReviewConfiguration
DefaultReviewConfiguration returns the default configuration for code reviews
type ReviewContext ¶
type ReviewContext struct {
Diff string // The code diff to review
OriginalPrompt string // The original user prompt (for automated reviews)
ProcessedInstructions string // Processed instructions (for automated reviews)
RevisionID string // Revision ID for change tracking
Config *configuration.Config
Logger *utils.Logger
History *ReviewHistory // Review history for this context
SessionID string // Unique session identifier
CurrentIteration int // Current iteration number
FullFileContext string // Full file content for patch resolution context
RelatedFiles []string // Files that might be affected by changes
AgentClient api.ClientInterface // Agent API client for LLM calls
// Metadata for enhanced context
ProjectType string // Project type (Go, Node.js, etc.)
CommitMessage string // Commit message/intent
KeyComments string // Key code comments explaining WHY
ChangeCategories string // Categorization of changes
}
ReviewContext represents the context for a code review request
type ReviewHistory ¶
type ReviewHistory struct {
SessionID string `json:"session_id"`
Iterations []ReviewIteration `json:"iterations"`
OriginalPrompt string `json:"original_prompt"`
OriginalContent string `json:"original_content"`
StartTime time.Time `json:"start_time"`
LastUpdate time.Time `json:"last_update"`
Converged bool `json:"converged"` // Whether the review process has converged
FinalStatus string `json:"final_status"` // Final status: approved, rejected, fallback
}
ReviewHistory tracks the history of review iterations for a given context
type ReviewIteration ¶
type ReviewIteration struct {
IterationNumber int `json:"iteration_number"`
OriginalDiff string `json:"original_diff"`
ReviewResult *types.CodeReviewResult `json:"review_result"`
AppliedChanges bool `json:"applied_changes"`
Timestamp time.Time `json:"timestamp"`
ContentHash string `json:"content_hash"` // Hash of the content being reviewed
}
ReviewIteration represents a single iteration in the review process
type ReviewMetrics ¶
type ReviewMetrics struct {
TotalReviews int `json:"total_reviews"`
ApprovedReviews int `json:"approved_reviews"`
RejectedReviews int `json:"rejected_reviews"`
RetryAttempts int `json:"retry_attempts"`
AverageTime time.Duration `json:"average_time"`
SuccessRate float64 `json:"success_rate"` // Percentage of approved reviews
}
ReviewMetrics contains metrics about the code review process
type ReviewOptions ¶
type ReviewOptions struct {
Type ReviewType
SkipPrompt bool
PreapplyReview bool
RollbackOnReject bool // Whether to rollback changes when review is rejected
}
ReviewOptions contains options for the code review
type ReviewResult ¶
type ReviewResult struct {
*types.CodeReviewResult
AppliedFixes bool // Whether fixes were automatically applied
RolledBack bool // Whether changes were rolled back
RetryAttempted bool // Whether a retry was attempted
RetryCount int // Number of retry attempts made
ProcessingTime float64 // Time taken to process the review in seconds
}
ReviewResult represents the result of a code review operation This extends the base types.CodeReviewResult with additional context
type ReviewType ¶
type ReviewType int
ReviewType defines the type of code review being performed
const (
StagedReview ReviewType = iota // Used for reviewing Git staged changes
)
type Reviewer ¶
type Reviewer interface {
Review(cfg *configuration.Config, combinedDiff, originalPrompt, workspaceContext string) (*types.CodeReviewResult, error)
}
Reviewer defines the interface for a code reviewer