Note
Commitizen-like tool for formatting commit messages using emojis written in go.
goji is an easy-to-use commit message formatting tool, inspired by Commitizen and cz-cli, that helps you create conventional commits with emojis with streamlined [git] commit process by providing a user-friendly TUI for selecting the type of change, scope, and description of your commit message..
? Select the type of change you are committing: (Use arrow keys)
β― feature β¨ Introducing new features.
fix π Fixing a bug.
docs π Documentation change.
refactor π¨ Improve structure/format of the code.
clean π₯ Remove code or files.
? What is the scope of this change? (class or file name): (press [enter] to skip)
>- Interactive and Non-interactive CLI with sensible defaults for choosing commit types, scopes, and descriptions and signing off commits.
- Predefined commit types with corresponding emojis.
- Customizable commit types and scopes through a JSON configuration file.
- Supports Git out of the box
- AI generated commit messages using multiple providers:
- Phind (default, no API key required)
- Groq (fast inference, requires API key)
- OpenRouter (access to multiple models, requires API key)
- Intelligent large diff handling with automatic summarization
- No rate limiting issues with smart diff compression
Homebrew (macOs/Linux)
brew install muandane/tap/gojiLinux (or WSL)
VERSION=$(curl --silent "https://api.github.com/repos/muandane/goji/releases/latest" | jq .tag_name -r)
curl -Lso goji.tar.gz https://github.com/muandane/goji/releases/download/$VERSION/goji_${VERSION}_Linux_x86_64.tar.gz
tar -xvzf goji.tar.gz
chmod +x ./goji
# optionnal
sudo mv ./goji /usr/local/bin/Windows (winget)
winget install muandane.gojiBuild locally
git clone https://github.com/muandane/goji.git && cd goji
# Auto-detect version from git tags (recommended)
VERSION=$(git describe --tags --always --dirty | sed 's/^v//')
go build -ldflags "-s -w -X github.com/muandane/goji/cmd.version=${VERSION}"
mv goji /usr/local/bin
goji --versionOr manually specify the version:
go build -ldflags "-s -w -X github.com/muandane/goji/cmd.version=0.1.8"
mv goji /usr/local/bin
goji --versionBuild with Nix
git clone https://github.com/muandane/goji.git && cd goji
nix-build -E 'with import <nixpkgs> {}; callPackage ./default.nix {}'Simply run goji in your terminal to start the interactive commit process:
If you don't want the interactive screen you can use the flags to construct a message:
goji --type feat --scope home --message "Add home page" --git-flag="--porcelain" --git-flag="--branch" --signoff --no-verify --add
-a, --add Automatically stage files that have been modified and deleted
--amend Change last commit
-n, --no-verify bypass pre-commit and commit-msg hooksTo check if a commit message is conventional run:
goji checkTo use the check command, add the following to your pre-commit hook in your git repository:
- repo: https://github.com/muandane/goji
rev: v0.0.8
hooks:
- id: goji-check
name: goji check
description: >
Check whether the current commit message follows commiting rules. Allow empty commit messages by default, because they typically indicate to Git that the commit should be aborted.The draft command allows you to generate a commit message for staged changes using various AI providers.
goji draftThis command connects to an AI provider to generate a commit message based on your staged changes.
1. Set up environment variables (if using Groq or OpenRouter):
# For Groq
export GROQ_API_KEY="your-groq-api-key"
# For OpenRouter
export OPENROUTER_API_KEY="your-openrouter-api-key"
# For Phind (no setup needed)2. Generate and commit:
git add .
goji draft --commit# Generate a commit message (interactive)
goji draft
# Generate and commit directly
goji draft --commit
# Generate with detailed body
goji draft --body
# Generate and commit with detailed body
goji draft --body --commit-c,--commit: Commit the generated message directly.-b,--body: Generate a detailed commit message with body.-t,--type: Override the commit type (e.g., feat, fix, docs).-s,--scope: Override the commit scope (e.g., api, ui, core).
Goji supports multiple AI providers for generating commit messages. Configure your preferred provider in the .goji.json file:
Phind is the default provider and doesn't require any API keys.
{
"aiprovider": "phind",
"aichoices": {
"phind": {
"model": "Phind-70B"
}
}
}Fast inference with various models. Requires a Groq API key.
Setup:
export GROQ_API_KEY="your-groq-api-key"Configuration:
{
"aiprovider": "groq",
"aichoices": {
"groq": {
"model": "mixtral-8x7b-32768"
}
}
}Available Models:
mixtral-8x7b-32768(default)llama2-70b-4096llama2-13b-chatgemma-7b-it
Access to multiple AI models through a single API. Requires an OpenRouter API key.
Setup:
export OPENROUTER_API_KEY="your-openrouter-api-key"Configuration:
{
"aiprovider": "openrouter",
"aichoices": {
"openrouter": {
"model": "anthropic/claude-3.5-sonnet"
}
}
}Available Models:
anthropic/claude-3.5-sonnet(default)openai/gpt-4oopenai/gpt-4o-minimeta-llama/llama-3.1-405b-instructgoogle/gemini-pro-1.5
Goji automatically handles large diffs using intelligent summarization:
- Small diffs (<20k chars): Processed normally
- Large diffs (>20k chars): Automatically summarized to key changes only
- Smart compression: Reduces large diffs by 90%+ while preserving important context
- No rate limits: Single API call prevents token limit issues
Basic commit generation:
# Stage your changes
git add .
# Generate commit message
goji draft
# Generate and commit directly
goji draft --commitDetailed commit with body:
# Generate detailed commit with body
goji draft --body --commitOverride type and scope:
# Force a specific type and scope
goji draft --type feat --scope api --commitUsing different AI providers:
# Switch to Groq (requires GROQ_API_KEY)
goji draft --commit
# Switch to OpenRouter (requires OPENROUTER_API_KEY)
goji draft --commitUpdate your .goji.json to configure AI providers:
{
"aiprovider": "groq",
"aichoices": {
"phind": {
"model": "Phind-70B"
},
"groq": {
"model": "mixtral-8x7b-32768"
},
"openrouter": {
"model": "anthropic/claude-3.5-sonnet"
}
}
}Goji uses environment variables to authenticate with AI providers. Set these in your shell profile (.bashrc, .zshrc, etc.) or export them before running commands.
| Provider | Environment Variable | Required | Description |
|---|---|---|---|
| Phind | None | β | Works out of the box |
| Groq | GROQ_API_KEY |
β | Get from Groq Console |
| OpenRouter | OPENROUTER_API_KEY |
β | Get from OpenRouter |
For Groq:
export GROQ_API_KEY="your-groq-api-key"For OpenRouter:
export OPENROUTER_API_KEY="your-openrouter-api-key"For Phind:
# No environment variables required - works out of the boxTemporary (current session only):
export GROQ_API_KEY="your-api-key"
goji draft --commitPermanent (add to shell profile):
# Add to ~/.bashrc, ~/.zshrc, or ~/.profile
echo 'export GROQ_API_KEY="your-api-key"' >> ~/.bashrc
source ~/.bashrcUsing .env files (if supported by your shell):
# Create .env file in your project root
echo "GROQ_API_KEY=your-api-key" > .envCheck if your environment variables are set:
echo $GROQ_API_KEY
echo $OPENROUTER_API_KEYRate limiting issues:
- Goji automatically handles large diffs with smart summarization
- No need to worry about token limits or rate limiting
API key issues:
- Ensure your API key is set in the environment
- Check that the provider is correctly configured in
.goji.json - Verify environment variables with
echo $VARIABLE_NAME
Large diff processing:
- Goji will show:
π Large diff detected: X chars, using aggressive summarization - Summary shows compression:
π Summarized to Y chars (Z% reduction)
Common environment variable issues:
- Variable not found: Make sure to export the variable in your current shell session
- Wrong variable name: Check spelling (GROQ_API_KEY, not GROQ_KEY)
- Shell restart needed: Some shells require restarting after adding to profile
- Case sensitivity: Environment variable names are case-sensitive
By default goji comes ready to run out of the box and you can initialize a config file with commands. For now customization is in the works (?)
goji init --repo # Writes the config in the git repo's root
goji init --global # Writes the config to home directoryHOW TO
You can customize the .goji.json generated file to add or change the scopes, types and other parameters:
{
"types": [
//***
{
"emoji": "β¨",
"code": ":sparkles:",
"description": "Introducing new features.",
"name": "feat"
},
{
"emoji": "π",
"code": ":bug:",
"description": "Fixing a bug.",
"name": "fix"
}
//***
],
"scopes": ["home", "accounts", "ci"],
"noemoji": false,
"skipquestions": [],
"subjectmaxlength": 50,
"signoff": true
}Only "Scopes" question can be skipped since it's optional according to the Commit Spec
| Option | Type | Description |
|---|---|---|
types |
Array of objects | Types for the commit messages (emoji, code, description, name) |
scopes |
Array of strings | Optional scopes for the commit messages (you can auto-complete with ctrl+e) |
noemoji |
Boolean | Creates commit message with emojis in types |
subjectmaxlength |
Number | Maximum length for the description message |
signoff |
Boolean | Add a sign off to the end of the commit message |
skipquestions |
Array of strings | Skip prompting for these questions (Unimplemented) |
Apache 2.0 license Zine El Abidine Moualhi
Thanks to @Simplifi-ED & @IT Challenge in letting me work on this open source side project and to my mentor @EtienneDeneuve for the help with learning Go lang.

