Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Example .env (DO NOT COMMIT this file to version control)

# Your Groq API key used by commit-ai to make chat-completion requests
GROQ_API_KEY=your_groq_api_key_here

# Optional: customize truncation length (not wired to env by default; modify src/index.ts)
# MAX_CHAR=5000
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# Finder (MacOS) folder config
.DS_Store
commit-ai.exe
bin/
34 changes: 34 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Do not publish source or dev artifacts
src/
*.ts
*.tsx
*.map
tsconfig.json

# Local env files
.env
.env.*

# Editor + OS
.vscode/
.idea/
.DS_Store

# Tests, docs and configs not needed in package
tests/
coverage/
docs/
.github/

# Logs
*.log

# Ignore node_modules (npm ignores it by default) but keep explicit
node_modules/

# Keep package artifacts
!dist/
!bin/
!README.md
!LICENSE
!package.json
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
149 changes: 143 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,152 @@
# commit-ai
# Commit-AI 🤖

To install dependencies:
<div>

**Professionalize your Git history with AI-generated Conventional Commits.**

[![Version](https://img.shields.io/badge/version-1.3.0-magenta?style=flat-square)](https://github.com/NeelFrostrain/commit-ai)
[![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-339933?style=flat-square&logo=node.js&logoColor=white)](https://nodejs.org)
[![TypeScript](https://img.shields.io/badge/TypeScript-%3E%3D5.0-3178C6?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org)
[![Groq](https://img.shields.io/badge/Groq-AI-cyan?style=flat-square)](https://groq.com)
[![License](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](LICENSE)

Stop writing "fixed stuff" and start writing commits that tell a story.

</div>

---

## 📖 About Commit-AI

**Commit-AI** was born out of a common developer frustration: the "Lazy Commit" syndrome. We've all written messages like `fixed bug`, `update index.ts`, or the dreaded `..........`.

This tool transforms raw, technical code changes into **human-readable, professional documentation**. By leveraging the **Llama 3.1 8B** model via Groq's ultra-fast inference engine, Commit-AI acts as a bridge between your terminal and your project's history.

### 🧠 The Logic

The tool doesn't just look at filenames; it reads the **Git Diff**. It understands:

- **Intent:** Are you adding a feature or fixing a regression?
- **Impact:** What specific logic changed within the functions?
- **Context:** It filters out noise like `package-lock.json` or `node_modules` to focus on your actual contributions.

### 🏗️ Built With

- **[Bun](https://www.google.com/search?q=https://bun.sh/):** High-performance runtime and bundler.
- **[Groq SDK](https://www.google.com/search?q=https://groq.com/):** Lightning-fast AI inference.
- **[Commander.js](https://www.google.com/search?q=https://github.com/tj/commander.js/):** CLI interface and flag management.
- **[Simple-Git](https://www.google.com/search?q=https://github.com/steveukx/git-js):** Local Git interaction layer.
- **[Chalk](https://www.google.com/search?q=https://github.com/chalk/chalk):** Beautiful, colored terminal logs.

---

## ⚡ Quick Start

### 1️⃣ Installation

Install the tool globally using npm:

```bash
npm i @neelfrostrain/commit-ai -g

```

### 2️⃣ Get your API Key

1. Visit [Groq Cloud Console](https://www.google.com/search?q=https://console.groq.com/keys).
2. Create a new API Key and copy it.

### 3️⃣ Configure Environment (Windows)

To use Commit-AI, you must set your `GROQ_API_KEY` as an environment variable. Choose your preferred terminal below:

#### **Option A: Command Prompt (CMD)**

Run this command (replace `your_key_here` with your actual key):

```cmd
setx GROQ_API_KEY "your_key_here"

```

#### **Option B: PowerShell**

Run this command:

```powershell
[System.Environment]::SetEnvironmentVariable('GROQ_API_KEY', 'your_key_here', 'User')

```

> **⚠️ Important:** You **must restart** your terminal (CMD, PowerShell, or VS Code) after running these commands for the changes to take effect.

---

## ✨ Features

| Feature | Description |
| ------------------------- | ---------------------------------------------------------------- |
| **🧠 Deep Diff Analysis** | Understands code logic, not just file metadata. |
| **📝 Conventional Style** | Strictly follows the `type: description` standard. |
| **📊 Technical Reports** | Generates a detailed bulleted summary for the commit body. |
| **🛡️ Smart Filtering** | Respects `.gitignore` and ignores heavy lockfiles automatically. |
| **🚀 Sub-second Speed** | Powered by Groq for nearly instant commit generation. |

---

## 📖 Usage

### Command Flags

| Flag | Short | Description |
| ----------- | ----- | ------------------------------------------------------- |
| `--commit` | `-c` | Performs the `git commit` after generating the message. |
| `--yes` | `-y` | Skips the confirmation prompt (Auto-pilot). |
| `--version` | `-v` | Displays the current version. |
| `--help` | `-h` | Displays the help menu. |

### Example Workflow

1. **Stage your changes:**

```bash
bun install
git add .

```

To run:
2. **Run Commit-AI:**

```bash
bun run index.ts
commit-ai -c

```

This project was created using `bun init` in bun v1.3.6. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
3. **Review & Confirm:** The AI will show you a report and the suggested message. Type `y` to finalize!

---

## ⚙️ Standards & Security

### Conventional Commit Types

Commit-AI automatically categorizes your work into:

- `feat`: New features
- `fix`: Bug fixes
- `docs`: Documentation updates
- `style`: Formatting/Linting
- `refactor`: Code restructuring
- `chore`: Build tasks/dependencies

### 🛡️ Privacy

- **Local Keys:** Your API key stays on your machine and is never shared.
- **Diffs Only:** Only the `git diff` of your **staged** files is sent to the AI for processing. No other system data is accessed.

---

## 📄 License

MIT © [Neel Frostrain](https://www.google.com/search?q=https://github.com/NeelFrostrain)

---
4 changes: 1 addition & 3 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading