georgiosnikitas/commit-whisper
GitHub: georgiosnikitas/commit-whisper
commit-whisper 是一款基于 Git 历史确定性分析并可选结合 AI 叙事的终端 CLI 工具,用于生成多格式的仓库指标报告。
Stars: 1 | Forks: 0
# commit-whisper
[](https://sonarcloud.io/summary/overall?id=georgiosnikitas_commit-whisper)
[](https://github.com/georgiosnikitas/commit-whisper/actions/workflows/ci.yml)
[](https://github.com/georgiosnikitas/commit-whisper/actions/workflows/release.yml)
[](https://www.npmjs.com/package/commit-whisper)
[](https://www.typescriptlang.org/)
[](LICENSE)
[](https://buymeacoffee.com/georgiosnikitas)
基于确定性 git 历史分析,配合自带密钥(BYOK)的 AI 叙事功能——这是一个
终端原生的 CLI。
commit-whisper 会分析本地或远程的 git 仓库,计算一系列确定性
指标(不使用 AI),并且——在配置了 provider 时——生成基于事实依据的 AI 叙事和
指导报告。它可以通过单一的规范 Report JSON 渲染输出为 HTML、Markdown、终端和 JSON 格式。
## 环境要求
- Node.js 22 LTS 或更新版本
- npm(随 Node.js 一起提供)
- `PATH` 中包含系统 `git`(数据获取时会直接调用它)
## 🚀 安装
### 🍺 Homebrew (macOS)
```
brew trust georgiosnikitas/commit-whisper
brew tap georgiosnikitas/commit-whisper
brew install commit-whisper
```
### 📦 从 npm 安装
```
npm install -g commit-whisper
```
或者无需安装直接运行:
```
npx commit-whisper .
```
### 📦 从 GitHub Packages 安装
```
npm install -g @georgiosnikitas/commit-whisper --registry=https://npm.pkg.github.com
```
### 💾 预编译二进制文件(无需 Node.js)
适用于 macOS、Linux 和 Windows 的独立可执行文件已附在每个
[GitHub Release](https://github.com/georgiosnikitas/commit-whisper/releases) 中。
通过 Homebrew、npm、GitHub Packages 或预编译二进制文件安装后,可以在
任意位置运行:
```
commit-whisper .
```
### 🛠️ 从源码构建
```
git clone https://github.com/georgiosnikitas/commit-whisper.git
cd commit-whisper
npm install
npm run build
node dist/index.js .
```
## 快速开始(开发)
```
npm install # install pinned toolchain + runtime deps
npm run build # bundle src/ → dist/ (tsup / esbuild)
npm test # run the test suite (vitest)
```
## npm 脚本
| 脚本 | 用途 |
| --- | --- |
| `npm run build` | 通过 tsup 将 `src/` 打包到 `dist/`(ESM,Node 22 目标)。 |
| `npm run bundle:sea` | 将 `src/sea-entry.ts` 打包到 `dist-sea/` 中的单个独立 CJS 文件。 |
| `npm run build:sea` | 构建 Node SEA 单可执行文件(参见 [7.4 调研结果](docs/implementation-artifacts/7-4-sea-packaging-spike-findings.md))。 |
| `npm test` | 运行一次测试套件(`vitest run`)。 |
| `npm run test:watch` | 在 watch 模式下运行 vitest。 |
| `npm run typecheck` | 使用 `tsc --noEmit` 进行类型检查(strict,nodenext)。 |
| `npm run lint` | 使用 ESLint 进行代码检查(强制执行架构规范)。 |
## 项目结构
```
src/
├── index.ts # entrypoint (bootstrap → cli)
├── cli/ # CLI shell, menu, arg parsing, exit-code mapping
├── config/ # two-phase resolver, RunConfig, the only reader of process.env
├── retrieve/ # git clone shell-out, retrieval, temp-workspace lifecycle
├── analyze/ # normalized model + deterministic metric functions (Groups A–F)
├── narrate/ # AI client, reachability preflight, grounding check
├── assemble/ # canonical Report JSON assembly + schema
├── render/ # HTML / Markdown / Terminal / JSON renderers
├── license/ # license validation and tier resolution
└── shared/ # errors, ui (stderr), Secret, ports, types
```
只有 `cli/` 和 `config/` 可以访问 `argv` / `env` / 提示信息;从 `retrieve/` 开始的每一个阶段都会接收一个被冻结的 `RunConfig`(六边形边界)。这些规范
由 ESLint 强制执行。
## 许可证
[MIT](LICENSE) © Georgios Nikitas。该 CLI 及其源代码基于 MIT 许可证;付费
层级在运行时通过在线许可证检查进行强制验证(你的 BYOK AI 密钥和 git
token 仅保留在你的本机上)。
标签:AI辅助, Git分析, MITM代理, TypeScript, 代码度量, 威胁情报, 安全插件, 开发者工具, 网络安全研究, 自动化攻击