auto-commit generates Conventional Commit messages from staged git changes using Gemma 4 31B through the Gemini API.
-
Install dependencies:
npm install
-
Create a
.envfile 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.
Build the CLI:
npm run buildGenerate a commit message without committing:
node dist/cli.js generate --cwd /path/to/git/repoGenerate a message and create the commit from already staged changes:
node dist/cli.js commit --cwd /path/to/git/repoStage everything first, then generate and commit:
node dist/cli.js commit --cwd /path/to/git/repo --addDuring development you can run the TypeScript entrypoint directly:
npm run start -- generate --cwd /path/to/git/repoThe 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.
Run the test suite:
npm testRun the type-check:
npm run check