A Deno CLI tool that automates git commits with AI-generated commit messages, handling production and test files separately.
- 🤖 AI-generated commit messages using OpenAI
- 📝 Separates test files from production code
- 🔄 Two-stage commit process
- 📊 Clear visual feedback
- ⚡ Fast and lightweight
- Make sure you have Deno installed
- Clone this repository
- Run the installation script:
./install.shOr install manually:
deno install --allow-all --name commit main.tsSet your OpenAI API key as an environment variable:
export OPENAI_API_KEY=your_api_key_hereAdd this to your shell profile (.bashrc, .zshrc, etc.) to make it permanent.
Navigate to any git repository and run:
commitThe tool will:
- Detect all changed files
- Separate test files from production code
- Generate an AI commit message for production files
- Create two commits:
- First: Production files with AI-generated message
- Second: Test files with "chore: test files for [feature]"
$ commit
🔍 Detecting changes...
Detected changes:
📝 Non-test files:
- src/payment.ts
- src/utils/validator.ts
🧪 Test files:
- src/payment.test.ts
- src/utils/validator.spec.ts
🤖 Generating commit message...
AI suggested: "feat: add payment validation with credit card support"
✅ Committed non-test files
✅ Committed test files
🎉 Done! Created commits successfully.The tool recognizes these patterns as test files:
*.test.ts,*.test.js,*.test.tsx,*.test.jsx*.spec.ts,*.spec.js,*.spec.tsx,*.spec.jsx- Files in
__tests__/directories - Files in
.test/or.spec/directories
The tool uses OpenAI's GPT-3.5-turbo by default. You can modify the model in src/git-commit-tool.ts.
- Deno 1.37+
- Git repository
- OpenAI API key
MIT