genmsg
v0.3.1
Published
CLI tool that reads current `git diff` and generates a commit message with OpenAI.
Readme
gm
CLI tool that reads current git diff and generates a commit message with OpenAI.
gm currently runs as a standard CLI command (no TUI screen during normal commit message generation).
Generated messages are constrained to the Conventional Commits header format and validated against @commitlint/config-conventional-compatible rules (type enum, header shape, lower-case style, and max header length).
Setup
Set env vars in .env (Bun auto-loads it):
OPEN_AI_KEY=your_key
OPEN_AI_API_URL=https://your-api-base-url
OPEN_AI_MODEL=gpt-4.1-miniInstall dependencies:
bun installRun locally:
bun run index.tsAfter publishing/installing globally, run in any git repo:
gmCLI options
--lang, -l <en|zh>: set CLI output language and generated commit subject language (enby default)--help, -h: show usage and available options
Examples:
gm --lang zh
gm --helpIt generates a suggested command like:
git commit -m "<generated message>"By default, it also copies the generated commit command to your clipboard.
- macOS uses
pbcopy - Windows uses
clip - Linux tries
wl-copyfirst, thenxclip
It prints the suggested commit command to stdout and copies it to the clipboard.
@opentui/core is installed for upcoming interactive configuration features (for example setting OPEN_AI_KEY).
Example output:
feat(parser): support commitlint-compatible fallback retriesThe git commit command is not executed automatically.
This project was created using bun init in bun v1.3.9. Bun is a fast all-in-one JavaScript runtime.
