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

@moretocontabilidade/cmsg

v2.0.1

Published

CLI for generating commit messages from staged git changes using the OpenAI API.

Readme

@moretocontabilidade/cmsg

CLI for generating commit messages from staged Git changes using the OpenAI API.

Requirements

  1. Node.js 18.18 or newer
  2. Git
  3. An OpenAI API key (configured via cmsg --init)

Installation

Install the package:

yarn add -D @moretocontabilidade/cmsg

Add the script to package.json:

{
  "scripts": {
    "cmsg": "cmsg"
  }
}

Setup

Run the setup wizard to configure your OpenAI API key:

yarn cmsg --init

The key is stored in ~/.config/cmsg/config with restricted permissions (600) and is reused automatically on every run.

To remove the key:

yarn cmsg --unset

Usage

Run the assistant:

yarn cmsg

If no files are staged, the CLI will ask whether you want to stage all changed files (git add .) before continuing.

You can optionally provide a preferred prefix:

yarn cmsg bug
yarn cmsg chore
yarn cmsg docs
yarn cmsg feature
yarn cmsg improvement

Show help:

yarn cmsg --help

Check the installed version:

yarn cmsg --version

How it works

  1. If no staged changes are found, asks whether to run git add .
  2. Reads staged changes and filters out lock files, build artifacts, and minified files to reduce token usage
  3. Sends the filtered diff to the OpenAI API (model gpt-4o-mini) with structured output
  4. Presents one recommended commit message and three alternatives, plus a Try again option
  5. If Try again is selected, re-runs the request
  6. Runs git commit -m "<selected message>"
  7. Optionally runs git pull --rebase and git push

Environment variables

OPENAI_API_KEY

Overrides the key stored by --init. Useful for CI or when you prefer to manage the key yourself.

CMSG_DEBUG

When set to 1, prints the raw API response and token usage instead of the progress spinner.

export CMSG_DEBUG=1

Publishing

Before publishing, log in to npm:

npm login --registry https://registry.npmjs.org

Check what will be included in the package:

yarn pack:check

Publish to npm:

yarn pack:publish

Notes

  1. The tool analyzes only staged changes
  2. Lock files (*.lock, package-lock.json, etc.), build artifacts (dist/, build/, .next/, etc.), minified files, and source maps are excluded from the diff automatically
  3. Large per-file diffs are truncated at 300 lines; the total diff is capped at 20,000 characters
  4. Commit messages are always requested in English
  5. The CLI is interactive and expects a terminal when prompting for prefix, selection, and sync confirmation