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

@ttawdtt/codepulse

v1.0.0

Published

Developer coding habits analyzer and visualization dashboard

Readme

CodePulse

开发者编程习惯分析器和可视化仪表板。追踪你的 Git 提交历史,发现你最高效的工作时间,并可视化你的编程旅程。

English | 中文

功能特点

核心功能

  • Git 仓库扫描: 自动扫描和分析目录中的所有 Git 仓库
  • 贡献热力图: GitHub 风格的贡献日历,展示你的编程活动
  • 时间分布分析: 发现你最高效的工作时间和日期
  • 语言统计: 追踪你最常用的编程语言
  • 项目排名: 查看你贡献最多的项目
  • 连续天数追踪: 监控你当前和最长的编程连续天数
  • 精美报告: 生成可分享的 HTML 或 JSON 报告
  • 隐私优先: 所有数据存储在本地,不会上传任何信息

高级分析

  • 代码速度: 每次提交的代码行数、每日提交数、速度趋势
  • 工作会话: 自动检测编程会话、持续时间、专注时间
  • 代码变更率: 变更率、热点文件、重构检测
  • 提交质量: 质量评分 0-100、规范化提交百分比、消息分析
  • 深度工作: 总深度工作时间、心流状态提交、专注时间日历
  • 目标与进度: 每日/每周/每月目标、连续天数追踪、一致性评分

个人资料页面

  • 作者档案: 查看单个开发者的完整统计信息
  • 仓库档案: 查看单个仓库的完整分析
  • 成就系统: 解锁编程里程碑成就
  • 健康评分: 仓库健康状态指标

GitHub 集成

  • OAuth 认证: 使用设备流程安全登录
  • 远程仓库扫描: 扫描和分析 GitHub 上的仓库

安装

# 克隆或下载项目
cd codepulse

# 安装依赖
npm install

# 构建项目
npm run build

# 全局链接(可选)
npm link

CLI 命令

CodePulse 提供 30 个强大的命令 来分析和可视化你的编程习惯。

基础命令

codepulse scan <directories...>

扫描目录中的 Git 仓库并分析提交历史。

codepulse scan ~/projects              # 扫描目录
codepulse scan .                        # 扫描当前目录
codepulse scan ~/projects --depth 3    # 限制扫描深度
codepulse scan ~/projects --author "[email protected]"  # 按作者过滤

codepulse stats

在终端显示编程统计摘要。

codepulse stats                        # 显示整体统计
codepulse stats --author "email"       # 特定作者的统计
codepulse stats --compare-authors "email1,email2"  # 比较作者

codepulse dashboard

启动基于 Web 的可视化仪表板。

codepulse dashboard                    # 在默认端口启动 (3456)
codepulse dashboard --port 8080        # 在自定义端口启动
codepulse dashboard --no-open          # 不自动打开浏览器

codepulse report

生成可分享的报告。

codepulse report                       # 当前年份的文本报告
codepulse report --year 2024 --format html  # HTML 报告
codepulse report --output report.html --format html  # 保存到文件

分析命令

codepulse profile [email]

查看详细的开发者档案,包含全面的统计信息。

codepulse profile                      # 列出所有贡献者
codepulse profile [email protected]       # 查看特定档案
codepulse profile [email protected] --json  # JSON 格式输出

显示:提交数、代码行数、仓库数、生产力评分、连续天数、活动模式、语言、提交大小、最近提交。

codepulse repo <name>

单个仓库的深度分析。

codepulse repo my-project              # 分析仓库
codepulse repo my-project --json       # JSON 格式输出

显示:概览统计、活动模式、语言、主要贡献者、月度活动。

codepulse diff

比较两个时间段的编程活动。

codepulse diff                         # 本周 vs 上周(默认)
codepulse diff --week                  # 本周 vs 上周
codepulse diff --month                 # 本月 vs 上月
codepulse diff --year                  # 今年 vs 去年
codepulse diff --p1 this-month --p2 last-month  # 自定义预设
codepulse diff --from1 2024-01-01 --to1 2024-01-31 --from2 2024-02-01 --to2 2024-02-28

codepulse weekly

生成每周摘要报告。

codepulse weekly                       # 本周摘要
codepulse weekly --weeks-ago 1         # 上周摘要
codepulse weekly --author email        # 按作者过滤
codepulse weekly --json                # JSON 格式输出

显示:概览、每日活动图表、主要贡献者、活跃仓库、亮点。

codepulse trends

显示语言使用趋势。

