@easbot/skills 0.3.14 → 0.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{blob-SCUVTYVE.cjs → blob-RYNC3CVY.cjs} +1 -1
- package/dist/chunks/{chunk-NH4TYEPW.mjs → chunk-5DAHAO55.mjs} +1 -1
- package/dist/chunks/{chunk-AQYRRXU5.mjs → chunk-6OLPTZDO.mjs} +2 -2
- package/dist/chunks/{chunk-5BDDXFOF.mjs → chunk-BQ6QWQEM.mjs} +1 -1
- package/dist/chunks/{chunk-5RWSXDNO.cjs → chunk-BWDTT6SA.cjs} +2 -2
- package/dist/chunks/chunk-HI5IN4UL.mjs +265 -0
- package/dist/chunks/chunk-HOK3SUH4.cjs +22 -0
- package/dist/chunks/{chunk-UGHF4GOW.cjs → chunk-IJI72D6W.cjs} +2 -2
- package/dist/chunks/{chunk-ISMGLHYS.cjs → chunk-JUNIAQ2A.cjs} +1 -1
- package/dist/chunks/{chunk-DFBKA5A6.cjs → chunk-LJ63Q26N.cjs} +1 -1
- package/dist/chunks/{chunk-2E6BHPFV.cjs → chunk-S5OLAC7X.cjs} +46 -46
- package/dist/chunks/chunk-UUZB3HCD.mjs +22 -0
- package/dist/chunks/chunk-Y6D5Z6AU.mjs +1 -0
- package/dist/chunks/cli-handler-2G4ZYO2S.cjs +1 -0
- package/dist/chunks/cli-handler-F4DUEULA.mjs +1 -0
- package/dist/chunks/installer-3ZLHOVAO.cjs +1 -0
- package/dist/chunks/{installer-NJN3PT5F.mjs → installer-UUEXYC7I.mjs} +1 -1
- package/dist/chunks/{interfaces-5BH4K5TM.cjs → interfaces-T3TO7GQW.cjs} +1 -1
- package/dist/chunks/local-lock-KNX2RUIV.cjs +1 -0
- package/dist/chunks/{local-lock-ZHTDWYXF.mjs → local-lock-UYZTKIET.mjs} +1 -1
- package/dist/chunks/scan-6EBCZDVK.cjs +1 -0
- package/dist/chunks/scan-BZA5LEZN.mjs +1 -0
- package/dist/chunks/{skill-lock-MNRZ7TIX.mjs → skill-lock-CDMLVBYH.mjs} +1 -1
- package/dist/chunks/skill-lock-WPACLO4W.cjs +1 -0
- package/dist/chunks/store-2ULHEVHS.cjs +1 -0
- package/dist/chunks/{store-UJPPYDBG.mjs → store-FRXO6UWU.mjs} +1 -1
- package/dist/chunks/{telemetry-B4PS27S5.cjs → telemetry-TAVF3FAM.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -1
- package/package.json +7 -7
- package/dist/chunks/chunk-6NTEYECA.mjs +0 -22
- package/dist/chunks/chunk-J6PRUXFG.mjs +0 -265
- package/dist/chunks/chunk-JCOXRETY.cjs +0 -22
- package/dist/chunks/chunk-ML6B4IQL.mjs +0 -1
- package/dist/chunks/cli-handler-3FSM4C7L.mjs +0 -1
- package/dist/chunks/cli-handler-B6H4RZEM.cjs +0 -1
- package/dist/chunks/installer-YDJBZTQ7.cjs +0 -1
- package/dist/chunks/local-lock-SPZB3AB7.cjs +0 -1
- package/dist/chunks/scan-6W47D2KJ.mjs +0 -1
- package/dist/chunks/scan-L6UNVP3V.cjs +0 -1
- package/dist/chunks/skill-lock-VX2HGPTY.cjs +0 -1
- package/dist/chunks/store-TSS4BMBF.cjs +0 -1
- /package/dist/chunks/{chunk-GWUDKZEH.cjs → chunk-BWPPLYIF.cjs} +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';var chunkJUNIAQ2A_cjs=require('./chunk-JUNIAQ2A.cjs'),chunkXGUPIAAF_cjs=require('./chunk-XGUPIAAF.cjs'),chunkDNE3XPCJ_cjs=require('./chunk-DNE3XPCJ.cjs'),chunkE7AHWFZN_cjs=require('./chunk-E7AHWFZN.cjs'),chunkBWPPLYIF_cjs=require('./chunk-BWPPLYIF.cjs'),promises=require('fs/promises'),path=require('path'),crypto=require('crypto'),fs=require('fs'),utils=require('@easbot/utils'),ge=require('simple-git'),os=require('os'),child_process=require('child_process'),util=require('util'),zlib=require('zlib');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var ge__default=/*#__PURE__*/_interopDefault(ge);var K=6;function he(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=he(n);return t?`plugins/${t.pluginSlug}`:null}function It(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 At=3e5,nt=(()=>{let n=process.env.SKILLS_CLONE_TIMEOUT;if(!n)return At;let t=Number.parseInt(n,10);return Number.isFinite(t)&&t>0?t:At})(),Wt=util.promisify(child_process.execFile),L=class extends Error{constructor(e,r,i=false,s=false){super(e);chunkBWPPLYIF_cjs.b(this,"url");chunkBWPPLYIF_cjs.b(this,"isTimeout");chunkBWPPLYIF_cjs.b(this,"isAuthError");this.name="GitCloneError",this.url=r,this.isTimeout=i,this.isAuthError=s;}};function Pe(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 i=r[1],s=r[2];return {owner:i,repo:s,slug:`${i}/${s}`,sshUrl:`git@github.com:${i}/${s}.git`}}catch{return null}}function Le(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 ve(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 et(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),ge__default.default({timeout:{block:nt},config:["filter.lfs.required=false","protocol.version=2","remote.origin.promisor=false"]}).env(t)}async function Kt(n){try{await promises.rm(n,{recursive:!0,force:!0});}catch{}await promises.mkdir(n,{recursive:true});}async function Ie(n,t,e){let r=n.slug;try{let{stdout:s,stderr:o}=await Wt("gh",["auth","status","-h","github.com"],{timeout:5e3,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),l=`${s}${o}`;/Git operations protocol:\s+ssh/i.test(l)&&(r=n.sshUrl);}catch{return false}return await Wt("gh",["repo","clone",r,t,"--",...e?["--depth=1","--branch",e]:["--depth=1"]],{timeout:nt,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),true}function $e(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 Dt(n,t,e){if(e){await utils.Filesystem.mkdir(path.dirname(e),{recursive:true});let o=t?["--depth","1","--branch",t]:["--depth","1"];try{return await et().clone(n,e,o),e}catch(l){throw await promises.rm(e,{recursive:true,force:true}).catch(()=>{}),l}}let r=await promises.mkdtemp(path.join(os.tmpdir(),"skills-")),i=t?["--depth","1","--branch",t]:["--depth","1"],s=Pe(n);try{return await et().clone(n,r,i),r}catch(o){let l=o instanceof Error?o.message:String(o),a=l.includes("block timeout")||l.includes("timed out"),c=ve(l);if(a){try{await promises.rm(r,{recursive:!0,force:!0});}catch{}let f=Math.round(nt/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&&s&&Le(n)){try{if(await Kt(r),await Ie(s,r,t))return r}catch{}try{return await Kt(r),await et({GIT_SSH_COMMAND:process.env.GIT_SSH_COMMAND??"ssh -o BatchMode=yes"}).clone(s.sshUrl,r,i),r}catch{}}try{await promises.rm(r,{recursive:!0,force:!0});}catch{}if(c)throw new L($e(n,s,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 In(n){let t=path.normalize(path.resolve(n)),e=path.normalize(path.resolve(os.tmpdir()));if(!t.startsWith(e+path.sep)&&t!==e)throw new Error("Attempted to clean up directory outside of temp directory");await promises.rm(n,{recursive:true,force:true});}function j(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 Kn(n){let t=n.match(/^([^/]+)\/([^/]+)$/);return t?{owner:t[1],repo:t[2]}:null}async function Nn(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 Tt(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 O(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 We(n){return path.isAbsolute(n)||n.startsWith("./")||n.startsWith("../")||n==="."||n===".."||/^[a-zA-Z]:[/\\]/.test(n)}var Ke={"coinbase/agentWallet":"coinbase/agentic-wallet-skills"};function rt(n){try{return decodeURIComponent(n)}catch{return n}}function Ne(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(!Ne(e))return {inputWithoutFragment:n};let i=r.indexOf("@");if(i===-1)return {inputWithoutFragment:e,ref:rt(r)};let s=r.slice(0,i),o=r.slice(i+1);return {inputWithoutFragment:e,ref:s?rt(s):void 0,subpath:o?rt(o):void 0}}function Ct(n,t,e){return t?`${n}#${t}${e?`@${e}`:""}`:n}function Ft(n){if(We(n)){let g=path.resolve(n);return {type:"local",url:g,localPath:g}}let{inputWithoutFragment:t,ref:e,subpath:r}=Ue(n);n=t;let i=Ke[n];i&&(n=i);let s=n.match(/^github:(.+)$/);if(s)return Ft(Ct(s[1],e,r));let o=n.match(/^gitlab:(.+)$/);if(o)return Ft(Ct(`https://gitlab.com/${o[1]}`,e,r));let l=n.match(/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/(.+)/);if(l){let[,g,p,w,S]=l;return {type:"github",url:`https://github.com/${g}/${p}.git`,ref:w||e,subpath:S&&O(S)}}let a=n.match(/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)$/);if(a){let[,g,p,w]=a;return {type:"github",url:`https://github.com/${g}/${p}.git`,ref:w||e}}let c=n.match(/github\.com\/([^/]+)\/([^/]+)/);if(c){let[,g,p]=c,w=p.replace(/\.git$/,"");return {type:"github",url:`https://github.com/${g}/${w}.git`,...e?{ref:e}:{}}}let u=n.match(/^(https?):\/\/([^/]+)\/(.+?)\/-\/tree\/([^/]+)\/(.+)/);if(u){let[,g,p,w,S,k]=u;if(p!=="github.com"&&w)return {type:"gitlab",url:`${g}://${p}/${w.replace(/\.git$/,"")}.git`,ref:S||e,subpath:k&&O(k)}}let f=n.match(/^(https?):\/\/([^/]+)\/(.+?)\/-\/tree\/([^/]+)$/);if(f){let[,g,p,w,S]=f;if(p!=="github.com"&&w)return {type:"gitlab",url:`${g}://${p}/${w.replace(/\.git$/,"")}.git`,ref:S||e}}let d=n.match(/gitlab\.com\/(.+?)(?:\.git)?\/?$/);if(d){let g=d[1];if(g.includes("/"))return {type:"gitlab",url:`https://gitlab.com/${g}.git`,...e?{ref:e}:{}}}let y=n.match(/^([^/@]+)\/([^/@]+)@(.+)?$/);if(y&&!n.includes(":")&&!n.startsWith(".")&&!n.startsWith("/")){let g=y[1],p=y[2],w=y[3];if(!w)return {type:"github",url:`https://github.com/${g}/${p}.git`,...e?{ref:e}:{}};let S=O(w);return {type:"github",url:`https://github.com/${g}/${p}.git`,...e?{ref:e}:{},...S?{subpath:S}:{}}}let x=n.match(/^([^/@]+)\/([^/@]+)(?:\/(.+?))?\/?$/);if(x&&!n.includes(":")&&!n.startsWith(".")&&!n.startsWith("/")){let[,g,p,w]=x;return {type:"github",url:`https://github.com/${g}/${p}.git`,...e?{ref:e}:{},subpath:r??(w&&O(w))}}return De(n)?{type:"well-known",url:n}:{type:"git",url:n,...e?{ref:e}:{},...r?{subpath:r}:{}}}function De(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 Mt="https://schemas.agentskills.io/discovery/0.2.0/schema.json",Me=/\/schemas\/agent-skills\/index\.v1\.json$/,_e=50*1024*1024,ze=1e3;function He(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 i=new URL(n.sourceUrl).pathname,s=/\/\.well-known\/(?:agent-skills|skills)\/(.*?)\/SKILL\.md$/,o=i.match(s);if(o?.[1])return o[1];let l=i.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 i=n.installName.slice(r+1);if(i.includes("/"))return i.replace(/^\/+/,"")}}return t}var it=class{constructor(){chunkBWPPLYIF_cjs.b(this,"id","well-known");chunkBWPPLYIF_cjs.b(this,"displayName","Well-Known Skills");chunkBWPPLYIF_cjs.b(this,"WELL_KNOWN_PATHS",[".well-known/agent-skills",".well-known/skills"]);chunkBWPPLYIF_cjs.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(/\/$/,""),i=[],s=r.match(/\/\.well-known\/(agent-skills|skills)\/?$/);if(s?.[1]){let l=`.well-known/${s[1]}`;i.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)i.push({indexUrl:`${e.protocol}//${e.host}${r}/${l}/${this.INDEX_FILE}`,baseUrl:`${e.protocol}//${e.host}${r}`,wellKnownPath:l}),r&&r!==""&&i.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 i)try{let u=await fetch(l);if(!u.ok)continue;let f=await u.json(),d=this.normalizeIndex(f,l,c);if(!d)continue;o.push({index:d.index,entries:d.entries,resolvedBaseUrl:a,resolvedWellKnownPath:c,indexUrl:l});}catch{}return o}catch{return []}}normalizeIndex(t,e,r){if(!t||typeof t!="object")return null;let i=t;if(!Array.isArray(i.skills))return null;let s=i.$schema;if(s===Mt){let a=[],c=[];for(let u of i.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:Mt,skills:c},entries:a}}if(typeof s=="string"&&Me.test(s)){let a=[],c=[];for(let u of i.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:s,skills:c},entries:a}}if(s!==void 0)return null;let o=[],l=[];for(let a of i.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),i=`/${e}/${this.INDEX_FILE}`;return `${r.protocol}//${r.host}${r.pathname.slice(0,-i.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}if(e.files!==void 0){if(!Array.isArray(e.files)||e.files.length===0)return false;let r=e.files[0];if(typeof r!="string"||r.toLowerCase()!=="skill.md")return false;for(let i of e.files)if(!this.isSafeLegacyFilePath(i))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 i of e.files)if(!this.isSafeLegacyFilePath(i))return false;return e.files.some(i=>typeof i=="string"&&i.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 i of r){let{entries:s}=i,o=null,l=e.pathname.match(/\/.well-known\/(?:agent-skills|skills)\/([^/]+)\/?$/);if(l?.[1]&&l[1]!=="index.json"?o=l[1]:s.length===1&&(o=s[0].name),!o)continue;let a=s.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:i}=chunkE7AHWFZN_cjs.a(r);if(typeof i.name!="string"||typeof i.description!="string")return null;let s=new Map;s.set("SKILL.md",r);let o=t.indexEntry;if(Array.isArray(o.files)&&o.files.length>0){let a=t.skillMdUrl.replace(/\/SKILL\.md$/i,""),u=o.files.filter(d=>d.toLowerCase()!=="skill.md").map(async d=>{try{let y=`${a}/${d}`,x=await fetch(y);if(x.ok){let g=await x.arrayBuffer();return {path:d,content:new Uint8Array(g)}}}catch{}return null}),f=await Promise.all(u);for(let d of f)d&&s.set(d.path,d.content);}let l=He(t.indexEntry,i.name);return this.createSkill({name:i.name,description:i.description,content:r,installName:l,sourceUrl:t.skillMdUrl,metadata:i.metadata,files:s,indexEntry:t.indexEntry})}catch{return null}}async fetchLegacySkillByEntry(t){try{let e=`${t.baseUrl.replace(/\/$/,"")}/${t.wellKnownPath}/${t.name}`,r=`${e}/SKILL.md`,i=await fetch(r);if(!i.ok)return null;let s=await i.text(),{data:o}=chunkE7AHWFZN_cjs.a(s);if(typeof o.name!="string"||typeof o.description!="string")return null;let l=new Map;l.set("SKILL.md",s);let c=t.files.filter(f=>f.toLowerCase()!=="skill.md").map(async f=>{try{let d=`${e}/${f}`,y=await fetch(d);if(y.ok){let x=await y.arrayBuffer();return {path:f,content:new Uint8Array(x)}}}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:s,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")??"",i=new Uint8Array(await e.arrayBuffer());if(this.computeDigest(i)!==t.digest)return null;if(t.type==="skill-md"){let c=new TextDecoder().decode(i),{data:u}=chunkE7AHWFZN_cjs.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 s=this.extractArchive(i,t.artifactUrl,r),o=s.get("SKILL.md");if(!o)return null;let l=typeof o=="string"?o:new TextDecoder().decode(o);s.set("SKILL.md",l);let{data:a}=chunkE7AHWFZN_cjs.a(l);return typeof a.name!="string"||typeof a.description!="string"?null:this.createSkill({name:a.name,description:a.description,content:l,installName:t.name,sourceUrl:t.artifactUrl,metadata:a.metadata,files:s,indexEntry:t.indexEntry})}catch{return null}}createSkill(t){return {name:chunkDNE3XPCJ_cjs.b(t.name),description:chunkDNE3XPCJ_cjs.b(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 i=r.entries.map(l=>this.fetchSkillByEntry(l)),o=(await Promise.all(i)).filter(l=>l!==null);if(o.length>0)return o}return []}catch{return []}}computeDigest(t){return `sha256:${crypto.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 i=e.toLowerCase();return r.includes("application/gzip")||r.includes("application/x-gzip")||i.endsWith(".tar.gz")||i.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,i){let s=this.normalizeArchivePath(e);if(!s)throw new Error(`Unsafe archive path: ${e}`);if(i.bytes+=r.byteLength,i.bytes>_e)throw new Error("Archive exceeds maximum unpacked size");if(t.size>=ze)throw new Error("Archive contains too many files");t.set(s,r);}extractTarGz(t){let e=zlib.gunzipSync(Buffer.from(t)),r=new Map,i={bytes:0},s=0;for(;s+512<=e.length;){let o=e.subarray(s,s+512);if(o.every(x=>x===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,d=Number.parseInt(a||"0",8);if(!Number.isFinite(d)||d<0)throw new Error("Invalid tar entry size");if(s+=512,c===50||c===49)throw new Error("Archive links are not supported");if(c===0||c===48){let x=e.subarray(s,s+d);this.addArchiveFile(r,f,new Uint8Array(x),i);}s+=Math.ceil(d/512)*512;}if(!r.has("SKILL.md"))throw new Error("Archive missing root SKILL.md");return r}readTarString(t,e,r){let i=t.subarray(e,e+r),s=i.indexOf(0);return new TextDecoder().decode(s>=0?i.subarray(0,s):i)}extractZip(t){let e=Buffer.from(t),r=this.findZipEndOfCentralDirectory(e);if(r<0)throw new Error("Invalid zip archive");let i=e.readUInt16LE(r+10),s=e.readUInt32LE(r+16),o=new Map,l={bytes:0},a=s;for(let c=0;c<i;c++){if(e.readUInt32LE(a)!==33639248)throw new Error("Invalid zip directory");let u=e.readUInt16LE(a+8),f=e.readUInt16LE(a+10),d=e.readUInt32LE(a+20),y=e.readUInt32LE(a+24),x=e.readUInt16LE(a+28),g=e.readUInt16LE(a+30),p=e.readUInt16LE(a+32),w=e.readUInt32LE(a+38),S=e.readUInt32LE(a+42),k=a+46,E=e.subarray(k,k+x),b=new TextDecoder(u&2048?"utf-8":void 0).decode(E);if(a=k+x+g+p,b.endsWith("/"))continue;if(u&1)throw new Error("Encrypted zip entries are not supported");let M=w>>>16&61440;if(M===40960||M===4096)throw new Error("Archive links are not supported");if(e.readUInt32LE(S)!==67324752)throw new Error("Invalid zip local header");let _=e.readUInt16LE(S+26),de=e.readUInt16LE(S+28),wt=S+30+_+de,yt=e.subarray(wt,wt+d),z;if(f===0)z=yt;else if(f===8)z=zlib.inflateRawSync(yt);else throw new Error(`Unsupported zip compression method: ${f}`);if(z.byteLength!==y)throw new Error("Zip entry size mismatch");this.addArchiveFile(o,b,new Uint8Array(z),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],i=e.pathname.match(/\/.well-known\/(?:agent-skills|skills)\/([^/]+)\/?$/);if(i?.[1]){let o=e.pathname.replace(/\/.well-known\/(?:agent-skills|skills)\/.*$/,"");return `${e.protocol}//${e.host}${o}/${r}/${i[1]}/SKILL.md`}let s=e.pathname.replace(/\/$/,"");return `${e.protocol}//${e.host}${s}/${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}},_t=new it;function st(n,t){let e=path.normalize(path.resolve(t)),r=path.normalize(path.resolve(n));return r.startsWith(e+path.sep)||r===e}function V(n){return n.startsWith("./")}async function Ot(n){let t=new Map;try{let e=await promises.readFile(path.join(n,".claude-plugin/marketplace.json"),"utf-8"),r=JSON.parse(e),i=r.metadata?.pluginRoot;if(i===void 0||V(i))for(let o of r.plugins??[]){if(!o.name||typeof o.source!="string"&&o.source!==void 0||o.source!==void 0&&!V(o.source))continue;let l=path.join(n,i??"",o.source??"");if(st(l,n)&&o.skills&&o.skills.length>0)for(let a of o.skills){if(!V(a))continue;let c=path.join(l,a);st(c,n)&&t.set(path.resolve(c),o.name);}}}catch{}try{let e=await promises.readFile(path.join(n,".claude-plugin/plugin.json"),"utf-8"),r=JSON.parse(e);if(r.name&&r.skills&&r.skills.length>0)for(let i of r.skills){if(!V(i))continue;let s=path.join(n,i);st(s,n)&&t.set(path.resolve(s),r.name);}}catch{}return t}var Ge=["node_modules",".git","dist","build","__pycache__"];async function qe(n){let t=path.join(n,".gitignore");try{let e=await promises.readFile(t,"utf-8");return utils.Glob.parseGitignoreContent(e)}catch{return []}}function ot(n){return n.toLowerCase().replace(/[\s_]+/g,"-")}function Xe(n){return n.split(path.sep).join("/").replace(/\/+/g,"/")}function Je(){let n=process.env.INSTALL_INTERNAL_SKILLS;return n==="1"||n==="true"}async function Jt(n){try{let t=path.join(n,"SKILL.md");return (await promises.stat(t)).isFile()}catch{return false}}async function Vt(n,t){try{let e=await promises.readFile(n,"utf-8"),{data:r}=chunkE7AHWFZN_cjs.a(e);if(!r.name||!r.description||typeof r.name!="string"||typeof r.description!="string")return null;let i=r.metadata&&typeof r.metadata=="object"&&!Array.isArray(r.metadata)?r.metadata:void 0;return i?.internal===!0&&!Je()&&!t?.includeInternal?null:{name:chunkDNE3XPCJ_cjs.b(r.name),description:chunkDNE3XPCJ_cjs.b(r.description),path:path.dirname(n),rawContent:e,metadata:i}}catch{return null}}async function Zt(n,t=0,e=5){if(t>e)return [];try{let[r,i]=await Promise.all([Jt(n),promises.readdir(n,{withFileTypes:!0}).catch(()=>[])]),s=r?[n]:[],o=await Promise.all(i.filter(l=>l.isDirectory()&&!Ge.includes(l.name)).map(l=>Zt(path.join(n,l.name),t+1,e)));return [...s,...o.flat()]}catch{return []}}function Ze(n,t){let e=path.normalize(path.resolve(n)),r=path.normalize(path.resolve(path.join(n,t)));return r.startsWith(e+path.sep)||r===e}async function ct(n,t,e){let r=[],i=new Set,s=await q(n),o=new Set(Object.keys(s.skills).map(ot));if(t&&!Ze(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?path.join(n,t):n,a=await Ot(l),c=k=>{let E=path.resolve(k.path);return a.has(E)&&(k.pluginName=a.get(E)),k},u=chunkJUNIAQ2A_cjs.k(),f=k=>{if(o.size===0)return false;let E=Xe(path.relative(n,k.path));if(!u.some(_=>E===_||E.startsWith(`${_}/`)))return false;let kt=ot(k.name),M=ot(path.basename(k.path));return o.has(kt)||o.has(M)},d=async k=>{if(!await Jt(k))return false;let E=await Vt(path.join(k,"SKILL.md"),e);return !E||i.has(E.name)||f(E)||(E=c(E),r.push(E),i.add(E.name)),true},y=t?t.replace(/^\/+|\/+$/g,"").split("/").filter(k=>k.length>0):[],x=y.length>0?`**/${y.join("/")}/**/SKILL.md`:"**/SKILL.md",g=await utils.Glob.scan(x,{cwd:l,absolute:true,ignore:[...utils.Glob.DEFAULT_IGNORE_PATTERNS,...await qe(l)]}),p="/",w=l.split(path.sep).join(p);g.sort((k,E)=>k.split(p).length-E.split(p).length);let S=[];for(let k of g){if(S.some(b=>k.startsWith(`${b}${p}`)||k===b))continue;let E=path.dirname(k);if(await d(E)){let b=E.split(path.sep).join(p);if(b===w)continue;S.push(b);}}if(r.length===0||e?.fullDepth){let k=await Zt(l);for(let E of k){let b=await Vt(path.join(E,"SKILL.md"),e);b&&!i.has(b.name)&&!f(b)&&(b=c(b),r.push(b),i.add(b.name));}}return r}function Ye(n){return n.name||(n.path?path.basename(n.path):"")}function nr(n,t){let e=t.map(r=>r.toLowerCase());return n.filter(r=>{let i=r.name.toLowerCase(),s=Ye(r).toLowerCase();return e.some(o=>o===i||o===s)})}var Yt="*";function rr(n,t){if(!n||n.length===0)return [];let e=new Set(t),r=[];for(let i of n)if(i!==Yt){if(i.includes("/")||i.includes("**")){r.push(i);continue}Qt.test(i)?t.some(s=>utils.Wildcard.match(s,i))||r.push(i):e.has(i)||r.push(i);}return r}function ir(n,t){let e={wildcard:false,matched:[],invalid:[]};if(!n||n.length===0)return e;let r=new Set(t),i=new Set;for(let s of n){if(s===Yt){e.wildcard=true;continue}if(s.includes("/")||s.includes("**")){e.invalid.push(s);continue}if(Qt.test(s))for(let o of t)utils.Wildcard.match(o,s)&&i.add(o);else r.has(s)?i.add(s):e.invalid.push(s);}return e.matched=Array.from(i),e}var Qt=/[*?[{}]/;var ft="houjallen/agent-skills";async function Sr(n){let t=n.defaultPlugin;if(!t||typeof t.marketId!="string"||t.marketId.length===0)return ft;let e=n.markets[t.marketId];if(!e)return ft;let r=e.localPath??e.url;if(!r)return ft;let i=r;return e.subpath&&(i=`${i}@${e.subpath}`),e.ref&&(i=`${i}#${e.ref}`),i}function en(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 utils.Filesystem.normalize(n)}function dt(n){if(n==="general"||n==="coder"||n==="all")return n}function nn({scope:n}){let t=n==="project"?chunkXGUPIAAF_cjs.p():chunkXGUPIAAF_cjs.m(),e=utils.Filesystem.join(t,n==="project"?".easbot":"easbot","skills");return utils.Filesystem.normalize(e)}function T(){return utils.Filesystem.join(chunkXGUPIAAF_cjs.m(),"skills","store")}function se(){return utils.Filesystem.join(T(),"index.json")}function X(n){let t=`${n.type}|${n.url}|${n.ref??""}`;return crypto.createHash("sha256").update(t).digest("hex")}function oe(n){let t=X(n);return utils.Filesystem.join(T(),t)}function D(){return utils.Filesystem.join(chunkXGUPIAAF_cjs.o(),"skills","cache")}function rn(n,t,e){if(e&&e.length>0)return N(e);let r=sn(n);if(r)return r;if(t?.includes("/")){let i=t.split("/")[0];if(i)return N(i)}return "default"}function sn(n){let t=n.localPath??n.url;if(!t)return null;if(n.type==="well-known")try{let i=new URL(t),s=i.hostname.replace(/^www\./,"").replace(/\./g,"-"),o=i.pathname.replace(/^\/+/,"").split("/")[0]||"";return o&&!s.endsWith(`-${o}`)?N(`${s}-${o}`):N(s)}catch{return null}let e=t.match(/^(?:https?:\/\/[^/]+\/|git@[^:]+:)([^/]+)\/([^/]+?)(?:\.git)?\/?$/);if(e)return N(e[2]??"");let r=t.split(/[\\/]/).filter(Boolean).pop();return r?N(r.replace(/\.git$/,"")):null}function N(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 Y(n){if(n.type==="well-known")return on(n.url);let t=j(n);if(t)return utils.Filesystem.join(D(),n.type,t);let e=crypto.createHash("sha256").update(n.url).digest("hex").slice(0,16);return utils.Filesystem.join(D(),n.type,`unknown-${e}`)}function on(n){let t,e;try{let r=new URL(n);t=r.hostname.replace(/^www\./,"");let i=r.pathname.match(/\/\.well-known\/(agent-skills|skills)/);i?.[1]?e=`.well-known/${i[1]}`:e=".well-known/agent-skills";}catch{let r=crypto.createHash("sha256").update(n).digest("hex").slice(0,16);return utils.Filesystem.join(D(),"wellknown",`unknown-${r}`)}return utils.Filesystem.join(D(),"wellknown",t,e)}async function le(n){let t=n.skillNames??[],e=n.mode??"install";if(n.type==="local")return ln(n,t,e);let{cacheDir:r,source:i,cloneError:s}=await an(n,e);return {tempDir:r,cacheHit:false,source:i,cloneError:s}}var pt=class extends Error{constructor(e){super(`Local source path does not exist: ${e}`);chunkBWPPLYIF_cjs.b(this,"localPath",e);this.name="LocalPathNotFoundError";}};async function ln(n,t,e="install"){let r=n.localPath??n.url;if(!fs.existsSync(r))throw new pt(r);let i=oe(n);return e!=="update"&&fs.existsSync(i)&&await ae(i)?{tempDir:i,cacheHit:true,source:"local-cp",cloneError:null}:{tempDir:r,cacheHit:false,source:"local-cp",cloneError:null}}async function an(n,t){let e=n.ref;if(!e){let l=j(n);if(l){let[a,c]=l.split("/");if(a&&c){let u=await Tt(a,c);u&&(e=u);}}}e||(e="HEAD");let r=Y(n);if(n.type==="well-known")return !fs.existsSync(r)||t==="update"?(t==="update"&&fs.existsSync(r)&&await promises.rm(m(r),{recursive:true,force:true}).catch(()=>{}),await utils.Filesystem.mkdir(m(r),{recursive:true}),await dn(n.url,r),{cacheDir:r,source:"well-known-fetch",cloneError:null}):{cacheDir:r,source:"cache-pull",cloneError:null};if(fs.existsSync(r)){if(t==="update")try{let l=await utils.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 utils.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 utils.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 i(l,a,c){return Dt(l,a,c)}let s=null,o=null;try{return await utils.Filesystem.mkdir(m(utils.Filesystem.dirname(r)),{recursive:!0}),s=`${r}.clone-tmp`,await i(n.url,e,s),await promises.rename(m(s),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 utils.Filesystem.mkdir(m(r),{recursive:true}).catch(()=>{}),{cacheDir:r,source:"cache-pull",cloneError:o}}finally{if(s)try{await promises.rm(m(s),{recursive:!0,force:!0});}catch{}}}async function A(){let n=m(se()),t;try{t=await utils.Filesystem.readText(n);}catch{return {version:6,markets:{}}}let e;try{e=JSON.parse(t);}catch{try{await promises.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 i={version:6,markets:r.markets};if("defaultPlugin"in r){let s=en(r.defaultPlugin);s&&(i.defaultPlugin=s);}return i}async function Q(n){await utils.Filesystem.writeJson(m(se()),n);}async function xr(){let n=await A(),t={};for(let e of Object.values(n.markets))for(let r of Object.values(e.plugins))for(let[i,s]of Object.entries(r.skills))t[i]={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:s.skillPath,computedHash:s.computedHash,sourceKey:e.id,sourcePath:e.localPath??e.storePath};return t}async function Er(n,t,e,r,i){let s=await A(),o=s.markets[n];o||(o={...i,id:n,addedAt:i.addedAt??new Date().toISOString(),plugins:{}},s.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 Q(s);}async function cn(){let n=await A(),t=[];for(let e of Object.values(n.markets))for(let r of Object.values(e.plugins))for(let i of Object.values(r.skills))t.push({skillName:i.name,marketId:e.id,pluginId:r.id,entry:i});return t.sort((e,r)=>{let i=e.marketId.localeCompare(r.marketId);if(i!==0)return i;let s=e.pluginId.localeCompare(r.pluginId);return s!==0?s:e.skillName.localeCompare(r.skillName)}),t}async function un(n){return (await cn()).filter(e=>e.skillName===n)}async function br(n,t,e){let i=(await A()).markets[n];if(!i)return;let s=i.plugins[t];if(!s)return;let o=s.skills[e];if(o)return {skillName:o.name,marketId:n,pluginId:t,entry:o}}async function Pr(n,t,e){let r=await A(),i=r.markets[n];if(!i)return false;let s=i.plugins[t];return !s||!(e in s.skills)?false:(delete s.skills[e],await Q(r),true)}async function fn(n){let t=await un(n);if(t.length===0)return [];let e=await A(),r=[];for(let i of t){let s=e.markets[i.marketId]?.plugins[i.pluginId];s&&n in s.skills&&(delete s.skills[n],r.push(i));}return r.length>0&&await Q(e),r}async function Lr(n,t,e,r,i,s,o){await J([{skillName:n,parsed:t,sourceKey:e,sourcePath:r,storePath:i,skillPath:s,...o&&{computedHash:o}}]);}async function J(n){if(n.length===0)return;let t=await A(),e=new Date().toISOString();for(let s of n){let o=s.sourceKey,l=rn(s.parsed,s.skillPath,s.pluginName),a=`${o}:${l}`,c=t.markets[o];if(!c){let d=s.parsed.type==="local"?s.parsed.localPath??s.parsed.url:Y(s.parsed);c={id:o,type:s.parsed.type,url:s.parsed.url,localPath:s.parsed.localPath,subpath:s.parsed.subpath,ref:s.parsed.ref,storePath:s.storePath,cachePath:d,addedAt:e,plugins:{}},t.markets[o]=c;}let u=c.plugins[a];u||(u={id:a,name:l,sourcePath:s.parsed.subpath,skills:{}},c.plugins[a]=u);let f={name:s.skillName,description:s.description??"",skillPath:s.skillPath,computedHash:s.computedHash};s.scope&&(f.scope=s.scope),s.snapshotHash&&(f.snapshotHash=s.snapshotHash),u.skills[s.skillName]=f;}let r=new Set,i=new Map;for(let s of n)r.add(s.sourceKey),s.marketSnapshotHash&&i.set(s.sourceKey,s.marketSnapshotHash);for(let s of r){let o=t.markets[s];if(!o)continue;let l=i.get(s);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=chunkE7AHWFZN_cjs.d(a);}await Q(t);}async function vr(n){return (await fn(n)).length>0}async function dn(n,t){let e;try{e=await _t.fetchAllSkills(n);}catch{return}if(e.length!==0)for(let r of e)try{await hn(r,t);}catch{}}async function hn(n,t){let e=utils.Filesystem.join(t,n.installName),r=utils.Filesystem.normalize(e),i=utils.Filesystem.normalize(t);if(!r.startsWith(`${i}/`)&&r!==i)throw new Error(`Unsafe skill dir: ${n.installName}`);await promises.mkdir(m(e),{recursive:true});for(let[s,o]of n.files){let l=utils.Filesystem.join(e,s),a=utils.Filesystem.normalize(l);if(!a.startsWith(`${r}/`)&&a!==r||s.includes("\0"))continue;let c=path.dirname(m(l));c!==m(e)&&await promises.mkdir(c,{recursive:true}),await promises.writeFile(m(l),typeof o=="string"?o:Buffer.from(o));}}async function Ir(n){return (await le({type:"git",url:n.url,ref:n.ref})).tempDir}async function $r(n,t={}){let e=oe(n),r=false;if(fs.existsSync(e)&&(r=await ae(e),!r))try{await promises.rmdir(m(e));}catch{}if(r)if(t.mode==="update"){try{await promises.rm(m(e),{recursive:!0,force:!0});}catch{}r=false;}else {let c=await ct(e,void 0,{includeInternal:t.includeInternal,fullDepth:t.fullDepth});if(c.length>0){let f=await Promise.all(c.map(async d=>{let y=ht(e,d.path);return {skillName:d.name,parsed:n,sourceKey:X(n),sourcePath:e,storePath:e,skillPath:y,description:d.description,scope:dt(d.metadata?.scope),...d.pluginName&&{pluginName:d.pluginName},computedHash:await chunkE7AHWFZN_cjs.b(d.path)}}));await J(f);}let u=n.type==="local"?"local-cp":"cache-pull";return {storeDir:e,cacheHit:true,source:u,skills:c,blobSkills:[],cloneError:null}}let i=[];if(n.type==="github"&&!t.fullDepth){let c=j(n),u=c?.split("/")[0]?.toLowerCase(),f=!!c&&Object.hasOwn(chunkDNE3XPCJ_cjs.c,c.toLowerCase());if(c&&u&&(f||chunkDNE3XPCJ_cjs.d.includes(u))){let d=await chunkDNE3XPCJ_cjs.l(c,{subpath:n.subpath,ref:n.ref,includeInternal:t.includeInternal});if(d&&d.skills.length>0){await te(d.skills,e);let y=Y(n);await te(d.skills,y);let x=d.skills.map(p=>({...p,path:utils.Filesystem.join(e,p.repoSubpath??"",p.name)})),g=await Promise.all(x.map(async(p,w)=>{let S=d.skills[w],k=`${S.repoSubpath??""}${S.repoSubpath?"/":""}${S.name}`;return {skillName:p.name,parsed:n,sourceKey:X(n),sourcePath:e,storePath:e,skillPath:k,description:p.description,scope:dt(p.metadata?.scope),...p.pluginName&&{pluginName:p.pluginName},computedHash:await chunkE7AHWFZN_cjs.b(utils.Filesystem.dirname(p.path)),snapshotHash:S.snapshotHash,marketSnapshotHash:d.snapshotHash}}));return await J(g),i=d.skills,{storeDir:e,cacheHit:false,source:"blob-fetch",skills:x,blobSkills:i,cloneError:null}}}}let s=await le({...n,mode:t.mode??"install"});await utils.Filesystem.mkdir(m(e),{recursive:true}).catch(()=>{});let o=await ct(s.tempDir,void 0,{includeInternal:t.includeInternal,fullDepth:t.fullDepth}),l=[],a=utils.Filesystem.normalize(e).replace(/\\/g,"/");for(let c of o){let u=ht(s.tempDir,c.path),f=utils.Filesystem.join(e,u),d=`${ht(s.tempDir,c.path)}/SKILL.md`,y=utils.Filesystem.normalize(f).replace(/\\/g,"/"),x="/",g=a.endsWith(x)?a:a+x;if(!y.startsWith(g)&&y!==a)throw new Error(`[INVARIANT 0048-yyy] cp target escapes storeRoot: target=${y} 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 p;try{await utils.Filesystem.mkdir(m(utils.Filesystem.dirname(f)),{recursive:!0}),await promises.cp(m(c.path),m(f),{recursive:!0}),p=await chunkE7AHWFZN_cjs.b(f);}catch{}c.path=f,l.push({skill:c,skillRel:u,sourceSkillPath:d,targetPath:f,computedHash:p});}if(l.length>0){let c=l.filter(u=>u.computedHash).map(u=>({skillName:u.skill.name,parsed:n,sourceKey:X(n),sourcePath:s.tempDir,storePath:e,skillPath:u.skillRel,description:u.skill.description,scope:dt(u.skill.metadata?.scope),...u.skill.pluginName&&{pluginName:u.skill.pluginName},computedHash:u.computedHash}));await J(c);}return {storeDir:e,cacheHit:s.cacheHit,source:s.source,skills:o,blobSkills:[],cloneError:s.cloneError??null}}async function te(n,t){let e=utils.Filesystem.normalize(t);for(let r of n){let i=utils.Filesystem.join(t,r.repoSubpath??"",r.name),s=utils.Filesystem.normalize(i);if(!(!s.startsWith(`${e}/`)&&s!==e))try{await promises.mkdir(m(i),{recursive:!0});for(let o of r.files){let l=utils.Filesystem.join(i,o.path),a=utils.Filesystem.normalize(l);if(!a.startsWith(`${s}/`)&&a!==s||o.path.includes("\0"))continue;let c=path.dirname(m(l));c!==m(i)&&await promises.mkdir(c,{recursive:!0}),await promises.writeFile(m(l),o.contents,"utf-8");}}catch{}}}function ht(n,t){let r=utils.Filesystem.normalize(n).replace(/\\/g,"/"),i=utils.Filesystem.normalize(t).replace(/\\/g,"/"),s=r.toLowerCase();return i.toLowerCase().startsWith(`${s}/`)?i.slice(s.length+1):""}async function ae(n){try{return (await promises.readdir(m(n))).length>0}catch{return false}}function Rr(n){try{let t=utils.Filesystem.normalize(n);for(let e of [D(),T()]){let r=utils.Filesystem.normalize(e);if(t===r||t.startsWith(`${r}/`))return !0}return !1}catch{return false}}async function Ar({cachePath:n,skillName:t,scope:e}){let r=utils.Filesystem.join(nn({scope:e}),t);return fs.existsSync(r)&&await promises.rm(m(r),{recursive:true,force:true}),await promises.cp(m(n),m(r),{recursive:true}),r}async function Wr(n){let t=Y(n);fs.existsSync(t)&&await promises.rm(m(t),{recursive:true,force:true});}async function Kr(){let n=D();fs.existsSync(n)&&await promises.rm(m(n),{recursive:true,force:true});}var kn="skills-lock.json",ce=4;function ue(n){return path.join(n||process.cwd(),kn)}function _r(n,t){return n?It(n,T(),t):null}async function q(n){let t=ue(n);try{let e=await promises.readFile(t,"utf-8"),r=JSON.parse(e);return typeof r.version!="number"||!r.skills||r.version<ce?mt():r}catch{return mt()}}async function fe(n,t){let e=ue(t),r={};for(let o of Object.keys(n.skills).sort())r[o]=n.skills[o];let i={version:n.version,skills:r},s=JSON.stringify(i,null,2)+`
|
|
22
|
+
`;await promises.writeFile(e,s,"utf-8");}async function zr(n,t,e){let r=await q(e),i=new Date().toISOString(),s=r.skills[n];r.skills[n]={...t,installedAt:s?.installedAt??i,updatedAt:i},await fe(r,e);}async function Hr(n,t){let e=await q(t);return n in e.skills?(delete e.skills[n],await fe(e,t),true):false}function mt(){return {version:ce,skills:{}}}exports.$=Lr;exports.A=ct;exports.B=Ye;exports.C=nr;exports.D=rr;exports.E=ir;exports.F=ft;exports.G=Sr;exports.H=en;exports.I=nn;exports.J=T;exports.K=se;exports.L=X;exports.M=oe;exports.N=D;exports.O=rn;exports.P=Y;exports.Q=le;exports.R=pt;exports.S=A;exports.T=Q;exports.U=xr;exports.V=Er;exports.W=cn;exports.X=un;exports.Y=br;exports.Z=Pr;exports._=fn;exports.a=j;exports.aa=J;exports.b=Kn;exports.ba=vr;exports.c=Nn;exports.ca=Ir;exports.d=O;exports.da=$r;exports.e=Ft;exports.ea=ht;exports.f=At;exports.fa=ae;exports.g=L;exports.ga=Rr;exports.h=Pe;exports.ha=Ar;exports.i=Le;exports.ia=Wr;exports.j=Ut;exports.ja=Kr;exports.k=Dt;exports.l=In;exports.m=it;exports.n=_t;exports.o=K;exports.p=It;exports.q=ce;exports.r=ue;exports.s=_r;exports.t=q;exports.u=fe;exports.v=zr;exports.w=Hr;exports.x=Je;exports.y=Vt;exports.z=Ze;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkJUNIAQ2A_cjs=require('./chunk-JUNIAQ2A.cjs'),chunkXGUPIAAF_cjs=require('./chunk-XGUPIAAF.cjs'),chunkE7AHWFZN_cjs=require('./chunk-E7AHWFZN.cjs'),promises=require('fs/promises'),fs=require('fs'),path=require('path'),os=require('os');var V=".agents",X="skills",ve=".agents/skills";async function fe(t){try{return await chunkE7AHWFZN_cjs.b(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 fe(e);if(!i)return false;let s;if(a){let{readSkillLock:l}=await import('./skill-lock-WPACLO4W.cjs');s=(await l()).skills[t]?.computedHash;}else {let{readLocalLock:l}=await import('./local-lock-KNX2RUIV.cjs');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=path.normalize(path.resolve(t)),r=path.normalize(path.resolve(e));return r.startsWith(a+path.sep)||r===a}function Y(t,e){return w(t,e)||w(e,t)}function N(t,e){let a=t?chunkXGUPIAAF_cjs.k()||os.homedir():e||chunkXGUPIAAF_cjs.p()||process.cwd();return path.join(a,V,X)}function te(t,e){let a=e||chunkXGUPIAAF_cjs.p()||process.cwd();return path.join(a,chunkJUNIAQ2A_cjs.e,P(t),"skills")}function D(t,e,a,r){if(chunkJUNIAQ2A_cjs.o(t,e?"global":"project"))return N(e,a);if(t==="eve"&&r)return te(r,a);let n=chunkJUNIAQ2A_cjs.b[t],i=chunkXGUPIAAF_cjs.k()||os.homedir(),s=e?i:a||chunkXGUPIAAF_cjs.p()||process.cwd();return e?n.globalSkillsDir===void 0?path.join(s,n.skillsDir):n.globalSkillsDir:path.join(s,n.skillsDir)}function ge(t,e){return path.resolve(path.dirname(t),e)}async function S(t){try{await promises.rm(t,{recursive:!0,force:!0});}catch{}await promises.mkdir(t,{recursive:true});}async function j(t,e){try{let a=path.resolve(t),r=path.resolve(e),[n,i]=await Promise.all([promises.realpath(a).catch(()=>a),promises.realpath(r).catch(()=>r)]);if(n===i)return !0;let s=chunkXGUPIAAF_cjs.q(t),l=chunkXGUPIAAF_cjs.q(e);if(s===l)return !0;try{if((await promises.lstat(e)).isSymbolicLink()){let d=await promises.readlink(e);if(ge(e,d)===a)return !0;await promises.rm(e);}else await promises.rm(e,{recursive:!0});}catch(k){if(k&&typeof k=="object"&&"code"in k&&k.code==="ELOOP")try{await promises.rm(e,{force:!0});}catch{}}let u=path.dirname(e);await promises.mkdir(u,{recursive:!0});let h=chunkXGUPIAAF_cjs.q(u),g=path.relative(h,t),f=os.platform()==="win32"?"junction":void 0;return await promises.symlink(f==="junction"?a:g,e,f),!0}catch{return false}}async function Re(t,e,a={}){let r=chunkJUNIAQ2A_cjs.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||path.basename(t.path),u=P(l),h=a.mode??"symlink",f=e==="eve"&&h==="symlink"?D(e,n,i,s):N(n,i),o=path.join(f,u),k=D(e,n,i,s),d=path.join(k,P(t.name||path.basename(t.path))),c=chunkXGUPIAAF_cjs.q(d),m=chunkXGUPIAAF_cjs.q(o);if(!w(f,o))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})&&fs.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)&&fs.existsSync(m)||(await S(m),await R(t.path,m,e)),!n&&chunkJUNIAQ2A_cjs.o(e,"project"))return {success:!0,path:m,canonicalPath:m,mode:"copy"};if(n&&chunkJUNIAQ2A_cjs.o(e,"global"))return {success:!0,path:m,canonicalPath:m,mode:"symlink"};if(!n){let z=path.join(i,chunkJUNIAQ2A_cjs.b[e].skillsDir.split("/")[0]);if(!fs.existsSync(z))return {success:!0,path:m,canonicalPath:m,mode:"symlink",skipped:!0}}return o===d?{success:!0,path:d,canonicalPath:o,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})&&fs.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 Me(t,e,a={}){let{isGlobal:r=false,agentType:n,cwd:i,storePath:s}=a,l=chunkXGUPIAAF_cjs.q(t),u=chunkXGUPIAAF_cjs.q(e);if(l===u)return {success:true,path:u,canonicalPath:t,mode:"copy"};if(!r&&n&&i&&!chunkJUNIAQ2A_cjs.o(n,"project")){let f=path.join(i,chunkJUNIAQ2A_cjs.b[n].skillsDir.split("/")[0]);if(!fs.existsSync(f))return {success:true,path:e,canonicalPath:t,mode:"symlink",skipped:true}}let h=s?chunkXGUPIAAF_cjs.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 je(t,e,a={}){let{agentType:r="easbot"}=a,n=chunkXGUPIAAF_cjs.q(t),i=chunkXGUPIAAF_cjs.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 he=new Set(["metadata.json"]),ke=new Set([".git","__pycache__","__pypackages__"]),we=(t,e=false)=>!!(he.has(t)||e&&ke.has(t));function L(t){let{data:e,content:a}=chunkE7AHWFZN_cjs.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.replace(/^\r?\n/u,""):`---
|
|
2
2
|
${n.map(s=>`${s}: ${JSON.stringify(r[s])}`).join(`
|
|
3
3
|
`)}
|
|
4
4
|
---
|
|
5
|
-
${a.replace(/^\r?\n/u,"")}`}async function R(t,e,a){await promises.mkdir(e,{recursive:true});let r=await promises.readdir(t,{withFileTypes:true});await Promise.all(r.filter(n=>!we(n.name,n.isDirectory())).map(async n=>{let i=path.join(t,n.name),s=path.join(e,n.name);if(n.isDirectory())await R(i,s,a);else try{if(a==="eve"&&n.name.toLowerCase()==="skill.md"){await promises.writeFile(s,L(await promises.readFile(i,"utf-8")));return}await promises.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 ye(t){return t.some(e=>path.basename(e.path).toLowerCase()==="skill.md")}function U(t){return `${P(t)}.md`}function be(t){let e=t.find(r=>path.basename(r.path).toLowerCase()==="skill.md");if(e)return L(e.contents);let a=t.find(r=>path.extname(r.path).toLowerCase()===".md");return a?L(a.contents):""}async function _e(t,e,a={}){return (await ne(t,e,a)).installed}async function ne(t,e,a={}){let r=
|
|
5
|
+
${a.replace(/^\r?\n/u,"")}`}async function R(t,e,a){await promises.mkdir(e,{recursive:true});let r=await promises.readdir(t,{withFileTypes:true});await Promise.all(r.filter(n=>!we(n.name,n.isDirectory())).map(async n=>{let i=path.join(t,n.name),s=path.join(e,n.name);if(n.isDirectory())await R(i,s,a);else try{if(a==="eve"&&n.name.toLowerCase()==="skill.md"){await promises.writeFile(s,L(await promises.readFile(i,"utf-8")));return}await promises.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 ye(t){return t.some(e=>path.basename(e.path).toLowerCase()==="skill.md")}function U(t){return `${P(t)}.md`}function be(t){let e=t.find(r=>path.basename(r.path).toLowerCase()==="skill.md");if(e)return L(e.contents);let a=t.find(r=>path.extname(r.path).toLowerCase()===".md");return a?L(a.contents):""}async function _e(t,e,a={}){return (await ne(t,e,a)).installed}async function ne(t,e,a={}){let r=chunkJUNIAQ2A_cjs.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):path.join(a.cwd||process.cwd(),r.skillsDir),s=path.join(i,n);if(!w(i,s))return {installed:false,mode:null,path:""};try{let l=await promises.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 Ue(t,e,a={}){let r=P(t),n=D(e,a.global??false,a.cwd,a.eveSubagent),i=path.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 promises.access(path.join(t,"SKILL.md")),{created:!1}}catch{}return await promises.mkdir(t,{recursive:true}),await e(t),{created:true}}function Be(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=path.join(r,a);if(!w(r,n))throw new Error("Invalid skill name: potential path traversal detected");return n}async function $e(t,e,a={}){let r=chunkJUNIAQ2A_cjs.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=path.join(h,u),f=D(e,n,i,l),o=path.join(f,u);if(!w(h,g))return {success:false,path:o,mode:s,error:"Invalid skill name: potential path traversal detected"};if(!w(f,o))return {success:false,path:o,mode:s,error:"Invalid skill name: potential path traversal detected"};try{if(s==="copy"){await S(o);let c=e==="eve"?U(t.installName):"SKILL.md",m=path.join(o,c);return await promises.writeFile(m,e==="eve"?L(t.content):t.content,"utf-8"),{success:!0,path:o,mode:"copy"}}let k=e==="eve"?U(t.installName):"SKILL.md";if(await O(g,async c=>{let m=path.join(c,k);await promises.writeFile(m,e==="eve"?L(t.content):t.content,"utf-8");}),n&&chunkJUNIAQ2A_cjs.o(e,"global"))return {success:!0,path:g,canonicalPath:g,mode:"symlink"};if(!await j(g,o)){await S(o);let c=e==="eve"?U(t.installName):"SKILL.md",m=path.join(o,c);return await promises.writeFile(m,e==="eve"?L(t.content):t.content,"utf-8"),{success:!0,path:o,canonicalPath:g,mode:"symlink",symlinkFailed:!0}}return {success:!0,path:o,canonicalPath:g,mode:"symlink"}}catch(k){return {success:false,path:o,mode:s,error:k instanceof Error?k.message:"Unknown error"}}}async function ze(t,e,a={}){let r=chunkJUNIAQ2A_cjs.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=path.join(h,u),f=D(e,n,i,l),o=path.join(f,u);if(!w(h,g))return {success:false,path:o,mode:s,error:"Invalid skill name: potential path traversal detected"};if(!w(f,o))return {success:false,path:o,mode:s,error:"Invalid skill name: potential path traversal detected"};async function k(d){for(let[c,m]of t.files){let b=path.join(d,c);if(!w(d,b))continue;let $=path.dirname(b);$!==d&&await promises.mkdir($,{recursive:true}),await promises.writeFile(b,e==="eve"&&path.basename(c).toLowerCase()==="skill.md"&&typeof m=="string"?L(m):m);}}try{return s==="copy"?(await S(o),await k(o),{success:!0,path:o,mode:"copy"}):(await O(g,k),n&&chunkJUNIAQ2A_cjs.o(e,"global")?{success:!0,path:g,canonicalPath:g,mode:"symlink"}:await j(g,o)?{success:!0,path:o,canonicalPath:g,mode:"symlink"}:(await S(o),await k(o),{success:!0,path:o,canonicalPath:g,mode:"symlink",symlinkFailed:!0}))}catch(d){return {success:false,path:o,mode:s,error:d instanceof Error?d.message:"Unknown error"}}}async function Ke(t,e,a={}){let r=chunkJUNIAQ2A_cjs.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"&&!ye(t.files)){let d=path.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 promises.mkdir(h,{recursive:!0}),await promises.rm(d,{recursive:!0,force:!0}),await promises.writeFile(d,be(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=path.join(g,u),o=path.join(h,u);if(!w(g,f))return {success:false,path:o,mode:s,error:"Invalid skill name: potential path traversal detected"};if(!w(h,o))return {success:false,path:o,mode:s,error:"Invalid skill name: potential path traversal detected"};async function k(d){for(let c of t.files){let m=path.join(d,c.path);if(!w(d,m))continue;let b=path.dirname(m);b!==d&&await promises.mkdir(b,{recursive:true}),await promises.writeFile(m,e==="eve"&&path.basename(c.path).toLowerCase()==="skill.md"?L(c.contents):c.contents,"utf-8");}}try{if(s==="copy")return await S(o),await k(o),{success:!0,path:o,mode:"copy"};if(await O(f,k),n&&chunkJUNIAQ2A_cjs.o(e,"global"))return {success:!0,path:f,canonicalPath:f,mode:"symlink"};if(!n&&!chunkJUNIAQ2A_cjs.o(e,"project")){let c=path.join(i,chunkJUNIAQ2A_cjs.b[e].skillsDir.split("/")[0]);if(!fs.existsSync(c))return {success:!0,path:f,canonicalPath:f,mode:"symlink",skipped:!0}}return await j(f,o)?{success:!0,path:o,canonicalPath:f,mode:"symlink"}:(await S(o),await k(o),{success:!0,path:o,canonicalPath:f,mode:"symlink",symlinkFailed:!0})}catch(d){return {success:false,path:o,mode:s,error:d instanceof Error?d.message:"Unknown error"}}}async function Ge(t={}){let e=t.cwd||process.cwd(),{scanInstalledSkillDirs:a}=await import('./scan-6EBCZDVK.cjs'),r=t.agentFilter?null:await chunkJUNIAQ2A_cjs.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())}exports.a=V;exports.b=X;exports.c=ve;exports.d=P;exports.e=N;exports.f=te;exports.g=D;exports.h=Re;exports.i=Me;exports.j=je;exports.k=_e;exports.l=ne;exports.m=Ue;exports.n=O;exports.o=Be;exports.p=$e;exports.q=ze;exports.r=Ke;exports.s=Ge;
|
|
@@ -1 +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;
|
|
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 d(){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(d(),"agents/skills")},detectInstalled:async()=>fs.existsSync(path.join(d(),"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(d(),"devin/skills")},detectInstalled:async()=>fs.existsSync(path.join(d(),"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(d(),"goose/skills")},detectInstalled:async()=>fs.existsSync(path.join(d(),"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(d(),"opencode/skills")},detectInstalled:async()=>fs.existsSync(path.join(d(),"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(d(),"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(d(),"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(d(),"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(o=>utils.Wildcard.match(o,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 o of n)utils.Wildcard.match(o,r)&&i.add(o);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 o of i){let c=a[o];if(!c||!c.skillsDir||!x.test(c.skillsDir))continue;let T=c.skillsDir===".agents/skills"?path.join(n,".agents","skills"):path.join(n,c.skillsDir);if(o==="eve")for(let z of R(n)){let O=path.join(n,v,z,"skills");r.add(k(`${O}/**/SKILL.md`));}r.add(k(`${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 o=a[r];o&&o.globalSkillsDir!==void 0&&i.add(k(`${o.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 k(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=k(i.globalSkillsDir);r!==""&&t.add(r);}let n=k(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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkIJI72D6W_cjs=require('./chunk-IJI72D6W.cjs'),chunkHOK3SUH4_cjs=require('./chunk-HOK3SUH4.cjs'),chunkJUNIAQ2A_cjs=require('./chunk-JUNIAQ2A.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=chunkJUNIAQ2A_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(chunkJUNIAQ2A_cjs.b),G="/",m=[],F=o.replace(/\\/g,"/"),M=chunkJUNIAQ2A_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 chunkHOK3SUH4_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=chunkJUNIAQ2A_cjs.b[t],S=[];R&&P.skillsDir!==void 0&&S.push(chunkIJI72D6W_cjs.g(t,false,o)),C&&P.globalSkillsDir!==void 0&&S.push(chunkIJI72D6W_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 chunkHOK3SUH4_cjs.y(s.skillMdPath);c&&r.push(c);}return r}exports.a=v;exports.b=Y;
|