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 🙏

© 2025 – Pkg Stats / Ryan Hefner

review-copilot

v0.4.11

Published

ReviewCopilot - AI-powered code review assistant with customizable prompts

Readme

中文 | English


📋 目录


✨ 功能特性

🤖 AI 驱动审查

  • OpenAI GPT 模型支持
  • DeepSeek 集成
  • 自定义审查提示
  • 多提供商支持

📝 智能规则

  • 提交信息验证
  • 分支命名规范
  • 自定义审查点
  • 文件模式过滤

🔧 易于集成

  • GitHub Actions 就绪
  • GitLab CI(即将推出)
  • 基于环境的配置
  • 零配置设置

🎯 灵活安全

  • YAML 配置
  • 环境变量
  • Glob 模式过滤
  • 安全的 API 密钥管理

🚀 快速开始

2 分钟内快速启动 ReviewCopilot:

# 1. 安装
npm install -D review-copilot

# 2. 初始化
npx review-copilot init

# 3. 设置 API 密钥
echo "AI_API_KEY_DEEPSEEK=your-api-key" >> .env

# 4. 运行审查
npx review-copilot review

💡 提示: 推荐使用 DeepSeek,稳定性更好。OpenAI 支持为测试版。

🎯 你将获得:

  • ✅ 自动化代码质量分析
  • ✅ 安全漏洞检测
  • ✅ 性能优化建议
  • ✅ 最佳实践执行
  • ✅ 直接 PR 评论集成

💭 为什么选择 ReviewCopilot?

⏰ 节省时间

  • 代码变更即时反馈
  • 减少 60% 的手动审查时间
  • 专注架构,而非语法

🔧 易于设置

  • 零配置即可使用
  • 与现有 CI/CD 兼容
  • 支持多个 AI 提供商

📈 提升质量

  • 一致的审查标准
  • 早期发现问题
  • 从 AI 建议中学习

💰 成本效益

  • 减少高级开发者审查时间
  • DeepSeek:约 ¥0.007 每次请求
  • OpenAI:约 ¥0.07 每次请求

📦 安装

使用 npm

npm install -D review-copilot

使用 pnpm

pnpm add -D review-copilot

使用 yarn

yarn add -D review-copilot

⚙️ 配置

基础设置

运行 npx review-copilot init 后,你将获得一个 .review-copilot.yaml 文件:

providers:
  deepseek:
    enabled: true
    apiKey: ${AI_API_KEY_DEEPSEEK}
    model: deepseek-chat

rules:
  commitMessage:
    enabled: true
    pattern: '^(feat|fix|docs|style|refactor|test|chore|ci)(\\(.+\\))?: .{1,50}'
  
  branchName:
    enabled: true
    pattern: '^(feature|bugfix|hotfix|release)/[A-Z]+-[0-9]+-.+'
  
  codeChanges:
    enabled: true
    filePatterns:
      - '**/*.{ts,tsx,js,jsx}'
      - '!**/dist/**'
      - '!**/node_modules/**'

环境变量

在项目根目录创建 .env 文件:

# 选择你的 AI 提供商
AI_API_KEY_DEEPSEEK=your-deepseek-api-key
AI_API_KEY_OPENAI=your-openai-api-key

高级配置

providers:
  openai:
    enabled: false
    apiKey: ${AI_API_KEY_OPENAI}
    model: gpt-4o-mini
    baseURL: https://api.openai.com/v1
  
  deepseek:
    enabled: true
    apiKey: ${AI_API_KEY_DEEPSEEK}
    model: deepseek-chat
    baseURL: https://api.deepseek.com/v1

customReviewPoints:
  - name: '安全检查'
    prompt: '审查代码中的潜在安全漏洞,重点关注输入验证、身份认证和数据处理。'
  
  - name: '性能评审'
    prompt: '分析代码的性能瓶颈、内存使用和优化机会。'
  
  - name: '可访问性检查'
    prompt: '审查前端代码的可访问性合规性和最佳实践。'

rules:
  commitMessage:
    enabled: true
    pattern: '^(feat|fix|docs|style|refactor|test|chore|ci)(\\(.+\\))?: .{1,50}'
    prompt: '确保提交消息遵循 Conventional Commits 规范。'
  
  branchName:
    enabled: true
    pattern: '^(feature|bugfix|hotfix|release)/[A-Z]+-[0-9]+-.+'
    prompt: '检查分支名是否符合模式:<type>/<ticket-id>-<description>'
  
  codeChanges:
    enabled: true
    filePatterns:
      - '**/*.{ts,tsx,js,jsx,py,java,go,rs}'
      - '!**/test/**'
      - '!**/tests/**' 
      - '!**/*.test.*'
      - '!**/*.spec.*'
      - '!**/dist/**'
      - '!**/build/**'
      - '!**/node_modules/**'
      - '!**/coverage/**'
    prompt: '审查代码变更,重点关注代码质量、潜在错误、性能、安全性和最佳实践。'

