Skip to content

a small ai cli tool for generating commit message

Notifications You must be signed in to change notification settings

Shivgitcode/gimi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GIMI - AI-Powered Commit Message Generator

Version Go Report Card

GIMI is a command-line interface (CLI) tool that uses AI to automatically generate conventional commit messages from your staged git changes. It supports Ollama, OpenAI, and Google Gemini.


📦 Installation

You can install GIMI using NPM (recommended) or Go.

Option 1: NPM (Recommended)

This method installs the pre-compiled binary for your operating system.

npm install -g gimi-cli

Troubleshooting: "Command not found" If you run gimi and see "command not found", your NPM global bin directory is likely not in your system's PATH.

  1. Run npm config get prefix to see where npm installs global packages (e.g., /usr/local or /Users/you/.npm-global).
  2. Add the bin folder inside that prefix to your PATH.
    • Example (add to ~/.zshrc or ~/.bashrc):
      export PATH=$PATH:$(npm config get prefix)/bin

Option 2: Go

If you have Go installed, you can build and install directly from the source:

go install github.com/shivgitcode/gimi@latest

Ensure your Go bin directory (usually ~/go/bin) is in your PATH:

export PATH=$PATH:$(go env GOPATH)/bin

🚀 Usage

1. Initialize Configuration

Run this once to select your AI provider (Ollama, OpenAI, or Gemini) and set API keys.

gimi init

2. Generate Commit Message

Stage your changes (git add .) and run:

gimi generate

The tool will analyze your diff and propose a commit message.

3. Reset Configuration

To change your provider or keys:

gimi reset

🛠️ Development (For Contributors)

If you are developing GIMI, follow these steps to avoid "running the old version" issues.

Running Locally

Do not just run gimi if you want to test your code changes. The gimi command points to the installed binary (in /usr/local/bin or $GOPATH/bin), not your current source code.

To run the version you are working on:

# Run directly from source
go run . generate

# OR
go run main.go generate

Installing Your Local Changes

If you want to use your modified version globally (as the gimi command):

go install .

This overwrites the binary in $GOPATH/bin with your current code.


📦 Release Process (For Maintainers)

To deploy a new version to NPM so everyone gets the update:

  1. Prerequisites:

    • Ensure you are logged into npm: npm login
    • Ensure you have node and go installed.
  2. Run the Build Script: We have a helper script that cross-compiles binaries for Windows, Linux, and macOS (AMD64 & ARM64) and updates the version.

    # Usage: ./build.sh <new-version>
    ./build.sh 0.8.0

    This will:

    • Clean npm/bin/.
    • Compile binaries for all platforms.
    • Update the version in npm/package.json.
  3. Publish to NPM:

    cd npm
    npm publish
  4. Commit Changes: Don't forget to commit the version bump and the new build artifacts (if you track them).

    git add .
    git commit -m "chore: release v0.8.0"
    git tag v0.8.0
    git push origin v0.8.0

⚙️ Configuration File

Config is stored in ~/.gimi/config.json.

{
  "Backend": "gemini",
  "apiKey": "your-api-key"
}

License

MIT

About

a small ai cli tool for generating commit message

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •