@easbot/skills 0.3.12 → 0.3.14

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.
Files changed (67) hide show
  1. package/README.en.md +433 -126
  2. package/README.md +428 -126
  3. package/dist/chunks/blob-SCUVTYVE.cjs +1 -0
  4. package/dist/chunks/blob-WZAGX4RO.mjs +1 -0
  5. package/dist/chunks/chunk-2E6BHPFV.cjs +265 -0
  6. package/dist/chunks/chunk-5BDDXFOF.mjs +1 -0
  7. package/dist/chunks/chunk-5RWSXDNO.cjs +3 -0
  8. package/dist/chunks/chunk-6NTEYECA.mjs +22 -0
  9. package/dist/chunks/chunk-AQYRRXU5.mjs +5 -0
  10. package/dist/chunks/{chunk-2VZUPTI7.cjs → chunk-DFBKA5A6.cjs} +1 -1
  11. package/dist/chunks/chunk-DNE3XPCJ.cjs +2 -0
  12. package/dist/chunks/chunk-E7AHWFZN.cjs +2 -0
  13. package/dist/chunks/chunk-ISMGLHYS.cjs +1 -0
  14. package/dist/chunks/chunk-J6PRUXFG.mjs +265 -0
  15. package/dist/chunks/chunk-JCOXRETY.cjs +22 -0
  16. package/dist/chunks/chunk-ML6B4IQL.mjs +1 -0
  17. package/dist/chunks/chunk-NH4TYEPW.mjs +3 -0
  18. package/dist/chunks/{chunk-S6YNGR7S.cjs → chunk-Q2MOP5ZW.cjs} +2 -2
  19. package/dist/chunks/{chunk-OWG6N2K6.cjs → chunk-UGHF4GOW.cjs} +2 -2
  20. package/dist/chunks/chunk-ZJS7IO5V.mjs +2 -0
  21. package/dist/chunks/chunk-ZYDDQV73.mjs +2 -0
  22. package/dist/chunks/cli-handler-3FSM4C7L.mjs +1 -0
  23. package/dist/chunks/cli-handler-B6H4RZEM.cjs +1 -0
  24. package/dist/chunks/{installer-FB26E7JZ.mjs → installer-NJN3PT5F.mjs} +1 -1
  25. package/dist/chunks/installer-YDJBZTQ7.cjs +1 -0
  26. package/dist/chunks/{interfaces-UIS44Q7A.cjs → interfaces-5BH4K5TM.cjs} +1 -1
  27. package/dist/chunks/local-lock-SPZB3AB7.cjs +1 -0
  28. package/dist/chunks/local-lock-ZHTDWYXF.mjs +1 -0
  29. package/dist/chunks/scan-6W47D2KJ.mjs +1 -0
  30. package/dist/chunks/scan-L6UNVP3V.cjs +1 -0
  31. package/dist/chunks/skill-lock-MNRZ7TIX.mjs +1 -0
  32. package/dist/chunks/skill-lock-VX2HGPTY.cjs +1 -0
  33. package/dist/chunks/store-TSS4BMBF.cjs +1 -0
  34. package/dist/chunks/store-UJPPYDBG.mjs +1 -0
  35. package/dist/chunks/telemetry-B4PS27S5.cjs +1 -0
  36. package/dist/cli.cjs +1 -1
  37. package/dist/cli.mjs +1 -1
  38. package/dist/index.cjs +1 -1
  39. package/dist/index.d.cts +53 -9
  40. package/dist/index.d.ts +53 -9
  41. package/dist/index.mjs +1 -1
  42. package/package.json +5 -7
  43. package/dist/chunks/blob-DOVEGVIE.cjs +0 -1
  44. package/dist/chunks/blob-JSMTOYEN.mjs +0 -1
  45. package/dist/chunks/chunk-2YVJ7YP6.mjs +0 -22
  46. package/dist/chunks/chunk-4R6NKPNW.mjs +0 -3
  47. package/dist/chunks/chunk-676OG55M.mjs +0 -5
  48. package/dist/chunks/chunk-6PJ3YQA7.mjs +0 -2
  49. package/dist/chunks/chunk-72DXY4B7.mjs +0 -1
  50. package/dist/chunks/chunk-GR2NJUJ6.mjs +0 -255
  51. package/dist/chunks/chunk-JFEBB5CL.cjs +0 -22
  52. package/dist/chunks/chunk-KV7EP6AW.cjs +0 -255
  53. package/dist/chunks/chunk-RWSBKHQ2.cjs +0 -3
  54. package/dist/chunks/chunk-TCFGU43L.cjs +0 -2
  55. package/dist/chunks/cli-handler-RAJ42VDN.mjs +0 -1
  56. package/dist/chunks/cli-handler-YAJ5J5VA.cjs +0 -1
  57. package/dist/chunks/installer-GOQTCUJ4.cjs +0 -1
  58. package/dist/chunks/local-lock-4AA55ORE.cjs +0 -1
  59. package/dist/chunks/local-lock-LG5YL33V.mjs +0 -1
  60. package/dist/chunks/scan-QEVID2TF.mjs +0 -1
  61. package/dist/chunks/scan-XWU3FCE3.cjs +0 -1
  62. package/dist/chunks/skill-lock-KHPVP7AD.mjs +0 -1
  63. package/dist/chunks/skill-lock-LET33FVT.cjs +0 -1
  64. package/dist/chunks/store-3NRBE47N.mjs +0 -1
  65. package/dist/chunks/store-EHYH46YY.cjs +0 -1
  66. package/dist/chunks/telemetry-LCGTSJDM.cjs +0 -1
  67. /package/dist/chunks/{chunk-VRHWDHQV.cjs → chunk-GWUDKZEH.cjs} +0 -0
