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

job51-gitlab-cr-node-jt-1

v3.1.4

Published

GitLab merge request code review tool with AI-powered analysis and project context support

Readme

GitLab Code Review AI Tool

一个使用 AI 自动审查 GitLab 合并请求的工具,基于 Claude AI 进行代码分析。

安装

通过 npm 全局安装:

npm install -g gitlab-cr-node

使用方法

1. 环境变量配置

在使用前需要设置以下环境变量:

export CI_API_V4_URL="https://your-gitlab-instance.com/api/v4"
export GITLAB_ACCESS_TOKEN="your_gitlab_access_token"
export CI_PROJECT_ID="your_project_id"
export CI_MERGE_REQUEST_IID="your_merge_request_iid"

或者在 Windows PowerShell 中:

$env:CI_API_V4_URL="https://your-gitlab-instance.com/api/v4"
$env:GITLAB_ACCESS_TOKEN="your_gitlab_access_token"
$env:CI_PROJECT_ID="your_project_id"
$env:CI_MERGE_REQUEST_IID="your_merge_request_iid"

2. 运行代码审查

设置好环境变量后,运行:

gitlab-cr

功能特性

  • 自动获取 GitLab 合并请求的代码变更
  • 使用 Claude AI 进行代码审查
  • 生成结构化的审查报告
  • 将审查结果发布到 GitLab MR
  • 分阶段审查:快速扫描过滤低价值变更,减少 token 消耗
  • 自动跳过测试文件(如 *Test.java*.test.js 等)
  • 自动跳过 DTO/VO/Query 文件(如 *Dto.java*VO.java*Query.java*Request.java 等)
  • 自动跳过非代码文件(如配置文件、文档文件、资源文件等)

Token 优化

快速扫描机制

在调用 AI 完整审查前,会先进行本地快速扫描,过滤以下低价值变更:

| 跳过类型 | 示例 | |---------|------| | 纯 import 变更 | import java.util.List; | | 纯注释变更 | // 注释内容/* 多行注释 */ | | 纯空白/格式变更 | 空行、缩进调整 | | 纯注解变更 | @Override@Autowired | | 纯 getter/setter | getXxx()setXxx() | | 纯日志打印 | log.info()console.log() | | 纯常量定义 | private static final String XXX = "xxx"; |

预计效果:减少 30-50% 的 AI 调用,显著降低 token 消耗。

依赖要求

  • Node.js 10+
  • Claude CLI 工具
  • GitLab 访问令牌

自定义审查规则

使用方法

接入团队可以在项目中自定义代码审查规则,覆盖默认规则。

  1. 创建配置目录

    mkdir -p .cr-config/rules
  2. 创建自定义规则文件

    touch .cr-config/rules/code-review-rules.md
  3. 编辑规则文件

    • 参考 npm 包中的默认规则内容
    • 或使用 .cr-config-templates/rules/code-review-rules.md 模板示例

规则生效机制

  • 项目规则文件存在时,完全覆盖默认规则
  • 规则文件不存在时,使用 npm 包内置的默认规则
  • 规则变更后,重新运行 CI Pipeline 即可生效

规则编写建议

  1. 保留核心强制规则:文件路径、审查范围、已安全处理等基础规则建议保留
  2. 添加团队特定规则:团队特有的编码规范、框架使用约定等
  3. 保持格式一致:使用相同的 Markdown 格式和引用块语法

示例:自定义规则结构

# 代码审查规则

**核心原则:高准确率、低误报、深度上下文分析**

**⚠️ 最高优先级强制规则**:

0. **文件路径必须保持原样**:
   > - LINE_INFO 中的路径必须与 diff 块实际路径完全一致

1. **已安全处理代码禁止报告**:
   > - 如果代码已正确处理潜在风险,则禁止报告该问题

... (团队自定义规则内容)

许可证

MIT