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

cw-check-review

v0.0.4

Published

AI-driven Git diff reviewer

Downloads

6

Readme

Check Review CLI

npm version License: MIT

🤖 AI 驅動的 Git Diff 程式碼審查工具

這是一個基於 OpenAI GPT 的智能程式碼審查工具,能夠自動分析您的 Git diff 並提供專業的程式碼審查建議。

✨ 功能特色

  • 🔍 智能分析 - 使用 OpenAI GPT 模型分析程式碼變更
  • 📊 評分系統 - 提供 0-10 分的程式碼品質評分
  • 📝 詳細報告 - 生成包含風險點、優化建議的完整審查報告
  • 🎯 檔案篩選 - 支援 include/exclude 模式過濾檔案
  • 批次處理 - 自動將大量檔案分批處理以提高效率
  • 💰 成本追蹤 - 顯示 API 使用量和預估費用

📦 安裝

全域安裝

npm install -g cw-check-review

本地安裝

npm install cw-check-review

🚀 快速開始

1. 建立配置檔案

在您的專案根目錄建立 reviewer.config.js

module.exports = {
  apiKey: 'your-openai-api-key',  // 必填:您的 OpenAI API Key
  model: 'gpt-4.1-nano',          // 可選:使用的模型,預設 gpt-4.1-nano
  include: ['src/**/*.js', 'app/**/*.vue'],  // 可選:要包含的檔案模式
  exclude: ['**/*.test.js', 'dist/**'],      // 可選:要排除的檔案模式
  keepPhrases: [                   // 可選:審查時要遵守的規則
    '不要批評 XXX 函式',
    '忽略 test 檔案改動',
  ],
};

2. 執行審查

check-review <target-branch>

例如:

# 比較當前分支與 main 分支的差異
check-review main

# 比較當前分支與 develop 分支的差異
check-review develop

3. 查看結果

工具會在專案根目錄生成 review.md 檔案,包含完整的審查報告。

⚙️ 配置選項

| 參數 | 類型 | 必填 | 說明 | 預設值 | |------|------|------|------|--------| | apiKey | string | ✅ | OpenAI API Key | - | | model | string | ❌ | 使用的 OpenAI 模型 | gpt-4.1-nano | | include | string[] | ❌ | 要包含的檔案模式(glob 語法) | 所有檔案 | | exclude | string[] | ❌ | 要排除的檔案模式(glob 語法) | 無 | | keepPhrases | string[] | ❌ | 審查時要遵守的規則 | 無 |

檔案模式範例

module.exports = {
  // 只審查 JavaScript 和 TypeScript 檔案
  include: [
    'src/**/*.js',
    'src/**/*.ts',
    'lib/**/*.js',
  ],
  
  // 排除測試檔案和建置產物
  exclude: [
    '**/*.test.js',
    '**/*.spec.ts',
    'dist/**',
    'build/**',
    'node_modules/**',
  ],
};

📊 審查報告範例

生成的 review.md 包含以下內容:

# AI Review 分析報告

來源:`origin/main...HEAD`

## 🟢 建議 Approve

**整體平均評分:** 8.5 / 10

### 🔎 整體簡述摘要:
本次變更主要新增了使用者認證功能,包含登入、註冊和權限驗證機制。
程式碼結構清晰,遵循最佳實踐,建議進行簡單的錯誤處理優化後即可合併。

---

## 🔹 第 1 批檔案分析

**包含檔案:**
- src/auth/login.js
- src/auth/register.js

### 改動做了什麼事
新增了完整的使用者認證系統...

### 潛在風險點
1. 密碼加密強度需要確認...
2. Session 管理可能存在安全風險...

### 可以優化的地方
1. 建議加入更詳細的錯誤處理...

### 建議 Reviewer 檢查重點
1. 檢查密碼加密是否使用足夠強度...

💡 **總共使用 1,250 tokens**
💰 **預估花費約 $0.0375**

🛠️ 進階用法

在 CI/CD 中使用

# GitHub Actions 範例
name: AI Code Review
on: [pull_request]

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
      with:
        fetch-depth: 0
    - uses: actions/setup-node@v3
      with:
        node-version: '18'
    - run: npm install -g cw-check-review
    - run: check-review main
      env:
        OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
    - uses: actions/upload-artifact@v3
      with:
        name: review-report
        path: review.md

自訂模型

支援的 OpenAI 模型:

  • gpt-4.1-nano (預設,成本較低)
  • gpt-4
  • gpt-3.5-turbo
module.exports = {
  model: 'gpt-4',  // 使用更強大的模型
  // ...其他配置
};

🔧 故障排除

常見問題

Q: 出現 "請在根目錄建立 reviewer.config.js" 錯誤 A: 請確認在專案根目錄建立 reviewer.config.js 配置檔案。

Q: API Key 錯誤 A: 請確認 OpenAI API Key 有效且有足夠額度。

Q: 沒有找到變更檔案 A: 請確認:

  1. 目標分支名稱正確
  2. 本地已經 fetch 最新的遠端分支
  3. include/exclude 設定是否過濾掉了所有檔案

Q: 審查結果不如預期 A: 可以嘗試:

  1. 調整 keepPhrases 設定更具體的審查規則
  2. 使用更強大的模型如 gpt-4
  3. 確認 diff 內容符合預期

📝 開發

# 複製專案
git clone <repository-url>
cd check-review

# 安裝依賴
npm install

# 本地測試
node bin/index.js main

🤝 貢獻

歡迎提交 Issue 和 Pull Request!

📄 授權

MIT License - 詳見 LICENSE 檔案。

🔗 相關連結