@cachly-dev/mcp-server 0.10.256 → 0.10.258

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,18 +1,18 @@
1
- const d="<!-- cachly-brain-start -->",p="<!-- cachly-brain-end -->";function f(e=""){return new RegExp(`${d}[\\s\\S]*?${p}`,e)}const m=`---
1
+ import{homedir as h}from"node:os";import{join as i,resolve as w}from"node:path";const l="<!-- cachly-brain-start -->",f="<!-- cachly-brain-end -->";function _(e=""){return new RegExp(`${l}[\\s\\S]*?${f}`,e)}const g=`---
2
2
  description: Cachly AI Brain \u2014 persistent memory protocol (recall before tasks, learn after fixes)
3
3
  alwaysApply: true
4
4
  ---
5
5
 
6
- `,y=`---
6
+ `,E=`---
7
7
  name: cachly AI Brain
8
8
  description: Persistent memory protocol (recall before tasks, learn after fixes)
9
9
  alwaysApply: true
10
10
  ---
11
11
 
12
- `,h={claude:".mcp.json",cursor:".cursor/mcp.json",windsurf:".windsurf/mcp.json",copilot:".vscode/mcp.json",continue:".continue/config.json",cline:".vscode/mcp.json",zed:".zed/settings.json"};function w(e,r,c,n,t,s){if(e.nurMitIdea&&!n(t(r,".idea")))return!1;if(e.nurMit){const i=(e.nurMit.projekt??[]).some(o=>n(t(r,o))),a=(e.nurMit.heim??[]).some(o=>n(t(c,o)));if(!i&&!a)return!1}if(s&&e.editoren&&!e.editoren.includes(s)){const i=n(t(r,...e.pfad)),a=(e.ordner??[]).some(o=>n(t(r,o)));if(!i&&!a)return!1}return!0}async function _(e,r,c){const{writeFile:n,appendFile:t,readFile:s,mkdir:i}=await import("node:fs/promises"),{existsSync:a}=await import("node:fs"),{dirname:o}=await import("node:path");if(await i(o(e),{recursive:!0}),a(e)){const u=await s(e,"utf-8");if(u.includes(d)){const l=u.replace(f(),()=>r);return l===u?"unchanged":(await n(e,l,"utf-8"),"updated")}return await t(e,`
12
+ `,x={claude:".mcp.json",cursor:".cursor/mcp.json",windsurf:".windsurf/mcp.json",copilot:".vscode/mcp.json",continue:".continue/config.json",cline:".vscode/mcp.json",zed:".zed/settings.json"},D=["windsurf","cline"];function m(e){return e.plattform==="win32"?i(e.appData??i(e.heim,"AppData","Roaming"),"Code","User"):e.plattform==="darwin"?i(e.heim,"Library","Application Support","Code","User"):i(e.heim,".config","Code","User")}const y=["globalStorage","saoudrizwan.claude-dev"];function A(e,r){return e==="windsurf"?i(r.heim,".codeium","windsurf","mcp_config.json"):e==="cline"?i(m(r),...y,"settings","cline_mcp_settings.json"):null}function j(e,r,t){return e==="windsurf"?t(i(r.heim,".codeium","windsurf")):e==="cline"?t(i(m(r),...y)):!1}function R(){return{heim:h(),plattform:process.platform,appData:process.env.APPDATA}}const T="mcpServers";function k(e,r,t=R()){const n=A(e,t);if(n){const s=n.startsWith(t.heim)?"~"+n.slice(t.heim.length):n;return{pfad:n,anzeige:s,format:T}}const o=x[e]??".mcp.json";return{pfad:w(r,o),anzeige:o,format:e}}function N(e,r,t,n,o,s){if(e.nurMitIdea&&!n(o(r,".idea")))return!1;if(e.nurMit){const c=(e.nurMit.projekt??[]).some(a=>n(o(r,a))),u=(e.nurMit.heim??[]).some(a=>n(o(t,a)));if(!c&&!u)return!1}if(s&&e.editoren&&!e.editoren.includes(s)){const c=n(o(r,...e.pfad)),u=(e.ordner??[]).some(a=>n(o(r,a)));if(!c&&!u)return!1}return!0}async function v(e,r,t){const{writeFile:n,appendFile:o,readFile:s,mkdir:c}=await import("node:fs/promises"),{existsSync:u}=await import("node:fs"),{dirname:a}=await import("node:path");if(await c(a(e),{recursive:!0}),u(e)){const p=await s(e,"utf-8");if(p.includes(l)){const d=p.replace(_(),()=>r);return d===p?"unchanged":(await n(e,d,"utf-8"),"updated")}return await o(e,`
13
13
  `+r+`
14
- `,"utf-8"),"appended"}return await n(e,(c??"")+r+`
15
- `,"utf-8"),"written"}const E=[{pfad:["CLAUDE.md"],editoren:["claude"],ordner:[".claude"]},{pfad:["AGENTS.md"],editoren:["codex","zed"],ordner:[".codex"]},{pfad:[".github","copilot-instructions.md"],editoren:["copilot"]},{pfad:[".cursor","rules","cachly.mdc"],prefix:m,editoren:["cursor"],ordner:[".cursor"]},{pfad:[".windsurfrules"],editoren:["windsurf"],ordner:[".windsurf"]},{pfad:[".clinerules"],editoren:["cline"]},{pfad:[".aiassistant","rules","cachly.md"],nurMitIdea:!0},{pfad:["GEMINI.md"],nurMit:{projekt:[".gemini"],heim:[".gemini"]}},{pfad:[".junie","guidelines.md"],nurMit:{projekt:[".junie"]}},{pfad:[".continue","rules","cachly.md"],prefix:y,nurMit:{projekt:[".continue"],heim:[".continue"]}},{pfad:[".rules"],nurMit:{projekt:[".rules"]}},{pfad:[".cursorrules"],nurMit:{projekt:[".cursorrules"]}}];function g(e){return`${d}
14
+ `,"utf-8"),"appended"}return await n(e,(t??"")+r+`
15
+ `,"utf-8"),"written"}const C=[{pfad:["CLAUDE.md"],editoren:["claude"],ordner:[".claude"]},{pfad:["AGENTS.md"],editoren:["codex","zed"],ordner:[".codex"]},{pfad:[".github","copilot-instructions.md"],editoren:["copilot"]},{pfad:[".cursor","rules","cachly.mdc"],prefix:g,editoren:["cursor"],ordner:[".cursor"]},{pfad:[".windsurfrules"],editoren:["windsurf"],ordner:[".windsurf"]},{pfad:[".clinerules"],editoren:["cline"]},{pfad:[".aiassistant","rules","cachly.md"],nurMitIdea:!0},{pfad:["GEMINI.md"],nurMit:{projekt:[".gemini"],heim:[".gemini"]}},{pfad:[".junie","guidelines.md"],nurMit:{projekt:[".junie"]}},{pfad:[".continue","rules","cachly.md"],prefix:E,nurMit:{projekt:[".continue"],heim:[".continue"]}},{pfad:[".rules"],nurMit:{projekt:[".rules"]}},{pfad:[".cursorrules"],nurMit:{projekt:[".cursorrules"]}}];function S(e){return`${l}
16
16
  ## Cachly AI Brain \u2014 Always Active
17
17
 
