claimdiff-mcp 0.0.0-stage → 0.1.0
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/LICENSE.md +107 -0
- package/README.md +25 -2
- package/dist/claimdiff.cjs +41032 -0
- package/dist/hook.cjs +4 -0
- package/package.json +43 -4
package/dist/hook.cjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";var F=require("node:child_process"),o=require("node:fs"),e=require("node:path");var x=require("node:crypto"),M=require("node:os"),S=require("node:path");function _(){return process.env.CLAIMDIFF_HOME||(0,S.join)((0,M.homedir)(),".claimdiff")}function v(t){let n=t.replace(/\\/g,"/").replace(/\/+$/,""),r=(0,x.createHash)("sha256").update(n).digest("hex").slice(0,16);return(0,S.join)(_(),"sessions",r)}function D(t){let n=process.argv.indexOf(`--${t}`);return n>=0?process.argv[n+1]:void 0}function g(t,n){for(let r of n){let i=t;for(let c of r.split("."))i=i?.[c];if(typeof i=="string"&&i)return i}}function H(t){let n=t;for(;;){if((0,o.existsSync)((0,e.join)(n,".git")))return n;let r=(0,e.dirname)(n);if(r===n)return;n=r}}function N(t){return t?.tool_name==="Bash"||typeof t?.tool_input?.command=="string"||typeof t?.command=="string"}function O(t,n,r=Date.now()){let i=g(t,["cwd","workspace_roots.0"])??process.cwd(),c;try{c=H((0,o.realpathSync)(i))}catch{return 0}if(!c)return 0;let f=v(c);(0,o.mkdirSync)(f,{recursive:!0});let l=(0,e.join)(f,"shell-check"),d=r-600*1e3;try{let s=Number((0,o.readFileSync)(l,"utf8"));Number.isFinite(s)&&s>0&&s<=r&&(d=s)}catch{}(0,o.writeFileSync)(l,String(r));let u=(0,F.execFileSync)("git",["-c","core.quotePath=false","status","--porcelain","-z","--untracked-files=all"],{cwd:c,encoding:"utf8",timeout:5e3,stdio:["ignore","pipe","ignore"]}),h=g(t,["session_id","conversation_id","sessionId"]),p=new Map;try{for(let s of(0,o.readFileSync)((0,e.join)(f,"edits.jsonl"),"utf8").split(`
|
|
2
|
+
`))if(s)try{let a=JSON.parse(s);typeof a.file=="string"&&typeof a.t=="number"&&p.set(a.file,Math.max(p.get(a.file)??0,a.t))}catch{}}catch{}let b=u.split("\0"),k=0;for(let s=0;s<b.length;s++){let a=b[s];if(a.length<4)continue;let w=a.slice(0,2),m=a.slice(3);if((w[0]==="R"||w[0]==="C")&&s++,m.startsWith(".claimdiff/")||m.endsWith("/"))continue;let y;try{y=(0,o.statSync)((0,e.join)(c,m)).mtimeMs}catch{try{y=(0,o.statSync)((0,e.dirname)((0,e.join)(c,m))).mtimeMs}catch{continue}}y<d-1e3||Math.floor(y)<=(p.get(m)??0)||((0,o.appendFileSync)((0,e.join)(f,"edits.jsonl"),JSON.stringify({t:r,platform:n,...h?{session:h}:{},file:m,via:"shell"})+`
|
|
3
|
+
`),k++)}return k}function A(t,n,r=Date.now()){let i=g(t,["file_path","tool_input.file_path","tool_input.notebook_path","tool_input.path","path","file"]);if(!i)return N(t)?O(t,n,r)>0:!1;let c=g(t,["cwd","workspace_roots.0"])??process.cwd(),f=(0,e.isAbsolute)(i)?i:(0,e.resolve)(c,i),l=(0,e.dirname)(f);try{l=(0,o.realpathSync)(l)}catch{}let d=H(l);if(!d)return!1;let u=(0,e.relative)(d,(0,e.join)(l,(0,e.basename)(f))).replace(/\\/g,"/");if(!u||u.startsWith("..")||u.startsWith(".claimdiff/")||u.startsWith(".git/"))return!1;let h=g(t,["session_id","conversation_id","sessionId"]),p=v(d);return(0,o.mkdirSync)(p,{recursive:!0}),(0,o.appendFileSync)((0,e.join)(p,"edits.jsonl"),JSON.stringify({t:r,platform:n,...h?{session:h}:{},file:u})+`
|
|
4
|
+
`),!0}function j(){try{let t=D("platform")??"unknown",n="";try{n=(0,o.readFileSync)(0,"utf8")}catch{}if(process.argv.includes("--capture")){let r=(0,e.join)(_(),"hook-capture");(0,o.mkdirSync)(r,{recursive:!0}),(0,o.writeFileSync)((0,e.join)(r,`${t}-${Date.now()}.json`),n)}A(n.trim()?JSON.parse(n):{},t)}catch{}}j();process.exit(0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claimdiff-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Review what your AI agent changed: click each claimed feature to see its diff, and get warned when the summary and the code don't match. Works with Cursor, Claude Code, DeepSeek.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"code review",
|
|
7
|
+
"ai code review",
|
|
8
|
+
"diff",
|
|
9
|
+
"git diff",
|
|
10
|
+
"agent",
|
|
11
|
+
"ai changes",
|
|
12
|
+
"summary",
|
|
13
|
+
"pr review",
|
|
14
|
+
"verify",
|
|
15
|
+
"cursor",
|
|
16
|
+
"claude code",
|
|
17
|
+
"deepseek",
|
|
18
|
+
"代码审查",
|
|
19
|
+
"代码评审",
|
|
20
|
+
"改动导读",
|
|
21
|
+
"diff 对比"
|
|
22
|
+
],
|
|
23
|
+
"author": {
|
|
24
|
+
"name": "Zhiyuan Vision",
|
|
25
|
+
"email": "contact@zhiyuanv.com",
|
|
26
|
+
"url": "https://zhiyuanv.com"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://zhiyuanv.com/software.html",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/zhiyuanvision-lang/ClaimDiff.git"
|
|
32
|
+
},
|
|
33
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
34
|
+
"bin": {
|
|
35
|
+
"claimdiff": "dist/claimdiff.cjs"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"README.md",
|
|
40
|
+
"LICENSE.md"
|
|
41
|
+
],
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=18"
|
|
44
|
+
}
|
|
45
|
+
}
|