@cachly-dev/mcp-server 0.10.183 → 0.10.185

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.
package/dist/src/autor.js CHANGED
@@ -1 +1 @@
1
- import{execSync as c}from"node:child_process";const f=e=>n=>{try{return c(`git config ${n}`,{cwd:e,encoding:"utf-8",stdio:"pipe",timeout:1500}).trim()}catch{return""}};function t(e){const n=(e??"").trim();return n?(n.split(/[\s.]+/)[0]??"").toLowerCase().replace(/[^a-z0-9_-]/g,"").slice(0,32):""}const a=new Set(["-","anonym","anonymous","none","kein","off"]);function g(e){const n=(e.uebergeben??"").trim().toLowerCase();if(a.has(n))return{autor:"",quelle:"anonym"};const r=(e.umgebung??"").trim().toLowerCase();if(a.has(r))return{autor:"",quelle:"anonym"};const o=t(e.uebergeben??"");if(o)return{autor:o,quelle:"uebergeben"};const u=t(e.umgebung??"");if(u)return{autor:u,quelle:"umgebung"};const i=t(e.git("user.name"));if(i)return{autor:i,quelle:"git-name"};const l=e.git("user.email"),s=t((l??"").split("@")[0]??"");return s?{autor:s,quelle:"git-mail"}:{autor:"",quelle:"unbekannt"}}const b="coauthor";function h(e){const n=(e??"").trim().toLowerCase();return!n||n==="off"||n==="false"||n==="0"||n==="none"?"":t(n)}function p(e,n){return e?!n||n===e?e:`${e}+${n}`:""}function w(e){return(e??"").split("+")[0]??""}function d(e){return e.autor||e.quelle==="anonym"?null:'\u{1F464} **Kein Autor ermittelt** \u2014 weder `author`, noch `CACHLY_AUTHOR`, noch `git config user.name`. Ohne Autor z\xE4hlt diese Lektion nicht als Team-Wissen: `brain_who_knows` findet niemanden und Wiederverwendung \xFCber Personengrenzen bleibt ungez\xE4hlt. Ein `git config user.name "Vorname"` im Projekt gen\xFCgt f\xFCr alle k\xFCnftigen Lektionen.'}export{b as COAUTHOR_PREF_KEY,d as autorHinweis,h as coautorAus,f as echterGitLeser,g as ermittleAutor,p as mitCoautor,t as normalisiere,w as nurMensch};
1
+ import{execFileSync as c}from"node:child_process";const f=e=>n=>{try{return n.startsWith("-")?"":c("git",["config",n],{cwd:e,encoding:"utf-8",stdio:"pipe",timeout:1500,windowsHide:!0}).trim()}catch{return""}};function t(e){const n=(e??"").trim();return n?(n.split(/[\s.]+/)[0]??"").toLowerCase().replace(/[^a-z0-9_-]/g,"").slice(0,32):""}const a=new Set(["-","anonym","anonymous","none","kein","off"]);function g(e){const n=(e.uebergeben??"").trim().toLowerCase();if(a.has(n))return{autor:"",quelle:"anonym"};const r=(e.umgebung??"").trim().toLowerCase();if(a.has(r))return{autor:"",quelle:"anonym"};const o=t(e.uebergeben??"");if(o)return{autor:o,quelle:"uebergeben"};const i=t(e.umgebung??"");if(i)return{autor:i,quelle:"umgebung"};const u=t(e.git("user.name"));if(u)return{autor:u,quelle:"git-name"};const l=e.git("user.email"),s=t((l??"").split("@")[0]??"");return s?{autor:s,quelle:"git-mail"}:{autor:"",quelle:"unbekannt"}}const b="coauthor";function h(e){const n=(e??"").trim().toLowerCase();return!n||n==="off"||n==="false"||n==="0"||n==="none"?"":t(n)}function w(e,n){return e?!n||n===e?e:`${e}+${n}`:""}function d(e){return(e??"").split("+")[0]??""}function p(e){return e.autor||e.quelle==="anonym"?null:'\u{1F464} **Kein Autor ermittelt** \u2014 weder `author`, noch `CACHLY_AUTHOR`, noch `git config user.name`. Ohne Autor z\xE4hlt diese Lektion nicht als Team-Wissen: `brain_who_knows` findet niemanden und Wiederverwendung \xFCber Personengrenzen bleibt ungez\xE4hlt. Ein `git config user.name "Vorname"` im Projekt gen\xFCgt f\xFCr alle k\xFCnftigen Lektionen.'}export{b as COAUTHOR_PREF_KEY,p as autorHinweis,h as coautorAus,f as echterGitLeser,g as ermittleAutor,w as mitCoautor,t as normalisiere,d as nurMensch};
@@ -1,8 +1,8 @@
1
- import{existsSync as _}from"node:fs";import{readFile as p,writeFile as o,chmod as c,mkdir as m}from"node:fs/promises";import{resolve as s}from"node:path";const u="v1",h=/(?:#!\/bin\/sh\n)?# cachly brain_watch[\s\S]*?\nexit 0\n?/;async function B(n,a,d){if(!_(s(n,".git")))return{result:"skipped-no-git",hookPath:""};const l=s(n,".git","hooks"),t=s(l,"post-commit");await m(l,{recursive:!0});const r=f(a,d);let e="";try{e=await p(t,"utf-8")}catch{}if(!e)return await o(t,r+`
2
- `,"utf-8"),await c(t,493).catch(()=>{}),{result:"written",hookPath:t};if(e.includes(`cachly brain_watch \u2014 Auto-Learn ${u}`))return{result:"unchanged",hookPath:t};if(h.test(e)){const i=e.replace(h,r);return await o(t,i.endsWith(`
3
- `)?i:i+`
4
- `,"utf-8"),await c(t,493).catch(()=>{}),{result:"upgraded",hookPath:t}}return await o(t,e.trimEnd()+`
1
+ import{existsSync as _}from"node:fs";import{readFile as m,writeFile as o,chmod as c,mkdir as p}from"node:fs/promises";import{resolve as s}from"node:path";import{instanzIdFuerSkript as f,schluesselFuerSkript as $}from"./git-ohne-shell.js";const u="v1",h=/(?:#!\/bin\/sh\n)?# cachly brain_watch[\s\S]*?\nexit 0\n?/;async function H(r,e,d){if(!_(s(r,".git")))return{result:"skipped-no-git",hookPath:""};const l=s(r,".git","hooks"),t=s(l,"post-commit");await p(l,{recursive:!0});const i=w(e,d);let n="";try{n=await m(t,"utf-8")}catch{}if(!n)return await o(t,i+`
2
+ `,"utf-8"),await c(t,493).catch(()=>{}),{result:"written",hookPath:t};if(n.includes(`cachly brain_watch \u2014 Auto-Learn ${u}`))return{result:"unchanged",hookPath:t};if(h.test(n)){const a=n.replace(h,i);return await o(t,a.endsWith(`
3
+ `)?a:a+`
4
+ `,"utf-8"),await c(t,493).catch(()=>{}),{result:"upgraded",hookPath:t}}return await o(t,n.trimEnd()+`
5
5
 
6
- `+r+`
7
- `,"utf-8"),await c(t,493).catch(()=>{}),{result:"appended",hookPath:t}}function f(n,a){return["#!/bin/sh",`# cachly brain_watch \u2014 Auto-Learn ${u}`,"# Silently teaches your Brain after every commit \u2014 no manual brain_from_git needed.",...a?[`CACHLY_JWT="${a}"`]:[],'_BW_SHA=$(git rev-parse HEAD 2>/dev/null || echo "")',"_BW_MSG=$(git log -1 --pretty=%B 2>/dev/null | head -1 | cut -c1-200)","_BW_FILES=$(git diff-tree --no-commit-id -r --name-only HEAD 2>/dev/null | tr '\\n' '\\t' | sed 's/\\t$//')","(curl -s -o /dev/null -m 8 \\",` -X POST "https://api.cachly.dev/api/v1/instances/${n}/learn" \\`,' -H "Authorization: Bearer ${CACHLY_JWT}" \\',' -H "Content-Type: application/json" \\',` --data-raw "{\\"message\\":\\"$(echo "$_BW_MSG" | sed 's/"/\\\\"/g')\\",\\"sha\\":\\"$_BW_SHA\\",\\"files\\":[$(echo "$_BW_FILES" | tr '\\t' '\\n' | grep -v '^$' | sed 's/.*/\\"&\\"/' | tr '\\n' ',' | sed 's/,$//')],\\"source\\":\\"brain_watch\\"}" \\`,") 2>/dev/null &","exit 0"].join(`
8
- `)}export{u as BRAIN_WATCH_HOOK_VERSION,f as buildBrainWatchHook,B as installBrainWatchHook};
6
+ `+i+`
7
+ `,"utf-8"),await c(t,493).catch(()=>{}),{result:"appended",hookPath:t}}function w(r,e){return r=f(r),e&&(e=$(e)),["#!/bin/sh",`# cachly brain_watch \u2014 Auto-Learn ${u}`,"# Silently teaches your Brain after every commit \u2014 no manual brain_from_git needed.",...e?[`CACHLY_JWT="${e}"`]:[],'_BW_SHA=$(git rev-parse HEAD 2>/dev/null || echo "")',"_BW_MSG=$(git log -1 --pretty=%B 2>/dev/null | head -1 | cut -c1-200)","_BW_FILES=$(git diff-tree --no-commit-id -r --name-only HEAD 2>/dev/null | tr '\\n' '\\t' | sed 's/\\t$//')","(curl -s -o /dev/null -m 8 \\",` -X POST "https://api.cachly.dev/api/v1/instances/${r}/learn" \\`,' -H "Authorization: Bearer ${CACHLY_JWT}" \\',' -H "Content-Type: application/json" \\',` --data-raw "{\\"message\\":\\"$(echo "$_BW_MSG" | sed 's/"/\\\\"/g')\\",\\"sha\\":\\"$_BW_SHA\\",\\"files\\":[$(echo "$_BW_FILES" | tr '\\t' '\\n' | grep -v '^$' | sed 's/.*/\\"&\\"/' | tr '\\n' ',' | sed 's/,$//')],\\"source\\":\\"brain_watch\\"}" \\`,") 2>/dev/null &","exit 0"].join(`
8
+ `)}export{u as BRAIN_WATCH_HOOK_VERSION,w as buildBrainWatchHook,H as installBrainWatchHook};
@@ -0,0 +1 @@
1
+ function e(r){if(typeof r!="string")return null;try{const t=new URL(r);return t.protocol==="http:"||t.protocol==="https:"?t.href:null}catch{return null}}function n(r){return r.replace(/[&|<>^]/g,"^$&")}export{e as browserAdresse,n as fuerCmd};
@@ -1,8 +1,8 @@
1
- import{existsSync as C}from"node:fs";import{readFile as d,writeFile as s,chmod as c,mkdir as m}from"node:fs/promises";import{resolve as a}from"node:path";const u="v2",S=/(?:#!\/bin\/sh\n)?# cachly CLS[\s\S]*?\nexit 0\n?/;async function v(n,i,p){if(!C(a(n,".git")))return"skipped-no-git";const l=a(n,".git","hooks"),t=a(l,"post-commit");await m(l,{recursive:!0});const o=L(i,p);let e="";try{e=await d(t,"utf-8")}catch{}if(!e)return await s(t,o+`
2
- `,"utf-8"),await c(t,493).catch(()=>{}),"written";if(e.includes(`cachly CLS \u2014 Continuous Learning Stream ${u}`))return"unchanged";if(S.test(e)){const r=e.replace(S,o);return await s(t,r.endsWith(`
1
+ import{existsSync as C}from"node:fs";import{readFile as m,writeFile as s,chmod as c,mkdir as d}from"node:fs/promises";import{resolve as a}from"node:path";import{instanzIdFuerSkript as _,schluesselFuerSkript as L}from"./git-ohne-shell.js";const u="v2",S=/(?:#!\/bin\/sh\n)?# cachly CLS[\s\S]*?\nexit 0\n?/;async function y(n,t,p){if(!C(a(n,".git")))return"skipped-no-git";const l=a(n,".git","hooks"),e=a(l,"post-commit");await d(l,{recursive:!0});const i=f(t,p);let o="";try{o=await m(e,"utf-8")}catch{}if(!o)return await s(e,i+`
2
+ `,"utf-8"),await c(e,493).catch(()=>{}),"written";if(o.includes(`cachly CLS \u2014 Continuous Learning Stream ${u}`))return"unchanged";if(S.test(o)){const r=o.replace(S,i);return await s(e,r.endsWith(`
3
3
  `)?r:r+`
4
- `,"utf-8"),await c(t,493).catch(()=>{}),"upgraded"}return await s(t,e.trimEnd()+`
4
+ `,"utf-8"),await c(e,493).catch(()=>{}),"upgraded"}return await s(e,o.trimEnd()+`
5
5
 
6
- `+o+`
7
- `,"utf-8"),await c(t,493).catch(()=>{}),"appended"}const _="try{var p={instance_id:process.env.CACHLY_BRAIN_INSTANCE_ID,source:'git_commit',payload:{message:process.env.CLS_MSG||'',sha:process.env.CLS_SHA||'',files:(process.env.CLS_FILES||'').split(',').filter(Boolean)}};require('child_process').execFileSync('npx',['@cachly-dev/mcp-server@latest','cls-ingest',JSON.stringify(p)],{stdio:'ignore',timeout:8000});}catch(e){}";function L(n,i){return["#!/bin/sh",`# cachly CLS \u2014 Continuous Learning Stream ${u}`,"# Runs silently on every commit to keep your brain up to date.",`export CACHLY_BRAIN_INSTANCE_ID="${n}"`,...i?[`export CACHLY_JWT="${i}"`]:[],'CLS_SHA=$(git rev-parse HEAD 2>/dev/null || echo "")',"CLS_MSG=$(git log -1 --pretty=%B 2>/dev/null | head -1 | cut -c1-200)","CLS_FILES=$(git diff-tree --no-commit-id -r --name-only HEAD 2>/dev/null | tr '\\n' ',' | sed 's/,$//')","export CLS_SHA CLS_MSG CLS_FILES",`node -e "${_}" 2>/dev/null &`,"exit 0"].join(`
8
- `)}export{u as CLS_HOOK_VERSION,L as buildClsPostCommitHook,v as installClsPostCommitHook};
6
+ `+i+`
7
+ `,"utf-8"),await c(e,493).catch(()=>{}),"appended"}const h="try{var p={instance_id:process.env.CACHLY_BRAIN_INSTANCE_ID,source:'git_commit',payload:{message:process.env.CLS_MSG||'',sha:process.env.CLS_SHA||'',files:(process.env.CLS_FILES||'').split(',').filter(Boolean)}};require('child_process').execFileSync('npx',['@cachly-dev/mcp-server@latest','cls-ingest',JSON.stringify(p)],{stdio:'ignore',timeout:8000});}catch(e){}";function f(n,t){return n=_(n),t&&(t=L(t)),["#!/bin/sh",`# cachly CLS \u2014 Continuous Learning Stream ${u}`,"# Runs silently on every commit to keep your brain up to date.",`export CACHLY_BRAIN_INSTANCE_ID="${n}"`,...t?[`export CACHLY_JWT="${t}"`]:[],'CLS_SHA=$(git rev-parse HEAD 2>/dev/null || echo "")',"CLS_MSG=$(git log -1 --pretty=%B 2>/dev/null | head -1 | cut -c1-200)","CLS_FILES=$(git diff-tree --no-commit-id -r --name-only HEAD 2>/dev/null | tr '\\n' ',' | sed 's/,$//')","export CLS_SHA CLS_MSG CLS_FILES",`node -e "${h}" 2>/dev/null &`,"exit 0"].join(`
8
+ `)}export{u as CLS_HOOK_VERSION,f as buildClsPostCommitHook,y as installClsPostCommitHook};
@@ -0,0 +1 @@
1
+ import{execFileSync as r}from"node:child_process";import{statSync as i}from"node:fs";import{resolve as o}from"node:path";function p(t){if(typeof t!="string"||t===""||t.includes("\0"))return null;const e=o(t);try{return i(e).isDirectory()?e:null}catch{return null}}function a(t){return typeof t=="string"&&/^[0-9a-f]{7,64}$/i.test(t)}function h(t){return t.startsWith("-")}const u=/^[A-Za-z0-9_-]{1,64}$/,s=/^[A-Za-z0-9._~-]{1,4096}$/;function d(t){if(typeof t!="string"||!u.test(t))throw new Error("instance_id fehlt oder enthaelt Zeichen, die nicht in ein Hook-Skript gehoeren (erlaubt: Buchstaben, Ziffern, _ und -).");return t}function S(t){if(typeof t!="string"||!s.test(t))throw new Error("Der API-Schluessel enthaelt Zeichen, die nicht in ein Hook-Skript gehoeren (erlaubt: Buchstaben, Ziffern, ., _, ~ und -).");return t}function g(t){return`'${t.replace(/'/g,"'\\''")}'`}function m(t,e,n={}){return r("git",[...e],{cwd:t,encoding:"utf-8",stdio:["ignore","pipe",n.stderr??"ignore"],timeout:n.timeoutMs??5e3,windowsHide:!0})}export{g as alsShellWort,h as beginntMitBindestrich,m as gitLesen,d as instanzIdFuerSkript,a as istCommitHash,p as pruefeOrdner,S as schluesselFuerSkript};