Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ› οΈ git-commit-craft

AI-Powered Conventional Commits & README Generation, Right From Your Terminal

License: MIT Node.js Version Engine Version Platform

Clean commit histories and polished documentation, without the manual overhead.

Installation β€’ Configuration β€’ Usage β€’ Architecture


🧭 Table of Contents

  1. Overview
  2. Features
  3. Tech Stack
  4. Project Structure
  5. Installation
  6. Configuration
  7. Usage & Commands
  8. How It Works
  9. Security Notice
  10. Contributing
  11. License

🧠 Overview

git-commit-craft is a production-ready CLI tool built on Node.js ESM that uses Google's Gemini 3.5 Flash model via the official @google/genai SDK to automate two of the most tedious parts of software development:

  • βœ… Writing structured, standards-compliant Conventional Commit messages from your git diff
  • βœ… Generating comprehensive, professional README.md files from your project's structure and metadata

No more staring at a blank commit prompt or a blank README file.


πŸš€ Features

πŸ€– AI-Generated Commits Analyzes staged (or unstaged) git diff output and produces a fully compliant Conventional Commit message
πŸ”„ Interactive Commit Workflow Accept, edit, regenerate, or cancel the AI-suggested commit directly from the terminal
πŸ“„ Smart README Generation Scans your directory tree, detected language, and package.json to draft a complete README
⚑ Powered by Gemini 3.5 Flash Frontier-level intelligence with sub-second response times, running with thinking disabled for maximum speed
πŸ” Secure Config Management Caches your Gemini API key locally at ~/.git-commit-craft/config.json, or reads it from GEMINI_API_KEY
🎨 Polished Terminal UX Custom-rendered boxes, spinners, and color-coded success/warning/error indicators

🧰 Tech Stack

Category Technology
Runtime Node.js >=18.0.0 (ESM)
AI Engine @google/genai β€” Gemini 3.5 Flash
CLI Framework commander
Interactive Prompts inquirer
Terminal Spinners ora
Terminal Styling chalk

πŸ“‚ Project Structure

git-commit-craft/
β”œβ”€β”€ package.json
└── src/
    β”œβ”€β”€ cli.js
    β”œβ”€β”€ config.js
    β”œβ”€β”€ ai.js
    β”œβ”€β”€ git.js
    β”œβ”€β”€ scanner.js
    └── ui.js
File Responsibility
src/cli.js CLI entry point β€” defines craft-commit and craft-readme commands
src/config.js Secure API key storage and retrieval (env var or local config file)
src/ai.js Gemini 3.5 Flash prompt engineering and generation pipeline via @google/genai
src/git.js Native Git operations β€” diffing and committing
src/scanner.js Project directory analysis, language detection, package.json parsing
src/ui.js Terminal rendering β€” boxes, spinners, and status messages
flowchart LR
    A[git-commit-craft CLI] --> B{Command}
    B -->|craft-commit| C[git.js: Get Diff]
    C --> D[ai.js: Generate Commit Message]
    D --> E[ui.js: Interactive Review]
    E -->|Confirm| F[git.js: Commit]
    B -->|craft-readme| G[scanner.js: Analyze Project]
    G --> H[ai.js: Generate README]
    H --> I[Write README.md to Disk]
Loading

βš™οΈ Installation

From Source (Local Development)

git clone https://github.com/pegasusdev18/git-commit-craft.git
cd git-commit-craft
npm install
npm link

Once linked, the git-commit-craft command becomes available globally from any Git repository on your machine.

Unlinking

npm unlink -g git-commit-craft

πŸ”‘ Configuration

You'll need a free Gemini API Key from Google AI Studio.

Option 1 β€” Interactive Prompt

Run any command below and the tool will securely prompt you for the key on first use, saving it locally at:

~/.git-commit-craft/config.json

Option 2 β€” Environment Variable

export GEMINI_API_KEY="your_actual_api_key_here"

πŸ”’ The GEMINI_API_KEY environment variable always takes priority over the locally cached config file.


πŸ’» Usage & Commands

Command Description
git-commit-craft craft-commit Analyzes staged changes and guides you through an interactive AI-assisted commit
git-commit-craft craft-readme Scans the project directory and generates a complete README.md file

Example: Crafting a Commit

git add .
git-commit-craft craft-commit
βœ” Commit message generated.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Generated Commit Message                      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ feat(auth): add JWT-based session validation  β”‚
β”‚                                                β”‚
β”‚ - Implement token verification middleware     β”‚
β”‚ - Attach decoded user to socket session       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

? Do you want to commit with this message?
  ❯ Yes, commit now
    Edit message
    Regenerate message
    Cancel

If no staged changes exist, the CLI will offer to analyze unstaged changes instead.

Example: Generating a README

git-commit-craft craft-readme
βœ” Project structure scanned.
βœ” README.md generated successfully.
βœ” Saved to /path/to/project/README.md

If a README.md already exists in the current directory, you'll be prompted before it's overwritten.


πŸ”¬ How It Works

Commit Generation Pipeline

  1. Reads git diff --cached (falls back to git diff if nothing is staged).
  2. Sends the diff to Gemini 3.5 Flash with a strict system prompt enforcing the Conventional Commits v1.0.0 specification.
  3. Runs with thinkingConfig: { thinkingBudget: 0 } to disable extended reasoning and maximize response speed.
  4. Strips any accidental code fences from the model's response.
  5. Presents the result in an interactive review loop β€” accept, edit, regenerate, or cancel.
  6. On confirmation, runs git commit -m "<message>" natively.

README Generation Pipeline

  1. Recursively scans the project directory (up to a bounded depth, skipping node_modules, .git, dist, etc.).
  2. Detects the dominant programming language by counting file extensions.
  3. Parses package.json, if present, for name, dependencies, and scripts.
  4. Sends this metadata to Gemini 3.5 Flash with a system prompt tailored for professional README generation.
  5. Writes the raw Markdown response directly to README.md.

πŸ” Security Notice

Starting June 19, 2026, Google requires all Gemini API keys to be restricted to generativelanguage.googleapis.com. Unrestricted keys will be rejected.

  • Keys generated directly from Google AI Studio are restricted by default β€” no extra action needed.
  • If your key was generated from a Google Cloud project, restrict it manually under API restrictions in Google Cloud Credentials.

🀝 Contributing

Contributions are welcome and appreciated.

  1. Fork the repository
  2. Create a feature branch β€” git checkout -b feature/amazing-feature
  3. Commit your changes β€” git-commit-craft craft-commit
  4. Push the branch β€” git push origin feature/amazing-feature
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


⭐ If this tool saves you time, consider giving it a star! ⭐

About

An elegant, production-ready CLI tool powered by Gemini to generate structured Conventional Commits and professional README.md files.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages