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

@ohos-graphics/stability-code-review

v0.1.1

Published

OpenHarmony C/C++ stability code review skill library for opencode/Codex agents.

Readme

OpenHarmony Stability Code Review Skill Library

项目说明

C/C++ 稳定性代码审查框架,由 OpenHarmony图形稳定性团队 维护,可推广至 OH 各子系统及非 OH 部门使用。

包含 57 条稳定性规则,覆盖异常处理、并发稳定性、性能稳定性、资源管理、初始化顺序、边界条件、生命周期、内存稳定性、图形稳定性等 9 个稳定性分类。所有规则以 Markdown 文档形式存放于 references/ 目录。

安装

npm 安装(推荐)

# 一条命令安装或更新到 opencode skills 目录
npx -y @ohos-graphics/stability-code-review install --force

# 或者全局安装后再执行安装器
npm install -g @ohos-graphics/stability-code-review
ohos-stability-skill install --force

默认会安装到:

~/.config/opencode/skills/ohos-dev-graphics-stability-code-review/

如需覆盖已安装版本:

ohos-stability-skill install --force

如需安装到自定义 skills 目录:

ohos-stability-skill install --target /path/to/opencode/skills

手动安装

将本仓库放到 opencode skills 路径下:

# 全局(推荐,所有项目可用)
~/.config/opencode/skills/ohos-dev-graphics-stability-code-review/

# 项目级
<project>/.opencode/skills/ohos-dev-graphics-stability-code-review/

快速开始

然后在 opencode 对话中直接输入:

# 全量扫描(遍历所有规则)
稳定性全量扫描 ./rosen/
代码稳定性检视 ./src/

# 指定规则扫描(遍历指定的所有规则)
用 ExceptionHandling_001 规则检视 ./src/
用 ExceptionHandling_001,ExceptionHandling_002,ConcurrencyStability_001 规则检视 ./rosen/

# 按级别过滤扫描(遍历指定级别的所有规则)
对 ./rosen/ 做稳定性扫描,只检视 HIGH 级别的规则
对 ./src/ 进行稳定性扫描,检视 CRITICAL 和 HIGH 级别规则

# 指定分类扫描(遍历该分类下的所有规则)
对 ./src/ 做稳定性扫描,只检视异常处理分类的规则
用ConcurrencyStability和MemoryStability分类的规则检视 ./rosen/

报告自动输出到 ./report/ 目录,包含一个 Markdown 格式的详细说明文档和一个 CSV 格式的检出问题列表

项目结构

├── README.md                      # 项目说明(本文件)
├── SKILL.md                       # skill 技能说明
├── config/
│   ├── rules.yaml                 # 规则配置
│   └── whitelist.yaml             # 白名单配置
├── references/                    # 规则参考文档(核心)和报告输出格式示例
│   ├── RULE_INDEX.md              # 规则总索引
│   ├── RULE_DEVELOPMENT_GUIDE.md  # 规则开发完整指南
│   ├── RULE_TEMPLATE.md           # 规则文档模板
│   ├── PROBLEM_TEMPLATE.md        # 检出问题格式模板
│   ├── REPORT_TEMPLATE.md         # 报告输出格式模板(Markdown格式)
│   ├── REPORT_TEMPLATE.csv        # 报告输出格式模板(CSV格式)
│   ├── ExceptionHandling/         # 异常处理 规则目录(3条)
│   ├── ConcurrencyStability/      # 并发稳定性 规则目录(5条)
│   ├── PerformanceStability/      # 性能稳定性 规则目录(2条)
│   ├── ResourceManagement/        # 资源管理 规则目录(7条)
│   ├── InitializationOrder/       # 初始化顺序 规则目录(1条)
│   ├── BoundaryCondition/         # 边界条件 规则目录(18条)
│   ├── Lifecycle/                 # 生命周期 规则目录(2条)
│   ├── MemoryStability/           # 内存稳定性 规则目录(7条)
│   └── GraphicsStability/         # 图形稳定性 规则目录(12条)
└── scripts/
    └── add-rule.py                # 规则脚手架工具

核心特性

  • 57条稳定性规则:覆盖9个稳定性分类
    • 异常处理:3条(ExceptionHandling_001~003)
    • 并发稳定性:5条(ConcurrencyStability_001~005)
    • 性能稳定性:2条(PerformanceStability_001~002)
    • 资源管理:7条(ResourceManagement_001~007)
    • 初始化顺序:1条(InitializationOrder_001)
    • 边界条件:18条(BoundaryCondition_001~018)
    • 生命周期:2条(Lifecycle_001~002)
    • 内存稳定性:7条(MemoryStability_001~007)
    • 图形稳定性:12条(GraphicsStability_001~012)
  • 四级严重程度:CRITICAL(12条)/ HIGH(36条)/ MEDIUM(9条)/ LOW(0条)
    • CRITICAL:空指针解引用、use-after-free、double-free、内存越界等极高风险
    • HIGH:内存泄漏、资源泄漏、线程安全、并发死锁等高风险
    • MEDIUM:编码规范、类型转换、JSON处理等中等风险
    • LOW:编码风格、优化建议等低风险
  • 可覆盖模块:ArkUI、ArkWeb、内核、图形、音频、窗口、语言运行时、相机、图库、框架等 OH 核心模块
  • 部门可扩展:各部门可按业务特点添加专属规则
  • 跨平台支持:适用于 OpenHarmony 及通用 C/C++ 项目

文档索引

工作流程

  1. 规则加载:根据请求加载 config/rules.yaml 中启用的规则,读取对应的 references/ 规则文档
  2. 代码检视:AI 模型根据规则文档中的检测要点、检测范围对代码进行检视
  3. 误报过滤:参考规则文档中的误报排除表格,跳过测试代码、白名单路径
  4. 问题分析:输出完整的问题描述、风险流分析(RiskFlow)、影响分析(ImpactAnalysis)、修复建议
  5. 报告输出:生成 Markdown 报告和 CSV 报告到 ./report/

发布到 npm

发布前先检查包内容并运行测试:

npm test
npm pack --dry-run

首次发布公开 scoped package:

npm login
npm publish --access public

后续发布需要先更新 package.json 中的 version,再执行 npm publish

贡献者

  • 维护团队:OpenHarmony图形稳定性团队
  • 贡献方式:欢迎各 OH 子系统部门及外部开发者贡献规则,共建稳定性生态
  • 联系方式:如有问题或建议,欢迎提交 Issue 或 PR