-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Overview
Use local LLM (Ollama) or cloud AI to generate commit messages from diffs.
Commands
commit ai
commit ai # Generate message from staged diff
commit ai --model llama3 # Use specific model
commit ai --style conventional # Enforce conventional commits
commit ai --verbose # Include reasoningcommit suggest
commit suggest # Show 3 message options
commit suggest --pick 2 # Use option 2Implementation
Local LLM (Ollama)
// Use Ollama for privacy/speed
$response = Http::post('http://localhost:11434/api/generate', [
'model' => 'llama3',
'prompt' => $this->buildPrompt($diff),
]);Prompt Template
Analyze this git diff and generate a conventional commit message.
Rules:
- Use format: type(scope): description
- Types: feat, fix, docs, refactor, test, chore
- Keep description under 50 chars
- Focus on WHY not WHAT
Diff:
{diff}
Commit message:
Fallback
- If Ollama not running, offer cloud option
- Cache common patterns for speed
Configuration
commit config --ai-model llama3
commit config --ai-provider ollama
commit config --ai-style conventionalMetadata
Metadata
Assignees
Labels
No labels