Documentation
¶
Index ¶
- Constants
- func BuildRangeTask(input PromptInput) (string, error)
- func MergeReport(input MergeInput) (*schema.Report, error)
- func ParseRangeResponse(raw string, lineCount int, rr ReviewRange) (*schema.Report, error)
- func ValidateConfig(cfg Config) error
- func ValidatePreviousCompatibility(prev *PreviousReport, cfg Config) error
- type Config
- type DroppedFinding
- type ExecutorConfig
- type FallbackReason
- type LineRange
- type MergeInput
- type Metadata
- type Mode
- type Plan
- type PreviousReport
- type PromptInput
- type RangeResult
- type ReuseInput
- type ReuseRange
- type ReuseResult
- type ReviewRange
- type SectionChange
Constants ¶
const ( ClassUnchanged = "unchanged" ClassChanged = "changed" ClassAdded = "added" ClassDeleted = "deleted" ClassMoved = "moved" ClassRenamed = "renamed" ClassAmbiguous = "ambiguous" )
const TagIncrementalReview = "incremental-review"
const TagReused = "incremental-reused"
Variables ¶
This section is empty.
Functions ¶
func BuildRangeTask ¶
func BuildRangeTask(input PromptInput) (string, error)
BuildRangeTask returns the task for reviewing one changed range. It follows the prefix every call about the spec shares (context files, the numbered spec and the known preflight findings), so a range review judges its lines with the same material as a full review, and reads the spec from the provider's prompt cache.
func MergeReport ¶
func MergeReport(input MergeInput) (*schema.Report, error)
func ParseRangeResponse ¶
ParseRangeResponse reads a complete incremental range response. See parseRangeResponse for what is kept and what is dropped.
func ValidateConfig ¶
ValidateConfig validates flag-derived incremental settings.
func ValidatePreviousCompatibility ¶
func ValidatePreviousCompatibility(prev *PreviousReport, cfg Config) error
ValidatePreviousCompatibility checks whether a previous report can be used as the baseline for the current incremental request.
Types ¶
type Config ¶
type Config struct {
Mode Mode
MaxChangeRatio float64
MaxRemapFailureRatio float64
ContextLines int
ChunkTokenThreshold int
StrictReuse bool
ReportMetadata bool
Profile string
Strict bool
SeverityThreshold string
ProfileHash string
RedactionConfigHash string
}
Config contains incremental settings shared by CLI, web, and app code.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the spec-defined incremental defaults.
type DroppedFinding ¶
type ExecutorConfig ¶
type ExecutorConfig struct {
SystemPrompt string
// Prefix is the user-message prefix every call about the spec shares,
// built by llm.BuildSpecPrefix: context files, the numbered spec unless
// it is too large to share, and the known preflight findings.
Prefix string
// SpecShown says Prefix holds the whole spec. When false each range
// task carries its own numbered lines.
SpecShown bool
// LongCache asks for the longer prompt-cache lifetime.
LongCache bool
MaxTokens int
Effort string
// EnforceSchema asks the provider to constrain responses to the review
// schema.
EnforceSchema bool
// NoPatches leaves patches out of the requested output.
NoPatches bool
Concurrency int
Issues []schema.Issue
Questions []schema.Question
}
type FallbackReason ¶
type MergeInput ¶
type MergeInput struct {
Spec *spec.Spec
PreflightIssues []schema.Issue
ReusedIssues []schema.Issue
ReusedQuestions []schema.Question
RangeResults []RangeResult
Patches []schema.Patch
Model string
Profile string
Strict bool
SeverityThreshold string
ContextFiles []string
IncrementalMetadata *schema.IncrementalMeta
IncludeMetadata bool
}
type Metadata ¶
type Metadata struct {
Enabled bool `json:"enabled"`
PreviousSpecHash string `json:"previous_spec_hash"`
Mode string `json:"mode"`
Fallback bool `json:"fallback"`
ReviewedSections int `json:"reviewed_sections"`
ReusedSections int `json:"reused_sections"`
ReusedIssues int `json:"reused_issues"`
ReusedQuestions int `json:"reused_questions"`
DroppedFindings int `json:"dropped_findings"`
ChangedLineRatio float64 `json:"changed_line_ratio"`
}
Metadata is emitted as meta.incremental when the user explicitly requests incremental metadata in JSON output.
type Mode ¶
type Mode string
Mode controls whether incremental review is disabled, required, or used only when the planner can prove reuse is safe.
type Plan ¶
type Plan struct {
PreviousHash string
CurrentHash string
Mode Mode
Sections []SectionChange
ReviewRanges []ReviewRange
ReuseRanges []ReuseRange
Fallback *FallbackReason
}
Plan describes the planner's decision for one current spec.
type PreviousReport ¶
PreviousReport wraps a validated previous SpecCritic report and optional metadata that does not yet exist in the public schema type.
func LoadPreviousReport ¶
func LoadPreviousReport(path string) (*PreviousReport, error)
LoadPreviousReport loads and validates a previous SpecCritic JSON report.
func ParsePreviousReport ¶
func ParsePreviousReport(raw []byte) (*PreviousReport, error)
ParsePreviousReport validates raw JSON from a previous SpecCritic report.
type PromptInput ¶
type PromptInput struct {
Spec *spec.Spec
Plan Plan
Range ReviewRange
Issues []schema.Issue
Questions []schema.Question
// SpecShown says the shared prefix built by llm.BuildSpecPrefix holds the
// whole numbered spec, as it does for a full or chunked review. The task
// then names the lines to review. Without it the spec was too large to
// share, and the task carries the range's own numbered lines and a table
// of contents.
SpecShown bool
}
type RangeResult ¶
type RangeResult struct {
Range ReviewRange
Report *schema.Report
Model string
}
func ReviewRanges ¶
func ReviewRanges(ctx context.Context, provider llm.Provider, s *spec.Spec, plan Plan, cfg ExecutorConfig) ([]RangeResult, error)
type ReuseInput ¶
type ReuseInput struct {
Plan Plan
Previous *schema.Report
// SpecPath is the path of the current spec. Reused evidence is pointed at
// it, because the previous run may have named the same file differently
// and duplicate detection compares evidence paths.
SpecPath string
CurrentRaw string
CurrentRedacted string
Config Config
PreflightIssues []schema.Issue
}
type ReuseRange ¶
type ReuseResult ¶
type ReuseResult struct {
Issues []schema.Issue
Questions []schema.Question
Dropped []DroppedFinding
RemapFailures int
RemapCandidates int
Fallback *FallbackReason
}
func ReuseFindings ¶
func ReuseFindings(input ReuseInput) (ReuseResult, error)