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

ai-coding-utils

v0.1.2

Published

AI 编码工具集 — 分析 git 分支的 AI/Human 代码贡献比例

Readme

ai-coding-utils

分析 Git 分支主线中 AI 与人工代码贡献比例的 CLI 工具。通过识别 commit message 中的 Co-Authored-By 标记,按开发者统计 AI 生成代码与手写代码的行数占比。

使用

npx ai-coding-utils commit-stats [branch] [base]

参数:

  • [branch] — 目标分支(默认当前分支)
  • [base] — 基准分支(默认自动检测 main/master)

选项:

  • -d, --dir <path> — 指定 Git 仓库路径
  • --from <ref> — 指定范围起点(commit/tag/branch),跳过自动分叉点检测
  • --debug-author <name> — 调试指定开发者的每条 commit 判定明细

示例:

# 分析当前分支相对于 main 的代码贡献
npx ai-coding-utils commit-stats

# 分析指定分支
npx ai-coding-utils commit-stats feature/login

# 指定基准分支
npx ai-coding-utils commit-stats feature/login develop

# 在指定 feature 分支上调试某个开发者的 commit 判定过程
npx ai-coding-utils commit-stats feature/login --debug-author Philoveritas

AI 识别规则

通过检测 commit message 中是否包含 Co-Authored-By:.*noreply 来判断该 commit 是否为 AI 辅助生成。例如:

Co-Authored-By: Claude Opus 4.6 <[email protected]>

调试模式下会按 commit 打印完整 message、改动行数、匹配规则、命中证据和最终判定结果,便于核对识别是否符合预期。

统计口径

commit-stats 默认按目标分支的 first-parent 主线统计,并排除 merge commits。

  • 合并进来的 main 或其他旁支提交不会计入 AI/Human 行数占比
  • merge commit 自身也不会参与统计,避免把集成代码误算成主线开发代码
  • 统计目标是“这个分支主线开发出来的代码”,不是“这个范围内所有可达 commit”

输出示例

按开发者输出彩色表格,包含:

  • 每位开发者的 AI 生成行数与手写行数
  • AI/人工代码占比
  • 总 commit 数与总行数汇总

开发

# 监听模式
pnpm dev

# 构建
pnpm build

技术栈

环境要求

  • Node.js >= 18
  • Git