@devflow-tools/claude-code-plugin 0.8.11 → 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
|
|
2
|
-
export{
|
|
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.
|
|
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.
|
|
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": "
|
|
31
|
+
"gitHead": "20444d2631e3d77c3b3a4c3afd9398b21d888a4f"
|
|
32
32
|
}
|