codepulse trends                       # 显示语言趋势
codepulse trends --months 6            # 最近 6 个月
codepulse trends --json                # JSON 格式输出

codepulse heatmap

显示文件和文件夹活动热力图。

codepulse heatmap                      # 显示文件活动
codepulse heatmap --type folder        # 显示文件夹活动
codepulse heatmap --limit 20           # 前 20 项

codepulse quality

分析提交信息质量并评分。

codepulse quality                      # 质量分析
codepulse quality --author email       # 特定作者
codepulse quality --json               # JSON 格式输出

显示:质量评分、规范化提交百分比、平均长度、主要问题、建议。

codepulse insights

获取个性化的生产力洞察和建议。

codepulse insights                     # 获取 AI 风格的洞察
codepulse insights --author email      # 特定作者
codepulse insights --json              # JSON 格式输出

生产力命令

codepulse streak

详细分析你的编程连续天数。

codepulse streak                       # 当前连续天数信息
codepulse streak --author email        # 特定作者

codepulse activity

在终端显示编程活动日历。

codepulse activity                     # 活动日历
codepulse activity --year 2024         # 特定年份
codepulse activity --author email      # 特定作者

codepulse schedule

分析你的编程时间表并获取优化建议。

codepulse schedule                     # 时间表分析
codepulse schedule --author email      # 特定作者
codepulse schedule --json              # JSON 格式输出

显示:每小时活动热力图、每日分布、工作日 vs 周末、建议。

codepulse focus

分析专注领域和上下文切换模式。

codepulse focus                        # 专注分析
codepulse focus --days 30              # 最近 30 天
codepulse focus --author email         # 特定作者

显示:专注评分、每日仓库数、每日语言数、深度工作天数、上下文切换。

codepulse predict

基于历史数据预测未来的编程生产力。

codepulse predict                      # 生产力预测
codepulse predict --author email       # 特定作者
codepulse predict --json               # JSON 格式输出

显示:历史平均值、趋势分析、每周预测、影响因素。

游戏化命令

codepulse achievements [email]

查看你的编程成就和徽章。

codepulse achievements                 # 你的成就
codepulse achievements [email protected]  # 特定作者
codepulse achievements --category commits  # 按类别过滤
codepulse achievements --unlocked      # 仅显示已解锁
codepulse achievements --locked        # 仅显示未解锁

类别:commits(提交)、streaks(连续天数)、lines(代码行)、repos(仓库)、special(特殊)。

codepulse goals

设置和追踪编程目标。

codepulse goals list                   # 列出所有目标
codepulse goals add commits 10 daily   # 添加每日提交目标
codepulse goals add commits 50 weekly  # 添加每周目标
codepulse goals update <id> 15         # 更新目标值
codepulse goals remove <id>            # 删除目标
codepulse goals clear                  # 清除所有目标
codepulse goals suggest                # 获取目标建议

codepulse leaderboard

查看贡献者排名和排行榜。

codepulse leaderboard                  # 默认:按提交数
codepulse leaderboard -c lines         # 按代码行数
codepulse leaderboard -c streak        # 按最长连续天数
codepulse leaderboard -c score         # 按生产力评分
codepulse leaderboard -c repos         # 按仓库数
codepulse leaderboard --all            # 所有类别
codepulse leaderboard --limit 20       # 前 20 名

实用命令

codepulse search <query>

搜索提交信息。

codepulse search "bug fix"             # 搜索提交
codepulse search "feature" --limit 20  # 限制结果数
codepulse search "refactor" --author email  # 按作者过滤

codepulse export

导出编程数据为各种格式。

codepulse export --format json         # 导出为 JSON
codepulse export --format csv          # 导出为 CSV
codepulse export --output data.json    # 保存到文件

codepulse summary

生成编程活动摘要报告。

codepulse summary                      # 整体摘要
codepulse summary --period month       # 月度摘要
codepulse summary --author email       # 特定作者

codepulse top

显示最活跃的项目。

codepulse top files                    # 最活跃的文件
codepulse top days                     # 最活跃的日期
codepulse top commits                  # 最大的提交
codepulse top --limit 10               # 前 10 项

codepulse tags

分析提交标签和发布模式。

codepulse tags                         # 所有仓库
codepulse tags --repo my-project       # 特定仓库
codepulse tags --json                  # JSON 格式输出

显示:发布频率、版本类型(major/minor/patch)、最近标签。

数据管理命令

codepulse config

管理 CodePulse 配置设置。

codepulse config list                  # 列出所有设置
codepulse config set key value         # 设置配置值
codepulse config get key               # 获取配置值