@@ -0,0 +1,3 @@
1
+ 'use strict';var chunkJCOXRETY_cjs=require('./chunk-JCOXRETY.cjs'),chunkXGUPIAAF_cjs=require('./chunk-XGUPIAAF.cjs'),promises=require('fs/promises'),path=require('path'),crypto=require('crypto'),child_process=require('child_process'),terminal=require('@easbot/terminal');function e(t,r){return i=>terminal.colorize(t,r,i)}var o=terminal.isRich(),y=e(o,terminal.theme.muted),D=e(o,terminal.theme.error),$=e(o,terminal.theme.success),x=e(o,terminal.theme.warn),a=e(o,terminal.theme.info);e(o,terminal.theme.accentBright);var B=e(o,terminal.theme.heading),C=e(o,terminal.theme.heading);var U=e(o,terminal.theme.info);e(o,terminal.theme.error);var z=t=>t;var G=".skill-lock.json",S=6;function h(){return path.join(chunkXGUPIAAF_cjs.m(),"skills",G)}async function l(){let t=h();return await I(t)??N()}async function I(t){try{let r=await promises.readFile(t,"utf-8"),i=JSON.parse(r);return typeof i.version!="number"||!i.skills||i.version<S?null:i}catch{return null}}async function k(t){let r=h();await promises.mkdir(path.dirname(r),{recursive:true});let i=JSON.stringify(t,null,2);await promises.writeFile(r,i,"utf-8");}function tt(t){return crypto.createHash("sha256").update(t,"utf-8").digest("hex")}var p=false;function rt(){p=false;}function it(){if(process.env.GITHUB_TOKEN)return process.env.GITHUB_TOKEN;if(process.env.GH_TOKEN)return process.env.GH_TOKEN;p||(process.stderr.write(`${terminal.Symbol.colorize(terminal.Symbol.bar.vertical,"warning")} ${x("GitHub rate limit reached")} \u2014 using your ${a("gh")} login to continue.
2
+ ${terminal.Symbol.colorize(terminal.Symbol.bar.vertical,"warning")} ${y(`Tip: set ${a("GITHUB_TOKEN")} to avoid this prompt, or use ${a("--full-depth")} to clone instead.
3
+ `)}`),p=true);try{let t=child_process.execSync("gh auth token",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();if(t)return t}catch{}return null}async function nt(t,r,i,s){let{fetchRepoTree:c,getSkillFolderHashFromTree:w}=await import('./blob-SCUVTYVE.cjs'),g=await c(t,s,i??void 0);return g?w(g,r):null}async function et(t,r){let i=await l(),s=new Date().toISOString(),c=i.skills[t];i.skills[t]={...r,installedAt:c?.installedAt??s,updatedAt:s},await k(i);}async function ot(t){let r=await l();return t in r.skills?(delete r.skills[t],await k(r),true):false}async function st(t){return (await l()).skills[t]??null}async function lt(){return (await l()).skills}async function ct(){let t=await l(),r=new Map;for(let[i,s]of Object.entries(t.skills)){let c=r.get(s.source);c?c.skills.push(i):r.set(s.source,{skills:[i],entry:s});}return r}function N(){return {version:S,skills:{},dismissed:{}}}async function at(t){return (await l()).dismissed?.[t]===true}function ut(t,r){return t?chunkJCOXRETY_cjs.p(t,chunkJCOXRETY_cjs.J(),r):null}async function pt(t){let r=await l();r.dismissed||(r.dismissed={}),r.dismissed[t]=true,await k(r);}exports.a=y;exports.b=D;exports.c=$;exports.d=x;exports.e=a;exports.f=B;exports.g=C;exports.h=U;exports.i=z;exports.j=S;exports.k=h;exports.l=l;exports.m=k;exports.n=tt;exports.o=rt;exports.p=it;exports.q=nt;exports.r=et;exports.s=ot;exports.t=st;exports.u=lt;exports.v=ct;exports.w=at;exports.x=ut;exports.y=pt;
@@ -0,0 +1,22 @@
1
+ import {k}from'./chunk-ML6B4IQL.mjs';import {p,m as m$1,o}from'./chunk-RWZ4LFSN.mjs';import {b as b$1,c,d as d$1,l}from'./chunk-ZJS7IO5V.mjs';import {a,d,b as b$2}from'./chunk-ZYDDQV73.mjs';import {b}from'./chunk-WQGSYA5D.mjs';import {rm,mkdtemp,readFile,rename,mkdir,writeFile,rmdir,cp,readdir,stat}from'fs/promises';import {dirname,join,normalize,resolve,sep,basename,relative,isAbsolute}from'path';import {createHash}from'crypto';import {existsSync}from'fs';import {Filesystem,Glob,Wildcard,git}from'@easbot/utils';import me from'simple-git';import {tmpdir}from'os';import {execFile}from'child_process';import {promisify}from'util';import {gunzipSync,inflateRawSync}from'zlib';var N=6;function ge(n){let t=n.indexOf(":");return t<0||t===n.length-1?null:{marketId:n.slice(0,t),pluginSlug:n.slice(t+1)}}function pe(n){let t=ge(n);return t?`plugins/${t.pluginSlug}`:null}function $t(n,t,e){if(!n.marketId||!n.pluginId)return null;let r=pe(n.pluginId);return r?`${t.replace(/\\/g,"/").replace(/\/+$/,"")}/${n.marketId}/${r}/${e}`:null}var Wt=3e5,rt=(()=>{let n=process.env.SKILLS_CLONE_TIMEOUT;if(!n)return Wt;let t=Number.parseInt(n,10);return Number.isFinite(t)&&t>0?t:Wt})(),Kt=promisify(execFile),L=class extends Error{constructor(e,r,s=false,i=false){super(e);b(this,"url");b(this,"isTimeout");b(this,"isAuthError");this.name="GitCloneError",this.url=r,this.isTimeout=s,this.isAuthError=i;}};function Le(n){let t=n.match(/^git@github\.com:([^/]+)\/([^/]+?)(?:\.git)?$/i);if(t){let e=t[1],r=t[2];return {owner:e,repo:r,slug:`${e}/${r}`,sshUrl:`git@github.com:${e}/${r}.git`}}try{let e=new URL(n);if(e.hostname!=="github.com")return null;let r=e.pathname.match(/^\/([^/]+)\/([^/]+?)(?:\.git)?\/?$/);if(!r)return null;let s=r[1],i=r[2];return {owner:s,repo:i,slug:`${s}/${i}`,sshUrl:`git@github.com:${s}/${i}.git`}}catch{return null}}function ve(n){try{let t=new URL(n);return t.protocol==="https:"&&t.hostname==="github.com"}catch{return false}}function Ut(n){let t=n.toLowerCase();return t.includes("saml sso")||t.includes("enforced sso")||t.includes("enabled or enforced saml")||t.includes("re-authorize the oauth application")}function Ie(n){return n.includes("Authentication failed")||n.includes("could not read Username")||n.includes("Permission denied")||n.includes("Repository not found")||n.includes("requested URL returned error: 403")||Ut(n)}function nt(n){let t={...process.env};return delete t.GIT_ASKPASS,delete t.GIT_EDITOR,delete t.GIT_SEQUENCE_EDITOR,delete t.GIT_PAGER,delete t.GIT_SSH_COMMAND,delete t.GIT_CONFIG_GLOBAL,delete t.GIT_CONFIG_SYSTEM,delete t.PAGER,delete t.EDITOR,delete t.VISUAL,t.GIT_TERMINAL_PROMPT="0",t.GIT_LFS_SKIP_SMUDGE="1",Object.assign(t,n),me({timeout:{block:rt},config:["filter.lfs.required=false","protocol.version=2","remote.origin.promisor=false"]}).env(t)}async function Nt(n){try{await rm(n,{recursive:!0,force:!0});}catch{}await mkdir(n,{recursive:true});}async function $e(n,t,e){let r=n.slug;try{let{stdout:i,stderr:o}=await Kt("gh",["auth","status","-h","github.com"],{timeout:5e3,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),l=`${i}${o}`;/Git operations protocol:\s+ssh/i.test(l)&&(r=n.sshUrl);}catch{return false}return await Kt("gh",["repo","clone",r,t,"--",...e?["--depth=1","--branch",e]:["--depth=1"]],{timeout:rt,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),true}function Re(n,t,e){return t&&Ut(e)?`GitHub blocked HTTPS access to ${n} because the organization enforces SAML SSO.
2
+ skills tried your existing git credentials and available fallbacks, but none succeeded.
3
+ - Re-authorize your GitHub credentials/app for that org's SSO policy
4
+ - Or rerun with SSH: easbot skills add ${t.sshUrl}
5
+ - Verify access with: gh auth status -h github.com or ssh -T git@github.com`:t?`Authentication failed for ${n}.
6
+ - For private repos, ensure you have access
7
+ - Retry with SSH: easbot skills add ${t.sshUrl}
8
+ - Check access with: gh auth status -h github.com or ssh -T git@github.com`:`Authentication failed for ${n}.
9
+ - For private repos, ensure you have access
10
+ - For SSH: Check your keys with 'ssh -T git@github.com'
11
+ - For HTTPS: Run 'gh auth login' or configure git credentials`}async function Ct(n,t,e){if(e){await Filesystem.mkdir(dirname(e),{recursive:true});let o=t?["--depth","1","--branch",t]:["--depth","1"];try{return await nt().clone(n,e,o),e}catch(l){throw await rm(e,{recursive:true,force:true}).catch(()=>{}),l}}let r=await mkdtemp(join(tmpdir(),"skills-")),s=t?["--depth","1","--branch",t]:["--depth","1"],i=Le(n);try{return await nt().clone(n,r,s),r}catch(o){let l=o instanceof Error?o.message:String(o),a=l.includes("block timeout")||l.includes("timed out"),c=Ie(l);if(a){try{await rm(r,{recursive:!0,force:!0});}catch{}let f=Math.round(rt/1e3);throw new L(`Clone timed out after ${f}s. Common causes:
12
+ - Large repository: raise the timeout with SKILLS_CLONE_TIMEOUT=600000 (10m)
13
+ - Slow network: retry, or clone manually and pass the local path to 'skills add'
14
+ - Private repo without credentials: ensure auth is configured
15
+ - For SSH: ssh-add -l (to check loaded keys)
16
+ - For HTTPS: gh auth status (if using GitHub CLI)`,n,true,false)}if(c&&i&&ve(n)){try{if(await Nt(r),await $e(i,r,t))return r}catch{}try{return await Nt(r),await nt({GIT_SSH_COMMAND:process.env.GIT_SSH_COMMAND??"ssh -o BatchMode=yes"}).clone(i.sshUrl,r,s),r}catch{}}try{await rm(r,{recursive:!0,force:!0});}catch{}if(c)throw new L(Re(n,i,l),n,false,true);let u=l.includes("filter.smudge")?`
17
+ - The repo defines a smudge/clean filter that Git considers unsafe.
18
+ Enable it with: git config --global protocol.allowUnsafeFilter true
19
+ Or upgrade Git, or unset filter.<driver>.* in the source repo.`:"";throw new L(`Failed to clone ${n}: ${l}${u}`,n,false,false)}}async function $n(n){let t=normalize(resolve(n)),e=normalize(resolve(tmpdir()));if(!t.startsWith(e+sep)&&t!==e)throw new Error("Attempted to clean up directory outside of temp directory");await rm(n,{recursive:true,force:true});}function V(n){if(n.type==="local")return null;let t=n.url.match(/^git@[^:]+:(.+)$/);if(t){let e=t[1];return e=e.replace(/\.git$/,""),e.includes("/")?e:null}if(n.url.startsWith("ssh://"))try{let r=new URL(n.url).pathname.slice(1);return r=r.replace(/\.git$/,""),r.includes("/")?r:null}catch{return null}if(!n.url.startsWith("http://")&&!n.url.startsWith("https://"))return null;try{let r=new URL(n.url).pathname.slice(1);if(r=r.replace(/\.git$/,""),r.includes("/"))return r}catch{}return null}function Nn(n){let t=n.match(/^([^/]+)\/([^/]+)$/);return t?{owner:t[1],repo:t[2]}:null}async function Dn(n,t){try{let e=await fetch(`https://api.github.com/repos/${n}/${t}`);return e.ok?(await e.json()).private===!0:null}catch{return null}}async function Mt(n,t){try{let e=await fetch(`https://api.github.com/repos/${n}/${t}`,{headers:{Accept:"application/vnd.github+json"}});if(!e.ok)return null;let r=await e.json();return typeof r.default_branch=="string"&&r.default_branch.length>0?r.default_branch:null}catch{return null}}function j(n){let e=n.replace(/\\/g,"/").split("/");for(let r of e)if(r==="..")throw new Error(`Unsafe subpath: "${n}" contains path traversal segments. Subpaths must not contain ".." components.`);return n}function Ke(n){return isAbsolute(n)||n.startsWith("./")||n.startsWith("../")||n==="."||n===".."||/^[a-zA-Z]:[/\\]/.test(n)}var Ne={"coinbase/agentWallet":"coinbase/agentic-wallet-skills"};function it(n){try{return decodeURIComponent(n)}catch{return n}}function De(n){if(n.startsWith("github:")||n.startsWith("gitlab:")||n.startsWith("git@")||/^ssh:\/\/.+\.git(?:$|[/?])/i.test(n))return true;if(n.startsWith("http://")||n.startsWith("https://"))try{let t=new URL(n),e=t.pathname;if(t.hostname==="github.com")return /^\/[^/]+\/[^/]+(?:\.git)?(?:\/tree\/[^/]+(?:\/.*)?)?\/?$/.test(e);if(t.hostname==="gitlab.com")return /^\/.+?\/[^/]+(?:\.git)?(?:\/-\/tree\/[^/]+(?:\/.*)?)?\/?$/.test(e)}catch{}return /^https?:\/\/.+\.git(?:$|[/?])/i.test(n)?true:!n.includes(":")&&!n.startsWith(".")&&!n.startsWith("/")&&/^([^/]+)\/([^/]+)(?:\/(.+)|@(.+))?$/.test(n)}function Ue(n){let t=n.indexOf("#");if(t<0)return {inputWithoutFragment:n};let e=n.slice(0,t),r=n.slice(t+1);if(!r)return {inputWithoutFragment:e};if(!De(e))return {inputWithoutFragment:n};let s=r.indexOf("@");if(s===-1)return {inputWithoutFragment:e,ref:it(r)};let i=r.slice(0,s),o=r.slice(s+1);return {inputWithoutFragment:e,ref:i?it(i):void 0,subpath:o?it(o):void 0}}function Ft(n,t,e){return t?`${n}#${t}${e?`@${e}`:""}`:n}function Tt(n){if(Ke(n)){let k=resolve(n);return {type:"local",url:k,localPath:k}}let{inputWithoutFragment:t,ref:e,subpath:r}=Ue(n);n=t;let s=Ne[n];s&&(n=s);let i=n.match(/^github:(.+)$/);if(i)return Tt(Ft(i[1],e,r));let o=n.match(/^gitlab:(.+)$/);if(o)return Tt(Ft(`https://gitlab.com/${o[1]}`,e,r));let l=n.match(/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/(.+)/);if(l){let[,k,g,w,y]=l;return {type:"github",url:`https://github.com/${k}/${g}.git`,ref:w||e,subpath:y&&j(y)}}let a=n.match(/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)$/);if(a){let[,k,g,w]=a;return {type:"github",url:`https://github.com/${k}/${g}.git`,ref:w||e}}let c=n.match(/github\.com\/([^/]+)\/([^/]+)/);if(c){let[,k,g]=c,w=g.replace(/\.git$/,"");return {type:"github",url:`https://github.com/${k}/${w}.git`,...e?{ref:e}:{}}}let u=n.match(/^(https?):\/\/([^/]+)\/(.+?)\/-\/tree\/([^/]+)\/(.+)/);if(u){let[,k,g,w,y,p]=u;if(g!=="github.com"&&w)return {type:"gitlab",url:`${k}://${g}/${w.replace(/\.git$/,"")}.git`,ref:y||e,subpath:p&&j(p)}}let f=n.match(/^(https?):\/\/([^/]+)\/(.+?)\/-\/tree\/([^/]+)$/);if(f){let[,k,g,w,y]=f;if(g!=="github.com"&&w)return {type:"gitlab",url:`${k}://${g}/${w.replace(/\.git$/,"")}.git`,ref:y||e}}let h=n.match(/gitlab\.com\/(.+?)(?:\.git)?\/?$/);if(h){let k=h[1];if(k.includes("/"))return {type:"gitlab",url:`https://gitlab.com/${k}.git`,...e?{ref:e}:{}}}let x=n.match(/^([^/@]+)\/([^/@]+)@(.+)?$/);if(x&&!n.includes(":")&&!n.startsWith(".")&&!n.startsWith("/")){let k=x[1],g=x[2],w=x[3];if(!w)return {type:"github",url:`https://github.com/${k}/${g}.git`,...e?{ref:e}:{}};let y=j(w);return {type:"github",url:`https://github.com/${k}/${g}.git`,...e?{ref:e}:{},...y?{subpath:y}:{}}}let E=n.match(/^([^/@]+)\/([^/@]+)(?:\/(.+?))?\/?$/);if(E&&!n.includes(":")&&!n.startsWith(".")&&!n.startsWith("/")){let[,k,g,w]=E;return {type:"github",url:`https://github.com/${k}/${g}.git`,...e?{ref:e}:{},subpath:r??(w&&j(w))}}return Ce(n)?{type:"well-known",url:n}:{type:"git",url:n,...e?{ref:e}:{},...r?{subpath:r}:{}}}function Ce(n){if(!n.startsWith("http://")&&!n.startsWith("https://"))return false;try{let t=new URL(n);return !(["github.com","gitlab.com","raw.githubusercontent.com"].includes(t.hostname)||n.endsWith(".git"))}catch{return false}}var _t="https://schemas.agentskills.io/discovery/0.2.0/schema.json",_e=/\/schemas\/agent-skills\/index\.v1\.json$/,ze=50*1024*1024,He=1e3;function Oe(n,t){let e=n.skillPath;if(typeof e=="string"&&e.trim()!==""&&e!==null)return e.replace(/^\/+/,"").replace(/\/+$/,"");if(typeof n.sourceUrl=="string"&&n.sourceUrl)try{let s=new URL(n.sourceUrl).pathname,i=/\/\.well-known\/(?:agent-skills|skills)\/(.*?)\/SKILL\.md$/,o=s.match(i);if(o?.[1])return o[1];let l=s.match(/^(.*?)\/[^/]+\/SKILL\.md$/);if(l?.[1])return l[1]}catch{}if(typeof n.installName=="string"&&n.installName){let r=n.installName.lastIndexOf("@");if(r>=0){let s=n.installName.slice(r+1);if(s.includes("/"))return s.replace(/^\/+/,"")}}return t}var st=class{constructor(){b(this,"id","well-known");b(this,"displayName","Well-Known Skills");b(this,"WELL_KNOWN_PATHS",[".well-known/agent-skills",".well-known/skills"]);b(this,"INDEX_FILE","index.json");}match(t){if(!t.startsWith("http://")&&!t.startsWith("https://"))return {matches:false};try{let e=new URL(t);return ["github.com","gitlab.com","huggingface.co"].includes(e.hostname)?{matches:!1}:{matches:!0,sourceIdentifier:`wellknown/${e.hostname}`}}catch{return {matches:false}}}async fetchIndex(t){return (await this.fetchIndexCandidates(t))[0]??null}async fetchIndexCandidates(t){try{let e=new URL(t),r=e.pathname.replace(/\/$/,""),s=[],i=r.match(/\/\.well-known\/(agent-skills|skills)\/?$/);if(i?.[1]){let l=`.well-known/${i[1]}`;s.push({indexUrl:`${e.protocol}//${e.host}${r}/${this.INDEX_FILE}`,baseUrl:`${e.protocol}//${e.host}${r.replace(/\/\.well-known\/(?:agent-skills|skills)$/,"")}`,wellKnownPath:l});}for(let l of this.WELL_KNOWN_PATHS)s.push({indexUrl:`${e.protocol}//${e.host}${r}/${l}/${this.INDEX_FILE}`,baseUrl:`${e.protocol}//${e.host}${r}`,wellKnownPath:l}),r&&r!==""&&s.push({indexUrl:`${e.protocol}//${e.host}/${l}/${this.INDEX_FILE}`,baseUrl:`${e.protocol}//${e.host}`,wellKnownPath:l});let o=[];for(let{indexUrl:l,baseUrl:a,wellKnownPath:c}of s)try{let u=await fetch(l);if(!u.ok)continue;let f=await u.json(),h=this.normalizeIndex(f,l,c);if(!h)continue;o.push({index:h.index,entries:h.entries,resolvedBaseUrl:a,resolvedWellKnownPath:c,indexUrl:l});}catch{}return o}catch{return []}}normalizeIndex(t,e,r){if(!t||typeof t!="object")return null;let s=t;if(!Array.isArray(s.skills))return null;let i=s.$schema;if(i===_t){let a=[],c=[];for(let u of s.skills){if(!this.isValidSkillEntryV2(u))continue;let f=new URL(u.url,e).toString();a.push({version:"0.2.0",name:u.name,description:u.description,type:u.type,artifactUrl:f,digest:u.digest,indexEntry:u}),c.push(u);}return a.length===0?null:{index:{$schema:_t,skills:c},entries:a}}if(typeof i=="string"&&_e.test(i)){let a=[],c=[];for(let u of s.skills){if(!this.isValidSkillEntryEasbotV1(u))continue;let f=new URL(u.sourceUrl,e).toString();a.push({version:"easbot-v1",name:u.name,description:u.description,skillMdUrl:f,installName:u.installName,indexEntry:u}),c.push(u);}return a.length===0?null:{index:{$schema:i,skills:c},entries:a}}if(i!==void 0)return null;let o=[],l=[];for(let a of s.skills){if(!this.isValidSkillEntryV1(a))return null;o.push(a),l.push({version:"0.1.0",name:a.name,description:a.description,files:a.files,baseUrl:this.getLegacySkillBaseUrl(e,r),wellKnownPath:r,indexEntry:a});}return {index:{skills:o},entries:l}}getLegacySkillBaseUrl(t,e){let r=new URL(t),s=`/${e}/${this.INDEX_FILE}`;return `${r.protocol}//${r.host}${r.pathname.slice(0,-s.length)}`}isValidSkillName(t){return !(typeof t!="string"||t.length===0||t.length>64||!/^[a-z0-9-]+$/.test(t)||t.startsWith("-")||t.endsWith("-")||t.includes("--"))}isSafeLegacyFilePath(t){return !(typeof t!="string"||t.length===0||t.startsWith("/")||t.startsWith("\\")||t.includes("..")||t.includes("\0"))}isValidSkillEntryEasbotV1(t){if(!t||typeof t!="object")return false;let e=t;if(!this.isValidSkillName(e.name)||typeof e.description!="string"||!e.description||e.description.length>1024||typeof e.sourceUrl!="string"||!e.sourceUrl)return false;try{new URL(e.sourceUrl,"https://easbot.cn/.well-known/agent-skills/index.json");}catch{return false}return true}isValidSkillEntryV1(t){if(!t||typeof t!="object")return false;let e=t;if(!this.isValidSkillName(e.name)||typeof e.description!="string"||!e.description||!Array.isArray(e.files)||e.files.length===0)return false;for(let s of e.files)if(!this.isSafeLegacyFilePath(s))return false;return e.files.some(s=>typeof s=="string"&&s.toLowerCase()==="skill.md")}isValidSkillEntryV2(t){if(!t||typeof t!="object")return false;let e=t;if(!this.isValidSkillName(e.name)||typeof e.description!="string"||!e.description||e.description.length>1024||e.type!=="skill-md"&&e.type!=="archive"||typeof e.url!="string"||!e.url||typeof e.digest!="string"||!/^sha256:[a-f0-9]{64}$/.test(e.digest))return false;try{new URL(e.url,"https://example.com/.well-known/agent-skills/index.json");}catch{return false}return true}async fetchSkill(t){try{let e=new URL(t),r=await this.fetchIndexCandidates(t);for(let s of r){let{entries:i}=s,o=null,l=e.pathname.match(/\/.well-known\/(?:agent-skills|skills)\/([^/]+)\/?$/);if(l?.[1]&&l[1]!=="index.json"?o=l[1]:i.length===1&&(o=i[0].name),!o)continue;let a=i.find(u=>u.name===o);if(!a)continue;let c=await this.fetchSkillByEntry(a);if(c)return c}return null}catch{return null}}async fetchSkillByEntry(t,e,r){return typeof t=="string"?e?this.fetchLegacySkillByEntry({version:"0.1.0",name:e.name,description:e.description,files:e.files,baseUrl:t,wellKnownPath:r??this.WELL_KNOWN_PATHS[0],indexEntry:e}):null:t.version==="0.1.0"?this.fetchLegacySkillByEntry(t):t.version==="easbot-v1"?this.fetchEasbotV1SkillByEntry(t):this.fetchArtifactSkillByEntry(t)}async fetchEasbotV1SkillByEntry(t){try{let e=await fetch(t.skillMdUrl);if(!e.ok)return null;let r=await e.text(),{data:s}=a(r);if(typeof s.name!="string"||typeof s.description!="string")return null;let i=new Map;i.set("SKILL.md",r);let o=Oe(t.indexEntry,s.name);return this.createSkill({name:s.name,description:s.description,content:r,installName:o,sourceUrl:t.skillMdUrl,metadata:s.metadata,files:i,indexEntry:t.indexEntry})}catch{return null}}async fetchLegacySkillByEntry(t){try{let e=`${t.baseUrl.replace(/\/$/,"")}/${t.wellKnownPath}/${t.name}`,r=`${e}/SKILL.md`,s=await fetch(r);if(!s.ok)return null;let i=await s.text(),{data:o}=a(i);if(typeof o.name!="string"||typeof o.description!="string")return null;let l=new Map;l.set("SKILL.md",i);let c=t.files.filter(f=>f.toLowerCase()!=="skill.md").map(async f=>{try{let h=`${e}/${f}`,x=await fetch(h);if(x.ok){let E=await x.arrayBuffer();return {path:f,content:new Uint8Array(E)}}}catch{}return null}),u=await Promise.all(c);for(let f of u)f&&l.set(f.path,f.content);return this.createSkill({name:o.name,description:o.description,content:i,installName:t.name,sourceUrl:r,metadata:o.metadata,files:l,indexEntry:t.indexEntry})}catch{return null}}async fetchArtifactSkillByEntry(t){try{let e=await fetch(t.artifactUrl);if(!e.ok)return null;let r=e.headers.get("content-type")??"",s=new Uint8Array(await e.arrayBuffer());if(this.computeDigest(s)!==t.digest)return null;if(t.type==="skill-md"){let c=new TextDecoder().decode(s),{data:u}=a(c);if(typeof u.name!="string"||typeof u.description!="string")return null;let f=new Map;return f.set("SKILL.md",c),this.createSkill({name:u.name,description:u.description,content:c,installName:t.name,sourceUrl:t.artifactUrl,metadata:u.metadata,files:f,indexEntry:t.indexEntry})}let i=this.extractArchive(s,t.artifactUrl,r),o=i.get("SKILL.md");if(!o)return null;let l=typeof o=="string"?o:new TextDecoder().decode(o);i.set("SKILL.md",l);let{data:a$1}=a(l);return typeof a$1.name!="string"||typeof a$1.description!="string"?null:this.createSkill({name:a$1.name,description:a$1.description,content:l,installName:t.name,sourceUrl:t.artifactUrl,metadata:a$1.metadata,files:i,indexEntry:t.indexEntry})}catch{return null}}createSkill(t){return {name:b$1(t.name),description:b$1(t.description),content:t.content,installName:t.installName,sourceUrl:t.sourceUrl,metadata:t.metadata&&typeof t.metadata=="object"?t.metadata:void 0,files:t.files,indexEntry:t.indexEntry}}async fetchAllSkills(t){try{let e=await this.fetchIndexCandidates(t);for(let r of e){let s=r.entries.map(l=>this.fetchSkillByEntry(l)),o=(await Promise.all(s)).filter(l=>l!==null);if(o.length>0)return o}return []}catch{return []}}computeDigest(t){return `sha256:${createHash("sha256").update(t).digest("hex")}`}extractArchive(t,e,r){if(this.isZipArchive(t,e,r))return this.extractZip(t);if(this.isTarGzArchive(t,e,r))return this.extractTarGz(t);throw new Error("Unsupported archive format")}isZipArchive(t,e,r){return r.includes("application/zip")||e.toLowerCase().endsWith(".zip")||t[0]===80&&t[1]===75}isTarGzArchive(t,e,r){let s=e.toLowerCase();return r.includes("application/gzip")||r.includes("application/x-gzip")||s.endsWith(".tar.gz")||s.endsWith(".tgz")||t[0]===31&&t[1]===139}normalizeArchivePath(t){if(!t||t.includes("\0")||t.startsWith("/")||t.startsWith("\\")||/^[A-Za-z]:/.test(t)||t.includes("\\"))return null;let e=t.split("/").filter(Boolean);return e.length===0||e.some(r=>r==="."||r==="..")?null:e.join("/")}addArchiveFile(t,e,r,s){let i=this.normalizeArchivePath(e);if(!i)throw new Error(`Unsafe archive path: ${e}`);if(s.bytes+=r.byteLength,s.bytes>ze)throw new Error("Archive exceeds maximum unpacked size");if(t.size>=He)throw new Error("Archive contains too many files");t.set(i,r);}extractTarGz(t){let e=gunzipSync(Buffer.from(t)),r=new Map,s={bytes:0},i=0;for(;i+512<=e.length;){let o=e.subarray(i,i+512);if(o.every(E=>E===0))break;let l=this.readTarString(o,0,100),a=this.readTarString(o,124,12).trim(),c=o[156],u=this.readTarString(o,345,155),f=u?`${u}/${l}`:l,h=Number.parseInt(a||"0",8);if(!Number.isFinite(h)||h<0)throw new Error("Invalid tar entry size");if(i+=512,c===50||c===49)throw new Error("Archive links are not supported");if(c===0||c===48){let E=e.subarray(i,i+h);this.addArchiveFile(r,f,new Uint8Array(E),s);}i+=Math.ceil(h/512)*512;}if(!r.has("SKILL.md"))throw new Error("Archive missing root SKILL.md");return r}readTarString(t,e,r){let s=t.subarray(e,e+r),i=s.indexOf(0);return new TextDecoder().decode(i>=0?s.subarray(0,i):s)}extractZip(t){let e=Buffer.from(t),r=this.findZipEndOfCentralDirectory(e);if(r<0)throw new Error("Invalid zip archive");let s=e.readUInt16LE(r+10),i=e.readUInt32LE(r+16),o=new Map,l={bytes:0},a=i;for(let c=0;c<s;c++){if(e.readUInt32LE(a)!==33639248)throw new Error("Invalid zip directory");let u=e.readUInt16LE(a+8),f=e.readUInt16LE(a+10),h=e.readUInt32LE(a+20),x=e.readUInt32LE(a+24),E=e.readUInt16LE(a+28),k=e.readUInt16LE(a+30),g=e.readUInt16LE(a+32),w=e.readUInt32LE(a+38),y=e.readUInt32LE(a+42),p=a+46,S=e.subarray(p,p+E),b=new TextDecoder(u&2048?"utf-8":void 0).decode(S);if(a=p+E+k+g,b.endsWith("/"))continue;if(u&1)throw new Error("Encrypted zip entries are not supported");let _=w>>>16&61440;if(_===40960||_===4096)throw new Error("Archive links are not supported");if(e.readUInt32LE(y)!==67324752)throw new Error("Invalid zip local header");let z=e.readUInt16LE(y+26),he=e.readUInt16LE(y+28),yt=y+30+z+he,St=e.subarray(yt,yt+h),H;if(f===0)H=St;else if(f===8)H=inflateRawSync(St);else throw new Error(`Unsupported zip compression method: ${f}`);if(H.byteLength!==x)throw new Error("Zip entry size mismatch");this.addArchiveFile(o,b,new Uint8Array(H),l);}if(!o.has("SKILL.md"))throw new Error("Archive missing root SKILL.md");return o}findZipEndOfCentralDirectory(t){let e=Math.max(0,t.length-65535-22);for(let r=t.length-22;r>=e;r--)if(t.readUInt32LE(r)===101010256)return r;return -1}toRawUrl(t){try{let e=new URL(t);if(t.toLowerCase().endsWith("/skill.md"))return t;let r=this.WELL_KNOWN_PATHS[0],s=e.pathname.match(/\/.well-known\/(?:agent-skills|skills)\/([^/]+)\/?$/);if(s?.[1]){let o=e.pathname.replace(/\/.well-known\/(?:agent-skills|skills)\/.*$/,"");return `${e.protocol}//${e.host}${o}/${r}/${s[1]}/SKILL.md`}let i=e.pathname.replace(/\/$/,"");return `${e.protocol}//${e.host}${i}/${r}/${this.INDEX_FILE}`}catch{return t}}getSourceIdentifier(t){try{return new URL(t).hostname.replace(/^www\./,"")}catch{return "unknown"}}async hasSkillsIndex(t){return await this.fetchIndex(t)!==null}},zt=new st;function ot(n,t){let e=normalize(resolve(t)),r=normalize(resolve(n));return r.startsWith(e+sep)||r===e}function B(n){return n.startsWith("./")}async function jt(n){let t=new Map;try{let e=await readFile(join(n,".claude-plugin/marketplace.json"),"utf-8"),r=JSON.parse(e),s=r.metadata?.pluginRoot;if(s===void 0||B(s))for(let o of r.plugins??[]){if(!o.name||typeof o.source!="string"&&o.source!==void 0||o.source!==void 0&&!B(o.source))continue;let l=join(n,s??"",o.source??"");if(ot(l,n)&&o.skills&&o.skills.length>0)for(let a of o.skills){if(!B(a))continue;let c=join(l,a);ot(c,n)&&t.set(resolve(c),o.name);}}}catch{}try{let e=await readFile(join(n,".claude-plugin/plugin.json"),"utf-8"),r=JSON.parse(e);if(r.name&&r.skills&&r.skills.length>0)for(let s of r.skills){if(!B(s))continue;let i=join(n,s);ot(i,n)&&t.set(resolve(i),r.name);}}catch{}return t}var qe=["node_modules",".git","dist","build","__pycache__"];async function Xe(n){let t=join(n,".gitignore");try{let e=await readFile(t,"utf-8");return Glob.parseGitignoreContent(e)}catch{return []}}function lt(n){return n.toLowerCase().replace(/[\s_]+/g,"-")}function Je(n){return n.split(sep).join("/").replace(/\/+/g,"/")}function Ze(){let n=process.env.INSTALL_INTERNAL_SKILLS;return n==="1"||n==="true"}async function Zt(n){try{let t=join(n,"SKILL.md");return (await stat(t)).isFile()}catch{return false}}async function Bt(n,t){try{let e=await readFile(n,"utf-8"),{data:r}=a(e);if(!r.name||!r.description||typeof r.name!="string"||typeof r.description!="string")return null;let s=r.metadata&&typeof r.metadata=="object"&&!Array.isArray(r.metadata)?r.metadata:void 0;return s?.internal===!0&&!Ze()&&!t?.includeInternal?null:{name:b$1(r.name),description:b$1(r.description),path:dirname(n),rawContent:e,metadata:s}}catch{return null}}async function Yt(n,t=0,e=5){if(t>e)return [];try{let[r,s]=await Promise.all([Zt(n),readdir(n,{withFileTypes:!0}).catch(()=>[])]),i=r?[n]:[],o=await Promise.all(s.filter(l=>l.isDirectory()&&!qe.includes(l.name)).map(l=>Yt(join(n,l.name),t+1,e)));return [...i,...o.flat()]}catch{return []}}function Ye(n,t){let e=normalize(resolve(n)),r=normalize(resolve(join(n,t)));return r.startsWith(e+sep)||r===e}async function ut(n,t,e){let r=[],s=new Set,i=await X(n),o=new Set(Object.keys(i.skills).map(lt));if(t&&!Ye(n,t))throw new Error(`Invalid subpath: "${t}" resolves outside the repository directory. Subpath must not contain ".." segments that escape the base path.`);let l=t?join(n,t):n,a=await jt(l),c=p=>{let S=resolve(p.path);return a.has(S)&&(p.pluginName=a.get(S)),p},u=k(),f=p=>{if(o.size===0)return false;let S=Je(relative(n,p.path));if(!u.some(z=>S===z||S.startsWith(`${z}/`)))return false;let wt=lt(p.name),_=lt(basename(p.path));return o.has(wt)||o.has(_)},h=async p=>{if(!await Zt(p))return false;let S=await Bt(join(p,"SKILL.md"),e);return !S||s.has(S.name)||f(S)||(S=c(S),r.push(S),s.add(S.name)),true},x=t?t.replace(/^\/+|\/+$/g,"").split("/").filter(p=>p.length>0):[],E=x.length>0?`**/${x.join("/")}/**/SKILL.md`:"**/SKILL.md",k$1=await Glob.scan(E,{cwd:l,absolute:true,ignore:[...Glob.DEFAULT_IGNORE_PATTERNS,...await Xe(l)]}),g="/",w=l.split(sep).join(g);k$1.sort((p,S)=>p.split(g).length-S.split(g).length);let y=[];for(let p of k$1){if(y.some(b=>p.startsWith(`${b}${g}`)||p===b))continue;let S=dirname(p);if(await h(S)){let b=S.split(sep).join(g);if(b===w)continue;y.push(b);}}if(r.length===0||e?.fullDepth){let p=await Yt(l);for(let S of p){let b=await Bt(join(S,"SKILL.md"),e);b&&!s.has(b.name)&&!f(b)&&(b=c(b),r.push(b),s.add(b.name));}}return r}function Qe(n){return n.name||(n.path?basename(n.path):"")}function rr(n,t){let e=t.map(r=>r.toLowerCase());return n.filter(r=>{let s=r.name.toLowerCase(),i=Qe(r).toLowerCase();return e.some(o=>o===s||o===i)})}var Qt="*";function ir(n,t){if(!n||n.length===0)return [];let e=new Set(t),r=[];for(let s of n)if(s!==Qt){if(s.includes("/")||s.includes("**")){r.push(s);continue}te.test(s)?t.some(i=>Wildcard.match(i,s))||r.push(s):e.has(s)||r.push(s);}return r}function sr(n,t){let e={wildcard:false,matched:[],invalid:[]};if(!n||n.length===0)return e;let r=new Set(t),s=new Set;for(let i of n){if(i===Qt){e.wildcard=true;continue}if(i.includes("/")||i.includes("**")){e.invalid.push(i);continue}if(te.test(i))for(let o of t)Wildcard.match(o,i)&&s.add(o);else r.has(i)?s.add(i):e.invalid.push(i);}return e.matched=Array.from(s),e}var te=/[*?[{}]/;var dt="houjallen/agent-skills";async function xr(n){let t=n.defaultPlugin;if(!t||typeof t.marketId!="string"||t.marketId.length===0)return dt;let e=n.markets[t.marketId];if(!e)return dt;let r=e.localPath??e.url;if(!r)return dt;let s=r;return e.subpath&&(s=`${s}@${e.subpath}`),e.ref&&(s=`${s}#${e.ref}`),s}function nn(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let t=n;if(typeof t.marketId!="string"||t.marketId.length===0)return null;let e={marketId:t.marketId};return typeof t.pluginId=="string"&&t.pluginId.length>0&&(e.pluginId=t.pluginId),e}function m(n){return Filesystem.normalize(n)}function ht(n){if(n==="general"||n==="coder"||n==="all")return n}function rn({scope:n}){let t=n==="project"?p():m$1(),e=Filesystem.join(t,n==="project"?".easbot":"easbot","skills");return Filesystem.normalize(e)}function M(){return Filesystem.join(m$1(),"skills","store")}function oe(){return Filesystem.join(M(),"index.json")}function J(n){let t=`${n.type}|${n.url}|${n.ref??""}`;return createHash("sha256").update(t).digest("hex")}function le(n){let t=J(n);return Filesystem.join(M(),t)}function U(){return Filesystem.join(o(),"skills","cache")}function sn(n,t,e){if(e&&e.length>0)return D(e);let r=on(n);if(r)return r;if(t?.includes("/")){let s=t.split("/")[0];if(s)return D(s)}return "default"}function on(n){let t=n.localPath??n.url;if(!t)return null;if(n.type==="well-known")try{let s=new URL(t),i=s.hostname.replace(/^www\./,"").replace(/\./g,"-"),o=s.pathname.replace(/^\/+/,"").split("/")[0]||"";return o&&!i.endsWith(`-${o}`)?D(`${i}-${o}`):D(i)}catch{return null}let e=t.match(/^(?:https?:\/\/[^/]+\/|git@[^:]+:)([^/]+)\/([^/]+?)(?:\.git)?\/?$/);if(e)return D(e[2]??"");let r=t.split(/[\\/]/).filter(Boolean).pop();return r?D(r.replace(/\.git$/,"")):null}function D(n){let t=n.trim().replace(/[:\\/\0]/g,"-").replace(/\.git$/,"").replace(/\s+/g,"-");return t.length>64&&(t=t.slice(0,64)),t.length>0?t:"default"}function Q(n){if(n.type==="well-known")return ln(n.url);let t=V(n);if(t)return Filesystem.join(U(),n.type,t);let e=createHash("sha256").update(n.url).digest("hex").slice(0,16);return Filesystem.join(U(),n.type,`unknown-${e}`)}function ln(n){let t,e;try{let r=new URL(n);t=r.hostname.replace(/^www\./,"");let s=r.pathname.match(/\/\.well-known\/(agent-skills|skills)/);s?.[1]?e=`.well-known/${s[1]}`:e=".well-known/agent-skills";}catch{let r=createHash("sha256").update(n).digest("hex").slice(0,16);return Filesystem.join(U(),"wellknown",`unknown-${r}`)}return Filesystem.join(U(),"wellknown",t,e)}async function ae(n){n.skillNames??[];if(n.type==="local")return an(n);let e=n.mode??"install",{cacheDir:r,source:s,cloneError:i}=await cn(n,e);return {tempDir:r,cacheHit:false,source:s,cloneError:i}}var pt=class extends Error{constructor(e){super(`Local source path does not exist: ${e}`);b(this,"localPath",e);this.name="LocalPathNotFoundError";}};async function an(n,t){let e=n.localPath??n.url;if(!existsSync(e))throw new pt(e);let r=le(n);return existsSync(r)&&await ce(r)?{tempDir:r,cacheHit:true,source:"local-cp",cloneError:null}:{tempDir:e,cacheHit:false,source:"local-cp",cloneError:null}}async function cn(n,t){let e=n.ref;if(!e){let l=V(n);if(l){let[a,c]=l.split("/");if(a&&c){let u=await Mt(a,c);u&&(e=u);}}}e||(e="HEAD");let r=Q(n);if(n.type==="well-known")return existsSync(r)?{cacheDir:r,source:"cache-pull",cloneError:null}:(await Filesystem.mkdir(m(r),{recursive:true}),await hn(n.url,r),{cacheDir:r,source:"well-known-fetch",cloneError:null});if(existsSync(r)){if(t==="update")try{let l=await git(["fetch","origin",e],{cwd:r});if(l.exitCode!==0){let c=await(typeof l.text=="function"?l.text():Promise.resolve(String(l.stderr||"")));throw new Error(`git fetch failed (exit=${l.exitCode}): ${c.slice(0,500)}`)}let a=await git(["reset","--hard",`origin/${e}`],{cwd:r});if(a.exitCode!==0){let c=await(typeof a.text=="function"?a.text():Promise.resolve(String(a.stderr||"")));throw new Error(`git reset --hard failed (exit=${a.exitCode}): ${c.slice(0,500)}`)}return {cacheDir:r,source:"cache-pull",cloneError:null}}catch(l){let a=l instanceof Error?l.message:String(l),c=new L(`Failed to fetch+reset ${n.url} (ref=${e}): ${a}`,n.url,false,false);return {cacheDir:r,source:"cache-pull",cloneError:c}}try{let l=await git(["checkout",e],{cwd:r});if(l.exitCode!==0){let a=await(typeof l.text=="function"?l.text():Promise.resolve(String(l.stderr||"")));throw new Error(`git checkout failed (exit=${l.exitCode}): ${a.slice(0,500)}`)}return {cacheDir:r,source:"cache-pull",cloneError:null}}catch(l){let a=l instanceof Error?l.message:String(l),c=new L(`Failed to checkout ${n.url} (ref=${e}): ${a}`,n.url,false,false);return {cacheDir:r,source:"cache-pull",cloneError:c}}}async function s(l,a,c){return Ct(l,a,c)}let i=null,o=null;try{return await Filesystem.mkdir(m(Filesystem.dirname(r)),{recursive:!0}),i=`${r}.clone-tmp`,await s(n.url,e,i),await rename(m(i),m(r)),{cacheDir:r,source:"cache-clone",cloneError:null}}catch(l){return l instanceof L?o=l:l instanceof Error&&(o=new L(`Failed to clone ${n.url}: ${l.message}`,n.url,false,false)),await Filesystem.mkdir(m(r),{recursive:true}).catch(()=>{}),{cacheDir:r,source:"cache-pull",cloneError:o}}finally{if(i)try{await rm(m(i),{recursive:!0,force:!0});}catch{}}}async function W(){let n=m(oe()),t;try{t=await Filesystem.readText(n);}catch{return {version:6,markets:{}}}let e;try{e=JSON.parse(t);}catch{try{await rename(m(n),`${m(n)}.corrupt-${Date.now()}`);}catch{}return {version:6,markets:{}}}let r=e;if(r.version!==6||!r.markets)return {version:6,markets:{}};let s={version:6,markets:r.markets};if("defaultPlugin"in r){let i=nn(r.defaultPlugin);i&&(s.defaultPlugin=i);}return s}async function tt(n){await Filesystem.writeJson(m(oe()),n);}async function Er(){let n=await W(),t={};for(let e of Object.values(n.markets))for(let r of Object.values(e.plugins))for(let[s,i]of Object.entries(r.skills))t[s]={marketId:e.id,pluginId:r.id,pluginName:r.name,storePath:e.storePath,pluginSlug:r.id.split(":").slice(1).join(":")||r.id,url:e.url,type:e.type,localPath:e.localPath,subpath:e.subpath,ref:e.ref,addedAt:e.addedAt,skillPath:i.skillPath,computedHash:i.computedHash,sourceKey:e.id,sourcePath:e.localPath??e.storePath};return t}async function br(n,t,e,r,s){let i=await W(),o=i.markets[n];o||(o={...s,id:n,addedAt:s.addedAt??new Date().toISOString(),plugins:{}},i.markets[n]=o);let l=o.plugins[t];l||(l={id:t,name:t.split(":").slice(1).join(":")||t,skills:{}},o.plugins[t]=l),l.skills[e]=r,await tt(i);}async function un(){let n=await W(),t=[];for(let e of Object.values(n.markets))for(let r of Object.values(e.plugins))for(let s of Object.values(r.skills))t.push({skillName:s.name,marketId:e.id,pluginId:r.id,entry:s});return t.sort((e,r)=>{let s=e.marketId.localeCompare(r.marketId);if(s!==0)return s;let i=e.pluginId.localeCompare(r.pluginId);return i!==0?i:e.skillName.localeCompare(r.skillName)}),t}async function fn(n){return (await un()).filter(e=>e.skillName===n)}async function Pr(n,t,e){let s=(await W()).markets[n];if(!s)return;let i=s.plugins[t];if(!i)return;let o=i.skills[e];if(o)return {skillName:o.name,marketId:n,pluginId:t,entry:o}}async function Lr(n,t,e){let r=await W(),s=r.markets[n];if(!s)return false;let i=s.plugins[t];return !i||!(e in i.skills)?false:(delete i.skills[e],await tt(r),true)}async function dn(n){let t=await fn(n);if(t.length===0)return [];let e=await W(),r=[];for(let s of t){let i=e.markets[s.marketId]?.plugins[s.pluginId];i&&n in i.skills&&(delete i.skills[n],r.push(s));}return r.length>0&&await tt(e),r}async function vr(n,t,e,r,s,i,o){await Z([{skillName:n,parsed:t,sourceKey:e,sourcePath:r,storePath:s,skillPath:i,...o&&{computedHash:o}}]);}async function Z(n){if(n.length===0)return;let t=await W(),e=new Date().toISOString();for(let i of n){let o=i.sourceKey,l=sn(i.parsed,i.skillPath,i.pluginName),a=`${o}:${l}`,c=t.markets[o];if(!c){let h=i.parsed.type==="local"?i.parsed.localPath??i.parsed.url:Q(i.parsed);c={id:o,type:i.parsed.type,url:i.parsed.url,localPath:i.parsed.localPath,subpath:i.parsed.subpath,ref:i.parsed.ref,storePath:i.storePath,cachePath:h,addedAt:e,plugins:{}},t.markets[o]=c;}let u=c.plugins[a];u||(u={id:a,name:l,sourcePath:i.parsed.subpath,skills:{}},c.plugins[a]=u);let f={name:i.skillName,description:i.description??"",skillPath:i.skillPath,computedHash:i.computedHash};i.scope&&(f.scope=i.scope),i.snapshotHash&&(f.snapshotHash=i.snapshotHash),u.skills[i.skillName]=f;}let r=new Set,s=new Map;for(let i of n)r.add(i.sourceKey),i.marketSnapshotHash&&s.set(i.sourceKey,i.marketSnapshotHash);for(let i of r){let o=t.markets[i];if(!o)continue;let l=s.get(i);if(l){o.snapshotHash=l;continue}let a=[];for(let c of Object.values(o.plugins))for(let u of Object.values(c.skills))a.push({name:u.name,snapshotHash:u.snapshotHash});o.snapshotHash=d(a);}await tt(t);}async function Ir(n){return (await dn(n)).length>0}async function hn(n,t){let e;try{e=await zt.fetchAllSkills(n);}catch{return}if(e.length!==0)for(let r of e)try{await gn(r,t);}catch{}}async function gn(n,t){let e=Filesystem.join(t,n.installName),r=Filesystem.normalize(e),s=Filesystem.normalize(t);if(!r.startsWith(`${s}/`)&&r!==s)throw new Error(`Unsafe skill dir: ${n.installName}`);await mkdir(m(e),{recursive:true});for(let[i,o]of n.files){let l=Filesystem.join(e,i),a=Filesystem.normalize(l);if(!a.startsWith(`${r}/`)&&a!==r||i.includes("\0"))continue;let c=dirname(m(l));c!==m(e)&&await mkdir(c,{recursive:true}),await writeFile(m(l),typeof o=="string"?o:Buffer.from(o));}}async function $r(n){return (await ae({type:"git",url:n.url,ref:n.ref})).tempDir}async function Rr(n,t={}){let e=le(n),r=false;if(existsSync(e)&&(r=await ce(e),!r))try{await rmdir(m(e));}catch{}if(r)if(t.mode==="update"){try{await rm(m(e),{recursive:!0,force:!0});}catch{}r=false;}else {let c=await ut(e,void 0,{includeInternal:t.includeInternal,fullDepth:t.fullDepth});if(c.length>0){let f=await Promise.all(c.map(async h=>{let x=gt(e,h.path);return {skillName:h.name,parsed:n,sourceKey:J(n),sourcePath:e,storePath:e,skillPath:x,description:h.description,scope:ht(h.metadata?.scope),...h.pluginName&&{pluginName:h.pluginName},computedHash:await b$2(h.path)}}));await Z(f);}let u=n.type==="local"?"local-cp":"cache-pull";return {storeDir:e,cacheHit:true,source:u,skills:c,blobSkills:[],cloneError:null}}let s=[];if(n.type==="github"&&!t.fullDepth){let c$1=V(n),u=c$1?.split("/")[0]?.toLowerCase(),f=!!c$1&&Object.hasOwn(c,c$1.toLowerCase());if(c$1&&u&&(f||d$1.includes(u))){let h=await l(c$1,{subpath:n.subpath,ref:n.ref,includeInternal:t.includeInternal});if(h&&h.skills.length>0){await ee(h.skills,e);let x=Q(n);await ee(h.skills,x);let E=h.skills.map(g=>({...g,path:Filesystem.join(e,g.repoSubpath??"",g.name)})),k=await Promise.all(E.map(async(g,w)=>{let y=h.skills[w],p=`${y.repoSubpath??""}${y.repoSubpath?"/":""}${y.name}`;return {skillName:g.name,parsed:n,sourceKey:J(n),sourcePath:e,storePath:e,skillPath:p,description:g.description,scope:ht(g.metadata?.scope),...g.pluginName&&{pluginName:g.pluginName},computedHash:await b$2(Filesystem.dirname(g.path)),snapshotHash:y.snapshotHash,marketSnapshotHash:h.snapshotHash}}));return await Z(k),s=h.skills,{storeDir:e,cacheHit:false,source:"blob-fetch",skills:E,blobSkills:s,cloneError:null}}}}let i=await ae(n);await Filesystem.mkdir(m(e),{recursive:true}).catch(()=>{});let o=await ut(i.tempDir,void 0,{includeInternal:t.includeInternal,fullDepth:t.fullDepth}),l$1=[],a=Filesystem.normalize(e).replace(/\\/g,"/");for(let c of o){let u=gt(i.tempDir,c.path),f=Filesystem.join(e,u),h=`${gt(i.tempDir,c.path)}/SKILL.md`,x=Filesystem.normalize(f).replace(/\\/g,"/"),E="/",k=a.endsWith(E)?a:a+E;if(!x.startsWith(k)&&x!==a)throw new Error(`[INVARIANT 0048-yyy] cp target escapes storeRoot: target=${x} storeRoot=${a}
20
+ source skill path=${c.path} (parsed.type=${n.type})
21
+ \u4E1A\u52A1\u4EFB\u4F55\u65F6\u5019\u4E0D\u80FD\u64CD\u4F5C\u7528\u6237\u7684 local \u76EE\u5F55\u6216\u6587\u4EF6\u3002`);let g;try{await Filesystem.mkdir(m(Filesystem.dirname(f)),{recursive:!0}),await cp(m(c.path),m(f),{recursive:!0}),g=await b$2(f);}catch{}c.path=f,l$1.push({skill:c,skillRel:u,sourceSkillPath:h,targetPath:f,computedHash:g});}if(l$1.length>0){let c=l$1.filter(u=>u.computedHash).map(u=>({skillName:u.skill.name,parsed:n,sourceKey:J(n),sourcePath:i.tempDir,storePath:e,skillPath:u.skillRel,description:u.skill.description,scope:ht(u.skill.metadata?.scope),...u.skill.pluginName&&{pluginName:u.skill.pluginName},computedHash:u.computedHash}));await Z(c);}return {storeDir:e,cacheHit:i.cacheHit,source:i.source,skills:o,blobSkills:[],cloneError:i.cloneError??null}}async function ee(n,t){let e=Filesystem.normalize(t);for(let r of n){let s=Filesystem.join(t,r.repoSubpath??"",r.name),i=Filesystem.normalize(s);if(!(!i.startsWith(`${e}/`)&&i!==e))try{await mkdir(m(s),{recursive:!0});for(let o of r.files){let l=Filesystem.join(s,o.path),a=Filesystem.normalize(l);if(!a.startsWith(`${i}/`)&&a!==i||o.path.includes("\0"))continue;let c=dirname(m(l));c!==m(s)&&await mkdir(c,{recursive:!0}),await writeFile(m(l),o.contents,"utf-8");}}catch{}}}function gt(n,t){let r=Filesystem.normalize(n).replace(/\\/g,"/"),s=Filesystem.normalize(t).replace(/\\/g,"/"),i=r.toLowerCase();return s.toLowerCase().startsWith(`${i}/`)?s.slice(i.length+1):""}async function ce(n){try{return (await readdir(m(n))).length>0}catch{return false}}function Ar(n){try{let t=Filesystem.normalize(n);for(let e of [U(),M()]){let r=Filesystem.normalize(e);if(t===r||t.startsWith(`${r}/`))return !0}return !1}catch{return false}}async function Wr({cachePath:n,skillName:t,scope:e}){let r=Filesystem.join(rn({scope:e}),t);return existsSync(r)&&await rm(m(r),{recursive:true,force:true}),await cp(m(n),m(r),{recursive:true}),r}async function Kr(n){let t=Q(n);existsSync(t)&&await rm(m(t),{recursive:true,force:true});}async function Nr(){let n=U();existsSync(n)&&await rm(m(n),{recursive:true,force:true});}var wn="skills-lock.json",ue=4;function fe(n){return join(n||process.cwd(),wn)}function zr(n,t){return n?$t(n,M(),t):null}async function X(n){let t=fe(n);try{let e=await readFile(t,"utf-8"),r=JSON.parse(e);return typeof r.version!="number"||!r.skills||r.version<ue?kt():r}catch{return kt()}}async function de(n,t){let e=fe(t),r={};for(let o of Object.keys(n.skills).sort())r[o]=n.skills[o];let s={version:n.version,skills:r},i=JSON.stringify(s,null,2)+`
22
+ `;await writeFile(e,i,"utf-8");}async function Hr(n,t,e){let r=await X(e),s=new Date().toISOString(),i=r.skills[n];r.skills[n]={...t,installedAt:i?.installedAt??s,updatedAt:s},await de(r,e);}async function Or(n,t){let e=await X(t);return n in e.skills?(delete e.skills[n],await de(e,t),true):false}function kt(){return {version:ue,skills:{}}}export{vr as $,ut as A,Qe as B,rr as C,ir as D,sr as E,dt as F,xr as G,nn as H,rn as I,M as J,oe as K,J as L,le as M,U as N,sn as O,Q as P,ae as Q,pt as R,W as S,tt as T,Er as U,br as V,un as W,fn as X,Pr as Y,Lr as Z,dn as _,V as a,Z as aa,Nn as b,Ir as ba,Dn as c,$r as ca,j as d,Rr as da,Tt as e,gt as ea,Wt as f,ce as fa,L as g,Ar as ga,Le as h,Wr as ha,ve as i,Kr as ia,Ut as j,Nr as ja,Ct as k,$n as l,st as m,zt as n,N as o,$t as p,ue as q,fe as r,zr as s,X as t,de as u,Hr as v,Or as w,Ze as x,Bt as y,Ye as z};
@@ -0,0 +1,5 @@
1
+ import {e,o,b,c}from'./chunk-ML6B4IQL.mjs';import {k,p,q}from'./chunk-RWZ4LFSN.mjs';import {a,b as b$1}from'./chunk-ZYDDQV73.mjs';import {mkdir,readdir,writeFile,readFile,cp,lstat,access,rm,realpath,readlink,symlink}from'fs/promises';import {existsSync}from'fs';import {join,basename,dirname,normalize,resolve,sep,relative,extname}from'path';import {homedir,platform}from'os';var V=".agents",X="skills",Se=".agents/skills";async function ge(t){try{return await b$1(t)}catch{return}}async function G(t,e,a,r,n={}){if(n.expectedMode&&n.agentType){let l=await ne(t,n.agentType,{global:a,cwd:r});if(!l.installed||l.mode!==n.expectedMode)return false}let i=await ge(e);if(!i)return false;let s;if(a){let{readSkillLock:l}=await import('./skill-lock-MNRZ7TIX.mjs');s=(await l()).skills[t]?.computedHash;}else {let{readLocalLock:l}=await import('./local-lock-ZHTDWYXF.mjs');s=(await l(r)).skills[t]?.computedHash;}return s?s===i:false}function P(t){return t.toLowerCase().replace(/[^a-z0-9._]+/g,"-").replace(/^[.-]+|[.-]+$/g,"").substring(0,255)||"unnamed-skill"}function w(t,e){let a=normalize(resolve(t)),r=normalize(resolve(e));return r.startsWith(a+sep)||r===a}function Y(t,e){return w(t,e)||w(e,t)}function N(t,e){let a=t?k()||homedir():e||p()||process.cwd();return join(a,V,X)}function te(t,e$1){let a=e$1||p()||process.cwd();return join(a,e,P(t),"skills")}function D(t,e,a,r){if(o(t,e?"global":"project"))return N(e,a);if(t==="eve"&&r)return te(r,a);let n=b[t],i=k()||homedir(),s=e?i:a||p()||process.cwd();return e?n.globalSkillsDir===void 0?join(s,n.skillsDir):n.globalSkillsDir:join(s,n.skillsDir)}function he(t,e){return resolve(dirname(t),e)}async function S(t){try{await rm(t,{recursive:!0,force:!0});}catch{}await mkdir(t,{recursive:true});}async function j(t,e){try{let a=resolve(t),r=resolve(e),[n,i]=await Promise.all([realpath(a).catch(()=>a),realpath(r).catch(()=>r)]);if(n===i)return !0;let s=q(t),l=q(e);if(s===l)return !0;try{if((await lstat(e)).isSymbolicLink()){let d=await readlink(e);if(he(e,d)===a)return !0;await rm(e);}else await rm(e,{recursive:!0});}catch(k){if(k&&typeof k=="object"&&"code"in k&&k.code==="ELOOP")try{await rm(e,{force:!0});}catch{}}let u=dirname(e);await mkdir(u,{recursive:!0});let h=q(u),g=relative(h,t),f=platform()==="win32"?"junction":void 0;return await symlink(f==="junction"?a:g,e,f),!0}catch{return false}}async function Me(t,e,a={}){let r=b[e],n=a.global??false,i=a.cwd||process.cwd(),s=a.eveSubagent;if(n&&r.globalSkillsDir===void 0)return {success:false,path:"",mode:a.mode??"symlink",error:`${r.displayName} does not support global skill installation`};let l=t.name||basename(t.path),u=P(l),h=a.mode??"symlink",f=e==="eve"&&h==="symlink"?D(e,n,i,s):N(n,i),o$1=join(f,u),k=D(e,n,i,s),d=join(k,P(t.name||basename(t.path))),c=q(d),m=q(o$1);if(!w(f,o$1))return {success:false,path:d,mode:h,error:"Invalid skill name: potential path traversal detected"};if(!w(k,d))return {success:false,path:d,mode:h,error:"Invalid skill name: potential path traversal detected"};try{if(Y(t.path,c))return {success:!0,path:c,mode:h,skipped:!0};if(h==="copy")return await G(u,t.path,n,i,{expectedMode:"copy",agentType:e})&&existsSync(c)?{success:!0,path:c,canonicalPath:m,mode:"copy",skipped:!0,skippedReason:"up-to-date"}:(await S(c),await R(t.path,c,e),{success:!0,path:c,canonicalPath:m,mode:"copy"});if(Y(t.path,c))return {success:!0,path:c,canonicalPath:m,mode:"symlink",skipped:!0};if(await G(u,t.path,n,i)&&existsSync(m)||(await S(m),await R(t.path,m,e)),!n&&o(e,"project"))return {success:!0,path:m,canonicalPath:m,mode:"copy"};if(n&&o(e,"global"))return {success:!0,path:m,canonicalPath:m,mode:"symlink"};if(!n){let z=join(i,b[e].skillsDir.split("/")[0]);if(!existsSync(z))return {success:!0,path:m,canonicalPath:m,mode:"symlink",skipped:!0}}return o$1===d?{success:!0,path:d,canonicalPath:o$1,mode:"copy"}:await j(t.path,c)?{success:!0,path:c,canonicalPath:m,mode:"symlink"}:await G(u,t.path,n,i,{expectedMode:"copy",agentType:e})&&existsSync(c)?{success:!0,path:c,canonicalPath:m,mode:"symlink",skipped:!0,skippedReason:"up-to-date"}:(await S(c),await R(t.path,c,e),{success:!0,path:c,canonicalPath:m,mode:"symlink",symlinkFailed:!0})}catch(b){return {success:false,path:c,mode:h,error:b instanceof Error?b.message:"Unknown error"}}}async function je(t,e,a={}){let{isGlobal:r=false,agentType:n,cwd:i,storePath:s}=a,l=q(t),u=q(e);if(l===u)return {success:true,path:u,canonicalPath:t,mode:"copy"};if(!r&&n&&i&&!o(n,"project")){let f=join(i,b[n].skillsDir.split("/")[0]);if(!existsSync(f))return {success:true,path:e,canonicalPath:t,mode:"symlink",skipped:true}}let h=s?q(s):l;return await j(h,u)?{success:true,path:e,canonicalPath:t,mode:"symlink"}:{success:true,path:e,canonicalPath:t,mode:"symlink",symlinkFailed:true}}async function _e(t,e,a={}){let{agentType:r="easbot"}=a,n=q(t),i=q(e);if(n===i)return {success:true,path:i,canonicalPath:t,mode:"copy"};try{return await S(i),await R(n,i,r),{success:!0,path:i,canonicalPath:t,mode:"copy"}}catch(s){return {success:false,path:e,mode:"copy",error:s instanceof Error?s.message:"Unknown error"}}}var ke=new Set(["metadata.json"]),we=new Set([".git","__pycache__","__pypackages__"]),ye=(t,e=false)=>!!(ke.has(t)||e&&we.has(t));function L(t){let{data:e,content:a$1}=a(t),r={};if(typeof e.description=="string"&&(r.description=e.description),typeof e.license=="string"&&(r.license=e.license),e.metadata&&typeof e.metadata=="object"&&!Array.isArray(e.metadata)){let s=Object.fromEntries(Object.entries(e.metadata).filter(l=>typeof l[1]=="string"));Object.keys(s).length>0&&(r.metadata=s);}let n=Object.keys(r);return n.length===0?a$1.replace(/^\r?\n/u,""):`---
2
+ ${n.map(s=>`${s}: ${JSON.stringify(r[s])}`).join(`
3
+ `)}
4
+ ---
5
+ ${a$1.replace(/^\r?\n/u,"")}`}async function R(t,e,a){await mkdir(e,{recursive:true});let r=await readdir(t,{withFileTypes:true});await Promise.all(r.filter(n=>!ye(n.name,n.isDirectory())).map(async n=>{let i=join(t,n.name),s=join(e,n.name);if(n.isDirectory())await R(i,s,a);else try{if(a==="eve"&&n.name.toLowerCase()==="skill.md"){await writeFile(s,L(await readFile(i,"utf-8")));return}await cp(i,s,{dereference:!0,recursive:!0});}catch(l){if(l instanceof Error&&"code"in l&&l.code==="ENOENT"&&n.isSymbolicLink())console.warn(`Skipping broken symlink: ${i}`);else throw l}}));}function be(t){return t.some(e=>basename(e.path).toLowerCase()==="skill.md")}function U(t){return `${P(t)}.md`}function ve(t){let e=t.find(r=>basename(r.path).toLowerCase()==="skill.md");if(e)return L(e.contents);let a=t.find(r=>extname(r.path).toLowerCase()===".md");return a?L(a.contents):""}async function Ue(t,e,a={}){return (await ne(t,e,a)).installed}async function ne(t,e,a={}){let r=b[e],n=P(t);if(a.global&&r.globalSkillsDir===void 0)return {installed:false,mode:null,path:""};let i=a.global?r.globalSkillsDir:e==="eve"&&a.eveSubagent?te(a.eveSubagent,a.cwd):join(a.cwd||process.cwd(),r.skillsDir),s=join(i,n);if(!w(i,s))return {installed:false,mode:null,path:""};try{let l=await lstat(s);return l.isSymbolicLink()?{installed:!0,mode:"symlink",path:s}:l.isDirectory()?{installed:!0,mode:"copy",path:s}:{installed:!1,mode:null,path:s}}catch{return {installed:false,mode:null,path:s}}}function Be(t,e,a={}){let r=P(t),n=D(e,a.global??false,a.cwd,a.eveSubagent),i=join(n,r);if(!w(n,i))throw new Error("Invalid skill name: potential path traversal detected");return i}async function O(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 $e(t,e={}){let a=P(t),r=e.agent==="eve"?D("eve",e.global??false,e.cwd,e.eveSubagent):N(e.global??false,e.cwd),n=join(r,a);if(!w(r,n))throw new Error("Invalid skill name: potential path traversal detected");return n}async function ze(t,e,a={}){let r=b[e],n=a.global??false,i=a.cwd||process.cwd(),s=a.mode??"symlink",l=a.eveSubagent;if(n&&r.globalSkillsDir===void 0)return {success:false,path:"",mode:s,error:`${r.displayName} does not support global skill installation`};let u=P(t.installName),h=e==="eve"&&s==="symlink"?D(e,n,i,l):N(n,i),g=join(h,u),f=D(e,n,i,l),o$1=join(f,u);if(!w(h,g))return {success:false,path:o$1,mode:s,error:"Invalid skill name: potential path traversal detected"};if(!w(f,o$1))return {success:false,path:o$1,mode:s,error:"Invalid skill name: potential path traversal detected"};try{if(s==="copy"){await S(o$1);let c=e==="eve"?U(t.installName):"SKILL.md",m=join(o$1,c);return await writeFile(m,e==="eve"?L(t.content):t.content,"utf-8"),{success:!0,path:o$1,mode:"copy"}}let k=e==="eve"?U(t.installName):"SKILL.md";if(await O(g,async c=>{let m=join(c,k);await writeFile(m,e==="eve"?L(t.content):t.content,"utf-8");}),n&&o(e,"global"))return {success:!0,path:g,canonicalPath:g,mode:"symlink"};if(!await j(g,o$1)){await S(o$1);let c=e==="eve"?U(t.installName):"SKILL.md",m=join(o$1,c);return await writeFile(m,e==="eve"?L(t.content):t.content,"utf-8"),{success:!0,path:o$1,canonicalPath:g,mode:"symlink",symlinkFailed:!0}}return {success:!0,path:o$1,canonicalPath:g,mode:"symlink"}}catch(k){return {success:false,path:o$1,mode:s,error:k instanceof Error?k.message:"Unknown error"}}}async function Ke(t,e,a={}){let r=b[e],n=a.global??false,i=a.cwd||process.cwd(),s=a.mode??"symlink",l=a.eveSubagent;if(n&&r.globalSkillsDir===void 0)return {success:false,path:"",mode:s,error:`${r.displayName} does not support global skill installation`};let u=P(t.installName),h=e==="eve"&&s==="symlink"?D(e,n,i,l):N(n,i),g=join(h,u),f=D(e,n,i,l),o$1=join(f,u);if(!w(h,g))return {success:false,path:o$1,mode:s,error:"Invalid skill name: potential path traversal detected"};if(!w(f,o$1))return {success:false,path:o$1,mode:s,error:"Invalid skill name: potential path traversal detected"};async function k(d){for(let[c,m]of t.files){let b=join(d,c);if(!w(d,b))continue;let $=dirname(b);$!==d&&await mkdir($,{recursive:true}),await writeFile(b,e==="eve"&&basename(c).toLowerCase()==="skill.md"&&typeof m=="string"?L(m):m);}}try{return s==="copy"?(await S(o$1),await k(o$1),{success:!0,path:o$1,mode:"copy"}):(await O(g,k),n&&o(e,"global")?{success:!0,path:g,canonicalPath:g,mode:"symlink"}:await j(g,o$1)?{success:!0,path:o$1,canonicalPath:g,mode:"symlink"}:(await S(o$1),await k(o$1),{success:!0,path:o$1,canonicalPath:g,mode:"symlink",symlinkFailed:!0}))}catch(d){return {success:false,path:o$1,mode:s,error:d instanceof Error?d.message:"Unknown error"}}}async function Ge(t,e,a={}){let r=b[e],n=a.global??false,i=a.cwd||process.cwd(),s=a.mode??"symlink",l=a.eveSubagent;if(n&&r.globalSkillsDir===void 0)return {success:false,path:"",mode:s,error:`${r.displayName} does not support global skill installation`};let u=P(t.installName),h=D(e,n,i,l);if(e==="eve"&&!be(t.files)){let d=join(h,U(t.installName));if(!w(h,d))return {success:false,path:d,mode:s,error:"Invalid skill name: potential path traversal detected"};try{return await mkdir(h,{recursive:!0}),await rm(d,{recursive:!0,force:!0}),await writeFile(d,ve(t.files),"utf-8"),{success:!0,path:d,mode:"copy"}}catch(c){return {success:false,path:d,mode:s,error:c instanceof Error?c.message:"Unknown error"}}}let g=e==="eve"&&s==="symlink"?D(e,n,i,l):N(n,i),f=join(g,u),o$1=join(h,u);if(!w(g,f))return {success:false,path:o$1,mode:s,error:"Invalid skill name: potential path traversal detected"};if(!w(h,o$1))return {success:false,path:o$1,mode:s,error:"Invalid skill name: potential path traversal detected"};async function k(d){for(let c of t.files){let m=join(d,c.path);if(!w(d,m))continue;let b=dirname(m);b!==d&&await mkdir(b,{recursive:true}),await writeFile(m,e==="eve"&&basename(c.path).toLowerCase()==="skill.md"?L(c.contents):c.contents,"utf-8");}}try{if(s==="copy")return await S(o$1),await k(o$1),{success:!0,path:o$1,mode:"copy"};if(await O(f,k),n&&o(e,"global"))return {success:!0,path:f,canonicalPath:f,mode:"symlink"};if(!n&&!o(e,"project")){let c=join(i,b[e].skillsDir.split("/")[0]);if(!existsSync(c))return {success:!0,path:f,canonicalPath:f,mode:"symlink",skipped:!0}}return await j(f,o$1)?{success:!0,path:o$1,canonicalPath:f,mode:"symlink"}:(await S(o$1),await k(o$1),{success:!0,path:o$1,canonicalPath:f,mode:"symlink",symlinkFailed:!0})}catch(d){return {success:false,path:o$1,mode:s,error:d instanceof Error?d.message:"Unknown error"}}}async function Oe(t={}){let e=t.cwd||process.cwd(),{scanInstalledSkillDirs:a}=await import('./scan-6W47D2KJ.mjs'),r=t.agentFilter?null:await c(),n=t.agentFilter??r??void 0,i=await a({scope:t.scope,cwd:e,agentFilter:n}),s=u=>u.replace(/\\/g,"/").replace(/\/[^/]+\/?$/,"").replace(/\/+$/,""),l=new Map;for(let u of i){let h=s(u.skillDir),g=`${u.scope}::${h}::${u.name}`,f=l.get(g);if(f){for(let o of u.agents)f.agents.includes(o)||f.agents.push(o);continue}l.set(g,{name:u.name,description:"",path:u.skillDir,canonicalPath:u.skillDir,scope:u.scope,agents:[...u.agents]});}return Array.from(l.values())}export{V as a,X as b,Se as c,P as d,N as e,te as f,D as g,Me as h,je as i,_e as j,Ue as k,ne as l,Be as m,O as n,$e as o,ze as p,Ke as q,Ge as r,Oe as s};
@@ -1 +1 @@
1
- 'use strict';var chunkOWG6N2K6_cjs=require('./chunk-OWG6N2K6.cjs'),chunkJFEBB5CL_cjs=require('./chunk-JFEBB5CL.cjs'),chunkTCFGU43L_cjs=require('./chunk-TCFGU43L.cjs'),utils=require('@easbot/utils'),promises=require('fs/promises'),path=require('path');async function v(i={}){let o=i.cwd??process.cwd(),e=i.scope??"project",r=chunkTCFGU43L_cjs.u({cwd:o,agentFilter:i.agentFilter}),s;if(e==="project"?s=r.project:e==="global"?s=r.global:s=r.all,s.length===0)return [];let a=new Set,c=[],T=await Promise.all(s.map(n=>utils.Glob.scan(n,{cwd:o,absolute:true,ignore:utils.Glob.DEFAULT_IGNORE_PATTERNS,follow:true})));for(let n of T)for(let l of n)a.has(l)||(a.add(l),c.push(l));let $=Object.keys(chunkTCFGU43L_cjs.e),G="/",m=[],F=o.replace(/\\/g,"/"),M=chunkTCFGU43L_cjs.v();for(let n of c){let l=path.dirname(n),g=l.replace(/\\/g,"/"),p=g.split(G),B=p.length>=3?`${p[p.length-3]??""}/${p[p.length-2]??""}`:"",d=await chunkJFEBB5CL_cjs.z(n);if(!d)continue;let E=g.startsWith(`${F}/`),I=M.some(t=>t!==""&&g.startsWith(`${t}/`)),f=E&&!I?"project":"global",k=[],R=e==="both"?f==="project":e==="project",C=e==="both"?f==="global":e==="global",b=t=>t.replace(/\\/g,"/"),L=b(l).replace(/\/[^/]+\/?$/,"");for(let t of $){let P=chunkTCFGU43L_cjs.e[t],S=[];R&&P.skillsDir!==void 0&&S.push(chunkOWG6N2K6_cjs.g(t,false,o)),C&&P.globalSkillsDir!==void 0&&S.push(chunkOWG6N2K6_cjs.g(t,true,o));for(let w of S)if(b(w).replace(/\/+$/,"")===L)try{let D=path.join(w,d.name);if(!(await promises.stat(D)).isDirectory())continue;await promises.realpath(D),k.includes(t)||k.push(t);break}catch{}}m.push({name:d.name,skillDir:l,skillMdPath:n,parentDir:B,scope:f,agents:k});}return m}async function Y(i={}){let o=await v(i),e=new Set,r=[];for(let s of o){let a=`${s.scope}:${s.name}`;if(e.has(a))continue;e.add(a);let c=await chunkJFEBB5CL_cjs.z(s.skillMdPath);c&&r.push(c);}return r}exports.a=v;exports.b=Y;
1
+ 'use strict';var chunkUGHF4GOW_cjs=require('./chunk-UGHF4GOW.cjs'),chunkJCOXRETY_cjs=require('./chunk-JCOXRETY.cjs'),chunkISMGLHYS_cjs=require('./chunk-ISMGLHYS.cjs'),utils=require('@easbot/utils'),promises=require('fs/promises'),path=require('path');async function v(i={}){let o=i.cwd??process.cwd(),e=i.scope??"project",r=chunkISMGLHYS_cjs.r({cwd:o,agentFilter:i.agentFilter}),s;if(e==="project"?s=r.project:e==="global"?s=r.global:s=r.all,s.length===0)return [];let a=new Set,c=[],T=await Promise.all(s.map(n=>utils.Glob.scan(n,{cwd:o,absolute:true,ignore:utils.Glob.DEFAULT_IGNORE_PATTERNS,follow:true})));for(let n of T)for(let l of n)a.has(l)||(a.add(l),c.push(l));let $=Object.keys(chunkISMGLHYS_cjs.b),G="/",m=[],F=o.replace(/\\/g,"/"),M=chunkISMGLHYS_cjs.s();for(let n of c){let l=path.dirname(n),g=l.replace(/\\/g,"/"),p=g.split(G),B=p.length>=3?`${p[p.length-3]??""}/${p[p.length-2]??""}`:"",d=await chunkJCOXRETY_cjs.y(n);if(!d)continue;let E=g.startsWith(`${F}/`),I=M.some(t=>t!==""&&g.startsWith(`${t}/`)),f=E&&!I?"project":"global",k=[],R=e==="both"?f==="project":e==="project",C=e==="both"?f==="global":e==="global",b=t=>t.replace(/\\/g,"/"),L=b(l).replace(/\/[^/]+\/?$/,"");for(let t of $){let P=chunkISMGLHYS_cjs.b[t],S=[];R&&P.skillsDir!==void 0&&S.push(chunkUGHF4GOW_cjs.g(t,false,o)),C&&P.globalSkillsDir!==void 0&&S.push(chunkUGHF4GOW_cjs.g(t,true,o));for(let w of S)if(b(w).replace(/\/+$/,"")===L)try{let D=path.join(w,d.name);if(!(await promises.stat(D)).isDirectory())continue;await promises.realpath(D),k.includes(t)||k.push(t);break}catch{}}m.push({name:d.name,skillDir:l,skillMdPath:n,parentDir:B,scope:f,agents:k});}return m}async function Y(i={}){let o=await v(i),e=new Set,r=[];for(let s of o){let a=`${s.scope}:${s.name}`;if(e.has(a))continue;e.add(a);let c=await chunkJCOXRETY_cjs.y(s.skillMdPath);c&&r.push(c);}return r}exports.a=v;exports.b=Y;
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkE7AHWFZN_cjs=require('./chunk-E7AHWFZN.cjs');var E=/\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]/g,T=/\x1b\][\s\S]*?(?:\x07|\x1b\\)/g,A=/\x1b[P^_][\s\S]*?(?:\x1b\\)/g,D=/\x1b[\x20-\x7e]/g,$=/[\x80-\x9f]/g,B=/[\x00-\x06\x07\x08\x0b\x0c\x0d-\x1a\x1c-\x1f\x7f]/g;function H(n){return n.replace(T,"").replace(A,"").replace(E,"").replace(D,"").replace($,"").replace(B,"")}function w(n){return H(n).replace(/[\r\n]+/g," ").trim()}var F=process.env.SKILLS_DOWNLOAD_URL||"https://skills.sh",M={},q=["houjallen","vercel-labs","anthropics"],R=3e5;function O(n){return n.toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}var L=false;function J(){L=false;}async function k(n,s,t){try{let o=`https://api.github.com/repos/${n}/git/trees/${encodeURIComponent(s)}?recursive=1`,r={Accept:"application/vnd.github.v3+json","User-Agent":"skills-cli"};t&&(r.Authorization=`Bearer ${t}`);let i=await fetch(o,{headers:r,signal:AbortSignal.timeout(R)});if(i.ok){let a=await i.json();return {tree:{sha:a.sha,branch:s,tree:a.tree},rateLimited:!1}}return {tree:null,rateLimited:i.status===403&&i.headers.get("x-ratelimit-remaining")==="0"}}catch{return {tree:null,rateLimited:false}}}async function y(n,s,t){let o=s?[s]:["HEAD","main","master"];if(L&&t){let c=t();if(!c)return null;for(let a of o){let g=await k(n,a,c);if(g.tree)return g.tree}return null}let r=false;for(let c of o){let a=await k(n,c,null);if(a.tree)return a.tree;if(a.rateLimited){r=true;break}}if(!r||!t)return null;L=true;let i=t();if(!i)return null;for(let c of o){let a=await k(n,c,i);if(a.tree)return a.tree}return null}async function W(n,s,t){let o=await y(n,s,t);return o?{tree:o,snapshotHash:o.sha}:null}function U(n,s){let t=s.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?n.tree.find(r=>r.type==="tree"&&r.path===t)?.sha??null:n.sha}async function Q(n,s,t,o){let r=await W(n,t,o);return r?U(r.tree,s):null}function v(n,s={}){let t=new Set(["node_modules",".git","dist","build","__pycache__"]),o=s.maxDepth??5,r=s.limit??100,i=s.subpath??"",a=(i?i.endsWith("/")?i.slice(0,-1):i:"").replace(/\\/g,"/"),g=n.tree.filter(e=>e.type==="blob"&&e.path.toLowerCase().endsWith("skill.md")).map(e=>e.path);if(g.length===0)return [];let p=[],S=new Set;for(let e of g){if(a!==""&&e!==a&&e!==`${a}.SKILL.md`&&!e.startsWith(`${a}/`))continue;let l=e.split("/");l.length===0||l.length>o||l[l.length-1].toLowerCase()==="skill.md"&&(l.some(u=>t.has(u)||u===".well-known")||S.has(e)||(S.add(e),p.push(e)));}return p.length>r?(console.warn(`[blob.findSkillMdPaths] tree has ${p.length} SKILL.md > limit=${r}\uFF0C\u5DF2\u622A\u65AD\u3002\u8981\u62FF\u5168\u90E8\u4F20 \`limit: Infinity\`\u3002`),p.slice(0,r)):p}async function z(n,s,t){let o=`https://raw.githubusercontent.com/${n}/${s}/${t}`,r=3;for(let i=0;i<r;i++){try{let c=await fetch(o,{signal:AbortSignal.timeout(R)});if(c.ok)return await c.text();if(i===r-1)return null}catch{if(i===r-1)return null}await new Promise(c=>setTimeout(c,500*2**i));}return null}async function K(n,s){try{let[t,o]=n.split("/"),r=`${F}/api/download/${encodeURIComponent(t)}/${encodeURIComponent(o)}/${encodeURIComponent(s)}`,c=M[n.toLowerCase()]?.downloadUrl(s)??r,a=await fetch(c,{signal:AbortSignal.timeout(R)});return a.ok?await a.json():null}catch{return null}}async function Y(n,s={}){let t=await y(n,s.ref,s.getToken);if(!t)return null;let o=v(t,{subpath:s.subpath});if(o.length===0)return null;let r=await Promise.all(o.map(async e=>{let l=await z(n,t.branch,e);return {mdPath:e,content:l}})),i=[];for(let{mdPath:e,content:l}of r){if(!l)continue;let{data:u}=chunkE7AHWFZN_cjs.a(l);if(!u.name||!u.description||typeof u.name!="string"||typeof u.description!="string"||u.metadata?.internal===true&&!s.includeInternal)continue;let d=w(u.name),m=w(u.description);i.push({mdPath:e,name:d,description:m,content:l,slug:O(d),metadata:u.metadata});}if(i.length===0)return null;let c=n.toLowerCase(),a=await Promise.all(i.map(async e=>{let l=await K(c,e.slug);return {skill:e,download:l}}));if(!a.every(e=>e.download!==null))return null;let p=a.map(({skill:e,download:l})=>{let u=e.mdPath.toLowerCase(),h=u.endsWith("/skill.md")?e.mdPath.slice(0,-9):u==="skill.md"?"":e.mdPath.slice(0,-9),d=h?l.files:l.files.filter(f=>f.path.toLowerCase()==="skill.md"),m=h?h.split("/").pop():"",b=h?d.map(f=>{let x=f.path.startsWith(`${h}/`)?f.path.slice(h.length+1):f.path;return m&&x.startsWith(`${m}/`)?{path:x.slice(m.length+1),contents:f.contents}:{path:x,contents:f.contents}}):d,I=h.includes("/")?h.slice(0,h.lastIndexOf("/")):"";return {name:e.name,description:e.description,path:"",rawContent:e.content,metadata:e.metadata,files:b,snapshotHash:b.length===l.files.length?l.hash:chunkE7AHWFZN_cjs.c(b),repoPath:e.mdPath,repoSubpath:I}}),S=t.sha;return {skills:p,tree:t,subpath:s.subpath,snapshotHash:S}}
2
+ exports.a=H;exports.b=w;exports.c=M;exports.d=q;exports.e=O;exports.f=J;exports.g=y;exports.h=W;exports.i=U;exports.j=Q;exports.k=v;exports.l=Y;
@@ -0,0 +1,2 @@
1
+ 'use strict';var yaml=require('yaml'),crypto=require('crypto'),promises=require('fs/promises'),path=require('path');function w(s){let r=s.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);return r?{data:yaml.parse(r[1])??{},content:r[2]??""}:{data:{},content:s}}var P=new Set([".git","node_modules"]);async function c(s,r,e){let n=await promises.readdir(r,{withFileTypes:true});await Promise.all(n.map(async t=>{let o=path.join(r,t.name);if(t.isDirectory()){if(P.has(t.name))return;await c(s,o,e);}else if(t.isFile()){let h=await promises.readFile(o),f=path.relative(s,o).split(path.sep).join("/");e.push({path:f,contents:h});}}));}function p(s){let r=[...s].sort((n,t)=>n.path.localeCompare(t.path)),e=crypto.createHash("sha256");for(let n of r){let t=n.path.split(path.sep).join("/");e.update(t);let o=typeof n.contents=="string"?Buffer.from(n.contents,"utf8"):n.contents;e.update(o);}return e.digest("hex")}async function F(s){let r=[];return await c(s,s,r),p(r)}function B(s){return p(s)}function j(s){let r=[];if(s instanceof Map)for(let[n,t]of s)typeof t=="string"&&t.length>0&&r.push([n,t]);else for(let n of s){let t=n?.snapshotHash,o=n?.name;t&&t.length>0&&o&&r.push([o,t]);}r.sort((n,t)=>n[0].localeCompare(t[0]));let e=crypto.createHash("sha256");for(let[n,t]of r)e.update(`${n}=${t}
2
+ `);return e.digest("hex")}exports.a=w;exports.b=F;exports.c=B;exports.d=j;
@@ -0,0 +1 @@
1
+ 'use strict';var chunkXGUPIAAF_cjs=require('./chunk-XGUPIAAF.cjs'),fs=require('fs'),path=require('path'),os=require('os'),xdgBasedir=require('xdg-basedir'),utils=require('@easbot/utils');function l(){return chunkXGUPIAAF_cjs.k()}function o(){return xdgBasedir.xdgConfig??path.join(chunkXGUPIAAF_cjs.k(),".config")}function p(){return process.env.CODEX_HOME?.trim()||path.join(l(),".codex")}function y(){return process.env.CLAUDE_CONFIG_DIR?.trim()||path.join(l(),".claude")}function D(){return process.env.VIBE_HOME?.trim()||path.join(l(),".vibe")}function b(){return process.env.HERMES_HOME?.trim()||path.join(l(),".hermes")}function f(){return process.env.AUTOHAND_HOME?.trim()||path.join(l(),".autohand")}function S(){return process.env.APPDATA?.trim()}function I(){return process.env.FLATPAK_XDG_CONFIG_HOME?.trim()}function G(t,n){try{let i=JSON.parse(fs.readFileSync(t,"utf-8"));return !!(i.dependencies?.[n]||i.devDependencies?.[n])}catch{return false}}function E(t=l(),n=fs.existsSync){return n(path.join(t,".openclaw"))?path.join(t,".openclaw/skills"):n(path.join(t,".clawdbot"))?path.join(t,".clawdbot/skills"):n(path.join(t,".moltbot"))?path.join(t,".moltbot/skills"):path.join(t,".openclaw/skills")}var a={easbot:{name:"easbot",displayName:"EASBot",skillsDir:".easbot/skills",get globalSkillsDir(){return path.join(chunkXGUPIAAF_cjs.l(),"easbot","skills")},detectInstalled:async()=>true},"aider-desk":{name:"aider-desk",displayName:"AiderDesk",skillsDir:".aider-desk/skills",get globalSkillsDir(){return path.join(l(),".aider-desk/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".aider-desk"))},amp:{name:"amp",displayName:"Amp",skillsDir:".agents/skills",get globalSkillsDir(){return path.join(o(),"agents/skills")},detectInstalled:async()=>fs.existsSync(path.join(o(),"amp"))},antigravity:{name:"antigravity",displayName:"Antigravity",skillsDir:".agents/skills",get globalSkillsDir(){return 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",get globalSkillsDir(){return 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",get globalSkillsDir(){return 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",get globalSkillsDir(){return path.join(f(),"skills")},detectInstalled:async()=>fs.existsSync(f())},augment:{name:"augment",displayName:"Augment",skillsDir:".augment/skills",get globalSkillsDir(){return path.join(l(),".augment/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".augment"))},bob:{name:"bob",displayName:"IBM Bob",skillsDir:".bob/skills",get globalSkillsDir(){return path.join(l(),".bob/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".bob"))},"claude-code":{name:"claude-code",displayName:"Claude Code",skillsDir:".claude/skills",get globalSkillsDir(){return path.join(y(),"skills")},detectInstalled:async()=>fs.existsSync(y())},openclaw:{name:"openclaw",displayName:"OpenClaw",skillsDir:".openclaw/skills",get globalSkillsDir(){return E()},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",get globalSkillsDir(){return path.join(l(),".agents","skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".cline"))},"codearts-agent":{name:"codearts-agent",displayName:"CodeArts Agent",skillsDir:".codeartsdoer/skills",get globalSkillsDir(){return path.join(l(),".codeartsdoer/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".codeartsdoer"))},codebuddy:{name:"codebuddy",displayName:"CodeBuddy",skillsDir:".codebuddy/skills",get globalSkillsDir(){return 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",get globalSkillsDir(){return path.join(l(),".codemaker/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".codemaker"))},codestudio:{name:"codestudio",displayName:"Code Studio",skillsDir:".codestudio/skills",get globalSkillsDir(){return path.join(l(),".codestudio/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".codestudio"))},codex:{name:"codex",displayName:"Codex",skillsDir:".agents/skills",get globalSkillsDir(){return path.join(p(),"skills")},detectInstalled:async()=>fs.existsSync(p())||fs.existsSync("/etc/codex")},"command-code":{name:"command-code",displayName:"Command Code",skillsDir:".commandcode/skills",get globalSkillsDir(){return path.join(l(),".commandcode/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".commandcode"))},continue:{name:"continue",displayName:"Continue",skillsDir:".continue/skills",get globalSkillsDir(){return 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",get globalSkillsDir(){return path.join(l(),".snowflake/cortex/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".snowflake/cortex"))},crush:{name:"crush",displayName:"Crush",skillsDir:".crush/skills",get globalSkillsDir(){return path.join(l(),".config/crush/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".config/crush"))},cursor:{name:"cursor",displayName:"Cursor",skillsDir:".agents/skills",get globalSkillsDir(){return path.join(l(),".cursor/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".cursor"))},deepagents:{name:"deepagents",displayName:"Deep Agents",skillsDir:".agents/skills",get globalSkillsDir(){return path.join(l(),".deepagents/agent/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".deepagents"))},devin:{name:"devin",displayName:"Devin for Terminal",skillsDir:".devin/skills",get globalSkillsDir(){return path.join(o(),"devin/skills")},detectInstalled:async()=>fs.existsSync(path.join(o(),"devin"))},dexto:{name:"dexto",displayName:"Dexto",skillsDir:".agents/skills",get globalSkillsDir(){return path.join(l(),".agents/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".dexto"))},droid:{name:"droid",displayName:"Droid",skillsDir:".factory/skills",get globalSkillsDir(){return 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 t=process.cwd();return fs.existsSync(path.join(t,"agent"))&&G(path.join(t,"package.json"),"eve")}},firebender:{name:"firebender",displayName:"Firebender",skillsDir:".agents/skills",get globalSkillsDir(){return path.join(l(),".firebender/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".firebender"))},forgecode:{name:"forgecode",displayName:"ForgeCode",skillsDir:".forge/skills",get globalSkillsDir(){return path.join(l(),".forge/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".forge"))},"gemini-cli":{name:"gemini-cli",displayName:"Gemini CLI",skillsDir:".agents/skills",get globalSkillsDir(){return path.join(l(),".gemini/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".gemini"))},"github-copilot":{name:"github-copilot",displayName:"GitHub Copilot",skillsDir:".agents/skills",get globalSkillsDir(){return path.join(l(),".copilot/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".copilot"))},goose:{name:"goose",displayName:"Goose",skillsDir:".goose/skills",get globalSkillsDir(){return path.join(o(),"goose/skills")},detectInstalled:async()=>fs.existsSync(path.join(o(),"goose"))},"hermes-agent":{name:"hermes-agent",displayName:"Hermes Agent",skillsDir:".hermes/skills",get globalSkillsDir(){return path.join(b(),"skills")},detectInstalled:async()=>fs.existsSync(b())},"inference-sh":{name:"inference-sh",displayName:"inference.sh",skillsDir:".inferencesh/skills",get globalSkillsDir(){return path.join(l(),".inferencesh/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".inferencesh"))},jazz:{name:"jazz",displayName:"Jazz",skillsDir:".jazz/skills",get globalSkillsDir(){return 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",get globalSkillsDir(){return path.join(l(),".junie/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".junie"))},"iflow-cli":{name:"iflow-cli",displayName:"iFlow CLI",skillsDir:".iflow/skills",get globalSkillsDir(){return path.join(l(),".iflow/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".iflow"))},kilo:{name:"kilo",displayName:"Kilo Code",skillsDir:".kilocode/skills",get globalSkillsDir(){return 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",get globalSkillsDir(){return 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",get globalSkillsDir(){return path.join(l(),".kiro/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".kiro"))},kode:{name:"kode",displayName:"Kode",skillsDir:".kode/skills",get globalSkillsDir(){return path.join(l(),".kode/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".kode"))},lingma:{name:"lingma",displayName:"Lingma",skillsDir:".lingma/skills",get globalSkillsDir(){return path.join(l(),".lingma/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".lingma"))},loaf:{name:"loaf",displayName:"Loaf",skillsDir:".agents/skills",get globalSkillsDir(){return path.join(l(),".agents/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".loaf"))},mcpjam:{name:"mcpjam",displayName:"MCPJam",skillsDir:".mcpjam/skills",get globalSkillsDir(){return path.join(l(),".mcpjam/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".mcpjam"))},"mistral-vibe":{name:"mistral-vibe",displayName:"Mistral Vibe",skillsDir:".vibe/skills",get globalSkillsDir(){return path.join(D(),"skills")},detectInstalled:async()=>fs.existsSync(D())},moxby:{name:"moxby",displayName:"Moxby",skillsDir:".moxby/skills",get globalSkillsDir(){return path.join(l(),".moxby/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".moxby"))},mux:{name:"mux",displayName:"Mux",skillsDir:".mux/skills",get globalSkillsDir(){return path.join(l(),".mux/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".mux"))},opencode:{name:"opencode",displayName:"OpenCode",skillsDir:".agents/skills",get globalSkillsDir(){return path.join(o(),"opencode/skills")},detectInstalled:async()=>fs.existsSync(path.join(o(),"opencode"))},openhands:{name:"openhands",displayName:"OpenHands",skillsDir:".openhands/skills",get globalSkillsDir(){return path.join(l(),".openhands/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".openhands"))},ona:{name:"ona",displayName:"Ona",skillsDir:".ona/skills",get globalSkillsDir(){return path.join(l(),".ona/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".ona"))},pi:{name:"pi",displayName:"Pi",skillsDir:".pi/skills",get globalSkillsDir(){return path.join(l(),".pi/agent/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".pi/agent"))},qoder:{name:"qoder",displayName:"Qoder",skillsDir:".qoder/skills",get globalSkillsDir(){return path.join(l(),".qoder/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".qoder"))},"qoder-cn":{name:"qoder-cn",displayName:"Qoder CN",skillsDir:".qoder/skills",get globalSkillsDir(){return 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",get globalSkillsDir(){return path.join(l(),".qwen/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".qwen"))},replit:{name:"replit",displayName:"Replit",skillsDir:".agents/skills",get globalSkillsDir(){return path.join(o(),"agents/skills")},detectInstalled:async()=>fs.existsSync(path.join(process.cwd(),".replit"))},reasonix:{name:"reasonix",displayName:"Reasonix",skillsDir:".reasonix/skills",get globalSkillsDir(){return path.join(l(),".reasonix/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".reasonix"))},rovodev:{name:"rovodev",displayName:"Rovo Dev",skillsDir:".rovodev/skills",get globalSkillsDir(){return path.join(l(),".rovodev/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".rovodev"))},roo:{name:"roo",displayName:"Roo Code",skillsDir:".roo/skills",get globalSkillsDir(){return 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",get globalSkillsDir(){return path.join(l(),".tabnine/agent/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".tabnine"))},terramind:{name:"terramind",displayName:"Terramind",skillsDir:".terramind/skills",get globalSkillsDir(){return path.join(l(),".terramind/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".terramind"))},tinycloud:{name:"tinycloud",displayName:"Tinycloud",skillsDir:".tinycloud/skills",get globalSkillsDir(){return path.join(l(),".tinycloud/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".tinycloud"))},trae:{name:"trae",displayName:"Trae",skillsDir:".trae/skills",get globalSkillsDir(){return path.join(l(),".trae/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".trae"))},"trae-cn":{name:"trae-cn",displayName:"Trae CN",skillsDir:".trae/skills",get globalSkillsDir(){return path.join(l(),".trae-cn/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".trae-cn"))},warp:{name:"warp",displayName:"Warp",skillsDir:".agents/skills",get globalSkillsDir(){return path.join(l(),".agents/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".warp"))},windsurf:{name:"windsurf",displayName:"Windsurf",skillsDir:".windsurf/skills",get globalSkillsDir(){return path.join(l(),".codeium/windsurf/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".codeium/windsurf"))},zed:{name:"zed",displayName:"Zed",skillsDir:".agents/skills",get globalSkillsDir(){return path.join(l(),".agents/skills")},detectInstalled:async()=>fs.existsSync(path.join(o(),"zed"))||!!S()&&fs.existsSync(path.join(S(),"Zed"))||!!I()&&fs.existsSync(path.join(I(),"zed"))},zencoder:{name:"zencoder",displayName:"Zencoder",skillsDir:".zencoder/skills",get globalSkillsDir(){return path.join(l(),".zencoder/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".zencoder"))},zenflow:{name:"zenflow",displayName:"Zenflow",skillsDir:".zencoder/skills",get globalSkillsDir(){return path.join(l(),".zencoder/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".zencoder"))},neovate:{name:"neovate",displayName:"Neovate",skillsDir:".neovate/skills",get globalSkillsDir(){return path.join(l(),".neovate/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".neovate"))},pochi:{name:"pochi",displayName:"Pochi",skillsDir:".pochi/skills",get globalSkillsDir(){return path.join(l(),".pochi/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".pochi"))},promptscript:{name:"promptscript",displayName:"PromptScript",skillsDir:".agents/skills",globalSkillsDir:void 0,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",get globalSkillsDir(){return path.join(l(),".adal/skills")},detectInstalled:async()=>fs.existsSync(path.join(l(),".adal"))},universal:{name:"universal",displayName:"Universal",skillsDir:".agents/skills",get globalSkillsDir(){return path.join(o(),"agents/skills")},detectInstalled:async()=>false}};async function Q(){return (await Promise.all(Object.entries(a).map(async([n,i])=>({type:n,installed:await i.detectInstalled()})))).filter(n=>n.installed).map(n=>n.type)}function V(t){return a[t]}var v=path.join("agent","subagents");function R(t=process.cwd()){let n=path.join(t,v);if(!fs.existsSync(n))return [];try{return fs.readdirSync(n,{withFileTypes:!0}).filter(i=>i.isDirectory()).map(i=>i.name).sort()}catch{return []}}function w(t,n){let i=a[t];if(n==="project")return i.skillsDir===".agents/skills";if(i.globalSkillsDir===void 0)return false;let r=path.resolve(chunkXGUPIAAF_cjs.k()||os.homedir(),".agents","skills");return path.resolve(i.globalSkillsDir)===r}function _(t){return Object.entries(a).filter(([n])=>w(n,t)).map(([n])=>n)}function X(t){let n=new Set(_(t));return Object.keys(a).filter(i=>!n.has(i))}var x=/^\.[^/]+\/skills$/;function C(){let t=new Set;for(let n of Object.values(a))n.skillsDir&&x.test(n.skillsDir)&&t.add(n.skillsDir);return Array.from(t).sort()}function q(){let t=new Set;for(let n of Object.values(a))n.globalSkillsDir!==void 0&&t.add(n.globalSkillsDir);return Array.from(t).sort()}function Y(){let t=C(),n=q(),i=Array.from(new Set([...t,...n])).sort();return {project:t,global:n,all:i}}function ee(){return C().map(t=>`${t}/`)}function le(t,n){let i=a[t];return n==="global"?w(t,"global"):i.skillsDir===".agents/skills"}var h="*";function se(t){if(!t||t.length===0)return [];let n=Object.keys(a),i=[];for(let r of t)if(r!==h){if(r.includes("/")||r.includes("**")){i.push(r);continue}j.test(r)?n.some(d=>utils.Wildcard.match(d,r))||i.push(r):n.includes(r)||i.push(r);}return i}function te(t){if(!t||t.length===0)return [];let n=Object.keys(a);if(t.includes(h))return [...n];if(t.some(i=>j.test(i))){let i=new Set;for(let r of t)if(!(r.includes("/")||r.includes("**")))for(let d of n)utils.Wildcard.match(d,r)&&i.add(d);return Array.from(i)}return Array.from(new Set(t.filter(i=>!i.includes("/")&&!i.includes("**"))))}var j=/[*?[{}]/;function F(t={}){let n=t.cwd??process.cwd(),i=t.agentFilter??Object.keys(a),r=new Set;for(let d of i){let k=a[d];if(!k.skillsDir||!x.test(k.skillsDir))continue;let T=k.skillsDir===".agents/skills"?path.join(n,".agents","skills"):path.join(n,k.skillsDir);if(d==="eve")for(let z of R(n)){let O=path.join(n,v,z,"skills");r.add(g(`${O}/**/SKILL.md`));}r.add(g(`${T}/**/SKILL.md`));}return Array.from(r).sort()}function M(t={}){let n=t.agentFilter??Object.keys(a),i=new Set;for(let r of n){let d=a[r];d.globalSkillsDir!==void 0&&i.add(g(`${d.globalSkillsDir}/**/SKILL.md`));}return Array.from(i).sort()}function ne(t={}){let n=F(t),i=M(t),r=Array.from(new Set([...n,...i])).sort();return {project:n,global:i,all:r}}function g(t){return t.replace(/\\/g,"/")}function ie(){let t=new Set;for(let i of Object.values(a)){if(i.globalSkillsDir===void 0)continue;let r=g(i.globalSkillsDir);r!==""&&t.add(r);}let n=g(path.join(chunkXGUPIAAF_cjs.k()||os.homedir(),".agents","skills"));return t.add(n),Array.from(t).sort()}exports.a=E;exports.b=a;exports.c=Q;exports.d=V;exports.e=v;exports.f=R;exports.g=w;exports.h=_;exports.i=X;exports.j=x;exports.k=C;exports.l=q;exports.m=Y;exports.n=ee;exports.o=le;exports.p=se;exports.q=te;exports.r=ne;exports.s=ie;