JSPM

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

A smart CLI tool that generates AI-powered, context-aware Git commit messages using OpenRouter LLMs. Automate your workflow and write meaningful commits effortlessly.

Package Exports

  • openrouter-commit
  • openrouter-commit/index.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 (openrouter-commit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

openrouter-commit - AI-powered Git Commit Messages πŸš€

openrouter-commit is a CLI tool that generates clear, concise, and AI-powered commit messages using OpenRouter's LLM models.
It supports DeepSeek R1 and any OpenRouter model, making it a more flexible and cost-efficient alternative to other commit tools.


✨ Quick Start

Run without installation

You can use openrouter-commit immediately with npx.
To execute the command, you must provide the -run flag:

npx openrouter-commit -run

Install globally

If you use it frequently, install it globally:

npm install -g openrouter-commit
openrouter-commit -run

Use in any project with package.json

You can add it to any project without installing globally. Just place a package.json in your directory and run:

yarn commit  # or npm run commit

Example package.json setup:

{
    "name": "your-project",
    "scripts": {
        "commit": "npx openrouter-commit -run"
    }
}

Now, running yarn commit or npm run commit will generate an AI-powered commit message!


πŸ”§ Configuration

Before using openrouter-commit, set up your OpenRouter API key and model.

Option 1: Using a .env.openrouter file

Create a .env.openrouter file in your project's root:

OPENROUTER_API_KEY=your-api-key
OPENROUTER_MODEL=deepseek/deepseek-r1

Option 2: Setting environment variables manually

Alternatively, export your API key and model in the terminal:

export OPENROUTER_API_KEY=your-api-key
export OPENROUTER_MODEL=deepseek/deepseek-r1

Option 3: Specify a custom .env path

By default, openrouter-commit looks for .env.openrouter in your project's root.
You can specify a different path using the --env-path flag:

npx openrouter-commit -run --env-path /custom/path/.env

πŸš€ How It Works

When you run openrouter-commit -run, the script will:
1️⃣ Check your Git status and show modified files.
2️⃣ Prompt you to stage all changes (if they are not staged).
3️⃣ Generate a commit message based on the Git diff using OpenRouter AI.
4️⃣ Allow you to confirm, modify, or manually enter a commit message.
5️⃣ Automatically commit and push your changes.


πŸ”Ή Features

βœ… AI-powered commit messages (DeepSeek R1 + all OpenRouter models)
βœ… Interactive CLI with confirmation prompts
βœ… Works with .env.openrouter or CLI environment variables
βœ… Supports custom .env file paths (--env-path <path>)
βœ… Handles large diffs (truncates beyond 10,000 characters)
βœ… Failsafe exit handling (Ctrl+C won’t commit unfinished work)
βœ… Prevents accidental execution with the -run flag


❓ Troubleshooting

Not enough OpenRouter credits?

Visit OpenRouter Credits and add more.

Command not found?

Try running:

npx openrouter-commit -run

Or, if installed globally:

npm install -g openrouter-commit
openrouter-commit -run

Git push fails?

Ensure your branch is set up to track a remote branch:

git branch --set-upstream-to=origin/main

πŸ’‘ About

Developed by Unrealos.com – AI, SaaS, and PaaS solutions for businesses.

πŸ“œ License

MIT Β© Unrealos.com