codepulse backup

备份 CodePulse 数据库。

codepulse backup                       # 创建备份
codepulse backup --output ~/backup.db  # 自定义位置

codepulse restore <backup-file>

从备份恢复 CodePulse 数据库。

codepulse restore ~/backup.db          # 恢复备份

codepulse clear

清除数据库中的扫描数据。

codepulse clear                        # 清除所有数据
codepulse clear --repo path            # 清除特定仓库

GitHub 集成

codepulse github

GitHub 集成,用于仓库统计。

codepulse github login                 # 登录 GitHub
codepulse github status                # 查看登录状态
codepulse github scan                  # 扫描 GitHub 仓库
codepulse github logout                # 登出

仪表板功能

概览标签页

  • 统计卡片: 总提交数、代码行数、仓库数量、连续天数
  • 贡献热力图: 年度活动可视化
  • 时间分布: 按小时和星期几的活动分布
  • 语言图表: 编程语言使用统计
  • 月度趋势: 提交活动趋势图
  • 洞察: 自动生成的编程习惯洞察
  • 成就: 游戏化的里程碑系统
  • 项目排名: 按贡献排序的项目列表
  • 贡献者: 可点击查看作者档案

高级分析标签页

  • 目标与进度: 每日/每周/每月目标追踪
  • 代码速度: 编码速度和趋势分析
  • 工作会话: 编程会话检测和分析
  • 深度工作: 专注时间和心流状态分析
  • 提交质量: 提交消息质量评分
  • 代码变更率: 文件变更频率和热点检测

作者档案页面

点击任意贡献者查看其完整档案:

  • 完整的统计摘要
  • 贡献热力图
  • 活动时间模式
  • 语言使用情况
  • 贡献的仓库
  • 月度趋势
  • 最近提交
  • 解锁的成就

仓库档案页面

点击任意项目查看其完整档案:

  • 健康评分和指标
  • 贡献者列表
  • 语言分布
  • 热点文件(频繁修改的文件)
  • 活动时间模式
  • 月度趋势
  • 最近提交

API 端点

运行仪表板时,以下 API 端点可用:

基础端点

| 端点 | 描述 | |------|------| | GET /api/overview | 整体统计 | | GET /api/heatmap?year=2025 | 贡献热力图数据 | | GET /api/time-distribution | 小时 × 天分布 | | GET /api/languages | 语言统计 | | GET /api/projects | 项目排名 | | GET /api/authors | 贡献者列表 | | GET /api/trend | 月度趋势 |

高级分析端点

| 端点 | 描述 | |------|------| | GET /api/velocity | 代码速度指标 | | GET /api/sessions | 工作会话指标 | | GET /api/churn | 代码变更率指标 | | GET /api/commit-quality | 提交质量指标 | | GET /api/deep-work | 深度工作指标 | | GET /api/goals | 目标进度 | | GET /api/advanced | 所有高级分析(合并端点)| | GET /api/language-trends | 语言使用趋势 | | GET /api/commit-sizes | 提交大小分布 | | GET /api/insights | 生产力洞察 | | GET /api/file-heatmap | 文件活动热力图 |

档案端点

| 端点 | 描述 | |------|------| | GET /api/author/:email/profile | 作者完整档案 | | GET /api/repo/:path/profile | 仓库完整档案(路径需 base64 编码)| | POST /api/compare/authors | 比较多个作者 | | POST /api/compare/repos | 比较多个仓库 |

作者过滤

大多数端点支持 ?author=email 参数来过滤特定作者的数据。

数据存储

所有数据存储在本地的 ~/.codepulse/codepulse.db(SQLite 数据库)。

配置存储在 ~/.codepulse/config.json

目标存储在 ~/.codepulse/goals.json

重置数据:

rm -rf ~/.codepulse

支持的语言

CodePulse 自动检测 50+ 种编程语言,包括:

  • TypeScript, JavaScript, Python, Java, Go, Rust
  • C, C++, C#, Swift, Kotlin, Scala
  • Ruby, PHP, Perl, Lua, R
  • HTML, CSS, SCSS, Vue, Svelte
  • 以及更多...

开发

# 开发模式运行
npm run dev scan ./my-projects

# 构建
npm run build

# 代码检查
npm run lint

# 格式化
npm run format

构建 Web 仪表板

cd web
npm install
npm run build

构建文件将位于 web/dist/,仪表板命令会自动提供服务。

系统要求

  • Node.js >= 18.0.0
  • Git 已安装并在 PATH 中可访问

许可证

MIT