@cachly-dev/mcp-server 0.10.226 → 0.10.228

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.
@@ -41,7 +41,7 @@ Add cross-project knowledge with \`global_learn(topic="...", lesson="...")\`.`;f
41
41
  Available: ${n}
42
42
 
43
43
  Or publish your own: \`publish_lesson(framework="${t}", ...)\``}const r=c.slice(0,i);let h=0;for(const n of r){const m=`cachly:lesson:best:${n.topic}`;await a.get(m)||(await a.set(m,JSON.stringify({...n,what_worked:n.lesson,outcome:"success",ts:new Date().toISOString(),recall_count:0,source:"public_brain",version:2})),h++)}return[`\u{1F4E5} **Public Brain imported: ${t}**`,"",`${h} new lessons added (${r.length-h} already existed)`,"","**Imported topics:**",...r.map(n=>` ${n.severity==="critical"?"\u{1F534}":n.severity==="major"?"\u{1F7E1}":"\u{1F4A1}"} \`${n.topic}\``),"","These lessons will now appear in `session_start` when relevant.",`Recall any time: \`recall_best_solution(topic="${e}:...")\``].join(`
44
- `)}case"setup_ai_memory":{const{instance_id:l,project_dir:t,embed_provider:i="openai",project_description:a="a software project"}=w,o=await E(`/api/v1/instances/${l}`),e={openai:{key:"OPENAI_API_KEY",hint:"Get at: https://platform.openai.com/api-keys"},mistral:{key:"MISTRAL_API_KEY",hint:"Get at: https://console.mistral.ai/api-keys"},cohere:{key:"COHERE_API_KEY",hint:"Get at: https://dashboard.cohere.com/api-keys"},ollama:{key:"OLLAMA_BASE_URL",hint:"Run: brew install ollama && ollama serve (free, local, no key needed)"},gemini:{key:"GEMINI_API_KEY",hint:"Get at: https://aistudio.google.com/app/apikey"}},c=e[i]??e.openai,r=!!o.vector_token,h=JSON.stringify({mcpServers:{cachly:{command:"npx",args:["-y","@cachly-dev/mcp-server@latest"],env:{CACHLY_JWT:"your-api-token-from-cachly.dev/settings",[c.key]:i==="ollama"?"http://localhost:11434":"your-key-here",...i!=="openai"?{CACHLY_EMBED_PROVIDER:i}:{}}}}},null,2),s=o.tier.toUpperCase(),n=je(l),m=["\u{1F9E0} **cachly AI Memory Setup Complete**","",`**Project:** ${a}`,`**Instance:** ${o.name} (${s}) \xB7 ID: \`${l}\``,`**Embedding Provider:** ${i}`,`**Semantic Search:** ${r?"\u2705 pgvector HNSW available":"\u26A0\uFE0F needs a vector token \u2014 rotate it in the dashboard (every tier includes one)"}`,"","\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500","**Step 1 \u2014 Add to .mcp.json:**","```json",h,"```","",`**Step 2 \u2014 Set your ${i} key:**`,"```bash",`export ${c.key}="your-key-here"`,"```",`_(${c.hint})_`,"","\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500","**Step 3 \u2014 Brain rules (Layer 3 Autopilot):**","",...t?[`\u{1F50D} Detecting IDEs in \`${t}\`\u2026`]:["Copy this to `.github/copilot-instructions.md` (Copilot), `CLAUDE.md` (Claude Code), or `.cursor/rules` (Cursor) in your project:"],"","```markdown",n,"```","","\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500","**How the 3 layers work together:**"," Layer 1 \u2192 Your Valkey instance stores all lessons + context (persists forever)"," Layer 2 \u2192 MCP tools (learn_from_attempts, recall_best_solution, smart_recall) read/write it"," Layer 3 \u2192 copilot-instructions.md makes your AI run them automatically","","Result: Your AI never solves the same problem twice. \u{1F680}"];if(t){const{access:g}=await import("node:fs/promises"),{constants:v}=await import("node:fs"),j=async S=>g(S,v.F_OK).then(()=>!0).catch(()=>!1),$=[{ide:"GitHub Copilot",path:I(t,".github","copilot-instructions.md")}];(await j(I(t,"CLAUDE.md"))||await j(I(t,".claude")))&&$.push({ide:"Claude Code",path:I(t,"CLAUDE.md")}),(await j(I(t,".cursor"))||await j(I(t,".cursorrules")))&&$.push({ide:"Cursor",path:I(t,".cursor","rules","cachly.mdc"),prefix:Le}),(await j(I(t,".windsurfrules"))||await j(I(t,".windsurf")))&&$.push({ide:"Windsurf",path:I(t,".windsurfrules")});const b=[];for(const S of $){const d=await Ae(S.path,n,S.prefix),u=d==="written"?"written":d==="updated"?"cachly block updated, rest of the file unchanged":"cachly block appended, your text kept";b.push(`\u2705 [${S.ide}] \u2192 \`${S.path.replace(t,".")}\` (${u})`)}b.push("\u2139\uFE0F Hooks (session briefing, per-prompt recall) are set up by `npx @cachly-dev/mcp-server@latest init` or `autopilot`."),m.push(...b)}return m.join(`
44
+ `)}case"setup_ai_memory":{const{instance_id:l,project_dir:t,embed_provider:i="openai",project_description:a="a software project"}=w,o=await E(`/api/v1/instances/${l}`),e={openai:{key:"OPENAI_API_KEY",hint:"Get at: https://platform.openai.com/api-keys"},mistral:{key:"MISTRAL_API_KEY",hint:"Get at: https://console.mistral.ai/api-keys"},cohere:{key:"COHERE_API_KEY",hint:"Get at: https://dashboard.cohere.com/api-keys"},ollama:{key:"OLLAMA_BASE_URL",hint:"Run: brew install ollama && ollama serve (free, local, no key needed)"},gemini:{key:"GEMINI_API_KEY",hint:"Get at: https://aistudio.google.com/app/apikey"}},c=e[i]??e.openai,r=!!o.vector_token,h=JSON.stringify({mcpServers:{cachly:{command:"npx",args:["-y","@cachly-dev/mcp-server@latest"],env:{CACHLY_JWT:"your-api-token-from-cachly.dev/settings",[c.key]:i==="ollama"?"http://localhost:11434":"your-key-here",...i!=="openai"?{CACHLY_EMBED_PROVIDER:i}:{}}}}},null,2),s=o.tier.toUpperCase(),n=je(l),m=["\u{1F9E0} **cachly AI Memory Setup Complete**","",`**Project:** ${a}`,`**Instance:** ${o.name} (${s}) \xB7 ID: \`${l}\``,`**Embedding Provider:** ${i}`,`**Semantic Search:** ${r?"\u2705 pgvector HNSW available":"\u26A0\uFE0F needs a vector token \u2014 rotate it in the dashboard (every tier includes one)"}`,"","\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500","**Step 1 \u2014 Add to .mcp.json:**","```json",h,"```","",`**Step 2 \u2014 Set your ${i} key:**`,"```bash",`export ${c.key}="your-key-here"`,"```",`_(${c.hint})_`,"","\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500","**Step 3 \u2014 Brain rules (Layer 3 Autopilot):**","",...t?[`\u{1F50D} Detecting IDEs in \`${t}\`\u2026`]:["Copy this to `.github/copilot-instructions.md` (Copilot), `CLAUDE.md` (Claude Code), or `.cursor/rules` (Cursor) in your project:"],"","```markdown",n,"```","","\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500","**How the 3 layers work together:**"," Layer 1 \u2192 Your Valkey instance stores all lessons + context (persists forever)"," Layer 2 \u2192 MCP tools (learn_from_attempts, recall_best_solution, smart_recall) read/write it"," Layer 3 \u2192 copilot-instructions.md makes your AI run them automatically","","Result: Your AI never solves the same problem twice. \u{1F680}"];if(t){const{access:g}=await import("node:fs/promises"),{constants:v}=await import("node:fs"),j=async S=>g(S,v.F_OK).then(()=>!0).catch(()=>!1),$=[{ide:"GitHub Copilot",path:I(t,".github","copilot-instructions.md")}];(await j(I(t,"CLAUDE.md"))||await j(I(t,".claude")))&&$.push({ide:"Claude Code",path:I(t,"CLAUDE.md")}),(await j(I(t,".cursor"))||await j(I(t,".cursorrules")))&&$.push({ide:"Cursor",path:I(t,".cursor","rules","cachly.mdc"),prefix:Le}),(await j(I(t,".windsurfrules"))||await j(I(t,".windsurf")))&&$.push({ide:"Windsurf",path:I(t,".windsurfrules")});const b=[];for(const S of $){const d=await Ae(S.path,n,S.prefix),u=d==="written"?"written":d==="unchanged"?"already current, nothing changed":d==="updated"?"cachly block updated, rest of the file unchanged":"cachly block appended, your text kept";b.push(`\u2705 [${S.ide}] \u2192 \`${S.path.replace(t,".")}\` (${u})`)}b.push("\u2139\uFE0F Hooks (session briefing, per-prompt recall) are set up by `npx @cachly-dev/mcp-server@latest init` or `autopilot`."),m.push(...b)}return m.join(`
45
45
  `)}case"team_assign_role":{const{instance_id:l,handle:t,role:i,assigned_by:a=""}=w;if(!l||!t||!i)return"\u274C Required: instance_id, handle, role";const o=["admin","reviewer","contributor","viewer"].includes(i)?i:null;if(!o)return`\u274C Unknown role \`${i}\`. Valid: admin \xB7 reviewer \xB7 contributor \xB7 viewer`;const e=await _(l),c=await e.hgetall(F(l)).catch(()=>({})),r=Object.values(c).includes("admin");if(r){const m=a?await G(e,l,a):null;if(!V(m,"admin"))return["\u274C **Permission denied** \u2014 only an `admin` can assign roles.","","Ask an existing admin to run:",`\`team_assign_role(instance_id="${l}", handle="${t}", role="${i}", assigned_by="<their-handle>")\``].join(`
46
46
  `)}const h=c[t.toLowerCase()]??null;await e.hset(F(l),t.toLowerCase(),o),await e.expire(F(l),365*2*86400),await de(e,l,{action:"team_assign_role",actor:a||"(bootstrap)",handle:t.toLowerCase(),from:h,to:o});const s=!r;return[`${K[o]} **Role assigned** \u2014 **${t}** is now a \`${o}\``,"",`**Capabilities:** ${oe[o]}`,"",s?"_First admin bootstrapped \u2014 governance is now active on this brain._":`_Assigned by ${a||"(bootstrap)"}_`,"","Run `team_roster` to see all current roles."].join(`
47
47
  `)}case"team_whoami":{const{instance_id:l,handle:t}=w;if(!l||!t)return"\u274C Required: instance_id, handle";const i=await _(l),a=await G(i,l,t);if(!a){const e=await i.hgetall(F(l)).catch(()=>({})),c=Object.values(e).includes("admin");return[`\u{1F441}\uFE0F **${t}** has no assigned role on this brain.`,"",c?`Ask an admin to run \`team_assign_role(handle="${t}", role="contributor")\` to add you.`:`This brain has no roles set up yet. Establish governance: