Package Exports
- @beiyuz/one-commit
- @beiyuz/one-commit/dist/cli.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@beiyuz/one-commit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
One-Commit
π AI-powered automatic commit message generator that uses OpenAI to create meaningful commit messages from your git diff.
Features
- π€ AI-Generated Commit Messages - Uses OpenAI to analyze your changes and generate descriptive commit messages
- π Selective File Staging - Choose specific files to stage and commit
- π― Conventional Commits - Follows conventional commit format (feat:, fix:, docs:, etc.)
- βοΈ Configurable - Support for custom OpenAI API keys and base URLs
- π Interactive - Review, edit, or regenerate commit messages before committing
- π¦ Easy to Use - Simple npx command, no installation required
Quick Start
# Run directly with npx (no installation needed)
npx one-commit
# Or install globally
npm install -g one-commit
one-commitFirst Time Setup
When you first run one-commit, you'll be prompted to configure your OpenAI settings:
npx one-commit --configYou'll need to provide:
- OpenAI API Key (required)
- Base URL (optional, defaults to https://api.openai.com/v1)
- Model (optional, defaults to gpt-4o-mini)
Usage
Basic Usage
Navigate to your git repository and run:
npx one-commitThe tool will:
- Check if you have staged changes
- If no staged changes, ask if you want to stage all changes
- Generate a commit message using AI
- Show you the generated message for review
- Allow you to commit, edit, regenerate, or cancel
Configuration
# Configure OpenAI settings
npx one-commit --config
# Show help
npx one-commit --helpEnvironment Variables
You can also set configuration via environment variables:
export OPENAI_API_KEY="your-api-key"
export OPENAI_BASE_URL="https://api.openai.com/v1" # optionalExamples
Generated Commit Messages
The AI generates commit messages following conventional commit format:
feat: add user authentication systemfix: resolve memory leak in data processordocs: update API documentationrefactor: simplify error handling logicstyle: format code with prettier
Interactive Flow
π One-Commit
β¨ Generated commit message:
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β feat: add user authentication with JWT tokens β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
Files: src/auth.ts, src/middleware.ts (+127 -23)
What would you like to do?
β
Commit with this message
βοΈ Edit message
π Regenerate message
β CancelRequirements
- Node.js 18+
- Git repository
- OpenAI API key
Configuration Storage
Configuration is stored locally using the conf package:
- macOS:
~/Library/Preferences/one-commit/config.json - Linux:
~/.config/one-commit/config.json - Windows:
%APPDATA%\one-commit\config.json
Development
# Clone the repository
git clone <repository-url>
cd one-commit
# Install dependencies
npm install
# Build
npm run build
# Run in development mode
npm run devLicense
MIT
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Made with β€οΈ for developers who want better commit messages without the hassle.