An AI-powered VS Code extension that generates meaningful Conventional Commit messages using OpenRouter.
- 🔹 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.
- Detects unstaged changes in the Git repository.
- Sends the changes to OpenRouter's AI for message generation.
- Displays the AI-generated commit message.
- Allows the user to apply or modify the message before committing.
- Clone this repository:
git clone https://github.com/sheikhmohdnazmulhasan/commit-first.git cd commit-first
- Install dependencies:
npm install
- Compile the extension:
npm run compile
- Run it in VS Code:
code --extensionDevelopmentPath=.
Once published, you will be able to install it directly from the VS Code Extensions Marketplace.
- Open a Git-tracked project in VS Code.
- Make some unstaged changes.
- Press
Cmd + Shift + P
(Mac) /Ctrl + Shift + P
(Windows). - Search for "Commit First" and select it.
- AI will generate a commit message for you.
- Choose "Use it" to commit or modify it before committing.
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
You need an OpenRouter API Key to use the extension.
- Get an API key from OpenRouter.
- Open
.env
and replace:with your actual API key.OPENROUTER_API_KEY = "YOUR_OPENROUTER_API_KEY";
- VS Code API – For extension development
- OpenRouter AI – AI-generated commit messages
- TypeScript – Codebase language
- Simple-Git – Fetching Git changes
- Axios – API requests
- 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.
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"!