Documentation
¶
Index ¶
Constants ¶
const SystemPrompt = `` /* 1111-byte string literal not displayed */
SystemPrompt is the primary instruction for the AI.
Variables ¶
This section is empty.
Functions ¶
func BuildPrompt ¶
BuildPrompt wraps the diff for the user turn of the prompt. extraContext is optional free-text appended to guide the AI. isStat indicates the content is a --stat summary rather than a full diff.
func GenerateCommitMessage ¶
func GenerateCommitMessage(ctx context.Context, diff DiffResult, extraContext string, p Provider) (string, error)
GenerateCommitMessage builds the prompt from the staged diff and calls the provider. extraContext is optional free-text to guide the AI (can be empty).
Types ¶
type DiffResult ¶
DiffResult holds the diff content and whether it was truncated to stat-only.
func GetStagedDiff ¶
func GetStagedDiff(ctx context.Context) (DiffResult, error)
GetStagedDiff returns the staged diff, falling back to --stat if the full diff exceeds maxDiffBytes to avoid hitting AI token limits.
type Provider ¶
Provider is the interface that all AI provider implementations must satisfy. Implementations are thin adapters: they accept a fully-formed prompt and return raw text.
func NewProvider ¶
func NewProvider(cfg ProviderConfig) (Provider, error)
NewProvider returns a Provider implementation for the given ProviderConfig. Currently supports "gemini", "openai", "ollama", and "anthropic".
func NewProviderFromEntry ¶
func NewProviderFromEntry(entry config.CommitGenEntry) (Provider, error)
NewProviderFromEntry constructs a Provider directly from a config.CommitGenEntry, avoiding the need for callers to manually map fields into ProviderConfig.