Documentation
¶
Index ¶
- Constants
- Variables
- func BuildPrompt(diff string, files []model.FileSummary) string
- func CheckStagingGuard(ctx context.Context, git gitexec.GitRunner) error
- func CollectStagedSnapshot(ctx context.Context, git gitexec.GitRunner) (string, []model.FileSummary, error)
- func PrepareEditorCmd(message string) (cmd *exec.Cmd, tmpPath string, err error)
- func ReadEditedMessage(path string) (string, error)
- type ClaudeProvider
- type CommitMessageProvider
- type Executor
Constants ¶
const DefaultModel = "claude-sonnet-4-6"
Variables ¶
Functions ¶
func BuildPrompt ¶
func BuildPrompt(diff string, files []model.FileSummary) string
BuildPrompt constructs a deterministic prompt from a staged-only diff and file summaries.
func CheckStagingGuard ¶
CheckStagingGuard returns ErrUnstagedChanges when unstaged or untracked changes are present alongside staged changes.
func CollectStagedSnapshot ¶
func CollectStagedSnapshot(ctx context.Context, git gitexec.GitRunner) (string, []model.FileSummary, error)
CollectStagedSnapshot returns the staged-only diff text and parsed file summaries.
func PrepareEditorCmd ¶
PrepareEditorCmd writes message to a temp file and returns an exec.Cmd that opens $EDITOR (or "vi" as fallback) on that file. The caller must call cleanup() after reading the edited result.
func ReadEditedMessage ¶
ReadEditedMessage reads a file path and returns its trimmed content.
Types ¶
type ClaudeProvider ¶
type ClaudeProvider struct {
// contains filtered or unexported fields
}
ClaudeProvider generates commit messages using the Anthropic Messages API.
func NewClaudeProvider ¶
func NewClaudeProvider(apiKey string, modelOverride string, opts ...option.RequestOption) (*ClaudeProvider, error)
NewClaudeProvider creates a ClaudeProvider. If apiKey is empty, ANTHROPIC_API_KEY is read from the environment. Pass option.WithBaseURL for testing.
func (*ClaudeProvider) Generate ¶
func (p *ClaudeProvider) Generate(ctx context.Context, diff string, files []model.FileSummary) (string, error)
Generate sends the diff and file summaries to Claude and returns the commit message.
type CommitMessageProvider ¶
type CommitMessageProvider interface {
Generate(ctx context.Context, diff string, files []model.FileSummary) (string, error)
}
CommitMessageProvider generates commit messages from diffs.