Instant AI Git Commit message, Git changes summary from the CLI (no API key required)
Find a file
2024-11-07 00:59:51 +05:30
src fix(OllamaProvider): convert response value to str 2024-11-07 00:59:51 +05:30
.gitignore feat: Initial setup using openai and keyring 2024-10-29 01:00:27 +05:30
Cargo.lock chore: Bump ver 2024-11-06 18:38:42 +05:30
Cargo.toml chore: Bump ver 2024-11-06 18:38:42 +05:30
LICENSE Create LICENSE 2024-10-30 04:39:38 +05:30
README.md Update README.md 2024-11-06 19:09:50 +05:30

lumen

Crates.io Total Downloads GitHub License Crates.io Size

lumen is a command-line tool that uses AI to generate commit messages, summarise git diffs or past commits, and more without requiring an API key.

demo

Features

  • Generate commit message for staged changes
  • Generate summary for changes in a git commit by providing its SHA-1
  • Generate summary for changes in git diff (staged/unstaged)
  • Fuzzy-search for the commit to generate a summary
  • Free and unlimited - no API key required to work out of the box
  • Pretty output formatting enabled by Markdown
  • Supports multiple AI providers

Usage

Try lumen --help

To generate a commit message for staged changes

lumen draft

The commit message can be piped to other commands

# copy the commit message to clipboard (macos and linux, respectively)
lumen draft | pbcopy
lumen draft | xclip -selection clipboard

# open the commit message in your code editor
lumen draft | code -

# directly commit with the generated message
lumen draft | git commit -F -

The AI generates more meaningful commit messages when you provide context.

# Without context:
lumen draft
# Output: "feat(button.tsx): Change button color to blue"

# With context - just add a simple why:
lumen draft --context "match brand guidelines"
# Output: "feat(button.tsx): Update button color to align with brand identity"

To summarise a commit, pass in its SHA-1

lumen explain HEAD
# OR
lumen explain cc50651f

To use the interactive fuzzy-finder (requires: fzf)

lumen list

To generate a summary for the current git diff

lumen explain --diff
# OR
lumen explain --diff --staged

AI Provider can be configured by using CLI arguments or Environment variables.

-p, --provider <PROVIDER>  [env: LUMEN_AI_PROVIDER] [default: phind] [possible values: openai, phind, groq, claude]
-k, --api-key <API_KEY>    [env: LUMEN_API_KEY]
-m, --model <MODEL>        [env: LUMEN_AI_MODEL]

# eg: lumen -p="openai" -k="<your-api-key>" -m="gpt-4o" explain HEAD
# eg: lumen -p="openai" -k="<your-api-key>" -m="gpt-4o" draft
# eg: LUMEN_AI_PROVIDER="openai" LUMEN_API_KEY="<your-api-key>" LUMEN_AI_MODEL="gpt-4o" lumen list

Supported providers

Provider API Key Required Models
Phind phind (Default) No Phind-70B
Groq groq Yes (free) llama2-70b-4096, mixtral-8x7b-32768 (default: mixtral-8x7b-32768)
OpenAI openai Yes gpt-4o, gpt-4o-mini, gpt-4, gpt-3.5-turbo (default: gpt-4o-mini)
Claude claude Yes see list (default: claude-3-5-sonnet-20241022)

Installation

Using Homebrew (MacOS and Linux)

brew tap jnsahaj/lumen
brew install --formula lumen

Using Cargo

Important

cargo is a package manager for rust, and is installed automatically when you install rust. see installation guide

cargo install lumen

Prerequisites

  1. git
  2. fzf (optional): Required for lumen list command
  3. mdcat (optional): Required for pretty output formatting