Documentation
¶
Index ¶
- func ReviewWithSpec(ctx context.Context, diff string, conversation []Message, userIntent string, ...) (*types.CodeReviewResult, *ScopeReviewResult, *CanonicalSpec, error)
- func ScopeValidationPrompt() string
- func SpecExtractionPrompt() string
- type CanonicalSpec
- type Message
- type ScopeReviewResult
- type ScopeValidator
- type ScopeViolation
- type SpecExtractionResult
- type SpecExtractor
- type SpecReviewService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReviewWithSpec ¶
func ReviewWithSpec( ctx context.Context, diff string, conversation []Message, userIntent string, cfg *configuration.Config, logger *utils.Logger, ) (*types.CodeReviewResult, *ScopeReviewResult, *CanonicalSpec, error)
ReviewWithSpec performs standard code review AND scope validation
func ScopeValidationPrompt ¶
func ScopeValidationPrompt() string
ScopeValidationPrompt returns the prompt for validating changes against a spec
func SpecExtractionPrompt ¶
func SpecExtractionPrompt() string
SpecExtractionPrompt returns the prompt for extracting a canonical spec from conversation
Types ¶
type CanonicalSpec ¶
type CanonicalSpec struct {
ID string `json:"id"` // Unique identifier
CreatedAt time.Time `json:"created_at"` // When spec was extracted
UserPrompt string `json:"user_prompt"` // Original user request
Objective string `json:"objective"` // Clear objective statement
InScope []string `json:"in_scope"` // What's included
OutOfScope []string `json:"out_of_scope"` // What's explicitly excluded
Acceptance []string `json:"acceptance"` // Acceptance criteria
Context string `json:"context"` // Additional context from conversation
Conversation []Message `json:"conversation"` // Full conversation for reference
}
CanonicalSpec represents the extracted specification from conversation
type ScopeReviewResult ¶
type ScopeReviewResult struct {
InScope bool `json:"in_scope"` // Overall pass/fail
Violations []ScopeViolation `json:"violations"` // Specific violations
Summary string `json:"summary"` // Human-readable summary
Suggestions []string `json:"suggestions"` // How to fix violations
}
ScopeReviewResult represents result of scope validation
type ScopeValidator ¶
type ScopeValidator struct {
// contains filtered or unexported fields
}
ScopeValidator validates changes against spec
func NewScopeValidator ¶
func NewScopeValidator(cfg *configuration.Config, logger *utils.Logger) (*ScopeValidator, error)
NewScopeValidator creates a new scope validator
func (*ScopeValidator) ValidateScope ¶
func (v *ScopeValidator) ValidateScope(ctx context.Context, diff string, spec *CanonicalSpec) (*ScopeReviewResult, error)
ValidateScope checks if changes are within spec boundaries
type ScopeViolation ¶
type ScopeViolation struct {
File string `json:"file"` // File where violation found
Line int `json:"line"` // Line number
Type string `json:"type"` // "addition", "modification", "removal"
Severity string `json:"severity"` // "critical", "high", "medium", "low"
Description string `json:"description"` // What was added/changed
Why string `json:"why"` // Why it's out of scope
}
ScopeViolation represents a scope violation found during review
type SpecExtractionResult ¶
type SpecExtractionResult struct {
Spec *CanonicalSpec `json:"spec"`
Confidence float64 `json:"confidence"` // 0-1 score
Reasoning string `json:"reasoning"` // How spec was derived
}
SpecExtractionResult represents result of spec extraction
type SpecExtractor ¶
type SpecExtractor struct {
// contains filtered or unexported fields
}
SpecExtractor extracts canonical specs from conversations
func NewSpecExtractor ¶
func NewSpecExtractor(cfg *configuration.Config, logger *utils.Logger) (*SpecExtractor, error)
NewSpecExtractor creates a new spec extractor
func (*SpecExtractor) ExtractSpec ¶
func (e *SpecExtractor) ExtractSpec(ctx context.Context, conversation []Message, userIntent string) (*SpecExtractionResult, error)
ExtractSpec analyzes conversation and extracts canonical spec
func (*SpecExtractor) UpdateSpec ¶
func (e *SpecExtractor) UpdateSpec(ctx context.Context, existing *CanonicalSpec, newMessages []Message) (*CanonicalSpec, error)
UpdateSpec updates existing spec with new conversation
type SpecReviewService ¶
type SpecReviewService struct {
// contains filtered or unexported fields
}
SpecReviewService integrates spec extraction and validation
func NewSpecReviewService ¶
func NewSpecReviewService(cfg *configuration.Config, logger *utils.Logger) (*SpecReviewService, error)
NewSpecReviewService creates a new spec review service
func (*SpecReviewService) ExtractAndValidate ¶
func (s *SpecReviewService) ExtractAndValidate(ctx context.Context, conversation []Message, diff string, userIntent string) (*ScopeReviewResult, *CanonicalSpec, error)
ExtractAndValidate extracts spec and validates changes in one call
func (*SpecReviewService) GetExtractor ¶
func (s *SpecReviewService) GetExtractor() *SpecExtractor
GetExtractor returns the spec extractor
func (*SpecReviewService) GetValidator ¶
func (s *SpecReviewService) GetValidator() *ScopeValidator
GetValidator returns the scope validator