🤖 AI 提供商

DeepSeek(推荐)

  • ✅ 稳定可靠
  • ✅ 性价比高
  • ✅ 良好的代码理解能力
  • 🔑 获取 API 密钥:DeepSeek 平台

OpenAI(测试版)

  • ⚠️ 测试版支持
  • ✅ 高质量审查
  • ⚠️ 成本较高
  • 🔑 获取 API 密钥:OpenAI 平台

🔧 使用方法

命令行

# 审查当前分支变更
npx review-copilot review

# 审查特定拉取请求
npx review-copilot review --pr 123

# 初始化配置
npx review-copilot init

# 显示帮助
npx review-copilot --help

文件过滤

使用 glob 模式控制要审查的文件:

filePatterns:
  # 包含模式
  - '**/*.{ts,tsx,js,jsx}'
  - '**/*.{py,java,go,rs}'
  
  # 排除模式
  - '!**/node_modules/**'
  - '!**/dist/**'
  - '!**/build/**'
  - '!**/*.test.*'
  - '!**/*.spec.*'

🏗️ CI/CD 集成

GitHub Actions

创建 .github/workflows/review.yml

name: Code Review

on:
  pull_request:
    types: [opened, synchronize]
  issue_comment:
    types: [created]

jobs:
  review:
    runs-on: ubuntu-latest
    if: github.event_name == 'pull_request' || contains(github.event.comment.body, '@review-copilot')
    
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      
      - uses: actions/setup-node@v4
        with:
          node-version: '18'
      
      - run: npm install -g review-copilot
      
      - name: Run Review
        env:
          AI_API_KEY_DEEPSEEK: ${{ secrets.AI_API_KEY_DEEPSEEK }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: review-copilot review

仓库密钥

将 API 密钥添加到 GitHub 仓库密钥:

  1. 前往 SettingsSecrets and variablesActions
  2. 点击 New repository secret
  3. 名称:AI_API_KEY_DEEPSEEK
  4. 值:你的 DeepSeek API 密钥

🔒 安全提示: 绝不要将 API 密钥直接提交到仓库中。始终使用 GitHub Secrets 或环境变量。


📚 示例

手动触发审查

在任何拉取请求中评论 @review-copilot 来触发手动审查:

提及审查

自动 PR 审查

ReviewCopilot 自动审查代码变更并发布详细反馈:

审查评论

完整设置说明请查看我们的示例目录


🖼️ 截图展示

审查评论示例

ReviewCopilot 审查示例

手动触发示例

ReviewCopilot 提及审查示例

真实示例

查看真实审查评论:ReviewCopilot PR 审查示例


🐛 故障排除

API 密钥问题

# 错误:未找到 API 密钥
# 解决方案:检查你的 .env 文件
echo "AI_API_KEY_DEEPSEEK=your-key" >> .env

GitHub Actions 权限

# 如需要,添加到你的工作流
permissions:
  contents: read
  pull-requests: write
  issues: write

文件模式问题

# 确保转义特殊字符
filePatterns:
  - '**/*.{ts,tsx}' # ✅ 正确
  - '**/*.{ts,tsx}' # ❌ 不带引号可能会有问题

常见错误消息

| 错误 | 解决方案 | |-------|----------| | No changes detected | 确保你在有变更的 git 仓库中 | | API key not found | 检查你的 .env 文件和环境变量 | | Rate limit exceeded | 稍等片刻重试,或升级你的 API 计划 | | File pattern error | 验证配置中的 glob 模式 |


🤝 贡献指南

我们欢迎贡献!以下是你可以帮助的方式:

开发设置

# 克隆仓库
git clone https://github.com/AlexShan2008/review-copilot.git
cd review-copilot

# 安装依赖
pnpm install

# 运行测试
pnpm test

# 构建项目
pnpm build

贡献方式

  • 🐛 报告错误 通过开启 issue
  • 建议功能 或改进
  • 📖 改进文档
  • 🔧 提交拉取请求
  • 🧪 添加测试用例

请阅读我们的贡献指南了解详细指导。


📊 项目状态

当前状态

  • GitHub 集成:完全支持
  • 🚧 GitLab 集成:开发中
  • DeepSeek 提供商:稳定
  • ⚠️ OpenAI 提供商:测试版(欢迎 PR!)

🌟 社区与支持

GitHub stars GitHub forks GitHub issues

📞 获取帮助


📄 许可证

本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。