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

@newstarzj/cann-review

v3.3.2

Published

CANN 代码审查技能 - 自动分析 PR 代码变更,检查内存泄漏、安全漏洞和可读性

Downloads

340

Readme

CANN Code Review Skill 🔍

npm version License: MIT

🤖 自动化代码审查技能 - 专为 CANN 项目设计

自动分析 GitCode PR 代码变更,检查内存泄漏、安全漏洞和可读性,生成结构化报告并发布评论。

✨ 核心功能

  • 🚀 自动分析代码变更 - 使用 GitCode API 获取 PR 信息
  • 🔍 全面质量检查 - 内存泄漏、安全漏洞、代码可读性
  • 📊 结构化报告 - 清晰展示问题和改进建议
  • 💬 自动发布评论 - 直接发布到 GitCode PR
  • 智能 LGTM - 中低风险自动打上 /lgtm 标记

📦 安装

方式 1: npx 直接使用(推荐)

无需安装,直接运行:

npx @newstarzj/cann-review

方式 2: 全局安装

npm install -g @newstarzj/cann-review
cann-review

方式 3: 在 OpenCode 中使用

将此技能复制到 OpenCode 的 skills 目录:

# OpenCode 默认路径
cp -r ./ ~/.opencode/skills/cann-review/

🚀 快速开始

1. 配置 GitCode API Token

# 获取 Token: https://gitcode.com/setting/token-classic
export GITCODE_API_TOKEN=your_token_here

2. 使用技能

在 OpenCode 中:

审查这个 PR: https://gitcode.com/cann/runtime/merge_requests/628

或通过命令行:

npx @newstarzj/cann-review "https://gitcode.com/cann/runtime/merge_requests/628"

📖 使用示例

基本用法

审查这个 PR: https://gitcode.com/cann/runtime/merge_requests/628

仅检查安全问题

审查这个 PR: https://gitcode.com/cann/runtime/merge_requests/628
只检查安全漏洞

禁用自动 LGTM

审查这个 PR: https://gitcode.com/cann/runtime/merge_requests/628
不要自动打 lgtm

🎯 审查报告示例

## 🤖 CANN 代码审查报告

**PR**: #628 - Fix memory leak in buffer allocation
**严重性**: ✅ Low
**审查时间**: 2026-03-12 21:30

---

### 📊 审查结论

**✅ 建议合入**

- **严重性**: Low
- **代码质量**: 良好
- **内存安全**: ✅ 无风险
- **安全性**: ✅ 无漏洞

代码质量良好,修复了内存泄漏问题,建议合入。

---

### 🔍 详细检查

#### 1. 内存安全 ✅
- **内存泄漏**: 已修复
- **指针操作**: 安全
- **资源管理**: RAII 模式

#### 2. 安全性 ✅
- **边界检查**: 完整
- **输入验证**: 完整
- **潜在漏洞**: 无

#### 3. 可读性 ✅
- **代码清晰度**: 良好
- **命名规范**: 符合
- **注释完整性**: 部分

---

### 💡 改进建议

1. **文档**: 为新增的内存管理类添加详细注释
2. **测试**: 增加边界条件的单元测试

---

### ✅ 代码亮点

- 使用 RAII 管理资源,避免内存泄漏
- 错误处理完整,异常路径安全
- 代码结构清晰,易于维护

---

**总体评价**: 高质量的内存管理修复,建议合入。

⚙️ 配置选项

| 选项 | 说明 | 默认值 | |------|------|--------| | pr_url | PR 页面链接(必需) | - | | focus_areas | 审查重点 (memory/security/readability/all) | all | | auto_lgtm | 中低风险自动 LGTM | true |

🔧 高级配置

创建配置文件 ~/.cann-review/config

# GitCode API Token
GITCODE_API_TOKEN=your_token_here

# 审查超时时间(秒)
REVIEW_TIMEOUT=300

# 最大文件数
MAX_FILES=100

📋 审查标准

严重程度判定

| 等级 | 条件 | 是否合入 | LGTM | |------|------|---------|------| | ✅ Low | 仅有建议性改进 | 可以 | 自动 | | ⚠️ Medium | 有一般性问题 | 建议修改后 | 自动 | | ❌ High | 有严重问题 | 需要修改 | 不发布 | | 🔴 Critical | 有安全漏洞或严重内存问题 | 需要修改 | 不发布 |

检查项

内存安全

  • 动态内存分配/释放配对
  • 异常路径资源释放
  • RAII 模式使用
  • 容器内存管理

安全性

  • 空指针检查
  • 数组边界检查
  • 安全函数使用
  • 整数溢出检查

可读性

  • 命名清晰度
  • 注释完整性
  • 代码结构
  • 风格一致性

🛠️ 开发

# 克隆仓库
git clone https://gitcode.com/your-repo/cann-review.git

# 安装依赖
npm install

# 测试
npm test

# 发布
npm publish

📄 License

MIT License - 详见 LICENSE 文件

🤝 贡献

欢迎提交 Issue 和 Pull Request!

📮 联系方式


Made with ❤️ by OpenClaw Team