Documentation
¶
Index ¶
- func BuildPrompt(cr *collect.CollectResult) string
- func JSONSchema() string
- func PreflightCheck() error
- type Alignment
- type AnalysisResult
- type AttentionItem
- type ClaudeRunner
- type Evidence
- type ExecClaudeRunner
- type Hypothesis
- type Mismatch
- type MismatchCategory
- type MockClaudeRunner
- type ValidationIssue
- type ValidationIssueType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPrompt ¶
func BuildPrompt(cr *collect.CollectResult) string
BuildPrompt constructs the full prompt for the LLM from the collect result.
func JSONSchema ¶
func JSONSchema() string
JSONSchema returns the JSON schema string for structured output.
func PreflightCheck ¶
func PreflightCheck() error
PreflightCheck verifies the claude CLI is available and compatible.
Types ¶
type Alignment ¶
type Alignment struct {
Grade string `json:"grade"`
Score float64 `json:"score"`
Confidence string `json:"confidence"`
HighestRiskCategory string `json:"highest_risk_category"`
}
Alignment represents the overall alignment assessment.
type AnalysisResult ¶
type AnalysisResult struct {
Version string `json:"version"`
Alignment Alignment `json:"alignment"`
ClaimedIntent string `json:"claimed_intent"`
ImplementationEvidence []Evidence `json:"implementation_evidence"`
BehaviorImpactHypotheses []Hypothesis `json:"behavior_impact_hypotheses"`
Mismatches []Mismatch `json:"mismatches"`
AttentionMap []AttentionItem `json:"attention_map"`
SuggestedPRDescription string `json:"suggested_pr_description"`
}
AnalysisResult is the top-level structured output from the LLM.
type AttentionItem ¶
type AttentionItem struct {
File string `json:"file"`
Reason string `json:"reason"`
Priority string `json:"priority"`
}
AttentionItem represents a file or area the reviewer should focus on.
type ClaudeRunner ¶
type ClaudeRunner interface {
Run(ctx context.Context, prompt string, schema string) (*AnalysisResult, error)
}
ClaudeRunner is the interface for running LLM analysis.
type Evidence ¶
type Evidence struct {
File string `json:"file"`
Description string `json:"description"`
Category string `json:"category"`
}
Evidence represents a piece of implementation evidence from the diff.
type ExecClaudeRunner ¶
type ExecClaudeRunner struct{}
ExecClaudeRunner calls `claude --bare -p` as a subprocess.
func (*ExecClaudeRunner) Run ¶
func (r *ExecClaudeRunner) Run(ctx context.Context, prompt string, schema string) (*AnalysisResult, error)
type Hypothesis ¶
type Hypothesis struct {
Description string `json:"description"`
AffectedFiles []string `json:"affected_files"`
VerificationHint string `json:"verification_hint"`
}
Hypothesis represents a behavior-impact hypothesis that needs verification.
type Mismatch ¶
type Mismatch struct {
Category MismatchCategory `json:"category"`
Severity string `json:"severity"`
Confidence string `json:"confidence"`
Claim string `json:"claim"`
Observation string `json:"observation"`
Evidence []string `json:"evidence"`
RecommendedAction string `json:"recommended_action"`
}
Mismatch represents a single detected mismatch.
type MismatchCategory ¶
type MismatchCategory string
MismatchCategory enumerates the 9-category taxonomy.
const ( MismatchScope MismatchCategory = "scope" MismatchContract MismatchCategory = "contract" MismatchRisk MismatchCategory = "risk" MismatchTest MismatchCategory = "test" MismatchIntentUnderSpec MismatchCategory = "intent_under_specification" MismatchNonCodeImpact MismatchCategory = "non_code_impact" MismatchBehavioralAmbiguity MismatchCategory = "behavioral_ambiguity" MismatchDocumentation MismatchCategory = "documentation" MismatchDependencyRisk MismatchCategory = "dependency_risk" )
type MockClaudeRunner ¶
type MockClaudeRunner struct {
Result *AnalysisResult
Err error
}
MockClaudeRunner returns a fixed result for testing.
func (*MockClaudeRunner) Run ¶
func (r *MockClaudeRunner) Run(ctx context.Context, prompt string, schema string) (*AnalysisResult, error)
type ValidationIssue ¶
type ValidationIssue struct {
Type ValidationIssueType `json:"type"`
Message string `json:"message"`
Index int `json:"index,omitempty"`
}
ValidationIssue describes a single post-hoc validation problem.
func ValidateResult ¶
func ValidateResult(result *AnalysisResult, diffFiles map[string]bool) []ValidationIssue
ValidateResult performs post-hoc validation on the LLM output. It checks that referenced file paths actually exist in the diff.
type ValidationIssueType ¶
type ValidationIssueType string
ValidationIssueType categorizes validation problems.
const ( ValidationHallucinatedFile ValidationIssueType = "hallucinated_file" ValidationMissingField ValidationIssueType = "missing_field" )