Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smart-commit

Generate conventional commit messages from your staged git diff using Azure OpenAI.

Features

  • Builds a suggested conventional commit message from staged changes.
  • Warns on large commits.
  • Optional Jira ticket prefix (e.g. JIRA-123 fix(auth): ...).
  • Interactive flow: accept, edit, or cancel.

Requirements

  • Node.js 22+.
  • Git repo with staged changes.
  • Azure OpenAI credentials.

Install

Local development:

npm install
npm link

Then run:

smart-commit

You can also run directly:

node bin/cli.js

Environment Variables

Create a .env file in this repo (or set environment variables in your shell):

AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com
AZURE_OPENAI_API_KEY=your-key
AZURE_OPENAI_DEPLOYMENT=your-deployment-name
AZURE_OPENAI_API_VERSION=2024-02-15-preview

AZURE_OPENAI_DEPLOYMENT defaults to gpt-4o-mini if not set.

Usage

  1. Stage changes:
git add .
  1. Run:
smart-commit
  1. If prompted, enter a Jira ticket (optional). If provided, it prefixes the commit message.

Notes

  • Only staged changes are analyzed.
  • Large commits are flagged when insertions exceed the threshold in git shortstat.

About

Generate conventional commit messages from your staged git diff using Azure OpenAI.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages