lensmcp 1.26.6 → 1.26.7

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
- "use strict";var y=Object.defineProperty;var i=(e,t)=>y(e,"name",{value:t,configurable:!0});var h=Object.defineProperty,a=i((e,t)=>h(e,"name",{value:t,configurable:!0}),"i");import{spawnSync as j}from"node:child_process";import{existsSync as v,readFileSync as k,realpathSync as N}from"node:fs";import{dirname as P,isAbsolute as A,join as c,resolve as x,sep as S}from"node:path";import{currentLink as C,currentVersion as I,storeHome as $}from"./store.js";export const MARKETPLACE="lensmcp-marketplace",PLUGIN="lensmcp",PLUGIN_ID=`${PLUGIN}@${MARKETPLACE}`,AGENTS=[{id:"claude",label:"Claude Code",bin:"claude",manifest:".claude-plugin/marketplace.json",pluginManifest:"plugin/.claude-plugin/plugin.json",since:"1.9.0",restartHint:"restart Claude Code (or run /plugin) for the new version to load"},{id:"codex",label:"Codex",bin:"codex",manifest:".agents/plugins/marketplace.json",pluginManifest:"plugins/lensmcp/.codex-plugin/plugin.json",since:"1.20.0",restartHint:"start a new Codex thread for the plugin to load (threads already open can report its hooks failed)"}];export function agentById(e){return AGENTS.find(t=>t.id===e)}i(agentById,"agentById"),a(agentById,"agentById");export function resolvePluginRoot(e){const t=e.exists??v,n=e.env??process.env,l=a(r=>{try{const s=JSON.parse(k(c(r,"package.json"),"utf8"));return typeof s.version=="string"?s.version:void 0}catch{return}},"readVersion"),o=a((r,s)=>{const f=l(r);return{root:r,source:s,...f?{version:f}:{}}},"decorate");if(e.from){const r=A(e.from)?e.from:x(e.cwd,e.from);return t(c(r,"package.json"))?o(r,"flag"):void 0}let u,d=x(e.cwd);for(let r=0;r<8;r++){const s=c(d,"node_modules","lensmcp");if(t(c(s,"package.json"))){u=s;break}const f=P(d);if(f===d)break;d=f}const p=$({env:n});if(n.LENSMCP_NO_STORE!=="1"&&I(p)&&!(u&&b(u)))return o(c(C(p),"node_modules","lensmcp"),"store");if(u)return o(u,"workspace");if(e.selfRoot&&t(c(e.selfRoot,"package.json")))return o(e.selfRoot,"self")}i(resolvePluginRoot,"resolvePluginRoot"),a(resolvePluginRoot,"resolvePluginRoot");function b(e){let t;try{t=N(e)}catch{return!1}const n=t.split(S);return n.at(-1)!=="lensmcp"||n.at(-2)!=="node_modules"}i(b,"w"),a(b,"linksCheckout");export function readPluginManifestVersion(e,t){try{const n=JSON.parse(k(c(e,t.pluginManifest),"utf8"));return typeof n.version=="string"?n.version:void 0}catch{return}}i(readPluginManifestVersion,"readPluginManifestVersion"),a(readPluginManifestVersion,"readPluginManifestVersion");export function planAgentInstall(e,t){if(e.id==="codex")return[[e.bin,"plugin","marketplace","add",t.root],[e.bin,"plugin","add",PLUGIN_ID]];const n=t.scope?["--scope",t.scope]:[];return[[e.bin,"plugin","marketplace","add",t.root],[e.bin,"plugin","marketplace","update",MARKETPLACE],[e.bin,"plugin","install",PLUGIN_ID,...n,"--yes"]]}i(planAgentInstall,"planAgentInstall"),a(planAgentInstall,"planAgentInstall");export function installAgentPlugin(e,t,n){const l=n.exists??v,o=planAgentInstall(e,t),u=o.map(r=>r.join(" ")),d=readPluginManifestVersion(t.root,e),p={agent:e.id,label:e.label,commands:u,...d?{version:d}:{}};if(!l(c(t.root,e.manifest)))return{...p,outcome:"skipped-not-packaged",detail:`${t.root} ships no ${e.manifest} \u2014 the ${e.label} plugin arrived in lensmcp ${e.since}. Upgrade first: \`lensmcp upgrade\`.`};for(const r of o){const[s,...f]=r,g=s===void 0?void 0:n.run(s,f);if(!g)return{...p,outcome:"skipped-no-cli",detail:`\`${e.bin}\` is not on PATH`};if(g.code!==0){const m=(g.stderr??g.stdout??"").trim().split(`
2
- `).filter(Boolean).pop();return{...p,outcome:"failed",detail:m&&m.length>0?m:`\`${r.join(" ")}\` exited ${g.code}`}}}return{...p,outcome:"installed",restartHint:e.restartHint}}i(installAgentPlugin,"installAgentPlugin"),a(installAgentPlugin,"installAgentPlugin");export function spawnAgentRunner(e,t=12e4){return(n,l)=>{try{const o=j(n,l,{encoding:"utf8",timeout:t,env:e,stdio:["ignore","pipe","pipe"]});return o.error&&o.error.code==="ENOENT"?void 0:{code:o.status??1,...o.stdout?{stdout:o.stdout}:{},...o.stderr?{stderr:o.stderr}:{}}}catch{return}}}i(spawnAgentRunner,"spawnAgentRunner"),a(spawnAgentRunner,"spawnAgentRunner");export function codexInstalledVersion(e){const t=e("codex",["plugin","list","--json"]);if(!(!t||t.code!==0||!t.stdout))try{const n=(JSON.parse(t.stdout).installed??[]).find(l=>l.pluginId===PLUGIN_ID||l.name===PLUGIN&&l.marketplaceName===MARKETPLACE)?.version;return typeof n=="string"?n:void 0}catch{return}}i(codexInstalledVersion,"codexInstalledVersion"),a(codexInstalledVersion,"codexInstalledVersion");
1
+ "use strict";var h=Object.defineProperty;var i=(e,t)=>h(e,"name",{value:t,configurable:!0});var j=Object.defineProperty,a=i((e,t)=>j(e,"name",{value:t,configurable:!0}),"d");import{spawnSync as A}from"node:child_process";import{existsSync as v,readFileSync as k,realpathSync as N}from"node:fs";import{dirname as P,isAbsolute as $,join as c,resolve as x,sep as S}from"node:path";import{currentLink as C,currentVersion as I,storeHome as R}from"./store.js";export const MARKETPLACE="lensmcp-marketplace",PLUGIN="lensmcp",PLUGIN_ID=`${PLUGIN}@${MARKETPLACE}`,AGENTS=[{id:"claude",label:"Claude Code",bin:"claude",manifest:".claude-plugin/marketplace.json",pluginManifest:"plugin/.claude-plugin/plugin.json",since:"1.9.0",restartHint:"restart Claude Code (or run /plugin) for the new version to load"},{id:"codex",label:"Codex",bin:"codex",manifest:".agents/plugins/marketplace.json",pluginManifest:"plugins/lensmcp/.codex-plugin/plugin.json",since:"1.20.0",restartHint:"start a new Codex thread for the plugin to load (threads already open can report its hooks failed)"}];export function agentById(e){return AGENTS.find(t=>t.id===e)}i(agentById,"agentById"),a(agentById,"agentById");export function resolvePluginRoot(e){const t=e.exists??v,n=e.env??process.env,r=a(s=>{try{const l=JSON.parse(k(c(s,"package.json"),"utf8"));return typeof l.version=="string"?l.version:void 0}catch{return}},"readVersion"),o=a((s,l)=>{const f=r(s);return{root:s,source:l,...f?{version:f}:{}}},"decorate");if(e.from){const s=$(e.from)?e.from:x(e.cwd,e.from);return t(c(s,"package.json"))?o(s,"flag"):void 0}let d,u=x(e.cwd);for(let s=0;s<8;s++){const l=c(u,"node_modules","lensmcp");if(t(c(l,"package.json"))){d=l;break}const f=P(u);if(f===u)break;u=f}const p=R({env:n});if(n.LENSMCP_NO_STORE!=="1"&&I(p)&&!(d&&b(d)))return o(c(C(p),"node_modules","lensmcp"),"store");if(d)return o(d,"workspace");if(e.selfRoot&&t(c(e.selfRoot,"package.json")))return o(e.selfRoot,"self")}i(resolvePluginRoot,"resolvePluginRoot"),a(resolvePluginRoot,"resolvePluginRoot");function b(e){let t;try{t=N(e)}catch{return!1}const n=t.split(S);return n.at(-1)!=="lensmcp"||n.at(-2)!=="node_modules"}i(b,"_"),a(b,"linksCheckout");export function readPluginManifestVersion(e,t){try{const n=JSON.parse(k(c(e,t.pluginManifest),"utf8"));return typeof n.version=="string"?n.version:void 0}catch{return}}i(readPluginManifestVersion,"readPluginManifestVersion"),a(readPluginManifestVersion,"readPluginManifestVersion");export function planAgentInstall(e,t){if(e.id==="codex")return[[e.bin,"plugin","marketplace","add",t.root],[e.bin,"plugin","add",PLUGIN_ID]];const n=t.scope?["--scope",t.scope]:[];return[[e.bin,"plugin","marketplace","add",t.root],[e.bin,"plugin","marketplace","update",MARKETPLACE],[e.bin,"plugin","install",PLUGIN_ID,...n,"--yes"]]}i(planAgentInstall,"planAgentInstall"),a(planAgentInstall,"planAgentInstall");export function installAgentPlugin(e,t,n){const r=n.exists??v,o=planAgentInstall(e,t),d=o.map(s=>s.join(" ")),u=readPluginManifestVersion(t.root,e),p={agent:e.id,label:e.label,commands:d,...u?{version:u}:{}};if(!r(c(t.root,e.manifest)))return{...p,outcome:"skipped-not-packaged",detail:`${t.root} ships no ${e.manifest} \u2014 the ${e.label} plugin arrived in lensmcp ${e.since}. Upgrade first: \`lensmcp upgrade\`.`};for(const s of o){const[l,...f]=s,g=l===void 0?void 0:y(l,f,n.run);if(!g)return{...p,outcome:"skipped-no-cli",detail:`\`${e.bin}\` is not on PATH`};if(g.code!==0){const m=(g.stderr??g.stdout??"").trim().split(`
2
+ `).filter(Boolean).pop();return{...p,outcome:"failed",detail:m&&m.length>0?m:`\`${s.join(" ")}\` exited ${g.code}`}}}return{...p,outcome:"installed",restartHint:e.restartHint}}i(installAgentPlugin,"installAgentPlugin"),a(installAgentPlugin,"installAgentPlugin");const w="already added from a different source";function y(e,t,n){const r=n(e,t),o=`${r?.stderr??""}${r?.stdout??""}`;return!r||r.code===0||!o.includes(w)?r:n(e,["plugin","marketplace","remove",MARKETPLACE])?.code===0?n(e,t):r}i(y,"E"),a(y,"runRepointing");export function spawnAgentRunner(e,t=12e4){return(n,r)=>{try{const o=A(n,r,{encoding:"utf8",timeout:t,env:e,stdio:["ignore","pipe","pipe"]});return o.error&&o.error.code==="ENOENT"?void 0:{code:o.status??1,...o.stdout?{stdout:o.stdout}:{},...o.stderr?{stderr:o.stderr}:{}}}catch{return}}}i(spawnAgentRunner,"spawnAgentRunner"),a(spawnAgentRunner,"spawnAgentRunner");export function codexInstalledVersion(e){const t=e("codex",["plugin","list","--json"]);if(!(!t||t.code!==0||!t.stdout))try{const n=(JSON.parse(t.stdout).installed??[]).find(r=>r.pluginId===PLUGIN_ID||r.name===PLUGIN&&r.marketplaceName===MARKETPLACE)?.version;return typeof n=="string"?n:void 0}catch{return}}i(codexInstalledVersion,"codexInstalledVersion"),a(codexInstalledVersion,"codexInstalledVersion");