Skip to content

yankeexe/ai-gen-commit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐙 AI Commit Generator

Use AI to generate commit message for your staged changes.

⚡️ Features

  • Use local models (via Ollama) or remote models (with OpenAI API compatible providers like: openai, groq, gemini, togetherai, deepseek)
  • Use your preferred AI model
  • Regenerate commit messages until you find the perfect one
  • In-place editing of generated commit
  • Simple CLI interface with debug mode

⚡️ Install

pip install ai-gen-commit

✨ Generate Commit messages

In any git directory with staged changes, run:

aic

🔍 Run in debug mode

aic -d

🦙 Local Mode [Specify model to use]

aic -m <model-name>

aic -m "llama3.2:3b"

# OR

export OLLAMA_MODEL="llama3.2:3b"

🛜 Remote Mode

To run in remote mode, export your API keys as:

export OPENAI_API_KEY=<your-api-key>

Specify which remote provider to use:

export AI_COMMIT_PROVIDER="gemini" or "openai" or "togetherai" or "groq" or "deepseek"

then enable remote mode:

aic -r

Specify the model to use based on the provider's API key:

export AI_COMMIT_PROVIDER="openai"
aic -r -m "gpt-4o-2024-11-20"

# ---

export AI_COMMIT_PROVIDER="gemini"
aic -r -m "gemini-1.5-flash"

📝 In-place Editing

Set your editor environment variable:

export EDITOR=vim
export EDITOR=nvim

# For VSCode
export EDITOR='code --wait'

After commit message is generated, press e to edit using the defined $EDITOR.

Defaults to using vi.

Getting Help

aic -h

🔨 Development

👀 Prerequisites Local mode [default]

🚀 Setting up

make setup