claimdiff-mcp 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,26 +1,161 @@
1
- # ClaimDiff
1
+ <div align="center">
2
+ <img src="https://raw.githubusercontent.com/zhiyuanvision-lang/ClaimDiff/main/packages/vscode/images/icon.png" width="84" height="84" alt="ClaimDiff Logo" />
3
+ <h1>Code Review &amp; Diff · ClaimDiff</h1>
4
+ <p><strong>核对 AI 编程智能体「说做了什么」与「实际改了什么」——把冗长杂乱的 Git Diff 秒变可点击逐项核对的改动导读</strong></p>
5
+ <p><em>Verify what your AI coding agent says it built against the real git diff: clickable feature-to-hunk review guide with mismatch warnings</em></p>
2
6
 
3
- **Review what your AI agent changed.** Click each feature the agent says it built to see the code behind it, and get warned when the summary and the diff don't match.
7
+ <p>
8
+ <a href="https://www.zhiyuanv.com/claimdiff.html"><img src="https://img.shields.io/badge/🌐_官方网站与指南-ClaimDiff-e03d22?style=for-the-badge" alt="Official Website" /></a>
9
+ <a href="https://open-vsx.org/extension/claimdiff/claimdiff-vscode"><img src="https://img.shields.io/open-vsx/v/claimdiff/claimdiff-vscode?style=for-the-badge&label=Cursor%20%2F%20Open%20VSX&color=059669" alt="Open VSX" /></a>
10
+ <a href="https://marketplace.visualstudio.com/items?itemName=claimdiff.claimdiff-vscode"><img src="https://img.shields.io/visual-studio-marketplace/v/claimdiff.claimdiff-vscode?style=for-the-badge&label=VS%20Code&color=0284c7" alt="VS Code Marketplace" /></a>
11
+ <a href="https://www.npmjs.com/package/claimdiff-mcp"><img src="https://img.shields.io/npm/v/claimdiff-mcp?style=for-the-badge&label=npm%20MCP&color=cb3837" alt="npm claimdiff-mcp" /></a>
12
+ </p>
4
13
 
5
- - A feature with no code behind it is flagged.
6
- - Code that no feature mentions is flagged.
7
- - A change in a listed file that contains none of the names given for it is marked.
14
+ <p>
15
+ <a href="#简体中文"><strong>简体中文</strong></a> · <a href="#english"><strong>English</strong></a> · <a href="https://www.zhiyuanv.com/claimdiff.html"><strong>产品主页</strong></a> · <a href="https://www.zhiyuanv.com/software.html#claimdiff"><strong>Pro 定价与说明</strong></a>
16
+ </p>
17
+ </div>
8
18
 
