smart-diff

Generate AI-powered natural-language summaries of git diffs for code review in any git repository.
Supports OpenAI, Anthropic, Google Gemini, Amazon Bedrock, Mistral, Cohere, Groq, xAI, DeepSeek, or any OpenAI-compatible gateway.
Ways to use it
| Use it as | Best for | API key |
|---|
| AI coding agent skills | Asking Claude Code, Copilot, or another coding agent to summarize your branch or draft release notes | Not needed; your agent writes the summary |
| CLI or library | Scripts, tooling, and your own pipelines | Your own provider |
| GitHub Action | A summary on every pull request in CI | Your own provider |
To try the skills in Claude Code:
/plugin marketplace add mcarvin8/smart-diff
/plugin install smart-diff@smart-diff
Then ask your agent to "summarize my branch against main". For GitHub Copilot and other agents, see AI coding agent skills.
Requirements
- Node.js 22.22.1+
- For the CLI, library, and GitHub Action: an LLM provider credential (see Provider configuration). Not needed for the agent skills or
--emit-context.
- No git binary required, on any platform — smart-diff reads the git repository directly via
@scolladon/tsgit, a pure-TypeScript git implementation with zero native dependencies
Installation
npm install @mcarvin/smart-diff
Provider configuration
smart-diff is "configured" when isLlmProviderConfigured() returns true — i.e. at least one supported provider can be resolved from env vars — or you pass your own llmModelProvider factory. Otherwise summarizeGitDiff / generateSummary throw with LLM_GATEWAY_REQUIRED_MESSAGE.
Selecting a provider
LLM_PROVIDER explicitly selects a provider. When unset, the resolver auto-detects in this order: LLM_BASE_URL/OPENAI_BASE_URL → openai-compatible, OPENAI_API_KEY/LLM_API_KEY → openai, then ANTHROPIC_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY (or GOOGLE_API_KEY), MISTRAL_API_KEY, COHERE_API_KEY, GROQ_API_KEY, XAI_API_KEY, DEEPSEEK_API_KEY, AWS_ACCESS_KEY_ID/AWS_PROFILE → bedrock, and finally OPENAI_DEFAULT_HEADERS/LLM_DEFAULT_HEADERS → openai.