claude-mem 11.0.0 → 12.0.1

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,80 +1,152 @@
1
1
  #!/usr/bin/env node
2
- var Ar=Object.create;var Rt=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var $r=Object.getOwnPropertyNames;var kr=Object.getPrototypeOf,Mr=Object.prototype.hasOwnProperty;var Ir=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var p=(t,e)=>()=>(t&&(e=t(t=0)),e);var On=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),X=(t,e)=>{for(var o in e)Rt(t,o,{get:e[o],enumerable:!0})},Or=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of $r(e))!Mr.call(t,s)&&s!==o&&Rt(t,s,{get:()=>e[s],enumerable:!(r=wr(e,s))||r.enumerable});return t};var re=(t,e,o)=>(o=t!=null?Ar(kr(t)):{},Or(e||!t||!t.__esModule?Rt(o,"default",{value:t,enumerable:!0}):o,t));var me=On((Au,Pt)=>{var ot=process||{},Tn=ot.argv||[],nt=ot.env||{},Tr=!(nt.NO_COLOR||Tn.includes("--no-color"))&&(!!nt.FORCE_COLOR||Tn.includes("--color")||ot.platform==="win32"||(ot.stdout||{}).isTTY&&nt.TERM!=="dumb"||!!nt.CI),Br=(t,e,o=t)=>r=>{let s=""+r,i=s.indexOf(e,t.length);return~i?t+Rr(s,e,o,i)+e:t+s+e},Rr=(t,e,o,r)=>{let s="",i=0;do s+=t.substring(i,r)+o,i=r+e.length,r=t.indexOf(e,i);while(~r);return s+t.substring(i)},Bn=(t=Tr)=>{let e=t?Br:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};Pt.exports=Bn();Pt.exports.createColors=Bn});import{existsSync as Pr,readFileSync as Lr}from"fs";function j(t,e){if(!Pr(t))return e;try{return JSON.parse(Lr(t,"utf-8"))}catch{throw new Error(`Corrupt JSON file, refusing to overwrite: ${t}`)}}var be=p(()=>{"use strict"});import{existsSync as Ae,mkdirSync as jr,readFileSync as Rn,writeFileSync as Nr}from"fs";import{homedir as Ur}from"os";import{dirname as Pn,join as M}from"path";import{fileURLToPath as Gr}from"url";function Lt(){return process.env.CLAUDE_CONFIG_DIR||M(Ur(),".claude")}function w(){return M(Lt(),"plugins","marketplaces","thedotmack")}function se(){return M(Lt(),"plugins")}function pe(){return M(se(),"known_marketplaces.json")}function ge(){return M(se(),"installed_plugins.json")}function fe(){return M(Lt(),"settings.json")}function jt(t){return M(se(),"cache","thedotmack","claude-mem",t)}function rt(){let t=Gr(import.meta.url),e=M(Pn(t),"..","..");if(!Ae(M(e,"package.json")))throw new Error(`npmPackageRootDirectory: expected package.json at ${e}. Bundle structure may have changed \u2014 update the path walk.`);return e}function Nt(){return M(rt(),"plugin")}function we(){let t=M(Nt(),".claude-plugin","plugin.json");if(Ae(t))try{let o=JSON.parse(Rn(t,"utf-8"));if(o.version)return o.version}catch{}let e=M(rt(),"package.json");if(Ae(e))try{let o=JSON.parse(Rn(e,"utf-8"));if(o.version)return o.version}catch{}return"0.0.0"}function st(){let t=w();return Ae(M(t,"plugin",".claude-plugin","plugin.json"))}function $e(t){Ae(t)||jr(t,{recursive:!0})}function z(t,e){$e(Pn(t)),Nr(t,JSON.stringify(e,null,2)+`
3
- `,"utf-8")}var Y,ie=p(()=>{"use strict";be();Y=process.platform==="win32"});var Gt=On((Ru,Ln)=>{"use strict";var Ut={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let o="";return t<0?o+=`\x1B[${-t}D`:t>0&&(o+=`\x1B[${t}C`),e<0?o+=`\x1B[${-e}A`:e>0&&(o+=`\x1B[${e}B`),o},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Wr={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},Hr={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let o=0;o<t;o++)e+=this.line+(o<t-1?Ut.up():"");return t&&(e+=Ut.left),e}};Ln.exports={cursor:Ut,scroll:Wr,erase:Hr,beep:"\x07"}});import{stdin as Vn,stdout as Xn}from"node:process";import*as Z from"node:readline";import jn from"node:readline";import{WriteStream as Jr}from"node:tty";function Kr({onlyFirst:t=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}function Yn(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Vr,"")}function qn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ke(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=Yn(t),t.length===0))return 0;t=t.replace(zr()," ");let o=e.ambiguousIsNarrow?1:2,r=0;for(let s of t){let i=s.codePointAt(0);if(!(i<=31||i>=127&&i<=159||i>=768&&i<=879))switch(Yr.eastAsianWidth(s)){case"F":case"W":r+=2;break;case"A":r+=o;break;default:r+=1}}return r}function es(){let t=new Map;for(let[e,o]of Object.entries(f)){for(let[r,s]of Object.entries(o))f[r]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},o[r]=f[r],t.set(s[0],s[1]);Object.defineProperty(f,e,{value:o,enumerable:!1})}return Object.defineProperty(f,"codes",{value:t,enumerable:!1}),f.color.close="\x1B[39m",f.bgColor.close="\x1B[49m",f.color.ansi=Nn(),f.color.ansi256=Un(),f.color.ansi16m=Gn(),f.bgColor.ansi=Nn(Wt),f.bgColor.ansi256=Un(Wt),f.bgColor.ansi16m=Gn(Wt),Object.defineProperties(f,{rgbToAnsi256:{value:(e,o,r)=>e===o&&o===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(o/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:e=>{let o=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!o)return[0,0,0];let[r]=o;r.length===3&&(r=[...r].map(i=>i+i).join(""));let s=Number.parseInt(r,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:e=>f.rgbToAnsi256(...f.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let o,r,s;if(e>=232)o=((e-232)*10+8)/255,r=o,s=o;else{e-=16;let u=e%36;o=Math.floor(e/36)/5,r=Math.floor(u/6)/5,s=u%6/5}let i=Math.max(o,r,s)*2;if(i===0)return 30;let n=30+(Math.round(s)<<2|Math.round(r)<<1|Math.round(o));return i===2&&(n+=60),n},enumerable:!1},rgbToAnsi:{value:(e,o,r)=>f.ansi256ToAnsi(f.rgbToAnsi256(e,o,r)),enumerable:!1},hexToAnsi:{value:e=>f.ansi256ToAnsi(f.hexToAnsi256(e)),enumerable:!1}}),f}function Jn(t,e,o){return String(t).normalize().replace(/\r\n/g,`
2
+ var Qr=Object.create;var Wt=Object.defineProperty;var es=Object.getOwnPropertyDescriptor;var ts=Object.getOwnPropertyNames;var ns=Object.getPrototypeOf,os=Object.prototype.hasOwnProperty;var rs=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var f=(t,e)=>()=>(t&&(e=t(t=0)),e);var Hn=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),X=(t,e)=>{for(var o in e)Wt(t,o,{get:e[o],enumerable:!0})},ss=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ts(e))!os.call(t,s)&&s!==o&&Wt(t,s,{get:()=>e[s],enumerable:!(r=es(e,s))||r.enumerable});return t};var ie=(t,e,o)=>(o=t!=null?Qr(ns(t)):{},ss(e||!t||!t.__esModule?Wt(o,"default",{value:t,enumerable:!0}):o,t));var ge=Hn((ca,Ht)=>{var lt=process||{},Jn=lt.argv||[],ct=lt.env||{},is=!(ct.NO_COLOR||Jn.includes("--no-color"))&&(!!ct.FORCE_COLOR||Jn.includes("--color")||lt.platform==="win32"||(lt.stdout||{}).isTTY&&ct.TERM!=="dumb"||!!ct.CI),us=(t,e,o=t)=>r=>{let s=""+r,i=s.indexOf(e,t.length);return~i?t+as(s,e,o,i)+e:t+s+e},as=(t,e,o,r)=>{let s="",i=0;do s+=t.substring(i,r)+o,i=r+e.length,r=t.indexOf(e,i);while(~r);return s+t.substring(i)},Kn=(t=is)=>{let e=t?us:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};Ht.exports=Kn();Ht.exports.createColors=Kn});import{existsSync as cs,readFileSync as ls}from"fs";function U(t,e){if(!cs(t))return e;try{return JSON.parse(ls(t,"utf-8"))}catch{throw new Error(`Corrupt JSON file, refusing to overwrite: ${t}`)}}var Me=f(()=>{"use strict"});import{existsSync as ke,mkdirSync as Ds,readFileSync as Vn,writeFileSync as ds}from"fs";import{homedir as ms}from"os";import{dirname as Xn,join as I}from"path";import{fileURLToPath as ps}from"url";function Jt(){return process.env.CLAUDE_CONFIG_DIR||I(ms(),".claude")}function $(){return I(Jt(),"plugins","marketplaces","thedotmack")}function ue(){return I(Jt(),"plugins")}function fe(){return I(ue(),"known_marketplaces.json")}function Ce(){return I(ue(),"installed_plugins.json")}function he(){return I(Jt(),"settings.json")}function Kt(t){return I(ue(),"cache","thedotmack","claude-mem",t)}function Dt(){let t=ps(import.meta.url),e=I(Xn(t),"..","..");if(!ke(I(e,"package.json")))throw new Error(`npmPackageRootDirectory: expected package.json at ${e}. Bundle structure may have changed \u2014 update the path walk.`);return e}function Vt(){return I(Dt(),"plugin")}function Ie(){let t=I(Vt(),".claude-plugin","plugin.json");if(ke(t))try{let o=JSON.parse(Vn(t,"utf-8"));if(o.version)return o.version}catch{}let e=I(Dt(),"package.json");if(ke(e))try{let o=JSON.parse(Vn(e,"utf-8"));if(o.version)return o.version}catch{}return"0.0.0"}function dt(){let t=$();return ke(I(t,"plugin",".claude-plugin","plugin.json"))}function Oe(t){ke(t)||Ds(t,{recursive:!0})}function Q(t,e){Oe(Xn(t)),ds(t,JSON.stringify(e,null,2)+`
3
+ `,"utf-8")}var z,ae=f(()=>{"use strict";Me();z=process.platform==="win32"});var Yt=Hn((ha,Yn)=>{"use strict";var Xt={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let o="";return t<0?o+=`\x1B[${-t}D`:t>0&&(o+=`\x1B[${t}C`),e<0?o+=`\x1B[${-e}A`:e>0&&(o+=`\x1B[${e}B`),o},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},gs={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},fs={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let o=0;o<t;o++)e+=this.line+(o<t-1?Xt.up():"");return t&&(e+=Xt.left),e}};Yn.exports={cursor:Xt,scroll:gs,erase:fs,beep:"\x07"}});import{stdin as ro,stdout as so}from"node:process";import*as ee from"node:readline";import qn from"node:readline";import{WriteStream as Cs}from"node:tty";function hs({onlyFirst:t=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}function io(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Es,"")}function uo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Te(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=io(t),t.length===0))return 0;t=t.replace(_s()," ");let o=e.ambiguousIsNarrow?1:2,r=0;for(let s of t){let i=s.codePointAt(0);if(!(i<=31||i>=127&&i<=159||i>=768&&i<=879))switch(ys.eastAsianWidth(s)){case"F":case"W":r+=2;break;case"A":r+=o;break;default:r+=1}}return r}function As(){let t=new Map;for(let[e,o]of Object.entries(C)){for(let[r,s]of Object.entries(o))C[r]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},o[r]=C[r],t.set(s[0],s[1]);Object.defineProperty(C,e,{value:o,enumerable:!1})}return Object.defineProperty(C,"codes",{value:t,enumerable:!1}),C.color.close="\x1B[39m",C.bgColor.close="\x1B[49m",C.color.ansi=zn(),C.color.ansi256=Zn(),C.color.ansi16m=Qn(),C.bgColor.ansi=zn(qt),C.bgColor.ansi256=Zn(qt),C.bgColor.ansi16m=Qn(qt),Object.defineProperties(C,{rgbToAnsi256:{value:(e,o,r)=>e===o&&o===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(o/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:e=>{let o=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!o)return[0,0,0];let[r]=o;r.length===3&&(r=[...r].map(i=>i+i).join(""));let s=Number.parseInt(r,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:e=>C.rgbToAnsi256(...C.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let o,r,s;if(e>=232)o=((e-232)*10+8)/255,r=o,s=o;else{e-=16;let u=e%36;o=Math.floor(e/36)/5,r=Math.floor(u/6)/5,s=u%6/5}let i=Math.max(o,r,s)*2;if(i===0)return 30;let n=30+(Math.round(s)<<2|Math.round(r)<<1|Math.round(o));return i===2&&(n+=60),n},enumerable:!1},rgbToAnsi:{value:(e,o,r)=>C.ansi256ToAnsi(C.rgbToAnsi256(e,o,r)),enumerable:!1},hexToAnsi:{value:e=>C.ansi256ToAnsi(C.hexToAnsi256(e)),enumerable:!1}}),C}function no(t,e,o){return String(t).normalize().replace(/\r\n/g,`
4
4
  `).split(`
5
- `).map(r=>is(r,e,o)).join(`
6
- `)}function Xt(t,e){if(typeof t=="string")return ut.aliases.get(t)===e;for(let o of t)if(o!==void 0&&Xt(o,e))return!0;return!1}function as(t,e){if(t===e)return;let o=t.split(`
5
+ `).map(r=>Is(r,e,o)).join(`
6
+ `)}function tn(t,e){if(typeof t=="string")return pt.aliases.get(t)===e;for(let o of t)if(o!==void 0&&tn(o,e))return!0;return!1}function Ts(t,e){if(t===e)return;let o=t.split(`
7
7
  `),r=e.split(`
8
- `),s=[];for(let i=0;i<Math.max(o.length,r.length);i++)o[i]!==r[i]&&s.push(i);return s}function Q(t){return t===Jt}function it(t,e){let o=t;o.isTTY&&o.setRawMode(e)}function eo({input:t=Vn,output:e=Xn,overwrite:o=!0,hideCursor:r=!0}={}){let s=Z.createInterface({input:t,output:e,prompt:"",tabSize:1});Z.emitKeypressEvents(t,s),t.isTTY&&t.setRawMode(!0);let i=(n,{name:u,sequence:c})=>{let D=String(n);if(Xt([D,u,c],"cancel")){r&&e.write(S.cursor.show),process.exit(0);return}if(!o)return;Z.moveCursor(e,u==="return"?0:-1,u==="return"?-1:0,()=>{Z.clearLine(e,1,()=>{t.once("keypress",i)})})};return r&&e.write(S.cursor.hide),t.once("keypress",i),()=>{t.off("keypress",i),r&&e.write(S.cursor.show),t.isTTY&&!cs&&t.setRawMode(!1),s.terminal=!1,s.close()}}var S,Vr,zn,Xr,Yr,qr,zr,Wt,Nn,Un,Gn,f,Zr,Qr,ts,lt,ns,Kt,Zn,os,Qn,Vt,Wn,Hn,rs,Ht,ss,is,us,ut,cs,Jt,ls,Ds,I,at,ct,ds,ms,Kn,to,Yt=p(()=>{S=re(Gt(),1);Vr=Kr();zn={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(r){var s=r.charCodeAt(0),i=r.length==2?r.charCodeAt(1):0,n=s;return 55296<=s&&s<=56319&&56320<=i&&i<=57343&&(s&=1023,i&=1023,n=s<<10|i,n+=65536),n==12288||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":n==8361||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||n==172||n==175||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":n==161||n==164||167<=n&&n<=168||n==170||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||n==198||n==208||215<=n&&n<=216||222<=n&&n<=225||n==230||232<=n&&n<=234||236<=n&&n<=237||n==240||242<=n&&n<=243||247<=n&&n<=250||n==252||n==254||n==257||n==273||n==275||n==283||294<=n&&n<=295||n==299||305<=n&&n<=307||n==312||319<=n&&n<=322||n==324||328<=n&&n<=331||n==333||338<=n&&n<=339||358<=n&&n<=359||n==363||n==462||n==464||n==466||n==468||n==470||n==472||n==474||n==476||n==593||n==609||n==708||n==711||713<=n&&n<=715||n==717||n==720||728<=n&&n<=731||n==733||n==735||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||n==1025||1040<=n&&n<=1103||n==1105||n==8208||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||n==8240||8242<=n&&n<=8243||n==8245||n==8251||n==8254||n==8308||n==8319||8321<=n&&n<=8324||n==8364||n==8451||n==8453||n==8457||n==8467||n==8470||8481<=n&&n<=8482||n==8486||n==8491||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||n==8585||8592<=n&&n<=8601||8632<=n&&n<=8633||n==8658||n==8660||n==8679||n==8704||8706<=n&&n<=8707||8711<=n&&n<=8712||n==8715||n==8719||n==8721||n==8725||n==8730||8733<=n&&n<=8736||n==8739||n==8741||8743<=n&&n<=8748||n==8750||8756<=n&&n<=8759||8764<=n&&n<=8765||n==8776||n==8780||n==8786||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||n==8853||n==8857||n==8869||n==8895||n==8978||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||n==9675||9678<=n&&n<=9681||9698<=n&&n<=9701||n==9711||9733<=n&&n<=9734||n==9737||9742<=n&&n<=9743||9748<=n&&n<=9749||n==9756||n==9758||n==9792||n==9794||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||n==9839||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||n==9955||9960<=n&&n<=9983||n==10045||n==10071||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||n==65533||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"},e.characterLength=function(r){var s=this.eastAsianWidth(r);return s=="F"||s=="W"||s=="A"?2:1};function o(r){return r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(r){for(var s=o(r),i=0,n=0;n<s.length;n++)i=i+this.characterLength(s[n]);return i},e.slice=function(r,s,i){textLen=e.length(r),s=s||0,i=i||1,s<0&&(s=textLen+s),i<0&&(i=textLen+i);for(var n="",u=0,c=o(r),D=0;D<c.length;D++){var d=c[D],l=e.length(d);if(u>=s-(l==2?1:0))if(u+l<=i)n+=d;else break;u+=l}return n}})(zn);Xr=zn.exports,Yr=qn(Xr),qr=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},zr=qn(qr);Wt=10,Nn=(t=0)=>e=>`\x1B[${e+t}m`,Un=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,Gn=(t=0)=>(e,o,r)=>`\x1B[${38+t};2;${e};${o};${r}m`,f={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(f.modifier);Zr=Object.keys(f.color),Qr=Object.keys(f.bgColor);[...Zr,...Qr];ts=es(),lt=new Set(["\x1B","\x9B"]),ns=39,Kt="\x07",Zn="[",os="]",Qn="m",Vt=`${os}8;;`,Wn=t=>`${lt.values().next().value}${Zn}${t}${Qn}`,Hn=t=>`${lt.values().next().value}${Vt}${t}${Kt}`,rs=t=>t.split(" ").map(e=>ke(e)),Ht=(t,e,o)=>{let r=[...e],s=!1,i=!1,n=ke(Yn(t[t.length-1]));for(let[u,c]of r.entries()){let D=ke(c);if(n+D<=o?t[t.length-1]+=c:(t.push(c),n=0),lt.has(c)&&(s=!0,i=r.slice(u+1).join("").startsWith(Vt)),s){i?c===Kt&&(s=!1,i=!1):c===Qn&&(s=!1);continue}n+=D,n===o&&u<r.length-1&&(t.push(""),n=0)}!n&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},ss=t=>{let e=t.split(" "),o=e.length;for(;o>0&&!(ke(e[o-1])>0);)o--;return o===e.length?t:e.slice(0,o).join(" ")+e.slice(o).join("")},is=(t,e,o={})=>{if(o.trim!==!1&&t.trim()==="")return"";let r="",s,i,n=rs(t),u=[""];for(let[D,d]of t.split(" ").entries()){o.trim!==!1&&(u[u.length-1]=u[u.length-1].trimStart());let l=ke(u[u.length-1]);if(D!==0&&(l>=e&&(o.wordWrap===!1||o.trim===!1)&&(u.push(""),l=0),(l>0||o.trim===!1)&&(u[u.length-1]+=" ",l++)),o.hard&&n[D]>e){let y=e-l,v=1+Math.floor((n[D]-y-1)/e);Math.floor((n[D]-1)/e)<v&&u.push(""),Ht(u,d,e);continue}if(l+n[D]>e&&l>0&&n[D]>0){if(o.wordWrap===!1&&l<e){Ht(u,d,e);continue}u.push("")}if(l+n[D]>e&&o.wordWrap===!1){Ht(u,d,e);continue}u[u.length-1]+=d}o.trim!==!1&&(u=u.map(D=>ss(D)));let c=[...u.join(`
9
- `)];for(let[D,d]of c.entries()){if(r+=d,lt.has(d)){let{groups:y}=new RegExp(`(?:\\${Zn}(?<code>\\d+)m|\\${Vt}(?<uri>.*)${Kt})`).exec(c.slice(D).join(""))||{groups:{}};if(y.code!==void 0){let v=Number.parseFloat(y.code);s=v===ns?void 0:v}else y.uri!==void 0&&(i=y.uri.length===0?void 0:y.uri)}let l=ts.codes.get(Number(s));c[D+1]===`
10
- `?(i&&(r+=Hn("")),s&&l&&(r+=Wn(l))):d===`
11
- `&&(s&&l&&(r+=Wn(s)),i&&(r+=Hn(i)))}return r};us=["up","down","left","right","space","enter","cancel"],ut={actions:new Set(us),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};cs=globalThis.process.platform.startsWith("win"),Jt=Symbol("clack:cancel");ls=Object.defineProperty,Ds=(t,e,o)=>e in t?ls(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,I=(t,e,o)=>(Ds(t,typeof e!="symbol"?e+"":e,o),o),at=class{constructor(e,o=!0){I(this,"input"),I(this,"output"),I(this,"_abortSignal"),I(this,"rl"),I(this,"opts"),I(this,"_render"),I(this,"_track",!1),I(this,"_prevFrame",""),I(this,"_subscribers",new Map),I(this,"_cursor",0),I(this,"state","initial"),I(this,"error",""),I(this,"value");let{input:r=Vn,output:s=Xn,render:i,signal:n,...u}=e;this.opts=u,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=o,this._abortSignal=n,this.input=r,this.output=s}unsubscribe(){this._subscribers.clear()}setSubscriber(e,o){let r=this._subscribers.get(e)??[];r.push(o),this._subscribers.set(e,r)}on(e,o){this.setSubscriber(e,{cb:o})}once(e,o){this.setSubscriber(e,{cb:o,once:!0})}emit(e,...o){let r=this._subscribers.get(e)??[],s=[];for(let i of r)i.cb(...o),i.once&&s.push(()=>r.splice(r.indexOf(i),1));for(let i of s)i()}prompt(){return new Promise((e,o)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Jt);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let r=new Jr(0);r._write=(s,i,n)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),n()},this.input.pipe(r),this.rl=jn.createInterface({input:this.input,output:r,tabSize:2,prompt:"",escapeCodeTimeout:50}),jn.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),it(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(S.cursor.show),this.output.off("resize",this.render),it(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(S.cursor.show),this.output.off("resize",this.render),it(this.input,!1),e(Jt)})})}onKeypress(e,o){if(this.state==="error"&&(this.state="active"),o?.name&&(!this._track&&ut.aliases.has(o.name)&&this.emit("cursor",ut.aliases.get(o.name)),ut.actions.has(o.name)&&this.emit("cursor",o.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),e===" "&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),e&&this.emit("key",e.toLowerCase()),o?.name==="return"){if(this.opts.validate){let r=this.opts.validate(this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}Xt([e,o?.name,o?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
12
- `),it(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=Jn(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
13
- `).length-1;this.output.write(S.cursor.move(-999,e*-1))}render(){let e=Jn(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(S.cursor.hide);else{let o=as(this._prevFrame,e);if(this.restoreCursor(),o&&o?.length===1){let r=o[0];this.output.write(S.cursor.move(0,r)),this.output.write(S.erase.lines(1));let s=e.split(`
8
+ `),s=[];for(let i=0;i<Math.max(o.length,r.length);i++)o[i]!==r[i]&&s.push(i);return s}function te(t){return t===Zt}function mt(t,e){let o=t;o.isTTY&&o.setRawMode(e)}function Do({input:t=ro,output:e=so,overwrite:o=!0,hideCursor:r=!0}={}){let s=ee.createInterface({input:t,output:e,prompt:"",tabSize:1});ee.emitKeypressEvents(t,s),t.isTTY&&t.setRawMode(!0);let i=(n,{name:u,sequence:c})=>{let D=String(n);if(tn([D,u,c],"cancel")){r&&e.write(S.cursor.show),process.exit(0);return}if(!o)return;ee.moveCursor(e,u==="return"?0:-1,u==="return"?-1:0,()=>{ee.clearLine(e,1,()=>{t.once("keypress",i)})})};return r&&e.write(S.cursor.hide),t.once("keypress",i),()=>{t.off("keypress",i),r&&e.write(S.cursor.show),t.isTTY&&!Rs&&t.setRawMode(!1),s.terminal=!1,s.close()}}var S,Es,ao,Fs,ys,xs,_s,qt,zn,Zn,Qn,C,vs,Ss,bs,Ct,ws,Qt,co,$s,lo,en,eo,to,Ms,zt,ks,Is,Os,pt,Rs,Zt,Bs,Ps,O,gt,ft,Ls,Ns,oo,mo,nn=f(()=>{S=ie(Yt(),1);Es=hs();ao={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(r){var s=r.charCodeAt(0),i=r.length==2?r.charCodeAt(1):0,n=s;return 55296<=s&&s<=56319&&56320<=i&&i<=57343&&(s&=1023,i&=1023,n=s<<10|i,n+=65536),n==12288||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":n==8361||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||n==172||n==175||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":n==161||n==164||167<=n&&n<=168||n==170||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||n==198||n==208||215<=n&&n<=216||222<=n&&n<=225||n==230||232<=n&&n<=234||236<=n&&n<=237||n==240||242<=n&&n<=243||247<=n&&n<=250||n==252||n==254||n==257||n==273||n==275||n==283||294<=n&&n<=295||n==299||305<=n&&n<=307||n==312||319<=n&&n<=322||n==324||328<=n&&n<=331||n==333||338<=n&&n<=339||358<=n&&n<=359||n==363||n==462||n==464||n==466||n==468||n==470||n==472||n==474||n==476||n==593||n==609||n==708||n==711||713<=n&&n<=715||n==717||n==720||728<=n&&n<=731||n==733||n==735||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||n==1025||1040<=n&&n<=1103||n==1105||n==8208||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||n==8240||8242<=n&&n<=8243||n==8245||n==8251||n==8254||n==8308||n==8319||8321<=n&&n<=8324||n==8364||n==8451||n==8453||n==8457||n==8467||n==8470||8481<=n&&n<=8482||n==8486||n==8491||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||n==8585||8592<=n&&n<=8601||8632<=n&&n<=8633||n==8658||n==8660||n==8679||n==8704||8706<=n&&n<=8707||8711<=n&&n<=8712||n==8715||n==8719||n==8721||n==8725||n==8730||8733<=n&&n<=8736||n==8739||n==8741||8743<=n&&n<=8748||n==8750||8756<=n&&n<=8759||8764<=n&&n<=8765||n==8776||n==8780||n==8786||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||n==8853||n==8857||n==8869||n==8895||n==8978||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||n==9675||9678<=n&&n<=9681||9698<=n&&n<=9701||n==9711||9733<=n&&n<=9734||n==9737||9742<=n&&n<=9743||9748<=n&&n<=9749||n==9756||n==9758||n==9792||n==9794||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||n==9839||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||n==9955||9960<=n&&n<=9983||n==10045||n==10071||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||n==65533||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"},e.characterLength=function(r){var s=this.eastAsianWidth(r);return s=="F"||s=="W"||s=="A"?2:1};function o(r){return r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(r){for(var s=o(r),i=0,n=0;n<s.length;n++)i=i+this.characterLength(s[n]);return i},e.slice=function(r,s,i){textLen=e.length(r),s=s||0,i=i||1,s<0&&(s=textLen+s),i<0&&(i=textLen+i);for(var n="",u=0,c=o(r),D=0;D<c.length;D++){var d=c[D],l=e.length(d);if(u>=s-(l==2?1:0))if(u+l<=i)n+=d;else break;u+=l}return n}})(ao);Fs=ao.exports,ys=uo(Fs),xs=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},_s=uo(xs);qt=10,zn=(t=0)=>e=>`\x1B[${e+t}m`,Zn=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,Qn=(t=0)=>(e,o,r)=>`\x1B[${38+t};2;${e};${o};${r}m`,C={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(C.modifier);vs=Object.keys(C.color),Ss=Object.keys(C.bgColor);[...vs,...Ss];bs=As(),Ct=new Set(["\x1B","\x9B"]),ws=39,Qt="\x07",co="[",$s="]",lo="m",en=`${$s}8;;`,eo=t=>`${Ct.values().next().value}${co}${t}${lo}`,to=t=>`${Ct.values().next().value}${en}${t}${Qt}`,Ms=t=>t.split(" ").map(e=>Te(e)),zt=(t,e,o)=>{let r=[...e],s=!1,i=!1,n=Te(io(t[t.length-1]));for(let[u,c]of r.entries()){let D=Te(c);if(n+D<=o?t[t.length-1]+=c:(t.push(c),n=0),Ct.has(c)&&(s=!0,i=r.slice(u+1).join("").startsWith(en)),s){i?c===Qt&&(s=!1,i=!1):c===lo&&(s=!1);continue}n+=D,n===o&&u<r.length-1&&(t.push(""),n=0)}!n&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},ks=t=>{let e=t.split(" "),o=e.length;for(;o>0&&!(Te(e[o-1])>0);)o--;return o===e.length?t:e.slice(0,o).join(" ")+e.slice(o).join("")},Is=(t,e,o={})=>{if(o.trim!==!1&&t.trim()==="")return"";let r="",s,i,n=Ms(t),u=[""];for(let[D,d]of t.split(" ").entries()){o.trim!==!1&&(u[u.length-1]=u[u.length-1].trimStart());let l=Te(u[u.length-1]);if(D!==0&&(l>=e&&(o.wordWrap===!1||o.trim===!1)&&(u.push(""),l=0),(l>0||o.trim===!1)&&(u[u.length-1]+=" ",l++)),o.hard&&n[D]>e){let x=e-l,v=1+Math.floor((n[D]-x-1)/e);Math.floor((n[D]-1)/e)<v&&u.push(""),zt(u,d,e);continue}if(l+n[D]>e&&l>0&&n[D]>0){if(o.wordWrap===!1&&l<e){zt(u,d,e);continue}u.push("")}if(l+n[D]>e&&o.wordWrap===!1){zt(u,d,e);continue}u[u.length-1]+=d}o.trim!==!1&&(u=u.map(D=>ks(D)));let c=[...u.join(`
9
+ `)];for(let[D,d]of c.entries()){if(r+=d,Ct.has(d)){let{groups:x}=new RegExp(`(?:\\${co}(?<code>\\d+)m|\\${en}(?<uri>.*)${Qt})`).exec(c.slice(D).join(""))||{groups:{}};if(x.code!==void 0){let v=Number.parseFloat(x.code);s=v===ws?void 0:v}else x.uri!==void 0&&(i=x.uri.length===0?void 0:x.uri)}let l=bs.codes.get(Number(s));c[D+1]===`
10
+ `?(i&&(r+=to("")),s&&l&&(r+=eo(l))):d===`
11
+ `&&(s&&l&&(r+=eo(s)),i&&(r+=to(i)))}return r};Os=["up","down","left","right","space","enter","cancel"],pt={actions:new Set(Os),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};Rs=globalThis.process.platform.startsWith("win"),Zt=Symbol("clack:cancel");Bs=Object.defineProperty,Ps=(t,e,o)=>e in t?Bs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,O=(t,e,o)=>(Ps(t,typeof e!="symbol"?e+"":e,o),o),gt=class{constructor(e,o=!0){O(this,"input"),O(this,"output"),O(this,"_abortSignal"),O(this,"rl"),O(this,"opts"),O(this,"_render"),O(this,"_track",!1),O(this,"_prevFrame",""),O(this,"_subscribers",new Map),O(this,"_cursor",0),O(this,"state","initial"),O(this,"error",""),O(this,"value");let{input:r=ro,output:s=so,render:i,signal:n,...u}=e;this.opts=u,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=o,this._abortSignal=n,this.input=r,this.output=s}unsubscribe(){this._subscribers.clear()}setSubscriber(e,o){let r=this._subscribers.get(e)??[];r.push(o),this._subscribers.set(e,r)}on(e,o){this.setSubscriber(e,{cb:o})}once(e,o){this.setSubscriber(e,{cb:o,once:!0})}emit(e,...o){let r=this._subscribers.get(e)??[],s=[];for(let i of r)i.cb(...o),i.once&&s.push(()=>r.splice(r.indexOf(i),1));for(let i of s)i()}prompt(){return new Promise((e,o)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Zt);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let r=new Cs(0);r._write=(s,i,n)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),n()},this.input.pipe(r),this.rl=qn.createInterface({input:this.input,output:r,tabSize:2,prompt:"",escapeCodeTimeout:50}),qn.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),mt(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(S.cursor.show),this.output.off("resize",this.render),mt(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(S.cursor.show),this.output.off("resize",this.render),mt(this.input,!1),e(Zt)})})}onKeypress(e,o){if(this.state==="error"&&(this.state="active"),o?.name&&(!this._track&&pt.aliases.has(o.name)&&this.emit("cursor",pt.aliases.get(o.name)),pt.actions.has(o.name)&&this.emit("cursor",o.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),e===" "&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),e&&this.emit("key",e.toLowerCase()),o?.name==="return"){if(this.opts.validate){let r=this.opts.validate(this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}tn([e,o?.name,o?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
12
+ `),mt(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=no(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
13
+ `).length-1;this.output.write(S.cursor.move(-999,e*-1))}render(){let e=no(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(S.cursor.hide);else{let o=Ts(this._prevFrame,e);if(this.restoreCursor(),o&&o?.length===1){let r=o[0];this.output.write(S.cursor.move(0,r)),this.output.write(S.erase.lines(1));let s=e.split(`
14
14
  `);this.output.write(s[r]),this._prevFrame=e,this.output.write(S.cursor.move(0,s.length-r-1));return}if(o&&o?.length>1){let r=o[0];this.output.write(S.cursor.move(0,r)),this.output.write(S.erase.down());let s=e.split(`
15
15
  `).slice(r);this.output.write(s.join(`
16
- `)),this._prevFrame=e;return}this.output.write(S.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},ct=class extends at{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",o=>{this.output.write(S.cursor.move(0,-1)),this.value=o,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}},ds=Object.defineProperty,ms=(t,e,o)=>e in t?ds(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Kn=(t,e,o)=>(ms(t,typeof e!="symbol"?e+"":e,o),o),to=class extends at{constructor(t){super(t,!1),Kn(this,"options"),Kn(this,"cursor",0),this.options=t.options,this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:e})=>e===t.cursorAt),0),this.on("key",e=>{e==="a"&&this.toggleAll()}),this.on("cursor",e=>{switch(e){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let t=this.value.length===this.options.length;this.value=t?[]:this.options.map(e=>e.value)}toggleValue(){let t=this.value.includes(this._value);this.value=t?this.value.filter(e=>e!==this._value):[...this.value,this._value]}}});import{stripVTControlCharacters as qt}from"node:util";import N from"node:process";function ps(){return N.platform!=="win32"?N.env.TERM!=="linux":!!N.env.CI||!!N.env.WT_SESSION||!!N.env.TERMINUS_SUBLIME||N.env.ConEmuTask==="{cmd::Cmder}"||N.env.TERM_PROGRAM==="Terminus-Sublime"||N.env.TERM_PROGRAM==="vscode"||N.env.TERM==="xterm-256color"||N.env.TERM==="alacritty"||N.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var a,Dt,zt,E,gs,uo,ao,dt,fs,h,Me,no,oo,Cs,ro,hs,zu,so,Es,Fs,ys,xs,vs,Ss,_s,co,io,Ie,lo,Oe,Te,mt,ue,b,bs,pt,Zt=p(()=>{Yt();Yt();a=re(me(),1),Dt=re(Gt(),1);zt=ps(),E=(t,e)=>zt?t:e,gs=E("\u25C6","*"),uo=E("\u25A0","x"),ao=E("\u25B2","x"),dt=E("\u25C7","o"),fs=E("\u250C","T"),h=E("\u2502","|"),Me=E("\u2514","\u2014"),no=E("\u25CF",">"),oo=E("\u25CB"," "),Cs=E("\u25FB","[\u2022]"),ro=E("\u25FC","[+]"),hs=E("\u25FB","[ ]"),zu=E("\u25AA","\u2022"),so=E("\u2500","-"),Es=E("\u256E","+"),Fs=E("\u251C","+"),ys=E("\u256F","+"),xs=E("\u25CF","\u2022"),vs=E("\u25C6","*"),Ss=E("\u25B2","!"),_s=E("\u25A0","x"),co=t=>{switch(t){case"initial":case"active":return a.default.cyan(gs);case"cancel":return a.default.red(uo);case"error":return a.default.yellow(ao);case"submit":return a.default.green(dt)}},io=t=>{let{cursor:e,options:o,style:r}=t,s=t.maxItems??Number.POSITIVE_INFINITY,i=Math.max(process.stdout.rows-4,0),n=Math.min(i,Math.max(s,5)),u=0;e>=u+n-3?u=Math.max(Math.min(e-n+3,o.length-n),0):e<u+2&&(u=Math.max(e-2,0));let c=n<o.length&&u>0,D=n<o.length&&u+n<o.length;return o.slice(u,u+n).map((d,l,y)=>{let v=l===0&&c,de=l===y.length-1&&D;return v||de?a.default.dim("..."):r(d,l+u===e)})},Ie=t=>{let e=t.active??"Yes",o=t.inactive??"No";return new ct({active:e,inactive:o,initialValue:t.initialValue??!0,render(){let r=`${a.default.gray(h)}
17
- ${co(this.state)} ${t.message}
18
- `,s=this.value?e:o;switch(this.state){case"submit":return`${r}${a.default.gray(h)} ${a.default.dim(s)}`;case"cancel":return`${r}${a.default.gray(h)} ${a.default.strikethrough(a.default.dim(s))}
19
- ${a.default.gray(h)}`;default:return`${r}${a.default.cyan(h)} ${this.value?`${a.default.green(no)} ${e}`:`${a.default.dim(oo)} ${a.default.dim(e)}`} ${a.default.dim("/")} ${this.value?`${a.default.dim(oo)} ${a.default.dim(o)}`:`${a.default.green(no)} ${o}`}
20
- ${a.default.cyan(Me)}
21
- `}}}).prompt()},lo=t=>{let e=(o,r)=>{let s=o.label??String(o.value);return r==="active"?`${a.default.cyan(Cs)} ${s} ${o.hint?a.default.dim(`(${o.hint})`):""}`:r==="selected"?`${a.default.green(ro)} ${a.default.dim(s)}`:r==="cancelled"?`${a.default.strikethrough(a.default.dim(s))}`:r==="active-selected"?`${a.default.green(ro)} ${s} ${o.hint?a.default.dim(`(${o.hint})`):""}`:r==="submitted"?`${a.default.dim(s)}`:`${a.default.dim(hs)} ${a.default.dim(s)}`};return new to({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,validate(o){if(this.required&&o.length===0)return`Please select at least one option.
22
- ${a.default.reset(a.default.dim(`Press ${a.default.gray(a.default.bgWhite(a.default.inverse(" space ")))} to select, ${a.default.gray(a.default.bgWhite(a.default.inverse(" enter ")))} to submit`))}`},render(){let o=`${a.default.gray(h)}
23
- ${co(this.state)} ${t.message}
24
- `,r=(s,i)=>{let n=this.value.includes(s.value);return i&&n?e(s,"active-selected"):n?e(s,"selected"):e(s,i?"active":"inactive")};switch(this.state){case"submit":return`${o}${a.default.gray(h)} ${this.options.filter(({value:s})=>this.value.includes(s)).map(s=>e(s,"submitted")).join(a.default.dim(", "))||a.default.dim("none")}`;case"cancel":{let s=this.options.filter(({value:i})=>this.value.includes(i)).map(i=>e(i,"cancelled")).join(a.default.dim(", "));return`${o}${a.default.gray(h)} ${s.trim()?`${s}
25
- ${a.default.gray(h)}`:""}`}case"error":{let s=this.error.split(`
26
- `).map((i,n)=>n===0?`${a.default.yellow(Me)} ${a.default.yellow(i)}`:` ${i}`).join(`
27
- `);return`${o+a.default.yellow(h)} ${io({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:r}).join(`
28
- ${a.default.yellow(h)} `)}
16
+ `)),this._prevFrame=e;return}this.output.write(S.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},ft=class extends gt{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",o=>{this.output.write(S.cursor.move(0,-1)),this.value=o,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}},Ls=Object.defineProperty,Ns=(t,e,o)=>e in t?Ls(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,oo=(t,e,o)=>(Ns(t,typeof e!="symbol"?e+"":e,o),o),mo=class extends gt{constructor(t){super(t,!1),oo(this,"options"),oo(this,"cursor",0),this.options=t.options,this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:e})=>e===t.cursorAt),0),this.on("key",e=>{e==="a"&&this.toggleAll()}),this.on("cursor",e=>{switch(e){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let t=this.value.length===this.options.length;this.value=t?[]:this.options.map(e=>e.value)}toggleValue(){let t=this.value.includes(this._value);this.value=t?this.value.filter(e=>e!==this._value):[...this.value,this._value]}}});import{stripVTControlCharacters as on}from"node:util";import G from"node:process";function js(){return G.platform!=="win32"?G.env.TERM!=="linux":!!G.env.CI||!!G.env.WT_SESSION||!!G.env.TERMINUS_SUBLIME||G.env.ConEmuTask==="{cmd::Cmder}"||G.env.TERM_PROGRAM==="Terminus-Sublime"||G.env.TERM_PROGRAM==="vscode"||G.env.TERM==="xterm-256color"||G.env.TERM==="alacritty"||G.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var a,ht,rn,F,Us,Eo,Fo,Et,Gs,E,Re,po,go,Ws,fo,Hs,Oa,Co,Js,Ks,Vs,Xs,Ys,qs,zs,yo,ho,Be,xo,Pe,Le,Ft,ce,b,Zs,yt,sn=f(()=>{nn();nn();a=ie(ge(),1),ht=ie(Yt(),1);rn=js(),F=(t,e)=>rn?t:e,Us=F("\u25C6","*"),Eo=F("\u25A0","x"),Fo=F("\u25B2","x"),Et=F("\u25C7","o"),Gs=F("\u250C","T"),E=F("\u2502","|"),Re=F("\u2514","\u2014"),po=F("\u25CF",">"),go=F("\u25CB"," "),Ws=F("\u25FB","[\u2022]"),fo=F("\u25FC","[+]"),Hs=F("\u25FB","[ ]"),Oa=F("\u25AA","\u2022"),Co=F("\u2500","-"),Js=F("\u256E","+"),Ks=F("\u251C","+"),Vs=F("\u256F","+"),Xs=F("\u25CF","\u2022"),Ys=F("\u25C6","*"),qs=F("\u25B2","!"),zs=F("\u25A0","x"),yo=t=>{switch(t){case"initial":case"active":return a.default.cyan(Us);case"cancel":return a.default.red(Eo);case"error":return a.default.yellow(Fo);case"submit":return a.default.green(Et)}},ho=t=>{let{cursor:e,options:o,style:r}=t,s=t.maxItems??Number.POSITIVE_INFINITY,i=Math.max(process.stdout.rows-4,0),n=Math.min(i,Math.max(s,5)),u=0;e>=u+n-3?u=Math.max(Math.min(e-n+3,o.length-n),0):e<u+2&&(u=Math.max(e-2,0));let c=n<o.length&&u>0,D=n<o.length&&u+n<o.length;return o.slice(u,u+n).map((d,l,x)=>{let v=l===0&&c,pe=l===x.length-1&&D;return v||pe?a.default.dim("..."):r(d,l+u===e)})},Be=t=>{let e=t.active??"Yes",o=t.inactive??"No";return new ft({active:e,inactive:o,initialValue:t.initialValue??!0,render(){let r=`${a.default.gray(E)}
17
+ ${yo(this.state)} ${t.message}
18
+ `,s=this.value?e:o;switch(this.state){case"submit":return`${r}${a.default.gray(E)} ${a.default.dim(s)}`;case"cancel":return`${r}${a.default.gray(E)} ${a.default.strikethrough(a.default.dim(s))}
19
+ ${a.default.gray(E)}`;default:return`${r}${a.default.cyan(E)} ${this.value?`${a.default.green(po)} ${e}`:`${a.default.dim(go)} ${a.default.dim(e)}`} ${a.default.dim("/")} ${this.value?`${a.default.dim(go)} ${a.default.dim(o)}`:`${a.default.green(po)} ${o}`}
20
+ ${a.default.cyan(Re)}
21
+ `}}}).prompt()},xo=t=>{let e=(o,r)=>{let s=o.label??String(o.value);return r==="active"?`${a.default.cyan(Ws)} ${s} ${o.hint?a.default.dim(`(${o.hint})`):""}`:r==="selected"?`${a.default.green(fo)} ${a.default.dim(s)}`:r==="cancelled"?`${a.default.strikethrough(a.default.dim(s))}`:r==="active-selected"?`${a.default.green(fo)} ${s} ${o.hint?a.default.dim(`(${o.hint})`):""}`:r==="submitted"?`${a.default.dim(s)}`:`${a.default.dim(Hs)} ${a.default.dim(s)}`};return new mo({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,validate(o){if(this.required&&o.length===0)return`Please select at least one option.
22
+ ${a.default.reset(a.default.dim(`Press ${a.default.gray(a.default.bgWhite(a.default.inverse(" space ")))} to select, ${a.default.gray(a.default.bgWhite(a.default.inverse(" enter ")))} to submit`))}`},render(){let o=`${a.default.gray(E)}
23
+ ${yo(this.state)} ${t.message}
24
+ `,r=(s,i)=>{let n=this.value.includes(s.value);return i&&n?e(s,"active-selected"):n?e(s,"selected"):e(s,i?"active":"inactive")};switch(this.state){case"submit":return`${o}${a.default.gray(E)} ${this.options.filter(({value:s})=>this.value.includes(s)).map(s=>e(s,"submitted")).join(a.default.dim(", "))||a.default.dim("none")}`;case"cancel":{let s=this.options.filter(({value:i})=>this.value.includes(i)).map(i=>e(i,"cancelled")).join(a.default.dim(", "));return`${o}${a.default.gray(E)} ${s.trim()?`${s}
25
+ ${a.default.gray(E)}`:""}`}case"error":{let s=this.error.split(`
26
+ `).map((i,n)=>n===0?`${a.default.yellow(Re)} ${a.default.yellow(i)}`:` ${i}`).join(`
27
+ `);return`${o+a.default.yellow(E)} ${ho({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:r}).join(`
28
+ ${a.default.yellow(E)} `)}
29
29
  ${s}
30
- `}default:return`${o}${a.default.cyan(h)} ${io({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:r}).join(`
31
- ${a.default.cyan(h)} `)}
32
- ${a.default.cyan(Me)}
33
- `}}}).prompt()},Oe=(t="",e="")=>{let o=`
30
+ `}default:return`${o}${a.default.cyan(E)} ${ho({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:r}).join(`
31
+ ${a.default.cyan(E)} `)}
32
+ ${a.default.cyan(Re)}
33
+ `}}}).prompt()},Pe=(t="",e="")=>{let o=`
34
34
  ${t}
35
35
  `.split(`
36
- `),r=qt(e).length,s=Math.max(o.reduce((n,u)=>{let c=qt(u);return c.length>n?c.length:n},0),r)+2,i=o.map(n=>`${a.default.gray(h)} ${a.default.dim(n)}${" ".repeat(s-qt(n).length)}${a.default.gray(h)}`).join(`
37
- `);process.stdout.write(`${a.default.gray(h)}
38
- ${a.default.green(dt)} ${a.default.reset(e)} ${a.default.gray(so.repeat(Math.max(s-r-1,1))+Es)}
36
+ `),r=on(e).length,s=Math.max(o.reduce((n,u)=>{let c=on(u);return c.length>n?c.length:n},0),r)+2,i=o.map(n=>`${a.default.gray(E)} ${a.default.dim(n)}${" ".repeat(s-on(n).length)}${a.default.gray(E)}`).join(`
37
+ `);process.stdout.write(`${a.default.gray(E)}
38
+ ${a.default.green(Et)} ${a.default.reset(e)} ${a.default.gray(Co.repeat(Math.max(s-r-1,1))+Js)}
39
39
  ${i}
40
- ${a.default.gray(Fs+so.repeat(s+2)+ys)}
41
- `)},Te=(t="")=>{process.stdout.write(`${a.default.gray(Me)} ${a.default.red(t)}
40
+ ${a.default.gray(Ks+Co.repeat(s+2)+Vs)}
41
+ `)},Le=(t="")=>{process.stdout.write(`${a.default.gray(Re)} ${a.default.red(t)}
42
42
 
43
- `)},mt=(t="")=>{process.stdout.write(`${a.default.gray(fs)} ${t}
44
- `)},ue=(t="")=>{process.stdout.write(`${a.default.gray(h)}
45
- ${a.default.gray(Me)} ${t}
43
+ `)},Ft=(t="")=>{process.stdout.write(`${a.default.gray(Gs)} ${t}
44
+ `)},ce=(t="")=>{process.stdout.write(`${a.default.gray(E)}
45
+ ${a.default.gray(Re)} ${t}
46
46
 
47
- `)},b={message:(t="",{symbol:e=a.default.gray(h)}={})=>{let o=[`${a.default.gray(h)}`];if(t){let[r,...s]=t.split(`
48
- `);o.push(`${e} ${r}`,...s.map(i=>`${a.default.gray(h)} ${i}`))}process.stdout.write(`${o.join(`
47
+ `)},b={message:(t="",{symbol:e=a.default.gray(E)}={})=>{let o=[`${a.default.gray(E)}`];if(t){let[r,...s]=t.split(`
48
+ `);o.push(`${e} ${r}`,...s.map(i=>`${a.default.gray(E)} ${i}`))}process.stdout.write(`${o.join(`
49
49
  `)}
50
- `)},info:t=>{b.message(t,{symbol:a.default.blue(xs)})},success:t=>{b.message(t,{symbol:a.default.green(vs)})},step:t=>{b.message(t,{symbol:a.default.green(dt)})},warn:t=>{b.message(t,{symbol:a.default.yellow(Ss)})},warning:t=>{b.warn(t)},error:t=>{b.message(t,{symbol:a.default.red(_s)})}},bs=()=>{let t=zt?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],e=zt?80:120,o=process.env.CI==="true",r,s,i=!1,n="",u,c=A=>{let L=A>1?"Something went wrong":"Canceled";i&&_e(L,A)},D=()=>c(2),d=()=>c(1),l=()=>{process.on("uncaughtExceptionMonitor",D),process.on("unhandledRejection",D),process.on("SIGINT",d),process.on("SIGTERM",d),process.on("exit",c)},y=()=>{process.removeListener("uncaughtExceptionMonitor",D),process.removeListener("unhandledRejection",D),process.removeListener("SIGINT",d),process.removeListener("SIGTERM",d),process.removeListener("exit",c)},v=()=>{if(u===void 0)return;o&&process.stdout.write(`
51
- `);let A=u.split(`
52
- `);process.stdout.write(Dt.cursor.move(-999,A.length-1)),process.stdout.write(Dt.erase.down(A.length))},de=A=>A.replace(/\.+$/,""),In=(A="")=>{i=!0,r=eo(),n=de(A),process.stdout.write(`${a.default.gray(h)}
53
- `);let L=0,q=0;l(),s=setInterval(()=>{if(o&&n===u)return;v(),u=n;let _r=a.default.magenta(t[L]),br=o?"...":".".repeat(Math.floor(q)).slice(0,3);process.stdout.write(`${_r} ${n}${br}`),L=L+1<t.length?L+1:0,q=q<t.length?q+.125:0},e)},_e=(A="",L=0)=>{i=!1,clearInterval(s),v();let q=L===0?a.default.green(dt):L===1?a.default.red(uo):a.default.red(ao);n=de(A??n),process.stdout.write(`${q} ${n}
54
- `),y(),r()};return{start:In,stop:_e,message:(A="")=>{n=de(A??n)}}},pt=async t=>{for(let e of t){if(e.enabled===!1)continue;let o=bs();o.start(e.title);let r=await e.task(o.message);o.stop(r||e.title)}}});import{execSync as As}from"child_process";import{existsSync as U,readdirSync as ws}from"fs";import{homedir as mo}from"os";import{join as G}from"path";function Be(t){try{return As(`${Y?"where":"which"} ${t}`,{stdio:"pipe"}),!0}catch{return!1}}function $s(t){let e=G(mo(),".vscode","extensions");if(!U(e))return!1;try{return ws(e).some(r=>r.toLowerCase().includes(t.toLowerCase()))}catch{return!1}}function Re(){let t=mo();return[{id:"claude-code",label:"Claude Code",detected:U(G(t,".claude")),supported:!0,hint:"recommended"},{id:"gemini-cli",label:"Gemini CLI",detected:U(G(t,".gemini")),supported:!0},{id:"opencode",label:"OpenCode",detected:U(G(t,".config","opencode"))||Be("opencode"),supported:!0,hint:"plugin-based integration"},{id:"openclaw",label:"OpenClaw",detected:U(G(t,".openclaw")),supported:!0,hint:"plugin-based integration"},{id:"windsurf",label:"Windsurf",detected:U(G(t,".codeium","windsurf")),supported:!0},{id:"codex-cli",label:"Codex CLI",detected:U(G(t,".codex")),supported:!0,hint:"transcript-based integration"},{id:"cursor",label:"Cursor",detected:U(G(t,".cursor")),supported:!1},{id:"copilot-cli",label:"Copilot CLI",detected:Be("copilot"),supported:!0,hint:"MCP-based integration"},{id:"antigravity",label:"Antigravity",detected:U(G(t,".gemini","antigravity")),supported:!0,hint:"MCP-based integration"},{id:"goose",label:"Goose",detected:U(G(t,".config","goose"))||Be("goose"),supported:!0,hint:"MCP-based integration"},{id:"crush",label:"Crush",detected:Be("crush"),supported:!0,hint:"MCP-based integration"},{id:"roo-code",label:"Roo Code",detected:$s("roo-code"),supported:!0,hint:"MCP-based integration"},{id:"warp",label:"Warp",detected:U(G(t,".warp"))||Be("warp"),supported:!0,hint:"MCP-based integration"}]}var po=p(()=>{"use strict";ie()});import{appendFileSync as ks,existsSync as go,mkdirSync as Ms,readFileSync as Is}from"fs";import{join as gt}from"path";import{homedir as Os}from"os";var Qt,fo,en,m,W=p(()=>{"use strict";Qt=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.SILENT=4]="SILENT",i))(Qt||{}),fo=gt(Os(),".claude-mem"),en=class{level=null;useColor;logFilePath=null;logFileInitialized=!1;constructor(){this.useColor=process.stdout.isTTY??!1}ensureLogFileInitialized(){if(!this.logFileInitialized){this.logFileInitialized=!0;try{let e=gt(fo,"logs");go(e)||Ms(e,{recursive:!0});let o=new Date().toISOString().split("T")[0];this.logFilePath=gt(e,`claude-mem-${o}.log`)}catch(e){console.error("[LOGGER] Failed to initialize log file:",e),this.logFilePath=null}}}getLevel(){if(this.level===null)try{let e=gt(fo,"settings.json");if(go(e)){let o=Is(e,"utf-8"),s=(JSON.parse(o).CLAUDE_MEM_LOG_LEVEL||"INFO").toUpperCase();this.level=Qt[s]??1}else this.level=1}catch{this.level=1}return this.level}correlationId(e,o){return`obs-${e}-${o}`}sessionId(e){return`session-${e}`}formatData(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="object"){if(e instanceof Error)return this.getLevel()===0?`${e.message}
55
- ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let o=Object.keys(e);return o.length===0?"{}":o.length<=3?JSON.stringify(e):`{${o.length} keys: ${o.slice(0,3).join(", ")}...}`}return String(e)}formatTool(e,o){if(!o)return e;let r=o;if(typeof o=="string")try{r=JSON.parse(o)}catch{r=o}if(e==="Bash"&&r.command)return`${e}(${r.command})`;if(r.file_path)return`${e}(${r.file_path})`;if(r.notebook_path)return`${e}(${r.notebook_path})`;if(e==="Glob"&&r.pattern)return`${e}(${r.pattern})`;if(e==="Grep"&&r.pattern)return`${e}(${r.pattern})`;if(r.url)return`${e}(${r.url})`;if(r.query)return`${e}(${r.query})`;if(e==="Task"){if(r.subagent_type)return`${e}(${r.subagent_type})`;if(r.description)return`${e}(${r.description})`}return e==="Skill"&&r.skill?`${e}(${r.skill})`:e==="LSP"&&r.operation?`${e}(${r.operation})`:e}formatTimestamp(e){let o=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),n=String(e.getMinutes()).padStart(2,"0"),u=String(e.getSeconds()).padStart(2,"0"),c=String(e.getMilliseconds()).padStart(3,"0");return`${o}-${r}-${s} ${i}:${n}:${u}.${c}`}log(e,o,r,s,i){if(e<this.getLevel())return;this.ensureLogFileInitialized();let n=this.formatTimestamp(new Date),u=Qt[e].padEnd(5),c=o.padEnd(6),D="";s?.correlationId?D=`[${s.correlationId}] `:s?.sessionId&&(D=`[session-${s.sessionId}] `);let d="";i!=null&&(i instanceof Error?d=this.getLevel()===0?`
50
+ `)},info:t=>{b.message(t,{symbol:a.default.blue(Xs)})},success:t=>{b.message(t,{symbol:a.default.green(Ys)})},step:t=>{b.message(t,{symbol:a.default.green(Et)})},warn:t=>{b.message(t,{symbol:a.default.yellow(qs)})},warning:t=>{b.warn(t)},error:t=>{b.message(t,{symbol:a.default.red(zs)})}},Zs=()=>{let t=rn?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],e=rn?80:120,o=process.env.CI==="true",r,s,i=!1,n="",u,c=w=>{let j=w>1?"Something went wrong":"Canceled";i&&$e(j,w)},D=()=>c(2),d=()=>c(1),l=()=>{process.on("uncaughtExceptionMonitor",D),process.on("unhandledRejection",D),process.on("SIGINT",d),process.on("SIGTERM",d),process.on("exit",c)},x=()=>{process.removeListener("uncaughtExceptionMonitor",D),process.removeListener("unhandledRejection",D),process.removeListener("SIGINT",d),process.removeListener("SIGTERM",d),process.removeListener("exit",c)},v=()=>{if(u===void 0)return;o&&process.stdout.write(`
51
+ `);let w=u.split(`
52
+ `);process.stdout.write(ht.cursor.move(-999,w.length-1)),process.stdout.write(ht.erase.down(w.length))},pe=w=>w.replace(/\.+$/,""),Wn=(w="")=>{i=!0,r=Do(),n=pe(w),process.stdout.write(`${a.default.gray(E)}
53
+ `);let j=0,Z=0;l(),s=setInterval(()=>{if(o&&n===u)return;v(),u=n;let zr=a.default.magenta(t[j]),Zr=o?"...":".".repeat(Math.floor(Z)).slice(0,3);process.stdout.write(`${zr} ${n}${Zr}`),j=j+1<t.length?j+1:0,Z=Z<t.length?Z+.125:0},e)},$e=(w="",j=0)=>{i=!1,clearInterval(s),v();let Z=j===0?a.default.green(Et):j===1?a.default.red(Eo):a.default.red(Fo);n=pe(w??n),process.stdout.write(`${Z} ${n}
54
+ `),x(),r()};return{start:Wn,stop:$e,message:(w="")=>{n=pe(w??n)}}},yt=async t=>{for(let e of t){if(e.enabled===!1)continue;let o=Zs();o.start(e.title);let r=await e.task(o.message);o.stop(r||e.title)}}});import{execSync as Qs}from"child_process";import{existsSync as W,readdirSync as ei}from"fs";import{homedir as vo}from"os";import{join as H}from"path";function Ne(t){try{return Qs(`${z?"where":"which"} ${t}`,{stdio:"pipe"}),!0}catch{return!1}}function ti(t){let e=H(vo(),".vscode","extensions");if(!W(e))return!1;try{return ei(e).some(r=>r.toLowerCase().includes(t.toLowerCase()))}catch{return!1}}function je(){let t=vo();return[{id:"claude-code",label:"Claude Code",detected:W(H(t,".claude")),supported:!0,hint:"recommended"},{id:"gemini-cli",label:"Gemini CLI",detected:W(H(t,".gemini")),supported:!0},{id:"opencode",label:"OpenCode",detected:W(H(t,".config","opencode"))||Ne("opencode"),supported:!0,hint:"plugin-based integration"},{id:"openclaw",label:"OpenClaw",detected:W(H(t,".openclaw")),supported:!0,hint:"plugin-based integration"},{id:"windsurf",label:"Windsurf",detected:W(H(t,".codeium","windsurf")),supported:!0},{id:"codex-cli",label:"Codex CLI",detected:W(H(t,".codex")),supported:!0,hint:"transcript-based integration"},{id:"cursor",label:"Cursor",detected:W(H(t,".cursor")),supported:!0,hint:"hooks + MCP integration"},{id:"copilot-cli",label:"Copilot CLI",detected:Ne("copilot"),supported:!0,hint:"MCP-based integration"},{id:"antigravity",label:"Antigravity",detected:W(H(t,".gemini","antigravity")),supported:!0,hint:"MCP-based integration"},{id:"goose",label:"Goose",detected:W(H(t,".config","goose"))||Ne("goose"),supported:!0,hint:"MCP-based integration"},{id:"crush",label:"Crush",detected:Ne("crush"),supported:!0,hint:"MCP-based integration"},{id:"roo-code",label:"Roo Code",detected:ti("roo-code"),supported:!0,hint:"MCP-based integration"},{id:"warp",label:"Warp",detected:W(H(t,".warp"))||Ne("warp"),supported:!0,hint:"MCP-based integration"}]}var So=f(()=>{"use strict";ae()});import{appendFileSync as ni,existsSync as Ao,mkdirSync as oi,readFileSync as ri}from"fs";import{join as xt}from"path";import{homedir as si}from"os";var un,bo,an,m,J=f(()=>{"use strict";un=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.SILENT=4]="SILENT",i))(un||{}),bo=xt(si(),".claude-mem"),an=class{level=null;useColor;logFilePath=null;logFileInitialized=!1;constructor(){this.useColor=process.stdout.isTTY??!1}ensureLogFileInitialized(){if(!this.logFileInitialized){this.logFileInitialized=!0;try{let e=xt(bo,"logs");Ao(e)||oi(e,{recursive:!0});let o=new Date().toISOString().split("T")[0];this.logFilePath=xt(e,`claude-mem-${o}.log`)}catch(e){console.error("[LOGGER] Failed to initialize log file:",e),this.logFilePath=null}}}getLevel(){if(this.level===null)try{let e=xt(bo,"settings.json");if(Ao(e)){let o=ri(e,"utf-8"),s=(JSON.parse(o).CLAUDE_MEM_LOG_LEVEL||"INFO").toUpperCase();this.level=un[s]??1}else this.level=1}catch{this.level=1}return this.level}correlationId(e,o){return`obs-${e}-${o}`}sessionId(e){return`session-${e}`}formatData(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="object"){if(e instanceof Error)return this.getLevel()===0?`${e.message}
55
+ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let o=Object.keys(e);return o.length===0?"{}":o.length<=3?JSON.stringify(e):`{${o.length} keys: ${o.slice(0,3).join(", ")}...}`}return String(e)}formatTool(e,o){if(!o)return e;let r=o;if(typeof o=="string")try{r=JSON.parse(o)}catch{r=o}if(e==="Bash"&&r.command)return`${e}(${r.command})`;if(r.file_path)return`${e}(${r.file_path})`;if(r.notebook_path)return`${e}(${r.notebook_path})`;if(e==="Glob"&&r.pattern)return`${e}(${r.pattern})`;if(e==="Grep"&&r.pattern)return`${e}(${r.pattern})`;if(r.url)return`${e}(${r.url})`;if(r.query)return`${e}(${r.query})`;if(e==="Task"){if(r.subagent_type)return`${e}(${r.subagent_type})`;if(r.description)return`${e}(${r.description})`}return e==="Skill"&&r.skill?`${e}(${r.skill})`:e==="LSP"&&r.operation?`${e}(${r.operation})`:e}formatTimestamp(e){let o=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),n=String(e.getMinutes()).padStart(2,"0"),u=String(e.getSeconds()).padStart(2,"0"),c=String(e.getMilliseconds()).padStart(3,"0");return`${o}-${r}-${s} ${i}:${n}:${u}.${c}`}log(e,o,r,s,i){if(e<this.getLevel())return;this.ensureLogFileInitialized();let n=this.formatTimestamp(new Date),u=un[e].padEnd(5),c=o.padEnd(6),D="";s?.correlationId?D=`[${s.correlationId}] `:s?.sessionId&&(D=`[session-${s.sessionId}] `);let d="";i!=null&&(i instanceof Error?d=this.getLevel()===0?`
56
56
  ${i.message}
57
57
  ${i.stack}`:` ${i.message}`:this.getLevel()===0&&typeof i=="object"?d=`
58
- `+JSON.stringify(i,null,2):d=" "+this.formatData(i));let l="";if(s){let{sessionId:v,memorySessionId:de,correlationId:In,..._e}=s;Object.keys(_e).length>0&&(l=` {${Object.entries(_e).map(([L,q])=>`${L}=${q}`).join(", ")}}`)}let y=`[${n}] [${u}] [${c}] ${D}${r}${l}${d}`;if(this.logFilePath)try{ks(this.logFilePath,y+`
58
+ `+JSON.stringify(i,null,2):d=" "+this.formatData(i));let l="";if(s){let{sessionId:v,memorySessionId:pe,correlationId:Wn,...$e}=s;Object.keys($e).length>0&&(l=` {${Object.entries($e).map(([j,Z])=>`${j}=${Z}`).join(", ")}}`)}let x=`[${n}] [${u}] [${c}] ${D}${r}${l}${d}`;if(this.logFilePath)try{ni(this.logFilePath,x+`
59
59
  `,"utf8")}catch(v){process.stderr.write(`[LOGGER] Failed to write to log file: ${v}
60
- `)}else process.stderr.write(y+`
60
+ `)}else process.stderr.write(x+`
61
61
  `)}debug(e,o,r,s){this.log(0,e,o,r,s)}info(e,o,r,s){this.log(1,e,o,r,s)}warn(e,o,r,s){this.log(2,e,o,r,s)}error(e,o,r,s){this.log(3,e,o,r,s)}dataIn(e,o,r,s){this.info(e,`\u2192 ${o}`,r,s)}dataOut(e,o,r,s){this.info(e,`\u2190 ${o}`,r,s)}success(e,o,r,s){this.info(e,`\u2713 ${o}`,r,s)}failure(e,o,r,s){this.error(e,`\u2717 ${o}`,r,s)}timing(e,o,r,s){this.info(e,`\u23F1 ${o}`,s,{duration:`${r}ms`})}happyPathError(e,o,r,s,i=""){let D=((new Error().stack||"").split(`
62
- `)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),d=D?`${D[1].split("/").pop()}:${D[2]}`:"unknown",l={...r,location:d};return this.warn(e,`[HAPPY-PATH] ${o}`,l,s),i}},m=new en});function Co(t){return process.platform==="win32"?Math.round(t*tn.WINDOWS_MULTIPLIER):t}var tn,ho=p(()=>{"use strict";tn={DEFAULT:3e5,HEALTH_CHECK:3e3,POST_SPAWN_WAIT:5e3,READINESS_WAIT:3e4,PORT_IN_USE_WAIT:3e3,WORKER_STARTUP_WAIT:1e3,PRE_RESTART_SETTLE_DELAY:2e3,POWERSHELL_COMMAND:1e4,WINDOWS_MULTIPLIER:1.5}});import{readFileSync as Ts,writeFileSync as Eo,existsSync as Fo,mkdirSync as Bs}from"fs";import{join as Rs,dirname as Ps}from"path";import{homedir as Ls}from"os";var Ce,nn=p(()=>{"use strict";Ce=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_PROVIDER:"claude",CLAUDE_MEM_CLAUDE_AUTH_METHOD:"cli",CLAUDE_MEM_GEMINI_API_KEY:"",CLAUDE_MEM_GEMINI_MODEL:"gemini-2.5-flash-lite",CLAUDE_MEM_GEMINI_RATE_LIMITING_ENABLED:"true",CLAUDE_MEM_OPENROUTER_API_KEY:"",CLAUDE_MEM_OPENROUTER_MODEL:"xiaomi/mimo-v2-flash:free",CLAUDE_MEM_OPENROUTER_SITE_URL:"",CLAUDE_MEM_OPENROUTER_APP_NAME:"claude-mem",CLAUDE_MEM_OPENROUTER_MAX_CONTEXT_MESSAGES:"20",CLAUDE_MEM_OPENROUTER_MAX_TOKENS:"100000",CLAUDE_MEM_DATA_DIR:Rs(Ls(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_MODE:"code",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_FULL_COUNT:"0",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false",CLAUDE_MEM_CONTEXT_SHOW_TERMINAL_OUTPUT:"true",CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED:"false",CLAUDE_MEM_MAX_CONCURRENT_AGENTS:"2",CLAUDE_MEM_EXCLUDED_PROJECTS:"",CLAUDE_MEM_FOLDER_MD_EXCLUDE:"[]",CLAUDE_MEM_SEMANTIC_INJECT:"true",CLAUDE_MEM_SEMANTIC_INJECT_LIMIT:"5",CLAUDE_MEM_TIER_ROUTING_ENABLED:"true",CLAUDE_MEM_TIER_SIMPLE_MODEL:"haiku",CLAUDE_MEM_TIER_SUMMARY_MODEL:"",CLAUDE_MEM_CHROMA_ENABLED:"true",CLAUDE_MEM_CHROMA_MODE:"local",CLAUDE_MEM_CHROMA_HOST:"127.0.0.1",CLAUDE_MEM_CHROMA_PORT:"8000",CLAUDE_MEM_CHROMA_SSL:"false",CLAUDE_MEM_CHROMA_API_KEY:"",CLAUDE_MEM_CHROMA_TENANT:"default_tenant",CLAUDE_MEM_CHROMA_DATABASE:"default_database"};static getAllDefaults(){return{...this.DEFAULTS}}static get(e){return process.env[e]??this.DEFAULTS[e]}static getInt(e){let o=this.get(e);return parseInt(o,10)}static getBool(e){let o=this.get(e);return o==="true"||o===!0}static applyEnvOverrides(e){let o={...e};for(let r of Object.keys(this.DEFAULTS))process.env[r]!==void 0&&(o[r]=process.env[r]);return o}static loadFromFile(e){try{if(!Fo(e)){let n=this.getAllDefaults();try{let u=Ps(e);Fo(u)||Bs(u,{recursive:!0}),Eo(e,JSON.stringify(n,null,2),"utf-8"),console.log("[SETTINGS] Created settings file with defaults:",e)}catch(u){console.warn("[SETTINGS] Failed to create settings file, using in-memory defaults:",e,u)}return this.applyEnvOverrides(n)}let o=Ts(e,"utf-8"),r=JSON.parse(o),s=r;if(r.env&&typeof r.env=="object"){s=r.env;try{Eo(e,JSON.stringify(s,null,2),"utf-8"),console.log("[SETTINGS] Migrated settings file from nested to flat schema:",e)}catch(n){console.warn("[SETTINGS] Failed to auto-migrate settings file:",e,n)}}let i={...this.DEFAULTS};for(let n of Object.keys(this.DEFAULTS))s[n]!==void 0&&(i[n]=s[n]);return this.applyEnvOverrides(i)}catch(o){return console.warn("[SETTINGS] Failed to load settings, using defaults:",e,o),this.applyEnvOverrides(this.getAllDefaults())}}}});import{join as _,dirname as js,basename as ga}from"path";import{homedir as yo}from"os";import{existsSync as Ns,mkdirSync as Ea}from"fs";import{execSync as ya}from"child_process";import{fileURLToPath as Us}from"url";function Gs(){return typeof __dirname<"u"?__dirname:js(Us(import.meta.url))}function Ws(){if(process.env.CLAUDE_MEM_DATA_DIR)return process.env.CLAUDE_MEM_DATA_DIR;let t=_(yo(),".claude-mem"),e=_(t,"settings.json");try{if(Ns(e)){let{readFileSync:o}=Ir("fs"),r=JSON.parse(o(e,"utf-8")),s=r.env??r;if(s.CLAUDE_MEM_DATA_DIR)return s.CLAUDE_MEM_DATA_DIR}}catch{}return t}var Sa,O,Pe,ft,_a,ba,Aa,wa,$a,ka,Ma,Ia,Oa,Ta,Ba,Ra,Ct=p(()=>{"use strict";W();Sa=Gs();O=Ws(),Pe=process.env.CLAUDE_CONFIG_DIR||_(yo(),".claude"),ft=_(Pe,"plugins","marketplaces","thedotmack"),_a=_(O,"archives"),ba=_(O,"logs"),Aa=_(O,"trash"),wa=_(O,"backups"),$a=_(O,"modes"),ka=_(O,"settings.json"),Ma=_(O,"claude-mem.db"),Ia=_(O,"vector-db"),Oa=_(O,"observer-sessions"),Ta=_(Pe,"settings.json"),Ba=_(Pe,"commands"),Ra=_(Pe,"CLAUDE.md")});import Hs from"path";import{readFileSync as Na}from"fs";function Et(){if(ht!==null)return ht;let t=Hs.join(Ce.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),e=Ce.loadFromFile(t);return ht=parseInt(e.CLAUDE_MEM_WORKER_PORT,10),ht}var Ja,ht,Le=p(()=>{"use strict";W();ho();nn();Ct();Ja=(()=>{let t=process.env.CLAUDE_MEM_HEALTH_TIMEOUT_MS;if(t){let e=parseInt(t,10);if(Number.isFinite(e)&&e>=500&&e<=3e5)return e;m.warn("SYSTEM","Invalid CLAUDE_MEM_HEALTH_TIMEOUT_MS, using default",{value:t,min:500,max:3e5})}return Co(tn.HEALTH_CHECK)})(),ht=null});import{existsSync as Xa,readFileSync as Ya,writeFileSync as qa,mkdirSync as za,renameSync as Za}from"fs";import{join as ec,basename as tc}from"path";var xo=p(()=>{"use strict";W()});import ee from"path";import{homedir as vo}from"os";import{existsSync as on,readFileSync as lc,writeFileSync as Dc,unlinkSync as dc,mkdirSync as mc}from"fs";import{exec as Ks}from"child_process";import{promisify as Vs}from"util";function rn(){let t=[ee.join(ft,"plugin","scripts","mcp-server.cjs"),ee.join(process.cwd(),"plugin","scripts","mcp-server.cjs")];for(let e of t)if(on(e))return e;return null}function Ft(){let t=[ee.join(ft,"plugin","scripts","worker-service.cjs"),ee.join(process.cwd(),"plugin","scripts","worker-service.cjs")];for(let e of t)if(on(e))return e;return null}function yt(){let t=[ee.join(vo(),".bun","bin","bun"),"/usr/local/bin/bun","/usr/bin/bun",...process.platform==="win32"?[ee.join(vo(),".bun","bin","bun.exe"),ee.join(process.env.LOCALAPPDATA||"","bun","bun.exe")]:[]];for(let e of t)if(e&&on(e))return e;return"bun"}var yc,xc,xt=p(()=>{"use strict";W();Le();Ct();xo();yc=Vs(Ks),xc=ee.join(O,"cursor-projects.json")});var cn={};X(cn,{checkGeminiCliHooksStatus:()=>wo,handleGeminiCliCommand:()=>ei,installGeminiCliHooks:()=>bo,uninstallGeminiCliHooks:()=>Ao});import sn from"path";import{homedir as Xs}from"os";import{existsSync as Ee,readFileSync as vt,writeFileSync as un,mkdirSync as So}from"fs";function qs(t,e,o){let r=he[o];if(!r)throw new Error(`Unknown Gemini CLI event: ${o}`);let s=t.replace(/\\/g,"\\\\"),i=e.replace(/\\/g,"\\\\");return`"${s}" "${i}" hook gemini-cli ${r}`}function zs(t){return{matcher:"*",hooks:[{name:je,type:"command",command:t,timeout:Ys}]}}function an(){if(!Ee(J))return{};let t=vt(J,"utf-8");try{return JSON.parse(t)}catch{throw new Error(`Corrupt JSON in ${J}, refusing to overwrite user settings`)}}function _o(t){So(St,{recursive:!0}),un(J,JSON.stringify(t,null,2)+`
63
- `)}function Zs(t,e){let o={...t};o.hooks||(o.hooks={});for(let[r,s]of Object.entries(e)){let i=o.hooks[r]??[];for(let n of s){let u=i.findIndex(c=>c.hooks.some(D=>D.name===je));if(u>=0){let c=i[u],D=c.hooks.findIndex(d=>d.name===je);D>=0?c.hooks[D]=n.hooks[0]:c.hooks.push(n.hooks[0])}else i.push(n)}o.hooks[r]=i}return o}function Qs(){let t="<claude-mem-context>",o=`${t}
62
+ `)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),d=D?`${D[1].split("/").pop()}:${D[2]}`:"unknown",l={...r,location:d};return this.warn(e,`[HAPPY-PATH] ${o}`,l,s),i}},m=new an});function wo(t){return process.platform==="win32"?Math.round(t*cn.WINDOWS_MULTIPLIER):t}var cn,$o=f(()=>{"use strict";cn={DEFAULT:3e5,HEALTH_CHECK:3e3,POST_SPAWN_WAIT:15e3,READINESS_WAIT:3e4,PORT_IN_USE_WAIT:3e3,WORKER_STARTUP_WAIT:1e3,PRE_RESTART_SETTLE_DELAY:2e3,POWERSHELL_COMMAND:1e4,WINDOWS_MULTIPLIER:1.5}});import{readFileSync as ii,writeFileSync as Mo,existsSync as ko,mkdirSync as ui}from"fs";import{join as Io,dirname as ai}from"path";import{homedir as Oo}from"os";var ne,ln=f(()=>{"use strict";ne=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-6",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_PROVIDER:"claude",CLAUDE_MEM_CLAUDE_AUTH_METHOD:"cli",CLAUDE_MEM_GEMINI_API_KEY:"",CLAUDE_MEM_GEMINI_MODEL:"gemini-2.5-flash-lite",CLAUDE_MEM_GEMINI_RATE_LIMITING_ENABLED:"true",CLAUDE_MEM_GEMINI_MAX_CONTEXT_MESSAGES:"20",CLAUDE_MEM_GEMINI_MAX_TOKENS:"100000",CLAUDE_MEM_OPENROUTER_API_KEY:"",CLAUDE_MEM_OPENROUTER_MODEL:"xiaomi/mimo-v2-flash:free",CLAUDE_MEM_OPENROUTER_SITE_URL:"",CLAUDE_MEM_OPENROUTER_APP_NAME:"claude-mem",CLAUDE_MEM_OPENROUTER_MAX_CONTEXT_MESSAGES:"20",CLAUDE_MEM_OPENROUTER_MAX_TOKENS:"100000",CLAUDE_MEM_DATA_DIR:Io(Oo(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_MODE:"code",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_FULL_COUNT:"0",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false",CLAUDE_MEM_CONTEXT_SHOW_TERMINAL_OUTPUT:"true",CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED:"false",CLAUDE_MEM_FOLDER_USE_LOCAL_MD:"false",CLAUDE_MEM_TRANSCRIPTS_ENABLED:"true",CLAUDE_MEM_TRANSCRIPTS_CONFIG_PATH:Io(Oo(),".claude-mem","transcript-watch.json"),CLAUDE_MEM_MAX_CONCURRENT_AGENTS:"2",CLAUDE_MEM_EXCLUDED_PROJECTS:"",CLAUDE_MEM_FOLDER_MD_EXCLUDE:"[]",CLAUDE_MEM_SEMANTIC_INJECT:"false",CLAUDE_MEM_SEMANTIC_INJECT_LIMIT:"5",CLAUDE_MEM_TIER_ROUTING_ENABLED:"true",CLAUDE_MEM_TIER_SIMPLE_MODEL:"haiku",CLAUDE_MEM_TIER_SUMMARY_MODEL:"",CLAUDE_MEM_CHROMA_ENABLED:"true",CLAUDE_MEM_CHROMA_MODE:"local",CLAUDE_MEM_CHROMA_HOST:"127.0.0.1",CLAUDE_MEM_CHROMA_PORT:"8000",CLAUDE_MEM_CHROMA_SSL:"false",CLAUDE_MEM_CHROMA_API_KEY:"",CLAUDE_MEM_CHROMA_TENANT:"default_tenant",CLAUDE_MEM_CHROMA_DATABASE:"default_database"};static getAllDefaults(){return{...this.DEFAULTS}}static get(e){return process.env[e]??this.DEFAULTS[e]}static getInt(e){let o=this.get(e);return parseInt(o,10)}static getBool(e){let o=this.get(e);return o==="true"||o===!0}static applyEnvOverrides(e){let o={...e};for(let r of Object.keys(this.DEFAULTS))process.env[r]!==void 0&&(o[r]=process.env[r]);return o}static loadFromFile(e){try{if(!ko(e)){let n=this.getAllDefaults();try{let u=ai(e);ko(u)||ui(u,{recursive:!0}),Mo(e,JSON.stringify(n,null,2),"utf-8"),console.log("[SETTINGS] Created settings file with defaults:",e)}catch(u){console.warn("[SETTINGS] Failed to create settings file, using in-memory defaults:",e,u)}return this.applyEnvOverrides(n)}let o=ii(e,"utf-8"),r=JSON.parse(o),s=r;if(r.env&&typeof r.env=="object"){s=r.env;try{Mo(e,JSON.stringify(s,null,2),"utf-8"),console.log("[SETTINGS] Migrated settings file from nested to flat schema:",e)}catch(n){console.warn("[SETTINGS] Failed to auto-migrate settings file:",e,n)}}let i={...this.DEFAULTS};for(let n of Object.keys(this.DEFAULTS))s[n]!==void 0&&(i[n]=s[n]);return this.applyEnvOverrides(i)}catch(o){return console.warn("[SETTINGS] Failed to load settings, using defaults:",e,o),this.applyEnvOverrides(this.getAllDefaults())}}}});import{join as A,dirname as ci,basename as za}from"path";import{homedir as To}from"os";import{existsSync as li,mkdirSync as tc}from"fs";import{execSync as oc}from"child_process";import{fileURLToPath as Di}from"url";function di(){return typeof __dirname<"u"?__dirname:ci(Di(import.meta.url))}function mi(){if(process.env.CLAUDE_MEM_DATA_DIR)return process.env.CLAUDE_MEM_DATA_DIR;let t=A(To(),".claude-mem"),e=A(t,"settings.json");try{if(li(e)){let{readFileSync:o}=rs("fs"),r=JSON.parse(o(e,"utf-8")),s=r.env??r;if(s.CLAUDE_MEM_DATA_DIR)return s.CLAUDE_MEM_DATA_DIR}}catch{}return t}var ic,T,Ee,_t,uc,ac,cc,lc,Dc,dc,mc,pc,gc,fc,Cc,hc,vt=f(()=>{"use strict";J();ic=di();T=mi(),Ee=process.env.CLAUDE_CONFIG_DIR||A(To(),".claude"),_t=A(Ee,"plugins","marketplaces","thedotmack"),uc=A(T,"archives"),ac=A(T,"logs"),cc=A(T,"trash"),lc=A(T,"backups"),Dc=A(T,"modes"),dc=A(T,"settings.json"),mc=A(T,"claude-mem.db"),pc=A(T,"vector-db"),gc=A(T,"observer-sessions"),fc=A(Ee,"settings.json"),Cc=A(Ee,"commands"),hc=A(Ee,"CLAUDE.md")});import Ro from"path";import{readFileSync as xc}from"fs";function gi(t,e={},o){return new Promise((r,s)=>{let i=setTimeout(()=>s(new Error(`Request timed out after ${o}ms`)),o);fetch(t,e).then(n=>{clearTimeout(i),r(n)},n=>{clearTimeout(i),s(n)})})}function Ue(){if(St!==null)return St;let t=Ro.join(ne.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),e=ne.loadFromFile(t);return St=parseInt(e.CLAUDE_MEM_WORKER_PORT,10),St}function fi(){if(At!==null)return At;let t=Ro.join(ne.get("CLAUDE_MEM_DATA_DIR"),"settings.json");return At=ne.loadFromFile(t).CLAUDE_MEM_WORKER_HOST,At}function Ci(t){return`http://${fi()}:${Ue()}${t}`}function Ge(t,e={}){let o=e.method??"GET",r=e.timeoutMs??pi,s=Ci(t),i={method:o};return e.headers&&(i.headers=e.headers),e.body&&(i.body=e.body),r>0?gi(s,i,r):fetch(s,i)}var pi,St,At,We=f(()=>{"use strict";J();$o();ln();vt();pi=(()=>{let t=process.env.CLAUDE_MEM_HEALTH_TIMEOUT_MS;if(t){let e=parseInt(t,10);if(Number.isFinite(e)&&e>=500&&e<=3e5)return e;m.warn("SYSTEM","Invalid CLAUDE_MEM_HEALTH_TIMEOUT_MS, using default",{value:t,min:500,max:3e5})}return wo(cn.HEALTH_CHECK)})();St=null,At=null});import{existsSync as hi,readFileSync as Ei,writeFileSync as Bo,mkdirSync as Po,renameSync as Fi}from"fs";import{join as Dn,basename as Mc}from"path";function Lo(t){try{return hi(t)?JSON.parse(Ei(t,"utf-8")):{}}catch(e){return m.error("CONFIG","Failed to read Cursor registry, using empty registry",{file:t,error:e instanceof Error?e.message:String(e)}),{}}}function No(t,e){let o=Dn(t,"..");Po(o,{recursive:!0}),Bo(t,JSON.stringify(e,null,2))}function dn(t,e){let o=Dn(t,".cursor","rules"),r=Dn(o,"claude-mem-context.mdc"),s=`${r}.tmp`;Po(o,{recursive:!0});let i=`---
63
+ alwaysApply: true
64
+ description: "Claude-mem context from past sessions (auto-updated)"
65
+ ---
66
+
67
+ # Memory Context from Past Sessions
68
+
69
+ The following context is from claude-mem, a persistent memory system that tracks your coding sessions.
70
+
71
+ ${e}
72
+
73
+ ---
74
+ *Updated after last session. Use claude-mem's MCP search tools for more detailed queries.*
75
+ `;Bo(s,i),Fi(s,r)}var jo=f(()=>{"use strict";J()});var Yo={};X(Yo,{checkCursorHooksStatus:()=>Xo,configureCursorMcp:()=>Ai,detectClaudeCode:()=>wi,detectPlatform:()=>Wo,findBunPath:()=>ye,findMcpServerPath:()=>He,findWorkerServicePath:()=>Fe,getScriptExtension:()=>vi,getTargetDir:()=>$t,handleCursorCommand:()=>$i,installCursorHooks:()=>Ko,readCursorRegistry:()=>wt,registerCursorProject:()=>Ho,uninstallCursorHooks:()=>Vo,unregisterCursorProject:()=>Jo,updateCursorContextForProject:()=>Si,writeCursorRegistry:()=>fn});import p from"path";import{homedir as bt}from"os";import{existsSync as B,readFileSync as Uo,writeFileSync as pn,unlinkSync as mn,mkdirSync as gn}from"fs";import{exec as yi}from"child_process";import{promisify as xi}from"util";function Wo(){return process.platform==="win32"?"windows":"unix"}function vi(){return Wo()==="windows"?".ps1":".sh"}function wt(){return Lo(Go)}function fn(t){No(Go,t)}function Ho(t,e){let o=wt();o[t]={workspacePath:e,installedAt:new Date().toISOString()},fn(o),m.info("CURSOR","Registered project for auto-context updates",{projectName:t,workspacePath:e})}function Jo(t){let e=wt();e[t]&&(delete e[t],fn(e),m.info("CURSOR","Unregistered project",{projectName:t}))}async function Si(t,e){let r=wt()[t];if(r)try{let s=await Ge(`/api/context/inject?project=${encodeURIComponent(t)}`);if(!s.ok)return;let i=await s.text();if(!i||!i.trim())return;dn(r.workspacePath,i),m.debug("CURSOR","Updated context file",{projectName:t,workspacePath:r.workspacePath})}catch(s){m.error("CURSOR","Failed to update context file",{projectName:t},s)}}function He(){let t=[p.join(_t,"plugin","scripts","mcp-server.cjs"),p.join(process.cwd(),"plugin","scripts","mcp-server.cjs")];for(let e of t)if(B(e))return e;return null}function Fe(){let t=[p.join(_t,"plugin","scripts","worker-service.cjs"),p.join(process.cwd(),"plugin","scripts","worker-service.cjs")];for(let e of t)if(B(e))return e;return null}function ye(){let t=[p.join(bt(),".bun","bin","bun"),"/usr/local/bin/bun","/usr/bin/bun",...process.platform==="win32"?[p.join(bt(),".bun","bin","bun.exe"),p.join(process.env.LOCALAPPDATA||"","bun","bun.exe")]:[]];for(let e of t)if(e&&B(e))return e;return"bun"}function $t(t){switch(t){case"project":return p.join(process.cwd(),".cursor");case"user":return p.join(bt(),".cursor");case"enterprise":return process.platform==="darwin"?"/Library/Application Support/Cursor":process.platform==="linux"?"/etc/cursor":process.platform==="win32"?p.join(process.env.ProgramData||"C:\\ProgramData","Cursor"):null;default:return null}}function Ai(t){let e=He();if(!e)return console.error("Could not find MCP server script"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs"),1;let o=$t(t);if(!o)return console.error(`Invalid target: ${t}. Use: project or user`),1;let r=p.join(o,"mcp.json");try{gn(o,{recursive:!0});let s={mcpServers:{}};if(B(r))try{s=JSON.parse(Uo(r,"utf-8")),s.mcpServers||(s.mcpServers={})}catch(i){m.error("SYSTEM","Corrupt mcp.json, creating new config",{path:r},i),s={mcpServers:{}}}return s.mcpServers["claude-mem"]={command:"node",args:[e]},pn(r,JSON.stringify(s,null,2)),console.log(` Configured MCP server in ${t==="user"?"~/.cursor":".cursor"}/mcp.json`),console.log(` Server path: ${e}`),0}catch(s){return console.error(`Failed to configure MCP: ${s.message}`),1}}async function Ko(t){console.log(`
76
+ Installing Claude-Mem Cursor hooks (${t} level)...
77
+ `);let e=$t(t);if(!e)return console.error(`Invalid target: ${t}. Use: project, user, or enterprise`),1;let o=Fe();if(!o)return console.error("Could not find worker-service.cjs"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/worker-service.cjs"),1;let r=process.cwd();try{gn(e,{recursive:!0});let s=p.join(e,"hooks.json"),i=ye(),n=i.replace(/\\/g,"\\\\"),u=o.replace(/\\/g,"\\\\"),c=d=>`"${n}" "${u}" hook cursor ${d}`;console.log(` Using Bun runtime: ${i}`);let D={version:1,hooks:{beforeSubmitPrompt:[{command:c("session-init")},{command:c("context")}],afterMCPExecution:[{command:c("observation")}],afterShellExecution:[{command:c("observation")}],afterFileEdit:[{command:c("file-edit")}],stop:[{command:c("summarize")}]}};return pn(s,JSON.stringify(D,null,2)),console.log(" Created hooks.json (unified CLI mode)"),console.log(` Worker service: ${o}`),t==="project"&&await bi(e,r),console.log(`
78
+ Installation complete!
79
+
80
+ Hooks installed to: ${e}/hooks.json
81
+ Using unified CLI: bun worker-service.cjs hook cursor <command>
82
+
83
+ Next steps:
84
+ 1. Start claude-mem worker: claude-mem start
85
+ 2. Restart Cursor to load the hooks
86
+ 3. Check Cursor Settings \u2192 Hooks tab to verify
87
+
88
+ Context Injection:
89
+ Context from past sessions is stored in .cursor/rules/claude-mem-context.mdc
90
+ and automatically included in every chat. It updates after each session ends.
91
+ `),0}catch(s){return console.error(`
92
+ Installation failed: ${s.message}`),t==="enterprise"&&console.error(" Tip: Enterprise installation may require sudo/admin privileges"),1}}async function bi(t,e){let o=p.join(t,"rules");gn(o,{recursive:!0});let r=p.basename(e),s=!1;console.log(" Generating initial context...");try{if((await Ge("/api/readiness")).ok){let n=await Ge(`/api/context/inject?project=${encodeURIComponent(r)}`);if(n.ok){let u=await n.text();u&&u.trim()&&(dn(e,u),s=!0,console.log(" Generated initial context from existing memory"))}}}catch(i){m.debug("CURSOR","Worker not running during install",{},i)}if(!s){let i=p.join(o,"claude-mem-context.mdc");pn(i,`---
93
+ alwaysApply: true
94
+ description: "Claude-mem context from past sessions (auto-updated)"
95
+ ---
96
+
97
+ # Memory Context from Past Sessions
98
+
99
+ *No context yet. Complete your first session and context will appear here.*
100
+
101
+ Use claude-mem's MCP search tools for manual memory queries.
102
+ `),console.log(" Created placeholder context file (will populate after first session)")}Ho(r,e),console.log(" Registered for auto-context updates")}function Vo(t){console.log(`
103
+ Uninstalling Claude-Mem Cursor hooks (${t} level)...
104
+ `);let e=$t(t);if(!e)return console.error(`Invalid target: ${t}`),1;try{let o=p.join(e,"hooks"),r=p.join(e,"hooks.json"),s=["common.sh","session-init.sh","context-inject.sh","save-observation.sh","save-file-edit.sh","session-summary.sh"],i=["common.ps1","session-init.ps1","context-inject.ps1","save-observation.ps1","save-file-edit.ps1","session-summary.ps1"],n=[...s,...i];for(let u of n){let c=p.join(o,u);B(c)&&(mn(c),console.log(` Removed legacy script: ${u}`))}if(B(r)&&(mn(r),console.log(" Removed hooks.json")),t==="project"){let u=p.join(e,"rules","claude-mem-context.mdc");B(u)&&(mn(u),console.log(" Removed context file"));let c=p.basename(process.cwd());Jo(c),console.log(" Unregistered from auto-context updates")}return console.log(`
105
+ Uninstallation complete!
106
+ `),console.log("Restart Cursor to apply changes."),0}catch(o){return console.error(`
107
+ Uninstallation failed: ${o.message}`),1}}function Xo(){console.log(`
108
+ Claude-Mem Cursor Hooks Status
109
+ `);let t=[{name:"Project",dir:p.join(process.cwd(),".cursor")},{name:"User",dir:p.join(bt(),".cursor")}];process.platform==="darwin"?t.push({name:"Enterprise",dir:"/Library/Application Support/Cursor"}):process.platform==="linux"&&t.push({name:"Enterprise",dir:"/etc/cursor"});let e=!1;for(let o of t){let r=p.join(o.dir,"hooks.json"),s=p.join(o.dir,"hooks");if(B(r)){e=!0,console.log(`${o.name}: Installed`),console.log(` Config: ${r}`);try{let n=JSON.parse(Uo(r,"utf-8"))?.hooks?.beforeSubmitPrompt?.[0]?.command||"";if(n.includes("worker-service.cjs")&&n.includes("hook cursor"))console.log(" Mode: Unified CLI (bun worker-service.cjs)");else{let u=["session-init.sh","context-inject.sh","save-observation.sh"],c=["session-init.ps1","context-inject.ps1","save-observation.ps1"],D=u.some(l=>B(p.join(s,l))),d=c.some(l=>B(p.join(s,l)));D||d?(console.log(" Mode: Legacy shell scripts (consider reinstalling for unified CLI)"),D&&d?console.log(" Platform: Both (bash + PowerShell)"):D?console.log(" Platform: Unix (bash)"):d&&console.log(" Platform: Windows (PowerShell)")):console.log(" Mode: Unknown configuration")}}catch{console.log(" Mode: Unable to parse hooks.json")}if(o.name==="Project"){let i=p.join(o.dir,"rules","claude-mem-context.mdc");B(i)?console.log(" Context: Active"):console.log(" Context: Not yet generated (will be created on first prompt)")}}else console.log(`${o.name}: Not installed`);console.log("")}return e||console.log(`No hooks installed. Run: claude-mem cursor install
110
+ `),0}async function wi(){try{let{stdout:e}=await _i("which claude || where claude",{timeout:5e3});if(e.trim())return!0}catch(e){m.debug("SYSTEM","Claude CLI not in PATH",{},e)}let t=p.join(Ee,"plugins");return!!B(t)}async function $i(t,e){switch(t){case"install":{let o=e[0]||"project";return Ko(o)}case"uninstall":{let o=e[0]||"project";return Vo(o)}case"status":return Xo();case"setup":return console.log("Use the main entry point for setup"),0;default:return console.log(`
111
+ Claude-Mem Cursor Integration
112
+
113
+ Usage: claude-mem cursor <command> [options]
114
+
115
+ Commands:
116
+ setup Interactive guided setup (recommended for first-time users)
117
+
118
+ install [target] Install Cursor hooks
119
+ target: project (default), user, or enterprise
120
+
121
+ uninstall [target] Remove Cursor hooks
122
+ target: project (default), user, or enterprise
123
+
124
+ status Check installation status
125
+
126
+ Examples:
127
+ npm run cursor:setup # Interactive wizard (recommended)
128
+ npm run cursor:install # Install for current project
129
+ claude-mem cursor install user # Install globally for user
130
+ claude-mem cursor uninstall # Remove from current project
131
+ claude-mem cursor status # Check if hooks are installed
132
+
133
+ For more info: https://docs.claude-mem.ai/cursor
134
+ `),0}}var _i,Go,Je=f(()=>{"use strict";J();We();vt();jo();_i=xi(yi),Go=p.join(T,"cursor-projects.json")});var Fn={};X(Fn,{checkGeminiCliHooksStatus:()=>er,handleGeminiCliCommand:()=>Bi,installGeminiCliHooks:()=>Zo,uninstallGeminiCliHooks:()=>Qo});import Cn from"path";import{homedir as Mi}from"os";import{existsSync as _e,readFileSync as Mt,writeFileSync as hn,mkdirSync as qo}from"fs";function Ii(t,e,o){let r=xe[o];if(!r)throw new Error(`Unknown Gemini CLI event: ${o}`);let s=t.replace(/\\/g,"\\\\"),i=e.replace(/\\/g,"\\\\");return`"${s}" "${i}" hook gemini-cli ${r}`}function Oi(t){return{matcher:"*",hooks:[{name:Ke,type:"command",command:t,timeout:ki}]}}function En(){if(!_e(V))return{};let t=Mt(V,"utf-8");try{return JSON.parse(t)}catch{throw new Error(`Corrupt JSON in ${V}, refusing to overwrite user settings`)}}function zo(t){qo(kt,{recursive:!0}),hn(V,JSON.stringify(t,null,2)+`
135
+ `)}function Ti(t,e){let o={...t};o.hooks||(o.hooks={});for(let[r,s]of Object.entries(e)){let i=o.hooks[r]??[];for(let n of s){let u=i.findIndex(c=>c.hooks.some(D=>D.name===Ke));if(u>=0){let c=i[u],D=c.hooks.findIndex(d=>d.name===Ke);D>=0?c.hooks[D]=n.hooks[0]:c.hooks.push(n.hooks[0])}else i.push(n)}o.hooks[r]=i}return o}function Ri(){let t="<claude-mem-context>",o=`${t}
64
136
  # Memory Context from Past Sessions
65
137
 
66
138
  *No context yet. Complete your first session and context will appear here.*
67
- </claude-mem-context>`,r="";if(Ee(H)&&(r=vt(H,"utf-8")),r.includes(t))return;let s=r.length>0&&!r.endsWith(`
139
+ </claude-mem-context>`,r="";if(_e(K)&&(r=Mt(K,"utf-8")),r.includes(t))return;let s=r.length>0&&!r.endsWith(`
68
140
  `)?`
69
141
 
70
142
  `:r.length>0?`
71
143
  `:"",i=r+s+o+`
72
- `;So(St,{recursive:!0}),un(H,i)}async function bo(){console.log(`
144
+ `;qo(kt,{recursive:!0}),hn(K,i)}async function Zo(){console.log(`
73
145
  Installing Claude-Mem Gemini CLI hooks...
74
- `);let t=Ft();if(!t)return console.error("Could not find worker-service.cjs"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/worker-service.cjs"),1;let e=yt();console.log(` Using Bun runtime: ${e}`),console.log(` Worker service: ${t}`);try{let o={};for(let n of Object.keys(he)){let u=qs(e,t,n);o[n]=[zs(u)]}let r=an(),s=Zs(r,o);_o(s),console.log(` Merged hooks into ${J}`),Qs(),console.log(` Setup context injection in ${H}`);let i=Object.keys(he);console.log(` Registered ${i.length} hook events:`);for(let n of i){let u=he[n];console.log(` ${n} \u2192 ${u}`)}return console.log(`
146
+ `);let t=Fe();if(!t)return console.error("Could not find worker-service.cjs"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/worker-service.cjs"),1;let e=ye();console.log(` Using Bun runtime: ${e}`),console.log(` Worker service: ${t}`);try{let o={};for(let n of Object.keys(xe)){let u=Ii(e,t,n);o[n]=[Oi(u)]}let r=En(),s=Ti(r,o);zo(s),console.log(` Merged hooks into ${V}`),Ri(),console.log(` Setup context injection in ${K}`);let i=Object.keys(xe);console.log(` Registered ${i.length} hook events:`);for(let n of i){let u=xe[n];console.log(` ${n} \u2192 ${u}`)}return console.log(`
75
147
  Installation complete!
76
148
 
77
- Hooks installed to: ${J}
149
+ Hooks installed to: ${V}
78
150
  Using unified CLI: bun worker-service.cjs hook gemini-cli <event>
79
151
 
80
152
  Next steps:
@@ -86,21 +158,21 @@ Context Injection:
86
158
  Context from past sessions is injected via ~/.gemini/GEMINI.md
87
159
  and automatically included in Gemini CLI conversations.
88
160
  `),0}catch(o){return console.error(`
89
- Installation failed: ${o.message}`),1}}function Ao(){console.log(`
161
+ Installation failed: ${o.message}`),1}}function Qo(){console.log(`
90
162
  Uninstalling Claude-Mem Gemini CLI hooks...
91
- `);try{if(!Ee(J))return console.log(" No Gemini CLI settings found \u2014 nothing to uninstall."),0;let t=an();if(!t.hooks)return console.log(" No hooks found in Gemini CLI settings \u2014 nothing to uninstall."),0;let e=0;for(let[o,r]of Object.entries(t.hooks)){let s=r.map(i=>{let n=i.hooks.filter(u=>u.name!==je);return e+=i.hooks.length-n.length,{...i,hooks:n}}).filter(i=>i.hooks.length>0);s.length>0?t.hooks[o]=s:delete t.hooks[o]}if(Object.keys(t.hooks).length===0&&delete t.hooks,_o(t),console.log(` Removed ${e} claude-mem hook(s) from ${J}`),Ee(H)){let o=vt(H,"utf-8"),r=/\n?<claude-mem-context>[\s\S]*?<\/claude-mem-context>\n?/;r.test(o)&&(o=o.replace(r,""),un(H,o),console.log(` Removed context section from ${H}`))}return console.log(`
163
+ `);try{if(!_e(V))return console.log(" No Gemini CLI settings found \u2014 nothing to uninstall."),0;let t=En();if(!t.hooks)return console.log(" No hooks found in Gemini CLI settings \u2014 nothing to uninstall."),0;let e=0;for(let[o,r]of Object.entries(t.hooks)){let s=r.map(i=>{let n=i.hooks.filter(u=>u.name!==Ke);return e+=i.hooks.length-n.length,{...i,hooks:n}}).filter(i=>i.hooks.length>0);s.length>0?t.hooks[o]=s:delete t.hooks[o]}if(Object.keys(t.hooks).length===0&&delete t.hooks,zo(t),console.log(` Removed ${e} claude-mem hook(s) from ${V}`),_e(K)){let o=Mt(K,"utf-8"),r=/\n?<claude-mem-context>[\s\S]*?<\/claude-mem-context>\n?/;r.test(o)&&(o=o.replace(r,""),hn(K,o),console.log(` Removed context section from ${K}`))}return console.log(`
92
164
  Uninstallation complete!
93
165
  `),console.log("Restart Gemini CLI to apply changes."),0}catch(t){return console.error(`
94
- Uninstallation failed: ${t.message}`),1}}function wo(){if(console.log(`
166
+ Uninstallation failed: ${t.message}`),1}}function er(){if(console.log(`
95
167
  Claude-Mem Gemini CLI Hooks Status
96
- `),!Ee(J))return console.log("Gemini CLI settings: Not found"),console.log(` Expected at: ${J}
168
+ `),!_e(V))return console.log("Gemini CLI settings: Not found"),console.log(` Expected at: ${V}
97
169
  `),console.log(`No hooks installed. Run: claude-mem install --ide gemini-cli
98
- `),0;let t;try{t=an()}catch(o){return console.log(`Gemini CLI settings: ${o.message}
170
+ `),0;let t;try{t=En()}catch(o){return console.log(`Gemini CLI settings: ${o.message}
99
171
  `),0}if(!t.hooks)return console.log(`Gemini CLI settings: Found, but no hooks configured
100
172
  `),console.log(`No hooks installed. Run: claude-mem install --ide gemini-cli
101
- `),0;let e=[];for(let[o,r]of Object.entries(t.hooks))r.some(i=>i.hooks.some(n=>n.name===je))&&e.push(o);if(e.length===0)return console.log(`Gemini CLI settings: Found, but no claude-mem hooks
173
+ `),0;let e=[];for(let[o,r]of Object.entries(t.hooks))r.some(i=>i.hooks.some(n=>n.name===Ke))&&e.push(o);if(e.length===0)return console.log(`Gemini CLI settings: Found, but no claude-mem hooks
102
174
  `),console.log(`Run: claude-mem install --ide gemini-cli
103
- `),0;console.log(`Settings: ${J}`),console.log("Mode: Unified CLI (bun worker-service.cjs hook gemini-cli)"),console.log(`Events: ${e.length} of ${Object.keys(he).length} mapped`);for(let o of e){let r=he[o]??"unknown";console.log(` ${o} \u2192 ${r}`)}return Ee(H)?vt(H,"utf-8").includes("<claude-mem-context>")?console.log(`Context: Active (${H})`):console.log("Context: GEMINI.md exists but missing claude-mem section"):console.log("Context: No GEMINI.md found"),console.log(""),0}async function ei(t,e){switch(t){case"install":return bo();case"uninstall":return Ao();case"status":return wo();default:return console.log(`
175
+ `),0;console.log(`Settings: ${V}`),console.log("Mode: Unified CLI (bun worker-service.cjs hook gemini-cli)"),console.log(`Events: ${e.length} of ${Object.keys(xe).length} mapped`);for(let o of e){let r=xe[o]??"unknown";console.log(` ${o} \u2192 ${r}`)}return _e(K)?Mt(K,"utf-8").includes("<claude-mem-context>")?console.log(`Context: Active (${K})`):console.log("Context: GEMINI.md exists but missing claude-mem section"):console.log("Context: No GEMINI.md found"),console.log(""),0}async function Bi(t,e){switch(t){case"install":return Zo();case"uninstall":return Qo();case"status":return er();default:return console.log(`
104
176
  Claude-Mem Gemini CLI Integration
105
177
 
106
178
  Usage: claude-mem gemini-cli <command>
@@ -116,36 +188,36 @@ Examples:
116
188
  claude-mem gemini-cli uninstall # Remove hooks
117
189
 
118
190
  For more info: https://docs.claude-mem.ai/usage/gemini-provider
119
- `),0}}var St,J,H,je,Ys,he,ln=p(()=>{"use strict";xt();St=sn.join(Xs(),".gemini"),J=sn.join(St,"settings.json"),H=sn.join(St,"GEMINI.md"),je="claude-mem",Ys=1e4,he={SessionStart:"context",BeforeAgent:"user-message",AfterAgent:"observation",BeforeTool:"observation",AfterTool:"observation",PreCompress:"summarize",Notification:"observation",SessionEnd:"session-complete"}});import ti from"path";import{existsSync as ni,readFileSync as oi,writeFileSync as Dn,mkdirSync as ri}from"fs";function _t(t,e,o){let r=ti.dirname(t);ri(r,{recursive:!0});let s=`${Ne}
191
+ `),0}}var kt,V,K,Ke,ki,xe,yn=f(()=>{"use strict";Je();kt=Cn.join(Mi(),".gemini"),V=Cn.join(kt,"settings.json"),K=Cn.join(kt,"GEMINI.md"),Ke="claude-mem",ki=1e4,xe={SessionStart:"context",BeforeAgent:"user-message",AfterAgent:"observation",BeforeTool:"observation",AfterTool:"observation",PreCompress:"summarize",Notification:"observation",SessionEnd:"session-complete"}});import Pi from"path";import{existsSync as Li,readFileSync as Ni,writeFileSync as xn,mkdirSync as ji}from"fs";function It(t,e,o){let r=Pi.dirname(t);ji(r,{recursive:!0});let s=`${Ve}
120
192
  ${e}
121
- ${Fe}`;if(ni(t)){let i=oi(t,"utf-8"),n=i.indexOf(Ne),u=i.indexOf(Fe);n!==-1&&u!==-1?i=i.slice(0,n)+s+i.slice(u+Fe.length):i=i.trimEnd()+`
193
+ ${ve}`;if(Li(t)){let i=Ni(t,"utf-8"),n=i.indexOf(Ve),u=i.indexOf(ve);n!==-1&&u!==-1?i=i.slice(0,n)+s+i.slice(u+ve.length):i=i.trimEnd()+`
122
194
 
123
195
  `+s+`
124
- `,Dn(t,i,"utf-8")}else o?Dn(t,`${o}
196
+ `,xn(t,i,"utf-8")}else o?xn(t,`${o}
125
197
 
126
198
  ${s}
127
- `,"utf-8"):Dn(t,s+`
128
- `,"utf-8")}var Ne,Fe,dn=p(()=>{"use strict";Ne="<claude-mem-context>",Fe="</claude-mem-context>"});var pn={};X(pn,{checkOpenCodeStatus:()=>Di,findBuiltPluginPath:()=>Io,getInstalledPluginPath:()=>Ge,getOpenCodeAgentsMdPath:()=>Ue,getOpenCodeConfigDirectory:()=>bt,getOpenCodePluginsDirectory:()=>mn,injectContextIntoAgentsMd:()=>ae,installOpenCodeIntegration:()=>di,installOpenCodePlugin:()=>Oo,syncContextToAgentsMd:()=>ci,uninstallOpenCodePlugin:()=>li});import te from"path";import{homedir as ko}from"os";import{fileURLToPath as si}from"url";import{existsSync as ye,readFileSync as Mo,writeFileSync as ii,mkdirSync as ui,copyFileSync as ai,unlinkSync as $o}from"fs";function bt(){return process.env.OPENCODE_CONFIG_DIR?process.env.OPENCODE_CONFIG_DIR:te.join(ko(),".config","opencode")}function mn(){return te.join(bt(),"plugins")}function Ue(){return te.join(bt(),"AGENTS.md")}function Ge(){return te.join(mn(),"claude-mem.js")}function Io(){let t=[te.join(process.env.CLAUDE_CONFIG_DIR||te.join(ko(),".claude"),"plugins","marketplaces","thedotmack","dist","opencode-plugin","index.js"),te.join(te.dirname(si(import.meta.url)),"..","..","..","dist","opencode-plugin","index.js")];for(let e of t)if(ye(e))return e;return null}function Oo(){let t=Io();if(!t)return console.error("Could not find built OpenCode plugin bundle."),console.error(" Expected at: dist/opencode-plugin/index.js"),console.error(" Run the build first: npm run build"),1;let e=mn(),o=Ge();try{return ui(e,{recursive:!0}),ai(t,o),console.log(` Plugin installed to: ${o}`),m.info("OPENCODE","Plugin installed",{destination:o}),0}catch(r){let s=r instanceof Error?r.message:String(r);return console.error(`Failed to install OpenCode plugin: ${s}`),1}}function ae(t){let e=Ue();try{return _t(e,t,"# Claude-Mem Memory Context"),m.info("OPENCODE","Context injected into AGENTS.md",{path:e}),0}catch(o){let r=o instanceof Error?o.message:String(o);return console.error(`Failed to inject context into AGENTS.md: ${r}`),1}}async function ci(t,e){try{let o=await fetch(`http://127.0.0.1:${t}/api/context/inject?project=${encodeURIComponent(e)}`);if(!o.ok)return;let r=await o.text();r&&r.trim()&&ae(r)!==0&&m.warn("OPENCODE","Failed to inject context into AGENTS.md during sync")}catch{}}function li(){let t=!1,e=Ge();if(ye(e))try{$o(e),console.log(` Removed plugin: ${e}`)}catch(r){let s=r instanceof Error?r.message:String(r);console.error(` Failed to remove plugin: ${s}`),t=!0}let o=Ue();if(ye(o))try{let r=Mo(o,"utf-8"),s=r.indexOf(Ne),i=r.indexOf(Fe);if(s!==-1&&i!==-1){r=r.slice(0,s).trimEnd()+`
129
- `+r.slice(i+Fe.length).trimStart();let n=r.trim();n.length===0||n==="# Claude-Mem Memory Context"?($o(o),console.log(" Removed empty AGENTS.md")):(ii(o,n+`
130
- `,"utf-8"),console.log(" Cleaned context from AGENTS.md"))}}catch(r){let s=r instanceof Error?r.message:String(r);console.error(` Failed to clean AGENTS.md: ${s}`),t=!0}return t?1:0}function Di(){console.log(`
199
+ `,"utf-8"):xn(t,s+`
200
+ `,"utf-8")}var Ve,ve,_n=f(()=>{"use strict";Ve="<claude-mem-context>",ve="</claude-mem-context>"});var Sn={};X(Sn,{checkOpenCodeStatus:()=>Vi,findBuiltPluginPath:()=>rr,getInstalledPluginPath:()=>Ye,getOpenCodeAgentsMdPath:()=>Xe,getOpenCodeConfigDirectory:()=>Ot,getOpenCodePluginsDirectory:()=>vn,injectContextIntoAgentsMd:()=>le,installOpenCodeIntegration:()=>Xi,installOpenCodePlugin:()=>sr,syncContextToAgentsMd:()=>Ji,uninstallOpenCodePlugin:()=>Ki});import oe from"path";import{homedir as nr}from"os";import{fileURLToPath as Ui}from"url";import{existsSync as Se,readFileSync as or,writeFileSync as Gi,mkdirSync as Wi,copyFileSync as Hi,unlinkSync as tr}from"fs";function Ot(){return process.env.OPENCODE_CONFIG_DIR?process.env.OPENCODE_CONFIG_DIR:oe.join(nr(),".config","opencode")}function vn(){return oe.join(Ot(),"plugins")}function Xe(){return oe.join(Ot(),"AGENTS.md")}function Ye(){return oe.join(vn(),"claude-mem.js")}function rr(){let t=[oe.join(process.env.CLAUDE_CONFIG_DIR||oe.join(nr(),".claude"),"plugins","marketplaces","thedotmack","dist","opencode-plugin","index.js"),oe.join(oe.dirname(Ui(import.meta.url)),"..","..","..","dist","opencode-plugin","index.js")];for(let e of t)if(Se(e))return e;return null}function sr(){let t=rr();if(!t)return console.error("Could not find built OpenCode plugin bundle."),console.error(" Expected at: dist/opencode-plugin/index.js"),console.error(" Run the build first: npm run build"),1;let e=vn(),o=Ye();try{return Wi(e,{recursive:!0}),Hi(t,o),console.log(` Plugin installed to: ${o}`),m.info("OPENCODE","Plugin installed",{destination:o}),0}catch(r){let s=r instanceof Error?r.message:String(r);return console.error(`Failed to install OpenCode plugin: ${s}`),1}}function le(t){let e=Xe();try{return It(e,t,"# Claude-Mem Memory Context"),m.info("OPENCODE","Context injected into AGENTS.md",{path:e}),0}catch(o){let r=o instanceof Error?o.message:String(o);return console.error(`Failed to inject context into AGENTS.md: ${r}`),1}}async function Ji(t,e){try{let o=await fetch(`http://127.0.0.1:${t}/api/context/inject?project=${encodeURIComponent(e)}`);if(!o.ok)return;let r=await o.text();r&&r.trim()&&le(r)!==0&&m.warn("OPENCODE","Failed to inject context into AGENTS.md during sync")}catch{}}function Ki(){let t=!1,e=Ye();if(Se(e))try{tr(e),console.log(` Removed plugin: ${e}`)}catch(r){let s=r instanceof Error?r.message:String(r);console.error(` Failed to remove plugin: ${s}`),t=!0}let o=Xe();if(Se(o))try{let r=or(o,"utf-8"),s=r.indexOf(Ve),i=r.indexOf(ve);if(s!==-1&&i!==-1){r=r.slice(0,s).trimEnd()+`
201
+ `+r.slice(i+ve.length).trimStart();let n=r.trim();n.length===0||n==="# Claude-Mem Memory Context"?(tr(o),console.log(" Removed empty AGENTS.md")):(Gi(o,n+`
202
+ `,"utf-8"),console.log(" Cleaned context from AGENTS.md"))}}catch(r){let s=r instanceof Error?r.message:String(r);console.error(` Failed to clean AGENTS.md: ${s}`),t=!0}return t?1:0}function Vi(){console.log(`
131
203
  Claude-Mem OpenCode Integration Status
132
- `);let t=bt(),e=Ge(),o=Ue();if(console.log(`Config directory: ${t}`),console.log(` Exists: ${ye(t)?"yes":"no"}`),console.log(""),console.log(`Plugin: ${e}`),console.log(` Installed: ${ye(e)?"yes":"no"}`),console.log(""),console.log(`Context (AGENTS.md): ${o}`),ye(o)){let s=Mo(o,"utf-8").includes(Ne);console.log(" Exists: yes"),console.log(` Has claude-mem context: ${s?"yes":"no"}`)}else console.log(" Exists: no");return console.log(""),0}async function di(){console.log(`
204
+ `);let t=Ot(),e=Ye(),o=Xe();if(console.log(`Config directory: ${t}`),console.log(` Exists: ${Se(t)?"yes":"no"}`),console.log(""),console.log(`Plugin: ${e}`),console.log(` Installed: ${Se(e)?"yes":"no"}`),console.log(""),console.log(`Context (AGENTS.md): ${o}`),Se(o)){let s=or(o,"utf-8").includes(Ve);console.log(" Exists: yes"),console.log(` Has claude-mem context: ${s?"yes":"no"}`)}else console.log(" Exists: no");return console.log(""),0}async function Xi(){console.log(`
133
205
  Installing Claude-Mem for OpenCode...
134
- `);let t=Oo();if(t!==0)return t;let e=`# Memory Context from Past Sessions
206
+ `);let t=sr();if(t!==0)return t;let e=`# Memory Context from Past Sessions
135
207
 
136
208
  *No context yet. Complete your first session and context will appear here.*
137
209
 
138
- Use claude-mem search tools for manual memory queries.`;try{let o=Et();if((await fetch(`http://127.0.0.1:${o}/api/readiness`)).ok){let s=await fetch(`http://127.0.0.1:${o}/api/context/inject?project=opencode`);if(s.ok){let i=await s.text();i&&i.trim()?ae(i)!==0?m.warn("OPENCODE","Failed to inject real context into AGENTS.md during install"):console.log(" Context injected from existing memory"):ae(e)!==0?m.warn("OPENCODE","Failed to inject placeholder context into AGENTS.md during install"):console.log(" Placeholder context created (will populate after first session)")}else ae(e)!==0&&m.warn("OPENCODE","Failed to inject placeholder context into AGENTS.md during install")}else ae(e)!==0?m.warn("OPENCODE","Failed to inject placeholder context into AGENTS.md during install"):console.log(" Placeholder context created (worker not running)")}catch{ae(e)!==0?m.warn("OPENCODE","Failed to inject placeholder context into AGENTS.md during install"):console.log(" Placeholder context created (worker not running)")}return console.log(`
210
+ Use claude-mem search tools for manual memory queries.`;try{let o=Ue();if((await fetch(`http://127.0.0.1:${o}/api/readiness`)).ok){let s=await fetch(`http://127.0.0.1:${o}/api/context/inject?project=opencode`);if(s.ok){let i=await s.text();i&&i.trim()?le(i)!==0?m.warn("OPENCODE","Failed to inject real context into AGENTS.md during install"):console.log(" Context injected from existing memory"):le(e)!==0?m.warn("OPENCODE","Failed to inject placeholder context into AGENTS.md during install"):console.log(" Placeholder context created (will populate after first session)")}else le(e)!==0&&m.warn("OPENCODE","Failed to inject placeholder context into AGENTS.md during install")}else le(e)!==0?m.warn("OPENCODE","Failed to inject placeholder context into AGENTS.md during install"):console.log(" Placeholder context created (worker not running)")}catch{le(e)!==0?m.warn("OPENCODE","Failed to inject placeholder context into AGENTS.md during install"):console.log(" Placeholder context created (worker not running)")}return console.log(`
139
211
  Installation complete!
140
212
 
141
- Plugin installed to: ${Ge()}
142
- Context file: ${Ue()}
213
+ Plugin installed to: ${Ye()}
214
+ Context file: ${Xe()}
143
215
 
144
216
  Next steps:
145
217
  1. Start claude-mem worker: npx claude-mem start
146
218
  2. Restart OpenCode to load the plugin
147
219
  3. Memory capture is automatic from then on
148
- `),0}var gn=p(()=>{"use strict";W();dn();Le()});var hn={};X(hn,{checkWindsurfHooksStatus:()=>Uo,handleWindsurfCommand:()=>Ei,installWindsurfHooks:()=>jo,readWindsurfRegistry:()=>kt,registerWindsurfProject:()=>Po,uninstallWindsurfHooks:()=>No,unregisterWindsurfProject:()=>Lo,updateWindsurfContextForProject:()=>gi,writeWindsurfContextFile:()=>Cn,writeWindsurfRegistry:()=>fn});import R from"path";import{homedir as mi}from"os";import{existsSync as xe,readFileSync as wt,writeFileSync as He,unlinkSync as To,mkdirSync as $t,renameSync as pi}from"fs";function kt(){try{return xe(We)?JSON.parse(wt(We,"utf-8")):{}}catch(t){return m.error("WINDSURF","Failed to read registry, using empty",{file:We},t),{}}}function fn(t){let e=R.dirname(We);$t(e,{recursive:!0}),He(We,JSON.stringify(t,null,2))}function Po(t){let e=kt();e[t]={installedAt:new Date().toISOString()},fn(e),m.info("WINDSURF","Registered project for auto-context updates",{workspacePath:t})}function Lo(t){let e=kt();e[t]&&(delete e[t],fn(e),m.info("WINDSURF","Unregistered project",{workspacePath:t}))}async function gi(t,e,o){if(kt()[e])try{let i=await fetch(`http://127.0.0.1:${o}/api/context/inject?project=${encodeURIComponent(t)}`);if(!i.ok)return;let n=await i.text();if(!n||!n.trim())return;Cn(e,n),m.debug("WINDSURF","Updated context file",{projectName:t,workspacePath:e})}catch(i){m.error("WINDSURF","Failed to update context file",{projectName:t,workspacePath:e},i)}}function Cn(t,e){let o=R.join(t,".windsurf","rules"),r=R.join(o,"claude-mem-context.md"),s=`${r}.tmp`;$t(o,{recursive:!0});let i=`# Memory Context from Past Sessions
220
+ `),0}var An=f(()=>{"use strict";J();_n();We()});var $n={};X($n,{checkWindsurfHooksStatus:()=>mr,handleWindsurfCommand:()=>tu,installWindsurfHooks:()=>Dr,readWindsurfRegistry:()=>Pt,registerWindsurfProject:()=>cr,uninstallWindsurfHooks:()=>dr,unregisterWindsurfProject:()=>lr,updateWindsurfContextForProject:()=>zi,writeWindsurfContextFile:()=>wn,writeWindsurfRegistry:()=>bn});import L from"path";import{homedir as Yi}from"os";import{existsSync as Ae,readFileSync as Rt,writeFileSync as ze,unlinkSync as ir,mkdirSync as Bt,renameSync as qi}from"fs";function Pt(){try{return Ae(qe)?JSON.parse(Rt(qe,"utf-8")):{}}catch(t){return m.error("WINDSURF","Failed to read registry, using empty",{file:qe},t),{}}}function bn(t){let e=L.dirname(qe);Bt(e,{recursive:!0}),ze(qe,JSON.stringify(t,null,2))}function cr(t){let e=Pt();e[t]={installedAt:new Date().toISOString()},bn(e),m.info("WINDSURF","Registered project for auto-context updates",{workspacePath:t})}function lr(t){let e=Pt();e[t]&&(delete e[t],bn(e),m.info("WINDSURF","Unregistered project",{workspacePath:t}))}async function zi(t,e,o){if(Pt()[e])try{let i=await fetch(`http://127.0.0.1:${o}/api/context/inject?project=${encodeURIComponent(t)}`);if(!i.ok)return;let n=await i.text();if(!n||!n.trim())return;wn(e,n),m.debug("WINDSURF","Updated context file",{projectName:t,workspacePath:e})}catch(i){m.error("WINDSURF","Failed to update context file",{projectName:t,workspacePath:e},i)}}function wn(t,e){let o=L.join(t,".windsurf","rules"),r=L.join(o,"claude-mem-context.md"),s=`${r}.tmp`;Bt(o,{recursive:!0});let i=`# Memory Context from Past Sessions
149
221
 
150
222
  The following context is from claude-mem, a persistent memory system that tracks your coding sessions.
151
223
 
@@ -153,15 +225,15 @@ ${e}
153
225
 
154
226
  ---
155
227
  *Auto-updated by claude-mem after each session. Use MCP search tools for detailed queries.*
156
- `;i.length>Bo&&(i=i.slice(0,Bo-50)+`
228
+ `;i.length>ur&&(i=i.slice(0,ur-50)+`
157
229
 
158
230
  *[Truncated \u2014 use MCP search for full history]*
159
- `),He(s,i),pi(s,r)}function fi(t,e,o){let s={pre_user_prompt:"session-init",post_write_code:"file-edit",post_run_command:"observation",post_mcp_tool_use:"observation",post_cascade_response:"observation"}[o]??"observation";return`"${t}" "${e}" hook windsurf ${s}`}function Ci(t,e,o){$t(Ro,{recursive:!0});let r={hooks:{}};if(xe(B))try{r=JSON.parse(wt(B,"utf-8")),r.hooks||(r.hooks={})}catch{throw new Error(`Corrupt hooks.json at ${B}, refusing to overwrite`)}for(let s of At){let n={command:fi(t,e,s),show_output:!1,working_directory:o},u=(r.hooks[s]??[]).filter(c=>!c.command.includes("worker-service")||!c.command.includes("windsurf"));r.hooks[s]=[...u,n]}He(B,JSON.stringify(r,null,2))}async function jo(){console.log(`
231
+ `),ze(s,i),qi(s,r)}function Zi(t,e,o){let s={pre_user_prompt:"session-init",post_write_code:"file-edit",post_run_command:"observation",post_mcp_tool_use:"observation",post_cascade_response:"observation"}[o]??"observation";return`"${t}" "${e}" hook windsurf ${s}`}function Qi(t,e,o){Bt(ar,{recursive:!0});let r={hooks:{}};if(Ae(P))try{r=JSON.parse(Rt(P,"utf-8")),r.hooks||(r.hooks={})}catch{throw new Error(`Corrupt hooks.json at ${P}, refusing to overwrite`)}for(let s of Tt){let n={command:Zi(t,e,s),show_output:!1,working_directory:o},u=(r.hooks[s]??[]).filter(c=>!c.command.includes("worker-service")||!c.command.includes("windsurf"));r.hooks[s]=[...u,n]}ze(P,JSON.stringify(r,null,2))}async function Dr(){console.log(`
160
232
  Installing Claude-Mem Windsurf hooks (user level)...
161
- `);let t=Ft();if(!t)return console.error("Could not find worker-service.cjs"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/worker-service.cjs"),1;let e=yt();if(!e)return console.error("Could not find Bun runtime"),console.error(" Install Bun: curl -fsSL https://bun.sh/install | bash"),1;let o=R.dirname(t);try{console.log(` Using Bun runtime: ${e}`),console.log(` Worker service: ${t}`),Ci(e,t,o),console.log(" Created/merged hooks.json");let r=process.cwd();return await hi(r),console.log(`
233
+ `);let t=Fe();if(!t)return console.error("Could not find worker-service.cjs"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/worker-service.cjs"),1;let e=ye();if(!e)return console.error("Could not find Bun runtime"),console.error(" Install Bun: curl -fsSL https://bun.sh/install | bash"),1;let o=L.dirname(t);try{console.log(` Using Bun runtime: ${e}`),console.log(` Worker service: ${t}`),Qi(e,t,o),console.log(" Created/merged hooks.json");let r=process.cwd();return await eu(r),console.log(`
162
234
  Installation complete!
163
235
 
164
- Hooks installed to: ${B}
236
+ Hooks installed to: ${P}
165
237
  Using unified CLI: bun worker-service.cjs hook windsurf <command>
166
238
 
167
239
  Events registered:
@@ -176,21 +248,21 @@ Next steps:
176
248
  2. Restart Windsurf to load the hooks
177
249
  3. Context is injected via .windsurf/rules/claude-mem-context.md (workspace-level)
178
250
  `),0}catch(r){return console.error(`
179
- Installation failed: ${r.message}`),1}}async function hi(t){let e=Et(),o=R.basename(t),r=!1;console.log(" Generating initial context...");try{if((await fetch(`http://127.0.0.1:${e}/api/readiness`)).ok){let i=await fetch(`http://127.0.0.1:${e}/api/context/inject?project=${encodeURIComponent(o)}`);if(i.ok){let n=await i.text();n&&n.trim()&&(Cn(t,n),r=!0,console.log(" Generated initial context from existing memory"))}}}catch(s){m.debug("WINDSURF","Worker not running during install",{},s)}if(!r){let s=R.join(t,".windsurf","rules");$t(s,{recursive:!0});let i=R.join(s,"claude-mem-context.md");He(i,`# Memory Context from Past Sessions
251
+ Installation failed: ${r.message}`),1}}async function eu(t){let e=Ue(),o=L.basename(t),r=!1;console.log(" Generating initial context...");try{if((await fetch(`http://127.0.0.1:${e}/api/readiness`)).ok){let i=await fetch(`http://127.0.0.1:${e}/api/context/inject?project=${encodeURIComponent(o)}`);if(i.ok){let n=await i.text();n&&n.trim()&&(wn(t,n),r=!0,console.log(" Generated initial context from existing memory"))}}}catch(s){m.debug("WINDSURF","Worker not running during install",{},s)}if(!r){let s=L.join(t,".windsurf","rules");Bt(s,{recursive:!0});let i=L.join(s,"claude-mem-context.md");ze(i,`# Memory Context from Past Sessions
180
252
 
181
253
  *No context yet. Complete your first session and context will appear here.*
182
254
 
183
255
  Use claude-mem's MCP search tools for manual memory queries.
184
- `),console.log(" Created placeholder context file (will populate after first session)")}Po(t),console.log(" Registered for auto-context updates")}function No(){console.log(`
256
+ `),console.log(" Created placeholder context file (will populate after first session)")}cr(t),console.log(" Registered for auto-context updates")}function dr(){console.log(`
185
257
  Uninstalling Claude-Mem Windsurf hooks...
186
- `);try{if(xe(B))try{let o=JSON.parse(wt(B,"utf-8"));for(let r of At)o.hooks[r]&&(o.hooks[r]=o.hooks[r].filter(s=>!s.command.includes("worker-service")||!s.command.includes("windsurf")),o.hooks[r].length===0&&delete o.hooks[r]);Object.keys(o.hooks).length===0?(To(B),console.log(" Removed hooks.json (no hooks remaining)")):(He(B,JSON.stringify(o,null,2)),console.log(" Removed claude-mem entries from hooks.json (other hooks preserved)"))}catch{console.log(" Warning: could not parse hooks.json \u2014 leaving file intact to preserve other hooks")}else console.log(" No hooks.json found");let t=process.cwd(),e=R.join(t,".windsurf","rules","claude-mem-context.md");return xe(e)&&(To(e),console.log(" Removed context file")),Lo(t),console.log(" Unregistered from auto-context updates"),console.log(`
258
+ `);try{if(Ae(P))try{let o=JSON.parse(Rt(P,"utf-8"));for(let r of Tt)o.hooks[r]&&(o.hooks[r]=o.hooks[r].filter(s=>!s.command.includes("worker-service")||!s.command.includes("windsurf")),o.hooks[r].length===0&&delete o.hooks[r]);Object.keys(o.hooks).length===0?(ir(P),console.log(" Removed hooks.json (no hooks remaining)")):(ze(P,JSON.stringify(o,null,2)),console.log(" Removed claude-mem entries from hooks.json (other hooks preserved)"))}catch{console.log(" Warning: could not parse hooks.json \u2014 leaving file intact to preserve other hooks")}else console.log(" No hooks.json found");let t=process.cwd(),e=L.join(t,".windsurf","rules","claude-mem-context.md");return Ae(e)&&(ir(e),console.log(" Removed context file")),lr(t),console.log(" Unregistered from auto-context updates"),console.log(`
187
259
  Uninstallation complete!
188
260
  `),console.log("Restart Windsurf to apply changes."),0}catch(t){return console.error(`
189
- Uninstallation failed: ${t.message}`),1}}function Uo(){if(console.log(`
261
+ Uninstallation failed: ${t.message}`),1}}function mr(){if(console.log(`
190
262
  Claude-Mem Windsurf Hooks Status
191
- `),xe(B)){console.log("User-level: Installed"),console.log(` Config: ${B}`);try{let e=JSON.parse(wt(B,"utf-8")),o=At.filter(r=>e.hooks[r]?.some(s=>s.command.includes("worker-service")&&s.command.includes("windsurf")));console.log(` Events: ${o.length}/${At.length} registered`);for(let r of o)console.log(` - ${r}`)}catch{console.log(" Mode: Unable to parse hooks.json")}let t=R.join(process.cwd(),".windsurf","rules","claude-mem-context.md");xe(t)?console.log(" Context: Active (current workspace)"):console.log(" Context: Not yet generated for this workspace")}else console.log("User-level: Not installed"),console.log(`
263
+ `),Ae(P)){console.log("User-level: Installed"),console.log(` Config: ${P}`);try{let e=JSON.parse(Rt(P,"utf-8")),o=Tt.filter(r=>e.hooks[r]?.some(s=>s.command.includes("worker-service")&&s.command.includes("windsurf")));console.log(` Events: ${o.length}/${Tt.length} registered`);for(let r of o)console.log(` - ${r}`)}catch{console.log(" Mode: Unable to parse hooks.json")}let t=L.join(process.cwd(),".windsurf","rules","claude-mem-context.md");Ae(t)?console.log(" Context: Active (current workspace)"):console.log(" Context: Not yet generated for this workspace")}else console.log("User-level: Not installed"),console.log(`
192
264
  No hooks installed. Run: claude-mem windsurf install
193
- `);return console.log(""),0}async function Ei(t,e){switch(t){case"install":return jo();case"uninstall":return No();case"status":return Uo();default:return console.log(`
265
+ `);return console.log(""),0}async function tu(t,e){switch(t){case"install":return Dr();case"uninstall":return dr();case"status":return mr();default:return console.log(`
194
266
  Claude-Mem Windsurf Integration
195
267
 
196
268
  Usage: claude-mem windsurf <command>
@@ -206,23 +278,23 @@ Examples:
206
278
  claude-mem windsurf status # Check if hooks are installed
207
279
 
208
280
  For more info: https://docs.claude-mem.ai/windsurf
209
- `),0}}var Ro,B,Bo,We,At,En=p(()=>{"use strict";W();Le();Ct();xt();Ro=R.join(mi(),".codeium","windsurf"),B=R.join(Ro,"hooks.json"),Bo=6e3,We=R.join(O,"windsurf-projects.json"),At=["pre_user_prompt","post_write_code","post_run_command","post_mcp_tool_use","post_cascade_response"]});var xn={};X(xn,{checkOpenClawStatus:()=>_i,findPluginManifestPath:()=>Ko,findPluginSkillsDirectory:()=>Vo,findPreBuiltPluginDirectory:()=>Jo,getOpenClawClaudeMemExtensionDirectory:()=>Ke,getOpenClawConfigDirectory:()=>Je,getOpenClawConfigFilePath:()=>ve,getOpenClawExtensionsDirectory:()=>Ho,installOpenClawIntegration:()=>bi,installOpenClawPlugin:()=>Yo,uninstallOpenClawPlugin:()=>Si});import x from"path";import{homedir as Mt}from"os";import{existsSync as K,readFileSync as Fi,writeFileSync as Go,mkdirSync as Wo,cpSync as Fn,rmSync as yi}from"fs";function Je(){return x.join(Mt(),".openclaw")}function Ho(){return x.join(Je(),"extensions")}function Ke(){return x.join(Ho(),"claude-mem")}function ve(){return x.join(Je(),"openclaw.json")}function Jo(){let t=[x.join(process.env.CLAUDE_CONFIG_DIR||x.join(Mt(),".claude"),"plugins","marketplaces","thedotmack"),process.cwd()];for(let e of t){let o=x.join(e,"openclaw","dist"),r=x.join(o,"index.js");if(K(r))return o}return null}function Ko(){let t=[x.join(process.env.CLAUDE_CONFIG_DIR||x.join(Mt(),".claude"),"plugins","marketplaces","thedotmack"),process.cwd()];for(let e of t){let o=x.join(e,"openclaw","openclaw.plugin.json");if(K(o))return o}return null}function Vo(){let t=[x.join(process.env.CLAUDE_CONFIG_DIR||x.join(Mt(),".claude"),"plugins","marketplaces","thedotmack"),process.cwd()];for(let e of t){let o=x.join(e,"openclaw","skills");if(K(o))return o}return null}function yn(){let t=ve();if(!K(t))return{};try{return JSON.parse(Fi(t,"utf-8"))}catch{return{}}}function Xo(t){let e=Je();Wo(e,{recursive:!0}),Go(ve(),JSON.stringify(t,null,2)+`
210
- `,"utf-8")}function xi(t=37777,e="openclaw",o=!0){let r=yn();if(r.plugins||(r.plugins={}),r.plugins.slots||(r.plugins.slots={}),r.plugins.entries||(r.plugins.entries={}),r.plugins.slots.memory="claude-mem",!r.plugins.entries["claude-mem"])r.plugins.entries["claude-mem"]={enabled:!0,config:{workerPort:t,project:e,syncMemoryFile:o}};else{r.plugins.entries["claude-mem"].enabled=!0,r.plugins.entries["claude-mem"].config||(r.plugins.entries["claude-mem"].config={});let s=r.plugins.entries["claude-mem"].config;s.workerPort===void 0&&(s.workerPort=t),s.project===void 0&&(s.project=e),s.syncMemoryFile===void 0&&(s.syncMemoryFile=o)}Xo(r)}function vi(){let t=ve();if(!K(t))return;let e=yn();e.plugins?.entries?.["claude-mem"]&&delete e.plugins.entries["claude-mem"],e.plugins?.slots?.memory==="claude-mem"&&delete e.plugins.slots.memory,Xo(e)}function Yo(){let t=Jo();if(!t)return console.error("Could not find pre-built OpenClaw plugin bundle."),console.error(" Expected at: openclaw/dist/index.js"),console.error(" Ensure the npm package includes the openclaw directory."),1;let e=Ke(),o=x.join(e,"dist");try{Wo(o,{recursive:!0}),Fn(t,o,{recursive:!0,force:!0}),console.log(` Plugin dist copied to: ${o}`);let r=Ko();if(r){let n=x.join(e,"openclaw.plugin.json");Fn(r,n,{force:!0}),console.log(` Plugin manifest copied to: ${n}`)}let s=Vo();if(s){let n=x.join(e,"skills");Fn(s,n,{recursive:!0,force:!0}),console.log(` Skills copied to: ${n}`)}let i={name:"claude-mem",version:"1.0.0",type:"module",main:"dist/index.js",openclaw:{extensions:["./dist/index.js"]}};return Go(x.join(e,"package.json"),JSON.stringify(i,null,2)+`
211
- `,"utf-8"),xi(),console.log(" Registered in openclaw.json"),m.info("OPENCLAW","Plugin installed",{destination:e}),0}catch(r){let s=r instanceof Error?r.message:String(r);return console.error(`Failed to install OpenClaw plugin: ${s}`),1}}function Si(){let t=!1,e=Ke();if(K(e))try{yi(e,{recursive:!0,force:!0}),console.log(` Removed extension: ${e}`)}catch(o){let r=o instanceof Error?o.message:String(o);console.error(` Failed to remove extension directory: ${r}`),t=!0}try{vi(),console.log(" Unregistered from openclaw.json")}catch(o){let r=o instanceof Error?o.message:String(o);console.error(` Failed to update openclaw.json: ${r}`),t=!0}return t?1:0}function _i(){console.log(`
281
+ `),0}}var ar,P,ur,qe,Tt,Mn=f(()=>{"use strict";J();We();vt();Je();ar=L.join(Yi(),".codeium","windsurf"),P=L.join(ar,"hooks.json"),ur=6e3,qe=L.join(T,"windsurf-projects.json"),Tt=["pre_user_prompt","post_write_code","post_run_command","post_mcp_tool_use","post_cascade_response"]});var On={};X(On,{checkOpenClawStatus:()=>uu,findPluginManifestPath:()=>hr,findPluginSkillsDirectory:()=>Er,findPreBuiltPluginDirectory:()=>Cr,getOpenClawClaudeMemExtensionDirectory:()=>Qe,getOpenClawConfigDirectory:()=>Ze,getOpenClawConfigFilePath:()=>be,getOpenClawExtensionsDirectory:()=>fr,installOpenClawIntegration:()=>au,installOpenClawPlugin:()=>yr,uninstallOpenClawPlugin:()=>iu});import _ from"path";import{homedir as Lt}from"os";import{existsSync as Y,readFileSync as nu,writeFileSync as pr,mkdirSync as gr,cpSync as kn,rmSync as ou}from"fs";function Ze(){return _.join(Lt(),".openclaw")}function fr(){return _.join(Ze(),"extensions")}function Qe(){return _.join(fr(),"claude-mem")}function be(){return _.join(Ze(),"openclaw.json")}function Cr(){let t=[_.join(process.env.CLAUDE_CONFIG_DIR||_.join(Lt(),".claude"),"plugins","marketplaces","thedotmack"),process.cwd()];for(let e of t){let o=_.join(e,"openclaw","dist"),r=_.join(o,"index.js");if(Y(r))return o}return null}function hr(){let t=[_.join(process.env.CLAUDE_CONFIG_DIR||_.join(Lt(),".claude"),"plugins","marketplaces","thedotmack"),process.cwd()];for(let e of t){let o=_.join(e,"openclaw","openclaw.plugin.json");if(Y(o))return o}return null}function Er(){let t=[_.join(process.env.CLAUDE_CONFIG_DIR||_.join(Lt(),".claude"),"plugins","marketplaces","thedotmack"),process.cwd()];for(let e of t){let o=_.join(e,"openclaw","skills");if(Y(o))return o}return null}function In(){let t=be();if(!Y(t))return{};try{return JSON.parse(nu(t,"utf-8"))}catch{return{}}}function Fr(t){let e=Ze();gr(e,{recursive:!0}),pr(be(),JSON.stringify(t,null,2)+`
282
+ `,"utf-8")}function ru(t=37777,e="openclaw",o=!0){let r=In();if(r.plugins||(r.plugins={}),r.plugins.slots||(r.plugins.slots={}),r.plugins.entries||(r.plugins.entries={}),r.plugins.slots.memory="claude-mem",!r.plugins.entries["claude-mem"])r.plugins.entries["claude-mem"]={enabled:!0,config:{workerPort:t,project:e,syncMemoryFile:o}};else{r.plugins.entries["claude-mem"].enabled=!0,r.plugins.entries["claude-mem"].config||(r.plugins.entries["claude-mem"].config={});let s=r.plugins.entries["claude-mem"].config;s.workerPort===void 0&&(s.workerPort=t),s.project===void 0&&(s.project=e),s.syncMemoryFile===void 0&&(s.syncMemoryFile=o)}Fr(r)}function su(){let t=be();if(!Y(t))return;let e=In();e.plugins?.entries?.["claude-mem"]&&delete e.plugins.entries["claude-mem"],e.plugins?.slots?.memory==="claude-mem"&&delete e.plugins.slots.memory,Fr(e)}function yr(){let t=Cr();if(!t)return console.error("Could not find pre-built OpenClaw plugin bundle."),console.error(" Expected at: openclaw/dist/index.js"),console.error(" Ensure the npm package includes the openclaw directory."),1;let e=Qe(),o=_.join(e,"dist");try{gr(o,{recursive:!0}),kn(t,o,{recursive:!0,force:!0}),console.log(` Plugin dist copied to: ${o}`);let r=hr();if(r){let n=_.join(e,"openclaw.plugin.json");kn(r,n,{force:!0}),console.log(` Plugin manifest copied to: ${n}`)}let s=Er();if(s){let n=_.join(e,"skills");kn(s,n,{recursive:!0,force:!0}),console.log(` Skills copied to: ${n}`)}let i={name:"claude-mem",version:"1.0.0",type:"module",main:"dist/index.js",openclaw:{extensions:["./dist/index.js"]}};return pr(_.join(e,"package.json"),JSON.stringify(i,null,2)+`
283
+ `,"utf-8"),ru(),console.log(" Registered in openclaw.json"),m.info("OPENCLAW","Plugin installed",{destination:e}),0}catch(r){let s=r instanceof Error?r.message:String(r);return console.error(`Failed to install OpenClaw plugin: ${s}`),1}}function iu(){let t=!1,e=Qe();if(Y(e))try{ou(e,{recursive:!0,force:!0}),console.log(` Removed extension: ${e}`)}catch(o){let r=o instanceof Error?o.message:String(o);console.error(` Failed to remove extension directory: ${r}`),t=!0}try{su(),console.log(" Unregistered from openclaw.json")}catch(o){let r=o instanceof Error?o.message:String(o);console.error(` Failed to update openclaw.json: ${r}`),t=!0}return t?1:0}function uu(){console.log(`
212
284
  Claude-Mem OpenClaw Integration Status
213
- `);let t=Je(),e=Ke(),o=ve(),r=x.join(e,"dist","index.js");if(console.log(`Config directory: ${t}`),console.log(` Exists: ${K(t)?"yes":"no"}`),console.log(""),console.log(`Extension directory: ${e}`),console.log(` Exists: ${K(e)?"yes":"no"}`),console.log(` Plugin entry: ${K(r)?"yes":"no"}`),console.log(""),console.log(`Config (openclaw.json): ${o}`),K(o)){let s=yn(),i=s.plugins?.entries?.["claude-mem"]!==void 0,n=s.plugins?.entries?.["claude-mem"]?.enabled===!0,u=s.plugins?.slots?.memory==="claude-mem";if(console.log(" Exists: yes"),console.log(` Registered: ${i?"yes":"no"}`),console.log(` Enabled: ${n?"yes":"no"}`),console.log(` Memory slot: ${u?"yes":"no"}`),i){let c=s.plugins.entries["claude-mem"].config;c&&(console.log(` Worker port: ${c.workerPort??"default"}`),console.log(` Project: ${c.project??"default"}`),console.log(` Sync MEMORY.md: ${c.syncMemoryFile??"default"}`))}}else console.log(" Exists: no");return console.log(""),0}async function bi(){console.log(`
285
+ `);let t=Ze(),e=Qe(),o=be(),r=_.join(e,"dist","index.js");if(console.log(`Config directory: ${t}`),console.log(` Exists: ${Y(t)?"yes":"no"}`),console.log(""),console.log(`Extension directory: ${e}`),console.log(` Exists: ${Y(e)?"yes":"no"}`),console.log(` Plugin entry: ${Y(r)?"yes":"no"}`),console.log(""),console.log(`Config (openclaw.json): ${o}`),Y(o)){let s=In(),i=s.plugins?.entries?.["claude-mem"]!==void 0,n=s.plugins?.entries?.["claude-mem"]?.enabled===!0,u=s.plugins?.slots?.memory==="claude-mem";if(console.log(" Exists: yes"),console.log(` Registered: ${i?"yes":"no"}`),console.log(` Enabled: ${n?"yes":"no"}`),console.log(` Memory slot: ${u?"yes":"no"}`),i){let c=s.plugins.entries["claude-mem"].config;c&&(console.log(` Worker port: ${c.workerPort??"default"}`),console.log(` Project: ${c.project??"default"}`),console.log(` Sync MEMORY.md: ${c.syncMemoryFile??"default"}`))}}else console.log(" Exists: no");return console.log(""),0}async function au(){console.log(`
214
286
  Installing Claude-Mem for OpenClaw...
215
- `);let t=Yo();if(t!==0)return t;let e=Ke();return console.log(`
287
+ `);let t=yr();if(t!==0)return t;let e=Qe();return console.log(`
216
288
  Installation complete!
217
289
 
218
290
  Plugin installed to: ${e}
219
- Config updated: ${ve()}
291
+ Config updated: ${be()}
220
292
 
221
293
  Next steps:
222
294
  1. Start claude-mem worker: npx claude-mem start
223
295
  2. Restart OpenClaw to load the plugin
224
296
  3. Memory capture is automatic from then on
225
- `),0}var vn=p(()=>{"use strict";W()});import zc from"path";var qo=p(()=>{"use strict";W()});import{existsSync as nl,readFileSync as ol,writeFileSync as rl,renameSync as sl}from"fs";import Ai from"path";import wi from"os";function zo(t,e){let o="<claude-mem-context>",r="</claude-mem-context>";if(!t)return`${o}
297
+ `),0}var Tn=f(()=>{"use strict";J()});import fl from"path";var xr=f(()=>{"use strict";J()});import{existsSync as yl,readFileSync as xl,writeFileSync as _l,renameSync as vl}from"fs";import cu from"path";import lu from"os";function _r(t,e){let o="<claude-mem-context>",r="</claude-mem-context>";if(!t)return`${o}
226
298
  ${e}
227
299
  ${r}`;let s=t.indexOf(o),i=t.indexOf(r);return s!==-1&&i!==-1?t.substring(0,s)+`${o}
228
300
  ${e}
@@ -230,57 +302,57 @@ ${r}`+t.substring(i+r.length):t+`
230
302
 
231
303
  ${o}
232
304
  ${e}
233
- ${r}`}var ml,Zo=p(()=>{"use strict";W();qo();nn();Le();ml=Ai.join(wi.homedir(),".claude-mem","settings.json")});import{existsSync as fl,readFileSync as Cl,writeFileSync as hl,mkdirSync as El}from"fs";import{homedir as Qo}from"os";import{join as er,dirname as xl}from"path";var V,Ve,$i,It,tr=p(()=>{"use strict";V=er(Qo(),".claude-mem","transcript-watch.json"),Ve=er(Qo(),".claude-mem","transcript-watch-state.json"),$i={name:"codex",version:"0.3",description:"Schema for Codex session JSONL files under ~/.codex/sessions.",events:[{name:"session-meta",match:{path:"type",equals:"session_meta"},action:"session_context",fields:{sessionId:"payload.id",cwd:"payload.cwd"}},{name:"turn-context",match:{path:"type",equals:"turn_context"},action:"session_context",fields:{cwd:"payload.cwd"}},{name:"user-message",match:{path:"payload.type",equals:"user_message"},action:"session_init",fields:{prompt:"payload.message"}},{name:"assistant-message",match:{path:"payload.type",equals:"agent_message"},action:"assistant_message",fields:{message:"payload.message"}},{name:"tool-use",match:{path:"payload.type",in:["function_call","custom_tool_call","web_search_call","exec_command"]},action:"tool_use",fields:{toolId:"payload.call_id",toolName:{coalesce:["payload.name","payload.type",{value:"web_search"}]},toolInput:{coalesce:["payload.arguments","payload.input","payload.command","payload.action"]}}},{name:"tool-result",match:{path:"payload.type",in:["function_call_output","custom_tool_call_output","exec_command_output"]},action:"tool_result",fields:{toolId:"payload.call_id",toolResponse:"payload.output"}},{name:"session-end",match:{path:"payload.type",in:["turn_aborted","turn_completed"]},action:"session_end"}]},It={version:1,schemas:{codex:$i},watches:[{name:"codex",path:"~/.codex/sessions/**/*.jsonl",schema:"codex",startAtEnd:!0,context:{mode:"agents",path:"~/.codex/AGENTS.md",updateOn:["session_start","session_end"]}}],stateFile:Ve}});var bn={};X(bn,{checkCodexCliStatus:()=>Ri,installCodexCli:()=>Ti,uninstallCodexCli:()=>Bi});import Ot from"path";import{homedir as nr}from"os";import{existsSync as ce,readFileSync as Xe,writeFileSync as Ye,mkdirSync as or}from"fs";function _n(){let t=V;if(!ce(t))return{version:1,schemas:{},watches:[],stateFile:Ve};try{let e=Xe(t,"utf-8"),o=JSON.parse(e);return o.version||(o.version=1),o.watches||(o.watches=[]),o.schemas||(o.schemas={}),o.stateFile||(o.stateFile=Ve),o}catch(e){m.error("CODEX","Corrupt transcript-watch.json, creating backup",{path:t},e);let o=`${t}.backup.${Date.now()}`;return Ye(o,Xe(t)),console.warn(` Backed up corrupt transcript-watch.json to ${o}`),{version:1,schemas:{},watches:[],stateFile:Ve}}}function Mi(t){let e={...t};e.schemas={...e.schemas};let o=It.schemas?.[ne];o&&(e.schemas[ne]=o);let r=It.watches.find(s=>s.name===ne);if(r){let s=e.watches.findIndex(i=>i.name===ne);s!==-1?e.watches[s]=r:e.watches.push(r)}return e}function rr(t){or(ki,{recursive:!0}),Ye(V,JSON.stringify(t,null,2)+`
234
- `)}function Ii(){try{or(Sn,{recursive:!0});let t="";ce($)&&(t=Xe($,"utf-8"));let e=["# Recent Activity","","<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->","","*No context yet. Complete your first session and context will appear here.*"].join(`
235
- `),o=zo(t,e);Ye($,o),console.log(` Injected context placeholder into ${$}`)}catch(t){m.warn("CODEX","Failed to inject AGENTS.md context",{error:t.message}),console.warn(` Warning: Could not inject context into AGENTS.md: ${t.message}`)}}function Oi(){try{if(!ce($))return;let t=Xe($,"utf-8"),e="<claude-mem-context>",o="</claude-mem-context>",r=t.indexOf(e),s=t.indexOf(o);if(r===-1||s===-1)return;let i=t.substring(0,r).replace(/\n+$/,""),n=t.substring(s+o.length).replace(/^\n+/,""),u=(i+(n?`
305
+ ${r}`}var Il,vr=f(()=>{"use strict";J();xr();ln();We();Il=cu.join(lu.homedir(),".claude-mem","settings.json")});import{existsSync as Rl,readFileSync as Bl,writeFileSync as Pl,mkdirSync as Ll}from"fs";import{homedir as Sr}from"os";import{join as Ar,dirname as Ul}from"path";var q,et,Du,Nt,br=f(()=>{"use strict";q=Ar(Sr(),".claude-mem","transcript-watch.json"),et=Ar(Sr(),".claude-mem","transcript-watch-state.json"),Du={name:"codex",version:"0.3",description:"Schema for Codex session JSONL files under ~/.codex/sessions.",events:[{name:"session-meta",match:{path:"type",equals:"session_meta"},action:"session_context",fields:{sessionId:"payload.id",cwd:"payload.cwd"}},{name:"turn-context",match:{path:"type",equals:"turn_context"},action:"session_context",fields:{cwd:"payload.cwd"}},{name:"user-message",match:{path:"payload.type",equals:"user_message"},action:"session_init",fields:{prompt:"payload.message"}},{name:"assistant-message",match:{path:"payload.type",equals:"agent_message"},action:"assistant_message",fields:{message:"payload.message"}},{name:"tool-use",match:{path:"payload.type",in:["function_call","custom_tool_call","web_search_call","exec_command"]},action:"tool_use",fields:{toolId:"payload.call_id",toolName:{coalesce:["payload.name","payload.type",{value:"web_search"}]},toolInput:{coalesce:["payload.arguments","payload.input","payload.command","payload.action"]}}},{name:"tool-result",match:{path:"payload.type",in:["function_call_output","custom_tool_call_output","exec_command_output"]},action:"tool_result",fields:{toolId:"payload.call_id",toolResponse:"payload.output"}},{name:"session-end",match:{path:"payload.type",in:["turn_aborted","turn_completed"]},action:"session_end"}]},Nt={version:1,schemas:{codex:Du},watches:[{name:"codex",path:"~/.codex/sessions/**/*.jsonl",schema:"codex",startAtEnd:!0,context:{mode:"agents",path:"~/.codex/AGENTS.md",updateOn:["session_start","session_end"]}}],stateFile:et}});var Pn={};X(Pn,{checkCodexCliStatus:()=>hu,installCodexCli:()=>fu,uninstallCodexCli:()=>Cu});import jt from"path";import{homedir as wr}from"os";import{existsSync as De,readFileSync as tt,writeFileSync as nt,mkdirSync as $r}from"fs";function Bn(){let t=q;if(!De(t))return{version:1,schemas:{},watches:[],stateFile:et};try{let e=tt(t,"utf-8"),o=JSON.parse(e);return o.version||(o.version=1),o.watches||(o.watches=[]),o.schemas||(o.schemas={}),o.stateFile||(o.stateFile=et),o}catch(e){m.error("CODEX","Corrupt transcript-watch.json, creating backup",{path:t},e);let o=`${t}.backup.${Date.now()}`;return nt(o,tt(t)),console.warn(` Backed up corrupt transcript-watch.json to ${o}`),{version:1,schemas:{},watches:[],stateFile:et}}}function mu(t){let e={...t};e.schemas={...e.schemas};let o=Nt.schemas?.[re];o&&(e.schemas[re]=o);let r=Nt.watches.find(s=>s.name===re);if(r){let s=e.watches.findIndex(i=>i.name===re);s!==-1?e.watches[s]=r:e.watches.push(r)}return e}function Mr(t){$r(du,{recursive:!0}),nt(q,JSON.stringify(t,null,2)+`
306
+ `)}function pu(){try{$r(Rn,{recursive:!0});let t="";De(M)&&(t=tt(M,"utf-8"));let e=["# Recent Activity","","<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->","","*No context yet. Complete your first session and context will appear here.*"].join(`
307
+ `),o=_r(t,e);nt(M,o),console.log(` Injected context placeholder into ${M}`)}catch(t){m.warn("CODEX","Failed to inject AGENTS.md context",{error:t.message}),console.warn(` Warning: Could not inject context into AGENTS.md: ${t.message}`)}}function gu(){try{if(!De(M))return;let t=tt(M,"utf-8"),e="<claude-mem-context>",o="</claude-mem-context>",r=t.indexOf(e),s=t.indexOf(o);if(r===-1||s===-1)return;let i=t.substring(0,r).replace(/\n+$/,""),n=t.substring(s+o.length).replace(/^\n+/,""),u=(i+(n?`
236
308
 
237
- `+n:"")).trim();u?Ye($,u+`
238
- `):Ye($,""),console.log(` Removed context section from ${$}`)}catch(t){m.warn("CODEX","Failed to clean AGENTS.md context",{error:t.message})}}async function Ti(){console.log(`
309
+ `+n:"")).trim();u?nt(M,u+`
310
+ `):nt(M,""),console.log(` Removed context section from ${M}`)}catch(t){m.warn("CODEX","Failed to clean AGENTS.md context",{error:t.message})}}async function fu(){console.log(`
239
311
  Installing Claude-Mem for Codex CLI (transcript watching)...
240
- `);try{let t=_n(),e=Mi(t);return rr(e),console.log(` Updated ${V}`),console.log(" Watch path: ~/.codex/sessions/**/*.jsonl"),console.log(` Schema: codex (v${It.schemas?.codex?.version??"?"})`),Ii(),console.log(`
312
+ `);try{let t=Bn(),e=mu(t);return Mr(e),console.log(` Updated ${q}`),console.log(" Watch path: ~/.codex/sessions/**/*.jsonl"),console.log(` Schema: codex (v${Nt.schemas?.codex?.version??"?"})`),pu(),console.log(`
241
313
  Installation complete!
242
314
 
243
- Transcript watch config: ${V}
244
- Context file: ${$}
315
+ Transcript watch config: ${q}
316
+ Context file: ${M}
245
317
 
246
318
  How it works:
247
319
  - claude-mem watches Codex session JSONL files for new activity
248
320
  - No hooks needed -- transcript watching is fully automatic
249
- - Context from past sessions is injected via ${$}
321
+ - Context from past sessions is injected via ${M}
250
322
 
251
323
  Next steps:
252
324
  1. Start claude-mem worker: npx claude-mem start
253
325
  2. Use Codex CLI as usual -- memory capture is automatic!
254
326
  `),0}catch(t){return console.error(`
255
- Installation failed: ${t.message}`),1}}function Bi(){console.log(`
327
+ Installation failed: ${t.message}`),1}}function Cu(){console.log(`
256
328
  Uninstalling Claude-Mem Codex CLI integration...
257
- `);try{if(ce(V)){let t=_n();t.watches=t.watches.filter(e=>e.name!==ne),t.schemas&&delete t.schemas[ne],rr(t),console.log(` Removed codex watch from ${V}`)}else console.log(" No transcript-watch.json found -- nothing to remove.");return Oi(),console.log(`
329
+ `);try{if(De(q)){let t=Bn();t.watches=t.watches.filter(e=>e.name!==re),t.schemas&&delete t.schemas[re],Mr(t),console.log(` Removed codex watch from ${q}`)}else console.log(" No transcript-watch.json found -- nothing to remove.");return gu(),console.log(`
258
330
  Uninstallation complete!`),console.log(`Restart claude-mem worker to apply changes.
259
331
  `),0}catch(t){return console.error(`
260
- Uninstallation failed: ${t.message}`),1}}function Ri(){if(console.log(`
332
+ Uninstallation failed: ${t.message}`),1}}function hu(){if(console.log(`
261
333
  Claude-Mem Codex CLI Integration Status
262
- `),!ce(V))return console.log("Status: Not installed"),console.log(` No transcript watch config at ${V}`),console.log(`
334
+ `),!De(q))return console.log("Status: Not installed"),console.log(` No transcript watch config at ${q}`),console.log(`
263
335
  Run: npx claude-mem install --ide codex-cli
264
- `),0;try{let t=_n(),e=t.watches.find(s=>s.name===ne),o=t.schemas?.[ne];if(!e)return console.log("Status: Not installed"),console.log(" transcript-watch.json exists but no codex watch configured."),console.log(`
336
+ `),0;try{let t=Bn(),e=t.watches.find(s=>s.name===re),o=t.schemas?.[re];if(!e)return console.log("Status: Not installed"),console.log(" transcript-watch.json exists but no codex watch configured."),console.log(`
265
337
  Run: npx claude-mem install --ide codex-cli
266
- `),0;console.log("Status: Installed"),console.log(` Config: ${V}`),console.log(` Watch path: ${e.path}`),console.log(` Schema: ${o?`codex (v${o.version??"?"})`:"missing"}`),console.log(` Start at end: ${e.startAtEnd??!1}`),e.context&&(console.log(` Context mode: ${e.context.mode}`),console.log(` Context path: ${e.context.path??"default"}`),console.log(` Context updates on: ${e.context.updateOn?.join(", ")??"none"}`)),ce($)?Xe($,"utf-8").includes("<claude-mem-context>")?console.log(` Context: Active (${$})`):console.log(" Context: AGENTS.md exists but no context tags"):console.log(" Context: No AGENTS.md file");let r=Ot.join(Sn,"sessions");ce(r)?console.log(" Sessions directory: exists"):console.log(" Sessions directory: not yet created (use Codex CLI to generate sessions)")}catch{console.log("Status: Unknown"),console.log(" Could not parse transcript-watch.json.")}return console.log(""),0}var Sn,$,ki,ne,An=p(()=>{"use strict";W();Zo();tr();Sn=Ot.join(nr(),".codex"),$=Ot.join(Sn,"AGENTS.md"),ki=Ot.join(nr(),".claude-mem"),ne="codex"});var lr={};X(lr,{MCP_IDE_INSTALLERS:()=>Xi,installGooseMcpIntegration:()=>cr});import T from"path";import{homedir as Ze}from"os";import{existsSync as ur,readFileSync as Pi,writeFileSync as ze,mkdirSync as ar}from"fs";function ji(t){return{command:process.execPath,args:[t]}}function Ni(t,e,o="mcpServers"){let r=T.dirname(t);ar(r,{recursive:!0});let s=j(t,{});s[o]||(s[o]={}),s[o]["claude-mem"]=ji(e),ze(t,JSON.stringify(s,null,2)+`
267
- `)}function qe(t){return async()=>{console.log(`
338
+ `),0;console.log("Status: Installed"),console.log(` Config: ${q}`),console.log(` Watch path: ${e.path}`),console.log(` Schema: ${o?`codex (v${o.version??"?"})`:"missing"}`),console.log(` Start at end: ${e.startAtEnd??!1}`),e.context&&(console.log(` Context mode: ${e.context.mode}`),console.log(` Context path: ${e.context.path??"default"}`),console.log(` Context updates on: ${e.context.updateOn?.join(", ")??"none"}`)),De(M)?tt(M,"utf-8").includes("<claude-mem-context>")?console.log(` Context: Active (${M})`):console.log(" Context: AGENTS.md exists but no context tags"):console.log(" Context: No AGENTS.md file");let r=jt.join(Rn,"sessions");De(r)?console.log(" Sessions directory: exists"):console.log(" Sessions directory: not yet created (use Codex CLI to generate sessions)")}catch{console.log("Status: Unknown"),console.log(" Could not parse transcript-watch.json.")}return console.log(""),0}var Rn,M,du,re,Ln=f(()=>{"use strict";J();vr();br();Rn=jt.join(wr(),".codex"),M=jt.join(Rn,"AGENTS.md"),du=jt.join(wr(),".claude-mem"),re="codex"});var Br={};X(Br,{MCP_IDE_INSTALLERS:()=>Mu,installGooseMcpIntegration:()=>Rr});import R from"path";import{homedir as st}from"os";import{existsSync as Or,readFileSync as Eu,writeFileSync as rt,mkdirSync as Tr}from"fs";function yu(t){return{command:process.execPath,args:[t]}}function xu(t,e,o="mcpServers"){let r=R.dirname(t);Tr(r,{recursive:!0});let s=U(t,{});s[o]||(s[o]={}),s[o]["claude-mem"]=yu(e),rt(t,JSON.stringify(s,null,2)+`
339
+ `)}function ot(t){return async()=>{console.log(`
268
340
  Installing Claude-Mem MCP integration for ${t.ideLabel}...
269
- `);let e=rn();if(!e)return console.error("Could not find MCP server script"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs"),1;try{let o=t.configPath;t.ideId==="warp"&&!ur(T.dirname(o))?console.log(" Note: ~/.warp/ not found. MCP may need to be configured via Warp Drive UI."):(Ni(o,e,t.configKey),console.log(` MCP config written to: ${o}`));let r;t.contextFile&&(r=t.contextFile.path,_t(r,Li),console.log(` Context placeholder written to: ${r}`));let s=[`
341
+ `);let e=He();if(!e)return console.error("Could not find MCP server script"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs"),1;try{let o=t.configPath;t.ideId==="warp"&&!Or(R.dirname(o))?console.log(" Note: ~/.warp/ not found. MCP may need to be configured via Warp Drive UI."):(xu(o,e,t.configKey),console.log(` MCP config written to: ${o}`));let r;t.contextFile&&(r=t.contextFile.path,It(r,Fu),console.log(` Context placeholder written to: ${r}`));let s=[`
270
342
  Installation complete!
271
343
  `];return s.push(`MCP config: ${o}`),r&&s.push(`Context: ${r}`),s.push(""),s.push("Note: This is an MCP-only integration providing search tools and context."),s.push(`Transcript capture is not available for ${t.ideLabel}.`),t.ideId==="warp"&&s.push("If MCP config via file is not supported, configure MCP through Warp Drive UI."),s.push(""),s.push("Next steps:"),s.push(" 1. Start claude-mem worker: npx claude-mem start"),s.push(` 2. Restart ${t.ideLabel} to pick up the MCP server`),s.push(""),console.log(s.join(`
272
344
  `)),0}catch(o){return console.error(`
273
- Installation failed: ${o.message}`),1}}}function Ki(){return T.join(Ze(),".config","goose","config.yaml")}function Vi(t){return t.includes("claude-mem:")&&t.includes("mcpServers:")}function sr(t){return["mcpServers:"," claude-mem:",` command: ${process.execPath}`," args:",` - ${t}`].join(`
274
- `)}function ir(t){return[" claude-mem:",` command: ${process.execPath}`," args:",` - ${t}`].join(`
275
- `)}async function cr(){console.log(`
345
+ Installation failed: ${o.message}`),1}}}function wu(){return R.join(st(),".config","goose","config.yaml")}function $u(t){return t.includes("claude-mem:")&&t.includes("mcpServers:")}function kr(t){return["mcpServers:"," claude-mem:",` command: ${process.execPath}`," args:",` - ${t}`].join(`
346
+ `)}function Ir(t){return[" claude-mem:",` command: ${process.execPath}`," args:",` - ${t}`].join(`
347
+ `)}async function Rr(){console.log(`
276
348
  Installing Claude-Mem MCP integration for Goose...
277
- `);let t=rn();if(!t)return console.error("Could not find MCP server script"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs"),1;try{let e=Ki(),o=T.dirname(e);if(ar(o,{recursive:!0}),ur(e)){let r=Pi(e,"utf-8");if(Vi(r)){let s=/( {2}claude-mem:\n(?:.*\n)*?(?= {2}\S|\n\n|^\S|$))/m,i=ir(t)+`
278
- `;s.test(r)&&(r=r.replace(s,i)),ze(e,r),console.log(` Updated existing claude-mem entry in: ${e}`)}else if(r.includes("mcpServers:")){let i=r.indexOf("mcpServers:")+11,n=`
279
- `+ir(t);r=r.slice(0,i)+n+r.slice(i),ze(e,r),console.log(` Added claude-mem to existing mcpServers in: ${e}`)}else{let s=`
280
- `+sr(t)+`
349
+ `);let t=He();if(!t)return console.error("Could not find MCP server script"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs"),1;try{let e=wu(),o=R.dirname(e);if(Tr(o,{recursive:!0}),Or(e)){let r=Eu(e,"utf-8");if($u(r)){let s=/( {2}claude-mem:\n(?:.*\n)*?(?= {2}\S|\n\n|^\S|$))/m,i=Ir(t)+`
350
+ `;s.test(r)&&(r=r.replace(s,i)),rt(e,r),console.log(` Updated existing claude-mem entry in: ${e}`)}else if(r.includes("mcpServers:")){let i=r.indexOf("mcpServers:")+11,n=`
351
+ `+Ir(t);r=r.slice(0,i)+n+r.slice(i),rt(e,r),console.log(` Added claude-mem to existing mcpServers in: ${e}`)}else{let s=`
352
+ `+kr(t)+`
281
353
  `;r=r.trimEnd()+`
282
- `+s,ze(e,r),console.log(` Appended mcpServers section to: ${e}`)}}else{let r=sr(t)+`
283
- `;ze(e,r),console.log(` Created config with MCP server: ${e}`)}return console.log(`
354
+ `+s,rt(e,r),console.log(` Appended mcpServers section to: ${e}`)}}else{let r=kr(t)+`
355
+ `;rt(e,r),console.log(` Created config with MCP server: ${e}`)}return console.log(`
284
356
  Installation complete!
285
357
 
286
358
  MCP config: ${e}
@@ -292,38 +364,38 @@ Next steps:
292
364
  1. Start claude-mem worker: npx claude-mem start
293
365
  2. Restart Goose to pick up the MCP server
294
366
  `),0}catch(e){return console.error(`
295
- Installation failed: ${e.message}`),1}}var Li,Ui,Gi,Wi,Hi,Ji,Xi,Dr=p(()=>{"use strict";xt();be();dn();Li=`# claude-mem: Cross-Session Memory
367
+ Installation failed: ${e.message}`),1}}var Fu,_u,vu,Su,Au,bu,Mu,Pr=f(()=>{"use strict";Je();Me();_n();Fu=`# claude-mem: Cross-Session Memory
296
368
 
297
369
  *No context yet. Complete your first session and context will appear here.*
298
370
 
299
- Use claude-mem's MCP search tools for manual memory queries.`;Ui={ideId:"copilot-cli",ideLabel:"Copilot CLI",configPath:T.join(Ze(),".github","copilot","mcp.json"),configKey:"servers",contextFile:{path:T.join(process.cwd(),".github","copilot-instructions.md"),isWorkspaceRelative:!0}},Gi={ideId:"antigravity",ideLabel:"Antigravity",configPath:T.join(Ze(),".gemini","antigravity","mcp_config.json"),configKey:"mcpServers",contextFile:{path:T.join(process.cwd(),".agent","rules","claude-mem-context.md"),isWorkspaceRelative:!0}},Wi={ideId:"crush",ideLabel:"Crush",configPath:T.join(Ze(),".config","crush","mcp.json"),configKey:"mcpServers"},Hi={ideId:"roo-code",ideLabel:"Roo Code",configPath:T.join(process.cwd(),".roo","mcp.json"),configKey:"mcpServers",contextFile:{path:T.join(process.cwd(),".roo","rules","claude-mem-context.md"),isWorkspaceRelative:!0}},Ji={ideId:"warp",ideLabel:"Warp",configPath:T.join(Ze(),".warp","mcp.json"),configKey:"mcpServers",contextFile:{path:T.join(process.cwd(),"WARP.md"),isWorkspaceRelative:!0}};Xi={"copilot-cli":qe(Ui),antigravity:qe(Gi),goose:cr,crush:qe(Wi),"roo-code":qe(Hi),warp:qe(Ji)}});var Tt={};X(Tt,{runInstallCommand:()=>iu});import{execSync as wn}from"child_process";import{cpSync as dr,existsSync as Qe,readFileSync as Yi,rmSync as mr}from"fs";import{join as Se}from"path";async function qi(t){if(oe)await pt(t);else for(let e of t){let o=await e.task(r=>console.log(` ${r}`));console.log(` ${o}`)}}function zi(){let t=j(pe(),{});t.thedotmack={source:{source:"github",repo:"thedotmack/claude-mem"},installLocation:w(),lastUpdated:new Date().toISOString(),autoUpdate:!0},$e(se()),z(pe(),t)}function Zi(t){let e=j(ge(),{});e.version||(e.version=2),e.plugins||(e.plugins={});let o=jt(t),r=new Date().toISOString();e.plugins["claude-mem@thedotmack"]=[{scope:"user",installPath:o,version:t,installedAt:r,lastUpdated:r}],z(ge(),e)}function Qi(){let t=j(fe(),{});t.enabledPlugins||(t.enabledPlugins={}),t.enabledPlugins["claude-mem@thedotmack"]=!0,z(fe(),t)}async function eu(t){let e=[];for(let o of t)switch(o){case"claude-code":{try{wn("claude plugin marketplace add thedotmack/claude-mem && claude plugin install claude-mem",{stdio:"inherit"}),g.success("Claude Code: plugin installed via CLI.")}catch{g.error("Claude Code: plugin install failed. Is `claude` CLI on your PATH?"),e.push(o)}break}case"cursor":g.warn("Cursor: integration not yet implemented. Skipping.");break;case"gemini-cli":{let{installGeminiCliHooks:r}=await Promise.resolve().then(()=>(ln(),cn));await r()===0?g.success("Gemini CLI: hooks installed."):(g.error("Gemini CLI: hook installation failed."),e.push(o));break}case"opencode":{let{installOpenCodeIntegration:r}=await Promise.resolve().then(()=>(gn(),pn));await r()===0?g.success("OpenCode: plugin installed."):(g.error("OpenCode: plugin installation failed."),e.push(o));break}case"windsurf":{let{installWindsurfHooks:r}=await Promise.resolve().then(()=>(En(),hn));await r()===0?g.success("Windsurf: hooks installed."):(g.error("Windsurf: hook installation failed."),e.push(o));break}case"openclaw":{let{installOpenClawIntegration:r}=await Promise.resolve().then(()=>(vn(),xn));await r()===0?g.success("OpenClaw: plugin installed."):(g.error("OpenClaw: plugin installation failed."),e.push(o));break}case"codex-cli":{let{installCodexCli:r}=await Promise.resolve().then(()=>(An(),bn));await r()===0?g.success("Codex CLI: transcript watching configured."):(g.error("Codex CLI: integration setup failed."),e.push(o));break}case"copilot-cli":case"antigravity":case"goose":case"crush":case"roo-code":case"warp":{let{MCP_IDE_INSTALLERS:r}=await Promise.resolve().then(()=>(Dr(),lr)),s=r[o];if(s){let i=await s(),c=Re().find(D=>D.id===o)?.label??o;i===0?g.success(`${c}: MCP integration installed.`):(g.error(`${c}: MCP integration failed.`),e.push(o))}break}default:{let s=Re().find(i=>i.id===o);s&&!s.supported&&g.warn(`Support for ${s.label} coming soon.`);break}}return e}async function tu(){let e=Re().filter(s=>s.detected);if(e.length===0)return g.warn("No supported IDEs detected. Installing for Claude Code by default."),["claude-code"];let o=e.map(s=>({value:s.id,label:s.label,hint:s.supported?s.hint:"coming soon"})),r=await lo({message:"Which IDEs do you use?",options:o,initialValues:e.filter(s=>s.supported).map(s=>s.id),required:!0});return Q(r)&&(Te("Installation cancelled."),process.exit(0)),r}function nu(){let t=w(),e=rt();$e(t);let o=["plugin","package.json","package-lock.json","node_modules","openclaw","dist","LICENSE","README.md","CHANGELOG.md"];for(let r of o){let s=Se(e,r),i=Se(t,r);Qe(s)&&(Qe(i)&&mr(i,{recursive:!0,force:!0}),dr(s,i,{recursive:!0,force:!0}))}}function ou(t){let e=Nt(),o=jt(t);mr(o,{recursive:!0,force:!0}),$e(o),dr(e,o,{recursive:!0,force:!0})}function ru(){let t=w(),e=Se(t,"package.json");Qe(e)&&wn("npm install --production",{cwd:t,stdio:"pipe",...Y?{shell:!0}:{}})}function su(){let t=Se(w(),"plugin","scripts","smart-install.js");if(!Qe(t))return g.warn("smart-install.js not found \u2014 skipping Bun/uv auto-install."),!1;try{return wn(`node "${t}"`,{stdio:"inherit",...Y?{shell:!0}:{}}),!0}catch{return g.warn("smart-install encountered an issue. You may need to install Bun/uv manually."),!1}}async function iu(t={}){let e=we();oe?mt(C.default.bgCyan(C.default.black(" claude-mem install "))):console.log("claude-mem install"),g.info(`Version: ${C.default.cyan(e)}`),g.info(`Platform: ${process.platform} (${process.arch})`);let o=w();if(Qe(Se(o,"plugin",".claude-plugin","plugin.json"))){try{let l=JSON.parse(Yi(Se(o,"plugin",".claude-plugin","plugin.json"),"utf-8"));g.warn(`Existing installation detected (v${l.version??"unknown"}).`)}catch{g.warn("Existing installation detected.")}if(process.stdin.isTTY){let l=await Ie({message:"Overwrite existing installation?",initialValue:!0});(Q(l)||!l)&&(Te("Installation cancelled."),process.exit(0))}}let s;if(t.ide){s=[t.ide];let l=Re(),y=l.find(v=>v.id===t.ide);y&&!y.supported&&(g.error(`Support for ${y.label} coming soon.`),process.exit(1)),y||(g.error(`Unknown IDE: ${t.ide}`),g.info(`Available IDEs: ${l.map(v=>v.id).join(", ")}`),process.exit(1))}else process.stdin.isTTY?s=await tu():s=["claude-code"];s.some(l=>l!=="claude-code")&&await qi([{title:"Copying plugin files",task:async l=>(l("Copying to marketplace directory..."),nu(),`Plugin files copied ${C.default.green("OK")}`)},{title:"Caching plugin version",task:async l=>(l(`Caching v${e}...`),ou(e),`Plugin cached (v${e}) ${C.default.green("OK")}`)},{title:"Registering marketplace",task:async()=>(zi(),`Marketplace registered ${C.default.green("OK")}`)},{title:"Registering plugin",task:async()=>(Zi(e),`Plugin registered ${C.default.green("OK")}`)},{title:"Enabling plugin in Claude settings",task:async()=>(Qi(),`Plugin enabled ${C.default.green("OK")}`)},{title:"Installing dependencies",task:async l=>{l("Running npm install...");try{return ru(),`Dependencies installed ${C.default.green("OK")}`}catch{return`Dependencies may need manual install ${C.default.yellow("!")}`}}},{title:"Setting up Bun and uv",task:async l=>(l("Running smart-install..."),su()?`Runtime dependencies ready ${C.default.green("OK")}`:`Runtime setup may need attention ${C.default.yellow("!")}`)}]);let n=await eu(s),u=n.length>0?"Installation Partial":"Installation Complete",c=[`Version: ${C.default.cyan(e)}`,`Plugin dir: ${C.default.cyan(o)}`,`IDEs: ${C.default.cyan(s.join(", "))}`];n.length>0&&c.push(`Failed: ${C.default.red(n.join(", "))}`),oe?Oe(c.join(`
371
+ Use claude-mem's MCP search tools for manual memory queries.`;_u={ideId:"copilot-cli",ideLabel:"Copilot CLI",configPath:R.join(st(),".github","copilot","mcp.json"),configKey:"servers",contextFile:{path:R.join(process.cwd(),".github","copilot-instructions.md"),isWorkspaceRelative:!0}},vu={ideId:"antigravity",ideLabel:"Antigravity",configPath:R.join(st(),".gemini","antigravity","mcp_config.json"),configKey:"mcpServers",contextFile:{path:R.join(process.cwd(),".agent","rules","claude-mem-context.md"),isWorkspaceRelative:!0}},Su={ideId:"crush",ideLabel:"Crush",configPath:R.join(st(),".config","crush","mcp.json"),configKey:"mcpServers"},Au={ideId:"roo-code",ideLabel:"Roo Code",configPath:R.join(process.cwd(),".roo","mcp.json"),configKey:"mcpServers",contextFile:{path:R.join(process.cwd(),".roo","rules","claude-mem-context.md"),isWorkspaceRelative:!0}},bu={ideId:"warp",ideLabel:"Warp",configPath:R.join(st(),".warp","mcp.json"),configKey:"mcpServers",contextFile:{path:R.join(process.cwd(),"WARP.md"),isWorkspaceRelative:!0}};Mu={"copilot-cli":ot(_u),antigravity:ot(vu),goose:Rr,crush:ot(Su),"roo-code":ot(Au),warp:ot(bu)}});var Ut={};X(Ut,{runInstallCommand:()=>Gu});import{execSync as Nn}from"child_process";import{cpSync as Lr,existsSync as it,readFileSync as ku,rmSync as Nr}from"fs";import{join as we}from"path";async function Iu(t){if(se)await yt(t);else for(let e of t){let o=await e.task(r=>console.log(` ${r}`));console.log(` ${o}`)}}function Ou(){let t=U(fe(),{});t.thedotmack={source:{source:"github",repo:"thedotmack/claude-mem"},installLocation:$(),lastUpdated:new Date().toISOString(),autoUpdate:!0},Oe(ue()),Q(fe(),t)}function Tu(t){let e=U(Ce(),{});e.version||(e.version=2),e.plugins||(e.plugins={});let o=Kt(t),r=new Date().toISOString();e.plugins["claude-mem@thedotmack"]=[{scope:"user",installPath:o,version:t,installedAt:r,lastUpdated:r}],Q(Ce(),e)}function Ru(){let t=U(he(),{});t.enabledPlugins||(t.enabledPlugins={}),t.enabledPlugins["claude-mem@thedotmack"]=!0,Q(he(),t)}async function Bu(t){let e=[];for(let o of t)switch(o){case"claude-code":{try{Nn("claude plugin marketplace add thedotmack/claude-mem && claude plugin install claude-mem",{stdio:"inherit"}),g.success("Claude Code: plugin installed via CLI.")}catch{g.error("Claude Code: plugin install failed. Is `claude` CLI on your PATH?"),e.push(o)}break}case"cursor":{let{installCursorHooks:r,configureCursorMcp:s}=await Promise.resolve().then(()=>(Je(),Yo));await r("user")===0?s("user")===0?g.success("Cursor: hooks + MCP installed."):g.success("Cursor: hooks installed (MCP setup failed \u2014 run `npx claude-mem cursor mcp` to retry)."):(g.error("Cursor: hook installation failed."),e.push(o));break}case"gemini-cli":{let{installGeminiCliHooks:r}=await Promise.resolve().then(()=>(yn(),Fn));await r()===0?g.success("Gemini CLI: hooks installed."):(g.error("Gemini CLI: hook installation failed."),e.push(o));break}case"opencode":{let{installOpenCodeIntegration:r}=await Promise.resolve().then(()=>(An(),Sn));await r()===0?g.success("OpenCode: plugin installed."):(g.error("OpenCode: plugin installation failed."),e.push(o));break}case"windsurf":{let{installWindsurfHooks:r}=await Promise.resolve().then(()=>(Mn(),$n));await r()===0?g.success("Windsurf: hooks installed."):(g.error("Windsurf: hook installation failed."),e.push(o));break}case"openclaw":{let{installOpenClawIntegration:r}=await Promise.resolve().then(()=>(Tn(),On));await r()===0?g.success("OpenClaw: plugin installed."):(g.error("OpenClaw: plugin installation failed."),e.push(o));break}case"codex-cli":{let{installCodexCli:r}=await Promise.resolve().then(()=>(Ln(),Pn));await r()===0?g.success("Codex CLI: transcript watching configured."):(g.error("Codex CLI: integration setup failed."),e.push(o));break}case"copilot-cli":case"antigravity":case"goose":case"crush":case"roo-code":case"warp":{let{MCP_IDE_INSTALLERS:r}=await Promise.resolve().then(()=>(Pr(),Br)),s=r[o];if(s){let i=await s(),c=je().find(D=>D.id===o)?.label??o;i===0?g.success(`${c}: MCP integration installed.`):(g.error(`${c}: MCP integration failed.`),e.push(o))}break}default:{let s=je().find(i=>i.id===o);s&&!s.supported&&g.warn(`Support for ${s.label} coming soon.`);break}}return e}async function Pu(){let e=je().filter(s=>s.detected);if(e.length===0)return g.warn("No supported IDEs detected. Installing for Claude Code by default."),["claude-code"];let o=e.map(s=>({value:s.id,label:s.label,hint:s.supported?s.hint:"coming soon"})),r=await xo({message:"Which IDEs do you use?",options:o,initialValues:e.filter(s=>s.supported).map(s=>s.id),required:!0});return te(r)&&(Le("Installation cancelled."),process.exit(0)),r}function Lu(){let t=$(),e=Dt();Oe(t);let o=["plugin","package.json","package-lock.json","node_modules","openclaw","dist","LICENSE","README.md","CHANGELOG.md"];for(let r of o){let s=we(e,r),i=we(t,r);it(s)&&(it(i)&&Nr(i,{recursive:!0,force:!0}),Lr(s,i,{recursive:!0,force:!0}))}}function Nu(t){let e=Vt(),o=Kt(t);Nr(o,{recursive:!0,force:!0}),Oe(o),Lr(e,o,{recursive:!0,force:!0})}function ju(){let t=$(),e=we(t,"package.json");it(e)&&Nn("npm install --production",{cwd:t,stdio:"pipe",...z?{shell:!0}:{}})}function Uu(){let t=we($(),"plugin","scripts","smart-install.js");if(!it(t))return g.warn("smart-install.js not found \u2014 skipping Bun/uv auto-install."),!1;try{return Nn(`node "${t}"`,{stdio:"inherit",...z?{shell:!0}:{}}),!0}catch{return g.warn("smart-install encountered an issue. You may need to install Bun/uv manually."),!1}}async function Gu(t={}){let e=Ie();se?Ft(h.default.bgCyan(h.default.black(" claude-mem install "))):console.log("claude-mem install"),g.info(`Version: ${h.default.cyan(e)}`),g.info(`Platform: ${process.platform} (${process.arch})`);let o=$();if(it(we(o,"plugin",".claude-plugin","plugin.json"))){try{let l=JSON.parse(ku(we(o,"plugin",".claude-plugin","plugin.json"),"utf-8"));g.warn(`Existing installation detected (v${l.version??"unknown"}).`)}catch{g.warn("Existing installation detected.")}if(process.stdin.isTTY){let l=await Be({message:"Overwrite existing installation?",initialValue:!0});(te(l)||!l)&&(Le("Installation cancelled."),process.exit(0))}}let s;if(t.ide){s=[t.ide];let l=je(),x=l.find(v=>v.id===t.ide);x&&!x.supported&&(g.error(`Support for ${x.label} coming soon.`),process.exit(1)),x||(g.error(`Unknown IDE: ${t.ide}`),g.info(`Available IDEs: ${l.map(v=>v.id).join(", ")}`),process.exit(1))}else process.stdin.isTTY?s=await Pu():s=["claude-code"];s.some(l=>l!=="claude-code")&&await Iu([{title:"Copying plugin files",task:async l=>(l("Copying to marketplace directory..."),Lu(),`Plugin files copied ${h.default.green("OK")}`)},{title:"Caching plugin version",task:async l=>(l(`Caching v${e}...`),Nu(e),`Plugin cached (v${e}) ${h.default.green("OK")}`)},{title:"Registering marketplace",task:async()=>(Ou(),`Marketplace registered ${h.default.green("OK")}`)},{title:"Registering plugin",task:async()=>(Tu(e),`Plugin registered ${h.default.green("OK")}`)},{title:"Enabling plugin in Claude settings",task:async()=>(Ru(),`Plugin enabled ${h.default.green("OK")}`)},{title:"Installing dependencies",task:async l=>{l("Running npm install...");try{return ju(),`Dependencies installed ${h.default.green("OK")}`}catch{return`Dependencies may need manual install ${h.default.yellow("!")}`}}},{title:"Setting up Bun and uv",task:async l=>(l("Running smart-install..."),Uu()?`Runtime dependencies ready ${h.default.green("OK")}`:`Runtime setup may need attention ${h.default.yellow("!")}`)}]);let n=await Bu(s),u=n.length>0?"Installation Partial":"Installation Complete",c=[`Version: ${h.default.cyan(e)}`,`Plugin dir: ${h.default.cyan(o)}`,`IDEs: ${h.default.cyan(s.join(", "))}`];n.length>0&&c.push(`Failed: ${h.default.red(n.join(", "))}`),se?Pe(c.join(`
300
372
  `),u):(console.log(`
301
- ${u}`),c.forEach(l=>console.log(` ${l}`)));let D=process.env.CLAUDE_MEM_WORKER_PORT||"37777",d=["Open Claude Code and start a conversation -- memory is automatic!",`View your memories: ${C.default.underline(`http://localhost:${D}`)}`,`Search past work: use ${C.default.bold("/mem-search")} in Claude Code`,`Start worker: ${C.default.bold("npx claude-mem start")}`];oe?(Oe(d.join(`
302
- `),"Next Steps"),n.length>0?ue(C.default.yellow("claude-mem installed with some IDE setup failures.")):ue(C.default.green("claude-mem installed successfully!"))):(console.log(`
373
+ ${u}`),c.forEach(l=>console.log(` ${l}`)));let D=process.env.CLAUDE_MEM_WORKER_PORT||"37777",d=["Open Claude Code and start a conversation -- memory is automatic!",`View your memories: ${h.default.underline(`http://localhost:${D}`)}`,`Search past work: use ${h.default.bold("/mem-search")} in Claude Code`,`Start worker: ${h.default.bold("npx claude-mem start")}`];se?(Pe(d.join(`
374
+ `),"Next Steps"),n.length>0?ce(h.default.yellow("claude-mem installed with some IDE setup failures.")):ce(h.default.green("claude-mem installed successfully!"))):(console.log(`
303
375
  Next Steps`),d.forEach(l=>console.log(` ${l}`)),n.length>0?(console.log(`
304
376
  claude-mem installed with some IDE setup failures.`),process.exitCode=1):console.log(`
305
- claude-mem installed successfully!`))}var C,oe,g,Bt=p(()=>{"use strict";Zt();C=re(me(),1);ie();be();po();oe=process.stdin.isTTY===!0;g={info:t=>oe?b.info(t):console.log(` ${t}`),success:t=>oe?b.success(t):console.log(` ${t}`),warn:t=>oe?b.warn(t):console.warn(` ${t}`),error:t=>oe?b.error(t):console.error(` ${t}`)}});var fr={};X(fr,{runUninstallCommand:()=>mu});import{existsSync as pr,rmSync as gr}from"fs";import{join as uu}from"path";function au(){let t=w();return pr(t)?(gr(t,{recursive:!0,force:!0}),!0):!1}function cu(){let t=uu(se(),"cache","thedotmack","claude-mem");return pr(t)?(gr(t,{recursive:!0,force:!0}),!0):!1}function lu(){let t=j(pe(),{});t.thedotmack&&(delete t.thedotmack,z(pe(),t))}function Du(){let t=j(ge(),{});t.plugins?.["claude-mem@thedotmack"]&&(delete t.plugins["claude-mem@thedotmack"],z(ge(),t))}function du(){let t=j(fe(),{});t.enabledPlugins?.["claude-mem@thedotmack"]!==void 0&&(delete t.enabledPlugins["claude-mem@thedotmack"],z(fe(),t))}async function mu(){if(mt(P.default.bgRed(P.default.white(" claude-mem uninstall "))),st()){if(process.stdin.isTTY){let o=await Ie({message:"Are you sure you want to uninstall claude-mem?",initialValue:!1});if(Q(o)||!o){Te("Uninstall cancelled.");return}}}else if(b.warn("claude-mem does not appear to be installed."),process.stdin.isTTY){let o=await Ie({message:"Clean up any remaining registration data anyway?",initialValue:!1});if(Q(o)||!o){ue("Nothing to do.");return}}else{ue("Nothing to do.");return}let t=process.env.CLAUDE_MEM_WORKER_PORT||"37777";try{await fetch(`http://127.0.0.1:${t}/api/admin/shutdown`,{method:"POST",signal:AbortSignal.timeout(5e3)});for(let o=0;o<20;o++){await new Promise(r=>setTimeout(r,500));try{await fetch(`http://127.0.0.1:${t}/api/health`,{signal:AbortSignal.timeout(1e3)})}catch{break}}b.info("Worker service stopped.")}catch{}await pt([{title:"Removing marketplace directory",task:async()=>au()?`Marketplace directory removed ${P.default.green("OK")}`:`Marketplace directory not found ${P.default.dim("skipped")}`},{title:"Removing cache directory",task:async()=>cu()?`Cache directory removed ${P.default.green("OK")}`:`Cache directory not found ${P.default.dim("skipped")}`},{title:"Removing marketplace registration",task:async()=>(lu(),`Marketplace registration removed ${P.default.green("OK")}`)},{title:"Removing plugin registration",task:async()=>(Du(),`Plugin registration removed ${P.default.green("OK")}`)},{title:"Removing from Claude settings",task:async()=>(du(),`Claude settings updated ${P.default.green("OK")}`)}]);let e=[{label:"Gemini CLI hooks",fn:async()=>{let{uninstallGeminiCliHooks:o}=await Promise.resolve().then(()=>(ln(),cn));return o()}},{label:"Windsurf hooks",fn:async()=>{let{uninstallWindsurfHooks:o}=await Promise.resolve().then(()=>(En(),hn));return o()}},{label:"OpenCode plugin",fn:async()=>{let{uninstallOpenCodePlugin:o}=await Promise.resolve().then(()=>(gn(),pn));return o()}},{label:"OpenClaw plugin",fn:async()=>{let{uninstallOpenClawPlugin:o}=await Promise.resolve().then(()=>(vn(),xn));return o()}},{label:"Codex CLI",fn:async()=>{let{uninstallCodexCli:o}=await Promise.resolve().then(()=>(An(),bn));return o()}}];for(let{label:o,fn:r}of e)try{await r()===0&&b.info(`${o}: removed.`)}catch{}Oe([`Your data directory at ${P.default.cyan("~/.claude-mem")} was preserved.`,"To remove it manually: rm -rf ~/.claude-mem"].join(`
306
- `),"Note"),ue(P.default.green("claude-mem has been uninstalled."))}var P,Cr=p(()=>{"use strict";Zt();P=re(me(),1);ie();be()});import{spawnSync as pu}from"child_process";import{existsSync as gu}from"fs";import{homedir as $n}from"os";import{join as kn}from"path";function fu(){return Y?[kn($n(),".bun","bin","bun.exe"),kn(process.env.USERPROFILE||$n(),".bun","bin","bun.exe")]:[kn($n(),".bun","bin","bun"),"/usr/local/bin/bun","/opt/homebrew/bin/bun","/home/linuxbrew/.linuxbrew/bin/bun"]}function hr(){let e=pu(Y?"where":"which",["bun"],{encoding:"utf-8",stdio:["pipe","pipe","pipe"],shell:Y});if(e.status===0&&e.stdout.trim())return"bun";for(let o of fu())if(gu(o))return o;return null}var Er=p(()=>{"use strict";ie()});var le={};X(le,{runRestartCommand:()=>Fu,runSearchCommand:()=>xu,runStartCommand:()=>hu,runStatusCommand:()=>yu,runStopCommand:()=>Eu,runTranscriptWatchCommand:()=>vu});import{spawn as Fr}from"child_process";import{existsSync as yr}from"fs";import{join as xr}from"path";function Mn(){st()||(console.error(k.default.red("claude-mem is not installed.")),console.error(`Run: ${k.default.bold("npx claude-mem install")}`),process.exit(1))}function vr(){let t=hr();return t||(console.error(k.default.red("Bun not found.")),console.error("Install Bun: https://bun.sh"),console.error("After installation, restart your terminal."),process.exit(1)),t}function Cu(){return xr(w(),"plugin","scripts","worker-service.cjs")}function et(t,e=[]){Mn();let o=vr(),r=Cu();yr(r)||(console.error(k.default.red(`Worker script not found at: ${r}`)),console.error("The installation may be corrupted. Try: npx claude-mem install"),process.exit(1));let s=[r,t,...e],i=Fr(o,s,{stdio:"inherit",cwd:w(),env:process.env});i.on("error",n=>{console.error(k.default.red(`Failed to start Bun: ${n.message}`)),process.exit(1)}),i.on("close",n=>{process.exit(n??0)})}function hu(){et("start")}function Eu(){et("stop")}function Fu(){et("restart")}function yu(){et("status")}async function xu(t){Mn();let e=t.join(" ").trim();e||(console.error(k.default.red("Usage: npx claude-mem search <query>")),process.exit(1));let r=`http://127.0.0.1:${process.env.CLAUDE_MEM_WORKER_PORT||"37777"}/api/search?q=${encodeURIComponent(e)}`;try{let s=await fetch(r);s.ok||(s.status===404&&(console.error(k.default.red("Search endpoint not found. Is the worker running?")),console.error(`Try: ${k.default.bold("npx claude-mem start")}`),process.exit(1)),console.error(k.default.red(`Search failed: HTTP ${s.status}`)),process.exit(1));let i=await s.json();console.log(typeof i=="object"&&i!==null?JSON.stringify(i,null,2):i)}catch(s){(s?.cause?.code==="ECONNREFUSED"||s?.message?.includes("ECONNREFUSED"))&&(console.error(k.default.red("Worker is not running.")),console.error(`Start it with: ${k.default.bold("npx claude-mem start")}`),process.exit(1)),console.error(k.default.red(`Search failed: ${s.message}`)),process.exit(1)}}function vu(){Mn();let t=vr(),e=xr(w(),"plugin","scripts","transcript-watcher.cjs");if(!yr(e)){et("transcript",["watch"]);return}let o=Fr(t,[e,"watch"],{stdio:"inherit",cwd:w(),env:process.env});o.on("error",r=>{console.error(k.default.red(`Failed to start transcript watcher: ${r.message}`)),process.exit(1)}),o.on("close",r=>{process.exit(r??0)})}var k,De=p(()=>{"use strict";k=re(me(),1);Er();ie()});var F=re(me(),1);ie();var tt=process.argv.slice(2),Sr=tt[0]?.toLowerCase()??"";function Su(){let t=we();console.log(`
307
- ${F.default.bold("claude-mem")} v${t} \u2014 persistent memory for AI coding assistants
308
-
309
- ${F.default.bold("Install Commands")} (no Bun required):
310
- ${F.default.cyan("npx claude-mem")} Interactive install
311
- ${F.default.cyan("npx claude-mem install")} Interactive install
312
- ${F.default.cyan("npx claude-mem install --ide <id>")} Install for specific IDE
313
- ${F.default.cyan("npx claude-mem update")} Update to latest version
314
- ${F.default.cyan("npx claude-mem uninstall")} Remove plugin and configs
315
- ${F.default.cyan("npx claude-mem version")} Print version
316
-
317
- ${F.default.bold("Runtime Commands")} (requires Bun, delegates to installed plugin):
318
- ${F.default.cyan("npx claude-mem start")} Start worker service
319
- ${F.default.cyan("npx claude-mem stop")} Stop worker service
320
- ${F.default.cyan("npx claude-mem restart")} Restart worker service
321
- ${F.default.cyan("npx claude-mem status")} Show worker status
322
- ${F.default.cyan("npx claude-mem search <query>")} Search observations
323
- ${F.default.cyan("npx claude-mem transcript watch")} Start transcript watcher
324
-
325
- ${F.default.bold("IDE Identifiers")}:
377
+ claude-mem installed successfully!`))}var h,se,g,Gt=f(()=>{"use strict";sn();h=ie(ge(),1);ae();Me();So();se=process.stdin.isTTY===!0;g={info:t=>se?b.info(t):console.log(` ${t}`),success:t=>se?b.success(t):console.log(` ${t}`),warn:t=>se?b.warn(t):console.warn(` ${t}`),error:t=>se?b.error(t):console.error(` ${t}`)}});var Gr={};X(Gr,{runUninstallCommand:()=>Yu});import{existsSync as jr,rmSync as Ur}from"fs";import{join as Wu}from"path";function Hu(){let t=$();return jr(t)?(Ur(t,{recursive:!0,force:!0}),!0):!1}function Ju(){let t=Wu(ue(),"cache","thedotmack","claude-mem");return jr(t)?(Ur(t,{recursive:!0,force:!0}),!0):!1}function Ku(){let t=U(fe(),{});t.thedotmack&&(delete t.thedotmack,Q(fe(),t))}function Vu(){let t=U(Ce(),{});t.plugins?.["claude-mem@thedotmack"]&&(delete t.plugins["claude-mem@thedotmack"],Q(Ce(),t))}function Xu(){let t=U(he(),{});t.enabledPlugins?.["claude-mem@thedotmack"]!==void 0&&(delete t.enabledPlugins["claude-mem@thedotmack"],Q(he(),t))}async function Yu(){if(Ft(N.default.bgRed(N.default.white(" claude-mem uninstall "))),dt()){if(process.stdin.isTTY){let o=await Be({message:"Are you sure you want to uninstall claude-mem?",initialValue:!1});if(te(o)||!o){Le("Uninstall cancelled.");return}}}else if(b.warn("claude-mem does not appear to be installed."),process.stdin.isTTY){let o=await Be({message:"Clean up any remaining registration data anyway?",initialValue:!1});if(te(o)||!o){ce("Nothing to do.");return}}else{ce("Nothing to do.");return}let t=process.env.CLAUDE_MEM_WORKER_PORT||"37777";try{await fetch(`http://127.0.0.1:${t}/api/admin/shutdown`,{method:"POST",signal:AbortSignal.timeout(5e3)});for(let o=0;o<20;o++){await new Promise(r=>setTimeout(r,500));try{await fetch(`http://127.0.0.1:${t}/api/health`,{signal:AbortSignal.timeout(1e3)})}catch{break}}b.info("Worker service stopped.")}catch{}await yt([{title:"Removing marketplace directory",task:async()=>Hu()?`Marketplace directory removed ${N.default.green("OK")}`:`Marketplace directory not found ${N.default.dim("skipped")}`},{title:"Removing cache directory",task:async()=>Ju()?`Cache directory removed ${N.default.green("OK")}`:`Cache directory not found ${N.default.dim("skipped")}`},{title:"Removing marketplace registration",task:async()=>(Ku(),`Marketplace registration removed ${N.default.green("OK")}`)},{title:"Removing plugin registration",task:async()=>(Vu(),`Plugin registration removed ${N.default.green("OK")}`)},{title:"Removing from Claude settings",task:async()=>(Xu(),`Claude settings updated ${N.default.green("OK")}`)}]);let e=[{label:"Gemini CLI hooks",fn:async()=>{let{uninstallGeminiCliHooks:o}=await Promise.resolve().then(()=>(yn(),Fn));return o()}},{label:"Windsurf hooks",fn:async()=>{let{uninstallWindsurfHooks:o}=await Promise.resolve().then(()=>(Mn(),$n));return o()}},{label:"OpenCode plugin",fn:async()=>{let{uninstallOpenCodePlugin:o}=await Promise.resolve().then(()=>(An(),Sn));return o()}},{label:"OpenClaw plugin",fn:async()=>{let{uninstallOpenClawPlugin:o}=await Promise.resolve().then(()=>(Tn(),On));return o()}},{label:"Codex CLI",fn:async()=>{let{uninstallCodexCli:o}=await Promise.resolve().then(()=>(Ln(),Pn));return o()}}];for(let{label:o,fn:r}of e)try{await r()===0&&b.info(`${o}: removed.`)}catch{}Pe([`Your data directory at ${N.default.cyan("~/.claude-mem")} was preserved.`,"To remove it manually: rm -rf ~/.claude-mem"].join(`
378
+ `),"Note"),ce(N.default.green("claude-mem has been uninstalled."))}var N,Wr=f(()=>{"use strict";sn();N=ie(ge(),1);ae();Me()});import{spawnSync as qu}from"child_process";import{existsSync as zu}from"fs";import{homedir as jn}from"os";import{join as Un}from"path";function Zu(){return z?[Un(jn(),".bun","bin","bun.exe"),Un(process.env.USERPROFILE||jn(),".bun","bin","bun.exe")]:[Un(jn(),".bun","bin","bun"),"/usr/local/bin/bun","/opt/homebrew/bin/bun","/home/linuxbrew/.linuxbrew/bin/bun"]}function Hr(){let e=qu(z?"where":"which",["bun"],{encoding:"utf-8",stdio:["pipe","pipe","pipe"],shell:z});if(e.status===0&&e.stdout.trim())return"bun";for(let o of Zu())if(zu(o))return o;return null}var Jr=f(()=>{"use strict";ae()});var de={};X(de,{runRestartCommand:()=>na,runSearchCommand:()=>ra,runStartCommand:()=>ea,runStatusCommand:()=>oa,runStopCommand:()=>ta,runTranscriptWatchCommand:()=>sa});import{spawn as Kr}from"child_process";import{existsSync as Vr}from"fs";import{join as Xr}from"path";function Gn(){dt()||(console.error(k.default.red("claude-mem is not installed.")),console.error(`Run: ${k.default.bold("npx claude-mem install")}`),process.exit(1))}function Yr(){let t=Hr();return t||(console.error(k.default.red("Bun not found.")),console.error("Install Bun: https://bun.sh"),console.error("After installation, restart your terminal."),process.exit(1)),t}function Qu(){return Xr($(),"plugin","scripts","worker-service.cjs")}function ut(t,e=[]){Gn();let o=Yr(),r=Qu();Vr(r)||(console.error(k.default.red(`Worker script not found at: ${r}`)),console.error("The installation may be corrupted. Try: npx claude-mem install"),process.exit(1));let s=[r,t,...e],i=Kr(o,s,{stdio:"inherit",cwd:$(),env:process.env});i.on("error",n=>{console.error(k.default.red(`Failed to start Bun: ${n.message}`)),process.exit(1)}),i.on("close",n=>{process.exit(n??0)})}function ea(){ut("start")}function ta(){ut("stop")}function na(){ut("restart")}function oa(){ut("status")}async function ra(t){Gn();let e=t.join(" ").trim();e||(console.error(k.default.red("Usage: npx claude-mem search <query>")),process.exit(1));let r=`http://127.0.0.1:${process.env.CLAUDE_MEM_WORKER_PORT||"37777"}/api/search?q=${encodeURIComponent(e)}`;try{let s=await fetch(r);s.ok||(s.status===404&&(console.error(k.default.red("Search endpoint not found. Is the worker running?")),console.error(`Try: ${k.default.bold("npx claude-mem start")}`),process.exit(1)),console.error(k.default.red(`Search failed: HTTP ${s.status}`)),process.exit(1));let i=await s.json();console.log(typeof i=="object"&&i!==null?JSON.stringify(i,null,2):i)}catch(s){(s?.cause?.code==="ECONNREFUSED"||s?.message?.includes("ECONNREFUSED"))&&(console.error(k.default.red("Worker is not running.")),console.error(`Start it with: ${k.default.bold("npx claude-mem start")}`),process.exit(1)),console.error(k.default.red(`Search failed: ${s.message}`)),process.exit(1)}}function sa(){Gn();let t=Yr(),e=Xr($(),"plugin","scripts","transcript-watcher.cjs");if(!Vr(e)){ut("transcript",["watch"]);return}let o=Kr(t,[e,"watch"],{stdio:"inherit",cwd:$(),env:process.env});o.on("error",r=>{console.error(k.default.red(`Failed to start transcript watcher: ${r.message}`)),process.exit(1)}),o.on("close",r=>{process.exit(r??0)})}var k,me=f(()=>{"use strict";k=ie(ge(),1);Jr();ae()});var y=ie(ge(),1);ae();var at=process.argv.slice(2),qr=at[0]?.toLowerCase()??"";function ia(){let t=Ie();console.log(`
379
+ ${y.default.bold("claude-mem")} v${t} \u2014 persistent memory for AI coding assistants
380
+
381
+ ${y.default.bold("Install Commands")} (no Bun required):
382
+ ${y.default.cyan("npx claude-mem")} Interactive install
383
+ ${y.default.cyan("npx claude-mem install")} Interactive install
384
+ ${y.default.cyan("npx claude-mem install --ide <id>")} Install for specific IDE
385
+ ${y.default.cyan("npx claude-mem update")} Update to latest version
386
+ ${y.default.cyan("npx claude-mem uninstall")} Remove plugin and configs
387
+ ${y.default.cyan("npx claude-mem version")} Print version
388
+
389
+ ${y.default.bold("Runtime Commands")} (requires Bun, delegates to installed plugin):
390
+ ${y.default.cyan("npx claude-mem start")} Start worker service
391
+ ${y.default.cyan("npx claude-mem stop")} Stop worker service
392
+ ${y.default.cyan("npx claude-mem restart")} Restart worker service
393
+ ${y.default.cyan("npx claude-mem status")} Show worker status
394
+ ${y.default.cyan("npx claude-mem search <query>")} Search observations
395
+ ${y.default.cyan("npx claude-mem transcript watch")} Start transcript watcher
396
+
397
+ ${y.default.bold("IDE Identifiers")}:
326
398
  claude-code, cursor, gemini-cli, opencode, openclaw,
327
399
  windsurf, codex-cli, copilot-cli, antigravity, goose,
328
400
  crush, roo-code, warp
329
- `)}async function _u(){switch(Sr){case"":{let{runInstallCommand:t}=await Promise.resolve().then(()=>(Bt(),Tt));await t();break}case"install":{let t=tt.indexOf("--ide"),e=t!==-1?tt[t+1]:void 0,{runInstallCommand:o}=await Promise.resolve().then(()=>(Bt(),Tt));await o({ide:e});break}case"update":case"upgrade":{let{runInstallCommand:t}=await Promise.resolve().then(()=>(Bt(),Tt));await t();break}case"uninstall":case"remove":{let{runUninstallCommand:t}=await Promise.resolve().then(()=>(Cr(),fr));await t();break}case"version":case"--version":case"-v":{console.log(we());break}case"help":case"--help":case"-h":{Su();break}case"start":{let{runStartCommand:t}=await Promise.resolve().then(()=>(De(),le));t();break}case"stop":{let{runStopCommand:t}=await Promise.resolve().then(()=>(De(),le));t();break}case"restart":{let{runRestartCommand:t}=await Promise.resolve().then(()=>(De(),le));t();break}case"status":{let{runStatusCommand:t}=await Promise.resolve().then(()=>(De(),le));t();break}case"search":{let{runSearchCommand:t}=await Promise.resolve().then(()=>(De(),le));await t(tt.slice(1));break}case"transcript":{let t=tt[1]?.toLowerCase();if(t==="watch"){let{runTranscriptWatchCommand:e}=await Promise.resolve().then(()=>(De(),le));e()}else console.error(F.default.red(`Unknown transcript subcommand: ${t??"(none)"}`)),console.error("Usage: npx claude-mem transcript watch"),process.exit(1);break}default:console.error(F.default.red(`Unknown command: ${Sr}`)),console.error(`Run ${F.default.bold("npx claude-mem --help")} for usage information.`),process.exit(1)}}_u().catch(t=>{console.error(F.default.red("Fatal error:"),t.message||t),process.exit(1)});
401
+ `)}async function ua(){switch(qr){case"":{let{runInstallCommand:t}=await Promise.resolve().then(()=>(Gt(),Ut));await t();break}case"install":{let t=at.indexOf("--ide"),e=t!==-1?at[t+1]:void 0,{runInstallCommand:o}=await Promise.resolve().then(()=>(Gt(),Ut));await o({ide:e});break}case"update":case"upgrade":{let{runInstallCommand:t}=await Promise.resolve().then(()=>(Gt(),Ut));await t();break}case"uninstall":case"remove":{let{runUninstallCommand:t}=await Promise.resolve().then(()=>(Wr(),Gr));await t();break}case"version":case"--version":case"-v":{console.log(Ie());break}case"help":case"--help":case"-h":{ia();break}case"start":{let{runStartCommand:t}=await Promise.resolve().then(()=>(me(),de));t();break}case"stop":{let{runStopCommand:t}=await Promise.resolve().then(()=>(me(),de));t();break}case"restart":{let{runRestartCommand:t}=await Promise.resolve().then(()=>(me(),de));t();break}case"status":{let{runStatusCommand:t}=await Promise.resolve().then(()=>(me(),de));t();break}case"search":{let{runSearchCommand:t}=await Promise.resolve().then(()=>(me(),de));await t(at.slice(1));break}case"transcript":{let t=at[1]?.toLowerCase();if(t==="watch"){let{runTranscriptWatchCommand:e}=await Promise.resolve().then(()=>(me(),de));e()}else console.error(y.default.red(`Unknown transcript subcommand: ${t??"(none)"}`)),console.error("Usage: npx claude-mem transcript watch"),process.exit(1);break}default:console.error(y.default.red(`Unknown command: ${qr}`)),console.error(`Run ${y.default.bold("npx claude-mem --help")} for usage information.`),process.exit(1)}}ua().catch(t=>{console.error(y.default.red("Fatal error:"),t.message||t),process.exit(1)});