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.
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)
- Ask questions about a specific change
- 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. See Advanced Configuration to configure commit types
The commit message can be piped to other commands
# copy the commit message to clipboard (macos and linux, respectively)
|
|
# open the commit message in your code editor
|
# directly commit with the generated message
|
The AI generates more meaningful commit messages when you provide context.
# Output: "feat(button.tsx): Change button color to blue"
# Output: "feat(button.tsx): Update button color to align with brand identity"
To summarise a commit, pass in its SHA-1
To use the interactive fuzzy-finder (requires: fzf)
To generate a summary for the current git diff
You can ask a question about the diff (or a commit) using --query
AI Provider can be configured by using CLI arguments or Environment variables (see also: Advanced Configuration).
# 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 ) |
Ollama ollama |
No (local) | see list (required) |
OpenRouter openrouter |
Yes | see list (default: anthropic/claude-3.5-sonnet ) |
Installation 🔅
Using Homebrew (MacOS and Linux)
brew tap jnsahaj/lumen
brew install --formula lumen
Using Cargo
[!IMPORTANT]
cargo
is a package manager forrust
, and is installed automatically when you installrust
. see installation guide
cargo install lumen
Prerequisites 🔅
- git
- fzf (optional): Required for
lumen list
command - mdcat (optional): Required for pretty output formatting
Advanced Configuration 🔅
lumen
can be configured using a configuration file. You can specify lumen.config.json
at the root of your git-tracked project, or use --config "./path/to/config.json
You can also specify command-specific options (currently only draft.commit_types
is supported)
An example configuration file can look like
lumen
uses the commit_types
specified in the example above as defaults if none are provided
Precedence Order
Since there are multiple ways of configuring options for lumen
, there is a defined precedence order
CLI Flags > Configuration File > Environment Variables > Default options
This also allows for mixing different methods.
For example, if you want to use Ollama
for a specific project, and OpenAI
for all others, you can do the following:
# .zshrc/.bashrc
The above will apply globally. You can override this for a specific project by either specifying a configuration file or using CLI flags.
OR