Documentation
¶
Index ¶
- Constants
- func DefaultAlwaysAsk() []string
- func DefaultAlwaysSkip() []string
- func ExtractImplicitWhy(subject string) (string, string, float64)
- func FormatCalibration(r *CalibrationReport) string
- type CalibrationReport
- type DecisionResult
- type Engine
- type EngineConfig
- type SignalContext
- type SignalScore
Constants ¶
const ( DefaultThresholdFull = 60 DefaultThresholdReduced = 35 DefaultThresholdSuggest = 15 DefaultLearningMinCommits = 20 )
Default values for the Decision Engine. Exported so that config/defaults.go can reference them, avoiding value duplication across two files.
Variables ¶
This section is empty.
Functions ¶
func DefaultAlwaysAsk ¶
func DefaultAlwaysAsk() []string
DefaultAlwaysAsk returns the default always_ask types (fresh copy each call).
func DefaultAlwaysSkip ¶
func DefaultAlwaysSkip() []string
DefaultAlwaysSkip returns the default always_skip types (fresh copy each call).
func ExtractImplicitWhy ¶
ExtractImplicitWhy splits a commit subject into What and Why parts. Returns what, why, confidence. If no separator found, confidence is 0.
func FormatCalibration ¶
func FormatCalibration(r *CalibrationReport) string
FormatCalibration returns a human-readable summary of calibration metrics.
Types ¶
type CalibrationReport ¶
type CalibrationReport struct {
TotalCommits int
AutoSkipped int
SuggestSkipped int
AskReduced int
AskFull int
Documented int
FalseNegativeRate float64 // auto-skip then manually documented / total auto-skip
FalsePositiveRate float64 // ask-full then skipped / total ask-full
AskFullDocRate float64 // documented / total ask-full
AutoSkipRate float64 // auto-skip / total commits
}
CalibrationReport holds quality metrics for the Decision Engine.
func ComputeCalibration ¶
func ComputeCalibration(store domain.LoreStore) (*CalibrationReport, error)
ComputeCalibration calculates Decision Engine quality metrics from stored commits. Uses a proxy for false negatives: commits with decision='documented' and question_mode='none' indicate an auto-skip that was later resolved via `lore new --commit`.
type DecisionResult ¶
type DecisionResult struct {
Score int
Action string // ask-full, ask-reduced, suggest-skip, auto-skip
Confidence float64
Signals []SignalScore
PrefilledWhat string
PrefilledWhy string
PrefilledWhyConfidence float64
}
DecisionResult holds the scoring outcome for a commit.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine evaluates commits using multi-signal scoring.
func NewEngine ¶
func NewEngine(store domain.LoreStore, config EngineConfig) *Engine
NewEngine creates a Decision Engine.
func (*Engine) Evaluate ¶
func (e *Engine) Evaluate(ctx SignalContext) *DecisionResult
Evaluate scores a commit and determines the documentation action.
type EngineConfig ¶
type EngineConfig struct {
ThresholdFull int
ThresholdReduced int
ThresholdSuggest int
AlwaysAsk []string
AlwaysSkip []string
CriticalScopes []string
Learning bool
LearningMinCommits int
}
EngineConfig holds Decision Engine configuration from .lorerc.
func DefaultConfig ¶
func DefaultConfig() EngineConfig
DefaultConfig returns sensible defaults for the Decision Engine.
type SignalContext ¶
type SignalContext struct {
ConvType string
Scope string
Subject string
Message string
DiffContent string
FilesChanged []string
LinesAdded int
LinesDeleted int
}
SignalContext contains all inputs needed for scoring a commit.
type SignalScore ¶
SignalScore records an individual signal's contribution.
func FileValueSignal ¶
func FileValueSignal(files []string) SignalScore
FileValueSignal scores modified files by their documentation value. High-value files (API, schema, migration, proto, graphql, security) get +5 each, capped at +15. If 100% of files are test/mock/testdata, score is -10.
func ScanDiffContent ¶
func ScanDiffContent(diffContent string) SignalScore
ScanDiffContent analyses diff lines for security, API, infra, deletion, and tech-debt patterns. Each pattern scores at most once per commit (deduplication). Analysis is limited to the first 1000 lines of the diff for performance.