1.0.3 • Published 5 months ago

@johnowennixon/diffdash v1.0.3

Weekly downloads
-
License
0BSD
Repository
github
Last release
5 months ago

DiffDash

A command-line tool to generate Git commit messages using AI.

Features

  • Generates Git commit messages in natural English
  • Adds a footer to the generated commit messages
  • Options to disable or auto-approve various stages of the process
  • Able to add a prefix or suffix to the summary line
  • Optionally select from a choice of LLM models
  • Compare messages generated from all configured models
  • Configuration using standard API provider environment variables
  • Uses the Vercel AI SDK
  • Uses structured JSON with compatible models
  • Substantially written using AI coding (Claude Code, Roo Code, and Amp)

Installation from npmjs.com

npm install -g @johnowennixon/diffdash

API Keys

DiffDash requires at least one API key for an LLM provider. These must be provided as environment variables.

# For Anthropic
export ANTHROPIC_API_KEY=your-api-key

# For DeepSeek
export DEEPSEEK_API_KEY=your-api-key

# For Google Gemini
export GEMINI_API_KEY=your-api-key

# For OpenAI
export OPENAI_API_KEY=your-api-key

# For Requesty
export REQUESTY_API_KEY=your-api-key

# For OpenRouter
export OPENROUTER_API_KEY=your-api-key

Usage

# Basic usage (uses defaults)
diffdash

# Add a prefix to the commit message summary line
diffdash --add-prefix "[FIX]"

# Add a suffix to the commit message summary line
diffdash --add-suffix "(closes #123)"

# Automatically stage all changes, but still prompt for commit and push
diffdash --auto-add

# Automatically stage and commit changes, but still prompt for push
diffdash --auto-add --auto-commit

# Fully automated workflow (stage, commit, and push without prompts)
diffdash --auto-add --auto-commit --auto-push

# Generate message for already staged changes only (won't stage any new changes)
diffdash --disable-add

# Skip displaying the status of staged files before commit
diffdash --disable-status

# Don't display the generated commit message
diffdash --disable-preview

# Generate message but don't commit (exit after displaying the message)
diffdash --disable-commit

# Generate message and commit, but don't push or prompt to push
diffdash --disable-push

# Skip git hooks when pushing
diffdash --no-verify

# Display commit messages generated by all models
diffdash --llm-compare

# Use the fallback LLM model
diffdash --llm-fallback

# Specify the LLM model by name
diffdash --llm-model claude-3.5-haiku

# Debug options
diffdash --debug-llm-inputs --debug-llm-outputs

Command Line Arguments

All command-line arguments are optional.

ArgumentDescription
--helpshow a help message and exit
--versionshow program version information and exit
--add-prefix PREFIXadd a prefix to the commit message summary line
--add-suffix SUFFIXadd a suffix to the commit message summary line
--auto-addautomatically stage all changes without confirmation
--auto-commitautomatically commit changes without confirmation
--auto-pushautomatically push changes after commit without confirmation
--disable-adddisable adding unstaged changes - exit if no changes staged
--disable-statusdisable listing the staged files before generating a message
--disable-previewdisable previewing the generated message
--disable-commitdisable committing changes - exit after generating the message
--disable-pushdisable pushing changes - exit after making the commit
--push-no-verifybypass git hooks when pushing to Git
--push-forceapply force when pushing to Git
--llm-listdisplay a list of available Large Language Models and exit
--llm-comparecompare the generated messages from all models - but do not commit
--llm-routerprefer to access the LLM via a router rather than direct
--llm-fallbackuse the fallback LLM model instead of the default
--llm-model MODELchoose the LLM model by name (the default is normally best)
--llm-excludes MODELSmodels to exclude from comparison (comma separated)
--silentsuppress all normal output - errors and aborts still display
--debug-llm-inputsshow inputs (including all prompts) sent to the LLM
--debug-llm-outputsshow outputs received from the LLM

Files containing secrets

Files containing secrets should not be in Git. But if they are, you can add an entry to a .gitattributes file with value -diff to prevent them being viewable by a Git diff. This will prevent DiffDash from sending any contents to the LLM. For example:

# This is file .gitattributes

.env  -diff

Development

To install on your laptop:

# Clone the repository
git clone https://github.com/johnowennixon/diffdash.git
cd diffdash

# Install dependencies
pnpm install

# Build the project
pnpm run build

# Make binaries executable
npm link

To rebuild after editing:

# Lint the code
pnpm run lint

# Fix formatting issues (if required)
pnpm run fix

# Build the project
pnpm run build

License

0BSD