18
18
  The Brain MCP server runs automatically. Instance: \`${e}\`
@@ -67,4 +67,4 @@ Report predicted failure risks to the user before proceeding.
67
67
 
68
68
  ### Half-finished code rule:
69
69
  Never commit code that does not compile. Run \`tsc --noEmit\` / \`go build ./...\` before every commit.
70
- ${p}`}export{E as ANWEISUNGS_DATEIEN,p as CLAUDE_MD_MARKER_END,d as CLAUDE_MD_MARKER_START,y as CONTINUE_RULE_FRONTMATTER,m as CURSOR_MDC_FRONTMATTER,h as EDITOR_FILES,f as blockMuster,g as buildClaudeMdBlock,_ as setzeAnweisungsblock,w as sollSchreiben};
70
+ ${f}`}export{C as ANWEISUNGS_DATEIEN,f as CLAUDE_MD_MARKER_END,l as CLAUDE_MD_MARKER_START,E as CONTINUE_RULE_FRONTMATTER,g as CURSOR_MDC_FRONTMATTER,x as EDITOR_FILES,D as GLOBALE_MCP_EDITOREN,T as MCPSERVERS_FORMAT,_ as blockMuster,S as buildClaudeMdBlock,R as diesesHeim,A as globaleMcpDatei,j as globalerEditorDa,k as mcpZiel,v as setzeAnweisungsblock,N as sollSchreiben,m as vsCodeNutzerOrdner};
@@ -0,0 +1 @@
1
+ const o=["task-notification","local-command-stdout","local-command-stderr","local-command-caveat","system-reminder"],n=new RegExp(`<(${o.join("|")})>[\\s\\S]*?</\\1>`,"g");function a(t){return String(t??"").replace(n," ").trim()}export{a as frageAusPrompt};
@@ -1,16 +1,16 @@
1
- import{existsSync as A,lstatSync as x,readFileSync as Z,readdirSync as v,rmSync as R,rmdirSync as ee,writeFileSync as te}from"node:fs";import{basename as b,dirname as C,isAbsolute as T,join as g,relative as I,resolve as k,sep as S}from"node:path";import{ANWEISUNGS_DATEIEN as ne,CLAUDE_MD_MARKER_END as H,CLAUDE_MD_MARKER_START as D,EDITOR_FILES as re,blockMuster as oe}from"./projektdateien.js";import{PROJEKT_HOOK_MARKE as $,istCachlyEintrag as N}from"./hook-zugang.js";import{CLS_BLOCK_RE as se,gitHookOrdner as ie}from"./cls-hook.js";import{BRAIN_WATCH_BLOCK_RE as ae}from"./brain-watch-hook.js";import{CLAUDE_HOOK_DIR as ce,CLAUDE_SETTINGS_DATEI as le,CODEX_HOOKS_DATEI as he,CODEX_HOOK_DIR as ue,COPILOT_HOOKS_DATEI as fe,COPILOT_HOOK_DIR as de,CURSOR_HOOKS_DATEI as pe,CURSOR_HOOK_DIR as me,GEMINI_HOOK_DIR as ge,GEMINI_SETTINGS_DATEI as z}from"./ambient-hooks.js";import{CURSOR_ABLAGE_ORDNER as ye}from"./cursor-hook.js";import{CODEX_CONFIG_DATEI as ke,ohneCodexMcpEintrag as be}from"./editor-mcp-eintrag.js";import{COPILOT_ABLAGE_ORDNER as ve}from"./copilot-hook.js";import{credentialsPath as P}from"./credentials.js";import{defaultLedgerPath as M,readLedger as je}from"./ambient-ledger.js";import{defaultMilestonePath as we}from"./funnel-milestones.js";import{defaultKostprobePath as _e}from"./kostprobe.js";import{standPfad as Ee}from"./neue-fassung.js";import{AUFTRAG as Oe,FEHLSCHLAG as Se,SPERRE as $e}from"./konto-anlegen.js";import{netBalance as Ae}from"./ambient-recall.js";import{istTestSchluessel as xe}from"./uebernahme.js";const Re='broken Stop hook from setup_ai_memory ("checkpoint" is not a command)',B="Your lessons stay in your cachly account. uninstall never deletes cloud data. To erase your account and everything in it (GDPR Art. 17), write to privacy@cachly.dev (https://cachly.dev/legal/datenschutz).",Ce=[P({home:""}),M(),we(),_e(),Ee(""),$e,Se,Oe].map(t=>b(t));function Te(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Ie=new RegExp(`^(?:${Ce.map(Te).join("|")})(?:\\.[\\w.-]*(?:tmp|genommen))?$`),He=/^cachly-(?:ambient|leser-sicherung|lernen-arme|projektversionen|startwissen-import)-[\w.-]+\.(?:json|jsonl|lock|tmp)$/,De=["cachly-lernen",b(ye),b(ve)];function Ne(t,e){return e?De.includes(t):He.test(t)}function p(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function L(t){try{const e=JSON.parse(t);return p(e)?e:null}catch{return null}}function K(t,e){const n=/^([ \t]+)"/m.exec(e)?.[1]??2,r=e.includes(`\r
1
+ import{existsSync as $,lstatSync as x,readFileSync as ee,readdirSync as v,rmSync as R,rmdirSync as te,writeFileSync as ne}from"node:fs";import{basename as b,dirname as C,isAbsolute as T,join as y,relative as I,resolve as k,sep as S}from"node:path";import{ANWEISUNGS_DATEIEN as re,CLAUDE_MD_MARKER_END as H,CLAUDE_MD_MARKER_START as D,EDITOR_FILES as oe,blockMuster as se,globaleMcpDatei as N}from"./projektdateien.js";import{PROJEKT_HOOK_MARKE as A,istCachlyEintrag as z}from"./hook-zugang.js";import{CLS_BLOCK_RE as ie,gitHookOrdner as ae}from"./cls-hook.js";import{BRAIN_WATCH_BLOCK_RE as ce}from"./brain-watch-hook.js";import{CLAUDE_HOOK_DIR as le,CLAUDE_SETTINGS_DATEI as he,CODEX_HOOKS_DATEI as ue,CODEX_HOOK_DIR as fe,COPILOT_HOOKS_DATEI as de,COPILOT_HOOK_DIR as pe,CURSOR_HOOKS_DATEI as me,CURSOR_HOOK_DIR as ge,GEMINI_HOOK_DIR as ye,GEMINI_SETTINGS_DATEI as P}from"./ambient-hooks.js";import{CURSOR_ABLAGE_ORDNER as ke}from"./cursor-hook.js";import{CODEX_CONFIG_DATEI as be,ohneCodexMcpEintrag as ve}from"./editor-mcp-eintrag.js";import{COPILOT_ABLAGE_ORDNER as je}from"./copilot-hook.js";import{credentialsPath as M}from"./credentials.js";import{defaultLedgerPath as B,readLedger as we}from"./ambient-ledger.js";import{defaultMilestonePath as _e}from"./funnel-milestones.js";import{defaultKostprobePath as Ee}from"./kostprobe.js";import{standPfad as Oe}from"./neue-fassung.js";import{AUFTRAG as Se,FEHLSCHLAG as Ae,SPERRE as $e}from"./konto-anlegen.js";import{netBalance as xe}from"./ambient-recall.js";import{istTestSchluessel as Re}from"./uebernahme.js";const Ce='broken Stop hook from setup_ai_memory ("checkpoint" is not a command)',L="Your lessons stay in your cachly account. uninstall never deletes cloud data. To erase your account and everything in it (GDPR Art. 17), write to privacy@cachly.dev (https://cachly.dev/legal/datenschutz).",Te=[M({home:""}),B(),_e(),Ee(),Oe(""),$e,Ae,Se].map(t=>b(t));function Ie(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const He=new RegExp(`^(?:${Te.map(Ie).join("|")})(?:\\.[\\w.-]*(?:tmp|genommen))?$`),De=/^cachly-(?:ambient|leser-sicherung|lernen-arme|projektversionen|startwissen-import)-[\w.-]+\.(?:json|jsonl|lock|tmp)$/,Ne=["cachly-lernen",b(ke),b(je)];function ze(t,e){return e?Ne.includes(t):De.test(t)}function p(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function K(t){try{const e=JSON.parse(t);return p(e)?e:null}catch{return null}}function F(t,e){const n=/^([ \t]+)"/m.exec(e)?.[1]??2,r=e.includes(`\r
2
2
  `);let o=JSON.stringify(t,null,n);return r&&(o=o.replace(/\n/g,`\r
3
3
  `)),/\n$/.test(e)?o+(r?`\r
4
4
  `:`
5
- `):o}function y(t){try{return x(t).isFile()?Z(t,"utf8"):null}catch{return null}}function F(t){try{return x(t).isDirectory()}catch{return!1}}function ze(t){if(!p(t))return"";const n=(p(t.env)?t.env:p(t.command)&&p(t.command.env)?t.command.env:null)?.CACHLY_BRAIN_INSTANCE_ID;return typeof n=="string"?n:""}function j(t,e,n){const r=t[e];return!p(r)||!("cachly"in r)?!1:(n.push(r.cachly),delete r.cachly,Object.keys(r).length===0&&delete t[e],!0)}function G(t){return p(t)?p(t.env)&&("CACHLY_JWT"in t.env||"CACHLY_BRAIN_INSTANCE_ID"in t.env)?!0:JSON.stringify(t).includes("@cachly-dev/mcp-server"):!1}function w(t,e){const n=L(t);if(!n)return{art:"unlesbar"};const r=[],o=[];if(e==="mcpServers"&&j(n,"mcpServers",r)&&o.push("mcpServers.cachly"),e==="vscode"&&(j(n,"servers",r)&&o.push("servers.cachly"),j(n,"mcpServers",r)&&o.push("mcpServers.cachly")),e==="zed"&&j(n,"context_servers",r)&&o.push("context_servers.cachly"),e==="continue"){const a=n.experimental,c=p(a)?a.modelContextProtocolServers:void 0;if(p(a)&&Array.isArray(c)){const s=c.filter(l=>!G(l));s.length<c.length&&(r.push(...c.filter(G)),o.push(`experimental.modelContextProtocolServers (${c.length-s.length})`),s.length===0?delete a.modelContextProtocolServers:a.modelContextProtocolServers=s,Object.keys(a).length===0&&delete n.experimental)}}if(o.length===0)return{art:"nichts"};const i=r.map(ze).find(Boolean)??"";return{art:"geaendert",nachher:Object.keys(n).length===0?null:K(n,t),entfernt:o,instanz:i}}function Pe(t){if(N(t))return"ambient";const e=String(t?.command??"");return e.includes("@cachly-dev/mcp-server")&&e.includes(" checkpoint")?"checkpoint":null}function _(t){return N(t)?"ambient":null}function U(t,e,n=[]){const r=L(t);if(!r)return{art:"unlesbar"};const o=r.hooks;if(!p(o))return{art:"nichts"};const i=[];for(const[c,s]of Object.entries(o)){if(!Array.isArray(s))continue;const l=i.length,h=[];for(const u of s){const d=p(u)&&Array.isArray(u.hooks)?u.hooks:null;if(!d){const f=e(u);f?i.push(f):h.push(u);continue}const m=d.filter(f=>{const O=e(f);return O&&i.push(O),!O});m.length===d.length?h.push(u):m.length>0&&h.push({...u,hooks:m})}i.length!==l&&(h.length===0?delete o[c]:o[c]=h)}return i.length===0?{art:"nichts"}:(Object.keys(o).length===0&&delete r.hooks,{art:"geaendert",nachher:Object.keys(r).filter(c=>!n.includes(c)).length===0?null:K(r,t),entfernt:i,instanz:""})}function Me(t,e,n){let r=e;t[e-1]===`
5
+ `):o}function g(t){try{return x(t).isFile()?ee(t,"utf8"):null}catch{return null}}function G(t){try{return x(t).isDirectory()}catch{return!1}}function Pe(t){if(!p(t))return"";const n=(p(t.env)?t.env:p(t.command)&&p(t.command.env)?t.command.env:null)?.CACHLY_BRAIN_INSTANCE_ID;return typeof n=="string"?n:""}function j(t,e,n){const r=t[e];return!p(r)||!("cachly"in r)?!1:(n.push(r.cachly),delete r.cachly,Object.keys(r).length===0&&delete t[e],!0)}function U(t){return p(t)?p(t.env)&&("CACHLY_JWT"in t.env||"CACHLY_BRAIN_INSTANCE_ID"in t.env)?!0:JSON.stringify(t).includes("@cachly-dev/mcp-server"):!1}function w(t,e){const n=K(t);if(!n)return{art:"unlesbar"};const r=[],o=[];if(e==="mcpServers"&&j(n,"mcpServers",r)&&o.push("mcpServers.cachly"),e==="vscode"&&(j(n,"servers",r)&&o.push("servers.cachly"),j(n,"mcpServers",r)&&o.push("mcpServers.cachly")),e==="zed"&&j(n,"context_servers",r)&&o.push("context_servers.cachly"),e==="continue"){const i=n.experimental,a=p(i)?i.modelContextProtocolServers:void 0;if(p(i)&&Array.isArray(a)){const c=a.filter(f=>!U(f));c.length<a.length&&(r.push(...a.filter(U)),o.push(`experimental.modelContextProtocolServers (${a.length-c.length})`),c.length===0?delete i.modelContextProtocolServers:i.modelContextProtocolServers=c,Object.keys(i).length===0&&delete n.experimental)}}if(o.length===0)return{art:"nichts"};const s=r.map(Pe).find(Boolean)??"";return{art:"geaendert",nachher:Object.keys(n).length===0?null:F(n,t),entfernt:o,instanz:s}}function Me(t){if(z(t))return"ambient";const e=String(t?.command??"");return e.includes("@cachly-dev/mcp-server")&&e.includes(" checkpoint")?"checkpoint":null}function _(t){return z(t)?"ambient":null}function W(t,e,n=[]){const r=K(t);if(!r)return{art:"unlesbar"};const o=r.hooks;if(!p(o))return{art:"nichts"};const s=[];for(const[a,c]of Object.entries(o)){if(!Array.isArray(c))continue;const f=s.length,l=[];for(const h of c){const u=p(h)&&Array.isArray(h.hooks)?h.hooks:null;if(!u){const d=e(h);d?s.push(d):l.push(h);continue}const m=u.filter(d=>{const O=e(d);return O&&s.push(O),!O});m.length===u.length?l.push(h):m.length>0&&l.push({...h,hooks:m})}s.length!==f&&(l.length===0?delete o[a]:o[a]=l)}return s.length===0?{art:"nichts"}:(Object.keys(o).length===0&&delete r.hooks,{art:"geaendert",nachher:Object.keys(r).filter(a=>!n.includes(a)).length===0?null:F(r,t),entfernt:s,instanz:""})}function Be(t,e,n){let r=e;t[e-1]===`
6
6
  `&&(r=t[e-2]==="\r"?e-2:e-1);let o=n;return t[n]===`
7
7
  `?o=n+1:t[n]==="\r"&&t[n+1]===`
8
8
  `&&(o=n+2),r<e&&o>n&&r>0&&o<t.length&&t[r-1]!==`
9
9
  `&&t[o]!==`
10
- `&&t[o]!=="\r"&&(o=n),t.slice(0,r)+t.slice(o)}function Be(t){if(!t.includes(D)&&!t.includes(H))return{art:"kein-block"};let e=t,n=0;for(;;){const r=oe().exec(e);if(!r)break;e=Me(e,r.index,r.index+r[0].length),n++}return n===0||e.includes(D)||e.includes(H)?{art:"kaputt"}:{art:"entfernt",rest:e}}function Le(t){const e=t.trim().split(/\r?\n/);if(e[0]?.trim()!=="---")return!1;const n=e.findIndex((r,o)=>o>0&&r.trim()==="---");return n>0&&e.slice(n+1).every(r=>r.trim()==="")}function Ke(t,e){return t.trim()===""||e&&Le(t)}function Fe(t){let e=t;const n=[],r=[["CLS hook",se],["brain_watch hook",ae]];for(const[i,a]of r)for(;;){const c=a.exec(e);if(!c)break;const s=e.slice(0,c.index).replace(/\s+$/,""),l=e.slice(c.index+c[0].length).replace(/^\s*\n/,"");e=s+(s&&l.trim()?`
10
+ `&&t[o]!=="\r"&&(o=n),t.slice(0,r)+t.slice(o)}function Le(t){if(!t.includes(D)&&!t.includes(H))return{art:"kein-block"};let e=t,n=0;for(;;){const r=se().exec(e);if(!r)break;e=Be(e,r.index,r.index+r[0].length),n++}return n===0||e.includes(D)||e.includes(H)?{art:"kaputt"}:{art:"entfernt",rest:e}}function Ke(t){const e=t.trim().split(/\r?\n/);if(e[0]?.trim()!=="---")return!1;const n=e.findIndex((r,o)=>o>0&&r.trim()==="---");return n>0&&e.slice(n+1).every(r=>r.trim()==="")}function Fe(t,e){return t.trim()===""||e&&Ke(t)}function Ge(t){let e=t;const n=[],r=[["CLS hook",ie],["brain_watch hook",ce]];for(const[s,i]of r)for(;;){const a=i.exec(e);if(!a)break;const c=e.slice(0,a.index).replace(/\s+$/,""),f=e.slice(a.index+a[0].length).replace(/^\s*\n/,"");e=c+(c&&f.trim()?`
11
11
 
12
- `:"")+l,n.push(i)}if(n.length===0)return{rest:t,entfernt:n};const o=e.trim();return o===""||o.startsWith("#!")&&!o.includes(`
12
+ `:"")+f,n.push(s)}if(n.length===0)return{rest:t,entfernt:n};const o=e.trim();return o===""||o.startsWith("#!")&&!o.includes(`
13
13
  `)?{rest:"",entfernt:n}:{rest:e.replace(/\s+$/,"")+`
14
- `,entfernt:n}}function Ge(t,e){const n=I(e,t);return n!==""&&!n.startsWith("..")&&!T(n)}function W(t,e,n,r){const o=new Set(t.filter(c=>c.stufe===e&&(c.aktion==="datei-loeschen"||c.aktion==="ordner-loeschen")).map(c=>c.pfad)),i=new Set;for(const c of o)for(let s=C(c);s!==r&&Ge(s,n)&&!s.split(S).includes(".git");s=C(s))i.add(s);const a=[];for(const c of[...i].sort((s,l)=>l.length-s.length)){let s;try{s=v(c)}catch{continue}s.every(l=>o.has(g(c,l)))&&(o.add(c),a.push({stufe:e,aktion:"ordner-entfernen",pfad:c,was:"empty folder"}))}return a}function Ue(t,e){const n=new Map;for(const[r,o]of Object.entries(re))n.set(o,r==="continue"?"continue":r==="zed"?"zed":o===".vscode/mcp.json"?"vscode":"mcpServers");for(const[r,o]of n){const i=k(t.projekt,r),a=y(i);if(A(`${i}.bak`)&&e.funde.push({stufe:"projekt",aktion:"melden",pfad:`${i}.bak`,was:"your old file is there; uninstall does not restore it"}),a===null)continue;const c=w(a,o);if(c.art==="unlesbar"){a.includes("cachly")&&e.vonHand.push({stufe:"projekt",text:`${r}: cannot be read as plain JSON (comments or another format). Remove the "cachly" entry by hand.`});continue}c.art!=="nichts"&&(e.instanz||=c.instanz,c.nachher===null?e.funde.push({stufe:"projekt",aktion:"datei-loeschen",pfad:i,was:'MCP server entry "cachly", the only thing in the file',vorher:a}):e.funde.push({stufe:"projekt",aktion:"eintrag-entfernen",pfad:i,was:'MCP server entry "cachly"; other servers and settings stay',vorher:a,nachher:c.nachher}))}}function We(t,e){for(const n of ne){const r=k(t.projekt,...n.pfad),o=y(r);if(o===null)continue;const i=n.pfad.join("/"),a=Be(o);if(a.art==="kein-block"){o.startsWith("# cachly AI Brain")&&e.vonHand.push({stufe:"projekt",text:`${i}: looks like the whole file was written by the setup_ai_memory tool (no markers). Check it and remove it by hand if it is not yours.`});continue}if(a.art==="kaputt"){e.vonHand.push({stufe:"projekt",text:`${i}: a cachly marker has no partner. Remove the block by hand.`});continue}Ke(a.rest,i.endsWith(".mdc")||n.prefix!==void 0)?e.funde.push({stufe:"projekt",aktion:"datei-loeschen",pfad:r,was:"only the cachly block was in it",vorher:o}):e.funde.push({stufe:"projekt",aktion:"block-entfernen",pfad:r,was:"cachly block between the markers; your text stays as it is",vorher:o,nachher:a.rest})}}function E(t,e,n,r,o){const i=k(t.projekt,n),a=y(i);if(a===null)return;const c=U(a,r,o);if(c.art==="unlesbar"){(a.includes($)||a.includes("@cachly-dev/mcp-server"))&&e.vonHand.push({stufe:"projekt",text:`${n}: cannot be read as plain JSON (comments or another format). Remove the cachly hooks by hand.`});return}if(c.art==="nichts")return;const s=c.entfernt.filter(u=>u==="ambient").length,l=c.entfernt.filter(u=>u==="checkpoint").length,h=[...s?[`${s} Ambient Recall hook${s===1?"":"s"}`]:[],...l?[`${l} ${Re}`]:[]];c.nachher===null?e.funde.push({stufe:"projekt",aktion:"datei-loeschen",pfad:i,was:`${h.join(" and ")}, the only thing in the file`,vorher:a}):e.funde.push({stufe:"projekt",aktion:"eintrag-entfernen",pfad:i,was:`${h.join(" and ")}; other hooks and settings stay`,vorher:a,nachher:c.nachher})}function Je(t,e,n){const r=k(t.projekt,n);let o;try{o=v(r)}catch{return}for(const i of o.sort()){const a=g(r,i);!i.startsWith($)||y(a)===null||e.funde.push({stufe:"projekt",aktion:"datei-loeschen",pfad:a,was:"Ambient Recall hook script"})}}function Ye(t,e){E(t,e,le,Pe,[]),E(t,e,pe,_,["version"]),E(t,e,fe,_,["version"]),E(t,e,he,_,[]),Ve(t,e);for(const n of[ce,me,de,ue,ge])Je(t,e,n);Xe(t,e)}function Ve(t,e){const n=k(t.projekt,z),r=y(n);if(r===null)return;const o=U(r,_,[]);if(o.art==="unlesbar"){(r.includes($)||r.includes("@cachly-dev/mcp-server"))&&e.vonHand.push({stufe:"projekt",text:`${z}: cannot be read as plain JSON (comments or another format). Remove the cachly hooks and the MCP server "cachly" by hand.`});return}const i=o.art==="geaendert"?o.nachher:r,a=i===null?{art:"nichts"}:w(i,"mcpServers"),c=a.art==="geaendert"?a.nachher:i;if(o.art!=="geaendert"&&a.art!=="geaendert")return;a.art==="geaendert"&&(e.instanz||=a.instanz);const s=o.art==="geaendert"?o.entfernt.length:0,l=[...s?[`${s} Ambient Recall hook${s===1?"":"s"}`]:[],...a.art==="geaendert"?['MCP server entry "cachly"']:[]];c===null?e.funde.push({stufe:"projekt",aktion:"datei-loeschen",pfad:n,was:`${l.join(" and ")}, the only thing in the file`,vorher:r}):e.funde.push({stufe:"projekt",aktion:"eintrag-entfernen",pfad:n,was:`${l.join(" and ")}; other servers, hooks and settings stay`,vorher:r,nachher:c})}function Xe(t,e){const n=k(t.projekt,ke),r=y(n);if(r===null)return;const o=be(r);o.entfernt&&(o.rest===""?e.funde.push({stufe:"projekt",aktion:"datei-loeschen",pfad:n,was:"MCP server table [mcp_servers.cachly], the only thing in the file",vorher:r}):e.funde.push({stufe:"projekt",aktion:"eintrag-entfernen",pfad:n,was:"MCP server table [mcp_servers.cachly]; other settings stay",vorher:r,nachher:o.rest}))}function qe(t,e){const n=g(t.projekt,".git");if(!A(n))return;if(!F(n)){e.vonHand.push({stufe:"projekt",text:".git is a file here (a Git worktree). cachly never writes a post-commit hook there. If you set one up in the main repository, check its .git/hooks/post-commit."});return}const r=g(ie(t.projekt),"post-commit"),o=y(r);if(o===null)return;const i=Fe(o);if(i.entfernt.length===0)return;const a=i.entfernt.join(" and ");i.rest===""?e.funde.push({stufe:"projekt",aktion:"datei-loeschen",pfad:r,was:`${a}, the only thing in the hook`,vorher:o}):e.funde.push({stufe:"projekt",aktion:"block-entfernen",pfad:r,was:`${a}; your own commands stay`,vorher:o,nachher:i.rest})}function Qe(t,e){const n=g(t.heim,".claude","mcp.json"),r=y(n);if(r!==null){const s=w(r,"mcpServers");s.art==="unlesbar"&&r.includes("cachly")?e.vonHand.push({stufe:"global",text:'~/.claude/mcp.json: cannot be read as plain JSON. Remove the "cachly" entry by hand.'}):s.art==="geaendert"&&(e.instanz||=s.instanz,s.nachher===null?e.funde.push({stufe:"global",aktion:"datei-loeschen",pfad:n,was:'MCP server entry "cachly", the only thing in the file (it holds your key)',vorher:r}):e.funde.push({stufe:"global",aktion:"eintrag-entfernen",pfad:n,was:'MCP server entry "cachly" (it holds your key); other servers stay',vorher:r,nachher:s.nachher}))}for(const s of[g(t.heim,".cursor","mcp.json"),g(t.heim,".codeium","windsurf","mcp_config.json")]){const l=y(s);if(l===null)continue;const h=w(l,"mcpServers");(h.art==="geaendert"||h.art==="unlesbar"&&l.includes("cachly"))&&e.funde.push({stufe:"global",aktion:"melden",pfad:s,was:'has a "cachly" server entry. You set this file up yourself, so uninstall leaves it. Remove the entry by hand.'})}const o=g(t.heim,".cachly");let i=[];try{i=v(o)}catch{}const a=[];for(const s of i.sort()){const l=g(o,s);if(Ie.test(s)&&y(l)!==null){const h=s===b(P({home:""}))?"your key and Brain id; other projects on this computer lose their access":"cachly data on this computer";e.funde.push({stufe:"global",aktion:"datei-loeschen",pfad:l,was:h})}else a.push(s)}a.length>0&&e.vonHand.push({stufe:"global",text:`~/.cachly also holds ${a.join(", ")}. Not written by this package, so it stays.${a.includes("vscode-mcp.env")?" vscode-mcp.env holds your key (written by the VS Code extension): uninstall the extension, then delete it.":""}`});let c=[];try{c=v(t.tmp)}catch{}for(const s of c.sort()){if(!s.startsWith("cachly-"))continue;const l=g(t.tmp,s),h=F(l);Ne(s,h)&&e.funde.push({stufe:"global",aktion:h?"ordner-loeschen":"datei-loeschen",pfad:l,was:"cache in the temp folder"})}}function Ze(t){const e={projekt:k(t.projekt),heim:k(t.heim),tmp:k(t.tmp)},n={funde:[],vonHand:[],instanz:""};return Ue(e,n),We(e,n),Ye(e,n),qe(e,n),Qe(e,n),n.funde.push(...W(n.funde,"projekt",e.projekt,e.tmp)),n.funde.push(...W(n.funde,"global",e.heim,e.tmp)),n}function J(t){return t.split(S).length}function Y(t){return[...t].sort((n,r)=>{const o=i=>i.aktion==="ordner-entfernen"?1:0;return o(n)-o(r)||(o(n)?J(r.pfad)-J(n.pfad):0)}).map(n=>{if(n.aktion==="melden")return{fund:n,status:"uebersprungen",grund:"only reported"};try{return n.vorher!==void 0&&y(n.pfad)!==n.vorher?{fund:n,status:"uebersprungen",grund:"the file changed after the plan was made"}:(n.aktion==="datei-loeschen"?R(n.pfad,{force:!0}):n.aktion==="ordner-loeschen"?R(n.pfad,{recursive:!0,force:!0}):n.aktion==="ordner-entfernen"?ee(n.pfad):te(n.pfad,n.nachher??"","utf8"),{fund:n,status:"entfernt"})}catch(r){const o=r.code==="ENOTEMPTY"?"the folder is not empty":r.message;return{fund:n,status:"uebersprungen",grund:o}}})}async function et(t){const e=await je(g(t.heim,".cachly",b(M()))),n=Ae(e),r={schluessel:t.schluessel?xe(t.schluessel)?"test":"konto":"keiner",turns:e.length,injected:n.injected,prevented:n.prevented,net:n.net,lektionen:null};if(!t.schluessel||!t.instanz)return r.lektionenFehlt="no-instance",r;try{const o=await(t.fetchFn??fetch)(`${t.apiUrl}/api/v1/instances/${t.instanz}/memory`,{headers:{Authorization:`Bearer ${t.schluessel}`},signal:AbortSignal.timeout(5e3)});if(!o.ok)throw new Error(`HTTP ${o.status}`);const i=(await o.json()).lesson_count;if(typeof i!="number")throw new Error("no lesson_count");r.lektionen=i}catch{r.lektionenFehlt="unreachable"}return r}const tt={"datei-loeschen":"delete file","ordner-loeschen":"delete folder","ordner-entfernen":"remove folder","eintrag-entfernen":"remove entry","block-entfernen":"remove block",melden:"note only"};function V(t,e){const n=t.stufe==="projekt"?e.projekt:e.heim,r=I(n,t.pfad),o=r!==""&&!r.startsWith("..")&&!T(r),i=(o?r:t.pfad).split(S).join("/");return t.stufe==="global"&&o?`~/${i}`:i}function nt(t,e){const n=e.ausgabe;n(""),n("What you have right now");const r=t.schluessel==="test"?"test key (cky_trial_), the Brain behind it is a test Brain":t.schluessel==="konto"?"account key":"none found";n(` Key: ${r}`);const o=t.lektionen!==null?`${t.lektionen} in your Brain`:t.lektionenFehlt==="no-instance"?"unknown (no key or Brain found here)":"not reachable right now";n(` Lessons: ${o}`),n(t.turns>0?` Ledger: ${t.turns} turns, ${t.injected} tokens injected, ${t.prevented} prevented, net ${t.net>=0?"+":""}${t.net} tokens`:" Ledger: no turns recorded"),n(" To keep your lessons first, write them to disk:"),n(" npx @cachly-dev/mcp-server@latest export")}function X(t,e,n){n.ausgabe(""),n.ausgabe(t);for(const r of e)n.ausgabe(` ${tt[r.aktion].padEnd(14)} ${V(r,n)} (${r.was})`)}function q(t,e,n){n.ausgabe(""),n.ausgabe("By hand (uninstall cannot do these):"),n.ausgabe(' - If you registered cachly with "codex mcp add" or "gemini mcp add -s user", it is in ~/.codex/config.toml or ~/.gemini/settings.json. Remove the entry named cachly there (the project files above are handled).'),n.ausgabe(' - Uninstall the JetBrains plugin "Cachly Brain" (Settings, Plugins) and the VS Code extension "cachly Brain" (cachly-dev.cachly-brain), if you installed them.');for(const r of t.vonHand)(r.stufe==="projekt"||e)&&n.ausgabe(` - ${r.text}`)}function Q(t,e){e.ausgabe("");for(const r of t){if(r.fund.aktion==="melden")continue;const o=r.status==="entfernt"?"removed":"skipped";e.ausgabe(` ${o.padEnd(8)} ${V(r.fund,e)}${r.grund?` (${r.grund})`:""}`)}const n=t.filter(r=>r.fund.aktion!=="melden");e.ausgabe(`Done: ${n.filter(r=>r.status==="entfernt").length} removed, ${n.filter(r=>r.status==="uebersprungen").length} skipped.`)}function rt(t){return{dryRun:t.includes("--dry-run"),ja:t.includes("--yes")||t.includes("-y"),global:t.includes("--global")}}async function wt(t,e){const n=rt(t),r=Ze({projekt:e.projekt,heim:e.heim,tmp:e.tmp}),o=await et({heim:e.heim,schluessel:e.schluessel,instanz:e.instanz||r.instanz,apiUrl:e.apiUrl,fetchFn:e.fetchFn});nt(o,e);const i=r.funde.filter(d=>d.stufe==="projekt"),a=r.funde.filter(d=>d.stufe==="global"),c=i.filter(d=>d.aktion!=="melden"),s=a.filter(d=>d.aktion!=="melden");if(i.length===0&&(!n.global||a.length===0))return e.ausgabe(""),e.ausgabe(`Nothing found in ${e.projekt}${n.global?" or your home folder":""}: cachly has not written anything here that uninstall can remove.`),!n.global&&s.length>0&&e.ausgabe(`Your home folder still holds ${s.length} cachly files (key, ledger, caches). "uninstall --global" removes them.`),q(r,n.global,e),e.ausgabe(""),e.ausgabe(B),0;if(i.length>0&&X(`In this project (${e.projekt}):`,i,e),n.global&&a.length>0&&X("In your home folder and temp folder (--global):",a,e),q(r,n.global,e),e.ausgabe(""),e.ausgabe(B),n.dryRun)return e.ausgabe(""),e.ausgabe("Dry run: nothing was changed."),!n.global&&s.length>0&&e.ausgabe(`Your home and temp folders hold ${s.length} more cachly files (key, ledger, caches); add --global to include them.`),0;if(!(c.length>0||n.global&&s.length>0))return e.ausgabe(""),e.ausgabe("Nothing to remove."),0;if(!n.ja&&!e.istTty)return e.ausgabe(""),e.ausgabe('This is not a terminal and --yes is missing: nothing was changed. Run it in a terminal, or add --yes. "--dry-run" only shows the plan.'),1;let h=0,u=0;if(c.length>0)if(n.ja||await e.frage(`
15
- Remove these ${c.length} items from this project? [y/N] `)){const m=Y(i);Q(m,e),h+=m.filter(f=>f.status==="entfernt").length,u+=m.filter(f=>f.status==="uebersprungen"&&f.fund.aktion!=="melden").length}else e.ausgabe("Project: nothing was changed.");if(n.global&&s.length>0)if(e.ausgabe(""),e.ausgabe("Home folder: this removes your key file. Other projects on this computer lose their access to the Brain."),o.schluessel==="test"&&e.ausgabe('It is a test key. Without it you cannot reach the test Brain again. "npx @cachly-dev/mcp-server@latest claim" keeps it in your own account first.'),n.ja||await e.frage(`
16
- Remove these ${s.length} items from your home and temp folder? [y/N] `)){const m=Y(a);Q(m,e),h+=m.filter(f=>f.status==="entfernt").length,u+=m.filter(f=>f.status==="uebersprungen"&&f.fund.aktion!=="melden").length}else e.ausgabe("Home folder: nothing was changed.");else!n.global&&s.length>0&&(e.ausgabe(""),e.ausgabe(`Your home folder still holds ${s.length} cachly files (key, ledger, caches). "uninstall --global" removes them, with its own question.`));return h===0&&u===0&&e.ausgabe("Nothing was changed."),u>0?1:0}export{Re as KAPUTTER_STOP_HOOK,Be as entferneAnweisungsBlock,Fe as entferneGitHookBloecke,U as entferneHookEintraege,w as entferneMcpEintrag,Y as fuehreAus,Ne as istCachlyAblage,Ke as istLeerNachRueckbau,_ as klassifiziereAmbientHook,Pe as klassifiziereClaudeHook,Ze as plane,et as sammleBestand,wt as uninstallBefehl};
14
+ `,entfernt:n}}function Ue(t,e){const n=I(e,t);return n!==""&&!n.startsWith("..")&&!T(n)}function J(t,e,n,r){const o=new Set(t.filter(a=>a.stufe===e&&(a.aktion==="datei-loeschen"||a.aktion==="ordner-loeschen")).map(a=>a.pfad)),s=new Set;for(const a of o)for(let c=C(a);c!==r&&Ue(c,n)&&!c.split(S).includes(".git");c=C(c))s.add(c);const i=[];for(const a of[...s].sort((c,f)=>f.length-c.length)){let c;try{c=v(a)}catch{continue}c.every(f=>o.has(y(a,f)))&&(o.add(a),i.push({stufe:e,aktion:"ordner-entfernen",pfad:a,was:"empty folder"}))}return i}function We(t,e){const n=new Map;for(const[r,o]of Object.entries(oe))n.set(o,r==="continue"?"continue":r==="zed"?"zed":o===".vscode/mcp.json"?"vscode":"mcpServers");for(const[r,o]of n){const s=k(t.projekt,r),i=g(s);if($(`${s}.bak`)&&e.funde.push({stufe:"projekt",aktion:"melden",pfad:`${s}.bak`,was:"your old file is there; uninstall does not restore it"}),i===null)continue;const a=w(i,o);if(a.art==="unlesbar"){i.includes("cachly")&&e.vonHand.push({stufe:"projekt",text:`${r}: cannot be read as plain JSON (comments or another format). Remove the "cachly" entry by hand.`});continue}a.art!=="nichts"&&(e.instanz||=a.instanz,a.nachher===null?e.funde.push({stufe:"projekt",aktion:"datei-loeschen",pfad:s,was:'MCP server entry "cachly", the only thing in the file',vorher:i}):e.funde.push({stufe:"projekt",aktion:"eintrag-entfernen",pfad:s,was:'MCP server entry "cachly"; other servers and settings stay',vorher:i,nachher:a.nachher}))}}function Je(t,e){for(const n of re){const r=k(t.projekt,...n.pfad),o=g(r);if(o===null)continue;const s=n.pfad.join("/"),i=Le(o);if(i.art==="kein-block"){o.startsWith("# cachly AI Brain")&&e.vonHand.push({stufe:"projekt",text:`${s}: looks like the whole file was written by the setup_ai_memory tool (no markers). Check it and remove it by hand if it is not yours.`});continue}if(i.art==="kaputt"){e.vonHand.push({stufe:"projekt",text:`${s}: a cachly marker has no partner. Remove the block by hand.`});continue}Fe(i.rest,s.endsWith(".mdc")||n.prefix!==void 0)?e.funde.push({stufe:"projekt",aktion:"datei-loeschen",pfad:r,was:"only the cachly block was in it",vorher:o}):e.funde.push({stufe:"projekt",aktion:"block-entfernen",pfad:r,was:"cachly block between the markers; your text stays as it is",vorher:o,nachher:i.rest})}}function E(t,e,n,r,o){const s=k(t.projekt,n),i=g(s);if(i===null)return;const a=W(i,r,o);if(a.art==="unlesbar"){(i.includes(A)||i.includes("@cachly-dev/mcp-server"))&&e.vonHand.push({stufe:"projekt",text:`${n}: cannot be read as plain JSON (comments or another format). Remove the cachly hooks by hand.`});return}if(a.art==="nichts")return;const c=a.entfernt.filter(h=>h==="ambient").length,f=a.entfernt.filter(h=>h==="checkpoint").length,l=[...c?[`${c} Ambient Recall hook${c===1?"":"s"}`]:[],...f?[`${f} ${Ce}`]:[]];a.nachher===null?e.funde.push({stufe:"projekt",aktion:"datei-loeschen",pfad:s,was:`${l.join(" and ")}, the only thing in the file`,vorher:i}):e.funde.push({stufe:"projekt",aktion:"eintrag-entfernen",pfad:s,was:`${l.join(" and ")}; other hooks and settings stay`,vorher:i,nachher:a.nachher})}function Ye(t,e,n){const r=k(t.projekt,n);let o;try{o=v(r)}catch{return}for(const s of o.sort()){const i=y(r,s);!s.startsWith(A)||g(i)===null||e.funde.push({stufe:"projekt",aktion:"datei-loeschen",pfad:i,was:"Ambient Recall hook script"})}}function Ve(t,e){E(t,e,he,Me,[]),E(t,e,me,_,["version"]),E(t,e,de,_,["version"]),E(t,e,ue,_,[]),Xe(t,e);for(const n of[le,ge,pe,fe,ye])Ye(t,e,n);qe(t,e)}function Xe(t,e){const n=k(t.projekt,P),r=g(n);if(r===null)return;const o=W(r,_,[]);if(o.art==="unlesbar"){(r.includes(A)||r.includes("@cachly-dev/mcp-server"))&&e.vonHand.push({stufe:"projekt",text:`${P}: cannot be read as plain JSON (comments or another format). Remove the cachly hooks and the MCP server "cachly" by hand.`});return}const s=o.art==="geaendert"?o.nachher:r,i=s===null?{art:"nichts"}:w(s,"mcpServers"),a=i.art==="geaendert"?i.nachher:s;if(o.art!=="geaendert"&&i.art!=="geaendert")return;i.art==="geaendert"&&(e.instanz||=i.instanz);const c=o.art==="geaendert"?o.entfernt.length:0,f=[...c?[`${c} Ambient Recall hook${c===1?"":"s"}`]:[],...i.art==="geaendert"?['MCP server entry "cachly"']:[]];a===null?e.funde.push({stufe:"projekt",aktion:"datei-loeschen",pfad:n,was:`${f.join(" and ")}, the only thing in the file`,vorher:r}):e.funde.push({stufe:"projekt",aktion:"eintrag-entfernen",pfad:n,was:`${f.join(" and ")}; other servers, hooks and settings stay`,vorher:r,nachher:a})}function qe(t,e){const n=k(t.projekt,be),r=g(n);if(r===null)return;const o=ve(r);o.entfernt&&(o.rest===""?e.funde.push({stufe:"projekt",aktion:"datei-loeschen",pfad:n,was:"MCP server table [mcp_servers.cachly], the only thing in the file",vorher:r}):e.funde.push({stufe:"projekt",aktion:"eintrag-entfernen",pfad:n,was:"MCP server table [mcp_servers.cachly]; other settings stay",vorher:r,nachher:o.rest}))}function Qe(t,e){const n=y(t.projekt,".git");if(!$(n))return;if(!G(n)){e.vonHand.push({stufe:"projekt",text:".git is a file here (a Git worktree). cachly never writes a post-commit hook there. If you set one up in the main repository, check its .git/hooks/post-commit."});return}const r=y(ae(t.projekt),"post-commit"),o=g(r);if(o===null)return;const s=Ge(o);if(s.entfernt.length===0)return;const i=s.entfernt.join(" and ");s.rest===""?e.funde.push({stufe:"projekt",aktion:"datei-loeschen",pfad:r,was:`${i}, the only thing in the hook`,vorher:o}):e.funde.push({stufe:"projekt",aktion:"block-entfernen",pfad:r,was:`${i}; your own commands stay`,vorher:o,nachher:s.rest})}function Ze(t,e){const n=y(t.heim,".claude","mcp.json"),r=g(n);if(r!==null){const l=w(r,"mcpServers");l.art==="unlesbar"&&r.includes("cachly")?e.vonHand.push({stufe:"global",text:'~/.claude/mcp.json: cannot be read as plain JSON. Remove the "cachly" entry by hand.'}):l.art==="geaendert"&&(e.instanz||=l.instanz,l.nachher===null?e.funde.push({stufe:"global",aktion:"datei-loeschen",pfad:n,was:'MCP server entry "cachly", the only thing in the file (it holds your key)',vorher:r}):e.funde.push({stufe:"global",aktion:"eintrag-entfernen",pfad:n,was:'MCP server entry "cachly" (it holds your key); other servers stay',vorher:r,nachher:l.nachher}))}const o={heim:t.heim,plattform:process.platform,appData:process.env.APPDATA},s=[y(t.heim,".cursor","mcp.json"),N("windsurf",o),N("cline",o)];for(const l of s){const h=g(l);if(h===null)continue;const u=w(h,"mcpServers");(u.art==="geaendert"||u.art==="unlesbar"&&h.includes("cachly"))&&e.funde.push({stufe:"global",aktion:"melden",pfad:l,was:'has a "cachly" server entry. The file belongs to that editor and also lists other servers, so uninstall leaves it. Remove the "cachly" entry by hand.'})}const i=y(t.heim,".cachly");let a=[];try{a=v(i)}catch{}const c=[];for(const l of a.sort()){const h=y(i,l);if(He.test(l)&&g(h)!==null){const u=l===b(M({home:""}))?"your key and Brain id; other projects on this computer lose their access":"cachly data on this computer";e.funde.push({stufe:"global",aktion:"datei-loeschen",pfad:h,was:u})}else c.push(l)}c.length>0&&e.vonHand.push({stufe:"global",text:`~/.cachly also holds ${c.join(", ")}. Not written by this package, so it stays.${c.includes("vscode-mcp.env")?" vscode-mcp.env holds your key (written by the VS Code extension): uninstall the extension, then delete it.":""}`});let f=[];try{f=v(t.tmp)}catch{}for(const l of f.sort()){if(!l.startsWith("cachly-"))continue;const h=y(t.tmp,l),u=G(h);ze(l,u)&&e.funde.push({stufe:"global",aktion:u?"ordner-loeschen":"datei-loeschen",pfad:h,was:"cache in the temp folder"})}}function et(t){const e={projekt:k(t.projekt),heim:k(t.heim),tmp:k(t.tmp)},n={funde:[],vonHand:[],instanz:""};return We(e,n),Je(e,n),Ve(e,n),Qe(e,n),Ze(e,n),n.funde.push(...J(n.funde,"projekt",e.projekt,e.tmp)),n.funde.push(...J(n.funde,"global",e.heim,e.tmp)),n}function Y(t){return t.split(S).length}function V(t){return[...t].sort((n,r)=>{const o=s=>s.aktion==="ordner-entfernen"?1:0;return o(n)-o(r)||(o(n)?Y(r.pfad)-Y(n.pfad):0)}).map(n=>{if(n.aktion==="melden")return{fund:n,status:"uebersprungen",grund:"only reported"};try{return n.vorher!==void 0&&g(n.pfad)!==n.vorher?{fund:n,status:"uebersprungen",grund:"the file changed after the plan was made"}:(n.aktion==="datei-loeschen"?R(n.pfad,{force:!0}):n.aktion==="ordner-loeschen"?R(n.pfad,{recursive:!0,force:!0}):n.aktion==="ordner-entfernen"?te(n.pfad):ne(n.pfad,n.nachher??"","utf8"),{fund:n,status:"entfernt"})}catch(r){const o=r.code==="ENOTEMPTY"?"the folder is not empty":r.message;return{fund:n,status:"uebersprungen",grund:o}}})}async function tt(t){const e=await we(y(t.heim,".cachly",b(B()))),n=xe(e),r={schluessel:t.schluessel?Re(t.schluessel)?"test":"konto":"keiner",turns:e.length,injected:n.injected,prevented:n.prevented,net:n.net,lektionen:null};if(!t.schluessel||!t.instanz)return r.lektionenFehlt="no-instance",r;try{const o=await(t.fetchFn??fetch)(`${t.apiUrl}/api/v1/instances/${t.instanz}/memory`,{headers:{Authorization:`Bearer ${t.schluessel}`},signal:AbortSignal.timeout(5e3)});if(!o.ok)throw new Error(`HTTP ${o.status}`);const s=(await o.json()).lesson_count;if(typeof s!="number")throw new Error("no lesson_count");r.lektionen=s}catch{r.lektionenFehlt="unreachable"}return r}const nt={"datei-loeschen":"delete file","ordner-loeschen":"delete folder","ordner-entfernen":"remove folder","eintrag-entfernen":"remove entry","block-entfernen":"remove block",melden:"note only"};function X(t,e){const n=t.stufe==="projekt"?e.projekt:e.heim,r=I(n,t.pfad),o=r!==""&&!r.startsWith("..")&&!T(r),s=(o?r:t.pfad).split(S).join("/");return t.stufe==="global"&&o?`~/${s}`:s}function rt(t,e){const n=e.ausgabe;n(""),n("What you have right now");const r=t.schluessel==="test"?"test key (cky_trial_), the Brain behind it is a test Brain":t.schluessel==="konto"?"account key":"none found";n(` Key: ${r}`);const o=t.lektionen!==null?`${t.lektionen} in your Brain`:t.lektionenFehlt==="no-instance"?"unknown (no key or Brain found here)":"not reachable right now";n(` Lessons: ${o}`),n(t.turns>0?` Ledger: ${t.turns} turns, ${t.injected} tokens injected, ${t.prevented} prevented, net ${t.net>=0?"+":""}${t.net} tokens`:" Ledger: no turns recorded"),n(" To keep your lessons first, write them to disk:"),n(" npx @cachly-dev/mcp-server@latest export")}function q(t,e,n){n.ausgabe(""),n.ausgabe(t);for(const r of e)n.ausgabe(` ${nt[r.aktion].padEnd(14)} ${X(r,n)} (${r.was})`)}function Q(t,e,n){n.ausgabe(""),n.ausgabe("By hand (uninstall cannot do these):"),n.ausgabe(' - If you registered cachly with "codex mcp add" or "gemini mcp add -s user", it is in ~/.codex/config.toml or ~/.gemini/settings.json. Remove the entry named cachly there (the project files above are handled).'),n.ausgabe(' - Uninstall the JetBrains plugin "Cachly Brain" (Settings, Plugins) and the VS Code extension "cachly Brain" (cachly-dev.cachly-brain), if you installed them.');for(const r of t.vonHand)(r.stufe==="projekt"||e)&&n.ausgabe(` - ${r.text}`)}function Z(t,e){e.ausgabe("");for(const r of t){if(r.fund.aktion==="melden")continue;const o=r.status==="entfernt"?"removed":"skipped";e.ausgabe(` ${o.padEnd(8)} ${X(r.fund,e)}${r.grund?` (${r.grund})`:""}`)}const n=t.filter(r=>r.fund.aktion!=="melden");e.ausgabe(`Done: ${n.filter(r=>r.status==="entfernt").length} removed, ${n.filter(r=>r.status==="uebersprungen").length} skipped.`)}function ot(t){return{dryRun:t.includes("--dry-run"),ja:t.includes("--yes")||t.includes("-y"),global:t.includes("--global")}}async function _t(t,e){const n=ot(t),r=et({projekt:e.projekt,heim:e.heim,tmp:e.tmp}),o=await tt({heim:e.heim,schluessel:e.schluessel,instanz:e.instanz||r.instanz,apiUrl:e.apiUrl,fetchFn:e.fetchFn});rt(o,e);const s=r.funde.filter(u=>u.stufe==="projekt"),i=r.funde.filter(u=>u.stufe==="global"),a=s.filter(u=>u.aktion!=="melden"),c=i.filter(u=>u.aktion!=="melden");if(s.length===0&&(!n.global||i.length===0))return e.ausgabe(""),e.ausgabe(`Nothing found in ${e.projekt}${n.global?" or your home folder":""}: cachly has not written anything here that uninstall can remove.`),!n.global&&c.length>0&&e.ausgabe(`Your home folder still holds ${c.length} cachly files (key, ledger, caches). "uninstall --global" removes them.`),Q(r,n.global,e),e.ausgabe(""),e.ausgabe(L),0;if(s.length>0&&q(`In this project (${e.projekt}):`,s,e),n.global&&i.length>0&&q("In your home folder and temp folder (--global):",i,e),Q(r,n.global,e),e.ausgabe(""),e.ausgabe(L),n.dryRun)return e.ausgabe(""),e.ausgabe("Dry run: nothing was changed."),!n.global&&c.length>0&&e.ausgabe(`Your home and temp folders hold ${c.length} more cachly files (key, ledger, caches); add --global to include them.`),0;if(!(a.length>0||n.global&&c.length>0))return e.ausgabe(""),e.ausgabe("Nothing to remove."),0;if(!n.ja&&!e.istTty)return e.ausgabe(""),e.ausgabe('This is not a terminal and --yes is missing: nothing was changed. Run it in a terminal, or add --yes. "--dry-run" only shows the plan.'),1;let l=0,h=0;if(a.length>0)if(n.ja||await e.frage(`
15
+ Remove these ${a.length} items from this project? [y/N] `)){const m=V(s);Z(m,e),l+=m.filter(d=>d.status==="entfernt").length,h+=m.filter(d=>d.status==="uebersprungen"&&d.fund.aktion!=="melden").length}else e.ausgabe("Project: nothing was changed.");if(n.global&&c.length>0)if(e.ausgabe(""),e.ausgabe("Home folder: this removes your key file. Other projects on this computer lose their access to the Brain."),o.schluessel==="test"&&e.ausgabe('It is a test key. Without it you cannot reach the test Brain again. "npx @cachly-dev/mcp-server@latest claim" keeps it in your own account first.'),n.ja||await e.frage(`
16
+ Remove these ${c.length} items from your home and temp folder? [y/N] `)){const m=V(i);Z(m,e),l+=m.filter(d=>d.status==="entfernt").length,h+=m.filter(d=>d.status==="uebersprungen"&&d.fund.aktion!=="melden").length}else e.ausgabe("Home folder: nothing was changed.");else!n.global&&c.length>0&&(e.ausgabe(""),e.ausgabe(`Your home folder still holds ${c.length} cachly files (key, ledger, caches). "uninstall --global" removes them, with its own question.`));return l===0&&h===0&&e.ausgabe("Nothing was changed."),h>0?1:0}export{Ce as KAPUTTER_STOP_HOOK,Le as entferneAnweisungsBlock,Ge as entferneGitHookBloecke,W as entferneHookEintraege,w as entferneMcpEintrag,V as fuehreAus,ze as istCachlyAblage,Fe as istLeerNachRueckbau,_ as klassifiziereAmbientHook,Me as klassifiziereClaudeHook,et as plane,tt as sammleBestand,_t as uninstallBefehl};
package/glama.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://glama.ai/mcp/schemas/server.json",
3
- "version": "0.10.256",
3
+ "version": "0.10.258",
4
4
  "maintainers": [
5
5
  "HeinrichNebula"
6
6
  ],