Skip to content

sheikhmohdnazmulhasan/commit-first

Repository files navigation

"Commit First" Intelligent Git Commit Helper

An AI-powered VS Code extension that generates meaningful Conventional Commit messages using OpenRouter.

Features

  • 🔹 AI-Generated Commit Messages: Uses OpenRouter's AI to generate commit messages.
  • 🔹 Conventional Commit Format: Ensures commits follow best practices.
  • 🔹 Quick & Efficient: No need to think about commit messages—just run "Commit First" and apply!
  • 🔹 Seamless Git Integration: Fetches unstaged Git changes automatically.

How It Works

  1. Detects unstaged changes in the Git repository.
  2. Sends the changes to OpenRouter's AI for message generation.
  3. Displays the AI-generated commit message.
  4. Allows the user to apply or modify the message before committing.

Installation

Install VS Code Extension Manually

  1. Clone this repository:
    git clone https://github.com/sheikhmohdnazmulhasan/commit-first.git
    cd commit-first
  2. Install dependencies:
    npm install
  3. Compile the extension:
    npm run compile
  4. Run it in VS Code:
    code --extensionDevelopmentPath=.

Install via VS Code Marketplace (Upcoming)

Once published, you will be able to install it directly from the VS Code Extensions Marketplace.

Usage

  1. Open a Git-tracked project in VS Code.
  2. Make some unstaged changes.
  3. Press Cmd + Shift + P (Mac) / Ctrl + Shift + P (Windows).
  4. Search for "Commit First" and select it.
  5. AI will generate a commit message for you.
  6. Choose "Use it" to commit or modify it before committing.

Folder Structure

commit-first/
│── .vscode/                   # VS Code settings
│── src/                       # Source code
│   ├── extension.ts           # Main extension logic
│   ├── generateCommit.ts      # AI commit message generation
│── package.json               # Extension metadata
│── tsconfig.json              # TypeScript config
│── README.md                  # Project documentation
│── .gitignore                 # Ignore unnecessary files
│── .eslintrc.json             # Linting rules
│── .prettierrc                # Formatting rules

Configuration

You need an OpenRouter API Key to use the extension.

  1. Get an API key from OpenRouter.
  2. Open .env and replace:
    OPENROUTER_API_KEY = "YOUR_OPENROUTER_API_KEY";
    with your actual API key.

Tech Stack

  • VS Code API – For extension development
  • OpenRouter AI – AI-generated commit messages
  • TypeScript – Codebase language
  • Simple-Git – Fetching Git changes
  • Axios – API requests

Future Enhancements

  • Model Selection: Let users choose AI models (GPT-4, Claude, Mistral, etc.).
  • Preview Before Committing: Allow users to edit AI-generated commit messages.
  • Branch-Based Messages: Modify suggestions based on branch type (feat/, fix/, etc.).
  • Custom Prompts: Users can define AI prompts for commit messages.

Contributing

We welcome contributions! Feel free to:

  • 🔹 Fork the repository
  • 🔹 Submit pull requests
  • 🔹 Report issues
  • 🔹 Suggest new features

Enjoy effortless, AI-powered Git commits with "Commit First"!

About

A VS Code extension that generates AI-powered, Conventional Commit messages using OpenRouter

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published