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 ¶
func BuildPrompt(diff DiffResult, extraContext string) string
BuildPrompt wraps the diff for the user turn of the prompt. extraContext is optional free-text appended to guide the AI.
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 ¶
type DiffResult struct {
Content string
Truncated bool // true when the diff was cut to fit within maxDiffBytes
}
DiffResult holds the diff content and metadata about how it was retrieved.
func GetStagedDiff ¶
func GetStagedDiff(ctx context.Context) (DiffResult, error)
GetStagedDiff returns the staged diff. If the diff exceeds maxDiffBytes it is truncated at a line boundary and prefixed with a --stat summary so the AI still sees the full scope of changes alongside as much detail as fits.
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.