Documentation
¶
Index ¶
- Variables
- func BuildSystemPromptWithIntent(basePrompt string, intent *Intent, presets map[string]*preset.Preset) string
- func GetFocusAreaPresets() (map[string]*preset.Preset, error)
- func GetSystemPrompt() string
- func GetSystemPromptWithIntent(intent *Intent, presetPrompt string, presetReplace bool) string
- func GetSystemPromptWithPreset(presetPrompt string, replace bool) string
- type Builder
- type Intent
- type ReviewContext
- type SecretsError
Constants ¶
This section is empty.
Variables ¶
var ErrSecretsDetected = SecretsError{}
ErrSecretsDetected is a sentinel error for secrets detection
Functions ¶
func BuildSystemPromptWithIntent ¶
func BuildSystemPromptWithIntent(basePrompt string, intent *Intent, presets map[string]*preset.Preset) string
BuildSystemPromptWithIntent builds the system prompt incorporating intent
func GetFocusAreaPresets ¶
GetFocusAreaPresets returns preset map for focus areas
func GetSystemPrompt ¶
func GetSystemPrompt() string
GetSystemPrompt returns the system prompt for the LLM Checks for custom system prompt file first, falls back to default if not found
func GetSystemPromptWithIntent ¶
GetSystemPromptWithIntent returns the system prompt incorporating intent and preset
func GetSystemPromptWithPreset ¶
GetSystemPromptWithPreset returns the system prompt modified by a preset If replace is true, returns only the preset prompt (replacing the base prompt) If replace is false, appends the preset prompt to the base prompt (default behavior)
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder constructs the review context from git changes
func NewBuilder ¶
NewBuilder creates a new context builder
func (*Builder) Build ¶
func (b *Builder) Build() (*ReviewContext, error)
Build gathers git changes and assembles the review context
func (*Builder) WithIntent ¶
WithIntent sets the intent for the builder
type Intent ¶
type Intent struct {
// CustomInstruction is optional user-provided custom instruction
CustomInstruction string
// FocusAreas are selected focus areas (security, performance, logic, style, typo, naming)
FocusAreas []string
// NegativeConstraints are things the user wants to ignore
NegativeConstraints []string
// WebSearchEnabled controls whether web search is enabled for Gemini requests (default: true)
WebSearchEnabled bool
}
Intent represents user's review intent and focus areas
type ReviewContext ¶
type ReviewContext struct {
// RawDiff is the filtered git diff
RawDiff string
// FileContents maps file paths to their content
FileContents map[string]string
// IgnoredFiles lists files that were filtered out
IgnoredFiles []string
// SecretsFound contains any potential secrets detected
SecretsFound []filter.SecretMatch
// UserPrompt is the assembled prompt for the LLM
UserPrompt string
// EstimatedTokens is the rough token count
EstimatedTokens int
// Intent is the user's review intent and focus areas
Intent *Intent
// PrunedFiles maps file paths to their summaries (for token optimization)
PrunedFiles map[string]string
}
ReviewContext contains all the data needed for a code review
func BuildFromDiff ¶
func BuildFromDiff(rawDiff string, files map[string]string) *ReviewContext
BuildFromDiff creates a review context from an existing diff string
func (*ReviewContext) DetailedSummary ¶
func (rc *ReviewContext) DetailedSummary() string
DetailedSummary returns a detailed summary including file list
func (*ReviewContext) HasChanges ¶
func (rc *ReviewContext) HasChanges() bool
HasChanges returns true if there are changes to review
func (*ReviewContext) Summary ¶
func (rc *ReviewContext) Summary() string
Summary returns a summary of what will be reviewed
type SecretsError ¶
type SecretsError struct {
Matches []filter.SecretMatch
}
SecretsError represents an error when secrets are detected in code
func (SecretsError) Error ¶
func (e SecretsError) Error() string
Error implements the error interface