JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q34964F
  • License MIT

AI-powered automatic commit message generator

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.

δΈ­ζ–‡ζ–‡ζ‘£ | English

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-commit

First Time Setup

When you first run one-commit, you'll be prompted to configure your OpenAI settings:

npx one-commit --config

You'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-commit

The tool will:

  1. Check if you have staged changes
  2. If no staged changes, ask if you want to stage all changes
  3. Generate a commit message using AI
  4. Show you the generated message for review
  5. Allow you to commit, edit, regenerate, or cancel

Configuration

# Configure OpenAI settings
npx one-commit --config

# Show help
npx one-commit --help

Environment 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"  # optional

Examples

Generated Commit Messages

The AI generates commit messages following conventional commit format:

  • feat: add user authentication system
  • fix: resolve memory leak in data processor
  • docs: update API documentation
  • refactor: simplify error handling logic
  • style: 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
❌ Cancel

Requirements

  • 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 dev

License

MIT

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Made with ❀️ for developers who want better commit messages without the hassle.