@wengine-ai/stats-local
v1.0.0
Published
Local Claude Code AI coding stats CLI for arbitrary Git repositories
Downloads
18
Maintainers
Readme
@wengine-ai/stats-local
Claude Code 本地 AI 编码统计 CLI,可通过 npm / npx 给任意 Git 仓库安装本地统计能力。
功能特性
- 记录 Claude Code
Edit/Write/NotebookEdit事件 - 在
git commit后自动 reconcile 分支净值与累计值 - 使用本地 SQLite 保存统计数据
- 支持
status / branch-summary / file-summary / sessions / audit - 提供
trusted / degraded / tampered信任状态 - 支持通过
init为任意仓库安装 hook
安装与使用
使用 npx(推荐)
在目标仓库中执行:
npx @wengine-ai/stats-local init --repo .初始化完成后可直接查询:
npx @wengine-ai/stats-local status --repo .
npx @wengine-ai/stats-local branch-summary --repo .
npx @wengine-ai/stats-local audit --repo .全局安装
npm install -g @wengine-ai/stats-local然后在任意仓库中执行:
stats-local init --repo .
stats-local status --repo .
stats-local sessions --repo .核心命令
stats-local init [--repo <path>]
stats-local doctor [--repo <path>]
stats-local status [--repo <path>]
stats-local branch-summary [--repo <path>]
stats-local file-summary --file <path> [--repo <path>]
stats-local sessions [--repo <path>]
stats-local audit [--repo <path>]
stats-local reconcile [--repo <path>] [--base-branch <branch>]初始化会做什么
init 会自动:
- 检测目标路径对应的 Git 仓库根目录
- 安装
Claude Code PostToolUsehook 到<repo>/.claude/settings.local.json - 安装
Git post-commithook 到 Git hooks 目录 - 在目标仓库
.claude/wengine-ai-stats-local/下写入运行时脚本/产物
平台说明
- macOS / Linux:原生支持
- Windows:建议通过 Git Bash / Git for Windows 使用 Git hook
- 数据库默认保存在用户数据目录,不写入业务源码目录
本地开发
cd wengine-ai-stats-local
npm install
npm run test
npm run build源码开发模式下,也可用兼容脚本给当前仓库安装:
./scripts/install-claude-stats.sh .发布前验证
npm test
npm run build
npm pack