Skip to content

thooams/ollacommit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ollacommit

Rust library and CLI to generate Conventional Commit messages using Ollama (default model: mistral).

Install

  • Ensure Ollama is running locally and the model is available.
  • Build from source:
cargo install --path ollacommit-cli

CLI Usage

ollacommit --model mistral --include-diff --dry-run
ollacommit --no-edit  # run git commit -F <msg> without opening editor

Flags:

  • --model <name>: Ollama model (default mistral)
  • --base-url <url>: Ollama base URL (default http://localhost:11434)
  • --include-diff: Include unified diff in prompt
  • --dry-run: Print message only
  • --no-edit: Use git commit -F without -e
  • --message-only: Print message only (alias for piping/integration)
  • --max-prompt-chars <n>: Limit prompt size (default 20000)

LazyGit Integration

Add to ~/.config/lazygit/config.yml:

customCommands:
  - key: 'C'
    context: 'files'
    description: 'OllaCommit (AI)'
    prompts:
      - type: 'input'
        title: 'Model'
        initialValue: 'mistral'
    command: 'ollacommit --model {{index .PromptResponses 0}} --include-diff --no-edit'

Alternatively, to just print to LazyGit's commit view:

    command: 'ollacommit --message-only --include-diff'

Library API

See ollacommit-core crate: generate_commit_message(path, opts) returns a parsed CommitMessage.

Testing

cargo test

Integration tests mock the Ollama HTTP endpoint and run in a temporary git repo.

About

Rust library and CLI to generate Conventional Commit messages using Ollama

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages