@devflow-tools/claude-code-plugin 0.9.0 → 0.10.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.
@@ -1,2 +1,2 @@
1
- import {request}from'http';import {existsSync,readFileSync,writeFileSync}from'fs';import {join}from'path';import {homedir}from'os';var R=process.env.DEVFLOW_SERVER_URL||"http://127.0.0.1:13337",O=process.env.DEVFLOW_API_KEY||"dev-key-000000",p=process.env.CLAUDE_PROJECT_DIR||process.cwd(),u=join(homedir(),".devflow","session-id"),d=join(homedir(),".devflow","event-map.json");function m(r,n){return new Promise(e=>{let o=JSON.stringify(n),t=new URL(r,R),s=request({hostname:t.hostname,port:t.port,path:t.pathname,method:"POST",headers:{"Content-Type":"application/json","X-API-Key":O,"Content-Length":Buffer.byteLength(o)},timeout:5e3},()=>e());s.on("error",()=>e()),s.write(o),s.end();})}function P(){try{if(existsSync(u))return readFileSync(u,"utf-8").trim()}catch{}return null}function L(r){try{if(!existsSync(d))return null;let n=JSON.parse(readFileSync(d,"utf-8")),e=n.findIndex(t=>t.toolName===r);if(e===-1)return null;let o=n[e];return n.splice(e,1),writeFileSync(d,JSON.stringify(n)),{eventId:o.eventId,timestamp:o.timestamp}}catch{return null}}async function N(r){if(!r)return;let n;try{n=JSON.parse(r);}catch{return}let e=n.tool_name||"",o=n.tool_input||{},t=n.tool_response||{},s=P(),c=L(e);if(c&&s){let i=typeof t=="string"?t:JSON.stringify(t),I=i.length>5e3?{_truncated:true,_originalSize:i.length,text:i.slice(0,5e3)}:t,S=Date.now()-c.timestamp;m("/api/telemetry/tool-call/output",{eventId:c.eventId,sessionId:s,output:I,duration:S,completedAt:Date.now()}).catch(()=>{});}let v=typeof o=="object"&&o.command?o.command:"",l=typeof t=="object"&&t!==null?t:null,a=l?.exitCode,_=l?.stderr;if(e==="Bash"&&a!==void 0&&a!==0){let i={id:`evt:${Date.now()}:${Math.random().toString(36).slice(2,7)}`,sessionId:s??`session:${p.split("/").pop()||"default"}`,tool:e,command:v||e,exitCode:a,stderr:_??null,durationMs:0,createdAt:Date.now()};m(`/api/memory/events?rootPath=${encodeURIComponent(p)}`,i).catch(()=>{});}}(process.argv[1]?.endsWith("post-tool-use")||process.argv[1]?.endsWith("post-tool-use.js"))&&N(process.argv[2]||"").catch(()=>process.exit(0));
2
- export{N as handlePostToolUse};
1
+ import {request}from'http';import {existsSync,readFileSync,writeFileSync}from'fs';import {join}from'path';import {homedir}from'os';var x=process.env.DEVFLOW_SERVER_URL||"http://127.0.0.1:13337",A=process.env.DEVFLOW_API_KEY||"dev-key-000000",w=process.env.CLAUDE_PROJECT_DIR||process.cwd(),v=join(homedir(),".devflow","session-id"),f=join(homedir(),".devflow","event-map.json");function y(d,a){return new Promise(e=>{let n=JSON.stringify(a),t=new URL(d,x),o=request({hostname:t.hostname,port:t.port,path:t.pathname,method:"POST",headers:{"Content-Type":"application/json","X-API-Key":A,"Content-Length":Buffer.byteLength(n)},timeout:5e3},()=>e());o.on("error",()=>e()),o.write(n),o.end();})}function L(){try{if(existsSync(v))return readFileSync(v,"utf-8").trim()}catch{}return null}function C(d,a){try{if(!existsSync(f))return null;let e=JSON.parse(readFileSync(f,"utf-8")),n=e.filter(c=>c.toolName===d);if(n.length===0)return null;let t=a??Date.now();n.sort((c,m)=>Math.abs(c.timestamp-t)-Math.abs(m.timestamp-t));let o=n[0],s=e.findIndex(c=>c.eventId===o.eventId);return s!==-1&&e.splice(s,1),writeFileSync(f,JSON.stringify(e)),{eventId:o.eventId,timestamp:o.timestamp}}catch{return null}}async function M(d){if(!d)return;let a;try{a=JSON.parse(d);}catch{return}let e=a.tool_name||"",n=a.tool_input||{},t=a.tool_response||{},o=L(),s=C(e,Date.now());if(s&&o){let r=typeof t=="string"?t:JSON.stringify(t),g=r.length>5e3?{_truncated:true,_originalSize:r.length,text:r.slice(0,5e3)}:t,i=Date.now()-s.timestamp;y("/api/telemetry/tool-call/output",{eventId:s.eventId,sessionId:o,output:g,duration:i,completedAt:Date.now()}).catch(()=>{});}let c=typeof n=="object"&&n.command?n.command:"",m=typeof t=="object"&&t!==null?t:null,p=m?.exitCode,O=m?.stderr;if(e==="Bash"&&p!==void 0&&p!==0){let r={id:`evt:${Date.now()}:${Math.random().toString(36).slice(2,7)}`,sessionId:o??`session:${w.split("/").pop()||"default"}`,tool:e,command:c||e,exitCode:p,stderr:O??null,durationMs:0,createdAt:Date.now()};y(`/api/memory/events?rootPath=${encodeURIComponent(w)}`,r).catch(()=>{});}let R=["get_project_context","get_knowledge","get_memory","search_symbol","get_dependency_graph","react_diagnose_bug","react_new_component","react_audit_performance","vue_diagnose_bug","nest_diagnose_bug","nextjs_diagnose_bug","electron_diagnose_bug","graphql_diagnose_bug","run_workflow"],l=e.replace("mcp__devflow__","");if(e.startsWith("mcp__devflow__")&&R.includes(l)){let r=typeof t=="object"&&t!==null?t:null,g=["files","results","data","result","memories","nodes","chunks"],i=0,u=r?.data??r;if(Array.isArray(u))i=u.length;else if(typeof u=="object"&&u!==null){let _=u;for(let h of g)Array.isArray(_[h])&&(i+=_[h].length);i===0&&Object.keys(_).length>0&&(i=1);}let k=JSON.stringify(t),j=Buffer.byteLength(k,"utf8"),D={id:`metric:${Date.now()}:${Math.random().toString(36).slice(2,11)}`,toolCallEventId:s?.eventId??`unknown:${Date.now()}`,sessionId:o??"",toolName:l,query:typeof n=="object"&&n.query?n.query:void 0,status:r?.error?"error":i===0?"empty":"success",resultCount:i,resultSizeBytes:j,latencyMs:s?Date.now()-s.timestamp:0,engine:l.startsWith("get_project_context")||l==="search_symbol"||l==="get_dependency_graph"?"codegraph":l==="get_knowledge"?"knowledge":l==="get_memory"?"memory":void 0};y("/api/telemetry/tool-metrics",D).catch(()=>{});}}(process.argv[1]?.endsWith("post-tool-use")||process.argv[1]?.endsWith("post-tool-use.js"))&&M(process.argv[2]||"").catch(()=>process.exit(0));
2
+ export{M as handlePostToolUse};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devflow-tools/claude-code-plugin",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "DevFlow — Developer Intelligence Platform for Claude Code",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -8,7 +8,7 @@
8
8
  "deploy": "npx tsx scripts/inject-gates.ts --deploy"
9
9
  },
10
10
  "devDependencies": {
11
- "@devflow-tools/mcp-server": "^0.9.0"
11
+ "@devflow-tools/mcp-server": "^0.10.0"
12
12
  },
13
13
  "keywords": [
14
14
  "pi-package",
@@ -28,5 +28,5 @@
28
28
  "hooks.json",
29
29
  "skills"
30
30
  ],
31
- "gitHead": "7872bccedbacd09cc92b983f30b3702db6878125"
31
+ "gitHead": "20444d2631e3d77c3b3a4c3afd9398b21d888a4f"
32
32
  }