claude-mem 12.1.2 → 12.1.4

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,65 +1,65 @@
1
1
  #!/usr/bin/env node
2
- var qr=Object.create;var Wt=Object.defineProperty;var zr=Object.getOwnPropertyDescriptor;var Zr=Object.getOwnPropertyNames;var Qr=Object.getPrototypeOf,es=Object.prototype.hasOwnProperty;var ts=(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 C=(t,e)=>()=>(t&&(e=t(t=0)),e);var Gn=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),K=(t,e)=>{for(var o in e)Wt(t,o,{get:e[o],enumerable:!0})},ns=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Zr(e))!es.call(t,s)&&s!==o&&Wt(t,s,{get:()=>e[s],enumerable:!(r=zr(e,s))||r.enumerable});return t};var se=(t,e,o)=>(o=t!=null?qr(Qr(t)):{},ns(e||!t||!t.__esModule?Wt(o,"default",{value:t,enumerable:!0}):o,t));var pe=Gn((ra,Ht)=>{var it=process||{},Wn=it.argv||[],st=it.env||{},os=!(st.NO_COLOR||Wn.includes("--no-color"))&&(!!st.FORCE_COLOR||Wn.includes("--color")||it.platform==="win32"||(it.stdout||{}).isTTY&&st.TERM!=="dumb"||!!st.CI),rs=(t,e,o=t)=>r=>{let s=""+r,i=s.indexOf(e,t.length);return~i?t+ss(s,e,o,i)+e:t+s+e},ss=(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)},Hn=(t=os)=>{let e=t?rs:()=>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=Hn();Ht.exports.createColors=Hn});import{existsSync as is,readFileSync as us}from"fs";function N(t,e){if(!is(t))return e;try{return JSON.parse(us(t,"utf-8"))}catch{throw new Error(`Corrupt JSON file, refusing to overwrite: ${t}`)}}var Me=C(()=>{"use strict"});import{existsSync as ke,mkdirSync as as,readFileSync as Jn,writeFileSync as cs}from"fs";import{homedir as ls}from"os";import{dirname as Kn,join as k}from"path";import{fileURLToPath as Ds}from"url";function Jt(){return process.env.CLAUDE_CONFIG_DIR||k(ls(),".claude")}function $(){return k(Jt(),"plugins","marketplaces","thedotmack")}function ie(){return k(Jt(),"plugins")}function ge(){return k(ie(),"known_marketplaces.json")}function Ce(){return k(ie(),"installed_plugins.json")}function fe(){return k(Jt(),"settings.json")}function Kt(t){return k(ie(),"cache","thedotmack","claude-mem",t)}function ut(){let t=Ds(import.meta.url),e=k(Kn(t),"..","..");if(!ke(k(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 k(ut(),"plugin")}function Ie(){let t=k(Vt(),".claude-plugin","plugin.json");if(ke(t))try{let o=JSON.parse(Jn(t,"utf-8"));if(o.version)return o.version}catch{}let e=k(ut(),"package.json");if(ke(e))try{let o=JSON.parse(Jn(e,"utf-8"));if(o.version)return o.version}catch{}return"0.0.0"}function at(){let t=$();return ke(k(t,"plugin",".claude-plugin","plugin.json"))}function Oe(t){ke(t)||as(t,{recursive:!0})}function Z(t,e){Oe(Kn(t)),cs(t,JSON.stringify(e,null,2)+`
3
- `,"utf-8")}var X,ue=C(()=>{"use strict";Me();X=process.platform==="win32"});var Xt=Gn((ma,Vn)=>{"use strict";var Yt={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"},ds={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},ms={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?Yt.up():"");return t&&(e+=Yt.left),e}};Vn.exports={cursor:Yt,scroll:ds,erase:ms,beep:"\x07"}});import{stdin as no,stdout as oo}from"node:process";import*as Q from"node:readline";import Yn from"node:readline";import{WriteStream as ps}from"node:tty";function gs({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 ro(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Cs,"")}function so(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=ro(t),t.length===0))return 0;t=t.replace(Fs()," ");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(hs.eastAsianWidth(s)){case"F":case"W":r+=2;break;case"A":r+=o;break;default:r+=1}}return r}function vs(){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=Xn(),f.color.ansi256=qn(),f.color.ansi16m=zn(),f.bgColor.ansi=Xn(qt),f.bgColor.ansi256=qn(qt),f.bgColor.ansi16m=zn(qt),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 eo(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=>$s(r,e,o)).join(`
6
- `)}function tn(t,e){if(typeof t=="string")return lt.aliases.get(t)===e;for(let o of t)if(o!==void 0&&tn(o,e))return!0;return!1}function ks(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 ee(t){return t===Zt}function ct(t,e){let o=t;o.isTTY&&o.setRawMode(e)}function co({input:t=no,output:e=oo,overwrite:o=!0,hideCursor:r=!0}={}){let s=Q.createInterface({input:t,output:e,prompt:"",tabSize:1});Q.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;Q.moveCursor(e,u==="return"?0:-1,u==="return"?-1:0,()=>{Q.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&&!Is&&t.setRawMode(!1),s.terminal=!1,s.close()}}var S,Cs,io,fs,hs,Es,Fs,qt,Xn,qn,zn,f,ys,xs,_s,mt,Ss,Qt,uo,As,ao,en,Zn,Qn,ws,zt,bs,$s,Ms,lt,Is,Zt,Os,Ts,I,Dt,dt,Bs,Rs,to,lo,nn=C(()=>{S=se(Xt(),1);Cs=gs();io={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}})(io);fs=io.exports,hs=so(fs),Es=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},Fs=so(Es);qt=10,Xn=(t=0)=>e=>`\x1B[${e+t}m`,qn=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,zn=(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);ys=Object.keys(f.color),xs=Object.keys(f.bgColor);[...ys,...xs];_s=vs(),mt=new Set(["\x1B","\x9B"]),Ss=39,Qt="\x07",uo="[",As="]",ao="m",en=`${As}8;;`,Zn=t=>`${mt.values().next().value}${uo}${t}${ao}`,Qn=t=>`${mt.values().next().value}${en}${t}${Qt}`,ws=t=>t.split(" ").map(e=>Te(e)),zt=(t,e,o)=>{let r=[...e],s=!1,i=!1,n=Te(ro(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),mt.has(c)&&(s=!0,i=r.slice(u+1).join("").startsWith(en)),s){i?c===Qt&&(s=!1,i=!1):c===ao&&(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())},bs=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("")},$s=(t,e,o={})=>{if(o.trim!==!1&&t.trim()==="")return"";let r="",s,i,n=ws(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,_=1+Math.floor((n[D]-x-1)/e);Math.floor((n[D]-1)/e)<_&&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=>bs(D)));let c=[...u.join(`
9
- `)];for(let[D,d]of c.entries()){if(r+=d,mt.has(d)){let{groups:x}=new RegExp(`(?:\\${uo}(?<code>\\d+)m|\\${en}(?<uri>.*)${Qt})`).exec(c.slice(D).join(""))||{groups:{}};if(x.code!==void 0){let _=Number.parseFloat(x.code);s=_===Ss?void 0:_}else x.uri!==void 0&&(i=x.uri.length===0?void 0:x.uri)}let l=_s.codes.get(Number(s));c[D+1]===`
10
- `?(i&&(r+=Qn("")),s&&l&&(r+=Zn(l))):d===`
11
- `&&(s&&l&&(r+=Zn(s)),i&&(r+=Qn(i)))}return r};Ms=["up","down","left","right","space","enter","cancel"],lt={actions:new Set(Ms),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};Is=globalThis.process.platform.startsWith("win"),Zt=Symbol("clack:cancel");Os=Object.defineProperty,Ts=(t,e,o)=>e in t?Os(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,I=(t,e,o)=>(Ts(t,typeof e!="symbol"?e+"":e,o),o),Dt=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=no,output:s=oo,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 ps(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=Yn.createInterface({input:this.input,output:r,tabSize:2,prompt:"",escapeCodeTimeout:50}),Yn.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),ct(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),ct(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(S.cursor.show),this.output.off("resize",this.render),ct(this.input,!1),e(Zt)})})}onKeypress(e,o){if(this.state==="error"&&(this.state="active"),o?.name&&(!this._track&&lt.aliases.has(o.name)&&this.emit("cursor",lt.aliases.get(o.name)),lt.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
- `),ct(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=eo(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
13
- `).length-1;this.output.write(S.cursor.move(-999,e*-1))}render(){let e=eo(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=ks(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}}},dt=class extends Dt{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})}},Bs=Object.defineProperty,Rs=(t,e,o)=>e in t?Bs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,to=(t,e,o)=>(Rs(t,typeof e!="symbol"?e+"":e,o),o),lo=class extends Dt{constructor(t){super(t,!1),to(this,"options"),to(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 U from"node:process";function Ps(){return U.platform!=="win32"?U.env.TERM!=="linux":!!U.env.CI||!!U.env.WT_SESSION||!!U.env.TERMINUS_SUBLIME||U.env.ConEmuTask==="{cmd::Cmder}"||U.env.TERM_PROGRAM==="Terminus-Sublime"||U.env.TERM_PROGRAM==="vscode"||U.env.TERM==="xterm-256color"||U.env.TERM==="alacritty"||U.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var a,pt,rn,F,Ls,fo,ho,gt,js,E,Be,Do,mo,Ns,po,Us,ba,go,Gs,Ws,Hs,Js,Ks,Vs,Ys,Eo,Co,Re,Fo,Pe,Le,Ct,ae,w,Xs,ft,sn=C(()=>{nn();nn();a=se(pe(),1),pt=se(Xt(),1);rn=Ps(),F=(t,e)=>rn?t:e,Ls=F("\u25C6","*"),fo=F("\u25A0","x"),ho=F("\u25B2","x"),gt=F("\u25C7","o"),js=F("\u250C","T"),E=F("\u2502","|"),Be=F("\u2514","\u2014"),Do=F("\u25CF",">"),mo=F("\u25CB"," "),Ns=F("\u25FB","[\u2022]"),po=F("\u25FC","[+]"),Us=F("\u25FB","[ ]"),ba=F("\u25AA","\u2022"),go=F("\u2500","-"),Gs=F("\u256E","+"),Ws=F("\u251C","+"),Hs=F("\u256F","+"),Js=F("\u25CF","\u2022"),Ks=F("\u25C6","*"),Vs=F("\u25B2","!"),Ys=F("\u25A0","x"),Eo=t=>{switch(t){case"initial":case"active":return a.default.cyan(Ls);case"cancel":return a.default.red(fo);case"error":return a.default.yellow(ho);case"submit":return a.default.green(gt)}},Co=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 _=l===0&&c,me=l===x.length-1&&D;return _||me?a.default.dim("..."):r(d,l+u===e)})},Re=t=>{let e=t.active??"Yes",o=t.inactive??"No";return new dt({active:e,inactive:o,initialValue:t.initialValue??!0,render(){let r=`${a.default.gray(E)}
17
- ${Eo(this.state)} ${t.message}
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
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(Do)} ${e}`:`${a.default.dim(mo)} ${a.default.dim(e)}`} ${a.default.dim("/")} ${this.value?`${a.default.dim(mo)} ${a.default.dim(o)}`:`${a.default.green(Do)} ${o}`}
20
- ${a.default.cyan(Be)}
21
- `}}}).prompt()},Fo=t=>{let e=(o,r)=>{let s=o.label??String(o.value);return r==="active"?`${a.default.cyan(Ns)} ${s} ${o.hint?a.default.dim(`(${o.hint})`):""}`:r==="selected"?`${a.default.green(po)} ${a.default.dim(s)}`:r==="cancelled"?`${a.default.strikethrough(a.default.dim(s))}`:r==="active-selected"?`${a.default.green(po)} ${s} ${o.hint?a.default.dim(`(${o.hint})`):""}`:r==="submitted"?`${a.default.dim(s)}`:`${a.default.dim(Us)} ${a.default.dim(s)}`};return new lo({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.
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
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
- ${Eo(this.state)} ${t.message}
23
+ ${yo(this.state)} ${t.message}
24
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
25
  ${a.default.gray(E)}`:""}`}case"error":{let s=this.error.split(`
26
- `).map((i,n)=>n===0?`${a.default.yellow(Be)} ${a.default.yellow(i)}`:` ${i}`).join(`
27
- `);return`${o+a.default.yellow(E)} ${Co({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:r}).join(`
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
28
  ${a.default.yellow(E)} `)}
29
29
  ${s}
30
- `}default:return`${o}${a.default.cyan(E)} ${Co({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:r}).join(`
30
+ `}default:return`${o}${a.default.cyan(E)} ${ho({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:r}).join(`
31
31
  ${a.default.cyan(E)} `)}
32
- ${a.default.cyan(Be)}
32
+ ${a.default.cyan(Re)}
33
33
  `}}}).prompt()},Pe=(t="",e="")=>{let o=`
34
34
  ${t}
35
35
  `.split(`
36
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
37
  `);process.stdout.write(`${a.default.gray(E)}
38
- ${a.default.green(gt)} ${a.default.reset(e)} ${a.default.gray(go.repeat(Math.max(s-r-1,1))+Gs)}
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(Ws+go.repeat(s+2)+Hs)}
41
- `)},Le=(t="")=>{process.stdout.write(`${a.default.gray(Be)} ${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
- `)},Ct=(t="")=>{process.stdout.write(`${a.default.gray(js)} ${t}
44
- `)},ae=(t="")=>{process.stdout.write(`${a.default.gray(E)}
45
- ${a.default.gray(Be)} ${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
- `)},w={message:(t="",{symbol:e=a.default.gray(E)}={})=>{let o=[`${a.default.gray(E)}`];if(t){let[r,...s]=t.split(`
47
+ `)},b={message:(t="",{symbol:e=a.default.gray(E)}={})=>{let o=[`${a.default.gray(E)}`];if(t){let[r,...s]=t.split(`
48
48
  `);o.push(`${e} ${r}`,...s.map(i=>`${a.default.gray(E)} ${i}`))}process.stdout.write(`${o.join(`
49
49
  `)}
50
- `)},info:t=>{w.message(t,{symbol:a.default.blue(Js)})},success:t=>{w.message(t,{symbol:a.default.green(Ks)})},step:t=>{w.message(t,{symbol:a.default.green(gt)})},warn:t=>{w.message(t,{symbol:a.default.yellow(Vs)})},warning:t=>{w.warn(t)},error:t=>{w.message(t,{symbol:a.default.red(Ys)})}},Xs=()=>{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=b=>{let j=b>1?"Something went wrong":"Canceled";i&&$e(j,b)},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)},_=()=>{if(u===void 0)return;o&&process.stdout.write(`
51
- `);let b=u.split(`
52
- `);process.stdout.write(pt.cursor.move(-999,b.length-1)),process.stdout.write(pt.erase.down(b.length))},me=b=>b.replace(/\.+$/,""),Un=(b="")=>{i=!0,r=co(),n=me(b),process.stdout.write(`${a.default.gray(E)}
53
- `);let j=0,z=0;l(),s=setInterval(()=>{if(o&&n===u)return;_(),u=n;let Yr=a.default.magenta(t[j]),Xr=o?"...":".".repeat(Math.floor(z)).slice(0,3);process.stdout.write(`${Yr} ${n}${Xr}`),j=j+1<t.length?j+1:0,z=z<t.length?z+.125:0},e)},$e=(b="",j=0)=>{i=!1,clearInterval(s),_();let z=j===0?a.default.green(gt):j===1?a.default.red(fo):a.default.red(ho);n=me(b??n),process.stdout.write(`${z} ${n}
54
- `),x(),r()};return{start:Un,stop:$e,message:(b="")=>{n=me(b??n)}}},ft=async t=>{for(let e of t){if(e.enabled===!1)continue;let o=Xs();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 G,readdirSync as zs}from"fs";import{homedir as xo}from"os";import{join as W}from"path";function je(t){try{return qs(`${X?"where":"which"} ${t}`,{stdio:"pipe"}),!0}catch{return!1}}function Zs(t){let e=W(xo(),".vscode","extensions");if(!G(e))return!1;try{return zs(e).some(r=>r.toLowerCase().includes(t.toLowerCase()))}catch{return!1}}function Ne(){let t=xo();return[{id:"claude-code",label:"Claude Code",detected:G(W(t,".claude")),supported:!0,hint:"recommended"},{id:"gemini-cli",label:"Gemini CLI",detected:G(W(t,".gemini")),supported:!0},{id:"opencode",label:"OpenCode",detected:G(W(t,".config","opencode"))||je("opencode"),supported:!0,hint:"plugin-based integration"},{id:"openclaw",label:"OpenClaw",detected:G(W(t,".openclaw")),supported:!0,hint:"plugin-based integration"},{id:"windsurf",label:"Windsurf",detected:G(W(t,".codeium","windsurf")),supported:!0},{id:"codex-cli",label:"Codex CLI",detected:G(W(t,".codex")),supported:!0,hint:"transcript-based integration"},{id:"cursor",label:"Cursor",detected:G(W(t,".cursor")),supported:!0,hint:"hooks + MCP integration"},{id:"copilot-cli",label:"Copilot CLI",detected:je("copilot"),supported:!0,hint:"MCP-based integration"},{id:"antigravity",label:"Antigravity",detected:G(W(t,".gemini","antigravity")),supported:!0,hint:"MCP-based integration"},{id:"goose",label:"Goose",detected:G(W(t,".config","goose"))||je("goose"),supported:!0,hint:"MCP-based integration"},{id:"crush",label:"Crush",detected:je("crush"),supported:!0,hint:"MCP-based integration"},{id:"roo-code",label:"Roo Code",detected:Zs("roo-code"),supported:!0,hint:"MCP-based integration"},{id:"warp",label:"Warp",detected:G(W(t,".warp"))||je("warp"),supported:!0,hint:"MCP-based integration"}]}var vo=C(()=>{"use strict";ue()});import{appendFileSync as Qs,existsSync as _o,mkdirSync as ei,readFileSync as ti}from"fs";import{join as ht}from"path";import{homedir as ni}from"os";var un,So,an,m,q=C(()=>{"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||{}),So=ht(ni(),".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=ht(So,"logs");_o(e)||ei(e,{recursive:!0});let o=new Date().toISOString().split("T")[0];this.logFilePath=ht(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=ht(So,"settings.json");if(_o(e)){let o=ti(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}
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
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:_,memorySessionId:me,correlationId:Un,...$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{Qs(this.logFilePath,x+`
59
- `,"utf8")}catch(_){process.stderr.write(`[LOGGER] Failed to write to log file: ${_}
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
+ `,"utf8")}catch(v){process.stderr.write(`[LOGGER] Failed to write to log file: ${v}
60
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 an});function Ao(t){return process.platform==="win32"?Math.round(t*cn.WINDOWS_MULTIPLIER):t}var cn,wo=C(()=>{"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 oi,writeFileSync as bo,existsSync as $o,mkdirSync as ri}from"fs";import{join as Mo,dirname as si}from"path";import{homedir as ko}from"os";var ce,Io=C(()=>{"use strict";ce=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:Mo(ko(),".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:Mo(ko(),".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(!$o(e)){let n=this.getAllDefaults();try{let u=si(e);$o(u)||ri(u,{recursive:!0}),bo(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=oi(e,"utf-8"),r=JSON.parse(o),s=r;if(r.env&&typeof r.env=="object"){s=r.env;try{bo(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 ii,basename as Ka}from"path";import{homedir as Oo}from"os";import{existsSync as ui,mkdirSync as qa}from"fs";import{execSync as Za}from"child_process";import{fileURLToPath as ai}from"url";function ci(){return typeof __dirname<"u"?__dirname:ii(ai(import.meta.url))}function li(){if(process.env.CLAUDE_MEM_DATA_DIR)return process.env.CLAUDE_MEM_DATA_DIR;let t=A(Oo(),".claude-mem"),e=A(t,"settings.json");try{if(ui(e)){let{readFileSync:o}=ts("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 tc,O,he,Et,nc,oc,rc,sc,ic,uc,ac,cc,lc,Dc,dc,mc,Ft=C(()=>{"use strict";q();tc=ci();O=li(),he=process.env.CLAUDE_CONFIG_DIR||A(Oo(),".claude"),Et=A(he,"plugins","marketplaces","thedotmack"),nc=A(O,"archives"),oc=A(O,"logs"),rc=A(O,"trash"),sc=A(O,"backups"),ic=A(O,"modes"),uc=A(O,"settings.json"),ac=A(O,"claude-mem.db"),cc=A(O,"vector-db"),lc=A(O,"observer-sessions"),Dc=A(he,"settings.json"),dc=A(he,"commands"),mc=A(he,"CLAUDE.md")});import To from"path";import{readFileSync as fc}from"fs";function di(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(yt!==null)return yt;let t=To.join(ce.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),e=ce.loadFromFile(t);return yt=parseInt(e.CLAUDE_MEM_WORKER_PORT,10),yt}function mi(){if(xt!==null)return xt;let t=To.join(ce.get("CLAUDE_MEM_DATA_DIR"),"settings.json");return xt=ce.loadFromFile(t).CLAUDE_MEM_WORKER_HOST,xt}function pi(t){return`http://${mi()}:${Ue()}${t}`}function vt(t,e={}){let o=e.method??"GET",r=e.timeoutMs??Di,s=pi(t),i={method:o};return e.headers&&(i.headers=e.headers),e.body&&(i.body=e.body),r>0?di(s,i,r):fetch(s,i)}var Di,yt,xt,_t=C(()=>{"use strict";q();wo();Io();Ft();Di=(()=>{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 Ao(cn.HEALTH_CHECK)})();yt=null,xt=null});import{existsSync as gi,readFileSync as Ci,writeFileSync as Bo,mkdirSync as Ro,renameSync as fi}from"fs";import{join as ln,basename as Sc}from"path";function Po(t){try{return gi(t)?JSON.parse(Ci(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 Lo(t,e){let o=ln(t,"..");Ro(o,{recursive:!0}),Bo(t,JSON.stringify(e,null,2))}function Dn(t,e){let o=ln(t,".cursor","rules"),r=ln(o,"claude-mem-context.mdc"),s=`${r}.tmp`;Ro(o,{recursive:!0});let i=`---
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
63
  alwaysApply: true
64
64
  description: "Claude-mem context from past sessions (auto-updated)"
65
65
  ---
@@ -72,9 +72,9 @@ ${e}
72
72
 
73
73
  ---
74
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=C(()=>{"use strict";q()});var Yo={};K(Yo,{checkCursorHooksStatus:()=>Vo,configureCursorMcp:()=>vi,detectClaudeCode:()=>Si,detectPlatform:()=>Go,findBunPath:()=>Fe,findMcpServerPath:()=>Ge,findWorkerServicePath:()=>Ee,getScriptExtension:()=>yi,getTargetDir:()=>wt,handleCursorCommand:()=>Ai,installCursorHooks:()=>Jo,readCursorRegistry:()=>At,registerCursorProject:()=>Wo,uninstallCursorHooks:()=>Ko,unregisterCursorProject:()=>Ho,updateCursorContextForProject:()=>xi,writeCursorRegistry:()=>gn});import p from"path";import{homedir as St}from"os";import{existsSync as B,readFileSync as No,writeFileSync as mn,unlinkSync as dn,mkdirSync as pn}from"fs";import{exec as hi}from"child_process";import{promisify as Ei}from"util";function Go(){return process.platform==="win32"?"windows":"unix"}function yi(){return Go()==="windows"?".ps1":".sh"}function At(){return Po(Uo)}function gn(t){Lo(Uo,t)}function Wo(t,e){let o=At();o[t]={workspacePath:e,installedAt:new Date().toISOString()},gn(o),m.info("CURSOR","Registered project for auto-context updates",{projectName:t,workspacePath:e})}function Ho(t){let e=At();e[t]&&(delete e[t],gn(e),m.info("CURSOR","Unregistered project",{projectName:t}))}async function xi(t,e){let r=At()[t];if(r)try{let s=await vt(`/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 Ge(){let t=[p.join(Et,"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 Ee(){let t=[p.join(Et,"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 Fe(){let t=[p.join(St(),".bun","bin","bun"),"/usr/local/bin/bun","/usr/bin/bun",...process.platform==="win32"?[p.join(St(),".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 wt(t){switch(t){case"project":return p.join(process.cwd(),".cursor");case"user":return p.join(St(),".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 vi(t){let e=Ge();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=wt(t);if(!o)return console.error(`Invalid target: ${t}. Use: project or user`),1;let r=p.join(o,"mcp.json");try{pn(o,{recursive:!0});let s={mcpServers:{}};if(B(r))try{s=JSON.parse(No(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]},mn(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 Jo(t){console.log(`
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
76
  Installing Claude-Mem Cursor hooks (${t} level)...
77
- `);let e=wt(t);if(!e)return console.error(`Invalid target: ${t}. Use: project, user, or enterprise`),1;let o=Ee();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{pn(e,{recursive:!0});let s=p.join(e,"hooks.json"),i=Fe(),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 mn(s,JSON.stringify(D,null,2)),console.log(" Created hooks.json (unified CLI mode)"),console.log(` Worker service: ${o}`),t==="project"&&await _i(e,r),console.log(`
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
78
  Installation complete!
79
79
 
80
80
  Hooks installed to: ${e}/hooks.json
@@ -89,7 +89,7 @@ Context Injection:
89
89
  Context from past sessions is stored in .cursor/rules/claude-mem-context.mdc
90
90
  and automatically included in every chat. It updates after each session ends.
91
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 _i(t,e){let o=p.join(t,"rules");pn(o,{recursive:!0});let r=p.basename(e),s=!1;console.log(" Generating initial context...");try{if((await vt("/api/readiness")).ok){let n=await vt(`/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");mn(i,`---
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
93
  alwaysApply: true
94
94
  description: "Claude-mem context from past sessions (auto-updated)"
95
95
  ---
@@ -99,15 +99,15 @@ description: "Claude-mem context from past sessions (auto-updated)"
99
99
  *No context yet. Complete your first session and context will appear here.*
100
100
 
101
101
  Use claude-mem's MCP search tools for manual memory queries.
102
- `),console.log(" Created placeholder context file (will populate after first session)")}Wo(r,e),console.log(" Registered for auto-context updates")}function Ko(t){console.log(`
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
103
  Uninstalling Claude-Mem Cursor hooks (${t} level)...
104
- `);let e=wt(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)&&(dn(c),console.log(` Removed legacy script: ${u}`))}if(B(r)&&(dn(r),console.log(" Removed hooks.json")),t==="project"){let u=p.join(e,"rules","claude-mem-context.mdc");B(u)&&(dn(u),console.log(" Removed context file"));let c=p.basename(process.cwd());Ho(c),console.log(" Unregistered from auto-context updates")}return console.log(`
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
105
  Uninstallation complete!
106
106
  `),console.log("Restart Cursor to apply changes."),0}catch(o){return console.error(`
107
- Uninstallation failed: ${o.message}`),1}}function Vo(){console.log(`
107
+ Uninstallation failed: ${o.message}`),1}}function Xo(){console.log(`
108
108
  Claude-Mem Cursor Hooks Status
109
- `);let t=[{name:"Project",dir:p.join(process.cwd(),".cursor")},{name:"User",dir:p.join(St(),".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(No(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 Si(){try{let{stdout:e}=await Fi("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(he,"plugins");return!!B(t)}async function Ai(t,e){switch(t){case"install":{let o=e[0]||"project";return Jo(o)}case"uninstall":{let o=e[0]||"project";return Ko(o)}case"status":return Vo();case"setup":return console.log("Use the main entry point for setup"),0;default:return console.log(`
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
111
  Claude-Mem Cursor Integration
112
112
 
113
113
  Usage: claude-mem cursor <command> [options]
@@ -131,22 +131,22 @@ Examples:
131
131
  claude-mem cursor status # Check if hooks are installed
132
132
 
133
133
  For more info: https://docs.claude-mem.ai/cursor
134
- `),0}}var Fi,Uo,We=C(()=>{"use strict";q();_t();Ft();jo();Fi=Ei(hi),Uo=p.join(O,"cursor-projects.json")});var En={};K(En,{checkGeminiCliHooksStatus:()=>Qo,handleGeminiCliCommand:()=>Oi,installGeminiCliHooks:()=>zo,uninstallGeminiCliHooks:()=>Zo});import Cn from"path";import{homedir as wi}from"os";import{existsSync as xe,readFileSync as bt,writeFileSync as fn,mkdirSync as Xo}from"fs";function $i(t,e,o){let r=ye[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 Mi(t){return{matcher:"*",hooks:[{name:He,type:"command",command:t,timeout:bi}]}}function hn(){if(!xe(J))return{};let t=bt(J,"utf-8");try{return JSON.parse(t)}catch{throw new Error(`Corrupt JSON in ${J}, refusing to overwrite user settings`)}}function qo(t){Xo($t,{recursive:!0}),fn(J,JSON.stringify(t,null,2)+`
135
- `)}function ki(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===He));if(u>=0){let c=i[u],D=c.hooks.findIndex(d=>d.name===He);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 Ii(){let t="<claude-mem-context>",o=`${t}
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}
136
136
  # Memory Context from Past Sessions
137
137
 
138
138
  *No context yet. Complete your first session and context will appear here.*
139
- </claude-mem-context>`,r="";if(xe(H)&&(r=bt(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(`
140
140
  `)?`
141
141
 
142
142
  `:r.length>0?`
143
143
  `:"",i=r+s+o+`
144
- `;Xo($t,{recursive:!0}),fn(H,i)}async function zo(){console.log(`
144
+ `;qo(kt,{recursive:!0}),hn(K,i)}async function Zo(){console.log(`
145
145
  Installing Claude-Mem Gemini CLI hooks...
146
- `);let t=Ee();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=Fe();console.log(` Using Bun runtime: ${e}`),console.log(` Worker service: ${t}`);try{let o={};for(let n of Object.keys(ye)){let u=$i(e,t,n);o[n]=[Mi(u)]}let r=hn(),s=ki(r,o);qo(s),console.log(` Merged hooks into ${J}`),Ii(),console.log(` Setup context injection in ${H}`);let i=Object.keys(ye);console.log(` Registered ${i.length} hook events:`);for(let n of i){let u=ye[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(`
147
147
  Installation complete!
148
148
 
149
- Hooks installed to: ${J}
149
+ Hooks installed to: ${V}
150
150
  Using unified CLI: bun worker-service.cjs hook gemini-cli <event>
151
151
 
152
152
  Next steps:
@@ -158,21 +158,21 @@ Context Injection:
158
158
  Context from past sessions is injected via ~/.gemini/GEMINI.md
159
159
  and automatically included in Gemini CLI conversations.
160
160
  `),0}catch(o){return console.error(`
161
- Installation failed: ${o.message}`),1}}function Zo(){console.log(`
161
+ Installation failed: ${o.message}`),1}}function Qo(){console.log(`
162
162
  Uninstalling Claude-Mem Gemini CLI hooks...
163
- `);try{if(!xe(J))return console.log(" No Gemini CLI settings found \u2014 nothing to uninstall."),0;let t=hn();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!==He);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,qo(t),console.log(` Removed ${e} claude-mem hook(s) from ${J}`),xe(H)){let o=bt(H,"utf-8"),r=/\n?<claude-mem-context>[\s\S]*?<\/claude-mem-context>\n?/;r.test(o)&&(o=o.replace(r,""),fn(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(`
164
164
  Uninstallation complete!
165
165
  `),console.log("Restart Gemini CLI to apply changes."),0}catch(t){return console.error(`
166
- Uninstallation failed: ${t.message}`),1}}function Qo(){if(console.log(`
166
+ Uninstallation failed: ${t.message}`),1}}function er(){if(console.log(`
167
167
  Claude-Mem Gemini CLI Hooks Status
168
- `),!xe(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}
169
169
  `),console.log(`No hooks installed. Run: claude-mem install --ide gemini-cli
170
- `),0;let t;try{t=hn()}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}
171
171
  `),0}if(!t.hooks)return console.log(`Gemini CLI settings: Found, but no hooks configured
172
172
  `),console.log(`No hooks installed. Run: claude-mem install --ide gemini-cli
173
- `),0;let e=[];for(let[o,r]of Object.entries(t.hooks))r.some(i=>i.hooks.some(n=>n.name===He))&&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
174
174
  `),console.log(`Run: claude-mem install --ide gemini-cli
175
- `),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(ye).length} mapped`);for(let o of e){let r=ye[o]??"unknown";console.log(` ${o} \u2192 ${r}`)}return xe(H)?bt(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 Oi(t,e){switch(t){case"install":return zo();case"uninstall":return Zo();case"status":return Qo();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(`
176
176
  Claude-Mem Gemini CLI Integration
177
177
 
178
178
  Usage: claude-mem gemini-cli <command>
@@ -188,36 +188,36 @@ Examples:
188
188
  claude-mem gemini-cli uninstall # Remove hooks
189
189
 
190
190
  For more info: https://docs.claude-mem.ai/usage/gemini-provider
191
- `),0}}var $t,J,H,He,bi,ye,Fn=C(()=>{"use strict";We();$t=Cn.join(wi(),".gemini"),J=Cn.join($t,"settings.json"),H=Cn.join($t,"GEMINI.md"),He="claude-mem",bi=1e4,ye={SessionStart:"context",BeforeAgent:"session-init",AfterAgent:"observation",BeforeTool:"observation",AfterTool:"observation",PreCompress:"summarize",Notification:"observation",SessionEnd:"session-complete"}});import Ti from"path";import{existsSync as Bi,readFileSync as Ri,writeFileSync as yn,mkdirSync as Pi}from"fs";function Mt(t,e,o){let r=Ti.dirname(t);Pi(r,{recursive:!0});let s=`${Je}
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}
192
192
  ${e}
193
- ${ve}`;if(Bi(t)){let i=Ri(t,"utf-8"),n=i.indexOf(Je),u=i.indexOf(ve);n!==-1&&u!==-1?i=i.slice(0,n)+s+i.slice(u+ve.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()+`
194
194
 
195
195
  `+s+`
196
- `,yn(t,i,"utf-8")}else o?yn(t,`${o}
196
+ `,xn(t,i,"utf-8")}else o?xn(t,`${o}
197
197
 
198
198
  ${s}
199
- `,"utf-8"):yn(t,s+`
200
- `,"utf-8")}var Je,ve,xn=C(()=>{"use strict";Je="<claude-mem-context>",ve="</claude-mem-context>"});var _n={};K(_n,{checkOpenCodeStatus:()=>Hi,findBuiltPluginPath:()=>or,getInstalledPluginPath:()=>Ve,getOpenCodeAgentsMdPath:()=>Ke,getOpenCodeConfigDirectory:()=>kt,getOpenCodePluginsDirectory:()=>vn,injectContextIntoAgentsMd:()=>le,installOpenCodeIntegration:()=>Ji,installOpenCodePlugin:()=>rr,syncContextToAgentsMd:()=>Gi,uninstallOpenCodePlugin:()=>Wi});import te from"path";import{homedir as tr}from"os";import{fileURLToPath as Li}from"url";import{existsSync as _e,readFileSync as nr,writeFileSync as ji,mkdirSync as Ni,copyFileSync as Ui,unlinkSync as er}from"fs";function kt(){return process.env.OPENCODE_CONFIG_DIR?process.env.OPENCODE_CONFIG_DIR:te.join(tr(),".config","opencode")}function vn(){return te.join(kt(),"plugins")}function Ke(){return te.join(kt(),"AGENTS.md")}function Ve(){return te.join(vn(),"claude-mem.js")}function or(){let t=[te.join(process.env.CLAUDE_CONFIG_DIR||te.join(tr(),".claude"),"plugins","marketplaces","thedotmack","dist","opencode-plugin","index.js"),te.join(te.dirname(Li(import.meta.url)),"..","..","..","dist","opencode-plugin","index.js")];for(let e of t)if(_e(e))return e;return null}function rr(){let t=or();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=Ve();try{return Ni(e,{recursive:!0}),Ui(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=Ke();try{return Mt(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 Gi(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 Wi(){let t=!1,e=Ve();if(_e(e))try{er(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=Ke();if(_e(o))try{let r=nr(o,"utf-8"),s=r.indexOf(Je),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"?(er(o),console.log(" Removed empty AGENTS.md")):(ji(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 Hi(){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(`
203
203
  Claude-Mem OpenCode Integration Status
204
- `);let t=kt(),e=Ve(),o=Ke();if(console.log(`Config directory: ${t}`),console.log(` Exists: ${_e(t)?"yes":"no"}`),console.log(""),console.log(`Plugin: ${e}`),console.log(` Installed: ${_e(e)?"yes":"no"}`),console.log(""),console.log(`Context (AGENTS.md): ${o}`),_e(o)){let s=nr(o,"utf-8").includes(Je);console.log(" Exists: yes"),console.log(` Has claude-mem context: ${s?"yes":"no"}`)}else console.log(" Exists: no");return console.log(""),0}async function Ji(){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(`
205
205
  Installing Claude-Mem for OpenCode...
206
- `);let t=rr();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
207
207
 
208
208
  *No context yet. Complete your first session and context will appear here.*
209
209
 
210
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(`
211
211
  Installation complete!
212
212
 
213
- Plugin installed to: ${Ve()}
214
- Context file: ${Ke()}
213
+ Plugin installed to: ${Ye()}
214
+ Context file: ${Xe()}
215
215
 
216
216
  Next steps:
217
217
  1. Start claude-mem worker: npx claude-mem start
218
218
  2. Restart OpenCode to load the plugin
219
219
  3. Memory capture is automatic from then on
220
- `),0}var Sn=C(()=>{"use strict";q();xn();_t()});var bn={};K(bn,{checkWindsurfHooksStatus:()=>dr,handleWindsurfCommand:()=>Zi,installWindsurfHooks:()=>lr,readWindsurfRegistry:()=>Bt,registerWindsurfProject:()=>ar,uninstallWindsurfHooks:()=>Dr,unregisterWindsurfProject:()=>cr,updateWindsurfContextForProject:()=>Yi,writeWindsurfContextFile:()=>wn,writeWindsurfRegistry:()=>An});import P from"path";import{homedir as Ki}from"os";import{existsSync as Se,readFileSync as Ot,writeFileSync as Xe,unlinkSync as sr,mkdirSync as Tt,renameSync as Vi}from"fs";function Bt(){try{return Se(Ye)?JSON.parse(Ot(Ye,"utf-8")):{}}catch(t){return m.error("WINDSURF","Failed to read registry, using empty",{file:Ye},t),{}}}function An(t){let e=P.dirname(Ye);Tt(e,{recursive:!0}),Xe(Ye,JSON.stringify(t,null,2))}function ar(t){let e=Bt();e[t]={installedAt:new Date().toISOString()},An(e),m.info("WINDSURF","Registered project for auto-context updates",{workspacePath:t})}function cr(t){let e=Bt();e[t]&&(delete e[t],An(e),m.info("WINDSURF","Unregistered project",{workspacePath:t}))}async function Yi(t,e,o){if(Bt()[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=P.join(t,".windsurf","rules"),r=P.join(o,"claude-mem-context.md"),s=`${r}.tmp`;Tt(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
221
221
 
222
222
  The following context is from claude-mem, a persistent memory system that tracks your coding sessions.
223
223
 
@@ -225,15 +225,15 @@ ${e}
225
225
 
226
226
  ---
227
227
  *Auto-updated by claude-mem after each session. Use MCP search tools for detailed queries.*
228
- `;i.length>ir&&(i=i.slice(0,ir-50)+`
228
+ `;i.length>ur&&(i=i.slice(0,ur-50)+`
229
229
 
230
230
  *[Truncated \u2014 use MCP search for full history]*
231
- `),Xe(s,i),Vi(s,r)}function Xi(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){Tt(ur,{recursive:!0});let r={hooks:{}};if(Se(R))try{r=JSON.parse(Ot(R,"utf-8")),r.hooks||(r.hooks={})}catch{throw new Error(`Corrupt hooks.json at ${R}, refusing to overwrite`)}for(let s of It){let n={command:Xi(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]}Xe(R,JSON.stringify(r,null,2))}async function lr(){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(`
232
232
  Installing Claude-Mem Windsurf hooks (user level)...
233
- `);let t=Ee();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=Fe();if(!e)return console.error("Could not find Bun runtime"),console.error(" Install Bun: curl -fsSL https://bun.sh/install | bash"),1;let o=P.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 zi(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(`
234
234
  Installation complete!
235
235
 
236
- Hooks installed to: ${R}
236
+ Hooks installed to: ${P}
237
237
  Using unified CLI: bun worker-service.cjs hook windsurf <command>
238
238
 
239
239
  Events registered:
@@ -248,21 +248,21 @@ Next steps:
248
248
  2. Restart Windsurf to load the hooks
249
249
  3. Context is injected via .windsurf/rules/claude-mem-context.md (workspace-level)
250
250
  `),0}catch(r){return console.error(`
251
- Installation failed: ${r.message}`),1}}async function zi(t){let e=Ue(),o=P.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=P.join(t,".windsurf","rules");Tt(s,{recursive:!0});let i=P.join(s,"claude-mem-context.md");Xe(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
252
252
 
253
253
  *No context yet. Complete your first session and context will appear here.*
254
254
 
255
255
  Use claude-mem's MCP search tools for manual memory queries.
256
- `),console.log(" Created placeholder context file (will populate after first session)")}ar(t),console.log(" Registered for auto-context updates")}function Dr(){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(`
257
257
  Uninstalling Claude-Mem Windsurf hooks...
258
- `);try{if(Se(R))try{let o=JSON.parse(Ot(R,"utf-8"));for(let r of It)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?(sr(R),console.log(" Removed hooks.json (no hooks remaining)")):(Xe(R,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=P.join(t,".windsurf","rules","claude-mem-context.md");return Se(e)&&(sr(e),console.log(" Removed context file")),cr(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(`
259
259
  Uninstallation complete!
260
260
  `),console.log("Restart Windsurf to apply changes."),0}catch(t){return console.error(`
261
- Uninstallation failed: ${t.message}`),1}}function dr(){if(console.log(`
261
+ Uninstallation failed: ${t.message}`),1}}function mr(){if(console.log(`
262
262
  Claude-Mem Windsurf Hooks Status
263
- `),Se(R)){console.log("User-level: Installed"),console.log(` Config: ${R}`);try{let e=JSON.parse(Ot(R,"utf-8")),o=It.filter(r=>e.hooks[r]?.some(s=>s.command.includes("worker-service")&&s.command.includes("windsurf")));console.log(` Events: ${o.length}/${It.length} registered`);for(let r of o)console.log(` - ${r}`)}catch{console.log(" Mode: Unable to parse hooks.json")}let t=P.join(process.cwd(),".windsurf","rules","claude-mem-context.md");Se(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(`
264
264
  No hooks installed. Run: claude-mem windsurf install
265
- `);return console.log(""),0}async function Zi(t,e){switch(t){case"install":return lr();case"uninstall":return Dr();case"status":return dr();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(`
266
266
  Claude-Mem Windsurf Integration
267
267
 
268
268
  Usage: claude-mem windsurf <command>
@@ -278,72 +278,81 @@ Examples:
278
278
  claude-mem windsurf status # Check if hooks are installed
279
279
 
280
280
  For more info: https://docs.claude-mem.ai/windsurf
281
- `),0}}var ur,R,ir,Ye,It,$n=C(()=>{"use strict";q();_t();Ft();We();ur=P.join(Ki(),".codeium","windsurf"),R=P.join(ur,"hooks.json"),ir=6e3,Ye=P.join(O,"windsurf-projects.json"),It=["pre_user_prompt","post_write_code","post_run_command","post_mcp_tool_use","post_cascade_response"]});var In={};K(In,{checkOpenClawStatus:()=>ru,findPluginManifestPath:()=>fr,findPluginSkillsDirectory:()=>hr,findPreBuiltPluginDirectory:()=>Cr,getOpenClawClaudeMemExtensionDirectory:()=>ze,getOpenClawConfigDirectory:()=>qe,getOpenClawConfigFilePath:()=>Ae,getOpenClawExtensionsDirectory:()=>gr,installOpenClawIntegration:()=>su,installOpenClawPlugin:()=>Fr,uninstallOpenClawPlugin:()=>ou});import v from"path";import{homedir as Rt}from"os";import{existsSync as V,readFileSync as Qi,writeFileSync as mr,mkdirSync as pr,cpSync as Mn,rmSync as eu}from"fs";function qe(){return v.join(Rt(),".openclaw")}function gr(){return v.join(qe(),"extensions")}function ze(){return v.join(gr(),"claude-mem")}function Ae(){return v.join(qe(),"openclaw.json")}function Cr(){let t=[v.join(process.env.CLAUDE_CONFIG_DIR||v.join(Rt(),".claude"),"plugins","marketplaces","thedotmack"),process.cwd()];for(let e of t){let o=v.join(e,"openclaw","dist"),r=v.join(o,"index.js");if(V(r))return o}return null}function fr(){let t=[v.join(process.env.CLAUDE_CONFIG_DIR||v.join(Rt(),".claude"),"plugins","marketplaces","thedotmack"),process.cwd()];for(let e of t){let o=v.join(e,"openclaw","openclaw.plugin.json");if(V(o))return o}return null}function hr(){let t=[v.join(process.env.CLAUDE_CONFIG_DIR||v.join(Rt(),".claude"),"plugins","marketplaces","thedotmack"),process.cwd()];for(let e of t){let o=v.join(e,"openclaw","skills");if(V(o))return o}return null}function kn(){let t=Ae();if(!V(t))return{};try{return JSON.parse(Qi(t,"utf-8"))}catch{return{}}}function Er(t){let e=qe();pr(e,{recursive:!0}),mr(Ae(),JSON.stringify(t,null,2)+`
282
- `,"utf-8")}function tu(t=37777,e="openclaw",o=!0){let r=kn();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)}Er(r)}function nu(){let t=Ae();if(!V(t))return;let e=kn();e.plugins?.entries?.["claude-mem"]&&delete e.plugins.entries["claude-mem"],e.plugins?.slots?.memory==="claude-mem"&&delete e.plugins.slots.memory,Er(e)}function Fr(){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=ze(),o=v.join(e,"dist");try{pr(o,{recursive:!0}),Mn(t,o,{recursive:!0,force:!0}),console.log(` Plugin dist copied to: ${o}`);let r=fr();if(r){let n=v.join(e,"openclaw.plugin.json");Mn(r,n,{force:!0}),console.log(` Plugin manifest copied to: ${n}`)}let s=hr();if(s){let n=v.join(e,"skills");Mn(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 mr(v.join(e,"package.json"),JSON.stringify(i,null,2)+`
283
- `,"utf-8"),tu(),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 ou(){let t=!1,e=ze();if(V(e))try{eu(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{nu(),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 ru(){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(`
284
284
  Claude-Mem OpenClaw Integration Status
285
- `);let t=qe(),e=ze(),o=Ae(),r=v.join(e,"dist","index.js");if(console.log(`Config directory: ${t}`),console.log(` Exists: ${V(t)?"yes":"no"}`),console.log(""),console.log(`Extension directory: ${e}`),console.log(` Exists: ${V(e)?"yes":"no"}`),console.log(` Plugin entry: ${V(r)?"yes":"no"}`),console.log(""),console.log(`Config (openclaw.json): ${o}`),V(o)){let s=kn(),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 su(){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(`
286
286
  Installing Claude-Mem for OpenClaw...
287
- `);let t=Fr();if(t!==0)return t;let e=ze();return console.log(`
287
+ `);let t=yr();if(t!==0)return t;let e=Qe();return console.log(`
288
288
  Installation complete!
289
289
 
290
290
  Plugin installed to: ${e}
291
- Config updated: ${Ae()}
291
+ Config updated: ${be()}
292
292
 
293
293
  Next steps:
294
294
  1. Start claude-mem worker: npx claude-mem start
295
295
  2. Restart OpenClaw to load the plugin
296
296
  3. Memory capture is automatic from then on
297
- `),0}var On=C(()=>{"use strict";q()});import{existsSync as Dl,readFileSync as dl,writeFileSync as ml,mkdirSync as pl}from"fs";import{homedir as yr}from"os";import{join as xr,dirname as fl}from"path";var Y,Ze,iu,Pt,vr=C(()=>{"use strict";Y=xr(yr(),".claude-mem","transcript-watch.json"),Ze=xr(yr(),".claude-mem","transcript-watch-state.json"),iu={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"}]},Pt={version:1,schemas:{codex:iu},watches:[{name:"codex",path:"~/.codex/sessions/**/*.jsonl",schema:"codex",startAtEnd:!0,context:{mode:"agents",updateOn:["session_start","session_end"]}}],stateFile:Ze}});var Bn={};K(Bn,{checkCodexCliStatus:()=>mu,installCodexCli:()=>Du,uninstallCodexCli:()=>du});import Nt from"path";import{homedir as _r}from"os";import{existsSync as we,readFileSync as Lt,writeFileSync as jt,mkdirSync as uu}from"fs";function Tn(){let t=Y;if(!we(t))return{version:1,schemas:{},watches:[],stateFile:Ze};try{let e=Lt(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=Ze),o}catch(e){m.error("SYSTEM","Corrupt transcript-watch.json, creating backup",{path:t},e);let o=`${t}.backup.${Date.now()}`;return jt(o,Lt(t)),console.warn(` Backed up corrupt transcript-watch.json to ${o}`),{version:1,schemas:{},watches:[],stateFile:Ze}}}function cu(t){let e={...t};e.schemas={...e.schemas};let o=Pt.schemas?.[oe];o&&(e.schemas[oe]=o);let r=Pt.watches.find(s=>s.name===oe);if(r){let s=e.watches.findIndex(i=>i.name===oe);s!==-1?e.watches[s]=r:e.watches.push(r)}return e}function Ar(t){uu(au,{recursive:!0}),jt(Y,JSON.stringify(t,null,2)+`
298
- `)}function lu(){try{if(!we(ne))return;let t=Lt(ne,"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?`
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}
298
+ ${e}
299
+ ${r}`;let s=t.indexOf(o),i=t.indexOf(r);return s!==-1&&i!==-1?t.substring(0,s)+`${o}
300
+ ${e}
301
+ ${r}`+t.substring(i+r.length):t+`
302
+
303
+ ${o}
304
+ ${e}
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?`
299
308
 
300
- `+n:"")).trim();u?jt(ne,u+`
301
- `):jt(ne,""),console.log(` Removed legacy global context from ${ne}`)}catch(t){m.warn("SYSTEM","Failed to clean AGENTS.md context",{error:t.message})}}async function Du(){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(`
302
311
  Installing Claude-Mem for Codex CLI (transcript watching)...
303
- `);try{let t=Tn(),e=cu(t);return Ar(e),console.log(` Updated ${Y}`),console.log(" Watch path: ~/.codex/sessions/**/*.jsonl"),console.log(` Schema: codex (v${Pt.schemas?.codex?.version??"?"})`),wr(),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(`
304
313
  Installation complete!
305
314
 
306
- Transcript watch config: ${Y}
307
- Context files: <workspace>/AGENTS.md
315
+ Transcript watch config: ${q}
316
+ Context file: ${M}
308
317
 
309
318
  How it works:
310
319
  - claude-mem watches Codex session JSONL files for new activity
311
320
  - No hooks needed -- transcript watching is fully automatic
312
- - Context from past sessions is injected via AGENTS.md in the active Codex workspace
321
+ - Context from past sessions is injected via ${M}
313
322
 
314
323
  Next steps:
315
324
  1. Start claude-mem worker: npx claude-mem start
316
325
  2. Use Codex CLI as usual -- memory capture is automatic!
317
326
  `),0}catch(t){return console.error(`
318
- Installation failed: ${t.message}`),1}}function du(){console.log(`
327
+ Installation failed: ${t.message}`),1}}function Cu(){console.log(`
319
328
  Uninstalling Claude-Mem Codex CLI integration...
320
- `);try{if(we(Y)){let t=Tn();t.watches=t.watches.filter(e=>e.name!==oe),t.schemas&&delete t.schemas[oe],Ar(t),console.log(` Removed codex watch from ${Y}`)}else console.log(" No transcript-watch.json found -- nothing to remove.");return wr(),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(`
321
330
  Uninstallation complete!`),console.log(`Restart claude-mem worker to apply changes.
322
331
  `),0}catch(t){return console.error(`
323
- Uninstallation failed: ${t.message}`),1}}function mu(){if(console.log(`
332
+ Uninstallation failed: ${t.message}`),1}}function hu(){if(console.log(`
324
333
  Claude-Mem Codex CLI Integration Status
325
- `),!we(Y))return console.log("Status: Not installed"),console.log(` No transcript watch config at ${Y}`),console.log(`
334
+ `),!De(q))return console.log("Status: Not installed"),console.log(` No transcript watch config at ${q}`),console.log(`
326
335
  Run: npx claude-mem install --ide codex-cli
327
- `),0;try{let t=Tn(),e=t.watches.find(s=>s.name===oe),o=t.schemas?.[oe];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(`
328
337
  Run: npx claude-mem install --ide codex-cli
329
- `),0;console.log("Status: Installed"),console.log(` Config: ${Y}`),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??"<workspace>/AGENTS.md (default)"}`),console.log(` Context updates on: ${e.context.updateOn?.join(", ")??"none"}`)),we(ne)?Lt(ne,"utf-8").includes("<claude-mem-context>")?console.log(` Legacy global context: Present (${ne})`):console.log(" Legacy global context: Not active"):console.log(" Legacy global context: None");let r=Nt.join(Sr,"sessions");we(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 Sr,ne,au,oe,wr,Rn=C(()=>{"use strict";q();vr();Sr=Nt.join(_r(),".codex"),ne=Nt.join(Sr,"AGENTS.md"),au=Nt.join(_r(),".claude-mem"),oe="codex";wr=lu});var Or={};K(Or,{MCP_IDE_INSTALLERS:()=>Su,installGooseMcpIntegration:()=>Ir});import T from"path";import{homedir as tt}from"os";import{existsSync as Mr,readFileSync as pu,writeFileSync as et,mkdirSync as kr}from"fs";function Cu(t){return{command:process.execPath,args:[t]}}function fu(t,e,o="mcpServers"){let r=T.dirname(t);kr(r,{recursive:!0});let s=N(t,{});s[o]||(s[o]={}),s[o]["claude-mem"]=Cu(e),et(t,JSON.stringify(s,null,2)+`
330
- `)}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(`
331
340
  Installing Claude-Mem MCP integration for ${t.ideLabel}...
332
- `);let e=Ge();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"&&!Mr(T.dirname(o))?console.log(" Note: ~/.warp/ not found. MCP may need to be configured via Warp Drive UI."):(fu(o,e,t.configKey),console.log(` MCP config written to: ${o}`));let r;t.contextFile&&(r=t.contextFile.path,Mt(r,gu),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=[`
333
342
  Installation complete!
334
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(`
335
344
  `)),0}catch(o){return console.error(`
336
- Installation failed: ${o.message}`),1}}}function vu(){return T.join(tt(),".config","goose","config.yaml")}function _u(t){return t.includes("claude-mem:")&&t.includes("mcpServers:")}function br(t){return["mcpServers:"," claude-mem:",` command: ${process.execPath}`," args:",` - ${t}`].join(`
337
- `)}function $r(t){return[" claude-mem:",` command: ${process.execPath}`," args:",` - ${t}`].join(`
338
- `)}async function Ir(){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(`
339
348
  Installing Claude-Mem MCP integration for Goose...
340
- `);let t=Ge();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=vu(),o=T.dirname(e);if(kr(o,{recursive:!0}),Mr(e)){let r=pu(e,"utf-8");if(_u(r)){let s=/( {2}claude-mem:\n(?:.*\n)*?(?= {2}\S|\n\n|^\S|$))/m,i=$r(t)+`
341
- `;s.test(r)&&(r=r.replace(s,i)),et(e,r),console.log(` Updated existing claude-mem entry in: ${e}`)}else if(r.includes("mcpServers:")){let i=r.indexOf("mcpServers:")+11,n=`
342
- `+$r(t);r=r.slice(0,i)+n+r.slice(i),et(e,r),console.log(` Added claude-mem to existing mcpServers in: ${e}`)}else{let s=`
343
- `+br(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)+`
344
353
  `;r=r.trimEnd()+`
345
- `+s,et(e,r),console.log(` Appended mcpServers section to: ${e}`)}}else{let r=br(t)+`
346
- `;et(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(`
347
356
  Installation complete!
348
357
 
349
358
  MCP config: ${e}
@@ -355,18 +364,18 @@ Next steps:
355
364
  1. Start claude-mem worker: npx claude-mem start
356
365
  2. Restart Goose to pick up the MCP server
357
366
  `),0}catch(e){return console.error(`
358
- Installation failed: ${e.message}`),1}}var gu,hu,Eu,Fu,yu,xu,Su,Tr=C(()=>{"use strict";We();Me();xn();gu=`# 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
359
368
 
360
369
  *No context yet. Complete your first session and context will appear here.*
361
370
 
362
- Use claude-mem's MCP search tools for manual memory queries.`;hu={ideId:"copilot-cli",ideLabel:"Copilot CLI",configPath:T.join(tt(),".github","copilot","mcp.json"),configKey:"servers",contextFile:{path:T.join(process.cwd(),".github","copilot-instructions.md"),isWorkspaceRelative:!0}},Eu={ideId:"antigravity",ideLabel:"Antigravity",configPath:T.join(tt(),".gemini","antigravity","mcp_config.json"),configKey:"mcpServers",contextFile:{path:T.join(process.cwd(),".agent","rules","claude-mem-context.md"),isWorkspaceRelative:!0}},Fu={ideId:"crush",ideLabel:"Crush",configPath:T.join(tt(),".config","crush","mcp.json"),configKey:"mcpServers"},yu={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}},xu={ideId:"warp",ideLabel:"Warp",configPath:T.join(tt(),".warp","mcp.json"),configKey:"mcpServers",contextFile:{path:T.join(process.cwd(),"WARP.md"),isWorkspaceRelative:!0}};Su={"copilot-cli":Qe(hu),antigravity:Qe(Eu),goose:Ir,crush:Qe(Fu),"roo-code":Qe(yu),warp:Qe(xu)}});var Ut={};K(Ut,{runInstallCommand:()=>Pu});import{execSync as Pn}from"child_process";import{cpSync as Br,existsSync as nt,readFileSync as Au,rmSync as Rr}from"fs";import{join as be}from"path";async function wu(t){if(re)await ft(t);else for(let e of t){let o=await e.task(r=>console.log(` ${r}`));console.log(` ${o}`)}}function bu(){let t=N(ge(),{});t.thedotmack={source:{source:"github",repo:"thedotmack/claude-mem"},installLocation:$(),lastUpdated:new Date().toISOString(),autoUpdate:!0},Oe(ie()),Z(ge(),t)}function $u(t){let e=N(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}],Z(Ce(),e)}function Mu(){let t=N(fe(),{});t.enabledPlugins||(t.enabledPlugins={}),t.enabledPlugins["claude-mem@thedotmack"]=!0,Z(fe(),t)}async function ku(t){let e=[];for(let o of t)switch(o){case"claude-code":{try{Pn("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(()=>(We(),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(()=>(Fn(),En));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(()=>(Sn(),_n));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(()=>($n(),bn));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(()=>(On(),In));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(()=>(Rn(),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(()=>(Tr(),Or)),s=r[o];if(s){let i=await s(),c=Ne().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=Ne().find(i=>i.id===o);s&&!s.supported&&g.warn(`Support for ${s.label} coming soon.`);break}}return e}async function Iu(){let e=Ne().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 Fo({message:"Which IDEs do you use?",options:o,initialValues:e.filter(s=>s.supported).map(s=>s.id),required:!0});return ee(r)&&(Le("Installation cancelled."),process.exit(0)),r}function Ou(){let t=$(),e=ut();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=be(e,r),i=be(t,r);nt(s)&&(nt(i)&&Rr(i,{recursive:!0,force:!0}),Br(s,i,{recursive:!0,force:!0}))}}function Tu(t){let e=Vt(),o=Kt(t);Rr(o,{recursive:!0,force:!0}),Oe(o),Br(e,o,{recursive:!0,force:!0})}function Bu(){let t=$(),e=be(t,"package.json");nt(e)&&Pn("npm install --production",{cwd:t,stdio:"pipe",...X?{shell:!0}:{}})}function Ru(){let t=be($(),"plugin","scripts","smart-install.js");if(!nt(t))return g.warn("smart-install.js not found \u2014 skipping Bun/uv auto-install."),!1;try{return Pn(`node "${t}"`,{stdio:"inherit",...X?{shell:!0}:{}}),!0}catch{return g.warn("smart-install encountered an issue. You may need to install Bun/uv manually."),!1}}async function Pu(t={}){let e=Ie();re?Ct(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(nt(be(o,"plugin",".claude-plugin","plugin.json"))){try{let l=JSON.parse(Au(be(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 Re({message:"Overwrite existing installation?",initialValue:!0});(ee(l)||!l)&&(Le("Installation cancelled."),process.exit(0))}}let s;if(t.ide){s=[t.ide];let l=Ne(),x=l.find(_=>_.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(_=>_.id).join(", ")}`),process.exit(1))}else process.stdin.isTTY?s=await Iu():s=["claude-code"];s.some(l=>l!=="claude-code")&&await wu([{title:"Copying plugin files",task:async l=>(l("Copying to marketplace directory..."),Ou(),`Plugin files copied ${h.default.green("OK")}`)},{title:"Caching plugin version",task:async l=>(l(`Caching v${e}...`),Tu(e),`Plugin cached (v${e}) ${h.default.green("OK")}`)},{title:"Registering marketplace",task:async()=>(bu(),`Marketplace registered ${h.default.green("OK")}`)},{title:"Registering plugin",task:async()=>($u(e),`Plugin registered ${h.default.green("OK")}`)},{title:"Enabling plugin in Claude settings",task:async()=>(Mu(),`Plugin enabled ${h.default.green("OK")}`)},{title:"Installing dependencies",task:async l=>{l("Running npm install...");try{return Bu(),`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..."),Ru()?`Runtime dependencies ready ${h.default.green("OK")}`:`Runtime setup may need attention ${h.default.yellow("!")}`)}]);let n=await ku(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(", "))}`),re?Pe(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(`
363
372
  `),u):(console.log(`
364
- ${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")}`];re?(Pe(d.join(`
365
- `),"Next Steps"),n.length>0?ae(h.default.yellow("claude-mem installed with some IDE setup failures.")):ae(h.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(`
366
375
  Next Steps`),d.forEach(l=>console.log(` ${l}`)),n.length>0?(console.log(`
367
376
  claude-mem installed with some IDE setup failures.`),process.exitCode=1):console.log(`
368
- claude-mem installed successfully!`))}var h,re,g,Gt=C(()=>{"use strict";sn();h=se(pe(),1);ue();Me();vo();re=process.stdin.isTTY===!0;g={info:t=>re?w.info(t):console.log(` ${t}`),success:t=>re?w.success(t):console.log(` ${t}`),warn:t=>re?w.warn(t):console.warn(` ${t}`),error:t=>re?w.error(t):console.error(` ${t}`)}});var jr={};K(jr,{runUninstallCommand:()=>Hu});import{existsSync as Pr,rmSync as Lr}from"fs";import{join as Lu}from"path";function ju(){let t=$();return Pr(t)?(Lr(t,{recursive:!0,force:!0}),!0):!1}function Nu(){let t=Lu(ie(),"cache","thedotmack","claude-mem");return Pr(t)?(Lr(t,{recursive:!0,force:!0}),!0):!1}function Uu(){let t=N(ge(),{});t.thedotmack&&(delete t.thedotmack,Z(ge(),t))}function Gu(){let t=N(Ce(),{});t.plugins?.["claude-mem@thedotmack"]&&(delete t.plugins["claude-mem@thedotmack"],Z(Ce(),t))}function Wu(){let t=N(fe(),{});t.enabledPlugins?.["claude-mem@thedotmack"]!==void 0&&(delete t.enabledPlugins["claude-mem@thedotmack"],Z(fe(),t))}async function Hu(){if(Ct(L.default.bgRed(L.default.white(" claude-mem uninstall "))),at()){if(process.stdin.isTTY){let o=await Re({message:"Are you sure you want to uninstall claude-mem?",initialValue:!1});if(ee(o)||!o){Le("Uninstall cancelled.");return}}}else if(w.warn("claude-mem does not appear to be installed."),process.stdin.isTTY){let o=await Re({message:"Clean up any remaining registration data anyway?",initialValue:!1});if(ee(o)||!o){ae("Nothing to do.");return}}else{ae("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}}w.info("Worker service stopped.")}catch{}await ft([{title:"Removing marketplace directory",task:async()=>ju()?`Marketplace directory removed ${L.default.green("OK")}`:`Marketplace directory not found ${L.default.dim("skipped")}`},{title:"Removing cache directory",task:async()=>Nu()?`Cache directory removed ${L.default.green("OK")}`:`Cache directory not found ${L.default.dim("skipped")}`},{title:"Removing marketplace registration",task:async()=>(Uu(),`Marketplace registration removed ${L.default.green("OK")}`)},{title:"Removing plugin registration",task:async()=>(Gu(),`Plugin registration removed ${L.default.green("OK")}`)},{title:"Removing from Claude settings",task:async()=>(Wu(),`Claude settings updated ${L.default.green("OK")}`)}]);let e=[{label:"Gemini CLI hooks",fn:async()=>{let{uninstallGeminiCliHooks:o}=await Promise.resolve().then(()=>(Fn(),En));return o()}},{label:"Windsurf hooks",fn:async()=>{let{uninstallWindsurfHooks:o}=await Promise.resolve().then(()=>($n(),bn));return o()}},{label:"OpenCode plugin",fn:async()=>{let{uninstallOpenCodePlugin:o}=await Promise.resolve().then(()=>(Sn(),_n));return o()}},{label:"OpenClaw plugin",fn:async()=>{let{uninstallOpenClawPlugin:o}=await Promise.resolve().then(()=>(On(),In));return o()}},{label:"Codex CLI",fn:async()=>{let{uninstallCodexCli:o}=await Promise.resolve().then(()=>(Rn(),Bn));return o()}}];for(let{label:o,fn:r}of e)try{await r()===0&&w.info(`${o}: removed.`)}catch{}Pe([`Your data directory at ${L.default.cyan("~/.claude-mem")} was preserved.`,"To remove it manually: rm -rf ~/.claude-mem"].join(`
369
- `),"Note"),ae(L.default.green("claude-mem has been uninstalled."))}var L,Nr=C(()=>{"use strict";sn();L=se(pe(),1);ue();Me()});import{spawnSync as Ju}from"child_process";import{existsSync as Ku}from"fs";import{homedir as Ln}from"os";import{join as jn}from"path";function Vu(){return X?[jn(Ln(),".bun","bin","bun.exe"),jn(process.env.USERPROFILE||Ln(),".bun","bin","bun.exe")]:[jn(Ln(),".bun","bin","bun"),"/usr/local/bin/bun","/opt/homebrew/bin/bun","/home/linuxbrew/.linuxbrew/bin/bun"]}function Ur(){let e=Ju(X?"where":"which",["bun"],{encoding:"utf-8",stdio:["pipe","pipe","pipe"],shell:X});if(e.status===0&&e.stdout.trim())return"bun";for(let o of Vu())if(Ku(o))return o;return null}var Gr=C(()=>{"use strict";ue()});var De={};K(De,{runRestartCommand:()=>zu,runSearchCommand:()=>Qu,runStartCommand:()=>Xu,runStatusCommand:()=>Zu,runStopCommand:()=>qu,runTranscriptWatchCommand:()=>ea});import{spawn as Wr}from"child_process";import{existsSync as Hr}from"fs";import{join as Jr}from"path";function Nn(){at()||(console.error(M.default.red("claude-mem is not installed.")),console.error(`Run: ${M.default.bold("npx claude-mem install")}`),process.exit(1))}function Kr(){let t=Ur();return t||(console.error(M.default.red("Bun not found.")),console.error("Install Bun: https://bun.sh"),console.error("After installation, restart your terminal."),process.exit(1)),t}function Yu(){return Jr($(),"plugin","scripts","worker-service.cjs")}function ot(t,e=[]){Nn();let o=Kr(),r=Yu();Hr(r)||(console.error(M.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=Wr(o,s,{stdio:"inherit",cwd:$(),env:process.env});i.on("error",n=>{console.error(M.default.red(`Failed to start Bun: ${n.message}`)),process.exit(1)}),i.on("close",n=>{process.exit(n??0)})}function Xu(){ot("start")}function qu(){ot("stop")}function zu(){ot("restart")}function Zu(){ot("status")}async function Qu(t){Nn();let e=t.join(" ").trim();e||(console.error(M.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?query=${encodeURIComponent(e)}`;try{let s=await fetch(r);s.ok||(s.status===404&&(console.error(M.default.red("Search endpoint not found. Is the worker running?")),console.error(`Try: ${M.default.bold("npx claude-mem start")}`),process.exit(1)),console.error(M.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(M.default.red("Worker is not running.")),console.error(`Start it with: ${M.default.bold("npx claude-mem start")}`),process.exit(1)),console.error(M.default.red(`Search failed: ${s.message}`)),process.exit(1)}}function ea(){Nn();let t=Kr(),e=Jr($(),"plugin","scripts","transcript-watcher.cjs");if(!Hr(e)){ot("transcript",["watch"]);return}let o=Wr(t,[e,"watch"],{stdio:"inherit",cwd:$(),env:process.env});o.on("error",r=>{console.error(M.default.red(`Failed to start transcript watcher: ${r.message}`)),process.exit(1)}),o.on("close",r=>{process.exit(r??0)})}var M,de=C(()=>{"use strict";M=se(pe(),1);Gr();ue()});var y=se(pe(),1);ue();var rt=process.argv.slice(2),Vr=rt[0]?.toLowerCase()??"";function ta(){let t=Ie();console.log(`
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(`
370
379
  ${y.default.bold("claude-mem")} v${t} \u2014 persistent memory for AI coding assistants
371
380
 
372
381
  ${y.default.bold("Install Commands")} (no Bun required):
@@ -389,4 +398,4 @@ ${y.default.bold("IDE Identifiers")}:
389
398
  claude-code, cursor, gemini-cli, opencode, openclaw,
390
399
  windsurf, codex-cli, copilot-cli, antigravity, goose,
391
400
  crush, roo-code, warp
392
- `)}async function na(){switch(Vr){case"":{let{runInstallCommand:t}=await Promise.resolve().then(()=>(Gt(),Ut));await t();break}case"install":{let t=rt.indexOf("--ide"),e=t!==-1?rt[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(()=>(Nr(),jr));await t();break}case"version":case"--version":case"-v":{console.log(Ie());break}case"help":case"--help":case"-h":{ta();break}case"start":{let{runStartCommand:t}=await Promise.resolve().then(()=>(de(),De));t();break}case"stop":{let{runStopCommand:t}=await Promise.resolve().then(()=>(de(),De));t();break}case"restart":{let{runRestartCommand:t}=await Promise.resolve().then(()=>(de(),De));t();break}case"status":{let{runStatusCommand:t}=await Promise.resolve().then(()=>(de(),De));t();break}case"search":{let{runSearchCommand:t}=await Promise.resolve().then(()=>(de(),De));await t(rt.slice(1));break}case"transcript":{let t=rt[1]?.toLowerCase();if(t==="watch"){let{runTranscriptWatchCommand:e}=await Promise.resolve().then(()=>(de(),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: ${Vr}`)),console.error(`Run ${y.default.bold("npx claude-mem --help")} for usage information.`),process.exit(1)}}na().catch(t=>{console.error(y.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)});