A cross-platform .NET tool that generates AI-powered commit messages using OpenAI or Azure OpenAI.
- 🤖 AI-powered commit messages - Generate meaningful commit messages from your staged changes
- 🔄 Cross-platform - Works on Windows, macOS, and Linux
- 🎛️ Highly configurable - Adjust AI parameters to your preference
- 🧪 Dry-run mode - Preview generated messages without committing
- 📝 Verbose output - Detailed logging for debugging and transparency
- ⚡ Fast and lightweight - Direct OpenAI or Azure OpenAI integration for quick responses
- 📋 Smart chunking - Handles large diffs by intelligently splitting them into semantic chunks
- 🔍 Context-aware - Adds surrounding code lines when diffs are very small for better summaries
- .NET 8.0 or later
- OpenAI or Azure OpenAI API key (optional, required only if your endpoint needs authentication)
- Git repository with staged changes
Quick install (latest release):
# Auto-detect platform (Linux/macOS)
curl -sSL https://raw.githubusercontent.com/PatrickRuddiman/WriteCommit/refs/heads/main/install-universal.sh | bash
# Specific architecture (Linux/macOS)
curl -sSL https://raw.githubusercontent.com/PatrickRuddiman/WriteCommit/refs/heads/main/install-universal.sh | bash -s -- --arch linux-arm64
# Windows - One-liner install (PowerShell)
iex (irm https://raw.githubusercontent.com/PatrickRuddiman/WriteCommit/refs/heads/main/install-web.ps1)
Supported architectures:
linux-x64- Linux 64-bit (Intel/AMD)linux-arm64- Linux ARM64 (Apple Silicon, Raspberry Pi, etc.)osx-x64- macOS Intelosx-arm64- macOS Apple Siliconwin-x64- Windows 64-bit
Build from source:
# Windows
.\install.ps1
# Linux/macOS
chmod +x install.sh && ./install.sh
Manual installation:
git clone https://github.com/yourusername/WriteCommit.git
cd WriteCommit
# Publish for your platform
dotnet publish --configuration Release --runtime win-x64 --self-contained true --output publish/win-x64 # Windows
dotnet publish --configuration Release --runtime linux-x64 --self-contained true --output publish/linux-x64 # Linux
dotnet publish --configuration Release --runtime osx-x64 --self-contained true --output publish/osx-x64 # macOS
# Copy to your local bin directory and add to PATH
# Stage your changes
git add .
# Generate and commit with AI-powered message
WriteCommit
# Preview message without committing
WriteCommit --dry-run
# Detailed output for debugging
WriteCommit --verbose
# Custom AI parameters
WriteCommit --temperature 0.7 --topp 0.9
# Combine multiple options
WriteCommit --dry-run --verbose --temperature 0.5
| Option | Default | Description |
|---|---|---|
--dry-run |
false |
Generate message without committing |
--verbose |
false |
Show detailed output |
--temperature |
1 |
AI creativity level (0-2) |
--topp |
1 |
Nucleus sampling parameter (0-1) |
--model |
from setup | OpenAI model to use |
--presence |
0 |
Presence penalty (-2 to 2) |
--frequency |
0 |
Frequency penalty (-2 to 2) |
--setup |
false |
Configure OpenAI or Azure OpenAI settings |
- Validates environment - Checks for git repository and OpenAI settings
- Analyzes changes - Processes your staged git diff using semantic chunking
- Generates message - Uses OpenAI or Azure OpenAI to create meaningful commit message
- Commits changes - Applies the generated message (unless
--dry-run)
Option 1: Using the Setup Command (Recommended)
# Run the setup wizard
WriteCommit --setup
This will prompt you to enter your API key (if needed), choose between OpenAI or Azure OpenAI, specify the endpoint, and default model/deployment. If you select Azure but leave the endpoint blank, WriteCommit will fall back to the standard OpenAI endpoint. The values are saved to ~/.writecommit/config.json.
Option 2: Using Environment Variables
# Linux/macOS
export OPENAI_API_KEY="your-api-key-here" # optional
# Windows (PowerShell)
$env:OPENAI_API_KEY="your-api-key-here" # optional
# Windows (Command Prompt)
set OPENAI_API_KEY=your-api-key-here # optional
For persistent configuration, add the export to your shell profile (~/.bashrc, ~/.zshrc, etc.) or Windows environment variables.
Note: The environment variable takes precedence over the configuration file if both are set.
git clone https://github.com/PatrickRuddiman/Toolkit
cd Tools/Write-Commit
dotnet build
dotnet run -- --help
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ for developers who want better commit messages