1.1.0 • Published 7 months ago
@yuankui/auto-commit v1.1.0
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: 1. Check for changes in your repository 2. Generate commit message suggestions using ChatGPT 3. Let you choose from the suggested messages 4. Automatically commit your changes with the selected message
Development
- Build the project:
npm run build
- Format code:
npm run format
- Check code formatting:
npm run format:check