@stephansama/ai-commit-msg
v1.1.0
Published
generate commit messages using ai
Maintainers
Readme
@stephansama / ai-commit-msg
generate commit messages using ai
Table of contents
Installation
pnpm install @stephansama/ai-commit-msgCLI Options
| Option | Alias | Description | Type |
| :---------- | :---- | :------------------------- | :-------- |
| --config | -c | Path to config file | string |
| --output | -o | Output file for commit-msg | string |
| --verbose | -v | Enable verbose logging | boolean |
Usage
Husky
Install and initialize husky
npm install --save-dev husky && npx husky initcreate the
prepare-commit-msghook by creating a file located at.husky/prepare-commit-msg#!/bin/sh ai-commit-msg -o "$1"
Preserving your commit message
If the output file already contains a message (for example from
git commit -m "fix login redirect"), it is passed to the model as the
original intent. The message is then rewritten to match the prompt's format and
the staged diff, without changing what it means.
Git comment lines (#) and verbose diff output are ignored. A message that is
empty, punctuation only, or a variant of n/a (N/A, na, n.a., none) is
treated as no message, and a fresh one is generated from the diff.
A custom prompt can place the existing message with the {{message}}
placeholder. Without the placeholder, intent instructions are appended to the
prompt when a message exists.
