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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ai-pre-commit-review

v0.1.2

Published

Local AI pre-commit code review CLI for staged Git changes.

Readme

ai-pre-commit-review

ai-pre-commit-review 是一个Git pre-commit AI code review 工具。它读取当前 staged diff,调用本机 agent CLI(Claude、Codex 或 Gemini)审查提交内容,并允许 agent 直接修改不合适的代码。如果 agent 没有改动工作树,本次 commit 正常继续;如果 agent 应用了修复,工具会终止本次 commit,且不会重新暂存任何内容。修复会留在 working tree 里由开发者检查、暂存后再次提交。

它能做什么

  • git commit 前审查 staged changes。
  • 支持 claudecodexgemini 三种本地 CLI backend。
  • 不接收 webhook,不运行 HTTP server,不依赖 GitLab、SQLite 或后台 worker。
  • Agent 只拿到 staged file list 和 staged diff;prompt 明确要求不要提交、建分支或改非 staged 文件。
  • Agent 不会运行 git add;修正后的代码是否进入后续 commit 由开发者决定。
  • 如果 agent 修改了 staged 文件的 working tree diff,pre-commit 返回 1 并阻止本次提交。

ai-pre-commit-review 使用方法

安装方法

1.安装agent CLI 并授权登录,以codex为例

npm install -g @openai/codex
codex --version

2.安装bun:

PS:这个包依赖 Bun 运行,所以需要安装bun

curl -fsSL https://bun.sh/install | bash
bun --version

3.全局安装ai-pre-commit-review

npm install -g ai-pre-commit-review

确认命令可用:

ai-pre-commit-review --help

使用方法

1. 手动 review 当前项目

进入任意 Git 项目:

cd /path/to/your/repo

先暂存改动:

git add <files>

执行 review:

ai-pre-commit-review

也可以 review 指定项目:

ai-pre-commit-review /path/to/your/repo

2. commit 时自动 review

在目标项目中的.git目录下新建

.git/hooks/pre-commit

写入:

#!/usr/bin/env sh
set -eu

ai-pre-commit-review

赋权

chmod +x .git/hooks/pre-commit

之后正常提交:

git add <files>
git commit -m "feat: xxx"

如果 AI 没改代码,commit 继续;如果 AI 修改了代码,commit 会被阻止。你检查修改后重新暂存再提交:

git add <files>
git commit -m "feat: xxx"

可选指定 agent:

ai-pre-commit-review --agent codex