ficommitgen-vscode
ficommitgen-vscode is a Visual Studio Code extension that generates commit messages automatically using Google Gemini AI (currently) based on changes (git diff) in your Git repository.
✨ Features
- 🔍 Automatically reads
git diff and git log for more accurate context
- 🧠 Generates commit messages using AI, following the Conventional Commits specification
- 📋 Automatically inserts the generated message into the Source Control input box
- 🧩 Integrated with VS Code's built-in Git UI (button in the Source Control title)
- 🛡️ API token is securely stored using VS Code's SecretStorage (not
settings.json)
- 🔑 Multi-Token Support: Manage multiple named tokens (e.g., Personal, Work) and switch between them easily
- 🔄 Auto-Switching: Automatically switches to the next available token if the active one fails (e.g., quota exceeded)
- 📝 Customizable configuration in
ficommitgen.md
🛠️ Requirements
- VS Code version 1.101.0 or later
- A Git repository must be initialized (
git init)
- A Google Gemini API token (you'll be prompted on first use)
🚀 Usage
Generate Commit Message
You can generate a commit message in two ways:
- Open the Source Control panel
- Click the "Generate Commit" button (sparkle ✨ icon) in the Source Control title
OR
- Open the Command Palette (
Ctrl+Shift+P on Windows/Linux, Cmd+Shift+P on macOS, or F1)
- Select "Ficommitgen: Generate Commit"
Note: If you have staged changes, it will try to generate commit message based on staged changes first. If not, it will generate commit message based on unstaged changes.
Manage Tokens
You can now manage multiple API tokens and switch between them.
- Open the Command Palette
- Select "Ficommitgen: Manage Tokens" (or use the key icon)
From here, you can:
- Add new token: Enter a token value and give it a name (e.g., "Personal", "Work"). The new token becomes active immediately.
- Switch active token: Choose from your saved tokens to set the active one.
- Remove token: Delete a token from storage.
Auto-Switching on Error
If the active token fails during commit generation (e.g., due to quota limits or expiration), the extension will automatically switch to the next available token in your list and retry the request. You will be notified when a switch occurs.
⚙️ Extension Settings
There are currently no settings configurable via settings.json. You can configure the extension by editing ficommitgen.md.
---
recentCommitsCount: 20
---
Your custom system instruction here...
Configuration Options
recentCommitsCount: Number of recent commits to consider (default is 20)
- The content of
ficommitgen.md is passed as the system instruction to the AI (optional)
🐛 Known Issues
- If your project is not initialized as a Git repository, the extension will not work.
- If the Gemini API token is missing, incorrect, or rate-limited, commit generation will fail.
📦 Build & Install Locally
To build and install the extension manually:
npm install -g vsce
vsce package
code --install-extension ficommitgen-vscode-1.0.0.vsix
🤝 Contributing
To contribute to this project:
- Fork the repository
- Create a new branch for your feature or fix
- Commit your changes
- Push your branch
- Open a pull request
Enjoy using ficommitgen-vscode! 🎉