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

opencode-git-check

v0.1.2

Published

OpenCode 插件:一键检查暂存区代码质量并创建规范化 git commit

Downloads

54

Readme

opencode-git-check

OpenCode 插件 — 一键扫描、分类、审查并提交代码

支持中文 / 英文提交信息 | AI 代码审查 | Conventional Commits 规范 | 仅本地提交

npm version license


安装

~/.config/opencode/opencode.jsoncplugin 数组中添加:

"plugin": [
  "opencode-git-check"
]

重启 OpenCode 即可使用。


命令

| 命令 | 说明 | | ------------ | ------------------------------------------- | | /commit | 一键提交(中文提交信息,不推送到远程) | | /commit:en | One-click commit (English message, no push) | | /gitignore | 分析项目结构,智能生成 / 更新 .gitignore |


工作流程

执行 /commit 后,插件将自动完成以下步骤:

扫描工作目录 --> 分析与分类 --> 暂存文件 --> 预提交检查 --> 代码审查 --> 提交
  1. 扫描工作目录 — 检测所有变更(已暂存、未暂存、未追踪),按文件类型自动分类
  2. 分析与分类 — AI 审查各分类文件,识别不应提交的构建产物或临时文件
  3. 暂存文件 — 自动 git add 全部或指定文件
  4. 预提交检查 — 检测代码质量问题,发现错误时中止提交并报告
  5. 代码审查 — AI 逐文件审查 diff,检查逻辑正确性、潜在 Bug、代码质量、性能隐患和兼容性
  6. 生成提交信息 — 基于 diff 内容生成 Conventional Commits 格式的提交信息并执行提交

所有操作仅在本地执行,不会推送到远程仓库。


注册工具

插件注册了以下工具供 AI 在对话中调用:

| 工具 | 说明 | | ------------------ | --------------------------------------------------- | | git_scan | 扫描工作目录的所有变更,按文件类型自动分类 | | git_stage | 暂存文件到 git 暂存区,支持全部暂存或指定文件列表 | | pre_commit_check | 检查暂存区代码质量(敏感信息、调试语句、冲突标记等)| | git_commit | 使用指定的提交信息执行 git commit(仅本地,不推送) | | gitignore_scan | 扫描项目结构,检测应忽略的文件和目录 | | gitignore_write | 将指定内容写入 .gitignore 文件 |


预提交检查项

错误(阻止提交)

| 检查项 | 说明 | | -------- | ------------------------------------------------------------ | | 冲突标记 | 检测 <<<<<<<=======>>>>>>> 等未解决的合并冲突 | | 调试语句 | 检测 console.logprintdebugger 等 10 种语言的调试代码 | | 敏感信息 | 检测硬编码的密码、API Key、AWS Key、PEM 私钥 |

警告(允许提交,但会提示)

| 检查项 | 说明 | | --------- | --------------------------------- | | TODO 标记 | 检测 TODO / FIXME / HACK 注释 | | 大文件 | 检测超过 1MB 的文件 | | 项目 lint | 运行项目已有的 lint 脚本(如有) |


代码审查

预提交检查通过后,AI 将基于 diff 内容逐文件进行代码审查:

| 审查维度 | 关注内容 | | ---------- | -------------------------------------------------- | | 逻辑正确性 | 逻辑错误、边界条件遗漏、空指针 / 未定义引用 | | 潜在 Bug | 竞态条件、资源泄漏、异常处理缺失、类型不匹配 | | 代码质量 | 重复代码、过长函数、命名不清晰、魔法数字 | | 性能隐患 | 不必要的循环、N+1 查询、内存分配过大 | | 兼容性 | 破坏性变更未注明、API 接口变动 |

审查结果处理

  • 发现严重问题 — 中止提交,列出问题及修复建议
  • 发现改进建议 — 列出建议,继续提交流程
  • 代码质量良好 — 确认审查通过,进入提交步骤

智能 .gitignore 生成

执行 /gitignore 后,插件自动分析项目并生成合适的忽略规则:

扫描项目结构 --> AI 分析建议 --> 确认后写入 .gitignore

自动检测以下类别:

| 类别 | 检测内容 | | -------- | -------------------------------------------------------------- | | 依赖 | node_modules/vendor/.bundle/ 等包管理器依赖目录 | | 构建产物 | dist/build/target/.next/.nuxt/.turbo/ 等 | | 编辑器 | .idea/.vscode/、Sublime Text、Vim 临时文件等 | | 操作系统 | .DS_StoreThumbs.dbdesktop.ini | | AI 工具 | .sisyphus/.cursor/.claude/.aider*.copilot/ | | 运行时 | __pycache__/.venv/.terraform/ 等 | | 测试 | coverage/.nyc_output/ 等覆盖率报告目录 | | 其他 | .env 环境变量、*.log 日志文件、*.tgz 压缩包等 |

支持的语言 / 框架:Node.js、Python、Rust、Go、Java、Kotlin、PHP、Ruby、Swift、TypeScript。


文件分类

扫描时自动识别 8 种文件类型:

| 类型 | 示例 | | -------- | --------------------------------------- | | source | .ts .js .py .go .rs .java | | config | package.json tsconfig.json .env | | docs | .md .txt .rst | | test | .spec.ts .test.js __tests__/ | | style | .css .scss .less | | asset | .png .jpg .svg .woff | | build | dist/ build/ .o .pyc | | other | 不属于以上分类的文件 |


开发

# 安装依赖
npm install

# 编译
npm run build

# 监听模式
npm run dev

# 本地安装到 OpenCode(调试用)
cd ~/.config/opencode && npm install /path/to/opencode-git-check

License

MIT