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

@woodpeck/cli

v0.1.1

Published

基于 Git diff 的代码审查工具 - 发现代码中的潜在问题

Readme

Woodpeck 🐦 / Wood 啄木鸟

基于 Git diff 的智能代码审查 CLI 工具,使用 Rust 编写。

✨ 特性

  • 🔴 严重级别: unwrap()、unsafe 代码块、硬编码密钥等
  • 🟡 中等级别: TODO/FIXME、未使用变量、资源泄露等
  • 🟢 初级别: 魔法数字、长函数、代码风格等
  • 📊 多格式输出: Table/JSON/Markdown/SARIF
  • 🔧 CI/CD 集成: 支持失败阈值控制

📦 安装

方式 1: 直接下载二进制文件

macOS

# Intel
 curl -L -o wood.tar.gz https://github.com/yourusername/woodpeck/releases/latest/download/wood-macos-x64.tar.gz
tar xzf wood.tar.gz
sudo mv wood /usr/local/bin/

# Apple Silicon
curl -L -o wood.tar.gz https://github.com/yourusername/woodpeck/releases/latest/download/wood-macos-arm64.tar.gz
tar xzf wood.tar.gz
sudo mv wood /usr/local/bin/

Linux

curl -L -o wood.tar.gz https://github.com/yourusername/woodpeck/releases/latest/download/wood-linux-x64.tar.gz
tar xzf wood.tar.gz
sudo mv wood /usr/local/bin/

Windows

下载 wood-windows-x64.exe 并重命名为 wood.exe,添加到 PATH。

方式 2: 通过 npm 安装

npm install -g @woodpeck/cli

方式 3: 从源码编译

git clone https://github.com/yourusername/woodpeck.git
cd woodpeck
cargo build --release
sudo cp target/release/woodpeck /usr/local/bin/wood

🚀 使用

查看帮助

wood -h
wood compare -h

基础分析

# 对比两个分支
wood compare main feature-branch

# 指定仓库路径
wood compare main feature-branch --path=/path/to/repo

# 只显示严重问题
wood compare main feature-branch --severity=high

输出格式

# JSON 格式
wood compare main feature-branch --format=json

# Markdown 格式(适合 PR 描述)
wood compare main feature-branch --format=markdown

# 导出到文件
wood compare main feature-branch --output=report.md

CI/CD 集成

# 如果有严重问题则 CI 失败
wood compare main feature-branch --fail-on=high:0

# 允许最多 5 个中等问题
wood compare main feature-branch --fail-on=medium:5

📊 输出示例

Woodpeck Analysis Report
main → feature/test

+-----------+---------+------+---------------------+----------------------------------+
| Severity  | File    | Line | Rule                | Description                      |
+=======================================================================================+
| 🔴 High   | main.rs | 3    | RUST_UNWRAP_IN_PROD | Using unwrap() can cause panics  |
|-----------+---------+------+---------------------+----------------------------------|
| 🟡 Medium | main.rs | 10   | RUST_TODO           | TODO comment found               |
|-----------+---------+------+---------------------+----------------------------------|
| 🟢 Low    | main.rs | 13   | RUST_MAGIC_NUMBER   | Unnamed numeric constant         |
+-----------+---------+------+---------------------+----------------------------------+

Summary:
  Total files: 1
  Total issues: 3
    🔴 High: 1
    🟡 Medium: 1
    🟢 Low: 1

⚙️ 配置

创建 woodpeck.toml 配置文件:

# 默认只显示严重和中等问题
default_severity = "medium"

# 默认 JSON 格式
default_format = "json"

[output]
color = "auto"
show_summary = true

[rules.overrides.RUST_UNWRAP_IN_PROD]
enabled = true
severity = "high"

🔌 GitHub Actions 集成

name: Code Review

on: [pull_request]

jobs:
  woodpeck:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Download Woodpeck
        run: |
          curl -L -o wood.tar.gz https://github.com/yourusername/woodpeck/releases/latest/download/wood-linux-x64.tar.gz
          tar xzf wood.tar.gz
          chmod +x wood
          sudo mv wood /usr/local/bin/

      - name: Run Woodpeck
        run: wood compare origin/main HEAD --fail-on=high:0

🛠️ 开发

构建

cargo build --release

测试

cargo test

运行

cargo run -- compare main feature-branch

📋 支持的规则

| 规则 ID | 级别 | 描述 | |---------|------|------| | RUST_UNWRAP_IN_PROD | 🔴 High | 生产代码中使用 unwrap() | | RUST_UNSAFE_BLOCK | 🔴 High | unsafe 代码块 | | JS_DANGEROUS_EVAL | 🔴 High | 使用 eval() | | RUST_TODO | 🟡 Medium | TODO/FIXME/XXX 注释 | | RUST_UNUSED_VARIABLE | 🟡 Medium | 未使用的变量 | | RUST_MAGIC_NUMBER | 🟢 Low | 魔法数字 | | RUST_LONG_FUNCTION | 🟢 Low | 过长的函数 |

📄 许可证

MIT

🤝 贡献

欢迎提交 Issue 和 PR!

🙏 鸣谢