npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

aicontext-commit

v0.1.2

Published

AI commit messages that match your team's style — reads your last 30 commits to learn your conventions before suggesting anything

Downloads

118

Readme

aicontext-commit

Commit messages that sound like your team wrote them, not a generic LLM. acc reads your last 30 commits before writing a single word — matching your style, language, and conventions automatically.

acc looks at what you have staged with git add, scans your recent commits to learn how this project writes commits, and asks an LLM (Anthropic or OpenAI) for 3 ready-to-use suggestions. Pick one, tweak it, or regenerate.

demo

Features

  • 🧠 Context-aware — uses your last 30 commits as a style reference (language, casing, format, level of detail)
  • ✍️ 3 suggestions per run — alternative phrasings for the same change, ordered most-specific first
  • 🌍 Auto-detects language — writes in whatever language your history uses, falling back to English
  • 📐 Conventional Commits — picks the right type from the diff (feat, fix, docs, build, ci, refactor…)
  • 🔁 Regenerate / edit / manual — you stay in control of the final message
  • 🤝 Two providers — works with Anthropic (Claude) or OpenAI; uses whichever key you have set
  • 🛡️ Safe by design — won't run without staged changes, refuses oversized diffs, redacts common secrets, and treats history and diff as data

Installation

npm install -g aicontext-commit

Or run on demand without installing:

npx aicontext-commit

The package exposes two binaries — aicontext-commit and the shorter alias acc.

Setup

Set one of the following API keys as an environment variable:

export ANTHROPIC_API_KEY=sk-ant-...
# or
export OPENAI_API_KEY=sk-...

If both are set, Anthropic is used. You can also drop them into a .env file in your project root. acc reads only the supported API key names from that file and does not inject the whole file into the process environment. See .env.example for the format.

Usage

# stage your changes as usual
git add .

# launch the picker
acc

You'll see something like:

Reading staged changes...
Generating suggestions...
? Choose a commit message: (Use arrow keys)
❯ feat(cli): add commit picker with 3 AI suggestions
  feat: generate commit messages from staged diff using LLM
  feat(acc): scaffold CLI to draft conventional commits
  ↺ Regenerate suggestions
  ✎ Write manually

Pick a suggestion → edit it inline if you want → press Enter → commit is created. Done.

Options on the picker

| Option | What it does | |---|---| | Any suggestion | Opens an editable prompt pre-filled with the message, then commits | | ↺ Regenerate suggestions | Asks the model again with the same prompt (useful if none fit) | | ✎ Write manually | Type your own message from scratch |

Press Ctrl+C at any time to abort cleanly — no commit is created.

How it works

  1. Read git — runs git diff --cached for the staged changes and git log --oneline -30 for style context.
  2. Build prompt — wraps both into a structured prompt that asks the model to summarize the entire staged diff as one commit (not one suggestion per file) and to match the repo's existing style.
  3. Call the model — Claude Sonnet 4 by default if ANTHROPIC_API_KEY is set, otherwise gpt-5.4-mini if OPENAI_API_KEY is set.
  4. Parse 3 suggestions — strict format 1. … / 2. … / 3. …; if parsing fails you get a clear error, not a bad commit.
  5. Commit — runs git commit -m "<your choice>" with the message you confirmed.

Limits & safeguards

  • No staged changes → exits with a clear message before calling any API.
  • Not a git repo → exits with a clear message.
  • Diff over ~60k characters → refuses and asks you to split the commit. Keeps token usage and quality predictable.
  • Secret redaction → common API keys, bearer tokens, private keys, and credential assignments are redacted before the diff/history is sent to the model.
  • Prompt injection → instructions are placed before untrusted repo data, code fences are escaped, and the prompt tells the model to treat the diff and history as data.
  • Git hooksgit commit runs with a sanitized environment so API keys and secret-looking variables are not passed to hooks.

Development

git clone https://github.com/samuelurones28/aicontext-commit.git
cd aicontext-commit
npm install

# run from source
npm run dev

# build to dist/
npm run build

# run the test suite (builds first)
npm test

# preview what would be published
npm run smoke

The project is plain TypeScript compiled to CommonJS — no bundler. Tests use Node's built-in node:test runner against the compiled dist/ output.

Project layout

src/
  index.ts    # CLI entrypoint, picker flow, commit execution
  git.ts      # staged diff + recent commits, with safety checks
  prompt.ts   # prompt template
  ai.ts       # provider detection (Anthropic/OpenAI) + parser
  errors.ts   # CliError class + typed error codes + formatter
bin/
  index.js    # thin wrapper that requires dist/index.js
tests/
  *.test.js   # node:test suites for each module

Debugging

Set DEBUG=1 to print full stack traces for unexpected errors:

DEBUG=1 acc

Known errors come back with a code (NO_STAGED_CHANGES, MISSING_API_KEY, STAGED_DIFF_TOO_LARGE, AI_PARSE_ERROR, …) so you can grep them or wrap them in scripts.

License

MIT © Samuel Fernandez — see LICENSE.