Skip to content
/ aicom Public

One command to commit with AI-generated message. No prompts, no copy-paste, just commit.

License

Notifications You must be signed in to change notification settings

olllayor/aicom

Repository files navigation

🤖 AIcom - AI-Powered Git Commit

One command to commit with AI-generated message. No prompts, no copy-paste, just commit.

🚀 Quick Start

Installation

npm install -g aicom
# or
pnpm add -g aicom

Setup

Get a free API key from OpenRouter and set it:

export OPENROUTER_API_KEY=your_key_here
# The tool will store this key in ~/.aicom/config.json automatically
# Add to ~/.zshrc or ~/.bashrc if you prefer keeping it in your shell too

The API key will be automatically saved to ~/.aicom/config.json for future use.

Usage

git add .
aicom

That's it! AI generates the commit message and commits automatically.

📝 Example

$ git add src/auth.ts
$ aicom
git commit -m "feat: add JWT authentication to user service" (Press Enter to commit)
# [User presses Enter]
[main abc1234] feat: add JWT authentication to user service
 1 file changed, 45 insertions(+), 3 deletions(-)

Simple: See the message, press Enter, done!

🎯 How It Works

  1. Checks Git Status - Verifies you're in a git repo with staged changes
  2. Fetches Free Model - Automatically finds an available free model from OpenRouter
  3. Analyzes Changes - Gets the git diff of your staged changes
  4. Generates Message - Uses AI to create a conventional commit message
  5. Outputs Command - Displays the ready-to-run git commit command

🔧 Features

  • One command commit - Just run aicom, press Enter, done
  • ✅ Shows the commit message before executing
  • ✅ AI-generated messages using free OpenRouter models
  • ✅ Conventional commit format (feat:, fix:, docs:, etc.)
  • ✅ Analyzes git diffs for context
  • ✅ Zero configuration needed (just API key)
  • ✅ Press Enter to confirm
  • ✅ Zero runtime dependencies
  • ✅ Small package size (~6.7 kB)

🛠️ Development

Local Development

# Clone the repository
git clone https://github.com/yourusername/aicom.git
cd aicom

# Install dependencies
npm install

# Build
npm run build

# Test locally
npm run dev

Build for Production

npm run build

Publishing

# Login to npm
npm login

# Publish
npm publish
# or with pnpm
pnpm publish

📦 Configuration

API keys can be provided in two ways:

  1. Environment variable: OPENROUTER_API_KEY. When present, aicom saves it to ~/.aicom/config.json so future sessions can reuse it automatically.
  2. Config file: ~/.aicom/config.json. You can edit this file directly if you need to rotate keys or switch accounts.

💡 Tips

  • The API key is automatically saved after first use - no need to export it every time
  • Optionally add export OPENROUTER_API_KEY=your_key to ~/.zshrc or ~/.bashrc if you prefer
  • The tool automatically uses free models from OpenRouter
  • Follows conventional commit best practices
  • Works silently - only shows git's commit output
  • If you need to edit before committing, use git commit --amend

🤝 Contributing

This is a simple starter project. Feel free to:

  • Implement streaming responses
  • Create better UI components
  • Add custom templates
  • Improve error handling
  • Add commit message history

📄 License

MIT

About

One command to commit with AI-generated message. No prompts, no copy-paste, just commit.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •