JSPM

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

AI-powered Git commit message generator — OpenRouter or Ollama, works in every project

Package Exports

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

Readme

write-commit

npm version CI License: MIT Node.js

AI-powered Git commit message generator. Reads your staged diff, generates a Conventional Commit message, and commits — in seconds.

Supports OpenRouter (free cloud models) and Ollama (fully local, no API key). Config is stored globally — set up once, works in every project.


Features

  • Two providers — OpenRouter (cloud) or Ollama (local)
  • One-time setup — saved to ~/.ai-commit/config.json, no .env per project
  • Two message modes — full (subject + bullet list per changed file) or short (one line)
  • Auto fallback — if one OpenRouter free model is rate-limited, tries the next automatically
  • --dry-run — preview the message without committing
  • --yes — skip the confirmation prompt for scripting
  • --amend — regenerate and amend the last commit
  • write-commit log — show unpushed commits with timestamps
  • write-commit config — switch provider or update your API key

Install

npm install -g write-commit

On first run, a setup wizard asks for your provider and saves the config globally.


Quick start

# Stage your changes
git add .

# Generate message, confirm, commit
write-commit

That's it.


Setup

Option 1 — OpenRouter (free cloud models)

Get a free API key at openrouter.ai/keys. No credit card required.

Choose your AI provider:

  1  OpenRouter  (cloud — free models available)
  2  Ollama      (local — runs on your machine)

Enter 1 or 2: 1

OpenRouter API key: sk-or-...
Model (press Enter for default: meta-llama/llama-3.3-70b-instruct:free):

✅ Config saved to /Users/you/.ai-commit/config.json

Option 2 — Ollama (fully local)

Install Ollama and pull a model first:

ollama pull llama3.2

Then run write-commit and choose option 2.


Usage

write-commit                  # full message (subject + bullets), confirm before commit
write-commit --short          # single subject line only
write-commit --yes            # skip confirmation
write-commit --dry-run        # preview message, do not commit
write-commit --amend          # amend the previous commit

write-commit log              # show unpushed commits with timestamps
write-commit config           # change provider, API key, or model
write-commit config --show    # print current settings

Message modes

Full (default)

Best for multi-file commits. Covers every changed file and function.

Suggested commit message:

  feat(NoteEditor): add per-note lock with PIN and keyboard shortcut

  - NoteEditor: add lock toggle button that gates editing behind a PIN prompt
  - useNoteLock: new hook stores lock state in zustand, persists to localStorage
  - LockModal: PIN input auto-focuses on open, clears on wrong attempt
  - Cmd+Shift+L shortcut wires to useNoteLock.toggle() via useHotkeys

Short (--short)

Best for small, focused commits. One line, under 72 characters.

Suggested commit message:

  feat(NoteEditor): add Cmd+Shift+L shortcut to toggle note lock

Configuration

Config is stored at ~/.ai-commit/config.json — one file for your whole machine.

To update it at any time:

write-commit config           # re-run the setup wizard
write-commit config --show    # see current settings

How the OpenRouter fallback works

Free-tier models have rate limits. write-commit handles this automatically:

  1. Tries your configured model first
  2. If rate-limited or unavailable — fetches the live list of free models from OpenRouter and tries them in order
  3. Only fails if every available free model is exhausted

You never see a dead error just because one model is busy.


Development

git clone https://github.com/iamsrikanth-dev/write-commit.git
cd write-commit
npm install
npm run build
npm link          # makes `write-commit` globally available from your local clone

Run without building:

npm run dev

See CONTRIBUTING.md for the full guide.


License

MIT © Srikanth