9
- A match only means the related code was changed, not that it is correct.
19
+ ---
20
+
21
+ <a id="简体中文"></a>
22
+
23
+ ## 为什么用 AI 写代码的程序员都需要 ClaimDiff?
24
+
25
+ 用 **Cursor、Claude Code、DeepSeek Harness、Antigravity** 写代码时,AI 动辄一次修改十几个文件、几百上千行代码,最后甩给你一段漂亮的「已完成总结」:
26
+ - **只看 AI 的文字汇报?** 经常遇到 AI **「嘴上说改了,代码根本没动」**,或者顺手 **「偷偷删改了不相关的逻辑却只字未提」**。
27
+ - **肉眼硬啃原始 `git diff`?** 跨十几个文件按字母顺序排列的零碎代码块,根本看不出哪几段改动对应哪个业务功能点。
28
+
29
+ **ClaimDiff 在本地把 AI 的总结与真实的 `git diff` 逐块交叉核对,生成一份「点击功能点 → 直达对应代码改动」的可交互审查导读,并对所有言行不一之处自动亮灯预警:**
30
+
31
+ | 审查维度 | **ClaimDiff(AI 改动核对导读)** | 肉眼直接翻 `git diff` | 仅看 AI 对话汇报 / 普通 PR 摘要 |
32
+ | :--- | :--- | :--- | :--- |
33
+ | **阅读主线与认知负担** | **按业务功能点聚合,点击任一功能直接展开对应 Diff 块** | 按文件名字母序平铺,跨文件逻辑碎成一地 | 只有自然语言自述,看不到底层真实代码证据 |
34
+ | **AI 漏改检测(说了没做)** | **自动标记无代码支撑的虚报功能点(`claimedButNoCode`)** | 需人脑逐条记忆并去几十个文件里翻找核实 | 完全无法发现 AI 幻觉汇报 |
35
+ | **AI 暗改检测(做了没说)** | **自动揪出没有任何功能点认领的未声明改动块(`unclassified`)** | 极易在几百行格式/重构噪音中漏看顺手暗改 | AI 没写进总结就彻底隐身 |
36
+ | **同文件偷改未声明函数** | **精准标出虽列了文件名、但未命中任何声明符号的改动块** | 看到文件名对了往往一滑而过 | 无法精确到函数与键值粒度 |
37
+ | **隐私安全与 Token 消耗** | **100% 纯本机运行不上传源码;向模型只返回一句话摘要** | 纯本地,但耗时费眼 | 云端 PR 机器人往往需上传代码仓库 |
38
+
39
+ > **诚实边界声明**:核对「对上了」只说明总结里声明的相关文件与符号确实发生了改动,**不代表代码逻辑本身没有 Bug**——ClaimDiff 帮你省去在十几个文件里大海捞针找改动的体力活,让你把精力集中在关键逻辑审查上。
40
+
41
+ ---
42
+
43
+ ## 安装与快速开始(30 秒上手)
44
+
45
+ ### 方式一:命令行一键配置项目或安装插件
46
+
47
+ 下方依次为 **Cursor 项目接入**、**Claude Code 项目接入**、**DeepSeek Harness 原生插件安装**(将钩子、MCP 服务与 `claimdiff` 技能自动写入环境,并将 `.claimdiff/` 加入 `.git/info/exclude` 不污染仓库):
48
+
49
+ ```bash
50
+ npx -y claimdiff-mcp@latest install --cursor
51
+ npx -y claimdiff-mcp@latest install --claude
52
+ dsh plugin --profile web add dsh-claimdiff
53
+ ```
54
+
55
+ ### 方式二:按所在 IDE 与 AI 客户端安装使用
56
+
57
+ | 所在平台 | 安装渠道 | 触发与打开方式 |
58
+ | :--- | :--- | :--- |
59
+ | **VS Code / Cursor / Windsurf / VSCodium** | 扩展商店搜索 **`ClaimDiff`** 安装(`claimdiff.claimdiff-vscode`) | Agent 改完代码自动打开;或点击左侧 Git 源代码管理栏顶部的 **核对图标(`打开改动导读`)** |
60
+ | **Claude Code / Claude Desktop** | 执行 `/plugin marketplace add zhiyuanvision-lang/ClaimDiff` 再执行 `/plugin install claimdiff@claimdiff-marketplace`(或上方 `install --claude`) | Agent 完成改码后自动调用 `claimdiff` 技能写总结、核对并在对话内直接展开交互导读面板 |
61
+ | **DeepSeek Harness** | 插件页添加 `dsh-claimdiff` 或运行 `dsh plugin --profile web add dsh-claimdiff` | 在文档预览工具栏点击 **`ClaimDiff`** 按钮,右侧分栏直接打开当前 Git 仓库的改动导读 |
62
+ | **Google Antigravity** | 从 [GitHub Releases](https://github.com/zhiyuanvision-lang/ClaimDiff/releases) 下载 `claimdiff-antigravity-<版本>.zip` 安装 | 右侧辅助面板(Sidecar)直接打开 ClaimDiff 导读,点击改动块联动查看 |
63
+ | **任意终端 / 独立浏览器** | 无需安装扩展,直接在任意 Git 仓库目录执行 `npx -y claimdiff-mcp@latest open` | 在本机浏览器启动独立导读面板,随时核对工作区未提交改动或指定 Commit 区间 |
64
+
65
+ ---
66
+
67
+ ## 功能特性详解(三大核对防线)
68
+
69
+ ### 1. 点击功能点 → 即刻对照真实 Git Diff 代码块
70
+ Agent 完成编码任务后,按规范将本次任务拆分为清晰的功能点写入 `.claimdiff/summary.md`(指明每个功能修改的相对路径与新增/改动的函数、类、路由或配置键名)。在 ClaimDiff 导读面板中点击任意功能点,右侧立即聚合展示支撑该功能的全部真实 Diff 改动块;在 VS Code / Cursor 中点击代码块还能一键跳转到源文件对应行。
71
+
72
+ ### 2. 三重双向交叉校验,专治 AI「言行不一」
73
+ - **虚报预警(说了没改)**:总结里声称完成了某功能或改了某路径,但真实 `git diff` 里根本没有对应改动时,立即高亮告警。
74
+ - **暗改预警(改了没说)**:真实 `git diff` 中存在未被任何功能点(或「未归入功能点的改动」)认领的野生改动块时,单独归入未解释改动提醒你重点排查。
75
+ - **符号级细粒度核对**:哪怕文件在声明列表里,只要某处 Diff 块完全不包含为该文件声明的函数名/类名/键名,也会明确标出「文件已列、符号未声明」,杜绝顺手夹带私货。
76
+
77
+ ### 3. 100% 纯本机隐私处理 & 极小模型上下文开销
78
+ - **源码零上传**:所有代码、Git Diff、`.claimdiff/` 总结与工作区路径 **100% 在本机进程内解析核对**,绝不上传任何云端服务器。
79
+ - **不挤占 Agent 上下文窗口**:`claimdiff_open` 返回给大模型的工具结果仅有一句话与几个统计数字,完整的改动块与核对明细由前端面板通过专用本地接口按需拉取,既省 Token 又不干扰后续对话。
10
80
 
11
- Your code, diffs and summaries stay on your computer. See [LICENSE.md](LICENSE.md) for what usage statistics are sent.
81
+ ---
82
+
83
+ ## 配置与工作流示例
84
+
85
+ ### 标准 MCP 客户端接入配置(`mcp.json`)
86
+
87
+ 如果你希望在任意支持标准 MCP / MCP Apps 协议的客户端中手动挂载 ClaimDiff:
88
+
89
+ ```json
90
+ {
91
+ "mcpServers": {
92
+ "claimdiff": {
93
+ "command": "npx",
94
+ "args": ["-y", "claimdiff-mcp@latest", "mcp"]
95
+ }
96
+ }
97
+ }
98
+ ```
99
+
100
+ ### 结构化改动总结示例(`.claimdiff/summary.md`)
12
101
 
13
- 3-day free trial, then a one-time purchase (¥39.9 / $19.9) that works on every supported platform.
102
+ 安装 `claimdiff` 技能后,Agent 会在汇报前自动生成如下结构并调用 `claimdiff_check` 自检修正,最后调用 `claimdiff_open` 打开导读:
14
103
 
15
- ## Install
104
+ ```markdown
105
+ ## 功能点 1:登录接口滑动窗口限流
16
106
 
17
- | Where | How |
18
- | --- | --- |
19
- | VS Code, Cursor, Antigravity (editor) | Search **ClaimDiff** in Extensions, or install `claimdiff-<version>.vsix` from [Releases](../../releases) |
20
- | Claude Code | `/plugin marketplace add zhiyuanvision-lang/ClaimDiff` then `/plugin install claimdiff@claimdiff-marketplace` |
21
- | Any MCP client | `npx -y claimdiff-mcp@latest mcp` |
22
- | DeepSeek Harness | `dsh plugin --profile <name> add dsh-claimdiff` |
107
+ 按用户 ID 统计窗口请求数,超限返回 429 状态码。
108
+
109
+ 涉及改动:
110
+ - src/middleware/rateLimit.ts:新增 `slidingWindow`、`rateLimit`
111
+ - src/routes/auth.ts:在 `/login` 路由挂载限流中间件
112
+
113
+ ## 未归入功能点的改动
114
+
115
+ - package.json:新增依赖 `ioredis`
116
+ ```
23
117
 
24
118
  ---
25
119
 
26
- **核对 AI agent 说做了什么和实际改了什么。** 点击功能点查看对应的代码改动,总结和代码不一致时预警。对上了只说明相关代码被改过,不说明改得对。代码、改动和总结只在本机处理。免费试用 3 天,之后一次买断(¥39.9 / $19.9),多平台通用。
120
+ ## 🎁 3 天免登录免费试用 & Pro 终身买断
121
+
122
+ - **免费试用**:首次使用自动享有 **3 天全功能免登录免费试用**(无需注册账号,开箱即用)。
123
+ - **一次买断 · 多平台通用**:试用期满后支持一次性买断 **ClaimDiff Pro 终身版**(国内 `¥39.9` / 海外 `$19.9`,无按月自动续费,享 14 天无理由全额退款保障),同一账号可在 VS Code、Cursor、Claude Code、Antigravity、DeepSeek Harness 与命令行全平台通用。详见 [官方网站说明](https://www.zhiyuanv.com/software.html#claimdiff)。
124
+
125
+ ---
126
+
127
+ <a id="english"></a>
128
+
129
+ ## English Guide — Code Review & Diff · ClaimDiff
130
+
131
+ **Verify what your AI coding agent says it built against what it actually changed in `git diff`.**
132
+ When **Cursor, Claude Code, DeepSeek Harness, or Antigravity** edits a dozen files at once, ClaimDiff turns the agent's summary into an **interactive, clickable change guide** — click each claimed feature to inspect the exact diff hunks behind it, and get immediate warnings whenever the summary and the code disagree.
133
+
134
+ | Review Dimension | **ClaimDiff** | Reading Raw `git diff` | Trusting Agent Chat / Generic PR Bots |
135
+ | :--- | :--- | :--- | :--- |
136
+ | **Review Flow** | **Grouped by feature; click a feature to inspect its exact diff hunks** | Flat alphabetical file dump across 15+ files | Prose claims with no direct hunk verification |
137
+ | **Unimplemented Claims** | **Flags features whose claimed files/symbols have no matching diff** | Manual cross-checking from memory | Undetected agent hallucinations |
138
+ | **Silent / Unexplained Edits** | **Flags every diff hunk that no feature or "Other changes" section accounts for** | Easy to miss buried inside formatting noise | Completely invisible if omitted from summary |
139
+ | **Symbol-Level Check** | **Marks hunks in listed files that touch none of the declared function/class names** | Skipped once the filename looks familiar | Too coarse to catch side-effect edits |
140
+ | **Privacy & Token Cost** | **100% local on your machine; returns only 1 sentence + counts to the LLM** | Local, slow & fatiguing | Cloud PR bots often upload repo diffs |
141
+
142
+ > **Honest Scope**: A match means the claimed files and symbols were indeed modified — **not** that the logic is bug-free. ClaimDiff eliminates the mechanical scavenger hunt across files so you can focus human judgment on correctness.
143
+
144
+ ### Quick Start
145
+
146
+ 1. **Set up in a project (Cursor / Claude Code) or DeepSeek Harness**:
147
+ ```bash
148
+ npx -y claimdiff-mcp@latest install --cursor
149
+ npx -y claimdiff-mcp@latest install --claude
150
+ dsh plugin --profile web add dsh-claimdiff
151
+ ```
152
+ 2. **IDE Extensions**: Search **`ClaimDiff`** (`claimdiff.claimdiff-vscode`) in the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=claimdiff.claimdiff-vscode) or [Open VSX Registry](https://open-vsx.org/extension/claimdiff/claimdiff-vscode) (Cursor / Windsurf / VSCodium).
153
+ 3. **Claude Code Marketplace**: Run `/plugin marketplace add zhiyuanvision-lang/ClaimDiff` then `/plugin install claimdiff@claimdiff-marketplace`.
154
+ 4. **Standalone CLI**: Run `npx -y claimdiff-mcp@latest open` inside any Git repository.
155
+
156
+ ### Features
157
+
158
+ - **Clickable Feature-to-Hunk Navigation**: Jump from each claimed feature directly to its backing diff hunks (and straight to the file & line inside VS Code / Cursor).
159
+ - **Three-Way Mismatch Warnings**: Automatically flags `claimedButNoCode`, `claimedPathsNotInDiff`, `inListedFileButNotNamed`, and `unclassified` leftover hunks.
160
+ - **100% Local Privacy & Minimal Context Footprint**: Code, diffs, file paths, and summaries never leave your machine. See [LICENSE.md](LICENSE.md) for anonymous usage telemetry details.
161
+ - **3-Day Free Trial + One-Time Lifetime Pro**: 3-day full-featured free trial with no sign-in required, followed by a one-time purchase (`$19.9` / `¥39.9` lifetime across all supported hosts, 14-day full refund guarantee).