Skip to content

anojndr/auto-commit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

auto-commit

auto-commit generates Conventional Commit messages from staged git changes using Gemma 4 31B through the Gemini API.

Setup

  1. Install dependencies:

    npm install
  2. Create a .env file from the example and add your Gemini API key:

    cp .env.example .env
    GEMINI_API_KEY=your-gemini-api-key
    GIT_AUTHOR_NAME=Auto Commit Bot
    GIT_AUTHOR_EMAIL=bot@example.com

GEMINI_API_KEY is required. GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL are optional, but they must be set together if you want the tool to create commits with a specific Git identity.

Usage

Build the CLI:

npm run build

Generate a commit message without committing:

node dist/cli.js generate --cwd /path/to/git/repo

Generate a message and create the commit from already staged changes:

node dist/cli.js commit --cwd /path/to/git/repo

Stage everything first, then generate and commit:

node dist/cli.js commit --cwd /path/to/git/repo --add

During development you can run the TypeScript entrypoint directly:

npm run start -- generate --cwd /path/to/git/repo

Conventional Commit Enforcement

The model does not emit raw commit text directly. Instead, the CLI sends the full Conventional Commits 1.0.0 specification to Gemini verbatim, requests structured JSON, validates the payload locally, and formats the final message itself. That keeps generated messages aligned with the specification’s structure:

<type>[optional scope]: <description>

[optional body]
[optional footer(s)]

Breaking changes may be rendered with !, with a BREAKING CHANGE: footer, or with both, as allowed by the specification. The staged diff is passed through without truncation; if the repository state exceeds model or transport limits, the CLI fails instead of silently shortening the input.

Development

Run the test suite:

npm test

Run the type-check:

npm run check

About

Generate Conventional Commit messages from staged Git changes with Gemma 4 31B via the Gemini API.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors