@easbot/skills 0.3.11 → 0.3.12
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/README.en.md +166 -59
- package/README.md +172 -62
- package/dist/chunks/blob-DOVEGVIE.cjs +1 -0
- package/dist/chunks/blob-JSMTOYEN.mjs +1 -0
- package/dist/chunks/chunk-2VZUPTI7.cjs +1 -0
- package/dist/chunks/chunk-2YVJ7YP6.mjs +22 -0
- package/dist/chunks/chunk-4R6NKPNW.mjs +3 -0
- package/dist/chunks/chunk-676OG55M.mjs +5 -0
- package/dist/chunks/chunk-6PJ3YQA7.mjs +2 -0
- package/dist/chunks/chunk-72DXY4B7.mjs +1 -0
- package/dist/chunks/chunk-CFMOYU7R.mjs +2 -0
- package/dist/chunks/chunk-GR2NJUJ6.mjs +255 -0
- package/dist/chunks/chunk-JFEBB5CL.cjs +22 -0
- package/dist/chunks/chunk-KV7EP6AW.cjs +255 -0
- package/dist/chunks/chunk-OWG6N2K6.cjs +5 -0
- package/dist/chunks/chunk-RWSBKHQ2.cjs +3 -0
- package/dist/chunks/chunk-RWZ4LFSN.mjs +1 -0
- package/dist/chunks/chunk-S6YNGR7S.cjs +2 -0
- package/dist/chunks/chunk-TCFGU43L.cjs +2 -0
- package/dist/chunks/chunk-VRHWDHQV.cjs +1 -0
- package/dist/chunks/chunk-WQGSYA5D.mjs +1 -0
- package/dist/chunks/chunk-XGUPIAAF.cjs +1 -0
- package/dist/chunks/cli-handler-RAJ42VDN.mjs +1 -0
- package/dist/chunks/cli-handler-YAJ5J5VA.cjs +1 -0
- package/dist/chunks/installer-FB26E7JZ.mjs +1 -0
- package/dist/chunks/installer-GOQTCUJ4.cjs +1 -0
- package/dist/chunks/interfaces-S47ZGORM.mjs +1 -0
- package/dist/chunks/interfaces-UIS44Q7A.cjs +1 -0
- package/dist/chunks/local-lock-4AA55ORE.cjs +1 -0
- package/dist/chunks/local-lock-LG5YL33V.mjs +1 -0
- package/dist/chunks/scan-QEVID2TF.mjs +1 -0
- package/dist/chunks/scan-XWU3FCE3.cjs +1 -0
- package/dist/chunks/skill-lock-KHPVP7AD.mjs +1 -0
- package/dist/chunks/skill-lock-LET33FVT.cjs +1 -0
- package/dist/chunks/store-3NRBE47N.mjs +1 -0
- package/dist/chunks/store-EHYH46YY.cjs +1 -0
- package/dist/chunks/telemetry-7T6MUW5A.mjs +1 -0
- package/dist/chunks/telemetry-LCGTSJDM.cjs +1 -0
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +242 -127
- package/dist/index.d.ts +242 -127
- package/dist/index.mjs +1 -1
- package/package.json +4 -4
- package/dist/chunks/blob-LYSE5I24.mjs +0 -1
- package/dist/chunks/blob-NYUAIVUS.cjs +0 -1
- package/dist/chunks/chunk-4IO7TNWC.mjs +0 -223
- package/dist/chunks/chunk-IWCI7DET.mjs +0 -6
- package/dist/chunks/chunk-KJPMAUXZ.cjs +0 -1
- package/dist/chunks/chunk-L6KE3VIY.mjs +0 -2
- package/dist/chunks/chunk-PGDLW2JN.cjs +0 -2
- package/dist/chunks/chunk-S76WRD5J.cjs +0 -6
- package/dist/chunks/chunk-WQJKBJSM.cjs +0 -223
- package/dist/chunks/chunk-Y2X6FBMZ.mjs +0 -1
- package/dist/chunks/scan-47YPOLJX.mjs +0 -1
- package/dist/chunks/scan-5G765ZEF.cjs +0 -1
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import {u,c,F,n,s,z,J as J$1,w,t,x as x$1}from'./chunk-Y2X6FBMZ.mjs';import {readFile,writeFile,readdir,mkdir,cp,access,rm,realpath,lstat,readlink,symlink,stat}from'fs/promises';import {join,relative,dirname,normalize,resolve,sep,basename,extname}from'path';import {createHash}from'crypto';import {Glob,Wildcard}from'@easbot/utils';import {existsSync}from'fs';import {homedir,platform}from'os';var Ut="skills-lock.json",ft=1;function mt(t){return join(t||process.cwd(),Ut)}async function T(t){let e=mt(t);try{let n=await readFile(e,"utf-8"),s=JSON.parse(n);return typeof s.version!="number"||!s.skills||s.version<ft?Z():s}catch{return Z()}}async function gt(t,e){let n=mt(e),s={};for(let i of Object.keys(t.skills).sort())s[i]=t.skills[i];let r={version:t.version,skills:s},a=JSON.stringify(r,null,2)+`
|
|
2
|
-
`;await writeFile(n,a,"utf-8");}async function ye(t){let e=[];await pt(t,t,e),e.sort((s,r)=>s.relativePath.localeCompare(r.relativePath));let n=createHash("sha256");for(let s of e)n.update(s.relativePath),n.update(s.content);return n.digest("hex")}async function pt(t,e,n){let s=await readdir(e,{withFileTypes:true});await Promise.all(s.map(async r=>{let a=join(e,r.name);if(r.isDirectory()){if(r.name===".git"||r.name==="node_modules")return;await pt(t,a,n);}else if(r.isFile()){let i=await readFile(a),o=relative(t,a).split("\\").join("/");n.push({relativePath:o,content:i});}}));}async function Se(t,e,n){let s=await T(n);s.skills[t]=e,await gt(s,n);}async function ve(t,e){let n=await T(e);return t in n.skills?(delete n.skills[t],await gt(n,e),true):false}function Z(){return {version:ft,skills:{}}}function tt(t,e){let n=normalize(resolve(e)),s=normalize(resolve(t));return s.startsWith(n+sep)||s===n}function J(t){return t.startsWith("./")}async function wt(t){let e=new Map;try{let n=await readFile(join(t,".claude-plugin/marketplace.json"),"utf-8"),s=JSON.parse(n),r=s.metadata?.pluginRoot;if(r===void 0||J(r))for(let i of s.plugins??[]){if(!i.name||typeof i.source!="string"&&i.source!==void 0||i.source!==void 0&&!J(i.source))continue;let o=join(t,r??"",i.source??"");if(tt(o,t)&&i.skills&&i.skills.length>0)for(let p of i.skills){if(!J(p))continue;let d=join(o,p);tt(d,t)&&e.set(resolve(d),i.name);}}}catch{}try{let n=await readFile(join(t,".claude-plugin/plugin.json"),"utf-8"),s=JSON.parse(n);if(s.name&&s.skills&&s.skills.length>0)for(let r of s.skills){if(!J(r))continue;let a=join(t,r);tt(a,t)&&e.set(resolve(a),s.name);}}catch{}return e}var Vt=["node_modules",".git","dist","build","__pycache__"];async function Xt(t){let e=join(t,".gitignore");try{let n=await readFile(e,"utf-8");return Glob.parseGitignoreContent(n)}catch{return []}}function et(t){return t.toLowerCase().replace(/[\s_]+/g,"-")}function qt(t){return t.split(sep).join("/").replace(/\/+/g,"/")}function Qt(){let t=process.env.INSTALL_INTERNAL_SKILLS;return t==="1"||t==="true"}async function It(t){try{let e=join(t,"SKILL.md");return (await stat(e)).isFile()}catch{return false}}async function St(t,e){try{let n=await readFile(t,"utf-8"),{data:s}=u(n);if(!s.name||!s.description||typeof s.name!="string"||typeof s.description!="string")return null;let r=s.metadata&&typeof s.metadata=="object"&&!Array.isArray(s.metadata)?s.metadata:void 0;return r?.internal===!0&&!Qt()&&!e?.includeInternal?null:{name:c(s.name),description:c(s.description),path:dirname(t),rawContent:n,metadata:r}}catch{return null}}async function Dt(t,e=0,n=5){if(e>n)return [];try{let[s,r]=await Promise.all([It(t),readdir(t,{withFileTypes:!0}).catch(()=>[])]),a=s?[t]:[],i=await Promise.all(r.filter(o=>o.isDirectory()&&!Vt.includes(o.name)).map(o=>Dt(join(t,o.name),e+1,n)));return [...a,...i.flat()]}catch{return []}}function Yt(t,e){let n=normalize(resolve(t)),s=normalize(resolve(join(t,e)));return s.startsWith(n+sep)||s===n}async function Oe(t,e,n){let s=[],r=new Set,a=await T(t),i=new Set(Object.keys(a.skills).map(et));if(e&&!Yt(t,e))throw new Error(`Invalid subpath: "${e}" resolves outside the repository directory. Subpath must not contain ".." segments that escape the base path.`);let o=e?join(t,e):t,p=await wt(o),d=w=>{let y=resolve(w.path);return p.has(y)&&(w.pluginName=p.get(y)),w},g=F(),k=w=>{if(i.size===0)return false;let y=qt(relative(t,w.path));if(!g.some(at=>y===at||y.startsWith(`${at}/`)))return false;let Ot=et(w.name),zt=et(basename(w.path));return i.has(Ot)||i.has(zt)},l=async w=>{if(!await It(w))return false;let y=await St(join(w,"SKILL.md"),n);return !y||r.has(y.name)||k(y)||(y=d(y),s.push(y),r.add(y.name)),true},h=e?e.replace(/^\/+|\/+$/g,"").split("/").filter(w=>w.length>0):[],f=h.length>0?`**/${h.join("/")}/**/SKILL.md`:"**/SKILL.md",c=await Glob.scan(f,{cwd:o,absolute:true,ignore:[...Glob.DEFAULT_IGNORE_PATTERNS,...await Xt(o)]}),u="/",P=o.split(sep).join(u);c.sort((w,y)=>w.split(u).length-y.split(u).length);let E=[];for(let w of c){if(E.some(v=>w.startsWith(`${v}${u}`)||w===v))continue;let y=dirname(w);if(await l(y)){let v=y.split(sep).join(u);if(v===P)continue;E.push(v);}}if(s.length===0||n?.fullDepth){let w=await Dt(o);for(let y of w){let v=await St(join(y,"SKILL.md"),n);v&&!r.has(v.name)&&!k(v)&&(v=d(v),s.push(v),r.add(v.name));}}return s}function Zt(t){return t.name||basename(t.path)}function ze(t,e){let n=e.map(s=>s.toLowerCase());return t.filter(s=>{let r=s.name.toLowerCase(),a=Zt(s).toLowerCase();return n.some(i=>i===r||i===a)})}var Ft="*";function Be(t,e){if(!t||t.length===0)return [];let n=new Set(e),s=[];for(let r of t)if(r!==Ft){if(r.includes("/")||r.includes("**")){s.push(r);continue}xt.test(r)?e.some(a=>Wildcard.match(a,r))||s.push(r):n.has(r)||s.push(r);}return s}function Ke(t,e){let n={wildcard:false,matched:[],invalid:[]};if(!t||t.length===0)return n;let s=new Set(e),r=new Set;for(let a of t){if(a===Ft){n.wildcard=true;continue}if(a.includes("/")||a.includes("**")){n.invalid.push(a);continue}if(xt.test(a))for(let i of e)Wildcard.match(i,a)&&r.add(i);else s.has(a)?r.add(a):n.invalid.push(a);}return n.matched=Array.from(r),n}var xt=/[*?[{}]/;var At=".agents",Et="skills",Ue=".agents/skills";function x(t){return t.toLowerCase().replace(/[^a-z0-9._]+/g,"-").replace(/^[.-]+|[.-]+$/g,"").substring(0,255)||"unnamed-skill"}function S(t,e){let n=normalize(resolve(t)),s=normalize(resolve(e));return s.startsWith(n+sep)||s===n}function Ct(t,e){return S(t,e)||S(e,t)}function _(t,e){let n$1=t?n()||homedir():e||s()||process.cwd();return join(n$1,At,Et)}function jt(t,e){let n=e||s()||process.cwd();return join(n,z,x(t),"skills")}function D(t,e,n$1,s$1){if(J$1(t))return _(e,n$1);if(t==="eve"&&s$1)return jt(s$1,n$1);let r=w[t],a=n()||homedir(),i=e?a:n$1||s()||process.cwd();return e?r.globalSkillsDir===void 0?join(i,r.skillsDir):r.globalSkillsDir:join(i,r.skillsDir)}function ue(t,e){return resolve(dirname(t),e)}async function I(t){try{await rm(t,{recursive:!0,force:!0});}catch{}await mkdir(t,{recursive:true});}async function K(t$1,e){try{let n=resolve(t$1),s=resolve(e),[r,a]=await Promise.all([realpath(n).catch(()=>n),realpath(s).catch(()=>s)]);if(r===a)return !0;let i=t(t$1),o=t(e);if(i===o)return !0;try{if((await lstat(e)).isSymbolicLink()){let f=await readlink(e);if(ue(e,f)===n)return !0;await rm(e);}else await rm(e,{recursive:!0});}catch(h){if(h&&typeof h=="object"&&"code"in h&&h.code==="ELOOP")try{await rm(e,{force:!0});}catch{}}let p=dirname(e);await mkdir(p,{recursive:!0});let d=t(p),g=relative(d,t$1),k=platform()==="win32"?"junction":void 0;return await symlink(k==="junction"?n:g,e,k),!0}catch{return false}}async function en(t$1,e,n={}){let s=w[e],r=n.global??false,a=n.cwd||process.cwd(),i=n.eveSubagent;if(r&&s.globalSkillsDir===void 0)return {success:false,path:"",mode:n.mode??"symlink",error:`${s.displayName} does not support global skill installation`};let o=t$1.name||basename(t$1.path),p=x(o),d=n.mode??"symlink",k=e==="eve"&&d==="symlink"?D(e,r,a,i):_(r,a),l=join(k,p),h=D(e,r,a,i),f=join(h,p),c=t(l),u=t(f);if(!S(k,l))return {success:false,path:f,mode:d,error:"Invalid skill name: potential path traversal detected"};if(!S(h,f))return {success:false,path:f,mode:d,error:"Invalid skill name: potential path traversal detected"};try{if(Ct(t$1.path,u))return {success:!0,path:u,mode:d,skipped:!0};if(d==="copy")return await I(u),await O(t$1.path,u,e),{success:!0,path:u,canonicalPath:c,mode:"copy"};if(Ct(t$1.path,c))return {success:!0,path:c,canonicalPath:c,mode:"symlink",skipped:!0};if(await I(c),await O(t$1.path,c,e),r&&J$1(e))return {success:!0,path:c,canonicalPath:c,mode:"symlink"};if(!r&&!J$1(e)){let E=join(a,w[e].skillsDir.split("/")[0]);if(!existsSync(E))return {success:!0,path:c,canonicalPath:c,mode:"symlink",skipped:!0}}return c===u?{success:!0,path:u,canonicalPath:c,mode:"copy"}:await K(c,u)?{success:!0,path:u,canonicalPath:c,mode:"symlink"}:(await I(u),await O(t$1.path,u,e),{success:!0,path:u,canonicalPath:c,mode:"symlink",symlinkFailed:!0})}catch(P){return {success:false,path:u,mode:d,error:P instanceof Error?P.message:"Unknown error"}}}async function nn(t$1,e,n={}){let{isGlobal:s=false,agentType:r,cwd:a}=n,i=t(t$1),o=t(e);if(i===o)return {success:true,path:o,canonicalPath:t$1,mode:"copy"};if(!s&&r&&a&&!J$1(r)){let d=join(a,w[r].skillsDir.split("/")[0]);if(!existsSync(d))return {success:true,path:e,canonicalPath:t$1,mode:"symlink",skipped:true}}return await K(i,o)?{success:true,path:e,canonicalPath:t$1,mode:"symlink"}:{success:true,path:e,canonicalPath:t$1,mode:"symlink",symlinkFailed:true}}async function sn(t$1,e,n={}){let{agentType:s="easbot"}=n,r=t(t$1),a=t(e);if(r===a)return {success:true,path:a,canonicalPath:t$1,mode:"copy"};try{return await I(a),await O(r,a,s),{success:!0,path:a,canonicalPath:t$1,mode:"copy"}}catch(i){return {success:false,path:e,mode:"copy",error:i instanceof Error?i.message:"Unknown error"}}}var de=new Set(["metadata.json"]),fe=new Set([".git","__pycache__","__pypackages__"]),me=(t,e=false)=>!!(de.has(t)||e&&fe.has(t));function A(t){let{data:e,content:n}=u(t),s={};if(typeof e.description=="string"&&(s.description=e.description),typeof e.license=="string"&&(s.license=e.license),e.metadata&&typeof e.metadata=="object"&&!Array.isArray(e.metadata)){let i=Object.fromEntries(Object.entries(e.metadata).filter(o=>typeof o[1]=="string"));Object.keys(i).length>0&&(s.metadata=i);}let r=Object.keys(s);return r.length===0?n.replace(/^\r?\n/u,""):`---
|
|
3
|
-
${r.map(i=>`${i}: ${JSON.stringify(s[i])}`).join(`
|
|
4
|
-
`)}
|
|
5
|
-
---
|
|
6
|
-
${n.replace(/^\r?\n/u,"")}`}async function O(t,e,n){await mkdir(e,{recursive:true});let s=await readdir(t,{withFileTypes:true});await Promise.all(s.filter(r=>!me(r.name,r.isDirectory())).map(async r=>{let a=join(t,r.name),i=join(e,r.name);if(r.isDirectory())await O(a,i,n);else try{if(n==="eve"&&r.name.toLowerCase()==="skill.md"){await writeFile(i,A(await readFile(a,"utf-8")));return}await cp(a,i,{dereference:!0,recursive:!0});}catch(o){if(o instanceof Error&&"code"in o&&o.code==="ENOENT"&&r.isSymbolicLink())console.warn(`Skipping broken symlink: ${a}`);else throw o}}));}function ge(t){return t.some(e=>basename(e.path).toLowerCase()==="skill.md")}function X(t){return `${x(t)}.md`}function pe(t){let e=t.find(s=>basename(s.path).toLowerCase()==="skill.md");if(e)return A(e.contents);let n=t.find(s=>extname(s.path).toLowerCase()===".md");return n?A(n.contents):""}async function rn(t,e,n={}){let s=w[e],r=x(t);if(n.global&&s.globalSkillsDir===void 0)return false;let a=n.global?s.globalSkillsDir:e==="eve"&&n.eveSubagent?jt(n.eveSubagent,n.cwd):join(n.cwd||process.cwd(),s.skillsDir),i=join(a,r);if(!S(a,i))return false;try{return await access(i),!0}catch{return false}}function an(t,e,n={}){w[e];n.cwd||process.cwd();let a=x(t),i=D(e,n.global??false,n.cwd,n.eveSubagent),o=join(i,a);if(!S(i,o))throw new Error("Invalid skill name: potential path traversal detected");return o}async function it(t,e){try{return await access(join(t,"SKILL.md")),{created:!1}}catch{}return await mkdir(t,{recursive:true}),await e(t),{created:true}}function on(t,e={}){let n=x(t),s=e.agent==="eve"?D("eve",e.global??false,e.cwd,e.eveSubagent):_(e.global??false,e.cwd),r=join(s,n);if(!S(s,r))throw new Error("Invalid skill name: potential path traversal detected");return r}async function ln(t,e,n={}){let s=w[e],r=n.global??false,a=n.cwd||process.cwd(),i=n.mode??"symlink",o=n.eveSubagent;if(r&&s.globalSkillsDir===void 0)return {success:false,path:"",mode:i,error:`${s.displayName} does not support global skill installation`};let p=x(t.installName),d=e==="eve"&&i==="symlink"?D(e,r,a,o):_(r,a),g=join(d,p),k=D(e,r,a,o),l=join(k,p);if(!S(d,g))return {success:false,path:l,mode:i,error:"Invalid skill name: potential path traversal detected"};if(!S(k,l))return {success:false,path:l,mode:i,error:"Invalid skill name: potential path traversal detected"};try{if(i==="copy"){await I(l);let c=e==="eve"?X(t.installName):"SKILL.md",u=join(l,c);return await writeFile(u,e==="eve"?A(t.content):t.content,"utf-8"),{success:!0,path:l,mode:"copy"}}let h=e==="eve"?X(t.installName):"SKILL.md";if(await it(g,async c=>{let u=join(c,h);await writeFile(u,e==="eve"?A(t.content):t.content,"utf-8");}),r&&J$1(e))return {success:!0,path:g,canonicalPath:g,mode:"symlink"};if(!await K(g,l)){await I(l);let c=e==="eve"?X(t.installName):"SKILL.md",u=join(l,c);return await writeFile(u,e==="eve"?A(t.content):t.content,"utf-8"),{success:!0,path:l,canonicalPath:g,mode:"symlink",symlinkFailed:!0}}return {success:!0,path:l,canonicalPath:g,mode:"symlink"}}catch(h){return {success:false,path:l,mode:i,error:h instanceof Error?h.message:"Unknown error"}}}async function cn(t,e,n={}){let s=w[e],r=n.global??false,a=n.cwd||process.cwd(),i=n.mode??"symlink",o=n.eveSubagent;if(r&&s.globalSkillsDir===void 0)return {success:false,path:"",mode:i,error:`${s.displayName} does not support global skill installation`};let p=x(t.installName),d=e==="eve"&&i==="symlink"?D(e,r,a,o):_(r,a),g=join(d,p),k=D(e,r,a,o),l=join(k,p);if(!S(d,g))return {success:false,path:l,mode:i,error:"Invalid skill name: potential path traversal detected"};if(!S(k,l))return {success:false,path:l,mode:i,error:"Invalid skill name: potential path traversal detected"};async function h(f){for(let[c,u]of t.files){let P=join(f,c);if(!S(f,P))continue;let E=dirname(P);E!==f&&await mkdir(E,{recursive:true}),await writeFile(P,e==="eve"&&basename(c).toLowerCase()==="skill.md"&&typeof u=="string"?A(u):u);}}try{return i==="copy"?(await I(l),await h(l),{success:!0,path:l,mode:"copy"}):(await it(g,h),r&&J$1(e)?{success:!0,path:g,canonicalPath:g,mode:"symlink"}:await K(g,l)?{success:!0,path:l,canonicalPath:g,mode:"symlink"}:(await I(l),await h(l),{success:!0,path:l,canonicalPath:g,mode:"symlink",symlinkFailed:!0}))}catch(f){return {success:false,path:l,mode:i,error:f instanceof Error?f.message:"Unknown error"}}}async function un(t,e,n={}){let s=w[e],r=n.global??false,a=n.cwd||process.cwd(),i=n.mode??"symlink",o=n.eveSubagent;if(r&&s.globalSkillsDir===void 0)return {success:false,path:"",mode:i,error:`${s.displayName} does not support global skill installation`};let p=x(t.installName),d=D(e,r,a,o);if(e==="eve"&&!ge(t.files)){let f=join(d,X(t.installName));if(!S(d,f))return {success:false,path:f,mode:i,error:"Invalid skill name: potential path traversal detected"};try{return await mkdir(d,{recursive:!0}),await rm(f,{recursive:!0,force:!0}),await writeFile(f,pe(t.files),"utf-8"),{success:!0,path:f,mode:"copy"}}catch(c){return {success:false,path:f,mode:i,error:c instanceof Error?c.message:"Unknown error"}}}let g=e==="eve"&&i==="symlink"?D(e,r,a,o):_(r,a),k=join(g,p),l=join(d,p);if(!S(g,k))return {success:false,path:l,mode:i,error:"Invalid skill name: potential path traversal detected"};if(!S(d,l))return {success:false,path:l,mode:i,error:"Invalid skill name: potential path traversal detected"};async function h(f){for(let c of t.files){let u=join(f,c.path);if(!S(f,u))continue;let P=dirname(u);P!==f&&await mkdir(P,{recursive:true}),await writeFile(u,e==="eve"&&basename(c.path).toLowerCase()==="skill.md"?A(c.contents):c.contents,"utf-8");}}try{if(i==="copy")return await I(l),await h(l),{success:!0,path:l,mode:"copy"};if(await it(k,h),r&&J$1(e))return {success:!0,path:k,canonicalPath:k,mode:"symlink"};if(!r&&!J$1(e)){let c=join(a,w[e].skillsDir.split("/")[0]);if(!existsSync(c))return {success:!0,path:k,canonicalPath:k,mode:"symlink",skipped:!0}}return await K(k,l)?{success:!0,path:l,canonicalPath:k,mode:"symlink"}:(await I(l),await h(l),{success:!0,path:l,canonicalPath:k,mode:"symlink",symlinkFailed:!0})}catch(f){return {success:false,path:l,mode:i,error:f instanceof Error?f.message:"Unknown error"}}}async function dn(t={}){let e=t.cwd||process.cwd(),{scanInstalledSkillDirs:n}=await import('./scan-47YPOLJX.mjs'),s=t.agentFilter?null:await x$1(),r=t.agentFilter??s??void 0,a=await n({global:t.global,cwd:e,agentFilter:r}),i=new Map;for(let o of a){let p=`${o.scope}:${o.name}`,d=i.get(p);if(d){for(let g of o.agents)d.agents.includes(g)||d.agents.push(g);continue}i.set(p,{name:o.name,description:"",path:o.skillDir,canonicalPath:o.skillDir,scope:o.scope,agents:[...o.agents]});}return Array.from(i.values())}export{on as A,ln as B,cn as C,un as D,dn as E,mt as a,T as b,gt as c,ye as d,Se as e,ve as f,Qt as g,St as h,Yt as i,Oe as j,Zt as k,ze as l,Be as m,Ke as n,At as o,Et as p,Ue as q,x as r,_ as s,jt as t,D as u,en as v,nn as w,sn as x,rn as y,an as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var os=require('os'),path=require('path'),fs=require('fs'),xdgBasedir=require('xdg-basedir'),yaml=require('yaml'),utils=require('@easbot/utils');var F=Object.defineProperty;var K=(s,t,i)=>t in s?F(s,t,{enumerable:true,configurable:true,writable:true,value:i}):s[t]=i;var ue=(s,t,i)=>K(s,typeof t!="symbol"?t+"":t,i);var X=()=>typeof document>"u"?new URL(`file:${__filename}`).href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"?document.currentScript.src:new URL("main.js",document.baseURI).href,b=X();var J=/\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]/g,$=/\x1b\][\s\S]*?(?:\x07|\x1b\\)/g,W=/\x1b[P^_][\s\S]*?(?:\x1b\\)/g,Z=/\x1b[\x20-\x7e]/g,Q=/[\x80-\x9f]/g,V=/[\x00-\x06\x07\x08\x0b\x0c\x0d-\x1a\x1c-\x1f\x7f]/g;function Y(s){return s.replace($,"").replace(W,"").replace(J,"").replace(Z,"").replace(Q,"").replace(V,"")}function be(s){return Y(s).replace(/[\r\n]+/g," ").trim()}var m=null,p=null,u=null;function we(s){m=s;}function Ne(){m=null;}function y(){if(m)return m;let s=os.homedir();return {Path:{home:s,data:process.env.EASBOT_DATA_PATH?.trim()||path.join(xdgBasedir.xdgData??path.join(s,".local","share"),"easbot"),config:process.env.EASBOT_CONFIG_PATH?.trim()||path.join(xdgBasedir.xdgConfig??path.join(s,".config"),"easbot"),state:process.env.EASBOT_STATE_PATH?.trim()||path.join(xdgBasedir.xdgState??path.join(xdgBasedir.xdgData??path.join(s,".local","share"),"easbot"),"state"),cache:process.env.EASBOT_CACHE_PATH?.trim()||path.join(xdgBasedir.xdgCache??path.join(s,".cache"),"easbot"),log:process.env.EASBOT_LOG_PATH?.trim()||path.join(xdgBasedir.xdgState??path.join(xdgBasedir.xdgData??path.join(s,".local","share"),"easbot"),"log"),bin:process.env.EASBOT_BIN_PATH?.trim()||path.join(s,".local","bin")}}}function he(s){p=s;}function Ce(){p=null;}function se(){if(p)return p;let s=process.cwd();return {directory:s,worktree:s}}function Te(s){u=s,s&&(m=s.global,p=s.instance);}function _e(){return u}function je(){return u!==null}function Pe(){if(!u)throw new Error("Skills agent adapter not set. Call setAgentAdapter() before using skills commands that depend on subAgentRunner.");return u}function k(){return y().Path.home||os.homedir()}function A(){let s=y().Path.config;return s||(xdgBasedir.xdgConfig??path.join(k(),".config"))}function ne(){let s=y().Path.data;return s||(xdgBasedir.xdgData??path.join(k(),".local","share"))}function Ee(){let s=y().Path.state;return s||(xdgBasedir.xdgState??path.join(ne(),"state"))}function Le(){let s=y().Path.cache;return s||(xdgBasedir.xdgCache??path.join(k(),".cache"))}function Oe(){return se().directory||process.cwd()}function Re(s){let t=path.resolve(s),i=t.split(path.sep).filter(Boolean);for(let r=1;r<=i.length;r+=1){let c=path.sep+i.slice(0,r).join(path.sep);try{let g=fs.realpathSync(c),f=i.slice(r).join(path.sep);return f?path.join(g,f):g}catch{}}return t}function Ue(s){let t=s.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);return t?{data:yaml.parse(t[1])??{},content:t[2]??""}:{data:{},content:s}}var l=k(),d=A()||xdgBasedir.xdgConfig||path.join(l,".config"),C=process.env.CODEX_HOME?.trim()||path.join(l,".codex"),T=process.env.CLAUDE_CONFIG_DIR?.trim()||path.join(l,".claude"),_=process.env.VIBE_HOME?.trim()||path.join(l,".vibe"),j=process.env.HERMES_HOME?.trim()||path.join(l,".hermes"),P=process.env.AUTOHAND_HOME?.trim()||path.join(l,".autohand"),E=process.env.APPDATA?.trim(),L=process.env.FLATPAK_XDG_CONFIG_HOME?.trim();function ce(s,t){try{let i=JSON.parse(fs.readFileSync(s,"utf-8"));return !!(i.dependencies?.[t]||i.devDependencies?.[t])}catch{return false}}function de(s=l,t=fs.existsSync){return t(path.join(s,".openclaw"))?path.join(s,".openclaw/skills"):t(path.join(s,".clawdbot"))?path.join(s,".clawdbot/skills"):t(path.join(s,".moltbot"))?path.join(s,".moltbot/skills"):path.join(s,".openclaw/skills")}var o={easbot:{name:"easbot",displayName:"EASBot",skillsDir:".easbot/skills",get globalSkillsDir(){return path.join(A(),"easbot","skills")},detectInstalled:async()=>true,showInUniversalList:true,isUniversalShared:!(process.env.EASBOT_DISABLE_EXTERNAL_SKILLS==="1"||process.env.EASBOT_DISABLE_EXTERNAL_SKILLS==="true"),showInUniversalPrompt:true},"aider-desk":{name:"aider-desk",displayName:"AiderDesk",skillsDir:".aider-desk/skills",globalSkillsDir:path.join(l,".aider-desk/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".aider-desk"))},amp:{name:"amp",displayName:"Amp",skillsDir:".agents/skills",globalSkillsDir:path.join(d,"agents/skills"),detectInstalled:async()=>fs.existsSync(path.join(d,"amp"))},antigravity:{name:"antigravity",displayName:"Antigravity",skillsDir:".agents/skills",globalSkillsDir:path.join(l,".gemini/antigravity/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".gemini/antigravity"))},"antigravity-cli":{name:"antigravity-cli",displayName:"Antigravity CLI",skillsDir:".agents/skills",globalSkillsDir:path.join(l,".gemini/antigravity-cli/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".gemini/antigravity-cli"))},astrbot:{name:"astrbot",displayName:"AstrBot",skillsDir:"data/skills",globalSkillsDir:path.join(l,".astrbot/data/skills"),detectInstalled:async()=>fs.existsSync(path.join(process.cwd(),"data/skills"))||fs.existsSync(path.join(l,".astrbot"))},"autohand-code":{name:"autohand-code",displayName:"Autohand Code CLI",skillsDir:".autohand/skills",globalSkillsDir:path.join(P,"skills"),detectInstalled:async()=>fs.existsSync(P)},augment:{name:"augment",displayName:"Augment",skillsDir:".augment/skills",globalSkillsDir:path.join(l,".augment/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".augment"))},bob:{name:"bob",displayName:"IBM Bob",skillsDir:".bob/skills",globalSkillsDir:path.join(l,".bob/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".bob"))},"claude-code":{name:"claude-code",displayName:"Claude Code",skillsDir:".claude/skills",globalSkillsDir:path.join(T,"skills"),detectInstalled:async()=>fs.existsSync(T)},openclaw:{name:"openclaw",displayName:"OpenClaw",skillsDir:".openclaw/skills",globalSkillsDir:de(),detectInstalled:async()=>fs.existsSync(path.join(l,".openclaw"))||fs.existsSync(path.join(l,".clawdbot"))||fs.existsSync(path.join(l,".moltbot"))},cline:{name:"cline",displayName:"Cline",skillsDir:".agents/skills",globalSkillsDir:path.join(l,".agents","skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".cline"))},"codearts-agent":{name:"codearts-agent",displayName:"CodeArts Agent",skillsDir:".codeartsdoer/skills",globalSkillsDir:path.join(l,".codeartsdoer/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".codeartsdoer"))},codebuddy:{name:"codebuddy",displayName:"CodeBuddy",skillsDir:".codebuddy/skills",globalSkillsDir:path.join(l,".codebuddy/skills"),detectInstalled:async()=>fs.existsSync(path.join(process.cwd(),".codebuddy"))||fs.existsSync(path.join(l,".codebuddy"))},codemaker:{name:"codemaker",displayName:"Codemaker",skillsDir:".codemaker/skills",globalSkillsDir:path.join(l,".codemaker/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".codemaker"))},codestudio:{name:"codestudio",displayName:"Code Studio",skillsDir:".codestudio/skills",globalSkillsDir:path.join(l,".codestudio/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".codestudio"))},codex:{name:"codex",displayName:"Codex",skillsDir:".agents/skills",globalSkillsDir:path.join(C,"skills"),detectInstalled:async()=>fs.existsSync(C)||fs.existsSync("/etc/codex")},"command-code":{name:"command-code",displayName:"Command Code",skillsDir:".commandcode/skills",globalSkillsDir:path.join(l,".commandcode/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".commandcode"))},continue:{name:"continue",displayName:"Continue",skillsDir:".continue/skills",globalSkillsDir:path.join(l,".continue/skills"),detectInstalled:async()=>fs.existsSync(path.join(process.cwd(),".continue"))||fs.existsSync(path.join(l,".continue"))},cortex:{name:"cortex",displayName:"Cortex Code",skillsDir:".cortex/skills",globalSkillsDir:path.join(l,".snowflake/cortex/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".snowflake/cortex"))},crush:{name:"crush",displayName:"Crush",skillsDir:".crush/skills",globalSkillsDir:path.join(l,".config/crush/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".config/crush"))},cursor:{name:"cursor",displayName:"Cursor",skillsDir:".agents/skills",globalSkillsDir:path.join(l,".cursor/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".cursor"))},deepagents:{name:"deepagents",displayName:"Deep Agents",skillsDir:".agents/skills",globalSkillsDir:path.join(l,".deepagents/agent/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".deepagents"))},devin:{name:"devin",displayName:"Devin for Terminal",skillsDir:".devin/skills",globalSkillsDir:path.join(d,"devin/skills"),detectInstalled:async()=>fs.existsSync(path.join(d,"devin"))},dexto:{name:"dexto",displayName:"Dexto",skillsDir:".agents/skills",globalSkillsDir:path.join(l,".agents/skills"),showInUniversalPrompt:false,detectInstalled:async()=>fs.existsSync(path.join(l,".dexto"))},droid:{name:"droid",displayName:"Droid",skillsDir:".factory/skills",globalSkillsDir:path.join(l,".factory/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".factory"))},eve:{name:"eve",displayName:"Eve",skillsDir:"agent/skills",globalSkillsDir:void 0,detectInstalled:async()=>{let s=process.cwd();return fs.existsSync(path.join(s,"agent"))&&ce(path.join(s,"package.json"),"eve")}},firebender:{name:"firebender",displayName:"Firebender",skillsDir:".agents/skills",globalSkillsDir:path.join(l,".firebender/skills"),showInUniversalPrompt:false,detectInstalled:async()=>fs.existsSync(path.join(l,".firebender"))},forgecode:{name:"forgecode",displayName:"ForgeCode",skillsDir:".forge/skills",globalSkillsDir:path.join(l,".forge/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".forge"))},"gemini-cli":{name:"gemini-cli",displayName:"Gemini CLI",skillsDir:".agents/skills",globalSkillsDir:path.join(l,".gemini/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".gemini"))},"github-copilot":{name:"github-copilot",displayName:"GitHub Copilot",skillsDir:".agents/skills",globalSkillsDir:path.join(l,".copilot/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".copilot"))},goose:{name:"goose",displayName:"Goose",skillsDir:".goose/skills",globalSkillsDir:path.join(d,"goose/skills"),detectInstalled:async()=>fs.existsSync(path.join(d,"goose"))},"hermes-agent":{name:"hermes-agent",displayName:"Hermes Agent",skillsDir:".hermes/skills",globalSkillsDir:path.join(j,"skills"),detectInstalled:async()=>fs.existsSync(j)},"inference-sh":{name:"inference-sh",displayName:"inference.sh",skillsDir:".inferencesh/skills",globalSkillsDir:path.join(l,".inferencesh/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".inferencesh"))},jazz:{name:"jazz",displayName:"Jazz",skillsDir:".jazz/skills",globalSkillsDir:path.join(l,".jazz/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".jazz"))||fs.existsSync(path.join(process.cwd(),".jazz"))},junie:{name:"junie",displayName:"Junie",skillsDir:".junie/skills",globalSkillsDir:path.join(l,".junie/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".junie"))},"iflow-cli":{name:"iflow-cli",displayName:"iFlow CLI",skillsDir:".iflow/skills",globalSkillsDir:path.join(l,".iflow/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".iflow"))},kilo:{name:"kilo",displayName:"Kilo Code",skillsDir:".kilocode/skills",globalSkillsDir:path.join(l,".kilocode/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".kilocode"))},"kimi-code-cli":{name:"kimi-code-cli",displayName:"Kimi Code CLI",skillsDir:".agents/skills",globalSkillsDir:path.join(l,".agents/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".kimi-code"))||fs.existsSync(path.join(l,".kimi"))},"kiro-cli":{name:"kiro-cli",displayName:"Kiro CLI",skillsDir:".kiro/skills",globalSkillsDir:path.join(l,".kiro/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".kiro"))},kode:{name:"kode",displayName:"Kode",skillsDir:".kode/skills",globalSkillsDir:path.join(l,".kode/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".kode"))},lingma:{name:"lingma",displayName:"Lingma",skillsDir:".lingma/skills",globalSkillsDir:path.join(l,".lingma/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".lingma"))},loaf:{name:"loaf",displayName:"Loaf",skillsDir:".agents/skills",globalSkillsDir:path.join(l,".agents/skills"),showInUniversalPrompt:false,detectInstalled:async()=>fs.existsSync(path.join(l,".loaf"))},mcpjam:{name:"mcpjam",displayName:"MCPJam",skillsDir:".mcpjam/skills",globalSkillsDir:path.join(l,".mcpjam/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".mcpjam"))},"mistral-vibe":{name:"mistral-vibe",displayName:"Mistral Vibe",skillsDir:".vibe/skills",globalSkillsDir:path.join(_,"skills"),detectInstalled:async()=>fs.existsSync(_)},moxby:{name:"moxby",displayName:"Moxby",skillsDir:".moxby/skills",globalSkillsDir:path.join(l,".moxby/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".moxby"))},mux:{name:"mux",displayName:"Mux",skillsDir:".mux/skills",globalSkillsDir:path.join(l,".mux/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".mux"))},opencode:{name:"opencode",displayName:"OpenCode",skillsDir:".agents/skills",globalSkillsDir:path.join(d,"opencode/skills"),detectInstalled:async()=>fs.existsSync(path.join(d,"opencode"))},openhands:{name:"openhands",displayName:"OpenHands",skillsDir:".openhands/skills",globalSkillsDir:path.join(l,".openhands/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".openhands"))},ona:{name:"ona",displayName:"Ona",skillsDir:".ona/skills",globalSkillsDir:path.join(l,".ona/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".ona"))},pi:{name:"pi",displayName:"Pi",skillsDir:".pi/skills",globalSkillsDir:path.join(l,".pi/agent/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".pi/agent"))},qoder:{name:"qoder",displayName:"Qoder",skillsDir:".qoder/skills",globalSkillsDir:path.join(l,".qoder/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".qoder"))},"qoder-cn":{name:"qoder-cn",displayName:"Qoder CN",skillsDir:".qoder/skills",globalSkillsDir:path.join(l,".qoder-cn/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".qoder-cn"))},"qwen-code":{name:"qwen-code",displayName:"Qwen Code",skillsDir:".qwen/skills",globalSkillsDir:path.join(l,".qwen/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".qwen"))},replit:{name:"replit",displayName:"Replit",skillsDir:".agents/skills",globalSkillsDir:path.join(d,"agents/skills"),showInUniversalList:false,detectInstalled:async()=>fs.existsSync(path.join(process.cwd(),".replit"))},reasonix:{name:"reasonix",displayName:"Reasonix",skillsDir:".reasonix/skills",globalSkillsDir:path.join(l,".reasonix/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".reasonix"))},rovodev:{name:"rovodev",displayName:"Rovo Dev",skillsDir:".rovodev/skills",globalSkillsDir:path.join(l,".rovodev/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".rovodev"))},roo:{name:"roo",displayName:"Roo Code",skillsDir:".roo/skills",globalSkillsDir:path.join(l,".roo/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".roo"))},"tabnine-cli":{name:"tabnine-cli",displayName:"Tabnine CLI",skillsDir:".tabnine/agent/skills",globalSkillsDir:path.join(l,".tabnine/agent/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".tabnine"))},terramind:{name:"terramind",displayName:"Terramind",skillsDir:".terramind/skills",globalSkillsDir:path.join(l,".terramind/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".terramind"))},tinycloud:{name:"tinycloud",displayName:"Tinycloud",skillsDir:".tinycloud/skills",globalSkillsDir:path.join(l,".tinycloud/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".tinycloud"))},trae:{name:"trae",displayName:"Trae",skillsDir:".trae/skills",globalSkillsDir:path.join(l,".trae/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".trae"))},"trae-cn":{name:"trae-cn",displayName:"Trae CN",skillsDir:".trae/skills",globalSkillsDir:path.join(l,".trae-cn/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".trae-cn"))},warp:{name:"warp",displayName:"Warp",skillsDir:".agents/skills",globalSkillsDir:path.join(l,".agents/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".warp"))},windsurf:{name:"windsurf",displayName:"Windsurf",skillsDir:".windsurf/skills",globalSkillsDir:path.join(l,".codeium/windsurf/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".codeium/windsurf"))},zed:{name:"zed",displayName:"Zed",skillsDir:".agents/skills",globalSkillsDir:path.join(l,".agents/skills"),detectInstalled:async()=>fs.existsSync(path.join(d,"zed"))||!!E&&fs.existsSync(path.join(E,"Zed"))||!!L&&fs.existsSync(path.join(L,"zed"))},zencoder:{name:"zencoder",displayName:"Zencoder",skillsDir:".zencoder/skills",globalSkillsDir:path.join(l,".zencoder/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".zencoder"))},zenflow:{name:"zenflow",displayName:"Zenflow",skillsDir:".zencoder/skills",globalSkillsDir:path.join(l,".zencoder/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".zencoder"))},neovate:{name:"neovate",displayName:"Neovate",skillsDir:".neovate/skills",globalSkillsDir:path.join(l,".neovate/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".neovate"))},pochi:{name:"pochi",displayName:"Pochi",skillsDir:".pochi/skills",globalSkillsDir:path.join(l,".pochi/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".pochi"))},promptscript:{name:"promptscript",displayName:"PromptScript",skillsDir:".agents/skills",globalSkillsDir:void 0,showInUniversalPrompt:false,detectInstalled:async()=>fs.existsSync(path.join(process.cwd(),".promptscript"))||fs.existsSync(path.join(process.cwd(),"promptscript.yaml"))},adal:{name:"adal",displayName:"AdaL",skillsDir:".adal/skills",globalSkillsDir:path.join(l,".adal/skills"),detectInstalled:async()=>fs.existsSync(path.join(l,".adal"))},universal:{name:"universal",displayName:"Universal",skillsDir:".agents/skills",globalSkillsDir:path.join(d,"agents/skills"),showInUniversalList:false,detectInstalled:async()=>false}};async function We(){return (await Promise.all(Object.entries(o).map(async([t,i])=>({type:t,installed:await i.detectInstalled()})))).filter(t=>t.installed).map(t=>t.type)}function Ze(s){return o[s]}var R=path.join("agent","subagents");function ge(s=process.cwd()){let t=path.join(s,R);if(!fs.existsSync(t))return [];try{return fs.readdirSync(t,{withFileTypes:!0}).filter(i=>i.isDirectory()).map(i=>i.name).sort()}catch{return []}}function z(s,t){let i=o[s];if(t==="project")return i.skillsDir===".agents/skills";if(i.globalSkillsDir===void 0)return false;let r=path.resolve(k()||os.homedir(),".agents","skills");return path.resolve(i.globalSkillsDir)===r}function Qe(){return Object.entries(o).filter(([s,t])=>t.showInUniversalList!==false).filter(([s,t])=>z(s,"project")||t.isUniversalShared===true).map(([s])=>s)}function Ve(){let s=new Set(Object.entries(o).filter(([t,i])=>z(t,"project")).map(([t])=>t));return Object.entries(o).filter(([t,i])=>i.showInUniversalList!==false).filter(([t])=>!s.has(t)).map(([t])=>t)}var G=/^\.[^/]+\/skills$/;function H(){let s=new Set;for(let t of Object.values(o))t.skillsDir&&G.test(t.skillsDir)&&s.add(t.skillsDir);return Array.from(s).sort()}function ke(){let s=new Set;for(let t of Object.values(o))t.globalSkillsDir!==void 0&&s.add(t.globalSkillsDir);return Array.from(s).sort()}function Ye(){let s=H(),t=ke(),i=Array.from(new Set([...s,...t])).sort();return {project:s,global:t,all:i}}function el(){return H().map(s=>`${s}/`)}function ll(s){return o[s].skillsDir===".agents/skills"}var U="*";function sl(s){if(!s||s.length===0)return [];let t=Object.keys(o),i=[];for(let r of s)if(r!==U){if(r.includes("/")||r.includes("**")){i.push(r);continue}B.test(r)?t.some(c=>utils.Wildcard.match(c,r))||i.push(r):t.includes(r)||i.push(r);}return i}function nl(s){if(!s||s.length===0)return [];let t=Object.keys(o);if(s.includes(U))return [...t];if(s.some(i=>B.test(i))){let i=new Set;for(let r of s)if(!(r.includes("/")||r.includes("**")))for(let c of t)utils.Wildcard.match(c,r)&&i.add(c);return Array.from(i)}return Array.from(new Set(s.filter(i=>!i.includes("/")&&!i.includes("**"))))}var B=/[*?[{}]/;function me(s={}){let t=s.cwd??process.cwd(),i=s.agentFilter??Object.keys(o),r=new Set;for(let c of i){let g=o[c];if(!g.skillsDir||!G.test(g.skillsDir))continue;let f=g.skillsDir===".agents/skills"?path.join(t,".agents","skills"):path.join(t,g.skillsDir);if(c==="eve")for(let M of ge(t)){let q=path.join(t,R,M,"skills");r.add(x(`${q}/**/SKILL.md`));}r.add(x(`${f}/**/SKILL.md`));}return Array.from(r).sort()}function pe(s={}){let t=s.agentFilter??Object.keys(o),i=new Set;for(let r of t){let c=o[r];c.globalSkillsDir!==void 0&&i.add(x(`${c.globalSkillsDir}/**/SKILL.md`));}return Array.from(i).sort()}function tl(s={}){let t=me(s),i=pe(s),r=Array.from(new Set([...t,...i])).sort();return {project:t,global:i,all:r}}function x(s){return s.replace(/\\/g,"/")}exports.A=R;exports.B=ge;exports.C=z;exports.D=Qe;exports.E=Ve;exports.F=G;exports.G=H;exports.H=ke;exports.I=Ye;exports.J=el;exports.K=ll;exports.L=sl;exports.M=nl;exports.N=tl;exports.a=ue;exports.b=b;exports.c=Y;exports.d=be;exports.e=we;exports.f=Ne;exports.g=y;exports.h=he;exports.i=Ce;exports.j=se;exports.k=Te;exports.l=_e;exports.m=je;exports.n=Pe;exports.o=k;exports.p=A;exports.q=ne;exports.r=Ee;exports.s=Le;exports.t=Oe;exports.u=Re;exports.v=Ue;exports.w=de;exports.x=o;exports.y=We;exports.z=Ze;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {u,c,I as I$1}from'./chunk-Y2X6FBMZ.mjs';import {createHash}from'crypto';var P=process.env.SKILLS_DOWNLOAD_URL||"https://skills.sh",R={"zapier/connectors":{downloadUrl:e=>`https://connectors-skills.zapier.com/download/${encodeURIComponent(e)}/snapshot.json`}},H=["houjallen","vercel-labs","anthropics"],k=1e4;function x(e){return e.toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}var w=false;function M(){w=false;}async function S(e,n,t){try{let o=`https://api.github.com/repos/${e}/git/trees/${encodeURIComponent(n)}?recursive=1`,i={Accept:"application/vnd.github.v3+json","User-Agent":"skills-cli"};t&&(i.Authorization=`Bearer ${t}`);let a=await fetch(o,{headers:i,signal:AbortSignal.timeout(k)});if(a.ok){let l=await a.json();return {tree:{sha:l.sha,branch:n,tree:l.tree},rateLimited:!1}}return {tree:null,rateLimited:a.status===403&&a.headers.get("x-ratelimit-remaining")==="0"}}catch{return {tree:null,rateLimited:false}}}async function C(e,n,t){let o=n?[n]:["HEAD","main","master"];if(w&&t){let c=t();if(!c)return null;for(let l of o){let f=await S(e,l,c);if(f.tree)return f.tree}return null}let i=false;for(let c of o){let l=await S(e,c,null);if(l.tree)return l.tree;if(l.rateLimited){i=true;break}}if(!i||!t)return null;w=true;let a=t();if(!a)return null;for(let c of o){let l=await S(e,c,a);if(l.tree)return l.tree}return null}function v(e,n){let t=n.replace(/\\/g,"/");return t.toLowerCase().endsWith("/skill.md")?t=t.slice(0,-9):t.toLowerCase().endsWith("skill.md")&&(t=t.slice(0,-8)),t.endsWith("/")&&(t=t.slice(0,-1)),t?e.tree.find(i=>i.type==="tree"&&i.path===t)?.sha??null:e.sha}var I=["","skills/","skills/.curated/","skills/.experimental/","skills/.system/"];function _(){let e=I$1();return Array.from(new Set([...I,...e]))}function A(e,n){let t=e.tree.filter(u=>u.type==="blob"&&u.path.toLowerCase().endsWith("skill.md")).map(u=>u.path),o=n?n.endsWith("/")?n:n+"/":"",i=o?t.filter(u=>u.startsWith(o)||u===o+"SKILL.md"):t;if(i.length===0)return [];let a=[],c=new Set,l=new Set(["node_modules",".git","dist","build","__pycache__"]),f=new Set(i.map(u=>u.toLowerCase()));for(let u of _()){let r=o+u,d=u!=="";for(let s of i){if(!s.startsWith(r))continue;let g=s.slice(r.length);if(g.toLowerCase()==="skill.md"){c.has(s)||(a.push(s),c.add(s));continue}let h=g.split("/");if(h.length===2&&h[1].toLowerCase()==="skill.md"){c.has(s)||(a.push(s),c.add(s));continue}if(d&&h.length===3&&h[2].toLowerCase()==="skill.md"&&!l.has(h[0])&&!l.has(h[1])){let p=`${r}${h[0]}/SKILL.md`.toLowerCase();!f.has(p)&&!c.has(s)&&(a.push(s),c.add(s));}}}return a.length>0?a:i.filter(u=>u.split("/").length<=6)}async function T(e,n,t){try{let o=`https://raw.githubusercontent.com/${e}/${n}/${t}`,i=await fetch(o,{signal:AbortSignal.timeout(k)});return i.ok?await i.text():null}catch{return null}}async function B(e,n){try{let[t,o]=e.split("/"),i=`${P}/api/download/${encodeURIComponent(t)}/${encodeURIComponent(o)}/${encodeURIComponent(n)}`,c=R[e.toLowerCase()]?.downloadUrl(n)??i,l=await fetch(c,{signal:AbortSignal.timeout(k)});return l.ok?await l.json():null}catch{return null}}function $(e){let n=createHash("sha256");for(let t of [...e].sort((o,i)=>o.path.localeCompare(i.path)))n.update(t.path),n.update(t.contents);return n.digest("hex")}async function j(e,n={}){let t=await C(e,n.ref,n.getToken);if(!t)return null;let o=A(t,n.subpath);if(o.length===0)return null;let i=await Promise.all(o.map(async r=>{let d=await T(e,t.branch,r);return {mdPath:r,content:d}})),a=[];for(let{mdPath:r,content:d}of i){if(!d)continue;let{data:s}=u(d);if(!s.name||!s.description||typeof s.name!="string"||typeof s.description!="string"||s.metadata?.internal===true&&!n.includeInternal)continue;let h=c(s.name),p=c(s.description);a.push({mdPath:r,name:h,description:p,content:d,slug:x(h),metadata:s.metadata});}if(a.length===0)return null;let c$1=e.toLowerCase(),l=await Promise.all(a.map(async r=>{let d=await B(c$1,r.slug);return {skill:r,download:d}}));return l.every(r=>r.download!==null)?{skills:l.map(({skill:r,download:d})=>{let s=r.mdPath.toLowerCase(),h=(s.endsWith("/skill.md")?r.mdPath.slice(0,-9):s==="skill.md"?"":r.mdPath.slice(0,-9))?d.files:d.files.filter(p=>p.path.toLowerCase()==="skill.md");return {name:r.name,description:r.description,path:"",rawContent:r.content,metadata:r.metadata,files:h,snapshotHash:h.length===d.files.length?d.hash:$(h),repoPath:r.mdPath}}),tree:t}:null}
|
|
2
|
-
export{R as a,H as b,x as c,M as d,C as e,v as f,A as g,j as h};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkKJPMAUXZ_cjs=require('./chunk-KJPMAUXZ.cjs'),crypto=require('crypto');var P=process.env.SKILLS_DOWNLOAD_URL||"https://skills.sh",R={"zapier/connectors":{downloadUrl:e=>`https://connectors-skills.zapier.com/download/${encodeURIComponent(e)}/snapshot.json`}},F=["houjallen","vercel-labs","anthropics"],k=1e4;function x(e){return e.toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}var w=false;function H(){w=false;}async function S(e,n,t){try{let o=`https://api.github.com/repos/${e}/git/trees/${encodeURIComponent(n)}?recursive=1`,i={Accept:"application/vnd.github.v3+json","User-Agent":"skills-cli"};t&&(i.Authorization=`Bearer ${t}`);let a=await fetch(o,{headers:i,signal:AbortSignal.timeout(k)});if(a.ok){let l=await a.json();return {tree:{sha:l.sha,branch:n,tree:l.tree},rateLimited:!1}}return {tree:null,rateLimited:a.status===403&&a.headers.get("x-ratelimit-remaining")==="0"}}catch{return {tree:null,rateLimited:false}}}async function C(e,n,t){let o=n?[n]:["HEAD","main","master"];if(w&&t){let c=t();if(!c)return null;for(let l of o){let f=await S(e,l,c);if(f.tree)return f.tree}return null}let i=false;for(let c of o){let l=await S(e,c,null);if(l.tree)return l.tree;if(l.rateLimited){i=true;break}}if(!i||!t)return null;w=true;let a=t();if(!a)return null;for(let c of o){let l=await S(e,c,a);if(l.tree)return l.tree}return null}function M(e,n){let t=n.replace(/\\/g,"/");return t.toLowerCase().endsWith("/skill.md")?t=t.slice(0,-9):t.toLowerCase().endsWith("skill.md")&&(t=t.slice(0,-8)),t.endsWith("/")&&(t=t.slice(0,-1)),t?e.tree.find(i=>i.type==="tree"&&i.path===t)?.sha??null:e.sha}var I=["","skills/","skills/.curated/","skills/.experimental/","skills/.system/"];function _(){let e=chunkKJPMAUXZ_cjs.J();return Array.from(new Set([...I,...e]))}function A(e,n){let t=e.tree.filter(u=>u.type==="blob"&&u.path.toLowerCase().endsWith("skill.md")).map(u=>u.path),o=n?n.endsWith("/")?n:n+"/":"",i=o?t.filter(u=>u.startsWith(o)||u===o+"SKILL.md"):t;if(i.length===0)return [];let a=[],c=new Set,l=new Set(["node_modules",".git","dist","build","__pycache__"]),f=new Set(i.map(u=>u.toLowerCase()));for(let u of _()){let r=o+u,d=u!=="";for(let s of i){if(!s.startsWith(r))continue;let g=s.slice(r.length);if(g.toLowerCase()==="skill.md"){c.has(s)||(a.push(s),c.add(s));continue}let h=g.split("/");if(h.length===2&&h[1].toLowerCase()==="skill.md"){c.has(s)||(a.push(s),c.add(s));continue}if(d&&h.length===3&&h[2].toLowerCase()==="skill.md"&&!l.has(h[0])&&!l.has(h[1])){let p=`${r}${h[0]}/SKILL.md`.toLowerCase();!f.has(p)&&!c.has(s)&&(a.push(s),c.add(s));}}}return a.length>0?a:i.filter(u=>u.split("/").length<=6)}async function T(e,n,t){try{let o=`https://raw.githubusercontent.com/${e}/${n}/${t}`,i=await fetch(o,{signal:AbortSignal.timeout(k)});return i.ok?await i.text():null}catch{return null}}async function B(e,n){try{let[t,o]=e.split("/"),i=`${P}/api/download/${encodeURIComponent(t)}/${encodeURIComponent(o)}/${encodeURIComponent(n)}`,c=R[e.toLowerCase()]?.downloadUrl(n)??i,l=await fetch(c,{signal:AbortSignal.timeout(k)});return l.ok?await l.json():null}catch{return null}}function $(e){let n=crypto.createHash("sha256");for(let t of [...e].sort((o,i)=>o.path.localeCompare(i.path)))n.update(t.path),n.update(t.contents);return n.digest("hex")}async function v(e,n={}){let t=await C(e,n.ref,n.getToken);if(!t)return null;let o=A(t,n.subpath);if(o.length===0)return null;let i=await Promise.all(o.map(async r=>{let d=await T(e,t.branch,r);return {mdPath:r,content:d}})),a=[];for(let{mdPath:r,content:d}of i){if(!d)continue;let{data:s}=chunkKJPMAUXZ_cjs.v(d);if(!s.name||!s.description||typeof s.name!="string"||typeof s.description!="string"||s.metadata?.internal===true&&!n.includeInternal)continue;let h=chunkKJPMAUXZ_cjs.d(s.name),p=chunkKJPMAUXZ_cjs.d(s.description);a.push({mdPath:r,name:h,description:p,content:d,slug:x(h),metadata:s.metadata});}if(a.length===0)return null;let c=e.toLowerCase(),l=await Promise.all(a.map(async r=>{let d=await B(c,r.slug);return {skill:r,download:d}}));return l.every(r=>r.download!==null)?{skills:l.map(({skill:r,download:d})=>{let s=r.mdPath.toLowerCase(),h=(s.endsWith("/skill.md")?r.mdPath.slice(0,-9):s==="skill.md"?"":r.mdPath.slice(0,-9))?d.files:d.files.filter(p=>p.path.toLowerCase()==="skill.md");return {name:r.name,description:r.description,path:"",rawContent:r.content,metadata:r.metadata,files:h,snapshotHash:h.length===d.files.length?d.hash:$(h),repoPath:r.mdPath}}),tree:t}:null}
|
|
2
|
-
exports.a=R;exports.b=F;exports.c=x;exports.d=H;exports.e=C;exports.f=M;exports.g=A;exports.h=v;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkKJPMAUXZ_cjs=require('./chunk-KJPMAUXZ.cjs'),promises=require('fs/promises'),path=require('path'),crypto=require('crypto'),utils=require('@easbot/utils'),fs=require('fs'),os=require('os');var Gt="skills-lock.json",dt=1;function ft(t){return path.join(t||process.cwd(),Gt)}async function W(t){let e=ft(t);try{let n=await promises.readFile(e,"utf-8"),s=JSON.parse(n);return typeof s.version!="number"||!s.skills||s.version<dt?Y():s}catch{return Y()}}async function mt(t,e){let n=ft(e),s={};for(let i of Object.keys(t.skills).sort())s[i]=t.skills[i];let r={version:t.version,skills:s},a=JSON.stringify(r,null,2)+`
|
|
2
|
-
`;await promises.writeFile(n,a,"utf-8");}async function we(t){let e=[];await gt(t,t,e),e.sort((s,r)=>s.relativePath.localeCompare(r.relativePath));let n=crypto.createHash("sha256");for(let s of e)n.update(s.relativePath),n.update(s.content);return n.digest("hex")}async function gt(t,e,n){let s=await promises.readdir(e,{withFileTypes:true});await Promise.all(s.map(async r=>{let a=path.join(e,r.name);if(r.isDirectory()){if(r.name===".git"||r.name==="node_modules")return;await gt(t,a,n);}else if(r.isFile()){let i=await promises.readFile(a),o=path.relative(t,a).split("\\").join("/");n.push({relativePath:o,content:i});}}));}async function ye(t,e,n){let s=await W(n);s.skills[t]=e,await mt(s,n);}async function Se(t,e){let n=await W(e);return t in n.skills?(delete n.skills[t],await mt(n,e),true):false}function Y(){return {version:dt,skills:{}}}function Z(t,e){let n=path.normalize(path.resolve(e)),s=path.normalize(path.resolve(t));return s.startsWith(n+path.sep)||s===n}function T(t){return t.startsWith("./")}async function ht(t){let e=new Map;try{let n=await promises.readFile(path.join(t,".claude-plugin/marketplace.json"),"utf-8"),s=JSON.parse(n),r=s.metadata?.pluginRoot;if(r===void 0||T(r))for(let i of s.plugins??[]){if(!i.name||typeof i.source!="string"&&i.source!==void 0||i.source!==void 0&&!T(i.source))continue;let o=path.join(t,r??"",i.source??"");if(Z(o,t)&&i.skills&&i.skills.length>0)for(let p of i.skills){if(!T(p))continue;let d=path.join(o,p);Z(d,t)&&e.set(path.resolve(d),i.name);}}}catch{}try{let n=await promises.readFile(path.join(t,".claude-plugin/plugin.json"),"utf-8"),s=JSON.parse(n);if(s.name&&s.skills&&s.skills.length>0)for(let r of s.skills){if(!T(r))continue;let a=path.join(t,r);Z(a,t)&&e.set(path.resolve(a),s.name);}}catch{}return e}var Ht=["node_modules",".git","dist","build","__pycache__"];async function Vt(t){let e=path.join(t,".gitignore");try{let n=await promises.readFile(e,"utf-8");return utils.Glob.parseGitignoreContent(n)}catch{return []}}function tt(t){return t.toLowerCase().replace(/[\s_]+/g,"-")}function Xt(t){return t.split(path.sep).join("/").replace(/\/+/g,"/")}function qt(){let t=process.env.INSTALL_INTERNAL_SKILLS;return t==="1"||t==="true"}async function Lt(t){try{let e=path.join(t,"SKILL.md");return (await promises.stat(e)).isFile()}catch{return false}}async function yt(t,e){try{let n=await promises.readFile(t,"utf-8"),{data:s}=chunkKJPMAUXZ_cjs.v(n);if(!s.name||!s.description||typeof s.name!="string"||typeof s.description!="string")return null;let r=s.metadata&&typeof s.metadata=="object"&&!Array.isArray(s.metadata)?s.metadata:void 0;return r?.internal===!0&&!qt()&&!e?.includeInternal?null:{name:chunkKJPMAUXZ_cjs.d(s.name),description:chunkKJPMAUXZ_cjs.d(s.description),path:path.dirname(t),rawContent:n,metadata:r}}catch{return null}}async function It(t,e=0,n=5){if(e>n)return [];try{let[s,r]=await Promise.all([Lt(t),promises.readdir(t,{withFileTypes:!0}).catch(()=>[])]),a=s?[t]:[],i=await Promise.all(r.filter(o=>o.isDirectory()&&!Ht.includes(o.name)).map(o=>It(path.join(t,o.name),e+1,n)));return [...a,...i.flat()]}catch{return []}}function Qt(t,e){let n=path.normalize(path.resolve(t)),s=path.normalize(path.resolve(path.join(t,e)));return s.startsWith(n+path.sep)||s===n}async function je(t,e,n){let s=[],r=new Set,a=await W(t),i=new Set(Object.keys(a.skills).map(tt));if(e&&!Qt(t,e))throw new Error(`Invalid subpath: "${e}" resolves outside the repository directory. Subpath must not contain ".." segments that escape the base path.`);let o=e?path.join(t,e):t,p=await ht(o),d=w=>{let y=path.resolve(w.path);return p.has(y)&&(w.pluginName=p.get(y)),w},g=chunkKJPMAUXZ_cjs.G(),k=w=>{if(i.size===0)return false;let y=Xt(path.relative(t,w.path));if(!g.some(it=>y===it||y.startsWith(`${it}/`)))return false;let jt=tt(w.name),Ot=tt(path.basename(w.path));return i.has(jt)||i.has(Ot)},l=async w=>{if(!await Lt(w))return false;let y=await yt(path.join(w,"SKILL.md"),n);return !y||r.has(y.name)||k(y)||(y=d(y),s.push(y),r.add(y.name)),true},h=e?e.replace(/^\/+|\/+$/g,"").split("/").filter(w=>w.length>0):[],f=h.length>0?`**/${h.join("/")}/**/SKILL.md`:"**/SKILL.md",c=await utils.Glob.scan(f,{cwd:o,absolute:true,ignore:[...utils.Glob.DEFAULT_IGNORE_PATTERNS,...await Vt(o)]}),u="/",P=o.split(path.sep).join(u);c.sort((w,y)=>w.split(u).length-y.split(u).length);let E=[];for(let w of c){if(E.some(v=>w.startsWith(`${v}${u}`)||w===v))continue;let y=path.dirname(w);if(await l(y)){let v=y.split(path.sep).join(u);if(v===P)continue;E.push(v);}}if(s.length===0||n?.fullDepth){let w=await It(o);for(let y of w){let v=await yt(path.join(y,"SKILL.md"),n);v&&!r.has(v.name)&&!k(v)&&(v=d(v),s.push(v),r.add(v.name));}}return s}function Yt(t){return t.name||path.basename(t.path)}function Oe(t,e){let n=e.map(s=>s.toLowerCase());return t.filter(s=>{let r=s.name.toLowerCase(),a=Yt(s).toLowerCase();return n.some(i=>i===r||i===a)})}var Dt="*";function ze(t,e){if(!t||t.length===0)return [];let n=new Set(e),s=[];for(let r of t)if(r!==Dt){if(r.includes("/")||r.includes("**")){s.push(r);continue}Ft.test(r)?e.some(a=>utils.Wildcard.match(a,r))||s.push(r):n.has(r)||s.push(r);}return s}function Be(t,e){let n={wildcard:false,matched:[],invalid:[]};if(!t||t.length===0)return n;let s=new Set(e),r=new Set;for(let a of t){if(a===Dt){n.wildcard=true;continue}if(a.includes("/")||a.includes("**")){n.invalid.push(a);continue}if(Ft.test(a))for(let i of e)utils.Wildcard.match(i,a)&&r.add(i);else s.has(a)?r.add(a):n.invalid.push(a);}return n.matched=Array.from(r),n}var Ft=/[*?[{}]/;var xt=".agents",At="skills",Ge=".agents/skills";function x(t){return t.toLowerCase().replace(/[^a-z0-9._]+/g,"-").replace(/^[.-]+|[.-]+$/g,"").substring(0,255)||"unnamed-skill"}function S(t,e){let n=path.normalize(path.resolve(t)),s=path.normalize(path.resolve(e));return s.startsWith(n+path.sep)||s===n}function Rt(t,e){return S(t,e)||S(e,t)}function _(t,e){let n=t?chunkKJPMAUXZ_cjs.o()||os.homedir():e||chunkKJPMAUXZ_cjs.t()||process.cwd();return path.join(n,xt,At)}function Mt(t,e){let n=e||chunkKJPMAUXZ_cjs.t()||process.cwd();return path.join(n,chunkKJPMAUXZ_cjs.A,x(t),"skills")}function D(t,e,n,s){if(chunkKJPMAUXZ_cjs.K(t))return _(e,n);if(t==="eve"&&s)return Mt(s,n);let r=chunkKJPMAUXZ_cjs.x[t],a=chunkKJPMAUXZ_cjs.o()||os.homedir(),i=e?a:n||chunkKJPMAUXZ_cjs.t()||process.cwd();return e?r.globalSkillsDir===void 0?path.join(i,r.skillsDir):r.globalSkillsDir:path.join(i,r.skillsDir)}function ce(t,e){return path.resolve(path.dirname(t),e)}async function I(t){try{await promises.rm(t,{recursive:!0,force:!0});}catch{}await promises.mkdir(t,{recursive:true});}async function K(t,e){try{let n=path.resolve(t),s=path.resolve(e),[r,a]=await Promise.all([promises.realpath(n).catch(()=>n),promises.realpath(s).catch(()=>s)]);if(r===a)return !0;let i=chunkKJPMAUXZ_cjs.u(t),o=chunkKJPMAUXZ_cjs.u(e);if(i===o)return !0;try{if((await promises.lstat(e)).isSymbolicLink()){let f=await promises.readlink(e);if(ce(e,f)===n)return !0;await promises.rm(e);}else await promises.rm(e,{recursive:!0});}catch(h){if(h&&typeof h=="object"&&"code"in h&&h.code==="ELOOP")try{await promises.rm(e,{force:!0});}catch{}}let p=path.dirname(e);await promises.mkdir(p,{recursive:!0});let d=chunkKJPMAUXZ_cjs.u(p),g=path.relative(d,t),k=os.platform()==="win32"?"junction":void 0;return await promises.symlink(k==="junction"?n:g,e,k),!0}catch{return false}}async function tn(t,e,n={}){let s=chunkKJPMAUXZ_cjs.x[e],r=n.global??false,a=n.cwd||process.cwd(),i=n.eveSubagent;if(r&&s.globalSkillsDir===void 0)return {success:false,path:"",mode:n.mode??"symlink",error:`${s.displayName} does not support global skill installation`};let o=t.name||path.basename(t.path),p=x(o),d=n.mode??"symlink",k=e==="eve"&&d==="symlink"?D(e,r,a,i):_(r,a),l=path.join(k,p),h=D(e,r,a,i),f=path.join(h,p),c=chunkKJPMAUXZ_cjs.u(l),u=chunkKJPMAUXZ_cjs.u(f);if(!S(k,l))return {success:false,path:f,mode:d,error:"Invalid skill name: potential path traversal detected"};if(!S(h,f))return {success:false,path:f,mode:d,error:"Invalid skill name: potential path traversal detected"};try{if(Rt(t.path,u))return {success:!0,path:u,mode:d,skipped:!0};if(d==="copy")return await I(u),await O(t.path,u,e),{success:!0,path:u,canonicalPath:c,mode:"copy"};if(Rt(t.path,c))return {success:!0,path:c,canonicalPath:c,mode:"symlink",skipped:!0};if(await I(c),await O(t.path,c,e),r&&chunkKJPMAUXZ_cjs.K(e))return {success:!0,path:c,canonicalPath:c,mode:"symlink"};if(!r&&!chunkKJPMAUXZ_cjs.K(e)){let E=path.join(a,chunkKJPMAUXZ_cjs.x[e].skillsDir.split("/")[0]);if(!fs.existsSync(E))return {success:!0,path:c,canonicalPath:c,mode:"symlink",skipped:!0}}return c===u?{success:!0,path:u,canonicalPath:c,mode:"copy"}:await K(c,u)?{success:!0,path:u,canonicalPath:c,mode:"symlink"}:(await I(u),await O(t.path,u,e),{success:!0,path:u,canonicalPath:c,mode:"symlink",symlinkFailed:!0})}catch(P){return {success:false,path:u,mode:d,error:P instanceof Error?P.message:"Unknown error"}}}async function en(t,e,n={}){let{isGlobal:s=false,agentType:r,cwd:a}=n,i=chunkKJPMAUXZ_cjs.u(t),o=chunkKJPMAUXZ_cjs.u(e);if(i===o)return {success:true,path:o,canonicalPath:t,mode:"copy"};if(!s&&r&&a&&!chunkKJPMAUXZ_cjs.K(r)){let d=path.join(a,chunkKJPMAUXZ_cjs.x[r].skillsDir.split("/")[0]);if(!fs.existsSync(d))return {success:true,path:e,canonicalPath:t,mode:"symlink",skipped:true}}return await K(i,o)?{success:true,path:e,canonicalPath:t,mode:"symlink"}:{success:true,path:e,canonicalPath:t,mode:"symlink",symlinkFailed:true}}async function nn(t,e,n={}){let{agentType:s="easbot"}=n,r=chunkKJPMAUXZ_cjs.u(t),a=chunkKJPMAUXZ_cjs.u(e);if(r===a)return {success:true,path:a,canonicalPath:t,mode:"copy"};try{return await I(a),await O(r,a,s),{success:!0,path:a,canonicalPath:t,mode:"copy"}}catch(i){return {success:false,path:e,mode:"copy",error:i instanceof Error?i.message:"Unknown error"}}}var ue=new Set(["metadata.json"]),de=new Set([".git","__pycache__","__pypackages__"]),fe=(t,e=false)=>!!(ue.has(t)||e&&de.has(t));function A(t){let{data:e,content:n}=chunkKJPMAUXZ_cjs.v(t),s={};if(typeof e.description=="string"&&(s.description=e.description),typeof e.license=="string"&&(s.license=e.license),e.metadata&&typeof e.metadata=="object"&&!Array.isArray(e.metadata)){let i=Object.fromEntries(Object.entries(e.metadata).filter(o=>typeof o[1]=="string"));Object.keys(i).length>0&&(s.metadata=i);}let r=Object.keys(s);return r.length===0?n.replace(/^\r?\n/u,""):`---
|
|
3
|
-
${r.map(i=>`${i}: ${JSON.stringify(s[i])}`).join(`
|
|
4
|
-
`)}
|
|
5
|
-
---
|
|
6
|
-
${n.replace(/^\r?\n/u,"")}`}async function O(t,e,n){await promises.mkdir(e,{recursive:true});let s=await promises.readdir(t,{withFileTypes:true});await Promise.all(s.filter(r=>!fe(r.name,r.isDirectory())).map(async r=>{let a=path.join(t,r.name),i=path.join(e,r.name);if(r.isDirectory())await O(a,i,n);else try{if(n==="eve"&&r.name.toLowerCase()==="skill.md"){await promises.writeFile(i,A(await promises.readFile(a,"utf-8")));return}await promises.cp(a,i,{dereference:!0,recursive:!0});}catch(o){if(o instanceof Error&&"code"in o&&o.code==="ENOENT"&&r.isSymbolicLink())console.warn(`Skipping broken symlink: ${a}`);else throw o}}));}function me(t){return t.some(e=>path.basename(e.path).toLowerCase()==="skill.md")}function V(t){return `${x(t)}.md`}function ge(t){let e=t.find(s=>path.basename(s.path).toLowerCase()==="skill.md");if(e)return A(e.contents);let n=t.find(s=>path.extname(s.path).toLowerCase()===".md");return n?A(n.contents):""}async function sn(t,e,n={}){let s=chunkKJPMAUXZ_cjs.x[e],r=x(t);if(n.global&&s.globalSkillsDir===void 0)return false;let a=n.global?s.globalSkillsDir:e==="eve"&&n.eveSubagent?Mt(n.eveSubagent,n.cwd):path.join(n.cwd||process.cwd(),s.skillsDir),i=path.join(a,r);if(!S(a,i))return false;try{return await promises.access(i),!0}catch{return false}}function rn(t,e,n={}){chunkKJPMAUXZ_cjs.x[e];n.cwd||process.cwd();let a=x(t),i=D(e,n.global??false,n.cwd,n.eveSubagent),o=path.join(i,a);if(!S(i,o))throw new Error("Invalid skill name: potential path traversal detected");return o}async function rt(t,e){try{return await promises.access(path.join(t,"SKILL.md")),{created:!1}}catch{}return await promises.mkdir(t,{recursive:true}),await e(t),{created:true}}function an(t,e={}){let n=x(t),s=e.agent==="eve"?D("eve",e.global??false,e.cwd,e.eveSubagent):_(e.global??false,e.cwd),r=path.join(s,n);if(!S(s,r))throw new Error("Invalid skill name: potential path traversal detected");return r}async function on(t,e,n={}){let s=chunkKJPMAUXZ_cjs.x[e],r=n.global??false,a=n.cwd||process.cwd(),i=n.mode??"symlink",o=n.eveSubagent;if(r&&s.globalSkillsDir===void 0)return {success:false,path:"",mode:i,error:`${s.displayName} does not support global skill installation`};let p=x(t.installName),d=e==="eve"&&i==="symlink"?D(e,r,a,o):_(r,a),g=path.join(d,p),k=D(e,r,a,o),l=path.join(k,p);if(!S(d,g))return {success:false,path:l,mode:i,error:"Invalid skill name: potential path traversal detected"};if(!S(k,l))return {success:false,path:l,mode:i,error:"Invalid skill name: potential path traversal detected"};try{if(i==="copy"){await I(l);let c=e==="eve"?V(t.installName):"SKILL.md",u=path.join(l,c);return await promises.writeFile(u,e==="eve"?A(t.content):t.content,"utf-8"),{success:!0,path:l,mode:"copy"}}let h=e==="eve"?V(t.installName):"SKILL.md";if(await rt(g,async c=>{let u=path.join(c,h);await promises.writeFile(u,e==="eve"?A(t.content):t.content,"utf-8");}),r&&chunkKJPMAUXZ_cjs.K(e))return {success:!0,path:g,canonicalPath:g,mode:"symlink"};if(!await K(g,l)){await I(l);let c=e==="eve"?V(t.installName):"SKILL.md",u=path.join(l,c);return await promises.writeFile(u,e==="eve"?A(t.content):t.content,"utf-8"),{success:!0,path:l,canonicalPath:g,mode:"symlink",symlinkFailed:!0}}return {success:!0,path:l,canonicalPath:g,mode:"symlink"}}catch(h){return {success:false,path:l,mode:i,error:h instanceof Error?h.message:"Unknown error"}}}async function ln(t,e,n={}){let s=chunkKJPMAUXZ_cjs.x[e],r=n.global??false,a=n.cwd||process.cwd(),i=n.mode??"symlink",o=n.eveSubagent;if(r&&s.globalSkillsDir===void 0)return {success:false,path:"",mode:i,error:`${s.displayName} does not support global skill installation`};let p=x(t.installName),d=e==="eve"&&i==="symlink"?D(e,r,a,o):_(r,a),g=path.join(d,p),k=D(e,r,a,o),l=path.join(k,p);if(!S(d,g))return {success:false,path:l,mode:i,error:"Invalid skill name: potential path traversal detected"};if(!S(k,l))return {success:false,path:l,mode:i,error:"Invalid skill name: potential path traversal detected"};async function h(f){for(let[c,u]of t.files){let P=path.join(f,c);if(!S(f,P))continue;let E=path.dirname(P);E!==f&&await promises.mkdir(E,{recursive:true}),await promises.writeFile(P,e==="eve"&&path.basename(c).toLowerCase()==="skill.md"&&typeof u=="string"?A(u):u);}}try{return i==="copy"?(await I(l),await h(l),{success:!0,path:l,mode:"copy"}):(await rt(g,h),r&&chunkKJPMAUXZ_cjs.K(e)?{success:!0,path:g,canonicalPath:g,mode:"symlink"}:await K(g,l)?{success:!0,path:l,canonicalPath:g,mode:"symlink"}:(await I(l),await h(l),{success:!0,path:l,canonicalPath:g,mode:"symlink",symlinkFailed:!0}))}catch(f){return {success:false,path:l,mode:i,error:f instanceof Error?f.message:"Unknown error"}}}async function cn(t,e,n={}){let s=chunkKJPMAUXZ_cjs.x[e],r=n.global??false,a=n.cwd||process.cwd(),i=n.mode??"symlink",o=n.eveSubagent;if(r&&s.globalSkillsDir===void 0)return {success:false,path:"",mode:i,error:`${s.displayName} does not support global skill installation`};let p=x(t.installName),d=D(e,r,a,o);if(e==="eve"&&!me(t.files)){let f=path.join(d,V(t.installName));if(!S(d,f))return {success:false,path:f,mode:i,error:"Invalid skill name: potential path traversal detected"};try{return await promises.mkdir(d,{recursive:!0}),await promises.rm(f,{recursive:!0,force:!0}),await promises.writeFile(f,ge(t.files),"utf-8"),{success:!0,path:f,mode:"copy"}}catch(c){return {success:false,path:f,mode:i,error:c instanceof Error?c.message:"Unknown error"}}}let g=e==="eve"&&i==="symlink"?D(e,r,a,o):_(r,a),k=path.join(g,p),l=path.join(d,p);if(!S(g,k))return {success:false,path:l,mode:i,error:"Invalid skill name: potential path traversal detected"};if(!S(d,l))return {success:false,path:l,mode:i,error:"Invalid skill name: potential path traversal detected"};async function h(f){for(let c of t.files){let u=path.join(f,c.path);if(!S(f,u))continue;let P=path.dirname(u);P!==f&&await promises.mkdir(P,{recursive:true}),await promises.writeFile(u,e==="eve"&&path.basename(c.path).toLowerCase()==="skill.md"?A(c.contents):c.contents,"utf-8");}}try{if(i==="copy")return await I(l),await h(l),{success:!0,path:l,mode:"copy"};if(await rt(k,h),r&&chunkKJPMAUXZ_cjs.K(e))return {success:!0,path:k,canonicalPath:k,mode:"symlink"};if(!r&&!chunkKJPMAUXZ_cjs.K(e)){let c=path.join(a,chunkKJPMAUXZ_cjs.x[e].skillsDir.split("/")[0]);if(!fs.existsSync(c))return {success:!0,path:k,canonicalPath:k,mode:"symlink",skipped:!0}}return await K(k,l)?{success:!0,path:l,canonicalPath:k,mode:"symlink"}:(await I(l),await h(l),{success:!0,path:l,canonicalPath:k,mode:"symlink",symlinkFailed:!0})}catch(f){return {success:false,path:l,mode:i,error:f instanceof Error?f.message:"Unknown error"}}}async function un(t={}){let e=t.cwd||process.cwd(),{scanInstalledSkillDirs:n}=await import('./scan-5G765ZEF.cjs'),s=t.agentFilter?null:await chunkKJPMAUXZ_cjs.y(),r=t.agentFilter??s??void 0,a=await n({global:t.global,cwd:e,agentFilter:r}),i=new Map;for(let o of a){let p=`${o.scope}:${o.name}`,d=i.get(p);if(d){for(let g of o.agents)d.agents.includes(g)||d.agents.push(g);continue}i.set(p,{name:o.name,description:"",path:o.skillDir,canonicalPath:o.skillDir,scope:o.scope,agents:[...o.agents]});}return Array.from(i.values())}exports.A=an;exports.B=on;exports.C=ln;exports.D=cn;exports.E=un;exports.a=ft;exports.b=W;exports.c=mt;exports.d=we;exports.e=ye;exports.f=Se;exports.g=qt;exports.h=yt;exports.i=Qt;exports.j=je;exports.k=Yt;exports.l=Oe;exports.m=ze;exports.n=Be;exports.o=xt;exports.p=At;exports.q=Ge;exports.r=x;exports.s=_;exports.t=Mt;exports.u=D;exports.v=tn;exports.w=en;exports.x=nn;exports.y=sn;exports.z=rn;
|