Documentation
¶
Overview ¶
Package ai provides AI provider clients (Ollama, OpenAI, Anthropic) for prose generation, description enhancement, and metric interpretation.
Index ¶
- func BuildChunkPrompt(report render.Report, tone Tone, sections []templatedSection, ...) string
- func BuildChunkPromptLang(report render.Report, tone Tone, sections []templatedSection, ...) string
- func BuildPrompt(report render.Report, tone Tone) string
- func BuildPromptLang(report render.Report, tone Tone, lang i18n.Lang) string
- func BuildSummaryPrompt(report render.Report, sm SummaryMetrics, lang i18n.Lang) string
- func Disclosure(purpose, endpoint string, maxChars int, exclusions []string) string
- func EnhanceReport(ctx context.Context, report render.Report, aiClient Client) (render.Report, error)
- func GenerateMetricInterpretations(ctx context.Context, sm SummaryMetrics, client Client, lang i18n.Lang) (map[string]string, error)
- func GenerateMetricsNarrative(ctx context.Context, sm SummaryMetrics, client Client, lang i18n.Lang) (string, error)
- func GenerateProse(ctx context.Context, report render.Report, tone Tone, aiClient Client) (string, error)
- func GenerateProseLang(ctx context.Context, report render.Report, tone Tone, aiClient Client, ...) (string, error)
- func GenerateProseStream(ctx context.Context, report render.Report, tone Tone, aiClient Client, ...) (string, error)
- func GenerateProseStreamLang(ctx context.Context, report render.Report, tone Tone, aiClient Client, ...) (string, error)
- func GenerateSummary(ctx context.Context, report render.Report, aiClient Client, sm SummaryMetrics) (string, error)
- func GenerateSummaryLang(ctx context.Context, report render.Report, aiClient Client, sm SummaryMetrics, ...) (string, error)
- func IsRetryable(err error) bool
- func PathExcluded(file string, patterns []string) bool
- func RedactSecrets(input string) string
- type AIError
- type AnthropicClient
- type Client
- type Config
- type ContributorStat
- type ErrorKind
- type InputPolicy
- type Message
- type OllamaClient
- type OpenAIClient
- type SummaryMetrics
- type Tone
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildChunkPrompt ¶
func BuildChunkPromptLang ¶
func BuildSummaryPrompt ¶
func Disclosure ¶
Disclosure describes the outbound AI data boundary without exposing a key.
func EnhanceReport ¶
func GenerateProse ¶
func GenerateProseLang ¶
func GenerateProseStream ¶
func GenerateProseStreamLang ¶
func GenerateSummary ¶
func GenerateSummaryLang ¶
func IsRetryable ¶
func PathExcluded ¶
PathExcluded applies slash-separated glob patterns, including **, to a repository-relative path.
func RedactSecrets ¶
RedactSecrets removes common credential formats from arbitrary AI input.
Types ¶
type AnthropicClient ¶
type AnthropicClient struct {
// contains filtered or unexported fields
}
func (*AnthropicClient) StreamGenerate ¶
type Client ¶
type Client interface {
Generate(ctx context.Context, prompt string) (string, error)
StreamGenerate(ctx context.Context, prompt string, onToken func(string)) (string, error)
}
Client is the interface for AI text generation providers.
func WithInputPolicy ¶
func WithInputPolicy(client Client, policy InputPolicy) Client
WithInputPolicy wraps a provider so every generation path shares the same redaction and volume controls.
type Config ¶
type Config struct {
Provider string `yaml:"provider"`
Model string `yaml:"model"`
APIKey string `yaml:"api_key"`
BaseURL string `yaml:"base_url"`
MaxTokens int `yaml:"max_tokens"`
}
Config holds AI provider connection settings.
type ContributorStat ¶
type InputPolicy ¶
type InputPolicy struct {
MaxChars int
}
InputPolicy is enforced immediately before any prompt leaves the process.
type OllamaClient ¶
type OllamaClient struct {
// contains filtered or unexported fields
}
func (*OllamaClient) StreamGenerate ¶
type OpenAIClient ¶
type OpenAIClient struct {
// contains filtered or unexported fields
}
func (*OpenAIClient) StreamGenerate ¶
type SummaryMetrics ¶
type SummaryMetrics struct {
TotalCommits int
TotalAuthors int
TopContributors []ContributorStat
BreakingChanges int
SignificanceCounts map[string]int
TypeCounts map[string]int
DateRange string
CommitsPerDay float64
MostActiveDay string
MostActiveDayCount int
FilesTouched int
LinesAdded int
LinesDeleted int
NetLines int
JiraTicketsLinked int
HotspotDensity float64
ChurnFactor float64
ComplexityPerFeat float64
ReleaseCommitSpanHours float64
ReleaseAgeHours float64
OwnershipConc float64
OwnershipEntropy float64
ReleaseContributionConcentration int
FixToFeatureRatio float64
TestToSourceRatio float64
RefactoringRatio float64
APISurfaceChange int
ReleaseRiskScore float64
BatchFactor float64
RevertRate float64
ScopeIsolation float64
CrossCuttingPct float64
FileVolatility float64
ChangeComplexityProxy float64
CrossCuttingChangeRisk float64
TechnicalDebtUSD float64
TouchedTestFileRatio float64
HotspotScore float64
CommitSizeSmall int
CommitSizeMedium int
CommitSizeLarge int
CommitSizeHuge int
ReviewLoad float64
DeleteRatio float64
CommitMsgQuality float64
AuthorOverlap float64
PeakHourSpread float64
DirectoryBreadth float64
ConfigChurnRate float64
CodeFreshness float64
RhythmConsistency float64
ReleaseCadenceDays int
DepUpdateFreq float64
LanguageMix float64
}