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

@sunshine_bit/code-review

v1.0.3

Published

GitLab MR 代码审查 CLI 工具

Readme

@sunshine_bit/code-review

GitLab MR 代码审查 CLI 工具。自动拉取 MR diff,调用 AI 进行代码审查,生成可读性高的审查报告。

功能

  • 通过 MR URL 自动拉取 GitLab 的代码改动
  • 调用 AI(火山引擎 Coding Plan)进行代码审查
  • 支持三种输出方式:
    • Markdown 报告 — 保存到 output/ 目录
    • HTML 报告 — 带样式的网页报告
    • GitLab 评论 — 直接评论到 MR 中

快速开始

1. 安装依赖

npm install

2. 配置环境变量

复制配置模板并填写:

cp .env.example .env

编辑 .env

# GitLab 配置
GITLAB_HOST=http://gitlab.beisencorp.com
GITLAB_TOKEN=你的_GitLab_Personal_Access_Token

# AI 配置(火山引擎 Coding Plan)
AI_PROVIDER=volcengine
AI_API_KEY=你的_火山引擎_API_Key
AI_MODEL=deepseek-v4-flash

GitLab Token:Settings → Access Tokens → 新建,勾选 read_api 权限

火山引擎 API Key:在火山引擎控制台获取,需先订阅 Coding Plan

3. 编译

npm run build

4. 全局链接(可选,方便在任意目录使用)

npm link

链接后即可直接使用 code-review 命令:

code-review review "你的MR地址"

5. 运行审查

npx @sunshine_bit/code-review@latest review "你的MR地址"

或者使用本地路径:

node dist/cli/index.js review "你的MR地址"

示例:

npx @sunshine_bit/code-review@latest review "http://gitlab.beisencorp.com/ux-tms-ui/ux-pc-ai-monorepo/-/merge_requests/179/diffs"

使用说明

命令选项

code-review review <mr-url> [options]

| 选项 | 说明 | |------|------| | <mr-url> | GitLab MR 的完整 URL(必填) | | -o, --output <format> | 输出格式:markdown(默认)、htmlgitlab-comment | | -f, --file <path> | 自定义输出文件路径(可选,默认自动生成) |

输出示例

Markdown 报告(默认):

code-review review "你的MR地址"
# 报告已写入: output/项目名-MR序号-作者.md

HTML 报告

code-review review "你的MR地址" --output html
# 报告已写入: output/项目名-MR序号-作者.html

评论到 GitLab MR

code-review review "你的MR地址" --output gitlab-comment

输出文件

报告默认保存到 output/ 目录,命名规则:

{项目名}-{MR序号}-{作者}.md

例如:ux-pc-ai-monorepo-[number]-[name].md

目录结构

@sunshine_bit/code-review/
├── src/
│   ├── cli/            # CLI 入口 & 命令
│   │   └── index.ts
│   ├── gitlab/         # GitLab API 封装
│   │   └── client.ts
│   ├── review/         # AI 审查引擎
│   │   ├── engine.ts
│   │   └── prompt.ts
│   ├── output/         # 输出渲染
│   │   ├── markdown.ts
│   │   ├── html.ts
│   │   └── gitlab-comment.ts
│   ├── config/         # 配置管理
│   │   └── index.ts
│   └── types/          # 公共类型
│       └── index.ts
├── output/             # 审查报告输出目录
├── package.json
├── tsconfig.json
└── .env.example

技术栈

| 组件 | 技术 | |------|------| | 语言 | TypeScript | | CLI 框架 | commander | | GitLab API | @gitbeaker/rest | | AI API | 火山引擎 Coding Plan(兼容 OpenAI 协议) |