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

@cloudglab/gerrit-cli

v0.0.6

Published

Gerrit CLI and SDK - A modern CLI tool and TypeScript SDK for Gerrit Code Review, built with Effect-TS

Readme

@cloudglab/gerrit-cli

gerrit-cli hero

让 Gerrit 代码审查流程进入命令行。支持查看变更、提交评论、管理审查、检查 CI 构建状态,以及直接面向 LLM 和自动化脚本输出结构化数据。

安装

npm install -g @cloudglab/gerrit-cli

安装完成后会打印 ASCII banner 和快速开始指引。

升级

npm update -g @cloudglab/gerrit-cli

# 或走 CLI 更新入口
gerrit update

卸载

# 先看预览
gerrit uninstall

# 确认执行
gerrit uninstall --confirm

命令速查页

项目提供 GitHub Pages 速查页,适合复制安装、角色入口、审查链路、CI 命令和发布前 smoke:

https://cloudglab.github.io/gerrit-cli/

页面源码位于 docs/index.html,由 GitHub Pages workflow 自动部署;npm 包不包含 docs/,只保留 CLI 入口、源码、发布脚本、README 和 CHANGELOG。

快速开始

# 初始化配置(交互式引导输入 Gerrit 地址、用户名、密码)
gerrit-cli setup

# 验证连接
gerrit-cli status

角色入口

| 入口 | 适用场景 | 核心命令 | |------|----------|----------| | gerrit-dev | 提交变更、查看状态 | push, mine, show, rebase, checkout | | gerrit-reviewer | 代码审查、投票 | incoming, diff, comments, comment, vote | | gerrit-ci | 构建检查、脚本集成 | build-status --watch, extract-url, --json, --xml | | gerrit-lead | 分配审查、组管理 | add-reviewer, groups, groups-members, team |

这些入口与 gerrit-cli 使用同一套权限和命令,只是给不同角色提供更清晰的安装后入口。

日常场景

提交变更

git commit -m "feat: add login page"
gerrit-cli push -t my-feature -r [email protected]

审查代码

# 查看待审查列表
gerrit-cli incoming

# 查看变更详情
gerrit-cli show 12345

# 查看 diff
gerrit-cli diff 12345

# 查看已有评论
gerrit-cli comments 12345

# 发布评论
gerrit-cli comment 12345 -m "LGTM, just one nit"

# 投票
gerrit-cli vote 12345 --code-review 2 -m "Approved"

等待 CI 构建

# 轮询直到构建完成,失败时非零退出
gerrit-cli build-status --watch --exit-status && deploy.sh

# 提取构建链接
gerrit-cli extract-url "jenkins.inst-ci.net" | tail -1

管理工作区

# 检出变更到本地测试
gerrit-cli checkout 12345

# 工作树隔离环境
gerrit-cli workspace create 12345

批量操作(管线)

# 批量发布行评论(JSON 数组 stdin)
echo '[{"file":"src/app.ts","line":42,"message":"Use const"}]' \
  | gerrit-cli comment 12345 --batch

# 批量添加审查人
gerrit-cli add-reviewer [email protected] [email protected] -c 12345

环境变量

export GERRIT_HOST="https://gerrit.example.com"
export GERRIT_USERNAME="your-username"
export GERRIT_PASSWORD="your-http-password"

配置优先级:命令行参数 > 环境变量 > ~/.gerrit-cli/config.json

输出格式

大多数命令支持三种输出:

| 格式 | 标志 | 适用场景 | |------|------|----------| | 纯文本 | 默认 | 人类阅读 | | JSON | --json | 脚本解析、jq 管道 | | XML | --xml | LLM 消费(CDATA 包裹) |

Skill / Agent 用法

本仓库包含 skills/gerrit-workflow 技能包,适合 AI Agent 和 IDE 插件使用。

安装 Skill

# 通过 Claude Code 插件系统安装
/plugin marketplace add cloudglab/gerrit-cli
/plugin install gerrit-workflow@gerrit-cli

自然语言示例

安装 Skill 后可直接用自然语言请求:

  • “查看我的待审查变更”
  • “审查 12345 这个 change”
  • “拉出 diff 并贴出建议评论”
  • “帮我 watch 当前分支的 CI 构建”

Skill 包结构

skills/gerrit-workflow/
├── SKILL.md         # 主指令
├── reference.md     # 完整命令索引
└── examples.md      # 真实场景示例

LLM 集成

# AI 审查当前变更
gerrit-cli diff 12345 | llm "Review this code"

# AI 生成评论并发布
llm "Review change 12345" | gerrit-cli comment 12345

# 完整变更分析
gerrit-cli show 12345 | llm "Summarize this change and review status"

发布前 smoke

# 默认只检查命令 help 面,适合 release 前无凭证环境
bun run release:smoke-query

# 如需真实 Gerrit 查询,先配置 GERRIT_*,再打开 live 模式
bun run release:smoke-query:live

live 模式默认只做只读查询,可用下面变量覆盖样本:

export GERRIT_SMOKE_CHANGE_ID="12345"
export GERRIT_SMOKE_QUERY="status:open"
export GERRIT_SMOKE_BUILD_KEYWORD="jenkins"

如果当前机器没有全局 CLI,也可以在仓库内直接运行脚本做发布前 smoke:

bun run release:smoke-query

License

MIT