lensmcp 1.23.13 → 1.24.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.
Files changed (63) hide show
  1. package/bundled/bridge.js +27 -27
  2. package/bundled/capture-runner.js +26 -26
  3. package/bundled/dashboard-ui/app.css +1 -1
  4. package/bundled/dashboard-ui/app.js +17 -17
  5. package/bundled/dashboard.js +98 -64
  6. package/bundled/lint-runner.js +3 -3
  7. package/bundled/main.js +43 -40
  8. package/bundled/shim.js +47 -43
  9. package/lib/bridge-origins.d.ts +16 -0
  10. package/lib/bridge-origins.js +1 -0
  11. package/lib/cli.js +53 -42
  12. package/lib/dashboard-login.d.ts +17 -0
  13. package/lib/dashboard-login.js +3 -0
  14. package/lib/duplicate-registration.d.ts +6 -3
  15. package/lib/duplicate-registration.js +1 -1
  16. package/lib/forward-signals.d.ts +24 -0
  17. package/lib/forward-signals.js +1 -0
  18. package/lib/guest-graph.d.ts +44 -0
  19. package/lib/guest-graph.js +4 -0
  20. package/lib/heap-analyzer-main.d.ts +1 -0
  21. package/lib/heap-analyzer-main.js +3 -0
  22. package/lib/heap-analyzer.d.ts +109 -0
  23. package/lib/heap-analyzer.js +1 -0
  24. package/lib/lint-args.d.ts +1 -1
  25. package/lib/mcp-mode.d.ts +92 -10
  26. package/lib/mcp-mode.js +3 -2
  27. package/lib/mcp-restart.d.ts +20 -1
  28. package/lib/mcp-restart.js +1 -1
  29. package/lib/mcp-sessions.d.ts +20 -0
  30. package/lib/mcp-sessions.js +2 -0
  31. package/lib/mcp-token.d.ts +48 -0
  32. package/lib/mcp-token.js +4 -0
  33. package/lib/mcp-wiring.d.ts +20 -5
  34. package/lib/mcp-wiring.js +2 -2
  35. package/lib/mem-command.d.ts +106 -0
  36. package/lib/mem-command.js +3 -0
  37. package/lib/perf-rules-check.d.ts +35 -0
  38. package/lib/perf-rules-check.js +4 -0
  39. package/lib/pod-source-maps.d.ts +31 -0
  40. package/lib/pod-source-maps.js +1 -0
  41. package/lib/process-ownership.d.ts +30 -0
  42. package/lib/process-ownership.js +2 -0
  43. package/lib/server-bundle.d.ts +19 -0
  44. package/lib/server-bundle.js +5 -0
  45. package/lib/status-client.d.ts +4 -1
  46. package/lib/status-client.js +2 -2
  47. package/lib/sweep.d.ts +15 -0
  48. package/lib/sweep.js +1 -1
  49. package/lib/workspace-scope.d.ts +26 -9
  50. package/package.json +4 -4
  51. package/plugin/.claude-plugin/plugin.json +1 -1
  52. package/plugin/scripts/dashboard-open.sh +26 -6
  53. package/plugin/skills/dashboard/SKILL.md +3 -1
  54. package/plugin/skills/using-lensmcp/SKILL.md +27 -0
  55. package/plugin/skills/using-lensmcp/rules/bundle-heavy-barrel-import.md +79 -0
  56. package/plugin/skills/using-lensmcp/rules/pod-heap-budget.md +53 -0
  57. package/plugin/skills/using-lensmcp/rules/pod-retained-generation.md +38 -0
  58. package/plugins/lensmcp/.codex-plugin/plugin.json +1 -1
  59. package/plugins/lensmcp/skills/lensmcp-dashboard/SKILL.md +5 -2
  60. package/plugins/lensmcp/skills/using-lensmcp/SKILL.md +21 -0
  61. package/plugins/lensmcp/skills/using-lensmcp/rules/bundle-heavy-barrel-import.md +79 -0
  62. package/plugins/lensmcp/skills/using-lensmcp/rules/pod-heap-budget.md +53 -0
  63. package/plugins/lensmcp/skills/using-lensmcp/rules/pod-retained-generation.md +38 -0
