Auto Commit
A TypeScript tool that helps generate commit messages using ChatGPT API.
Features
- Automatically detects changes in your git repository
- Uses OpenAI's GPT model to suggest commit messages based on your changes
- Interactive CLI to choose from suggested commit messages
- Automatically commits changes with the selected message
Setup
- Install the package:
npm install -g @yuankui/auto-commit
- Run the tool:
auto-commit
On first run, you'll be prompted to enter your OpenAI API key. The key will be saved in ~/.auto-commit.env
for future use.
Development Setup
- Install dependencies:
npm install
- Copy
.env.example
to .env
and add your OpenAI API key:
cp .env.example .env
Then edit .env
and add your OpenAI API key:
OPENAI_API_KEY=your_api_key_here
Usage
When you have changes you want to commit, simply run:
npm run dev
The tool will:
- Check for changes in your repository
- Generate commit message suggestions using ChatGPT
- Let you choose from the suggested messages
- Automatically commit your changes with the selected message
Development
npm run build
npm run format
npm run format:check