npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

diff-detective

v1.1.8

Published

AI-powered git commit review tool

Downloads

36

Readme

Diff Detective

Diff Detective is an AI-powered git commit review tool that helps catch issues before they're pushed to the repository.

Goal

To provide an automated review of staged changes in a git repository. it aims to:

  1. Identify potential bugs or issues in the code (be it serious ones, like blatant race conditions, to less serious ones like forgotten debug statements)
  2. Catch common mistakes or oversights
  3. Provide context-aware insights that a traditional linter might miss

Features

  • AI-powered analysis of staged git changes
  • Identification of bugs, potential issues, and code smells
  • Easy-to-use command-line interface
  • Configurable prompt, model, provider, max tokens, api key...

Usage

To install:

pnpm install -g diff-detective

The default model is Sonnet 3.5 from Anthropic.

For each provider you use, you need an API key. You can set it

  • as an environment variable in the system (OPENAI_API_KEY, ANTHROPIC_API_KEY etc.),
  • always pass it as a CLI argument (detective review --api-key your-api-key)
  • save it to the config file (detective set-api-key your-api-key)

To use Diff Detective, simply run detective or dd (because we are lazy) in the root of your project.

This will analyze your currently staged changes and provide a detailed report.

Example parameter usage:

detective --model gpt-4o --prompt-path "./my-custom-review-prompt.txt"
dd --prompt "See any issues in the database refactor?" -m "o1-mini" --ignore pnpm-lock.yaml dist/

Example of setting defaults:

detective set-provider anthropic
detective set-model claude-3-5-sonnet-20240620
detective set-api-key "your-api-key"
detective set-ignored-files dist/ pnpm-lock.yaml android/ ios/
detective get-config
detective clear-config

To see all available options, run

detective --help

Supported models

Diff Detective currently supports OpenAi, Anthropic and OpenRouter as providers. You can use any model available with these providers (given you have an API key). More to come.

How It Works

Diff Detective integrates into your git workflow as follows:

  1. You stage your changes as usual with git add
  2. Before committing, you run Diff Detective
  3. The tool analyzes your staged changes using AI
  4. It provides a detailed report of findings and suggestions, outputs to the console
  5. You can then review the AI's feedback and make any necessary adjustments before committing

To-Do

  • [x] Custom prompt configurable via config, not only using CLI arguments
  • [ ] ? Smarter algorithm for extracting code change context. Currently, the AI only sees the changed files. It might be beneficial to include additional context like repo map, related files, or just general info about the project.
  • [x] Configurable array of ignored files (pnpm-lock.yaml, dist...) - both global and repo-specific
  • [ ] Streaming support
  • [ ] manual inclusion of additional files using CLI params
  • [ ] More providers (Google, Mistral, Deepseek, Groq)
  • [ ] Better prompt (that's an uphill battle)
  • [ ] ? Better output formatting of code blocks
  • [ ] a --fail mode, which fails the command if it found a bug that it is confident in. Useful for automatic pre-commit testing where the commit would fail in case of a found bug.