@@ -1,3 +1,3 @@
1
- "use strict";var B=Object.defineProperty;var d=(r,e)=>B(r,"name",{value:e,configurable:!0});import{createRequire as O}from"module";const rr=O(import.meta.url);var A=Object.defineProperty,u=d((r,e)=>A(r,"name",{value:e,configurable:!0}),"u");import{join as J}from"node:path";import{appendFileSync as D,closeSync as T,existsSync as R,mkdirSync as V,openSync as W,renameSync as q,statSync as X,unlinkSync as z}from"node:fs";import{basename as U,dirname as E,join as Y,resolve as $}from"node:path";function v(r,e){let{fs:t,maxBytes:n,maxFiles:i}=e,c=`${r}.rotate.lock`,o=e.staleLockMs??3e4,s;for(let l=0;l<2&&s===void 0;l++)try{s=t.openSync(c,"wx")}catch{try{if(Date.now()-t.statSync(c).mtimeMs<=o)return"busy";t.unlinkSync(c)}catch{}}if(s===void 0)return"busy";try{try{if(t.statSync(r).size<=n)return"not-needed"}catch{return"not-needed"}try{t.unlinkSync(`${r}.${i}`)}catch{}for(let l=i-1;l>=1;l--)try{t.renameSync(`${r}.${l}`,`${r}.${l+1}`)}catch{}try{t.renameSync(r,`${r}.1`)}catch{}return"rotated"}finally{try{t.closeSync(s)}catch{}try{t.unlinkSync(c)}catch{}}}d(v,"h"),u(v,"rotateBusFile");import{spawn as G}from"node:child_process";var h=0;function j(){return h=(h+1)%65535,`${Date.now().toString(36)}${h.toString(36)}${Math.random().toString(36).slice(2,8)}`}d(j,"j"),u(j,"defaultId");function b(r,e){return`eslint:${r}:${e.filePath}:${e.line??0}:${e.column??0}:${e.ruleId??"fatal"}`}d(b,"I"),u(b,"lintFingerprint");function w(r){let{meta:e}=r,t=e.now??Date.now,n=e.makeId??j,i=t(),c=e.tool??"eslint",o={sessionId:e.sessionId,source:"eslint",category:"lint",context:{sessionId:e.sessionId}},s={project:e.project,tool:c},l=r.messages.filter(m=>m.severity===2).length,p=r.messages.length-l,f=r.messages.slice(0,200),g=[];if(!r.toolError){g.push({...o,id:n(),timestamp:i,severity:"info",title:`ESLint clear: ${e.project}`,message:`lint run starting for ${e.project}`,fingerprint:`eslint:${e.project}:run-start`,raw:{...s,kind:"lint-run",phase:"start"}});for(let m of f){let a=m.ruleId??"fatal";g.push({...o,id:n(),timestamp:i,severity:m.severity===2?"error":"warning",title:`[${a}] ${m.message}`,message:m.message,location:{file:m.filePath,line:m.line,column:m.column},fingerprint:b(e.project,m),raw:{...s,kind:"lint-message",rule:a}})}}return g.push({...o,id:n(),timestamp:i,severity:"info",title:`lint run: ${e.project} \u2014 ${r.toolError?"tool error":`${l} error${l===1?"":"s"}, ${p} warning${p===1?"":"s"}`} (${r.durationMs}ms)`,message:r.toolError,fingerprint:`eslint:${e.project}:run-end`,raw:{...s,kind:"lint-run",phase:"end",status:r.toolError?"error":l>0?"failing":"clean",durationMs:r.durationMs,errorCount:l,warningCount:p,...r.messages.length>f.length?{truncatedMessages:r.messages.length-f.length}:{},...r.toolError?{error:r.toolError}:{}}}),g}d(w,"E"),u(w,"buildLintRunEvents");function k(r){let e=r.trim();if(!e)throw new Error("ESLint produced no JSON on stdout");let t;try{t=JSON.parse(e)}catch{throw new Error("ESLint stdout was not valid JSON")}if(!Array.isArray(t))throw new Error("ESLint JSON was not a results array");let n=[];for(let i of t){let c=i?.filePath??"";for(let o of i?.messages??[])n.push({filePath:c,ruleId:o.ruleId??null,severity:o.severity===2?2:1,message:o.message??"",...o.line!==void 0?{line:o.line}:{},...o.column!==void 0?{column:o.column}:{}})}return n}d(k,"S"),u(k,"parseEslintJson");var H=2;async function C(r,e){let t=e.eslintBin??"eslint",n=e.project??e.cwd,i=e.targets??["."],c=["--format","json",...e.args??[],...i],o=Date.now(),s=(e.spawnImpl??G)(t,c,{cwd:e.cwd,stdio:["ignore","pipe","pipe"]}),l="",p="";s.stdout?.on("data",a=>l+=a.toString("utf-8")),s.stderr?.on("data",a=>p+=a.toString("utf-8"));let f=await new Promise(a=>{s.on("error",y=>a({code:null,spawnError:y.message})),s.on("close",y=>a({code:y}))}),g=u(a=>{for(let y of w({meta:{sessionId:r.id,project:n},messages:a.messages,durationMs:Math.max(0,Date.now()-o),...a.toolError?{toolError:a.toolError}:{}}))r.bus.publish(y);return{errorCount:a.messages.filter(y=>y.severity===2).length,warningCount:a.messages.filter(y=>y.severity===1).length,toolFailed:a.toolError!==void 0,...a.toolError?{error:a.toolError}:{}}},"publish");if(f.spawnError)return g({messages:[],toolError:`could not spawn ${t}: ${f.spawnError}`});if(f.code===H||f.code===null)return g({messages:[],toolError:`eslint exited ${f.code??"abnormally"}${p.trim()?`: ${S(p)}`:""}`});let m;try{m=k(l)}catch(a){return g({messages:[],toolError:`${a.message}${p.trim()?` (stderr: ${S(p)})`:""}`})}return g({messages:m})}d(C,"L"),u(C,"runEslintOnce");function S(r){return r.trim().split(`
2
- `)[0].slice(0,300)}d(S,"$"),u(S,"firstLine");function x(r){let e=r.indexOf("--"),t=e===-1?r:r.slice(0,e),n=e===-1?[]:r.slice(e+1),i=[],c;for(let o=0;o<t.length;o++){let s=t[o];if(s==="--project"||s.startsWith("--project=")){let l=s==="--project"?t[++o]:s.slice(10);if(!l||l.startsWith("-"))return{ok:!1,error:"--project needs a value"};c=l;continue}if(s.startsWith("-"))return{ok:!1,error:`unknown option ${s} \u2014 ESLint's own options go after \`--\``};i.push(s)}return{ok:!0,args:{...c?{project:c}:{},targets:i.length>0?i:["."],eslintArgs:n}}}d(x,"U"),u(x,"parseLintArgs");function L(r,e){return r.project?r.project:r.targets.length===1&&r.targets[0]==="."?U($(e))||".":r.targets.join(" ")}d(L,"V"),u(L,"lintScope");function M(r,e=R){let t=$(r);for(;;){let n=Y(t,"node_modules",".bin","eslint");if(e(n))return n;let i=E(t);if(i===t)return;t=i}}d(M,"W"),u(M,"locateEslintBin");var I=u((r,e,t)=>{let n=Number(process.env[r]);return Number.isFinite(n)&&t(n)?Math.floor(n):e},"envNumber");function F(r){let e=!1;return{id:"pending",bus:{publish(t){e||(V(E(r),{recursive:!0}),v(r,{maxBytes:I("LENSMCP_EVENT_MAX_BYTES",50*1024*1024,n=>n>0),maxFiles:I("LENSMCP_EVENT_MAX_FILES",5,n=>n>=1&&n<=20),fs:{statSync:X,renameSync:q,unlinkSync:z,openSync:W,closeSync:T}}),e=!0),D(r,JSON.stringify(t)+`
3
- `)}}}}d(F,"G"),u(F,"fileBusSink");var N=u((r,e)=>`${r} ${e}${r===1?"":"s"}`,"plural");async function _(r){let e=x(r.argv);if(!e.ok)return{exitCode:2,lines:[`lint: ${e.error}`,"Usage: lensmcp lint [paths\u2026] [--project <label>] [--cwd <dir>] [-- <eslint args>]"]};let{args:t}=e,n=L(t,r.cwd),i=(r.deps?.sink??F)(r.eventFile);try{let c=(r.deps?.locate??M)(r.cwd);if(!c){let s=`no ESLint found \u2014 looked for node_modules/.bin/eslint at and above ${$(r.cwd)}`;for(let l of w({meta:{sessionId:i.id,project:n},messages:[],durationMs:0,toolError:s}))i.bus.publish(l);return{exitCode:2,lines:[`lint: ${s}`]}}let o=await(r.deps?.run??C)(i,{cwd:r.cwd,project:n,targets:t.targets,args:t.eslintArgs,eslintBin:c});return o.toolFailed?{exitCode:2,lines:[`lint: ESLint did not reach a verdict for ${n} \u2014 ${o.error??"unknown failure"}`]}:{exitCode:o.errorCount>0?1:0,lines:[`lint: ${N(o.errorCount,"error")}, ${N(o.warningCount,"warning")} in ${n}`,`published to ${r.eventFile} \u2014 read lint://errors`]}}catch(c){return{exitCode:2,lines:[`lint: could not write the run to the lens bus (${r.eventFile}) \u2014 ${c.message}`]}}}d(_,"k"),u(_,"runLintCli");var P=process.cwd(),K=process.env.LENSMCP_EVENT_FILE||J(P,".lensmcp","events.jsonl");_({argv:process.argv.slice(2),cwd:P,eventFile:K}).then(r=>{for(let e of r.lines)console.log(e);process.exitCode=r.exitCode},r=>{console.error(`lint: ${r instanceof Error?r.message:String(r)}`),process.exitCode=2});
1
+ "use strict";var B=Object.defineProperty;var d=(r,e)=>B(r,"name",{value:e,configurable:!0});import{createRequire as O}from"module";const rr=O(import.meta.url);var A=Object.defineProperty,u=d((r,e)=>A(r,"name",{value:e,configurable:!0}),"u");import{join as J}from"node:path";import{appendFileSync as D,closeSync as T,existsSync as R,mkdirSync as V,openSync as W,renameSync as q,statSync as X,unlinkSync as z}from"node:fs";import{basename as U,dirname as E,join as Y,resolve as $}from"node:path";function v(r,e){let{fs:t,maxBytes:n,maxFiles:i}=e,c=`${r}.rotate.lock`,o=e.staleLockMs??3e4,s;for(let l=0;l<2&&s===void 0;l++)try{s=t.openSync(c,"wx")}catch{try{if(Date.now()-t.statSync(c).mtimeMs<=o)return"busy";t.unlinkSync(c)}catch{}}if(s===void 0)return"busy";try{try{if(t.statSync(r).size<=n)return"not-needed"}catch{return"not-needed"}try{t.unlinkSync(`${r}.${i}`)}catch{}for(let l=i-1;l>=1;l--)try{t.renameSync(`${r}.${l}`,`${r}.${l+1}`)}catch{}try{t.renameSync(r,`${r}.1`)}catch{}return"rotated"}finally{try{t.closeSync(s)}catch{}try{t.unlinkSync(c)}catch{}}}d(v,"S"),u(v,"rotateBusFile");import{spawn as G}from"node:child_process";var h=0;function j(){return h=(h+1)%65535,`${Date.now().toString(36)}${h.toString(36)}${Math.random().toString(36).slice(2,8)}`}d(j,"_"),u(j,"defaultId");function b(r,e){return`eslint:${r}:${e.filePath}:${e.line??0}:${e.column??0}:${e.ruleId??"fatal"}`}d(b,"B"),u(b,"lintFingerprint");function w(r){let{meta:e}=r,t=e.now??Date.now,n=e.makeId??j,i=t(),c=e.tool??"eslint",o={sessionId:e.sessionId,source:"eslint",category:"lint",context:{sessionId:e.sessionId}},s={project:e.project,tool:c},l=r.messages.filter(m=>m.severity===2).length,p=r.messages.length-l,f=r.messages.slice(0,200),g=[];if(!r.toolError){g.push({...o,id:n(),timestamp:i,severity:"info",title:`ESLint clear: ${e.project}`,message:`lint run starting for ${e.project}`,fingerprint:`eslint:${e.project}:run-start`,raw:{...s,kind:"lint-run",phase:"start"}});for(let m of f){let a=m.ruleId??"fatal";g.push({...o,id:n(),timestamp:i,severity:m.severity===2?"error":"warning",title:`[${a}] ${m.message}`,message:m.message,location:{file:m.filePath,line:m.line,column:m.column},fingerprint:b(e.project,m),raw:{...s,kind:"lint-message",rule:a}})}}return g.push({...o,id:n(),timestamp:i,severity:"info",title:`lint run: ${e.project} \u2014 ${r.toolError?"tool error":`${l} error${l===1?"":"s"}, ${p} warning${p===1?"":"s"}`} (${r.durationMs}ms)`,message:r.toolError,fingerprint:`eslint:${e.project}:run-end`,raw:{...s,kind:"lint-run",phase:"end",status:r.toolError?"error":l>0?"failing":"clean",durationMs:r.durationMs,errorCount:l,warningCount:p,...r.messages.length>f.length?{truncatedMessages:r.messages.length-f.length}:{},...r.toolError?{error:r.toolError}:{}}}),g}d(w,"E"),u(w,"buildLintRunEvents");function k(r){let e=r.trim();if(!e)throw new Error("ESLint produced no JSON on stdout");let t;try{t=JSON.parse(e)}catch{throw new Error("ESLint stdout was not valid JSON")}if(!Array.isArray(t))throw new Error("ESLint JSON was not a results array");let n=[];for(let i of t){let c=i?.filePath??"";for(let o of i?.messages??[])n.push({filePath:c,ruleId:o.ruleId??null,severity:o.severity===2?2:1,message:o.message??"",...o.line!==void 0?{line:o.line}:{},...o.column!==void 0?{column:o.column}:{}})}return n}d(k,"w"),u(k,"parseEslintJson");var H=2;async function C(r,e){let t=e.eslintBin??"eslint",n=e.project??e.cwd,i=e.targets??["."],c=["--format","json",...e.args??[],...i],o=Date.now(),s=(e.spawnImpl??G)(t,c,{cwd:e.cwd,stdio:["ignore","pipe","pipe"]}),l="",p="";s.stdout?.on("data",a=>l+=a.toString("utf-8")),s.stderr?.on("data",a=>p+=a.toString("utf-8"));let f=await new Promise(a=>{s.on("error",y=>a({code:null,spawnError:y.message})),s.on("close",y=>a({code:y}))}),g=u(a=>{for(let y of w({meta:{sessionId:r.id,project:n},messages:a.messages,durationMs:Math.max(0,Date.now()-o),...a.toolError?{toolError:a.toolError}:{}}))r.bus.publish(y);return{errorCount:a.messages.filter(y=>y.severity===2).length,warningCount:a.messages.filter(y=>y.severity===1).length,toolFailed:a.toolError!==void 0,...a.toolError?{error:a.toolError}:{}}},"publish");if(f.spawnError)return g({messages:[],toolError:`could not spawn ${t}: ${f.spawnError}`});if(f.code===H||f.code===null)return g({messages:[],toolError:`eslint exited ${f.code??"abnormally"}${p.trim()?`: ${S(p)}`:""}`});let m;try{m=k(l)}catch(a){return g({messages:[],toolError:`${a.message}${p.trim()?` (stderr: ${S(p)})`:""}`})}return g({messages:m})}d(C,"L"),u(C,"runEslintOnce");function S(r){return r.trim().split(`
2
+ `)[0].slice(0,300)}d(S,"$"),u(S,"firstLine");function x(r){let e=r.indexOf("--"),t=e===-1?r:r.slice(0,e),n=e===-1?[]:r.slice(e+1),i=[],c;for(let o=0;o<t.length;o++){let s=t[o];if(s==="--project"||s.startsWith("--project=")){let l=s==="--project"?t[++o]:s.slice(10);if(!l||l.startsWith("-"))return{ok:!1,error:"--project needs a value"};c=l;continue}if(s.startsWith("-"))return{ok:!1,error:`unknown option ${s} \u2014 ESLint's own options go after \`--\``};i.push(s)}return{ok:!0,args:{...c?{project:c}:{},targets:i.length>0?i:["."],eslintArgs:n}}}d(x,"U"),u(x,"parseLintArgs");function L(r,e){return r.project?r.project:r.targets.length===1&&r.targets[0]==="."?U($(e))||".":r.targets.join(" ")}d(L,"V"),u(L,"lintScope");function M(r,e=R){let t=$(r);for(;;){let n=Y(t,"node_modules",".bin","eslint");if(e(n))return n;let i=E(t);if(i===t)return;t=i}}d(M,"Y"),u(M,"locateEslintBin");var I=u((r,e,t)=>{let n=Number(process.env[r]);return Number.isFinite(n)&&t(n)?Math.floor(n):e},"envNumber");function F(r){let e=!1;return{id:"pending",bus:{publish(t){e||(V(E(r),{recursive:!0}),v(r,{maxBytes:I("LENSMCP_EVENT_MAX_BYTES",50*1024*1024,n=>n>0),maxFiles:I("LENSMCP_EVENT_MAX_FILES",5,n=>n>=1&&n<=20),fs:{statSync:X,renameSync:q,unlinkSync:z,openSync:W,closeSync:T}}),e=!0),D(r,JSON.stringify(t)+`
3
+ `)}}}}d(F,"z"),u(F,"fileBusSink");var N=u((r,e)=>`${r} ${e}${r===1?"":"s"}`,"plural");async function _(r){let e=x(r.argv);if(!e.ok)return{exitCode:2,lines:[`lint: ${e.error}`,"Usage: lensmcp lint [paths\u2026] [--project <label>] [--cwd <dir>] [-- <eslint args>]"]};let{args:t}=e,n=L(t,r.cwd),i=(r.deps?.sink??F)(r.eventFile);try{let c=(r.deps?.locate??M)(r.cwd);if(!c){let s=`no ESLint found \u2014 looked for node_modules/.bin/eslint at and above ${$(r.cwd)}`;for(let l of w({meta:{sessionId:i.id,project:n},messages:[],durationMs:0,toolError:s}))i.bus.publish(l);return{exitCode:2,lines:[`lint: ${s}`]}}let o=await(r.deps?.run??C)(i,{cwd:r.cwd,project:n,targets:t.targets,args:t.eslintArgs,eslintBin:c});return o.toolFailed?{exitCode:2,lines:[`lint: ESLint did not reach a verdict for ${n} \u2014 ${o.error??"unknown failure"}`]}:{exitCode:o.errorCount>0?1:0,lines:[`lint: ${N(o.errorCount,"error")}, ${N(o.warningCount,"warning")} in ${n}`,`published to ${r.eventFile} \u2014 read lint://errors`]}}catch(c){return{exitCode:2,lines:[`lint: could not write the run to the lens bus (${r.eventFile}) \u2014 ${c.message}`]}}}d(_,"C"),u(_,"runLintCli");var P=process.cwd(),K=process.env.LENSMCP_EVENT_FILE||J(P,".lensmcp","events.jsonl");_({argv:process.argv.slice(2),cwd:P,eventFile:K}).then(r=>{for(let e of r.lines)console.log(e);process.exitCode=r.exitCode},r=>{console.error(`lint: ${r instanceof Error?r.message:String(r)}`),process.exitCode=2});