Let an AI bot write your Git commit messages β powered by Google Gemini.
frai-commit reads your staged changes, sends them to Gemini, and generates clear, concise, and professional Git commit messages automatically.
- π§ Uses Google Gemini AI (via
@google/generative-ai) - π Parses your
git diffto understand code changes - π¬ Generates commit messages in natural language (English)
- βοΈ Easy setup using
.envfor your API key - β Works with any Git project using Node.js
git clone https://github.com/your-username/frai-commit.git
cd frai-commitnpm installCreate a .env file in the root of the project with your Gemini API key:
GEMINI_API_KEY=your_google_gemini_api_key_hereπ Get your API key here: https://makersuite.google.com/app/apikey
Stage your changes:
git add .Run the bot:
node frai-commit.jsYou'll see something like:
π Checking for modified files...
π Reading staged changes...
π€ Generating commit message...
β
Generated commit message:
Refactor: Remove git object instantiation from AICommitMessageGenerator constructor.
π Commit completed successfully!To run frai-commit from anywhere:
Make the script executable:
chmod +x frai-commit.js(Optional) Move or link it to your global path:
ln -s $(pwd)/frai-commit.js /usr/local/bin/frai-commitNow you can run it globally:
frai-commitThis tool uses the Gemini API to generate commit messages based on your code diffs. Review the generated messages before pushing to production.
MIT License
Made with π by Frai Labs