@easbot/skills 0.3.4 → 0.3.7

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.
@@ -1 +1 @@
1
- export{e as BLOB_ALLOWED_REPOS,h as fetchRepoTree,j as findSkillMdPaths,i as getSkillFolderHashFromTree,g as resetRepoTreeAuthState,f as toSkillSlug,k as tryBlobInstall}from'./chunk-MH2XZDJ5.mjs';
1
+ export{e as BLOB_ALLOWED_REPOS,h as fetchRepoTree,j as findSkillMdPaths,i as getSkillFolderHashFromTree,g as resetRepoTreeAuthState,f as toSkillSlug,k as tryBlobInstall}from'./chunk-ZEMGS5WR.mjs';
@@ -0,0 +1 @@
1
+ 'use strict';var chunkXDSGBJHO_cjs=require('./chunk-XDSGBJHO.cjs');Object.defineProperty(exports,"BLOB_ALLOWED_REPOS",{enumerable:true,get:function(){return chunkXDSGBJHO_cjs.f}});Object.defineProperty(exports,"fetchRepoTree",{enumerable:true,get:function(){return chunkXDSGBJHO_cjs.i}});Object.defineProperty(exports,"findSkillMdPaths",{enumerable:true,get:function(){return chunkXDSGBJHO_cjs.k}});Object.defineProperty(exports,"getSkillFolderHashFromTree",{enumerable:true,get:function(){return chunkXDSGBJHO_cjs.j}});Object.defineProperty(exports,"resetRepoTreeAuthState",{enumerable:true,get:function(){return chunkXDSGBJHO_cjs.h}});Object.defineProperty(exports,"toSkillSlug",{enumerable:true,get:function(){return chunkXDSGBJHO_cjs.g}});Object.defineProperty(exports,"tryBlobInstall",{enumerable:true,get:function(){return chunkXDSGBJHO_cjs.l}});
@@ -0,0 +1,208 @@
1
+ import {a,d,c,e,k as k$1,h,i,j,b as b$1}from'./chunk-ZEMGS5WR.mjs';import {join,dirname,resolve,normalize,sep,relative,basename,isAbsolute,extname}from'path';import Di from'simple-git';import {mkdtemp,rm,readFile,writeFile,readdir,mkdir,cp,access,stat,lstat,realpath,readlink,symlink}from'fs/promises';import {homedir,tmpdir,platform}from'os';import {execFile,execSync,spawn,spawnSync}from'child_process';import {promisify,stripVTControlCharacters}from'util';import {createHash}from'crypto';import {xdgConfig,xdgState,xdgData,xdgCache}from'xdg-basedir';import {existsSync,readdirSync,readFileSync,mkdirSync,writeFileSync}from'fs';import {determineAgent}from'@vercel/detect-agent';import {gunzipSync,inflateRawSync}from'zlib';import k from'picocolors';import*as y from'@clack/prompts';import*as ps from'readline';import {Writable}from'stream';import {Log,resolveLocaleLang}from'@easbot/utils';import {fileURLToPath}from'url';function Xe(t){if(t.type==="local")return null;let e=t.url.match(/^git@[^:]+:(.+)$/);if(e){let s=e[1];return s=s.replace(/\.git$/,""),s.includes("/")?s:null}if(t.url.startsWith("ssh://"))try{let n=new URL(t.url).pathname.slice(1);return n=n.replace(/\.git$/,""),n.includes("/")?n:null}catch{return null}if(!t.url.startsWith("http://")&&!t.url.startsWith("https://"))return null;try{let n=new URL(t.url).pathname.slice(1);if(n=n.replace(/\.git$/,""),n.includes("/"))return n}catch{}return null}function Xt(t){let e=t.match(/^([^/]+)\/([^/]+)$/);return e?{owner:e[1],repo:e[2]}:null}async function Et(t,e){try{let s=await fetch(`https://api.github.com/repos/${t}/${e}`);return s.ok?(await s.json()).private===!0:null}catch{return null}}function Ps(t){let s=t.replace(/\\/g,"/").split("/");for(let n of s)if(n==="..")throw new Error(`Unsafe subpath: "${t}" contains path traversal segments. Subpaths must not contain ".." components.`);return t}function Ai(t){return isAbsolute(t)||t.startsWith("./")||t.startsWith("../")||t==="."||t===".."||/^[a-zA-Z]:[/\\]/.test(t)}var Ii={"coinbase/agentWallet":"coinbase/agentic-wallet-skills"};function Ts(t){try{return decodeURIComponent(t)}catch{return t}}function Li(t){if(t.startsWith("github:")||t.startsWith("gitlab:")||t.startsWith("git@")||/^ssh:\/\/.+\.git(?:$|[/?])/i.test(t))return true;if(t.startsWith("http://")||t.startsWith("https://"))try{let e=new URL(t),s=e.pathname;if(e.hostname==="github.com")return /^\/[^/]+\/[^/]+(?:\.git)?(?:\/tree\/[^/]+(?:\/.*)?)?\/?$/.test(s);if(e.hostname==="gitlab.com")return /^\/.+?\/[^/]+(?:\.git)?(?:\/-\/tree\/[^/]+(?:\/.*)?)?\/?$/.test(s)}catch{}return /^https?:\/\/.+\.git(?:$|[/?])/i.test(t)?true:!t.includes(":")&&!t.startsWith(".")&&!t.startsWith("/")&&/^([^/]+)\/([^/]+)(?:\/(.+)|@(.+))?$/.test(t)}function Pi(t){let e=t.indexOf("#");if(e<0)return {inputWithoutFragment:t};let s=t.slice(0,e),n=t.slice(e+1);if(!n||!Li(s))return {inputWithoutFragment:t};let l=n.indexOf("@");if(l===-1)return {inputWithoutFragment:s,ref:Ts(n)};let o=n.slice(0,l),i=n.slice(l+1);return {inputWithoutFragment:s,ref:o?Ts(o):void 0,skillFilter:i?Ts(i):void 0}}function $n(t,e,s){return e?`${t}#${e}${s?`@${s}`:""}`:t}function gt(t){if(Ai(t)){let f=resolve(t);return {type:"local",url:f,localPath:f}}let{inputWithoutFragment:e,ref:s,skillFilter:n}=Pi(t);t=e;let l=Ii[t];l&&(t=l);let o=t.match(/^github:(.+)$/);if(o)return gt($n(o[1],s,n));let i=t.match(/^gitlab:(.+)$/);if(i)return gt($n(`https://gitlab.com/${i[1]}`,s,n));let a=t.match(/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/(.+)/);if(a){let[,f,x,A,S]=a;return {type:"github",url:`https://github.com/${f}/${x}.git`,ref:A||s,subpath:S&&Ps(S)}}let r=t.match(/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)$/);if(r){let[,f,x,A]=r;return {type:"github",url:`https://github.com/${f}/${x}.git`,ref:A||s}}let h=t.match(/github\.com\/([^/]+)\/([^/]+)/);if(h){let[,f,x]=h,A=x.replace(/\.git$/,"");return {type:"github",url:`https://github.com/${f}/${A}.git`,...s?{ref:s}:{}}}let u=t.match(/^(https?):\/\/([^/]+)\/(.+?)\/-\/tree\/([^/]+)\/(.+)/);if(u){let[,f,x,A,S,E]=u;if(x!=="github.com"&&A)return {type:"gitlab",url:`${f}://${x}/${A.replace(/\.git$/,"")}.git`,ref:S||s,subpath:E&&Ps(E)}}let m=t.match(/^(https?):\/\/([^/]+)\/(.+?)\/-\/tree\/([^/]+)$/);if(m){let[,f,x,A,S]=m;if(x!=="github.com"&&A)return {type:"gitlab",url:`${f}://${x}/${A.replace(/\.git$/,"")}.git`,ref:S||s}}let d=t.match(/gitlab\.com\/(.+?)(?:\.git)?\/?$/);if(d){let f=d[1];if(f.includes("/"))return {type:"gitlab",url:`https://gitlab.com/${f}.git`,...s?{ref:s}:{}}}let p=t.match(/^([^/]+)\/([^/@]+)@(.+)$/);if(p&&!t.includes(":")&&!t.startsWith(".")&&!t.startsWith("/")){let[,f,x,A]=p;return {type:"github",url:`https://github.com/${f}/${x}.git`,...s?{ref:s}:{},skillFilter:n||A}}let c=t.match(/^([^/]+)\/([^/]+)(?:\/(.+?))?\/?$/);if(c&&!t.includes(":")&&!t.startsWith(".")&&!t.startsWith("/")){let[,f,x,A]=c;return {type:"github",url:`https://github.com/${f}/${x}.git`,...s?{ref:s}:{},subpath:A&&Ps(A),...n?{skillFilter:n}:{}}}return Ti(t)?{type:"well-known",url:t}:{type:"git",url:t,...s?{ref:s}:{}}}function Ti(t){if(!t.startsWith("http://")&&!t.startsWith("https://"))return false;try{let e=new URL(t);return !(["github.com","gitlab.com","raw.githubusercontent.com"].includes(e.hostname)||t.endsWith(".git"))}catch{return false}}var xn=3e5,Ds=(()=>{let t=process.env.SKILLS_CLONE_TIMEOUT_MS;if(!t)return xn;let e=Number.parseInt(t,10);return Number.isFinite(e)&&e>0?e:xn})(),An=promisify(execFile),Ke=class extends Error{constructor(s,n,l=false,o=false){super(s);a(this,"url");a(this,"isTimeout");a(this,"isAuthError");this.name="GitCloneError",this.url=n,this.isTimeout=l,this.isAuthError=o;}};function ji(t){let e=t.match(/^git@github\.com:([^/]+)\/([^/]+?)(?:\.git)?$/i);if(e){let s=e[1],n=e[2];return {owner:s,repo:n,slug:`${s}/${n}`,sshUrl:`git@github.com:${s}/${n}.git`}}try{let s=new URL(t);if(s.hostname!=="github.com")return null;let n=s.pathname.match(/^\/([^/]+)\/([^/]+?)(?:\.git)?\/?$/);if(!n)return null;let l=n[1],o=n[2];return {owner:l,repo:o,slug:`${l}/${o}`,sshUrl:`git@github.com:${l}/${o}.git`}}catch{return null}}function Oi(t){try{let e=new URL(t);return e.protocol==="https:"&&e.hostname==="github.com"}catch{return false}}function Tn(t){let e=t.toLowerCase();return e.includes("saml sso")||e.includes("enforced sso")||e.includes("enabled or enforced saml")||e.includes("re-authorize the oauth application")}function Fi(t){return t.includes("Authentication failed")||t.includes("could not read Username")||t.includes("Permission denied")||t.includes("Repository not found")||t.includes("requested URL returned error: 403")||Tn(t)}function In(t){let e={...process.env,GIT_TERMINAL_PROMPT:"0",GIT_LFS_SKIP_SMUDGE:"1",...t};return Di({timeout:{block:Ds},config:["filter.lfs.required=false","filter.lfs.smudge=","filter.lfs.clean=","filter.lfs.process="]}).env(e)}async function Ln(t){try{await rm(t,{recursive:!0,force:!0});}catch{}await mkdir(t,{recursive:true});}async function Mi(t,e,s){let n=t.slug;try{let{stdout:o,stderr:i}=await An("gh",["auth","status","-h","github.com"],{timeout:5e3,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),a=`${o}${i}`;/Git operations protocol:\s+ssh/i.test(a)&&(n=t.sshUrl);}catch{return false}return await An("gh",["repo","clone",n,e,"--",...s?["--depth=1","--branch",s]:["--depth=1"]],{timeout:Ds,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),true}function Wi(t,e,s){return e&&Tn(s)?`GitHub blocked HTTPS access to ${t} 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 ${e.sshUrl}
5
+ - Verify access with: gh auth status -h github.com or ssh -T git@github.com`:e?`Authentication failed for ${t}.
6
+ - For private repos, ensure you have access
7
+ - Retry with SSH: easbot skills add ${e.sshUrl}
8
+ - Check access with: gh auth status -h github.com or ssh -T git@github.com`:`Authentication failed for ${t}.
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 ze(t,e){let s=await mkdtemp(join(tmpdir(),"skills-")),n=e?["--depth","1","--branch",e]:["--depth","1"],l=ji(t);try{return await In().clone(t,s,n),s}catch(o){let i=o instanceof Error?o.message:String(o),a=i.includes("block timeout")||i.includes("timed out"),r=Fi(i);if(a){try{await rm(s,{recursive:!0,force:!0});}catch{}let h=Math.round(Ds/1e3);throw new Ke(`Clone timed out after ${h}s. Common causes:
12
+ - Large repository: raise the timeout with SKILLS_CLONE_TIMEOUT_MS=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)`,t,true,false)}if(r&&l&&Oi(t)){try{if(await Ln(s),await Mi(l,s,e))return s}catch{}try{return await Ln(s),await In({GIT_SSH_COMMAND:process.env.GIT_SSH_COMMAND??"ssh -o BatchMode=yes"}).clone(l.sshUrl,s,n),s}catch{}}try{await rm(s,{recursive:!0,force:!0});}catch{}throw r?new Ke(Wi(t,l,i),t,false,true):new Ke(`Failed to clone ${t}: ${i}`,t,false,false)}}async function st(t){let e=normalize(resolve(t)),s=normalize(resolve(tmpdir()));if(!e.startsWith(s+sep)&&e!==s)throw new Error("Attempted to clean up directory outside of temp directory");await rm(t,{recursive:true,force:true});}var Bi="skills-lock.json",En=1;function Cn(t){return join(t||process.cwd(),Bi)}async function Le(t){let e=Cn(t);try{let s=await readFile(e,"utf-8"),n=JSON.parse(s);return typeof n.version!="number"||!n.skills||n.version<En?Ns():n}catch{return Ns()}}async function Rn(t,e){let s=Cn(e),n={};for(let i of Object.keys(t.skills).sort())n[i]=t.skills[i];let l={version:t.version,skills:n},o=JSON.stringify(l,null,2)+`
17
+ `;await writeFile(s,o,"utf-8");}async function He(t){let e=[];await _n(t,t,e),e.sort((n,l)=>n.relativePath.localeCompare(l.relativePath));let s=createHash("sha256");for(let n of e)s.update(n.relativePath),s.update(n.content);return s.digest("hex")}async function _n(t,e,s){let n=await readdir(e,{withFileTypes:true});await Promise.all(n.map(async l=>{let o=join(e,l.name);if(l.isDirectory()){if(l.name===".git"||l.name==="node_modules")return;await _n(t,o,s);}else if(l.isFile()){let i=await readFile(o),a=relative(t,o).split("\\").join("/");s.push({relativePath:a,content:i});}}));}async function Ct(t,e,s){let n=await Le(s);n.skills[t]=e,await Rn(n,s);}async function ic(t,e){let s=await Le(e);return t in s.skills?(delete s.skills[t],await Rn(s,e),true):false}function Ns(){return {version:En,skills:{}}}function Rt(t,e){let s=normalize(resolve(e)),n=normalize(resolve(t));return n.startsWith(s+sep)||n===s}function nt(t){return t.startsWith("./")}async function jn(t){let e=[],s=(n,l)=>{if(Rt(n,t)){if(l&&l.length>0)for(let o of l){if(!nt(o))continue;let i=dirname(join(n,o));Rt(i,t)&&e.push(i);}e.push(join(n,"skills"));}};try{let n=await readFile(join(t,".claude-plugin/marketplace.json"),"utf-8"),l=JSON.parse(n),o=l.metadata?.pluginRoot;if(o===void 0||nt(o))for(let a of l.plugins??[]){if(typeof a.source!="string"&&a.source!==void 0||a.source!==void 0&&!nt(a.source))continue;let r=join(t,o??"",a.source??"");s(r,a.skills);}}catch{}try{let n=await readFile(join(t,".claude-plugin/plugin.json"),"utf-8"),l=JSON.parse(n);s(t,l.skills);}catch{}return e}async function On(t){let e=new Map;try{let s=await readFile(join(t,".claude-plugin/marketplace.json"),"utf-8"),n=JSON.parse(s),l=n.metadata?.pluginRoot;if(l===void 0||nt(l))for(let i of n.plugins??[]){if(!i.name||typeof i.source!="string"&&i.source!==void 0||i.source!==void 0&&!nt(i.source))continue;let a=join(t,l??"",i.source??"");if(Rt(a,t)&&i.skills&&i.skills.length>0)for(let r of i.skills){if(!nt(r))continue;let h=join(a,r);Rt(h,t)&&e.set(resolve(h),i.name);}}}catch{}try{let s=await readFile(join(t,".claude-plugin/plugin.json"),"utf-8"),n=JSON.parse(s);if(n.name&&n.skills&&n.skills.length>0)for(let l of n.skills){if(!nt(l))continue;let o=join(t,l);Rt(o,t)&&e.set(resolve(o),n.name);}}catch{}return e}var _s=["node_modules",".git","dist","build","__pycache__"],Mn=[".agents/skills",".claude/skills",".cline/skills",".codebuddy/skills",".codex/skills",".commandcode/skills",".continue/skills",".github/skills",".goose/skills",".iflow/skills",".junie/skills",".kilocode/skills",".kiro/skills",".mux/skills",".neovate/skills",".opencode/skills",".openhands/skills",".pi/skills",".qoder/skills",".roo/skills",".trae/skills",".windsurf/skills",".zencoder/skills"];function Es(t){return t.toLowerCase().replace(/[\s_]+/g,"-")}function Qi(t){return t.split(sep).join("/").replace(/\/+/g,"/")}function eo(){let t=process.env.INSTALL_INTERNAL_SKILLS;return t==="1"||t==="true"}async function Us(t){try{let e=join(t,"SKILL.md");return (await stat(e)).isFile()}catch{return false}}async function Ge(t,e){try{let s=await readFile(t,"utf-8"),{data:n}=d(s);if(!n.name||!n.description||typeof n.name!="string"||typeof n.description!="string")return null;let l=n.metadata&&typeof n.metadata=="object"&&!Array.isArray(n.metadata)?n.metadata:void 0;return l?.internal===!0&&!eo()&&!e?.includeInternal?null:{name:c(n.name),description:c(n.description),path:dirname(t),rawContent:s,metadata:l}}catch{return null}}async function zn(t,e=0,s=5){if(e>s)return [];try{let[n,l]=await Promise.all([Us(t),readdir(t,{withFileTypes:!0}).catch(()=>[])]),o=n?[t]:[],i=await Promise.all(l.filter(a=>a.isDirectory()&&!_s.includes(a.name)).map(a=>zn(join(t,a.name),e+1,s)));return [...o,...i.flat()]}catch{return []}}function to(t,e){let s=normalize(resolve(t)),n=normalize(resolve(join(t,e)));return n.startsWith(s+sep)||n===s}async function Pe(t,e,s){let n=[],l=new Set,o=await Le(t),i=new Set(Object.keys(o.skills).map(Es));if(e&&!to(t,e))throw new Error(`Invalid subpath: "${e}" resolves outside the repository directory. Subpath must not contain ".." segments that escape the base path.`);let a=e?join(t,e):t,r=await On(a),h=c=>{let f=resolve(c.path);return r.has(f)&&(c.pluginName=r.get(f)),c},u=c=>{if(i.size===0)return false;let f=Qi(relative(t,c.path));if(!Mn.some(E=>f===E||f.startsWith(`${E}/`)))return false;let A=Es(c.name),S=Es(basename(c.path));return i.has(A)||i.has(S)};if(await Us(a)){let c=await Ge(join(a,"SKILL.md"),s);if(c&&!u(c)&&(c=h(c),n.push(c),l.add(c.name),!s?.fullDepth))return n}let m=[a,join(a,"skills"),join(a,"skills/.curated"),join(a,"skills/.experimental"),join(a,"skills/.system"),...Mn.map(c=>join(a,c))],d=new Set(m.slice(1));m.push(...await jn(a));let p=async c=>{if(!await Us(c))return false;let f=await Ge(join(c,"SKILL.md"),s);return !f||l.has(f.name)||u(f)||(f=h(f),n.push(f),l.add(f.name)),true};for(let c of m){let f=d.has(c);try{let x=await readdir(c,{withFileTypes:!0});for(let A of x){if(!A.isDirectory())continue;let S=join(c,A.name);if(!(await p(S)||!f)&&!_s.includes(A.name))try{let T=await readdir(S,{withFileTypes:!0});for(let O of T)!O.isDirectory()||_s.includes(O.name)||await p(join(S,O.name));}catch{}}}catch{}}if(n.length===0||s?.fullDepth){let c=await zn(a);for(let f of c){let x=await Ge(join(f,"SKILL.md"),s);x&&!l.has(x.name)&&!u(x)&&(x=h(x),n.push(x),l.add(x.name));}}return n}function le(t){return t.name||basename(t.path)}function es(t,e){let s=e.map(n=>n.toLowerCase());return t.filter(n=>{let l=n.name.toLowerCase(),o=le(n).toLowerCase();return s.some(i=>i===l||i===o)})}var _t=null,Ut=null,jt=null;function vc(t){_t=t;}function xc(){_t=null;}function Ot(){if(_t)return _t;let t=homedir();return {Path:{home:t,data:process.env.EASBOT_DATA_PATH?.trim()||join(xdgData??join(t,".local","share"),"easbot"),config:process.env.EASBOT_CONFIG_PATH?.trim()||join(xdgConfig??join(t,".config"),"easbot"),state:process.env.EASBOT_STATE_PATH?.trim()||join(xdgState??join(xdgData??join(t,".local","share"),"easbot"),"state"),cache:process.env.EASBOT_CACHE_PATH?.trim()||join(xdgCache??join(t,".cache"),"easbot"),log:process.env.EASBOT_LOG_PATH?.trim()||join(xdgState??join(xdgData??join(t,".local","share"),"easbot"),"log"),bin:process.env.EASBOT_BIN_PATH?.trim()||join(t,".local","bin")}}}function Ac(t){Ut=t;}function Ic(){Ut=null;}function so(){if(Ut)return Ut;let t=process.cwd();return {directory:t,worktree:t}}function Lc(t){jt=t,t&&(_t=t.global,Ut=t.instance);}function Pc(){return jt}function Tc(){return jt!==null}function Dc(){if(!jt)throw new Error("Skills agent adapter not set. Call setAgentAdapter() before using skills commands that depend on subAgentRunner.");return jt}function Ue(){return Ot().Path.home||homedir()}function Ft(){let t=Ot().Path.config;return t||(xdgConfig??join(Ue(),".config"))}function no(){let t=Ot().Path.data;return t||(xdgData??join(Ue(),".local","share"))}function Nc(){let t=Ot().Path.state;return t||(xdgState??join(no(),"state"))}function Ec(){let t=Ot().Path.cache;return t||(xdgCache??join(Ue(),".cache"))}function pt(){return so().directory||process.cwd()}var b=Ue(),Te=Ft()||xdgConfig||join(b,".config"),Vn=process.env.CODEX_HOME?.trim()||join(b,".codex"),qn=process.env.CLAUDE_CONFIG_DIR?.trim()||join(b,".claude"),Jn=process.env.VIBE_HOME?.trim()||join(b,".vibe"),Xn=process.env.HERMES_HOME?.trim()||join(b,".hermes"),Yn=process.env.AUTOHAND_HOME?.trim()||join(b,".autohand"),Zn=process.env.APPDATA?.trim(),Qn=process.env.FLATPAK_XDG_CONFIG_HOME?.trim();function ro(t,e){try{let s=JSON.parse(readFileSync(t,"utf-8"));return !!(s.dependencies?.[e]||s.devDependencies?.[e])}catch{return false}}function ao(t=b,e=existsSync){return e(join(t,".openclaw"))?join(t,".openclaw/skills"):e(join(t,".clawdbot"))?join(t,".clawdbot/skills"):e(join(t,".moltbot"))?join(t,".moltbot/skills"):join(t,".openclaw/skills")}var D={easbot:{name:"easbot",displayName:"EASBot",skillsDir:".easbot/skills",get globalSkillsDir(){return join(Ft(),"skills")},detectInstalled:async()=>true,showInUniversalList:false,showInUniversalPrompt:true},"aider-desk":{name:"aider-desk",displayName:"AiderDesk",skillsDir:".aider-desk/skills",globalSkillsDir:join(b,".aider-desk/skills"),detectInstalled:async()=>existsSync(join(b,".aider-desk"))},amp:{name:"amp",displayName:"Amp",skillsDir:".agents/skills",globalSkillsDir:join(Te,"agents/skills"),detectInstalled:async()=>existsSync(join(Te,"amp"))},antigravity:{name:"antigravity",displayName:"Antigravity",skillsDir:".agents/skills",globalSkillsDir:join(b,".gemini/antigravity/skills"),detectInstalled:async()=>existsSync(join(b,".gemini/antigravity"))},"antigravity-cli":{name:"antigravity-cli",displayName:"Antigravity CLI",skillsDir:".agents/skills",globalSkillsDir:join(b,".gemini/antigravity-cli/skills"),detectInstalled:async()=>existsSync(join(b,".gemini/antigravity-cli"))},astrbot:{name:"astrbot",displayName:"AstrBot",skillsDir:"data/skills",globalSkillsDir:join(b,".astrbot/data/skills"),detectInstalled:async()=>existsSync(join(process.cwd(),"data/skills"))||existsSync(join(b,".astrbot"))},"autohand-code":{name:"autohand-code",displayName:"Autohand Code CLI",skillsDir:".autohand/skills",globalSkillsDir:join(Yn,"skills"),detectInstalled:async()=>existsSync(Yn)},augment:{name:"augment",displayName:"Augment",skillsDir:".augment/skills",globalSkillsDir:join(b,".augment/skills"),detectInstalled:async()=>existsSync(join(b,".augment"))},bob:{name:"bob",displayName:"IBM Bob",skillsDir:".bob/skills",globalSkillsDir:join(b,".bob/skills"),detectInstalled:async()=>existsSync(join(b,".bob"))},"claude-code":{name:"claude-code",displayName:"Claude Code",skillsDir:".claude/skills",globalSkillsDir:join(qn,"skills"),detectInstalled:async()=>existsSync(qn)},openclaw:{name:"openclaw",displayName:"OpenClaw",skillsDir:"skills",globalSkillsDir:ao(),detectInstalled:async()=>existsSync(join(b,".openclaw"))||existsSync(join(b,".clawdbot"))||existsSync(join(b,".moltbot"))},cline:{name:"cline",displayName:"Cline",skillsDir:".agents/skills",globalSkillsDir:join(b,".agents","skills"),detectInstalled:async()=>existsSync(join(b,".cline"))},"codearts-agent":{name:"codearts-agent",displayName:"CodeArts Agent",skillsDir:".codeartsdoer/skills",globalSkillsDir:join(b,".codeartsdoer/skills"),detectInstalled:async()=>existsSync(join(b,".codeartsdoer"))},codebuddy:{name:"codebuddy",displayName:"CodeBuddy",skillsDir:".codebuddy/skills",globalSkillsDir:join(b,".codebuddy/skills"),detectInstalled:async()=>existsSync(join(process.cwd(),".codebuddy"))||existsSync(join(b,".codebuddy"))},codemaker:{name:"codemaker",displayName:"Codemaker",skillsDir:".codemaker/skills",globalSkillsDir:join(b,".codemaker/skills"),detectInstalled:async()=>existsSync(join(b,".codemaker"))},codestudio:{name:"codestudio",displayName:"Code Studio",skillsDir:".codestudio/skills",globalSkillsDir:join(b,".codestudio/skills"),detectInstalled:async()=>existsSync(join(b,".codestudio"))},codex:{name:"codex",displayName:"Codex",skillsDir:".agents/skills",globalSkillsDir:join(Vn,"skills"),detectInstalled:async()=>existsSync(Vn)||existsSync("/etc/codex")},"command-code":{name:"command-code",displayName:"Command Code",skillsDir:".commandcode/skills",globalSkillsDir:join(b,".commandcode/skills"),detectInstalled:async()=>existsSync(join(b,".commandcode"))},continue:{name:"continue",displayName:"Continue",skillsDir:".continue/skills",globalSkillsDir:join(b,".continue/skills"),detectInstalled:async()=>existsSync(join(process.cwd(),".continue"))||existsSync(join(b,".continue"))},cortex:{name:"cortex",displayName:"Cortex Code",skillsDir:".cortex/skills",globalSkillsDir:join(b,".snowflake/cortex/skills"),detectInstalled:async()=>existsSync(join(b,".snowflake/cortex"))},crush:{name:"crush",displayName:"Crush",skillsDir:".crush/skills",globalSkillsDir:join(b,".config/crush/skills"),detectInstalled:async()=>existsSync(join(b,".config/crush"))},cursor:{name:"cursor",displayName:"Cursor",skillsDir:".agents/skills",globalSkillsDir:join(b,".cursor/skills"),detectInstalled:async()=>existsSync(join(b,".cursor"))},deepagents:{name:"deepagents",displayName:"Deep Agents",skillsDir:".agents/skills",globalSkillsDir:join(b,".deepagents/agent/skills"),detectInstalled:async()=>existsSync(join(b,".deepagents"))},devin:{name:"devin",displayName:"Devin for Terminal",skillsDir:".devin/skills",globalSkillsDir:join(Te,"devin/skills"),detectInstalled:async()=>existsSync(join(Te,"devin"))},dexto:{name:"dexto",displayName:"Dexto",skillsDir:".agents/skills",globalSkillsDir:join(b,".agents/skills"),showInUniversalPrompt:false,detectInstalled:async()=>existsSync(join(b,".dexto"))},droid:{name:"droid",displayName:"Droid",skillsDir:".factory/skills",globalSkillsDir:join(b,".factory/skills"),detectInstalled:async()=>existsSync(join(b,".factory"))},eve:{name:"eve",displayName:"Eve",skillsDir:"agent/skills",globalSkillsDir:void 0,detectInstalled:async()=>{let t=process.cwd();return existsSync(join(t,"agent"))&&ro(join(t,"package.json"),"eve")}},firebender:{name:"firebender",displayName:"Firebender",skillsDir:".agents/skills",globalSkillsDir:join(b,".firebender/skills"),showInUniversalPrompt:false,detectInstalled:async()=>existsSync(join(b,".firebender"))},forgecode:{name:"forgecode",displayName:"ForgeCode",skillsDir:".forge/skills",globalSkillsDir:join(b,".forge/skills"),detectInstalled:async()=>existsSync(join(b,".forge"))},"gemini-cli":{name:"gemini-cli",displayName:"Gemini CLI",skillsDir:".agents/skills",globalSkillsDir:join(b,".gemini/skills"),detectInstalled:async()=>existsSync(join(b,".gemini"))},"github-copilot":{name:"github-copilot",displayName:"GitHub Copilot",skillsDir:".agents/skills",globalSkillsDir:join(b,".copilot/skills"),detectInstalled:async()=>existsSync(join(b,".copilot"))},goose:{name:"goose",displayName:"Goose",skillsDir:".goose/skills",globalSkillsDir:join(Te,"goose/skills"),detectInstalled:async()=>existsSync(join(Te,"goose"))},"hermes-agent":{name:"hermes-agent",displayName:"Hermes Agent",skillsDir:".hermes/skills",globalSkillsDir:join(Xn,"skills"),detectInstalled:async()=>existsSync(Xn)},"inference-sh":{name:"inference-sh",displayName:"inference.sh",skillsDir:".inferencesh/skills",globalSkillsDir:join(b,".inferencesh/skills"),detectInstalled:async()=>existsSync(join(b,".inferencesh"))},jazz:{name:"jazz",displayName:"Jazz",skillsDir:".jazz/skills",globalSkillsDir:join(b,".jazz/skills"),detectInstalled:async()=>existsSync(join(b,".jazz"))||existsSync(join(process.cwd(),".jazz"))},junie:{name:"junie",displayName:"Junie",skillsDir:".junie/skills",globalSkillsDir:join(b,".junie/skills"),detectInstalled:async()=>existsSync(join(b,".junie"))},"iflow-cli":{name:"iflow-cli",displayName:"iFlow CLI",skillsDir:".iflow/skills",globalSkillsDir:join(b,".iflow/skills"),detectInstalled:async()=>existsSync(join(b,".iflow"))},kilo:{name:"kilo",displayName:"Kilo Code",skillsDir:".kilocode/skills",globalSkillsDir:join(b,".kilocode/skills"),detectInstalled:async()=>existsSync(join(b,".kilocode"))},"kimi-code-cli":{name:"kimi-code-cli",displayName:"Kimi Code CLI",skillsDir:".agents/skills",globalSkillsDir:join(b,".agents/skills"),detectInstalled:async()=>existsSync(join(b,".kimi-code"))||existsSync(join(b,".kimi"))},"kiro-cli":{name:"kiro-cli",displayName:"Kiro CLI",skillsDir:".kiro/skills",globalSkillsDir:join(b,".kiro/skills"),detectInstalled:async()=>existsSync(join(b,".kiro"))},kode:{name:"kode",displayName:"Kode",skillsDir:".kode/skills",globalSkillsDir:join(b,".kode/skills"),detectInstalled:async()=>existsSync(join(b,".kode"))},lingma:{name:"lingma",displayName:"Lingma",skillsDir:".lingma/skills",globalSkillsDir:join(b,".lingma/skills"),detectInstalled:async()=>existsSync(join(b,".lingma"))},loaf:{name:"loaf",displayName:"Loaf",skillsDir:".agents/skills",globalSkillsDir:join(b,".agents/skills"),showInUniversalPrompt:false,detectInstalled:async()=>existsSync(join(b,".loaf"))},mcpjam:{name:"mcpjam",displayName:"MCPJam",skillsDir:".mcpjam/skills",globalSkillsDir:join(b,".mcpjam/skills"),detectInstalled:async()=>existsSync(join(b,".mcpjam"))},"mistral-vibe":{name:"mistral-vibe",displayName:"Mistral Vibe",skillsDir:".vibe/skills",globalSkillsDir:join(Jn,"skills"),detectInstalled:async()=>existsSync(Jn)},moxby:{name:"moxby",displayName:"Moxby",skillsDir:".moxby/skills",globalSkillsDir:join(b,".moxby/skills"),detectInstalled:async()=>existsSync(join(b,".moxby"))},mux:{name:"mux",displayName:"Mux",skillsDir:".mux/skills",globalSkillsDir:join(b,".mux/skills"),detectInstalled:async()=>existsSync(join(b,".mux"))},opencode:{name:"opencode",displayName:"OpenCode",skillsDir:".agents/skills",globalSkillsDir:join(Te,"opencode/skills"),detectInstalled:async()=>existsSync(join(Te,"opencode"))},openhands:{name:"openhands",displayName:"OpenHands",skillsDir:".openhands/skills",globalSkillsDir:join(b,".openhands/skills"),detectInstalled:async()=>existsSync(join(b,".openhands"))},ona:{name:"ona",displayName:"Ona",skillsDir:".ona/skills",globalSkillsDir:join(b,".ona/skills"),detectInstalled:async()=>existsSync(join(b,".ona"))},pi:{name:"pi",displayName:"Pi",skillsDir:".pi/skills",globalSkillsDir:join(b,".pi/agent/skills"),detectInstalled:async()=>existsSync(join(b,".pi/agent"))},qoder:{name:"qoder",displayName:"Qoder",skillsDir:".qoder/skills",globalSkillsDir:join(b,".qoder/skills"),detectInstalled:async()=>existsSync(join(b,".qoder"))},"qoder-cn":{name:"qoder-cn",displayName:"Qoder CN",skillsDir:".qoder/skills",globalSkillsDir:join(b,".qoder-cn/skills"),detectInstalled:async()=>existsSync(join(b,".qoder-cn"))},"qwen-code":{name:"qwen-code",displayName:"Qwen Code",skillsDir:".qwen/skills",globalSkillsDir:join(b,".qwen/skills"),detectInstalled:async()=>existsSync(join(b,".qwen"))},replit:{name:"replit",displayName:"Replit",skillsDir:".agents/skills",globalSkillsDir:join(Te,"agents/skills"),showInUniversalList:false,detectInstalled:async()=>existsSync(join(process.cwd(),".replit"))},reasonix:{name:"reasonix",displayName:"Reasonix",skillsDir:".reasonix/skills",globalSkillsDir:join(b,".reasonix/skills"),detectInstalled:async()=>existsSync(join(b,".reasonix"))},rovodev:{name:"rovodev",displayName:"Rovo Dev",skillsDir:".rovodev/skills",globalSkillsDir:join(b,".rovodev/skills"),detectInstalled:async()=>existsSync(join(b,".rovodev"))},roo:{name:"roo",displayName:"Roo Code",skillsDir:".roo/skills",globalSkillsDir:join(b,".roo/skills"),detectInstalled:async()=>existsSync(join(b,".roo"))},"tabnine-cli":{name:"tabnine-cli",displayName:"Tabnine CLI",skillsDir:".tabnine/agent/skills",globalSkillsDir:join(b,".tabnine/agent/skills"),detectInstalled:async()=>existsSync(join(b,".tabnine"))},terramind:{name:"terramind",displayName:"Terramind",skillsDir:".terramind/skills",globalSkillsDir:join(b,".terramind/skills"),detectInstalled:async()=>existsSync(join(b,".terramind"))},tinycloud:{name:"tinycloud",displayName:"Tinycloud",skillsDir:".tinycloud/skills",globalSkillsDir:join(b,".tinycloud/skills"),detectInstalled:async()=>existsSync(join(b,".tinycloud"))},trae:{name:"trae",displayName:"Trae",skillsDir:".trae/skills",globalSkillsDir:join(b,".trae/skills"),detectInstalled:async()=>existsSync(join(b,".trae"))},"trae-cn":{name:"trae-cn",displayName:"Trae CN",skillsDir:".trae/skills",globalSkillsDir:join(b,".trae-cn/skills"),detectInstalled:async()=>existsSync(join(b,".trae-cn"))},warp:{name:"warp",displayName:"Warp",skillsDir:".agents/skills",globalSkillsDir:join(b,".agents/skills"),detectInstalled:async()=>existsSync(join(b,".warp"))},windsurf:{name:"windsurf",displayName:"Windsurf",skillsDir:".windsurf/skills",globalSkillsDir:join(b,".codeium/windsurf/skills"),detectInstalled:async()=>existsSync(join(b,".codeium/windsurf"))},zed:{name:"zed",displayName:"Zed",skillsDir:".agents/skills",globalSkillsDir:join(b,".agents/skills"),detectInstalled:async()=>existsSync(join(Te,"zed"))||!!Zn&&existsSync(join(Zn,"Zed"))||!!Qn&&existsSync(join(Qn,"zed"))},zencoder:{name:"zencoder",displayName:"Zencoder",skillsDir:".zencoder/skills",globalSkillsDir:join(b,".zencoder/skills"),detectInstalled:async()=>existsSync(join(b,".zencoder"))},zenflow:{name:"zenflow",displayName:"Zenflow",skillsDir:".zencoder/skills",globalSkillsDir:join(b,".zencoder/skills"),detectInstalled:async()=>existsSync(join(b,".zencoder"))},neovate:{name:"neovate",displayName:"Neovate",skillsDir:".neovate/skills",globalSkillsDir:join(b,".neovate/skills"),detectInstalled:async()=>existsSync(join(b,".neovate"))},pochi:{name:"pochi",displayName:"Pochi",skillsDir:".pochi/skills",globalSkillsDir:join(b,".pochi/skills"),detectInstalled:async()=>existsSync(join(b,".pochi"))},promptscript:{name:"promptscript",displayName:"PromptScript",skillsDir:".agents/skills",globalSkillsDir:void 0,showInUniversalPrompt:false,detectInstalled:async()=>existsSync(join(process.cwd(),".promptscript"))||existsSync(join(process.cwd(),"promptscript.yaml"))},adal:{name:"adal",displayName:"AdaL",skillsDir:".adal/skills",globalSkillsDir:join(b,".adal/skills"),detectInstalled:async()=>existsSync(join(b,".adal"))},universal:{name:"universal",displayName:"Universal",skillsDir:".agents/skills",globalSkillsDir:join(Te,"agents/skills"),showInUniversalList:false,detectInstalled:async()=>false}};async function Be(){return (await Promise.all(Object.entries(D).map(async([e,s])=>({type:e,installed:await s.detectInstalled()})))).filter(e=>e.installed).map(e=>e.type)}function Fc(t){return D[t]}var Os=join("agent","subagents");function lt(t=process.cwd()){let e=join(t,Os);if(!existsSync(e))return [];try{return readdirSync(e,{withFileTypes:!0}).filter(s=>s.isDirectory()).map(s=>s.name).sort()}catch{return []}}function Ye(){return Object.entries(D).filter(([t,e])=>e.skillsDir===".agents/skills"&&e.showInUniversalList!==false).map(([t])=>t)}function ss(){return Object.entries(D).filter(([t,e])=>e.skillsDir===".agents/skills"&&e.showInUniversalList!==false&&e.showInUniversalPrompt!==false).map(([t])=>t)}function Mt(){return Object.entries(D).filter(([t,e])=>e.skillsDir!==".agents/skills").map(([t])=>t)}function $e(t){return D[t].skillsDir===".agents/skills"}var el=".agents",tl="skills",Kc=".agents/skills";function he(t){return t.toLowerCase().replace(/[^a-z0-9._]+/g,"-").replace(/^[.-]+|[.-]+$/g,"").substring(0,255)||"unnamed-skill"}function ie(t,e){let s=normalize(resolve(t)),n=normalize(resolve(e));return n.startsWith(s+sep)||n===s}function nl(t,e){return ie(t,e)||ie(e,t)}async function ll(t,e){if(t.isDirectory())return true;if(!t.isSymbolicLink())return false;try{return (await stat(e)).isDirectory()}catch{return false}}function je(t,e){let s=t?Ue()||homedir():e||pt()||process.cwd();return join(s,el,tl)}function kt(t,e){let s=e||pt()||process.cwd();return join(s,Os,he(t),"skills")}function De(t,e,s,n){if($e(t))return je(e,s);if(t==="eve"&&n)return kt(n,s);let l=D[t],o=Ue()||homedir(),i=e?o:s||pt()||process.cwd();return e?l.globalSkillsDir===void 0?join(i,l.skillsDir):l.globalSkillsDir:join(i,l.skillsDir)}function bo(t,e){return resolve(dirname(t),e)}async function Se(t){try{await rm(t,{recursive:!0,force:!0});}catch{}await mkdir(t,{recursive:true});}async function Fs(t){let e=resolve(t),s=dirname(e),n=basename(e);try{let l=await realpath(s);return join(l,n)}catch{return e}}async function is(t,e){try{let s=resolve(t),n=resolve(e),[l,o]=await Promise.all([realpath(s).catch(()=>s),realpath(n).catch(()=>n)]);if(l===o)return !0;let i=await Fs(t),a=await Fs(e);if(i===a)return !0;try{if((await lstat(e)).isSymbolicLink()){let c=await readlink(e);if(bo(e,c)===s)return !0;await rm(e);}else await rm(e,{recursive:!0});}catch(p){if(p&&typeof p=="object"&&"code"in p&&p.code==="ELOOP")try{await rm(e,{force:!0});}catch{}}let r=dirname(e);await mkdir(r,{recursive:!0});let h=await Fs(r),u=relative(h,t),m=platform()==="win32"?"junction":void 0;return await symlink(m==="junction"?s:u,e,m),!0}catch{return false}}async function os(t,e,s={}){let n=D[e],l=s.global??false,o=s.cwd||process.cwd(),i=s.eveSubagent;if(l&&n.globalSkillsDir===void 0)return {success:false,path:"",mode:s.mode??"symlink",error:`${n.displayName} does not support global skill installation`};let a=t.name||basename(t.path),r=he(a),h=s.mode??"symlink",u=e==="eve"&&h==="symlink"?De(e,l,o,i):je(l,o),m=join(u,r),d=De(e,l,o,i),p=join(d,r);if(!ie(u,m))return {success:false,path:p,mode:h,error:"Invalid skill name: potential path traversal detected"};if(!ie(d,p))return {success:false,path:p,mode:h,error:"Invalid skill name: potential path traversal detected"};try{if(nl(t.path,p))return {success:!0,path:p,mode:h,skipped:!0};if(h==="copy")return await Se(p),await ns(t.path,p,e),{success:!0,path:p,mode:"copy"};if(nl(t.path,m))return {success:!0,path:m,canonicalPath:m,mode:"symlink",skipped:!0};if(await Se(m),await ns(t.path,m,e),l&&$e(e))return {success:!0,path:m,canonicalPath:m,mode:"symlink"};if(!l&&!$e(e)){let f=join(o,D[e].skillsDir.split("/")[0]);if(!existsSync(f))return {success:!0,path:m,canonicalPath:m,mode:"symlink",skipped:!0}}return await is(m,p)?{success:!0,path:p,canonicalPath:m,mode:"symlink"}:(await Se(p),await ns(t.path,p,e),{success:!0,path:p,canonicalPath:m,mode:"symlink",symlinkFailed:!0})}catch(c){return {success:false,path:p,mode:h,error:c instanceof Error?c.message:"Unknown error"}}}var wo=new Set(["metadata.json"]),$o=new Set([".git","__pycache__","__pypackages__"]),So=(t,e=false)=>!!(wo.has(t)||e&&$o.has(t));function Ze(t){let{data:e,content:s}=d(t),n={};if(typeof e.description=="string"&&(n.description=e.description),typeof e.license=="string"&&(n.license=e.license),e.metadata&&typeof e.metadata=="object"&&!Array.isArray(e.metadata)){let i=Object.fromEntries(Object.entries(e.metadata).filter(a=>typeof a[1]=="string"));Object.keys(i).length>0&&(n.metadata=i);}let l=Object.keys(n);return l.length===0?s.replace(/^\r?\n/u,""):`---
18
+ ${l.map(i=>`${i}: ${JSON.stringify(n[i])}`).join(`
19
+ `)}
20
+ ---
21
+ ${s.replace(/^\r?\n/u,"")}`}async function ns(t,e,s){await mkdir(e,{recursive:true});let n=await readdir(t,{withFileTypes:true});await Promise.all(n.filter(l=>!So(l.name,l.isDirectory())).map(async l=>{let o=join(t,l.name),i=join(e,l.name);if(l.isDirectory())await ns(o,i,s);else try{if(s==="eve"&&l.name.toLowerCase()==="skill.md"){await writeFile(i,Ze(await readFile(o,"utf-8")));return}await cp(o,i,{dereference:!0,recursive:!0});}catch(a){if(a instanceof Error&&"code"in a&&a.code==="ENOENT"&&l.isSymbolicLink())console.warn(`Skipping broken symlink: ${o}`);else throw a}}));}function vo(t){return t.some(e=>basename(e.path).toLowerCase()==="skill.md")}function ls(t){return `${he(t)}.md`}function xo(t){let e=t.find(n=>basename(n.path).toLowerCase()==="skill.md");if(e)return Ze(e.contents);let s=t.find(n=>extname(n.path).toLowerCase()===".md");return s?Ze(s.contents):""}async function rs(t,e,s={}){let n=D[e],l=he(t);if(s.global&&n.globalSkillsDir===void 0)return false;let o=s.global?n.globalSkillsDir:e==="eve"&&s.eveSubagent?kt(s.eveSubagent,s.cwd):join(s.cwd||process.cwd(),n.skillsDir),i=join(o,l);if(!ie(o,i))return false;try{return await access(i),!0}catch{return false}}function Hs(t,e,s={}){D[e];s.cwd||process.cwd();let o=he(t),i=De(e,s.global??false,s.cwd,s.eveSubagent),a=join(i,o);if(!ie(i,a))throw new Error("Invalid skill name: potential path traversal detected");return a}function Qe(t,e={}){let s=he(t),n=e.agent==="eve"?De("eve",e.global??false,e.cwd,e.eveSubagent):je(e.global??false,e.cwd),l=join(n,s);if(!ie(n,l))throw new Error("Invalid skill name: potential path traversal detected");return l}async function eu(t,e,s={}){let n=D[e],l=s.global??false,o=s.cwd||process.cwd(),i=s.mode??"symlink",a=s.eveSubagent;if(l&&n.globalSkillsDir===void 0)return {success:false,path:"",mode:i,error:`${n.displayName} does not support global skill installation`};let r=he(t.installName),h=e==="eve"&&i==="symlink"?De(e,l,o,a):je(l,o),u=join(h,r),m=De(e,l,o,a),d=join(m,r);if(!ie(h,u))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};if(!ie(m,d))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};try{if(i==="copy"){await Se(d);let x=e==="eve"?ls(t.installName):"SKILL.md",A=join(d,x);return await writeFile(A,e==="eve"?Ze(t.content):t.content,"utf-8"),{success:!0,path:d,mode:"copy"}}await Se(u);let p=e==="eve"?ls(t.installName):"SKILL.md",c=join(u,p);if(await writeFile(c,e==="eve"?Ze(t.content):t.content,"utf-8"),l&&$e(e))return {success:!0,path:u,canonicalPath:u,mode:"symlink"};if(!await is(u,d)){await Se(d);let x=e==="eve"?ls(t.installName):"SKILL.md",A=join(d,x);return await writeFile(A,e==="eve"?Ze(t.content):t.content,"utf-8"),{success:!0,path:d,canonicalPath:u,mode:"symlink",symlinkFailed:!0}}return {success:!0,path:d,canonicalPath:u,mode:"symlink"}}catch(p){return {success:false,path:d,mode:i,error:p instanceof Error?p.message:"Unknown error"}}}async function rl(t,e,s={}){let n=D[e],l=s.global??false,o=s.cwd||process.cwd(),i=s.mode??"symlink",a=s.eveSubagent;if(l&&n.globalSkillsDir===void 0)return {success:false,path:"",mode:i,error:`${n.displayName} does not support global skill installation`};let r=he(t.installName),h=e==="eve"&&i==="symlink"?De(e,l,o,a):je(l,o),u=join(h,r),m=De(e,l,o,a),d=join(m,r);if(!ie(h,u))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};if(!ie(m,d))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};async function p(c){for(let[f,x]of t.files){let A=join(c,f);if(!ie(c,A))continue;let S=dirname(A);S!==c&&await mkdir(S,{recursive:true}),await writeFile(A,e==="eve"&&basename(f).toLowerCase()==="skill.md"&&typeof x=="string"?Ze(x):x);}}try{return i==="copy"?(await Se(d),await p(d),{success:!0,path:d,mode:"copy"}):(await Se(u),await p(u),l&&$e(e)?{success:!0,path:u,canonicalPath:u,mode:"symlink"}:await is(u,d)?{success:!0,path:d,canonicalPath:u,mode:"symlink"}:(await Se(d),await p(d),{success:!0,path:d,canonicalPath:u,mode:"symlink",symlinkFailed:!0}))}catch(c){return {success:false,path:d,mode:i,error:c instanceof Error?c.message:"Unknown error"}}}async function Gs(t,e,s={}){let n=D[e],l=s.global??false,o=s.cwd||process.cwd(),i=s.mode??"symlink",a=s.eveSubagent;if(l&&n.globalSkillsDir===void 0)return {success:false,path:"",mode:i,error:`${n.displayName} does not support global skill installation`};let r=he(t.installName),h=De(e,l,o,a);if(e==="eve"&&!vo(t.files)){let c=join(h,ls(t.installName));if(!ie(h,c))return {success:false,path:c,mode:i,error:"Invalid skill name: potential path traversal detected"};try{return await mkdir(h,{recursive:!0}),await rm(c,{recursive:!0,force:!0}),await writeFile(c,xo(t.files),"utf-8"),{success:!0,path:c,mode:"copy"}}catch(f){return {success:false,path:c,mode:i,error:f instanceof Error?f.message:"Unknown error"}}}let u=e==="eve"&&i==="symlink"?De(e,l,o,a):je(l,o),m=join(u,r),d=join(h,r);if(!ie(u,m))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};if(!ie(h,d))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};async function p(c){for(let f of t.files){let x=join(c,f.path);if(!ie(c,x))continue;let A=dirname(x);A!==c&&await mkdir(A,{recursive:true}),await writeFile(x,e==="eve"&&basename(f.path).toLowerCase()==="skill.md"?Ze(f.contents):f.contents,"utf-8");}}try{if(i==="copy")return await Se(d),await p(d),{success:!0,path:d,mode:"copy"};if(await Se(m),await p(m),l&&$e(e))return {success:!0,path:m,canonicalPath:m,mode:"symlink"};if(!l&&!$e(e)){let f=join(o,D[e].skillsDir.split("/")[0]);if(!existsSync(f))return {success:!0,path:m,canonicalPath:m,mode:"symlink",skipped:!0}}return await is(m,d)?{success:!0,path:d,canonicalPath:m,mode:"symlink"}:(await Se(d),await p(d),{success:!0,path:d,canonicalPath:m,mode:"symlink",symlinkFailed:!0})}catch(c){return {success:false,path:d,mode:i,error:c instanceof Error?c.message:"Unknown error"}}}async function al(t={}){let e=t.cwd||process.cwd(),s=new Map,n=[],l=await Be(),o=t.agentFilter,i=o?l.filter(r=>o.includes(r)):l,a=[];t.global===void 0?a.push({global:false},{global:true}):a.push({global:t.global});for(let{global:r}of a){n.push({global:r,path:je(r,e)});for(let u of i){let m=D[u];if(r&&m.globalSkillsDir===void 0)continue;let d=r?m.globalSkillsDir:join(e,m.skillsDir);if(n.some(p=>p.path===d&&p.global===r)||n.push({global:r,path:d,agentType:u}),u==="eve"&&!r)for(let p of lt(e)){let c=kt(p,e);n.some(f=>f.path===c&&f.global===r)||n.push({global:r,path:c,agentType:u});}}let h=Object.keys(D);for(let u of h){if(i.includes(u))continue;let m=D[u];if(r&&m.globalSkillsDir===void 0)continue;let d=r?m.globalSkillsDir:join(e,m.skillsDir);n.some(p=>p.path===d&&p.global===r)||existsSync(d)&&n.push({global:r,path:d,agentType:u});}}for(let r of n)try{let h=await readdir(r.path,{withFileTypes:!0});for(let u of h){let m=join(r.path,u.name);if(!await ll(u,m))continue;let d=join(m,"SKILL.md");try{await stat(d);}catch{continue}let p=await Ge(d);if(!p)continue;let c=r.global?"global":"project",f=`${c}:${p.name}`;if(r.agentType){if(s.has(f)){let S=s.get(f);S.agents.includes(r.agentType)||S.agents.push(r.agentType);}else s.set(f,{name:p.name,description:p.description,path:m,canonicalPath:m,scope:c,agents:[r.agentType]});continue}let x=he(p.name),A=[];for(let S of i){let E=D[S];if(r.global&&E.globalSkillsDir===void 0)continue;let T=De(S,r.global,e),O=!1,C=Array.from(new Set([u.name,x,p.name.toLowerCase().replace(/\s+/g,"-").replace(/[/\\:\0]/g,"")]));for(let I of C){let w=join(T,I);if(ie(T,w))try{await access(w),O=!0;break}catch{}}if(!O)try{let I=await readdir(T,{withFileTypes:!0});for(let w of I){let N=join(T,w.name);if(await ll(w,N)&&ie(T,N))try{let U=join(N,"SKILL.md");await stat(U);let M=await Ge(U);if(M&&M.name===p.name){O=!0;break}}catch{}}}catch{}O&&A.push(S);}if(s.has(f)){let S=s.get(f);for(let E of A)S.agents.includes(E)||S.agents.push(E);}else s.set(f,{name:p.name,description:p.description,path:m,canonicalPath:m,scope:c,agents:A});}}catch{}return Array.from(s.values())}var Ao="https://add-skill.vercel.sh/t",Io="https://add-skill.vercel.sh/audit",Bs=null,Vs=null;function cl(t){Vs=t;}function Lo(){return !!(process.env.CI||process.env.GITHUB_ACTIONS||process.env.GITLAB_CI||process.env.CIRCLECI||process.env.TRAVIS||process.env.BUILDKITE||process.env.JENKINS_URL||process.env.TEAMCITY_VERSION)}function Po(){return !process.env.DISABLE_TELEMETRY&&!process.env.DO_NOT_TRACK}function Js(t){Bs=t;}async function ul(t,e,s=3e3){if(e.length===0)return null;try{let n=new URLSearchParams({source:t,skills:e.join(",")}),l=new AbortController,o=setTimeout(()=>l.abort(),s),i=await fetch(`${Io}?${n.toString()}`,{signal:l.signal});return clearTimeout(o),i.ok?await i.json():null}catch{return null}}var qs=[];function be(t){if(Po())try{let e=new URLSearchParams;Bs&&e.set("v",Bs),Lo()&&e.set("ci","1"),Vs&&e.set("agent",Vs);for(let[n,l]of Object.entries(t))l!=null&&e.set(n,String(l));let s=fetch(`${Ao}?${e.toString()}`).catch(()=>{}).then(()=>{});qs.push(s);}catch{}}async function nu(t=5e3){if(qs.length===0)return;let e=new Promise(s=>setTimeout(s,t));await Promise.race([Promise.all(qs),e]);}var yt=null,Do={cursor:"cursor","cursor-cli":"cursor",claude:"claude-code",cowork:"claude-code",devin:"universal",replit:"replit",gemini:"gemini-cli",codex:"codex",antigravity:"antigravity","augment-cli":"augment",opencode:"opencode","github-copilot":"github-copilot"};async function et(){return yt||(yt=await determineAgent(),yt.isAgent&&cl(yt.agent.name),yt)}async function as(){return (await et()).isAgent}async function au(){let t=await et();return t.isAgent?t.agent.name:null}function cs(t){return Do[t]??null}var Xs=class{constructor(){a(this,"providers",[]);}register(e){if(this.providers.some(s=>s.id===e.id))throw new Error(`Provider with id "${e.id}" already registered`);this.providers.push(e);}findProvider(e){for(let s of this.providers)if(s.match(e).matches)return s;return null}getProviders(){return [...this.providers]}},us=new Xs;function No(t){us.register(t);}function Eo(t){return us.findProvider(t)}function Co(){return us.getProviders()}var dl="https://schemas.agentskills.io/discovery/0.2.0/schema.json",jo=50*1024*1024,Oo=1e3,ds=class{constructor(){a(this,"id","well-known");a(this,"displayName","Well-Known Skills");a(this,"WELL_KNOWN_PATHS",[".well-known/agent-skills",".well-known/skills"]);a(this,"INDEX_FILE","index.json");}match(e){if(!e.startsWith("http://")&&!e.startsWith("https://"))return {matches:false};try{let s=new URL(e);return ["github.com","gitlab.com","huggingface.co"].includes(s.hostname)?{matches:!1}:{matches:!0,sourceIdentifier:`wellknown/${s.hostname}`}}catch{return {matches:false}}}async fetchIndex(e){return (await this.fetchIndexCandidates(e))[0]??null}async fetchIndexCandidates(e){try{let s=new URL(e),n=s.pathname.replace(/\/$/,""),l=[];for(let i of this.WELL_KNOWN_PATHS)l.push({indexUrl:`${s.protocol}//${s.host}${n}/${i}/${this.INDEX_FILE}`,baseUrl:`${s.protocol}//${s.host}${n}`,wellKnownPath:i}),n&&n!==""&&l.push({indexUrl:`${s.protocol}//${s.host}/${i}/${this.INDEX_FILE}`,baseUrl:`${s.protocol}//${s.host}`,wellKnownPath:i});let o=[];for(let{indexUrl:i,baseUrl:a,wellKnownPath:r}of l)try{let h=await fetch(i);if(!h.ok)continue;let u=await h.json(),m=this.normalizeIndex(u,i,r);if(!m)continue;o.push({index:m.index,entries:m.entries,resolvedBaseUrl:a,resolvedWellKnownPath:r,indexUrl:i});}catch{}return o}catch{return []}}normalizeIndex(e,s,n){if(!e||typeof e!="object")return null;let l=e;if(!Array.isArray(l.skills))return null;let o=l.$schema;if(o===dl){let r=[],h=[];for(let u of l.skills){if(!this.isValidSkillEntryV2(u))continue;let m=new URL(u.url,s).toString();r.push({version:"0.2.0",name:u.name,description:u.description,type:u.type,artifactUrl:m,digest:u.digest,indexEntry:u}),h.push(u);}return r.length===0?null:{index:{$schema:dl,skills:h},entries:r}}if(o!==void 0)return null;let i=[],a=[];for(let r of l.skills){if(!this.isValidSkillEntryV1(r))return null;i.push(r),a.push({version:"0.1.0",name:r.name,description:r.description,files:r.files,baseUrl:this.getLegacySkillBaseUrl(s,n),wellKnownPath:n,indexEntry:r});}return {index:{skills:i},entries:a}}getLegacySkillBaseUrl(e,s){let n=new URL(e),l=`/${s}/${this.INDEX_FILE}`;return `${n.protocol}//${n.host}${n.pathname.slice(0,-l.length)}`}isValidSkillName(e){return !(typeof e!="string"||e.length===0||e.length>64||!/^[a-z0-9-]+$/.test(e)||e.startsWith("-")||e.endsWith("-")||e.includes("--"))}isSafeLegacyFilePath(e){return !(typeof e!="string"||e.length===0||e.startsWith("/")||e.startsWith("\\")||e.includes("..")||e.includes("\0"))}isValidSkillEntryV1(e){if(!e||typeof e!="object")return false;let s=e;if(!this.isValidSkillName(s.name)||typeof s.description!="string"||!s.description||!Array.isArray(s.files)||s.files.length===0)return false;for(let l of s.files)if(!this.isSafeLegacyFilePath(l))return false;return s.files.some(l=>typeof l=="string"&&l.toLowerCase()==="skill.md")}isValidSkillEntryV2(e){if(!e||typeof e!="object")return false;let s=e;if(!this.isValidSkillName(s.name)||typeof s.description!="string"||!s.description||s.description.length>1024||s.type!=="skill-md"&&s.type!=="archive"||typeof s.url!="string"||!s.url||typeof s.digest!="string"||!/^sha256:[a-f0-9]{64}$/.test(s.digest))return false;try{new URL(s.url,"https://example.com/.well-known/agent-skills/index.json");}catch{return false}return true}async fetchSkill(e){try{let s=new URL(e),n=await this.fetchIndexCandidates(e);for(let l of n){let{entries:o}=l,i=null,a=s.pathname.match(/\/.well-known\/(?:agent-skills|skills)\/([^/]+)\/?$/);if(a?.[1]&&a[1]!=="index.json"?i=a[1]:o.length===1&&(i=o[0].name),!i)continue;let r=o.find(u=>u.name===i);if(!r)continue;let h=await this.fetchSkillByEntry(r);if(h)return h}return null}catch{return null}}async fetchSkillByEntry(e,s,n){return typeof e=="string"?s?this.fetchLegacySkillByEntry({version:"0.1.0",name:s.name,description:s.description,files:s.files,baseUrl:e,wellKnownPath:n??this.WELL_KNOWN_PATHS[0],indexEntry:s}):null:e.version==="0.1.0"?this.fetchLegacySkillByEntry(e):this.fetchArtifactSkillByEntry(e)}async fetchLegacySkillByEntry(e){try{let s=`${e.baseUrl.replace(/\/$/,"")}/${e.wellKnownPath}/${e.name}`,n=`${s}/SKILL.md`,l=await fetch(n);if(!l.ok)return null;let o=await l.text(),{data:i}=d(o);if(typeof i.name!="string"||typeof i.description!="string")return null;let a=new Map;a.set("SKILL.md",o);let h=e.files.filter(m=>m.toLowerCase()!=="skill.md").map(async m=>{try{let d=`${s}/${m}`,p=await fetch(d);if(p.ok){let c=await p.arrayBuffer();return {path:m,content:new Uint8Array(c)}}}catch{}return null}),u=await Promise.all(h);for(let m of u)m&&a.set(m.path,m.content);return this.createSkill({name:i.name,description:i.description,content:o,installName:e.name,sourceUrl:n,metadata:i.metadata,files:a,indexEntry:e.indexEntry})}catch{return null}}async fetchArtifactSkillByEntry(e){try{let s=await fetch(e.artifactUrl);if(!s.ok)return null;let n=s.headers.get("content-type")??"",l=new Uint8Array(await s.arrayBuffer());if(this.computeDigest(l)!==e.digest)return null;if(e.type==="skill-md"){let h=new TextDecoder().decode(l),{data:u}=d(h);if(typeof u.name!="string"||typeof u.description!="string")return null;let m=new Map;return m.set("SKILL.md",h),this.createSkill({name:u.name,description:u.description,content:h,installName:e.name,sourceUrl:e.artifactUrl,metadata:u.metadata,files:m,indexEntry:e.indexEntry})}let o=this.extractArchive(l,e.artifactUrl,n),i=o.get("SKILL.md");if(!i)return null;let a=typeof i=="string"?i:new TextDecoder().decode(i);o.set("SKILL.md",a);let{data:r}=d(a);return typeof r.name!="string"||typeof r.description!="string"?null:this.createSkill({name:r.name,description:r.description,content:a,installName:e.name,sourceUrl:e.artifactUrl,metadata:r.metadata,files:o,indexEntry:e.indexEntry})}catch{return null}}createSkill(e){return {name:c(e.name),description:c(e.description),content:e.content,installName:e.installName,sourceUrl:e.sourceUrl,metadata:e.metadata&&typeof e.metadata=="object"?e.metadata:void 0,files:e.files,indexEntry:e.indexEntry}}async fetchAllSkills(e){try{let s=await this.fetchIndexCandidates(e);for(let n of s){let l=n.entries.map(a=>this.fetchSkillByEntry(a)),i=(await Promise.all(l)).filter(a=>a!==null);if(i.length>0)return i}return []}catch{return []}}computeDigest(e){return `sha256:${createHash("sha256").update(e).digest("hex")}`}extractArchive(e,s,n){if(this.isZipArchive(e,s,n))return this.extractZip(e);if(this.isTarGzArchive(e,s,n))return this.extractTarGz(e);throw new Error("Unsupported archive format")}isZipArchive(e,s,n){return n.includes("application/zip")||s.toLowerCase().endsWith(".zip")||e[0]===80&&e[1]===75}isTarGzArchive(e,s,n){let l=s.toLowerCase();return n.includes("application/gzip")||n.includes("application/x-gzip")||l.endsWith(".tar.gz")||l.endsWith(".tgz")||e[0]===31&&e[1]===139}normalizeArchivePath(e){if(!e||e.includes("\0")||e.startsWith("/")||e.startsWith("\\")||/^[A-Za-z]:/.test(e)||e.includes("\\"))return null;let s=e.split("/").filter(Boolean);return s.length===0||s.some(n=>n==="."||n==="..")?null:s.join("/")}addArchiveFile(e,s,n,l){let o=this.normalizeArchivePath(s);if(!o)throw new Error(`Unsafe archive path: ${s}`);if(l.bytes+=n.byteLength,l.bytes>jo)throw new Error("Archive exceeds maximum unpacked size");if(e.size>=Oo)throw new Error("Archive contains too many files");e.set(o,n);}extractTarGz(e){let s=gunzipSync(Buffer.from(e)),n=new Map,l={bytes:0},o=0;for(;o+512<=s.length;){let i=s.subarray(o,o+512);if(i.every(c=>c===0))break;let a=this.readTarString(i,0,100),r=this.readTarString(i,124,12).trim(),h=i[156],u=this.readTarString(i,345,155),m=u?`${u}/${a}`:a,d=Number.parseInt(r||"0",8);if(!Number.isFinite(d)||d<0)throw new Error("Invalid tar entry size");if(o+=512,h===50||h===49)throw new Error("Archive links are not supported");if(h===0||h===48){let c=s.subarray(o,o+d);this.addArchiveFile(n,m,new Uint8Array(c),l);}o+=Math.ceil(d/512)*512;}if(!n.has("SKILL.md"))throw new Error("Archive missing root SKILL.md");return n}readTarString(e,s,n){let l=e.subarray(s,s+n),o=l.indexOf(0);return new TextDecoder().decode(o>=0?l.subarray(0,o):l)}extractZip(e){let s=Buffer.from(e),n=this.findZipEndOfCentralDirectory(s);if(n<0)throw new Error("Invalid zip archive");let l=s.readUInt16LE(n+10),o=s.readUInt32LE(n+16),i=new Map,a={bytes:0},r=o;for(let h=0;h<l;h++){if(s.readUInt32LE(r)!==33639248)throw new Error("Invalid zip directory");let u=s.readUInt16LE(r+8),m=s.readUInt16LE(r+10),d=s.readUInt32LE(r+20),p=s.readUInt32LE(r+24),c=s.readUInt16LE(r+28),f=s.readUInt16LE(r+30),x=s.readUInt16LE(r+32),A=s.readUInt32LE(r+38),S=s.readUInt32LE(r+42),E=r+46,T=s.subarray(E,E+c),O=new TextDecoder(u&2048?"utf-8":void 0).decode(T);if(r=E+c+f+x,O.endsWith("/"))continue;if(u&1)throw new Error("Encrypted zip entries are not supported");let I=A>>>16&61440;if(I===40960||I===4096)throw new Error("Archive links are not supported");if(s.readUInt32LE(S)!==67324752)throw new Error("Invalid zip local header");let w=s.readUInt16LE(S+26),N=s.readUInt16LE(S+28),U=S+30+w+N,M=s.subarray(U,U+d),G;if(m===0)G=M;else if(m===8)G=inflateRawSync(M);else throw new Error(`Unsupported zip compression method: ${m}`);if(G.byteLength!==p)throw new Error("Zip entry size mismatch");this.addArchiveFile(i,O,new Uint8Array(G),a);}if(!i.has("SKILL.md"))throw new Error("Archive missing root SKILL.md");return i}findZipEndOfCentralDirectory(e){let s=Math.max(0,e.length-65535-22);for(let n=e.length-22;n>=s;n--)if(e.readUInt32LE(n)===101010256)return n;return -1}toRawUrl(e){try{let s=new URL(e);if(e.toLowerCase().endsWith("/skill.md"))return e;let n=this.WELL_KNOWN_PATHS[0],l=s.pathname.match(/\/.well-known\/(?:agent-skills|skills)\/([^/]+)\/?$/);if(l?.[1]){let i=s.pathname.replace(/\/.well-known\/(?:agent-skills|skills)\/.*$/,"");return `${s.protocol}//${s.host}${i}/${n}/${l[1]}/SKILL.md`}let o=s.pathname.replace(/\/$/,"");return `${s.protocol}//${s.host}${o}/${n}/${this.INDEX_FILE}`}catch{return e}}getSourceIdentifier(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return "unknown"}}async hasSkillsIndex(e){return await this.fetchIndex(e)!==null}},bt=new ds;var Bo=".agents",Zs=".skill-lock.json",gl=3;function pl(){let t=Ft(),e=Ue(),s=process.env.XDG_STATE_HOME;return s?join(s,"skills",Zs):t?join(t,"skills",Zs):join(e||homedir(),Bo,Zs)}async function Ne(){let t=pl();try{let e=await readFile(t,"utf-8"),s=JSON.parse(e);return typeof s.version!="number"||!s.skills||s.version<gl?Qs():s}catch{return Qs()}}async function gs(t){let e=pl();await mkdir(dirname(e),{recursive:true});let s=JSON.stringify(t,null,2);await writeFile(e,s,"utf-8");}function Pu(t){return createHash("sha256").update(t,"utf-8").digest("hex")}var en=false;function Tu(){en=false;}function rt(){if(process.env.GITHUB_TOKEN)return process.env.GITHUB_TOKEN;if(process.env.GH_TOKEN)return process.env.GH_TOKEN;en||(process.stderr.write(`${k.yellow("\u2502")} ${k.yellow("GitHub rate limit reached")} \u2014 using your ${k.cyan("gh")} login to continue.
22
+ ${k.yellow("\u2502")} ${k.dim(`Tip: set ${k.cyan("GITHUB_TOKEN")} to avoid this prompt, or use ${k.cyan("--full-depth")} to clone instead.
23
+ `)}`),en=true);try{let t=execSync("gh auth token",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();if(t)return t}catch{}return null}async function Du(t,e,s,n){let{fetchRepoTree:l,getSkillFolderHashFromTree:o}=await import('./blob-3ZTTX2CZ.mjs'),i=await l(t,n,s??void 0);return i?o(i,e):null}async function tn(t,e){let s=await Ne(),n=new Date().toISOString(),l=s.skills[t];s.skills[t]={...e,installedAt:l?.installedAt??n,updatedAt:n},await gs(s);}async function ml(t){let e=await Ne();return t in e.skills?(delete e.skills[t],await gs(e),true):false}async function fl(t){return (await Ne()).skills[t]??null}async function hl(){return (await Ne()).skills}async function Nu(){let t=await Ne(),e=new Map;for(let[s,n]of Object.entries(t.skills)){let l=e.get(n.source);l?l.skills.push(s):e.set(n.source,{skills:[s],entry:n});}return e}function Qs(){return {version:gl,skills:{},dismissed:{}}}async function kl(t){return (await Ne()).dismissed?.[t]===true}async function zt(t){let e=await Ne();e.dismissed||(e.dismissed={}),e.dismissed[t]=true,await gs(e);}async function sn(){return (await Ne()).lastSelectedAgents}async function nn(t){let e=await Ne();e.lastSelectedAgents=t,await gs(e);}var Jo=new Writable({write(t,e,s){s();}}),Xo=k.green("\u25C6"),Yo=k.red("\u25A0"),Zo=k.green("\u25C7"),Qo=k.green("\u25CF"),er=k.dim("\u25CB");k.green("\u2713");var tr=k.green("\u2022"),ue=k.dim("\u2502"),wt=k.dim("\u2500"),sr=Symbol("cancel");function nr(t){let e=0;for(let s of t){let n=s.codePointAt(0);if(n===0)continue;let l=n>=4352&&n<=4447||n>=8986&&n<=8987||n>=9001&&n<=9002||n>=9193&&n<=9196||n===9200||n===9203||n>=9725&&n<=9726||n>=9748&&n<=9749||n>=9800&&n<=9811||n>=9855&&n<=9855||n>=9875&&n<=9875||n>=9889&&n<=9889||n>=9898&&n<=9899||n>=9917&&n<=9918||n>=9924&&n<=9925||n>=9934&&n<=9934||n>=9940&&n<=9940||n>=9962&&n<=9962||n>=9970&&n<=9971||n>=9973&&n<=9973||n>=9978&&n<=9978||n>=9981&&n<=9981||n>=9989&&n<=9989||n>=9994&&n<=9995||n>=10024&&n<=10024||n>=10060&&n<=10060||n>=10062&&n<=10062||n>=10067&&n<=10069||n>=10071&&n<=10071||n>=10133&&n<=10135||n>=10160&&n<=10160||n>=10175&&n<=10175||n>=11035&&n<=11036||n>=11088&&n<=11088||n>=11093&&n<=11093||n>=11904&&n<=42191&&n!==12351||n>=43360&&n<=43388||n>=44032&&n<=55203||n>=63744&&n<=64255||n>=65040&&n<=65049||n>=65072&&n<=65135||n>=65280&&n<=65376||n>=65504&&n<=65510||n>=126976&&n<=129535;e+=l?2:1;}return e}function lr(t,e){let s=stripVTControlCharacters(t),n=Math.max(1,e),l=nr(s);return Math.max(1,Math.ceil(l/n))}function ir(t,e){let s=e!==void 0&&e>0?e:process.stdout.columns&&process.stdout.columns>0?process.stdout.columns:80;return t.reduce((n,l)=>n+lr(l,s),0)}async function $t(t){let{message:e,items:s,maxVisible:n=8,initialSelected:l=[],required:o=false,lockedSection:i}=t;return new Promise(a=>{let r=ps.createInterface({input:process.stdin,output:Jo,terminal:false});process.stdin.isTTY&&process.stdin.setRawMode(true),ps.emitKeypressEvents(process.stdin,r);let h="",u=0,m=new Set(l),d=0,p=i?i.items.map(C=>C.value):[],c=(C,I)=>{if(!I)return true;let w=I.toLowerCase();return C.label.toLowerCase().includes(w)||String(C.value).toLowerCase().includes(w)},f=()=>s.filter(C=>c(C,h)),x=()=>{if(d>0){process.stdout.write(`\x1B[${d}A`);for(let C=0;C<d;C++)process.stdout.write("\x1B[2K\x1B[1B");process.stdout.write(`\x1B[${d}A`);}},A=(C="active")=>{x();let I=[],w=f(),N=C==="active"?Xo:C==="cancel"?Yo:Zo;if(I.push(`${N} ${k.bold(e)}`),C==="active"){if(i&&i.items.length>0){I.push(`${ue}`);let te=`${k.bold(i.title)} ${k.dim("\u2500\u2500 always included")}`;I.push(`${ue} ${wt}${wt} ${te} ${wt.repeat(12)}`);for(let we of i.items)I.push(`${ue} ${tr} ${k.bold(we.label)}`);i.hiddenCount&&i.hiddenCount>0&&I.push(`${ue} ${k.dim(`...and ${i.hiddenCount} more`)}`),I.push(`${ue}`),I.push(`${ue} ${wt}${wt} ${k.bold("Additional agents")} ${wt.repeat(29)}`);}let U=`${ue} ${k.dim("Search:")} ${h}${k.inverse(" ")}`;I.push(U),I.push(`${ue} ${k.dim("\u2191\u2193 move, space select, enter confirm")}`),I.push(`${ue}`);let M=Math.max(0,Math.min(u-Math.floor(n/2),w.length-n)),G=Math.min(w.length,M+n),ge=w.slice(M,G);if(w.length===0)I.push(`${ue} ${k.dim("No matches found")}`);else {for(let pe=0;pe<ge.length;pe++){let Ae=ge[pe],Me=M+pe,Tt=m.has(Ae.value),Ee=Me===u,Ce=Tt?Qo:er,Vt=Ee?k.underline(Ae.label):Ae.label,$=Ae.hint?k.dim(` (${Ae.hint})`):"",_=Ee?k.cyan("\u276F"):" ";I.push(`${ue} ${_} ${Ce} ${Vt}${$}`);}let te=M,we=w.length-G;if(te>0||we>0){let pe=[];te>0&&pe.push(`\u2191 ${te} more`),we>0&&pe.push(`\u2193 ${we} more`),I.push(`${ue} ${k.dim(pe.join(" "))}`);}}I.push(`${ue}`);let se=[...i?i.items.map(te=>te.label):[],...s.filter(te=>m.has(te.value)).map(te=>te.label)];if(se.length===0)I.push(`${ue} ${k.dim("Selected: (none)")}`);else {let te=se.length<=3?se.join(", "):`${se.slice(0,3).join(", ")} +${se.length-3} more`;I.push(`${ue} ${k.green("Selected:")} ${te}`);}I.push(`${k.dim("\u2514")}`);}else if(C==="submit"){let U=[...i?i.items.map(M=>M.label):[],...s.filter(M=>m.has(M.value)).map(M=>M.label)];I.push(`${ue} ${k.dim(U.join(", "))}`);}else C==="cancel"&&I.push(`${ue} ${k.strikethrough(k.dim("Cancelled"))}`);process.stdout.write(I.join(`
24
+ `)+`
25
+ `),d=ir(I,process.stdout.columns);},S=()=>{process.stdin.removeListener("keypress",O),process.stdin.isTTY&&process.stdin.setRawMode(false),r.close();},E=()=>{o&&m.size===0&&p.length===0||(A("submit"),S(),a([...p,...Array.from(m)]));},T=()=>{A("cancel"),S(),a(sr);},O=(C,I)=>{if(!I)return;let w=f();if(I.name==="return"){E();return}if(I.name==="escape"||I.ctrl&&I.name==="c"){T();return}if(I.name==="up"){u=Math.max(0,u-1),A();return}if(I.name==="down"){u=Math.min(w.length-1,u+1),A();return}if(I.name==="space"){let N=w[u];N&&(m.has(N.value)?m.delete(N.value):m.add(N.value)),A();return}if(I.name==="backspace"){h=h.slice(0,-1),u=0,A();return}if(I.sequence&&!I.ctrl&&!I.meta&&I.sequence.length===1){h+=I.sequence,u=0,A();return}};process.stdin.on("keypress",O),A();})}var yl={version:"0.3.7"};var $l=t=>typeof t=="symbol",Sl="eve agent";async function gr(t){let e=Xt(t);return e?Et(e.owner,e.repo):false}function pr(t,e){return t.startsWith("git@")||t.startsWith("ssh://")?t:e}function vl(t){Js(t);}function bl(t){switch(t){case "critical":return k.red(k.bold("Critical Risk"));case "high":return k.red("High Risk");case "medium":return k.yellow("Med Risk");case "low":return k.green("Low Risk");case "safe":return k.green("Safe");default:return k.dim("--")}}function mr(t){if(!t)return k.dim("--");let e=t.alerts??0;return e>0?k.red(`${e} alert${e!==1?"s":""}`):k.green("0 alerts")}function St(t,e){let s=b$1(t),n=Math.max(0,e-s.length);return t+" ".repeat(n)}function fr(t,e,s){if(!t)return [];if(!e.some(a=>{let r=t[a.slug];return r&&Object.keys(r).length>0}))return [];let l=Math.min(Math.max(...e.map(a=>a.displayName.length)),36),o=[],i=St("",l+2)+St(k.dim("Gen"),18)+St(k.dim("Socket"),18)+k.dim("Snyk");o.push(i);for(let a of e){let r=t[a.slug],h=a.displayName.length>l?a.displayName.slice(0,l-1)+"\u2026":a.displayName,u=r?.ath?bl(r.ath.risk):k.dim("--"),m=r?.socket?mr(r.socket):k.dim("--"),d=r?.snyk?bl(r.snyk.risk):k.dim("--");o.push(St(k.cyan(h),l+2)+St(u,18)+St(m,18)+d);}return o.push(""),o.push(`${k.dim("Details:")} ${k.dim(`https://skills.sh/${s}`)}`),o}function vt(t,e){let s=homedir();return t===s||t.startsWith(s+sep)?"~"+t.slice(s.length):t===e||t.startsWith(e+sep)?"."+t.slice(e.length):t}function hr(t){let e=createHash("sha256");return e.update("SKILL.md"),e.update(t),e.digest("hex")}function me(t,e=5){if(t.length<=e)return t.join(", ");let s=t.slice(0,e),n=t.length-e;return `${s.join(", ")} +${n} more`}function kr(t){let e=t.map(n=>k.cyan(le(n))),s=me(e,3);return b$1(s).length<=80?s:`${t.length} selected skills`}function yr(t){return `Detected an eve project. Install ${kr(t)} for your ${Sl} to use?`}function rn(t){let e=[],s=[];for(let n of t)$e(n)?e.push(D[n].displayName):s.push(D[n].displayName);return {universal:e,symlinked:s}}function br(t,e){let s=[],{universal:n,symlinked:l}=rn(t);if(e==="symlink")n.length>0&&s.push(` ${k.green("universal:")} ${me(n)}`),l.length>0&&s.push(` ${k.dim("symlink \u2192")} ${me(l)}`);else {let o=t.map(i=>D[i].displayName);s.push(` ${k.dim("copy \u2192")} ${me(o)}`);}return s}function fs(t){let e=D[t.agent].displayName;return t.subagent?`${e} (${t.subagent})`:e}function wl(t){return t.subagent?`${t.agent}:${t.subagent}`:t.agent}function wr(t,e){let s=[];for(let n of t)if(n==="eve")for(let l of e)s.push({agent:n,subagent:l});else s.push({agent:n});return s}function $r(t,e){let s=[],n=t.filter(a=>!a.subagent).map(a=>a.agent),l=t.filter(a=>a.subagent).map(fs),{universal:o,symlinked:i}=rn(n);if(e==="symlink")o.length>0&&s.push(` ${k.green("universal:")} ${me(o)}`),i.length>0&&s.push(` ${k.dim("symlink \u2192")} ${me(i)}`),l.length>0&&s.push(` ${k.dim("copy \u2192")} ${me(l)}`);else {let a=t.map(fs);s.push(` ${k.dim("copy \u2192")} ${me(a)}`);}return s}function ln(t){let e=Ye(),s=[...t];for(let n of e)s.includes(n)||s.push(n);return s}function xl(t,e){let s=[],{universal:n}=rn(e),o=t.filter(a=>!a.symlinkFailed&&!a.skipped&&!n.includes(a.agent)).map(a=>a.agent),i=t.filter(a=>a.symlinkFailed&&!a.skipped).map(a=>a.agent);return n.length>0&&s.push(` ${k.green("universal:")} ${me(n)}`),o.length>0&&s.push(` ${k.dim("symlinked:")} ${me(o)}`),i.length>0&&s.push(` ${k.yellow("copied:")} ${me(i)}`),s}function Al(t){return y.multiselect({...t,options:t.options,message:`${t.message} ${k.dim("(space to toggle)")}`})}async function Il(t,e){let s;try{s=await sn();}catch{}let n=e.map(r=>r.value),o=["claude-code","opencode","codex"].filter(r=>n.includes(r)),i=[];s&&s.length>0&&(i=s.filter(r=>n.includes(r))),i.length===0&&(i=o);let a=await $t({message:t,items:e,initialSelected:i,required:true});if(!$l(a))try{await nn(a);}catch{}return a}async function on(t){let e=u=>!t.global||D[u].globalSkillsDir,s=Ye().filter(e),n=ss().filter(e),l=Mt().filter(u=>u!=="eve"&&e(u)),o={title:"Universal (.agents/skills)",items:n.map(u=>({value:u,label:D[u].displayName})),hiddenCount:s.length-n.length},i=l.map(u=>({value:u,label:D[u].displayName,hint:t.global?D[u].globalSkillsDir:D[u].skillsDir})),a;try{a=await sn();}catch{}let r=a?a.filter(u=>l.includes(u)&&!s.includes(u)):[],h=await $t({message:"Which agents do you want to install to?",items:i,initialSelected:r,lockedSection:o});if(!$l(h))try{await nn(h);}catch{}return h}var Sr=yl.version;Js(Sr);async function vr(t,e,s,n){n.start("Discovering skills from well-known endpoint...");let l=await bt.fetchAllSkills(e);l.length===0&&(n.stop(k.red("No skills found")),y.outro(k.red("No skills found at this URL. Make sure the server has a /.well-known/agent-skills/index.json or /.well-known/skills/index.json file.")),process.exit(1)),n.stop(`Found ${k.green(l.length)} skill${l.length>1?"s":""}`);for(let w of l)y.log.info(`Skill: ${k.cyan(w.installName)}`),y.log.message(k.dim(w.description)),w.files.size>1&&y.log.message(k.dim(` Files: ${Array.from(w.files.keys()).join(", ")}`));if(s.list){console.log(),y.log.step(k.bold("Available Skills"));for(let w of l)y.log.message(` ${k.cyan(w.installName)}`),y.log.message(` ${k.dim(w.description)}`),w.files.size>1&&y.log.message(` ${k.dim(`Files: ${w.files.size}`)}`);console.log(),y.outro("Run without --list to install"),process.exit(0);}let o;if(s.skill?.includes("*"))o=l,y.log.info(`Installing all ${l.length} skills`);else if(s.skill&&s.skill.length>0){if(o=l.filter(w=>s.skill.some(N=>w.installName.toLowerCase()===N.toLowerCase()||w.name.toLowerCase()===N.toLowerCase())),o.length===0){y.log.error(`No matching skills found for: ${s.skill.join(", ")}`),y.log.info("Available skills:");for(let w of l)y.log.message(` - ${w.installName}`);process.exit(1);}}else if(l.length===1){o=l;let w=l[0];y.log.info(`Skill: ${k.cyan(w.installName)}`);}else if(s.yes)o=l,y.log.info(`Installing all ${l.length} skills`);else {let w=l.map(U=>({value:U,label:U.installName,hint:U.description.length>60?U.description.slice(0,57)+"...":U.description})),N=await Al({message:"Select skills to install",options:w,required:true});y.isCancel(N)&&(y.cancel("Installation cancelled"),process.exit(0)),o=N;}let i,a=Object.keys(D);if(s.agent?.includes("*"))i=a,y.log.info(`Installing to all ${i.length} agents`);else if(s.agent&&s.agent.length>0){let w=s.agent.filter(N=>!a.includes(N));w.length>0&&(y.log.error(`Invalid agents: ${w.join(", ")}`),y.log.info(`Valid agents: ${a.join(", ")}`),process.exit(1)),i=s.agent;}else {n.start("Loading agents...");let w=await Be(),N=Object.keys(D).length;if(n.stop(`${N} agents`),w.length===0)if(s.yes)i=a,y.log.info("Installing to all agents");else {y.log.info("Select agents to install skills to");let U=Object.entries(D).map(([G,ge])=>({value:G,label:ge.displayName})),M=await Il("Which agents do you want to install to?",U);y.isCancel(M)&&(y.cancel("Installation cancelled"),process.exit(0)),i=M;}else if(w.length===1||s.yes)if(i=ln(w),w.length===1){let U=w[0];y.log.info(`Installing to: ${k.cyan(D[U].displayName)}`);}else y.log.info(`Installing to: ${w.map(U=>k.cyan(D[U].displayName)).join(", ")}`);else {let U=await on({global:s.global});y.isCancel(U)&&(y.cancel("Installation cancelled"),process.exit(0)),i=U;}}let r=s.global??false,h=i.some(w=>D[w].globalSkillsDir!==void 0);if(s.global===void 0&&!s.yes&&h){let w=await y.select({message:"Installation scope",options:[{value:false,label:"Project",hint:"Install in current directory (committed with your project)"},{value:true,label:"Global",hint:"Install in home directory (available across all projects)"}]});y.isCancel(w)&&(y.cancel("Installation cancelled"),process.exit(0)),r=w;}let u=s.copy?"copy":"symlink",m=new Set(i.map(w=>D[w].skillsDir));if(!s.copy&&!s.yes&&m.size>1){let w=await y.select({message:"Installation method",options:[{value:"symlink",label:"Symlink (Recommended)",hint:"Single source of truth, easy updates"},{value:"copy",label:"Copy to all agents",hint:"Independent copies for each agent"}]});y.isCancel(w)&&(y.cancel("Installation cancelled"),process.exit(0)),u=w;}else m.size<=1&&(u="copy");let d=process.cwd(),p=[];i.map(w=>D[w].displayName);let f=await Promise.all(o.flatMap(w=>i.map(async N=>({skillName:w.installName,agent:N,installed:await rs(w.installName,N,{global:r})})))),x=new Map;for(let{skillName:w,agent:N,installed:U}of f)x.has(w)||x.set(w,new Map),x.get(w).set(N,U);for(let w of o){p.length>0&&p.push("");let N=Qe(w.installName,{global:r}),U=vt(N,d);p.push(`${k.cyan(U)}`),p.push(...br(i,u)),w.files.size>1&&p.push(` ${k.dim("files:")} ${w.files.size}`);let M=x.get(w.installName),G=i.filter(ge=>M?.get(ge)).map(ge=>D[ge].displayName);G.length>0&&p.push(` ${k.yellow("overwrites:")} ${me(G)}`);}if(console.log(),y.note(p.join(`
26
+ `),"Installation Summary"),!s.yes){let w=await y.confirm({message:"Proceed with installation?"});(y.isCancel(w)||!w)&&(y.cancel("Installation cancelled"),process.exit(0));}let A=bt.getSourceIdentifier(e),S=gr(A).catch(()=>null);n.start("Installing skills...");let E=[];for(let w of o)for(let N of i){let U=await rl(w,N,{global:r,mode:u});E.push({skill:w.installName,agent:D[N].displayName,...U});}n.stop("Installation complete"),console.log();let T=E.filter(w=>w.success),O=E.filter(w=>!w.success),C={};for(let w of o)C[w.installName]=w.sourceUrl;if(await S!==true&&be({event:"install",source:A,skills:o.map(w=>w.installName).join(","),agents:i.join(","),...r&&{global:"1"},skillFiles:JSON.stringify(C),sourceType:"well-known"}),T.length>0&&r){let w=new Set(T.map(N=>N.skill));for(let N of o)if(w.has(N.installName))try{await tn(N.installName,{source:A,sourceType:"well-known",sourceUrl:N.sourceUrl,skillFolderHash:""});}catch{}}if(T.length>0&&!r){let w=new Set(T.map(N=>N.skill));for(let N of o)if(w.has(N.installName))try{let U=T.find(G=>G.skill===N.installName),M=U?.canonicalPath||U?.path;if(M){let G=await He(M);await Ct(N.installName,{source:A,sourceType:"well-known",computedHash:G},d);}}catch{}}if(T.length>0){let w=new Map;for(let se of T){let te=w.get(se.skill)||[];te.push(se),w.set(se.skill,te);}let N=w.size,U=T.filter(se=>se.mode==="symlink"&&se.symlinkFailed),M=U.map(se=>se.agent),G=[];for(let[se,te]of w){let we=te[0];if(we.mode==="copy"){G.push(`${k.green("\u2713")} ${se} ${k.dim("(copied)")}`);for(let pe of te){let Ae=vt(pe.path,d);G.push(` ${k.dim("\u2192")} ${Ae}`);}}else {if(we.canonicalPath){let pe=vt(we.canonicalPath,d);G.push(`${k.green("\u2713")} ${pe}`);}else G.push(`${k.green("\u2713")} ${se}`);G.push(...xl(te,i));}}let ge=k.green(`Installed ${N} skill${N!==1?"s":""}`);y.note(G.join(`
27
+ `),ge),U.length>0&&(y.log.warn(k.yellow(`Symlinks failed for: ${me(M)}`)),y.log.message(k.dim(" Files were copied instead. On Windows, enable Developer Mode for symlink support.")));}if(O.length>0){console.log(),y.log.error(k.red(`Failed to install ${O.length}`));for(let w of O)y.log.message(` ${k.red("\u2717")} ${w.skill} \u2192 ${w.agent}: ${k.dim(w.error)}`);}console.log(),y.outro(k.green("Done!")+k.dim(" Review skills before use; they run with full agent permissions.")),await Ll(s,i);}async function at(t,e$1={}){let s=t[0],n=false,l=()=>{n||(y.log.message(k.dim("Tip: use the --yes (-y) and --global (-g) flags to install without prompts.")),n=true);};s||(console.log(),console.log(k.bgRed(k.white(k.bold(" ERROR ")))+" "+k.red("Missing required argument: source")),console.log(),console.log(k.dim(" Usage:")),console.log(` ${k.cyan("easbot skills add")} ${k.yellow("<source>")} ${k.dim("[options]")}`),console.log(),console.log(k.dim(" Example:")),console.log(` ${k.cyan("easbot skills add")} ${k.yellow("houjallen/agent-skills")}`),console.log(),process.exit(1)),e$1.all&&(e$1.skill=["*"],e$1.agent=["*"],e$1.yes=true);let o=await et();if(o.isAgent&&(e$1.yes=true,!e$1.agent||e$1.agent.length===0)){let a=cs(o.agent.name);a&&(e$1.agent=ln([a]));}console.log(),o.isAgent||y.intro(k.bgCyan(k.black(" skills "))),o.isAgent?y.log.info(k.bgCyan(k.black(k.bold(` ${o.agent.name} `)))+" Agent detected \u2014 installing non-interactively"):process.stdin.isTTY||l();let i$1=null;try{let a=y.spinner();a.start("Parsing source...");let r=gt(s);a.stop(`Source: ${r.type==="local"?r.localPath:r.url}${r.ref?` @ ${k.yellow(r.ref)}`:""}${r.subpath?` (${r.subpath})`:""}${r.skillFilter?` ${k.dim("@")}${k.cyan(r.skillFilter)}`:""}`);let h$1=Xe(r),u=(()=>{if(!h$1)return Promise.resolve(null);let $=Xt(h$1);return $?Et($.owner,$.repo).catch(()=>null):Promise.resolve(null)})();if(r.type==="well-known"){await vr(s,r.url,e$1,a);return}r.skillFilter&&(e$1.skill=e$1.skill||[],e$1.skill.includes(r.skillFilter)||e$1.skill.push(r.skillFilter));let m=!!(e$1.skill&&e$1.skill.length>0),d,p=null;if(r.type==="local")a.start("Validating local path..."),existsSync(r.localPath)||(a.stop(k.red("Path not found")),y.outro(k.red(`Local path does not exist: ${r.localPath}`)),process.exit(1)),a.stop("Local path validated"),a.start("Discovering skills..."),d=await Pe(r.localPath,r.subpath,{includeInternal:m,fullDepth:e$1.fullDepth});else if(r.type==="github"&&!e$1.fullDepth){let $=["vercel","houjallen","heygen-com"],_=Xe(r),j=_?.split("/")[0]?.toLowerCase(),R=!!_&&Object.hasOwn(e,_.toLowerCase());_&&j&&(R||$.includes(j))&&(a.start("Fetching skills..."),p=await k$1(_,{subpath:r.subpath,skillFilter:r.skillFilter,ref:r.ref,getToken:rt,includeInternal:m}),p||a.stop(k.dim("Falling back to clone..."))),p?(d=p.skills,a.stop(`Found ${k.green(d.length)} skill${d.length>1?"s":""}`)):(a.start("Cloning repository..."),i$1=await ze(r.url,r.ref),a.stop("Repository cloned"),a.start("Discovering skills..."),d=await Pe(i$1,r.subpath,{includeInternal:m,fullDepth:e$1.fullDepth}));}else a.start("Cloning repository..."),i$1=await ze(r.url,r.ref),a.stop("Repository cloned"),a.start("Discovering skills..."),d=await Pe(i$1,r.subpath,{includeInternal:m,fullDepth:e$1.fullDepth});if(d.length===0&&(a.stop(k.red("No skills found")),y.outro(k.red("No valid skills found. Skills require a SKILL.md with name and description.")),await ke(i$1),process.exit(1)),p||a.stop(`Found ${k.green(d.length)} skill${d.length>1?"s":""}`),e$1.list){console.log(),y.log.step(k.bold("Available Skills"));let $={},_=[];for(let R of d)if(R.pluginName){let K=R.pluginName;$[K]||($[K]=[]),$[K].push(R);}else _.push(R);let j=Object.keys($).sort();for(let R of j){let K=R.split("-").map(z=>z.charAt(0).toUpperCase()+z.slice(1)).join(" ");console.log(k.bold(K));for(let z of $[R])y.log.message(` ${k.cyan(le(z))}`),y.log.message(` ${k.dim(z.description)}`);console.log();}if(_.length>0){j.length>0&&console.log(k.bold("General"));for(let R of _)y.log.message(` ${k.cyan(le(R))}`),y.log.message(` ${k.dim(R.description)}`);}console.log(),y.outro("Use --skill <name> to install specific skills"),await ke(i$1),process.exit(0);}let c;if(e$1.skill?.includes("*"))c=d,y.log.info(`Installing all ${d.length} skills`);else if(e$1.skill&&e$1.skill.length>0){if(c=es(d,e$1.skill),c.length===0){y.log.error(`No matching skills found for: ${e$1.skill.join(", ")}`),y.log.info("Available skills:");for(let $ of d)y.log.message(` - ${le($)}`);await ke(i$1),process.exit(1);}y.log.info(`Selected ${c.length} skill${c.length!==1?"s":""}: ${c.map($=>k.cyan(le($))).join(", ")}`);}else if(d.length===1){c=d;let $=d[0];y.log.info(`Skill: ${k.cyan(le($))}`),y.log.message(k.dim($.description));}else if(e$1.yes)c=d,y.log.info(`Installing all ${d.length} skills`);else {let $=[...d].sort((R,K)=>R.pluginName&&!K.pluginName?-1:!R.pluginName&&K.pluginName?1:R.pluginName&&K.pluginName&&R.pluginName!==K.pluginName?R.pluginName.localeCompare(K.pluginName):le(R).localeCompare(le(K))),_=$.some(R=>R.pluginName),j;if(_){let R=z=>z.split("-").map(V=>V.charAt(0).toUpperCase()+V.slice(1)).join(" "),K={};for(let z of $){let V=z.pluginName?R(z.pluginName):"Other";K[V]||(K[V]=[]),K[V].push({value:z,label:le(z),hint:z.description.length>60?z.description.slice(0,57)+"...":z.description});}j=await y.groupMultiselect({message:`Select skills to install ${k.dim("(space to toggle)")}`,options:K,required:!0});}else {let R=$.map(K=>({value:K,label:le(K),hint:K.description.length>60?K.description.slice(0,57)+"...":K.description}));j=await Al({message:"Select skills to install",options:R,required:!0});}y.isCancel(j)&&(y.cancel("Installation cancelled"),await ke(i$1),process.exit(0)),c=j;}let f=Xe(r),x=f?ul(f,c.map($=>le($))):Promise.resolve(null),A,S=Object.keys(D);if(e$1.agent?.includes("*"))A=S,y.log.info(`Installing to all ${A.length} agents`);else if(e$1.agent&&e$1.agent.length>0){let $=e$1.agent.filter(_=>!S.includes(_));$.length>0&&(y.log.error(`Invalid agents: ${$.join(", ")}`),y.log.info(`Valid agents: ${S.join(", ")}`),await ke(i$1),process.exit(1)),A=e$1.agent;}else {a.start("Loading agents...");let $=await Be(),_=Object.keys(D).length;if(a.stop(`${_} agents`),$.includes("eve")&&(e$1.yes||!o.isAgent)){let j=e$1.yes?!0:await y.confirm({message:yr(c),initialValue:!0});if(y.isCancel(j)&&(y.cancel("Installation cancelled"),await ke(i$1),process.exit(0)),j)A=["eve"],y.log.info(`Installing to: ${k.cyan(Sl)}`);else {let R=await on({global:e$1.global});y.isCancel(R)&&(y.cancel("Installation cancelled"),await ke(i$1),process.exit(0)),A=R;}}else if($.length===0)if(e$1.yes)A=S,y.log.info("Installing to all agents");else {y.log.info("Select agents to install skills to");let j=Object.entries(D).filter(([K])=>K!=="eve").map(([K,z])=>({value:K,label:z.displayName})),R=await Il("Which agents do you want to install to?",j);y.isCancel(R)&&(y.cancel("Installation cancelled"),await ke(i$1),process.exit(0)),A=R;}else if($.length===1||e$1.yes)if(A=ln($),$.length===1){let j=$[0];y.log.info(`Installing to: ${k.cyan(D[j].displayName)}`);}else y.log.info(`Installing to: ${$.map(j=>k.cyan(D[j].displayName)).join(", ")}`);else {let j=await on({global:e$1.global});y.isCancel(j)&&(y.cancel("Installation cancelled"),await ke(i$1),process.exit(0)),A=j;}}e$1.subagent&&e$1.subagent.length>0&&!A.includes("eve")&&(A=[...A,"eve"]);let E=[void 0];if(A.includes("eve")){let $=lt(process.cwd());if(e$1.subagent&&e$1.subagent.length>0)E=e$1.subagent.map(_=>_==="root"||_==="."?void 0:_);else if($.length>0&&!e$1.yes){let _=[{value:"",label:"Root agent",hint:"agent/skills"},...$.map(R=>({value:R,label:R,hint:`agent/subagents/${R}/skills`}))],j=await y.multiselect({message:"Where should Eve skills be installed?",options:_,initialValues:[""],required:!0});y.isCancel(j)&&(y.cancel("Installation cancelled"),await ke(i$1),process.exit(0)),E=j.map(R=>R===""?void 0:R);}}let T=wr(A,E),O=e$1.global??!1,C=A.some($=>D[$].globalSkillsDir!==void 0);if(e$1.global===void 0&&!e$1.yes&&C){let $=await y.select({message:"Installation scope",options:[{value:!1,label:"Project",hint:"Install in current directory (committed with your project)"},{value:!0,label:"Global",hint:"Install in home directory (available across all projects)"}]});y.isCancel($)&&(y.cancel("Installation cancelled"),await ke(i$1),process.exit(0)),O=$;}let I=e$1.copy?"copy":"symlink",w=T.every($=>$.agent==="eve"),N=new Set(T.map($=>$.subagent?`eve:subagent:${$.subagent}`:D[$.agent].skillsDir));if(!e$1.copy&&!e$1.yes&&N.size>1&&!w){let $=await y.select({message:"Installation method",options:[{value:"symlink",label:"Symlink (Recommended)",hint:"Single source of truth, easy updates"},{value:"copy",label:"Copy to all agents",hint:"Independent copies for each agent"}]});y.isCancel($)&&(y.cancel("Installation cancelled"),await ke(i$1),process.exit(0)),I=$;}else (N.size<=1||w)&&(I="copy");let U=process.cwd(),M=[],G=await Promise.all(c.flatMap($=>T.map(async _=>({skillName:$.name,target:_,installed:await rs($.name,_.agent,{global:O,eveSubagent:_.subagent})})))),ge=new Map;for(let{skillName:$,target:_,installed:j}of G)ge.has($)||ge.set($,new Map),ge.get($).set(wl(_),j);let se={},te=[];for(let $ of c)if($.pluginName){let _=$.pluginName;se[_]||(se[_]=[]),se[_].push($);}else te.push($);let we=$=>{for(let _ of $){M.length>0&&M.push("");let j=T.length===1?Qe(_.name,{global:O,agent:T[0].agent,eveSubagent:T[0].subagent}):Qe(_.name,{global:O}),R=vt(j,U);M.push(`${k.cyan(R)}`),M.push(...$r(T,I));let K=ge.get(_.name),z=T.filter(V=>K?.get(wl(V))).map(fs);z.length>0&&M.push(` ${k.yellow("overwrites:")} ${me(z)}`);}},pe=Object.keys(se).sort();for(let $ of pe){let _=$.split("-").map(j=>j.charAt(0).toUpperCase()+j.slice(1)).join(" ");M.push(""),M.push(k.bold(_)),we(se[$]);}te.length>0&&(pe.length>0&&(M.push(""),M.push(k.bold("General"))),we(te)),console.log(),y.note(M.join(`
28
+ `),"Installation Summary");try{let $=await x;if($&&f){let _=fr($,c.map(j=>({slug:le(j),displayName:le(j)})),f);_.length>0&&y.note(_.join(`
29
+ `),"Security Risk Assessments");}}catch{}if(!e$1.yes){let $=await y.confirm({message:"Proceed with installation?"});(y.isCancel($)||!$)&&(y.cancel("Installation cancelled"),await ke(i$1),process.exit(0));}a.start("Installing skills...");let Ae=[];for(let $ of c)for(let _ of T){let{agent:j,subagent:R}=_,K;if(p&&"files"in $){let z=$;K=await Gs({installName:z.name,files:z.files},j,{global:O,mode:I,eveSubagent:R});}else i$1&&$.path===i$1&&$.rawContent?K=await Gs({installName:$.name,files:[{path:"SKILL.md",contents:$.rawContent}]},j,{global:O,mode:I}):K=await os($,j,{global:O,mode:I,eveSubagent:R});Ae.push({skill:le($),agent:fs(_),pluginName:$.pluginName,...K});}a.stop("Installation complete"),console.log();let Me=Ae.filter($=>$.success),Tt=Ae.filter($=>!$.success),Ee={};for(let $ of c)p&&"repoPath"in $?Ee[$.name]=$.repoPath:i$1&&$.path===i$1?Ee[$.name]="SKILL.md":i$1&&$.path.startsWith(i$1+sep)&&(Ee[$.name]=`${$.path.slice(i$1.length+1).split(sep).join("/")}/SKILL.md`);let Ce=Xe(r),Vt=pr(r.url,Ce);if(Ce&&(Xt(Ce)?await u===!1&&be({event:"install",source:Ce,skills:c.map(j=>j.name).join(","),agents:A.join(","),...O&&{global:"1"},skillFiles:JSON.stringify(Ee)}):be({event:"install",source:Ce,skills:c.map(_=>_.name).join(","),agents:A.join(","),...O&&{global:"1"},skillFiles:JSON.stringify(Ee)})),Me.length>0&&O&&Ce){let $=new Set(Me.map(j=>j.skill)),_;r.type==="github"&&!p&&(_=await h(Ce,r.ref,rt));for(let j of c){let R=le(j);if($.has(R))try{let K="",z=Ee[j.name];if(p&&z){let V=i(p.tree,z);V&&(K=V);}else if(r.type==="github"&&z&&_){let V=i(_,z);V&&(K=V);}else if(z&&i$1){let V=join(i$1,dirname(z)),Dt=await He(V);Dt&&(K=Dt);}await tn(j.name,{source:Vt||Ce,sourceType:r.type,sourceUrl:r.url,ref:r.ref,skillPath:z,skillFolderHash:K,pluginName:j.pluginName});}catch{}}}if(Me.length>0&&!O){let $=new Set(Me.map(R=>R.skill)),_=A.includes("eve")?E.map(R=>R??""):void 0,j=_&&(_.length>1||_.some(R=>R!==""));for(let R of c){let K=le(R);if($.has(K))try{let z=p&&"snapshotHash"in R?R.snapshotHash:i$1&&R.path===i$1&&R.rawContent?hr(R.rawContent):await He(R.path),V=Ee[R.name];await Ct(R.name,{source:Vt||r.url,ref:r.ref,sourceType:r.type,...V&&{skillPath:V},computedHash:z,...j&&{subagents:_}},U);}catch{}}}if(Me.length>0){let $=new Map,_={},j=[];for(let ae of Me){let We=$.get(ae.skill)||[];if(We.push(ae),$.set(ae.skill,We),We.length===1)if(ae.pluginName){let Re=ae.pluginName;_[Re]||(_[Re]=[]),_[Re].push(ae);}else j.push(ae);}let R=$.size,K=Me.filter(ae=>ae.mode==="symlink"&&ae.symlinkFailed),z=K.map(ae=>ae.agent),V=[],Dt=ae=>{for(let We of ae){let Re=$.get(We.skill)||[],As=Re[0];if(As.mode==="copy"){V.push(`${k.green("\u2713")} ${We.skill} ${k.dim("(copied)")}`);for(let Is of Re){let Si=vt(Is.path,U);V.push(` ${k.dim("\u2192")} ${Si}`);}}else {if(As.canonicalPath){let Is=vt(As.canonicalPath,U);V.push(`${k.green("\u2713")} ${Is}`);}else V.push(`${k.green("\u2713")} ${We.skill}`);V.push(...xl(Re,A));}}},yn=Object.keys(_).sort();for(let ae of yn){let We=ae.split("-").map(Re=>Re.charAt(0).toUpperCase()+Re.slice(1)).join(" ");V.push(""),V.push(k.bold(We)),Dt(_[ae]);}j.length>0&&(yn.length>0&&(V.push(""),V.push(k.bold("General"))),Dt(j));let $i=k.green(`Installed ${R} skill${R!==1?"s":""}`);y.note(V.join(`
30
+ `),$i),K.length>0&&(y.log.warn(k.yellow(`Symlinks failed for: ${me(z)}`)),y.log.message(k.dim(" Files were copied instead. On Windows, enable Developer Mode for symlink support.")));}if(Tt.length>0){console.log(),y.log.error(k.red(`Failed to install ${Tt.length}`));for(let $ of Tt)y.log.message(` ${k.red("\u2717")} ${$.skill} \u2192 ${$.agent}: ${k.dim($.error)}`);}console.log(),y.outro(k.green("Done!")+k.dim(" Review skills before use; they run with full agent permissions.")),await Ll(e$1,A);}catch(a){if(a instanceof Ke){y.log.error(k.red("Failed to clone repository"));for(let r of a.message.split(`
31
+ `))y.log.message(k.dim(r));}else y.log.error(a instanceof Error?a.message:"Unknown error occurred");l(),y.outro(k.red("Installation failed")),process.exit(1);}finally{await ke(i$1);}}async function ke(t){if(t)try{await st(t);}catch{}}async function Ll(t,e){if(process.stdin.isTTY&&!t?.yes)try{if(await kl("findSkillsPrompt"))return;if(await rs("find-skills","claude-code",{global:!0})){await zt("findSkillsPrompt");return}console.log(),y.log.message(k.dim("One-time prompt - you won't be asked again if you dismiss."));let l=await y.confirm({message:`Install the ${k.cyan("find-skills")} skill? It helps your agent discover and suggest skills.`});if(y.isCancel(l)){await zt("findSkillsPrompt");return}if(l){await zt("findSkillsPrompt");let o=e?.filter(i=>i!=="replit");if(!o||o.length===0)return;console.log(),y.log.step("Installing find-skills skill...");try{await at(["houjallen/skills"],{skill:["find-skills"],global:!0,yes:!0,agent:o});}catch{y.log.warn("Failed to install find-skills. You can try again with:"),y.log.message(k.dim(" easbot skills add houjallen/skills@find-skills -g -y --all"));}}else await zt("findSkillsPrompt"),y.log.message(k.dim("You can install it later with: easbot skills add houjallen/skills@find-skills"));}catch{}}function hs(t){let e={},s=[];for(let n=0;n<t.length;n++){let l=t[n];if(l==="-g"||l==="--global")e.global=true;else if(l==="-y"||l==="--yes")e.yes=true;else if(l==="-l"||l==="--list")e.list=true;else if(l==="--all")e.all=true;else if(l==="-a"||l==="--agent"){e.agent=e.agent||[],n++;let o=t[n];for(;n<t.length&&o&&!o.startsWith("-");)e.agent.push(o),n++,o=t[n];n--;}else if(l==="-s"||l==="--skill"){e.skill=e.skill||[],n++;let o=t[n];for(;n<t.length&&o&&!o.startsWith("-");)e.skill.push(o),n++,o=t[n];n--;}else if(l==="--full-depth")e.fullDepth=true;else if(l==="--copy")e.copy=true;else if(l==="--subagent"){e.subagent=e.subagent||[],n++;let o=t[n];for(;n<t.length&&o&&!o.startsWith("-");)e.subagent.push(o),n++,o=t[n];n--;}else l&&!l.startsWith("-")&&s.push(l);}return {source:s,options:e}}var an=Log.create({service:"skills-find"}),Y="\x1B[0m",ks="\x1B[1m",de="\x1B[38;5;102m",xt="\x1B[38;5;145m",Tl="\x1B[36m";var Ar=process.env.SKILLS_API_URL||"https://skills.sh";function Dl(t){return !t||t<=0?"":t>=1e6?`${(t/1e6).toFixed(1).replace(/\.0$/,"")}M installs`:t>=1e3?`${(t/1e3).toFixed(1).replace(/\.0$/,"")}K installs`:`${t} install${t===1?"":"s"}`}var Ir=/^[a-z0-9](?:[a-z0-9-]{0,38})$/i;function Lr(t){let e=[],s={},n=[];for(let l=0;l<t.length;l++){let o=t[l];if(!o)continue;let i;if(o==="--owner"){let r=t[l+1];if(!r||r.startsWith("-")){n.push("--owner requires a GitHub owner");continue}i=r,l++;}else if(o.startsWith("--owner=")){if(i=o.slice(8),!i){n.push("--owner requires a GitHub owner");continue}}else {e.push(o);continue}let a=i.trim().toLowerCase();if(!Ir.test(a)){n.push("--owner must be a valid GitHub owner");continue}s.owner=a;}return {query:e.join(" "),options:s,errors:n}}async function Nl(t,e){try{let s=new URLSearchParams({q:t,limit:"10"});e&&s.set("owner",e);let n=`${Ar}/api/search?${s.toString()}`,l=await fetch(n);return l.ok?(await l.json()).skills.map(i=>({name:c(i.name),slug:c(i.id),source:c(i.source||""),installs:i.installs})).sort((i,a)=>(a.installs||0)-(i.installs||0)):[]}catch{return []}}var Pr="\x1B[?25l",Tr="\x1B[?25h",Dr="\x1B[J",Nr=t=>`\x1B[${t}A`,Er=t=>`\x1B[${t}G`;async function Cr(t="",e){let s=[],n=0,l=t,o=false,i=null,a=0;process.stdin.isTTY&&process.stdin.setRawMode(true),ps.emitKeypressEvents(process.stdin),process.stdin.resume(),process.stdout.write(Pr);function r(){a>0&&process.stdout.write(Nr(a)+Er(1)),process.stdout.write(Dr);let u=[],m=`${ks}_${Y}`;if(u.push(`${xt}Search skills:${Y} ${l}${m}`),u.push(""),!l||l.length<2)u.push(`${de}Start typing to search (min 2 chars)${Y}`);else if(s.length===0&&o)u.push(`${de}Searching...${Y}`);else if(s.length===0)u.push(`${de}No skills found${Y}`);else {let p=s.slice(0,8);for(let c=0;c<p.length;c++){let f=p[c],x=c===n,A=x?`${ks}>${Y}`:" ",S=x?`${ks}${f.name}${Y}`:`${xt}${f.name}${Y}`,E=f.source?` ${de}${f.source}${Y}`:"",T=Dl(f.installs),O=T?` ${Tl}${T}${Y}`:"",C=o&&c===0?` ${de}...${Y}`:"";u.push(` ${A} ${S}${E}${O}${C}`);}}u.push(""),u.push(`${de}up/down navigate | enter select | esc cancel${Y}`);for(let d of u)process.stdout.write(d+`
32
+ `);a=u.length;}function h(u){if(i&&(clearTimeout(i),i=null),o=false,!u||u.length<2){s=[],n=0,r();return}o=true,r();let m=Math.max(150,350-u.length*50);i=setTimeout(async()=>{try{s=await Nl(u,e),n=0;}catch{s=[];}finally{o=false,i=null,r();}},m);}return t&&h(t),r(),new Promise(u=>{function m(){process.stdin.removeListener("keypress",d),process.stdin.isTTY&&process.stdin.setRawMode(false),process.stdout.write(Tr),process.stdin.pause();}function d(p,c){if(c){if(c.name==="escape"||c.ctrl&&c.name==="c"){m(),u(null);return}if(c.name==="return"){m(),u(s[n]||null);return}if(c.name==="up"){n=Math.max(0,n-1),r();return}if(c.name==="down"){n=Math.min(Math.max(0,s.length-1),n+1),r();return}if(c.name==="backspace"){l.length>0&&(l=l.slice(0,-1),h(l));return}if(c.sequence&&!c.ctrl&&!c.meta&&c.sequence.length===1){let f=c.sequence;f>=" "&&f<="~"&&(l+=f,h(l));}}}process.stdin.on("keypress",d);})}function Rr(t){let e=t.lastIndexOf("@"),n=(e>0?t.slice(0,e):t).match(/^([^/]+)\/([^/]+)$/);return n?{owner:n[1],repo:n[2]}:null}async function _r(t,e){return await Et(t,e)===false}async function El(t){let{query:e,options:s,errors:n}=Lr(t),l=s.owner,o=!process.stdin.isTTY;an.debug("runFind enter",{args:t,query:e,owner:l,errors:n,isNonInteractive:o,stdinTTY:process.stdin.isTTY});let i=`${de}Tip: if running in a coding agent, follow these steps:${Y}
33
+ ${de} 1) easbot skills find [query] [--owner <owner>]${Y}
34
+ ${de} 2) easbot skills add <owner/repo@skill>${Y}`;if(n.length>0){for(let p of n)console.error(p);console.error("Usage: easbot skills find <query> [--owner <owner>]");return}if(e){an.debug("runFind enter query branch",{query:e,owner:l});let p=await Nl(e,l);if(an.debug("runFind searchSkillsAPI returned",{count:p.length}),be({event:"find",query:e,resultCount:String(p.length)}),p.length===0){let c=l?` from owner "${l}"`:"";console.log(`${de}No skills found for "${e}"${c}${Y}`);return}console.log(`${de}Install with${Y} easbot skills add <owner/repo@skill>`),console.log();for(let c of p.slice(0,6)){let f=c.source||c.slug,x=Dl(c.installs);console.log(`${xt}${f}@${c.name}${Y}${x?` ${Tl}${x}${Y}`:""}`),console.log(`${de}\u2514 https://skills.sh/${c.slug}${Y}`),console.log();}return}if(o||await as()){console.log(i),console.log(),console.log(`${de}Usage: easbot skills find <query> [--owner <owner>]${Y}`);return}let a=await Cr("",l);if(be({event:"find",query:"",resultCount:a?"1":"0",interactive:"1"}),!a){console.log(`${de}Search cancelled${Y}`),console.log();return}let r=a.source||a.slug,h=a.name;console.log(),console.log(`${xt}Installing ${ks}${h}${Y} from ${de}${r}${Y}...`),console.log();let{source:u,options:m}=hs([r,"--skill",h]);await at(u,m),console.log();let d=Rr(r);d&&await _r(d.owner,d.repo)?console.log(`${de}View the skill at${Y} ${xt}https://skills.sh/${a.slug}${Y}`):console.log(`${de}Discover more skills at${Y} ${xt}https://skills.sh${Y}`),console.log();}var Rl=t=>typeof t=="symbol";function _l(t,e){let s=homedir();return t===s||t.startsWith(s+sep)?"~"+t.slice(s.length):t===e||t.startsWith(e+sep)?"."+t.slice(e.length):t}async function jr(t){let e=join(t,"node_modules"),s=[],n;try{n=await readdir(e);}catch{return s}let l=async(o,i)=>{let a=await Ge(join(o,"SKILL.md"));if(a){s.push({...a,packageName:i});return}let r=[o,join(o,"skills"),join(o,".agents","skills")];for(let h of r)try{let u=await readdir(h);for(let m of u){let d=join(h,m);try{if(!(await stat(d)).isDirectory())continue}catch{continue}let p=await Ge(join(d,"SKILL.md"));p&&s.push({...p,packageName:i});}}catch{}};return await Promise.all(n.map(async o=>{if(o.startsWith("."))return;let i=join(e,o);try{if(!(await stat(i)).isDirectory())return}catch{return}if(o.startsWith("@"))try{let a=await readdir(i);await Promise.all(a.map(async r=>{let h=join(i,r);try{if(!(await stat(h)).isDirectory())return}catch{return}await l(h,`${o}/${r}`);}));}catch{}else await l(i,o);})),s}async function ys(t,e={}){let s=process.cwd(),n=await et();if(n.isAgent&&(e.yes=true,!e.agent||e.agent.length===0)){let S=cs(n.agent.name);if(S){let E=[S];for(let T of Ye())E.includes(T)||E.push(T);e.agent=E;}}console.log(),n.isAgent||y.intro(k.bgCyan(k.black(" skills experimental_sync "))),n.isAgent&&y.log.info(k.bgCyan(k.black(k.bold(` ${n.agent.name} `)))+" Agent detected \u2014 installing non-interactively");let l=y.spinner();l.start("Scanning node_modules for skills...");let o=await jr(s);if(o.length===0){l.stop(k.yellow("No skills found")),y.outro(k.dim("No SKILL.md files found in node_modules."));return}l.stop(`Found ${k.green(String(o.length))} skill${o.length>1?"s":""} in node_modules`);for(let S of o)y.log.info(`${k.cyan(S.name)} ${k.dim(`from ${S.packageName}`)}`),S.description&&y.log.message(k.dim(` ${S.description}`));let i=await Le(s),a=[],r=[];if(e.force)a.push(...o),y.log.info(k.dim("Force mode: reinstalling all skills"));else {for(let S of o){let E=i.skills[S.name];if(E&&await He(S.path)===E.computedHash){r.push(S.name);continue}a.push(S);}if(r.length>0&&y.log.info(k.dim(`${r.length} skill${r.length!==1?"s":""} already up to date`)),a.length===0){console.log(),y.outro(k.green("All skills are up to date."));return}}y.log.info(`${a.length} skill${a.length!==1?"s":""} to install/update`);let h,u=Object.keys(D),m=Ye(),d=ss();if(e.agent?.includes("*"))h=u,y.log.info(`Installing to all ${h.length} agents`);else if(e.agent&&e.agent.length>0){let S=e.agent.filter(E=>!u.includes(E));S.length>0&&(y.log.error(`Invalid agents: ${S.join(", ")}`),y.log.info(`Valid agents: ${u.join(", ")}`),process.exit(1)),h=e.agent;}else {l.start("Loading agents...");let S=await Be(),E=Object.keys(D).length;if(l.stop(`${E} agents`),S.length===0)if(e.yes)h=m,y.log.info("Installing to universal agents");else {let O=Mt().map(I=>({value:I,label:D[I].displayName,hint:D[I].skillsDir})),C=await $t({message:"Which agents do you want to install to?",items:O,initialSelected:[],lockedSection:{title:"Universal (.agents/skills)",items:d.map(I=>({value:I,label:D[I].displayName})),hiddenCount:m.length-d.length}});Rl(C)&&(y.cancel("Sync cancelled"),process.exit(0)),h=C;}else if(S.length===1||e.yes){h=[...S];for(let T of m)h.includes(T)||h.push(T);}else {let O=Mt().filter(I=>S.includes(I)).map(I=>({value:I,label:D[I].displayName,hint:D[I].skillsDir})),C=await $t({message:"Which agents do you want to install to?",items:O,initialSelected:S.filter(I=>!m.includes(I)),lockedSection:{title:"Universal (.agents/skills)",items:d.map(I=>({value:I,label:D[I].displayName})),hiddenCount:m.length-d.length}});Rl(C)&&(y.cancel("Sync cancelled"),process.exit(0)),h=C;}}let p=[];for(let S of a){let E=Qe(S.name,{global:false}),T=_l(E,s);p.push(`${k.cyan(S.name)} ${k.dim(`\u2190 ${S.packageName}`)}`),p.push(` ${k.dim(T)}`);}if(console.log(),y.note(p.join(`
35
+ `),"Sync Summary"),!e.yes){let S=await y.confirm({message:"Proceed with sync?"});(y.isCancel(S)||!S)&&(y.cancel("Sync cancelled"),process.exit(0));}l.start("Syncing skills...");let c=[];for(let S of a)for(let E of h){let T=await os(S,E,{global:false,cwd:s,mode:"symlink"});c.push({skill:S.name,packageName:S.packageName,agent:D[E].displayName,success:T.success,path:T.path,canonicalPath:T.canonicalPath,error:T.error});}l.stop("Sync complete");let f=c.filter(S=>S.success),x=c.filter(S=>!S.success),A=new Set(f.map(S=>S.skill));for(let S of a)if(A.has(S.name))try{let E=await He(S.path);await Ct(S.name,{source:S.packageName,sourceType:"node_modules",computedHash:E},s);}catch{}if(console.log(),f.length>0){let S=new Map;for(let C of f){let I=S.get(C.skill)||[];I.push(C),S.set(C.skill,I);}let E=[];for(let[C,I]of S){let w=I[0],N=a.find(U=>U.name===C)?.packageName;if(w.canonicalPath){let U=_l(w.canonicalPath,s);E.push(`${k.green("\u2713")} ${C} ${k.dim(`\u2190 ${N}`)}`),E.push(` ${k.dim(U)}`);}else E.push(`${k.green("\u2713")} ${C} ${k.dim(`\u2190 ${N}`)}`);}let T=S.size,O=k.green(`Synced ${T} skill${T!==1?"s":""}`);y.note(E.join(`
36
+ `),O);}if(x.length>0){console.log(),y.log.error(k.red(`Failed to install ${x.length}`));for(let S of x)y.log.message(` ${k.red("\u2717")} ${S.skill} \u2192 ${S.agent}: ${k.dim(S.error)}`);}be({event:"experimental_sync",skillCount:String(a.length),successCount:String(A.size),agents:h.join(",")}),console.log(),y.outro(k.green("Done!")+k.dim(" Review skills before use; they run with full agent permissions."));}function bs(t){let e={};for(let s=0;s<t.length;s++){let n=t[s];if(n==="-y"||n==="--yes")e.yes=true;else if(n==="-f"||n==="--force")e.force=true;else if(n==="-a"||n==="--agent"){e.agent=e.agent||[],s++;let l=t[s];for(;s<t.length&&l&&!l.startsWith("-");)e.agent.push(l),s++,l=t[s];s--;}}return {options:e}}async function Ul(t){let e=process.cwd(),s=await Le(e),n=Object.entries(s.skills);if(n.length===0){y.log.warn("No project skills found in skills-lock.json"),y.log.info(`Add project-level skills with ${k.cyan("easbot skills add <package>")} (without ${k.cyan("-g")})`);return}let l=Ye(),o=[],i=new Map;for(let[r,h]of n){if(h.sourceType==="node_modules"){o.push(r);continue}let u=h.ref?`${h.source}#${h.ref}`:h.source,m=i.get(u);m?m.skills.push(r):i.set(u,{sourceType:h.sourceType,skills:[r]});}let a=n.length-o.length;a>0&&y.log.info(`Restoring ${k.cyan(String(a))} skill${a!==1?"s":""} from skills-lock.json into ${k.dim(".agents/skills/")}`);for(let[r,{skills:h}]of i)try{await at([r],{skill:h,agent:l,yes:!0});}catch(u){y.log.error(`Failed to install from ${k.cyan(r)}: ${u instanceof Error?u.message:"Unknown error"}`);}if(o.length>0){y.log.info(`${k.cyan(String(o.length))} skill${o.length!==1?"s":""} from node_modules`);try{let{options:r}=bs(t);await ys(t,{...r,yes:!0,agent:l});}catch(r){y.log.error(`Failed to sync node_modules skills: ${r instanceof Error?r.message:"Unknown error"}`);}}}var ve="\x1B[0m",dn="\x1B[1m",It="\x1B[38;5;102m";var Fr="\x1B[36m",jl="\x1B[33m";function ws(t,e){let s=homedir();return t.startsWith(s)?t.replace(s,"~"):t.startsWith(e)?"."+t.slice(e.length):t}function Mr(t,e=5){if(t.length<=e)return t.join(", ");let s=t.slice(0,e),n=t.length-e;return `${s.join(", ")} +${n} more`}function Wr(t){let e={};for(let s=0;s<t.length;s++){let n=t[s];if(n==="-g"||n==="--global")e.global=true;else if(n==="--json")e.json=true;else if(n==="-a"||n==="--agent")for(e.agent=e.agent||[];s+1<t.length&&!t[s+1].startsWith("-");)e.agent.push(t[++s]);}return e}async function Ol(t){let e=Wr(t),s=e.global===true,n;if(e.agent&&e.agent.length>0){let d=Object.keys(D),p=e.agent.filter(c=>!d.includes(c));p.length>0&&(console.log(`${jl}Invalid agents: ${p.join(", ")}${ve}`),console.log(`${It}Valid agents: ${d.join(", ")}${ve}`),process.exit(1)),n=e.agent;}let l=await al({global:s,agentFilter:n});if(e.json){let d=l.map(p=>({name:p.name,path:p.canonicalPath,scope:p.scope,agents:p.agents.map(c=>D[c].displayName)}));console.log(JSON.stringify(d,null,2));return}let o=await hl(),i=process.cwd(),a=s?"Global":"Project";if(l.length===0){if(e.json){console.log("[]");return}console.log(`${It}No ${a.toLowerCase()} skills found.${ve}`),console.log(s?`${It}Try listing project skills without -g${ve}`:`${It}Try listing global skills with -g${ve}`);return}function r(d,p=false,c$1=0,f=0){let x=p?" ":"",A=ws(d.canonicalPath,i),S=d.agents.map(C=>D[C].displayName),E=d.agents.length>0?Mr(S):`${jl}not linked${ve}`,T=c(d.name).padEnd(c$1),O=A.padEnd(f);console.log(`${x}${Fr}${T}${ve} ${It}${O}${ve} ${It}Agents:${ve} ${E}`);}console.log(`${dn}${a} Skills${ve}`),console.log();let h={},u=[];for(let d of l){let p=o[d.name];if(p?.pluginName){let c=p.pluginName;h[c]||(h[c]=[]),h[c].push(d);}else u.push(d);}if(Object.keys(h).length>0){let d=Object.keys(h).sort();for(let p of d){let c$1=p.split("-").map(x=>x.charAt(0).toUpperCase()+x.slice(1)).join(" ");console.log(`${dn}${c$1}${ve}`);let f=h[p];if(f){let x=0,A=0;for(let S of f){let E=c(S.name).length,T=ws(S.canonicalPath,i).length;E>x&&(x=E),T>A&&(A=T);}for(let S of f)r(S,true,x,A);}console.log();}if(u.length>0){console.log(`${dn}General${ve}`);let p=0,c$1=0;for(let f of u){let x=c(f.name).length,A=ws(f.canonicalPath,i).length;x>p&&(p=x),A>c$1&&(c$1=A);}for(let f of u)r(f,true,p,c$1);console.log();}}else {let d=0,p=0;for(let c$1 of l){let f=c(c$1.name).length,x=ws(c$1.canonicalPath,i).length;f>d&&(d=f),x>p&&(p=x);}for(let c of l)r(c,false,d,p);console.log();}}async function Ss(t,e){let s=await et();s.isAgent&&(e.yes=true,y.log.info(k.bgCyan(k.black(k.bold(` ${s.agent.name} `)))+" Agent detected \u2014 removing non-interactively"));let n=e.global??false,l=process.cwd(),o=y.spinner();o.start("Scanning for installed skills...");let i=new Set,a=async c=>{try{let f=await readdir(c,{withFileTypes:!0});for(let x of f)x.isDirectory()&&i.add(x.name);}catch(f){f instanceof Error&&f.code!=="ENOENT"&&y.log.warn(`Could not scan directory ${c}: ${f.message}`);}};if(n){await a(je(true,l));for(let c of Object.values(D))c.globalSkillsDir!==void 0&&await a(c.globalSkillsDir);}else {await a(je(false,l));for(let c of Object.values(D))await a(join(l,c.skillsDir));for(let c of lt(l))await a(kt(c,l));}let r=Array.from(i).sort();if(o.stop(`Found ${r.length} unique installed skill(s)`),r.length===0){y.outro(k.yellow("No skills found to remove."));return}if(e.agent&&e.agent.length>0){let c=Object.keys(D),f=e.agent.filter(x=>!c.includes(x));f.length>0&&(y.log.error(`Invalid agents: ${f.join(", ")}`),y.log.info(`Valid agents: ${c.join(", ")}`),process.exit(1));}let h=[];if(e.all)h=r;else if(t.length>0){if(h=r.filter(c=>t.some(f=>f.toLowerCase()===c.toLowerCase())),h.length===0){y.log.error(`No matching skills found for: ${t.join(", ")}`);return}}else {let c=r.map(x=>({value:x,label:x})),f=await y.multiselect({message:`Select skills to remove ${k.dim("(space to toggle)")}`,options:c,required:true});y.isCancel(f)&&(y.cancel("Removal cancelled"),process.exit(0)),h=f;}let u;if(e.agent&&e.agent.length>0?u=e.agent:(u=Object.keys(D),o.stop(`Targeting ${u.length} potential agent(s)`)),!e.yes){console.log(),y.log.info("Skills to remove:");for(let f of h)y.log.message(` ${k.red("\u2022")} ${f}`);console.log();let c=await y.confirm({message:`Are you sure you want to uninstall ${h.length} skill(s)?`});(y.isCancel(c)||!c)&&(y.cancel("Removal cancelled"),process.exit(0));}o.start("Removing skills...");let m=[];for(let c of h)try{let f=Qe(c,{global:n,cwd:l});for(let C of u){let I=D[C],w=Hs(c,C,{global:n,cwd:l}),N=new Set([w]),U=he(c);if(n&&I.globalSkillsDir)N.add(join(I.globalSkillsDir,U));else if(N.add(join(l,I.skillsDir,U)),C==="eve")for(let M of lt(l))N.add(join(kt(M,l),U));for(let M of N)if(M!==f)try{await lstat(M).catch(()=>null)&&await rm(M,{recursive:!0,force:!0});}catch(G){y.log.warn(`Could not remove skill from ${I.displayName}: ${G instanceof Error?G.message:String(G)}`);}}let A=(await Be()).filter(C=>!u.includes(C)),S=!1;for(let C of A){let I=Hs(c,C,{global:n,cwd:l});if(await lstat(I).catch(()=>null)){S=!0;break}}S||await rm(f,{recursive:!0,force:!0});let E=n?await fl(c):null,T=E?.source||"local",O=E?.sourceType||"local";n&&await ml(c),m.push({skill:c,success:!0,source:T,sourceType:O});}catch(f){m.push({skill:c,success:false,error:f instanceof Error?f.message:String(f)});}o.stop("Removal process complete");let d=m.filter(c=>c.success),p=m.filter(c=>!c.success);if(d.length>0){let c=new Map;for(let f of d){let x=f.source||"local",A=c.get(x)||{skills:[]};A.skills.push(f.skill),A.sourceType=f.sourceType,c.set(x,A);}for(let[f,x]of c)be({event:"remove",source:f,skills:x.skills.join(","),agents:u.join(","),...n&&{global:"1"},sourceType:x.sourceType});}if(d.length>0&&y.log.success(k.green(`Successfully removed ${d.length} skill(s)`)),p.length>0){y.log.error(k.red(`Failed to remove ${p.length} skill(s)`));for(let c of p)y.log.message(` ${k.red("\u2717")} ${c.skill}: ${c.error}`);}console.log(),y.outro(k.green("Done!"));}function Wl(t){let e={},s=[];for(let n=0;n<t.length;n++){let l=t[n];if(l==="-g"||l==="--global")e.global=true;else if(l==="-y"||l==="--yes")e.yes=true;else if(l==="--all")e.all=true;else if(l==="-a"||l==="--agent"){e.agent=e.agent||[],n++;let o=t[n];for(;n<t.length&&o&&!o.startsWith("-");)e.agent.push(o),n++,o=t[n];n--;}else l&&!l.startsWith("-")&&s.push(l);}return {skills:s,options:e}}function Lt(t,e){return e?`${t}#${e}`:t}function zr(t){let e=t;return e.endsWith("/SKILL.md")?e=e.slice(0,-9):e.endsWith("SKILL.md")&&(e=e.slice(0,-8)),e.endsWith("/")&&(e=e.slice(0,-1)),e}function Hr(t){if(t.startsWith("git@")||t.endsWith(".git"))return false;if(t.startsWith("http://")||t.startsWith("https://"))try{let e=new URL(t).hostname;return e==="github.com"||e==="gitlab.com"}catch{return false}return true}function Gr(t,e,s){if(!Hr(t))return Lt(t,s);let n=zr(e),l=n?`${t}/${n}`:t;return s?`${l}#${s}`:l}function Kl(t){return t.skillPath?Gr(t.source,t.skillPath,t.ref):Lt(t.sourceUrl,t.ref)}var Xl=dirname(fileURLToPath(import.meta.url)),W="\x1B[0m",zl="\x1B[1m",ee="\x1B[38;5;102m",oe="\x1B[38;5;145m";function qr(t){let e={},s=[];for(let n of t)n==="-g"||n==="--global"?e.global=true:n==="-p"||n==="--project"?e.project=true:n==="-y"||n==="--yes"?e.yes=true:n.startsWith("-")||s.push(n);return s.length>0&&(e.skills=s),e}function Jr(t){let e=t||process.cwd(),s=join(e,"skills-lock.json");if(existsSync(s))return true;let n=join(e,".agents","skills");try{let l=readdirSync(n,{withFileTypes:!0});for(let o of l)if(o.isDirectory()){let i=join(n,o.name,"SKILL.md");if(existsSync(i))return !0}}catch{}return false}async function Xr(t){if(t.skills&&t.skills.length>0)return t.global?"global":t.project?"project":"both";if(t.global&&t.project)return "both";if(t.global)return "global";if(t.project)return "project";if(t.yes||!process.stdin.isTTY)return Jr()?"project":"global";let e=await y.select({message:"Update scope",options:[{value:"project",label:"Project",hint:"Update skills in current directory"},{value:"global",label:"Global",hint:"Update skills in home directory"},{value:"both",label:"Both",hint:"Update all skills"}]});return y.isCancel(e)&&(y.cancel("Cancelled"),process.exit(0)),e}function Yl(t,e){if(!e||e.length===0)return true;let s=t.toLowerCase();return e.some(n=>n.toLowerCase()===s)}function Yr(t){return t.sourceType==="local"?"Local path":t.sourceType==="git"?"Git URL":t.sourceType==="well-known"?"Well-known skill":t.skillFolderHash?t.skillPath?"No version tracking":"No skill path recorded":"Private or deleted repo"}function Zr(t){let e=t.sourceUrl;if(t.sourceType==="well-known"){let s=e.indexOf("/.well-known/");s!==-1&&(e=e.slice(0,s));}return Lt(e,t.ref)}function Hl(t){if(t.length===0)return;console.log(),console.log(`${ee}${t.length} skill(s) cannot be checked automatically:${W}`);let e=new Map;for(let s of t){let n=Zr(s),l=e.get(n)||[];l.push(s),e.set(n,l);}for(let[s,n]of e){if(n.length===1){let l=n[0];console.log(` ${oe}\u2022${W} ${c(l.name)} ${ee}(${l.reason})${W}`);}else {let l=n[0].reason,o=n.map(i=>c(i.name)).join(", ");console.log(` ${oe}\u2022${W} ${o} ${ee}(${l})${W}`);}console.log(` ${ee}To update: ${oe}easbot skills add ${s} -g -y${W}`);}}async function Qr(t){let e=await Le(),s=[];for(let[n,l]of Object.entries(e.skills))Yl(n,t)&&(l.sourceType==="node_modules"||l.sourceType==="local"||s.push({name:n,source:l.source,entry:l}));return s}async function gn(t,e,s,n,l,o){let i=e.filter(a=>{let r=s[a];return r?.skillPath?!o.includes(r.skillPath):false});if(i.length>0){console.log(),console.log(`${ee}Warning:${W} The following skills from ${ee}${t}${W} appear to have been deleted upstream:`);for(let r of i)console.log(` ${ee}\u2022${W} ${r}`);if(l.yes||!process.stdin.isTTY)console.log(`${ee}Skipping deletion in non-interactive mode.${W}`);else {let r=await y.confirm({message:"Would you like to remove the local copies of these deleted skills?"});if(r&&!y.isCancel(r))for(let h of i)console.log(`${ee}Removing${W} ${h}...`),await Ss([h],{yes:true,global:n});}}return i}async function ea(t={}){let e=await Ne(),s=Object.keys(e.skills),n=0,l=0;if(s.length===0)return t.skills||(console.log(`${ee}No global skills tracked in lock file.${W}`),console.log(`${ee}Install skills with${W} ${oe}easbot skills add <package> -g${W}`)),{successCount:n,failCount:l,checkedCount:0};let o=[],i$1=[],a=[];for(let u of s){if(!Yl(u,t.skills))continue;let m=e.skills[u];if(m){if(!m.skillFolderHash||!m.skillPath){i$1.push({name:u,reason:Yr(m),sourceUrl:m.sourceUrl,sourceType:m.sourceType,ref:m.ref});continue}a.push({name:u,entry:m});}}let r=new Map;for(let u of a){let m=u.entry.source,d=r.get(m)||[];d.push(u),r.set(m,d);}for(let[u,m]of r){let d=m[0].entry,p=d.sourceUrl||d.source,c=null;process.stdout.write(`\r${ee}Checking skills from source: ${u}${W}\x1B[K
37
+ `);try{if(d.sourceType==="github"){let T=await h(u,d.ref,rt);if(!T){console.log(` ${ee}\u2717 Failed to fetch tree for ${u}${W}`);continue}let O=j(T),C=Object.entries(e.skills).filter(([N,U])=>U.source===u).map(([N,U])=>N),I=await gn(u,C,e.skills,!0,t,O),w=new Set(I);for(let{name:N,entry:U}of m){if(w.has(N))continue;let M=i(T,U.skillPath);M&&M!==U.skillFolderHash&&o.push({name:N,source:u,entry:U});}continue}c=await ze(p,d.ref);let x=(await Pe(c)).map(T=>join(relative(c,T.path),"SKILL.md").split(sep).join("/")),A=Object.entries(e.skills).filter(([T,O])=>O.source===u).map(([T,O])=>T),S=await gn(u,A,e.skills,!0,t,x),E=new Set(S);for(let{name:T,entry:O}of m){if(E.has(T))continue;let C=O.skillPath;if(!x.includes(C))continue;let I=await He(join(c,dirname(C)));I&&I!==O.skillFolderHash&&o.push({name:T,source:u,entry:O});}}catch{console.log(` ${ee}\u2717 Failed to check skills from ${u}${W}`);}finally{c&&await st(c);}}a.length>0&&process.stdout.write("\r\x1B[K");let h$1=a.length+i$1.length;if(a.length===0&&i$1.length===0)return t.skills||console.log(`${ee}No global skills to check.${W}`),{successCount:n,failCount:l,checkedCount:0};if(a.length===0&&i$1.length>0)return Hl(i$1),{successCount:n,failCount:l,checkedCount:h$1};if(o.length===0)return console.log(`${oe}\u2713 All global skills are up to date${W}`),{successCount:n,failCount:l,checkedCount:h$1};console.log(`${oe}Found ${o.length} global update(s)${W}`),console.log();for(let u of o){let m=c(u.name);console.log(`${oe}Updating ${m}...${W}`);let d=Kl(u.entry),p=join(Xl,"..","bin","cli.mjs");if(!existsSync(p)){l++,console.log(` ${ee}\u2717 Failed to update ${m}: CLI entrypoint not found at ${p}${W}`);continue}spawnSync(process.execPath,[p,"add",d,"-g","-y"],{stdio:["inherit","pipe","pipe"],encoding:"utf-8",shell:process.platform==="win32"}).status===0?(n++,console.log(` ${oe}\u2713${W} Updated ${m}`)):(l++,console.log(` ${ee}\u2717 Failed to update ${m}${W}`));}return Hl(i$1),{successCount:n,failCount:l,checkedCount:h$1}}async function ta(t={}){let e=await Qr(t.skills),s=0,n=0;if(e.length===0)return t.skills||(console.log(`${ee}No project skills to update.${W}`),console.log(`${ee}Install project skills with${W} ${oe}easbot skills add <package>${W}`)),{successCount:s,failCount:n,foundCount:0};let l=e.filter(p=>p.entry.skillPath),o=e.filter(p=>!p.entry.skillPath);if(l.length===0)return console.log(`${ee}No project skills can be updated in place.${W}`),Gl(o),{successCount:s,failCount:n,foundCount:e.length};let i=process.cwd(),a=[],r=false;for(let[p,c]of Object.entries(D))if($e(p))!r&&existsSync(join(i,".agents"))&&(r=true);else {let f=c.skillsDir.split("/")[0];existsSync(join(i,f))&&a.push(c.displayName);}let h=[];r&&h.push("Universal"),h.push(...a),h.length>0&&console.log(`${oe}Updating for: ${h.join(", ")}${W}`),console.log(`${oe}Refreshing ${l.length} skill(s)...${W}`),console.log();let u=new Map;for(let p of l){let c=p.entry.source,f=u.get(c)||[];f.push(p),u.set(c,f);}let m=await Le(),d=join(Xl,"..","bin","cli.mjs");if(!existsSync(d))return console.log(`${ee}\u2717 CLI entrypoint not found at ${d}${W}`),{successCount:s,failCount:l.length,foundCount:e.length};for(let[p,c$1]of u){let f=c$1[0].entry,x=f.source,A=f.ref,S=Object.entries(m.skills).filter(([C,I])=>I.source===p).map(([C,I])=>C),E=null,T=[];try{E=await ze(x,A);let I=(await Pe(E)).map(w=>{let N=relative(E,w.path);return join(N,"SKILL.md").split(sep).join("/")});T=await gn(p,S,m.skills,!1,t,I);}catch{console.log(`${ee}\u2717 Failed to check for deleted skills from ${p}${W}`);}finally{E&&await st(E);}let O=c$1.filter(C=>!T.includes(C.name));for(let C of O){let I=c(C.name);console.log(`${oe}Updating ${I}...${W}`);let w=Lt(C.entry.source,C.entry.ref),N=C.entry.subagents,U=N&&N.length>0?["--subagent",...N.map(G=>G===""?"root":G)]:[];spawnSync(process.execPath,[d,"add",w,"--skill",C.name,...U,"-y"],{stdio:["inherit","pipe","pipe"],encoding:"utf-8",shell:process.platform==="win32"}).status===0?(s++,console.log(` ${oe}\u2713${W} Updated ${I}`)):(n++,console.log(` ${ee}\u2717 Failed to update ${I}${W}`));}}return Gl(o),{successCount:s,failCount:n,foundCount:e.length}}function Gl(t){if(t.length!==0){console.log(),console.log(`${ee}${t.length} project skill(s) cannot be updated automatically (installed before skillPath tracking):${W}`);for(let e of t){let s=Lt(e.entry.source,e.entry.ref);console.log(` ${oe}\u2022${W} ${c(e.name)}`),console.log(` ${ee}To refresh: ${oe}easbot skills add ${s} -y${W}`);}}}async function Zl(t=[]){let e=qr(t),s=await Xr(e);e.skills?console.log(`${oe}Updating ${e.skills.join(", ")}...${W}`):console.log(`${oe}Checking for skill updates...${W}`),console.log();let n=0,l=0,o=0;if(s==="global"||s==="both"){s==="both"&&!e.skills&&console.log(`${zl}Global Skills${W}`);let{successCount:i,failCount:a,checkedCount:r}=await ea(e);n+=i,l+=a,o+=r,s==="both"&&!e.skills&&console.log();}if(s==="project"||s==="both"){s==="both"&&!e.skills&&console.log(`${zl}Project Skills${W}`);let{successCount:i,failCount:a,foundCount:r}=await ta(e);n+=i,l+=a,o+=r;}e.skills&&o===0&&console.log(`${ee}No installed skills found matching: ${e.skills.join(", ")}${W}`),console.log(),n>0&&console.log(`${oe}\u2713 Updated ${n} skill(s)${W}`),l>0&&console.log(`${ee}Failed to update ${l} skill(s)${W}`),be({event:"update",scope:s,skillCount:String(n+l),successCount:String(n),failCount:String(l)}),console.log();}var ua=["vercel","houjallen","heygen-com"],da=new Set(["metadata.json"]),ga=new Set([".git","__pycache__","__pypackages__"]),mn={"claude-code":{command:"claude",args:[]},codex:{command:"codex",args:[]}},oi=Object.keys(mn);function ri(t){let e=[],s={},n=[];for(let l=0;l<t.length;l++){let o=t[l];if(o)if(o==="--help"||o==="-h")s.help=true;else if(o==="--full-depth")s.fullDepth=true;else if(o==="--dangerously-accept-openclaw-risks")s.dangerouslyAcceptOpenclawRisks=true;else if(o==="--skill"||o==="-s"){let i=t[l+1];!i||i.startsWith("-")?n.push(`${o} requires a skill name`):s.skill?(n.push("Only one --skill value can be provided"),l++):(s.skill=i,l++);}else if(o==="--agent"||o==="-a"){s.agent=s.agent||[],l++;let i=t[l],a=s.agent.length;for(;l<t.length&&i&&!i.startsWith("-");)s.agent.push(i),l++,i=t[l];s.agent.length===a&&n.push(`${o} requires an agent name`),l--;}else o.startsWith("-")?n.push(`Unknown option: ${o}`):e.push(o);}return n.push(...wa(s.agent)),{source:e,options:s,errors:n}}function pa(t){let e=["You are being given a Skill to execute for the user's next request.","Use the following SKILL.md as your instructions:",`<SKILL.md>
38
+ ${t.skillMd}
39
+ </SKILL.md>`];return t.hasSupportingFiles&&t.supportDir&&e.push(`Supporting files for this skill were downloaded to:
40
+ ${t.supportDir}
41
+
42
+ When the SKILL.md references relative paths, read them from that directory.`),e.join(`
43
+
44
+ `)+`
45
+ `}async function ma(t){let e=await mkdtemp(join(tmpdir(),"skills-use-")),s=join(e,he(t.directoryName||t.name));if(!fn(e,s))throw new Error("Invalid skill name: potential path traversal detected");await mkdir(s,{recursive:true}),t.kind==="blob"?await $a(s,t.files):t.kind==="well-known"?await Sa(s,t.files):await pi(t.path,s);let n=t.rawContent??await readFile(join(s,"SKILL.md"),"utf-8"),l=await mi(s,s);return {tempRoot:e,skillDir:s,skillMd:n,hasSupportingFiles:l}}async function ai(t,e={},s=[]){let n=null;try{if(e.help){console.log(si());return}s.length>0&&qe(s.join(`
46
+ `)),t.length===0&&qe(`Missing required argument: source
47
+
48
+ ${si()}`),t.length>1&&qe(`Expected one source, received ${t.length}: ${t.join(", ")}`);let l=e.agent?.[0];l&&!mn[l]&&qe(di(l));let o=t[0],i=gt(o);Xe(i)?.split("/")[0]?.toLowerCase()==="openclaw"&&!e.dangerouslyAcceptOpenclawRisks&&qe(["OpenClaw skills are unverified community submissions.","Skills run with full agent permissions and could be malicious.",`If you understand the risks, re-run with: skills use ${o} --dangerously-accept-openclaw-risks`].join(`
49
+ `));let h=ka(i.skillFilter,e.skill),u=h!==void 0,m;if(i.type==="well-known"){let c=await bt.fetchAllSkills(i.url);m=ba(c,h,o);}else {let c,f=null;if(i.type==="local")existsSync(i.localPath)||qe(`Local path does not exist: ${i.localPath}`),c=await Pe(i.localPath,i.subpath,{includeInternal:u,fullDepth:e.fullDepth});else if(i.type==="github"&&!e.fullDepth){let A=Xe(i),S=A?.split("/")[0]?.toLowerCase();A&&S&&ua.includes(S)&&(f=await k$1(A,{subpath:i.subpath,skillFilter:h,ref:i.ref,getToken:rt,includeInternal:u})),f?c=f.skills:(n=await ze(i.url,i.ref),c=await Pe(n,i.subpath,{includeInternal:u,fullDepth:e.fullDepth}));}else n=await ze(i.url,i.ref),c=await Pe(n,i.subpath,{includeInternal:u,fullDepth:e.fullDepth});let x=ya(c,h,o);f&&va(x)?m={kind:"blob",name:x.name,directoryName:x.name,rawContent:x.rawContent??xa(x.files),files:x.files}:m={kind:"disk",name:x.name,directoryName:x.name,rawContent:x.rawContent,path:x.path};}let d=await ma(m);await ni(n),n=null;let p=pa({skillMd:d.skillMd,supportDir:d.skillDir,hasSupportingFiles:d.hasSupportingFiles});if(l){let c=await fa(l,p);c!==0&&process.exit(c);return}process.stdout.write(p);}catch(l){await ni(n),l instanceof Ke&&qe(l.message),l instanceof ye&&qe(l.message),qe(l instanceof Error?l.message:"Unknown error");}}async function fa(t,e,s=ha){let n=mn[t];if(!n)throw new ye(di(t));return new Promise((l,o)=>{let i=s(n.command,[...n.args,e],{stdio:"inherit"}),a=false;i.on("error",r=>{if(!a){if(a=true,r.code==="ENOENT"){o(new ye(`Could not launch ${D[t].displayName}: command not found: ${n.command}`));return}o(r);}}),i.on("close",r=>{a||(a=true,l(r??1));});})}function ha(t,e){return spawn(t,e,{stdio:"inherit"})}function si(){return `Usage: skills use <source>[@<skill>] [options]
50
+
51
+ Generate a prompt for using one skill without installing it.
52
+
53
+ Options:
54
+ -s, --skill <skill> Select the skill to use
55
+ -a, --agent <agent> Start one supported agent interactively (${oi.join(", ")})
56
+ --full-depth Search nested directories like skills add --full-depth
57
+ --dangerously-accept-openclaw-risks
58
+ Allow unverified OpenClaw community skills
59
+ -h, --help Show this help message
60
+
61
+ Examples:
62
+ skills use houjallen/agent-skills@web-design-guidelines | claude
63
+ skills use houjallen/agent-skills --skill web-design-guidelines --agent claude-code
64
+ skills use houjallen/agent-skills@web-design-guidelines --agent codex`}function ka(t,e){if(t&&e){if(t.toLowerCase()!==e.toLowerCase())throw new ye(`Conflicting skill selectors: source selects "${t}" but --skill selects "${e}". Provide one selector.`);return e}return e??t}function ya(t,e,s){if(t.length===0)throw new ye("No valid skills found. Skills require a SKILL.md with name and description.");if(!e){if(t.length===1)return t[0];throw new ye(ci(s,t.map(le)))}let n=es(t,[e]);if(n.length===0)throw new ye(ui(e,t.map(le)));if(n.length>1)throw new ye(`Skill selector "${e}" matched multiple skills.`);return n[0]}function ba(t,e,s){if(t.length===0)throw new ye("No skills found at this URL. Make sure the server has a /.well-known/agent-skills/index.json or /.well-known/skills/index.json file.");let n;if(e){if(n=t.filter(o=>o.installName.toLowerCase()===e.toLowerCase()||o.name.toLowerCase()===e.toLowerCase()),n.length===0)throw new ye(ui(e,t.map(o=>o.installName)));if(n.length>1)throw new ye(`Skill selector "${e}" matched multiple skills.`)}else {if(t.length!==1)throw new ye(ci(s,t.map(o=>o.installName)));n=t;}let l=n[0];return {kind:"well-known",name:l.name,directoryName:l.installName,rawContent:l.content,files:l.files}}function ci(t,e){return ["This source contains multiple skills. Specify exactly one skill:",...e.map(s=>` - ${s}`),"",`Examples:
65
+ skills use ${t}@${e[0]??"<skill>"}
66
+ skills use ${t} --skill ${e[0]??"<skill>"}`].join(`
67
+ `)}function ui(t,e){return [`No matching skill found for: ${t}`,"Available skills:",...e.map(s=>` - ${s}`)].join(`
68
+ `)}function wa(t){if(!t||t.length===0)return [];let e=[],s=Object.keys(D),n=t.filter(l=>l!=="*"&&!s.includes(l));return t.includes("*")&&e.push("skills use --agent does not support '*'; specify exactly one agent."),t.length>1&&e.push("skills use --agent accepts exactly one agent."),n.length>0&&e.push(`Invalid agents: ${n.join(", ")}
69
+ Valid agents: ${s.join(", ")}`),e}function di(t){return [`Running ${D[t].displayName} is not supported yet.`,`Supported agents for skills use --agent: ${oi.join(", ")}`].join(`
70
+ `)}async function $a(t,e){for(let s of e)await gi(t,s.path,s.contents);}async function Sa(t,e){for(let[s,n]of e)await gi(t,s,n);}async function gi(t,e,s){let n=join(t,e);fn(t,n)&&(await mkdir(dirname(n),{recursive:true}),typeof s=="string"?await writeFile(n,s,"utf-8"):await writeFile(n,s));}async function pi(t,e){await mkdir(e,{recursive:true});let s=await readdir(t,{withFileTypes:true});await Promise.all(s.filter(n=>!Aa(n.name,n.isDirectory())).map(async n=>{let l=join(t,n.name),o=join(e,n.name);if(fn(e,o)){if(n.isDirectory()){await pi(l,o);return}try{await cp(l,o,{dereference:!0,recursive:!0});}catch(i){if(i instanceof Error&&"code"in i&&i.code==="ENOENT"&&n.isSymbolicLink()){console.error(`Skipping broken symlink: ${l}`);return}throw i}}}));}async function mi(t,e){let s=await readdir(e,{withFileTypes:true});for(let n of s){let l=join(e,n.name),o=relative(t,l).split(sep).join("/");if(n.isDirectory()){if(await mi(t,l))return true}else if(o.toLowerCase()!=="skill.md")return true}return false}function va(t){return Array.isArray(t.files)}function xa(t){return t.find(s=>s.path.toLowerCase()==="skill.md")?.contents??""}function Aa(t,e){return da.has(t)||e&&ga.has(t)}function fn(t,e){let s=normalize(resolve(t)),n=normalize(resolve(e));return n.startsWith(s+sep)||n===s}async function ni(t){t&&await st(t).catch(()=>{});}function qe(t){console.error(t),process.exit(1);}var ye=class extends Error{};var fi={languages:[{value:"zh-CN",name:"\u7B80\u4F53\u4E2D\u6587",example:"\u4F60\u597D\uFF0CEASBOT\uFF01",supported:true},{value:"en-US",name:"English (United States)",example:"Hello, EASBOT!",supported:true}]};var La=fi.languages,Pa=La.filter(t=>t.supported).map(t=>t.value),dt={defaultLocale:"zh-CN",locales:Pa},Ht={},vs=(t,e)=>{let s=Ht[t]||{translation:{}};return Ht[t]={translation:{...s.translation,...e.translation}},Ht[t]},xs=(t=dt.defaultLocale)=>(Ht[t]||vs(t,{translation:{}}),{locale:t,resources:Ht[t]||{translation:{}}});var Ta={translation:{"cli.banner.tagline":"easbot-skills \u2014 Agent \u6280\u80FD\u751F\u6001","cli.banner.try_hint":"\u8BD5\u8BD5:","cli.banner.discover":"\u5728 {{url}} \u53D1\u73B0\u66F4\u591A\u6280\u80FD","cli.banner.cmd.add":"{{cmd}} add {{dim}}<package>{{reset}} \u6DFB\u52A0\u65B0\u6280\u80FD","cli.banner.cmd.use":"{{cmd}} use {{dim}}<package>@<skill>{{reset}} \u4E0D\u5B89\u88C5\u76F4\u63A5\u4F7F\u7528\u4E00\u4E2A\u6280\u80FD","cli.banner.cmd.remove":"{{cmd}} remove \u79FB\u9664\u5DF2\u5B89\u88C5\u6280\u80FD","cli.banner.cmd.list":"{{cmd}} list \u5217\u51FA\u5DF2\u5B89\u88C5\u6280\u80FD","cli.banner.cmd.find":"{{cmd}} find {{dim}}[query]{{reset}} \u641C\u7D22\u6280\u80FD","cli.banner.cmd.update":"{{cmd}} update \u66F4\u65B0\u5DF2\u5B89\u88C5\u6280\u80FD","cli.banner.cmd.install":"{{cmd}} experimental_install \u4ECE skills-lock.json \u8FD8\u539F","cli.banner.cmd.init":"{{cmd}} init {{dim}}[name]{{reset}} \u521B\u5EFA\u4E00\u4E2A\u65B0\u6280\u80FD","cli.banner.cmd.sync":"{{cmd}} experimental_sync \u4ECE node_modules \u540C\u6B65\u6280\u80FD","cli.help.usage":"\u7528\u6CD5: skills <command> [options]","cli.help.section.manage":"\u6280\u80FD\u7BA1\u7406","cli.help.section.find_options":"Find \u9009\u9879","cli.help.section.updates":"\u66F4\u65B0","cli.help.section.update_options":"Update \u9009\u9879","cli.help.section.project":"\u9879\u76EE","cli.help.section.add_options":"Add \u9009\u9879","cli.help.section.use_options":"Use \u9009\u9879","cli.help.section.remove_options":"Remove \u9009\u9879","cli.help.section.sync_options":"\u5B9E\u9A8C\u6027 Sync \u9009\u9879","cli.help.section.list_options":"List \u9009\u9879","cli.help.section.options":"\u901A\u7528\u9009\u9879","cli.help.remove.usage":"\u7528\u6CD5: easbot-skills remove [skills...] [options]","cli.help.remove.description":"\u4ECE Agent \u4E2D\u79FB\u9664\u5DF2\u5B89\u88C5\u6280\u80FD\u3002\u672A\u4F20\u6280\u80FD\u540D\u65F6\u8FDB\u5165\u4EA4\u4E92\u5F0F\u9009\u62E9\u83DC\u5355\u3002","cli.help.remove.arguments":"skills \u53EF\u9009\u6280\u80FD\u540D\uFF08\u7A7A\u683C\u5206\u9694\uFF09","cli.example.add":"\u6DFB\u52A0\u4E00\u4E2A\u6280\u80FD\u5305","cli.example.use":"\u4E00\u6B21\u6027\u4F7F\u7528\u67D0\u4E2A\u6280\u80FD","cli.example.use_with_agent":"\u6307\u5B9A\u6280\u80FD + Agent","cli.example.add_global":"\u5168\u5C40\u5B89\u88C5","cli.example.add_multi_agent":"\u5B89\u88C5\u5230\u591A\u4E2A Agent","cli.example.add_multi_skill":"\u5B89\u88C5\u591A\u4E2A\u6280\u80FD","cli.example.remove_interactive":"\u4EA4\u4E92\u5F0F\u5220\u9664","cli.example.remove_by_name":"\u6309\u540D\u79F0\u5220\u9664","cli.example.remove_global":"\u4ECE\u5168\u5C40\u8303\u56F4\u5220\u9664","cli.example.remove_by_agent":"\u4ECE\u6307\u5B9A Agent \u5220\u9664","cli.example.remove_all":"\u5220\u9664\u5168\u90E8","cli.example.remove_agent_all":"\u5220\u9664\u6307\u5B9A Agent \u7684\u6240\u6709\u6280\u80FD","cli.example.list_project":"\u5217\u51FA\u9879\u76EE\u7EA7\u6280\u80FD","cli.example.list_global":"\u5217\u51FA\u5168\u5C40\u6280\u80FD","cli.example.list_filter_agent":"\u6309 Agent \u8FC7\u6EE4","cli.example.list_json":"JSON \u8F93\u51FA","cli.example.find_interactive":"\u4EA4\u4E92\u5F0F\u641C\u7D22","cli.example.find_keyword":"\u6309\u5173\u952E\u5B57\u641C\u7D22","cli.example.find_owner":"\u5728\u6307\u5B9A owner \u4E0B\u641C\u7D22","cli.example.update_one":"\u66F4\u65B0\u5355\u4E2A\u6280\u80FD","cli.example.update_global":"\u4EC5\u66F4\u65B0\u5168\u5C40\u6280\u80FD","cli.example.install":"\u4ECE\u9501\u5B9A\u6587\u4EF6\u8FD8\u539F","cli.example.init":"\u521B\u5EFA\u65B0\u6280\u80FD","cli.example.sync":"\u4ECE node_modules \u540C\u6B65","cli.example.sync_no_prompt":"\u540C\u6B65\u4E14\u8DF3\u8FC7\u786E\u8BA4","cli.example.help":"\u663E\u793A\u6B64\u5E2E\u52A9","cli.init.exists":"\u6280\u80FD\u5DF2\u5B58\u5728: {{path}}","cli.init.created":"\u5DF2\u521B\u5EFA\u6280\u80FD: {{name}}","cli.init.created_label":"\u5DF2\u521B\u5EFA","cli.init.next.title":"\u4E0B\u4E00\u6B65","cli.init.next.edit":"\u7F16\u8F91 {{path}} \u5B9A\u4E49\u6280\u80FD\u6307\u4EE4","cli.init.next.frontmatter":"\u66F4\u65B0 frontmatter \u4E2D\u7684 name \u4E0E description","cli.init.publish.title":"\u53D1\u5E03\u65B9\u5F0F","cli.init.publish.github":"\u63A8\u9001\u5230\u4ED3\u5E93\u540E\u4F7F\u7528 {{cmd}} add <owner>/<repo>","cli.init.publish.url":"\u6258\u7BA1\u6587\u4EF6\u540E\u4F7F\u7528 {{cmd}} add https://example.com/{{path}}","cli.init.browse_hint":"\u5728 {{url}} \u6D4F\u89C8\u5176\u4ED6\u6280\u80FD\u83B7\u53D6\u7075\u611F","cli.unknown_command":"\u672A\u77E5\u547D\u4EE4: {{command}}","cli.help_hint":"\u8FD0\u884C {{cmd}} --help \u67E5\u770B\u7528\u6CD5"}},hi=Ta;var Da={translation:{"cli.banner.tagline":"easbot-skills \u2014 agent skills ecosystem","cli.banner.try_hint":"try:","cli.banner.discover":"Discover more skills at {{url}}","cli.banner.cmd.add":"{{cmd}} add {{dim}}<package>{{reset}} Add a new skill","cli.banner.cmd.use":"{{cmd}} use {{dim}}<package>@<skill>{{reset}} Use a skill without installing","cli.banner.cmd.remove":"{{cmd}} remove Remove installed skills","cli.banner.cmd.list":"{{cmd}} list List installed skills","cli.banner.cmd.find":"{{cmd}} find {{dim}}[query]{{reset}} Search for skills","cli.banner.cmd.update":"{{cmd}} update Update installed skills","cli.banner.cmd.install":"{{cmd}} experimental_install Restore from skills-lock.json","cli.banner.cmd.init":"{{cmd}} init {{dim}}[name]{{reset}} Create a new skill","cli.banner.cmd.sync":"{{cmd}} experimental_sync Sync skills from node_modules","cli.help.usage":"Usage: skills <command> [options]","cli.help.section.manage":"Manage Skills","cli.help.section.find_options":"Find Options","cli.help.section.updates":"Updates","cli.help.section.update_options":"Update Options","cli.help.section.project":"Project","cli.help.section.add_options":"Add Options","cli.help.section.use_options":"Use Options","cli.help.section.remove_options":"Remove Options","cli.help.section.sync_options":"Experimental Sync Options","cli.help.section.list_options":"List Options","cli.help.section.options":"Options","cli.help.remove.usage":"Usage: easbot-skills remove [skills...] [options]","cli.help.remove.description":"Remove installed skills from agents. If no skill names are provided, an interactive selection menu will be shown.","cli.help.remove.arguments":"skills Optional skill names to remove (space-separated)","cli.example.add":"Add a skill package","cli.example.use":"Use a skill one-shot","cli.example.use_with_agent":"Specify skill + agent","cli.example.add_global":"Install globally","cli.example.add_multi_agent":"Install to multiple agents","cli.example.add_multi_skill":"Install multiple skills","cli.example.remove_interactive":"Interactive remove","cli.example.remove_by_name":"Remove by name","cli.example.remove_global":"Remove from global scope","cli.example.remove_by_agent":"Remove from specific agent","cli.example.remove_all":"Remove all skills","cli.example.remove_agent_all":"Remove all skills from one agent","cli.example.list_project":"List project skills","cli.example.list_global":"List global skills","cli.example.list_filter_agent":"Filter by agent","cli.example.list_json":"JSON output","cli.example.find_interactive":"Interactive search","cli.example.find_keyword":"Search by keyword","cli.example.find_owner":"Search within an owner","cli.example.update_one":"Update a single skill","cli.example.update_global":"Update global skills only","cli.example.install":"Restore from lockfile","cli.example.init":"Create a new skill","cli.example.sync":"Sync from node_modules","cli.example.sync_no_prompt":"Sync without prompts","cli.example.help":"Show this help","cli.init.exists":"Skill already exists at {{path}}","cli.init.created":"Initialized skill: {{name}}","cli.init.created_label":"Created","cli.init.next.title":"Next steps","cli.init.next.edit":"Edit {{path}} to define your skill instructions","cli.init.next.frontmatter":"Update the name and description in the frontmatter","cli.init.publish.title":"Publishing","cli.init.publish.github":"Push to a repo, then {{cmd}} add <owner>/<repo>","cli.init.publish.url":"Host the file, then {{cmd}} add https://example.com/{{path}}","cli.init.browse_hint":"Browse existing skills for inspiration at {{url}}","cli.unknown_command":"Unknown command: {{command}}","cli.help_hint":"Run {{cmd}} --help for usage"}},ki=Da;var Na=()=>{xs("zh-CN"),xs("en-US"),vs("zh-CN",hi),vs("en-US",ki);};Na();var hn=new Map;var kn=new Map;var Ea=t=>{if(kn.has(t))return kn.get(t);let e=/{{\s*(\w+)\s*}}/g,s=[],n;for(;(n=e.exec(t))!==null;){let i=n[1];i&&!s.includes(i)&&s.push(i);}let l=new RegExp("{{\\s*("+s.join("|")+")\\s*}}","g"),o={keys:s,regex:l};return kn.set(t,o),o},yi=(t,e)=>{if(!t||typeof t!="string")return "";if(!e||Object.keys(e).length===0)return t;let{regex:s,keys:n}=Ea(t);return n.length===0||!n.some(o=>o in e)?t:t.replace(s,(o,i)=>{let a=e[i];return a==null?"":String(a)})},Ca=t=>{if(t&&dt.locales.includes(t))return t;let e=process.env.EASBOT_LANG?.trim()||process.env.LANG?.trim();if(e){let s=e.replace(/_/g,"-");if(dt.locales.includes(s))return s;let n=s.split("-")[0];if(n==="zh")return "zh-CN";if(n==="en")return "en-US"}return dt.defaultLocale},bi=t=>{if(!hn.has(t)){let{resources:e}=xs(t);hn.set(t,e);}return hn.get(t)},Ra=(t,e={})=>{let s=Ca(e.locale),l=bi(s)?.translation[t];if(l&&typeof l=="string"){let o=yi(l,e.vars);return o!=null?String(o):String(t)}if(s!==dt.defaultLocale){let i=bi(dt.defaultLocale)?.translation[t];if(i&&typeof i=="string"){let a=yi(i,e.vars);return a!=null?String(a):String(t)}}return String(e.fallback??t)},F=Ra;var v="\x1B[0m",re="\x1B[1m",L="\x1B[38;5;102m",xe="\x1B[38;5;145m";function Ma(t){return t&&vl(t),t??"0.0.0"}function Bt(t){return resolveLocaleLang(t?.locale)}function Wa(t){let e=Bt(t);console.log(),console.log(`${L}${F("cli.banner.tagline",{locale:e,fallback:"easbot-skills \u2014 agent skills ecosystem"})}${v}`),console.log(),console.log(` ${L}$${v} ${xe}easbot-skills add ${L}<package>${v} ${L}${F("cli.banner.cmd.add",{locale:e,vars:{cmd:"",dim:"",reset:""},fallback:"Add a new skill"})}${v}`),console.log(` ${L}$${v} ${xe}easbot-skills use ${L}<package>@<skill>${v} ${L}${F("cli.banner.cmd.use",{locale:e,vars:{cmd:"",dim:"",reset:""},fallback:"Use a skill without installing"})}${v}`),console.log(` ${L}$${v} ${xe}easbot-skills remove${v} ${L}${F("cli.example.remove_interactive",{locale:e,fallback:"Remove installed skills"})}${v}`),console.log(` ${L}$${v} ${xe}easbot-skills list${v} ${L}${F("cli.example.list_project",{locale:e,fallback:"List installed skills"})}${v}`),console.log(` ${L}$${v} ${xe}easbot-skills find ${L}[query]${v} ${L}${F("cli.example.find_interactive",{locale:e,fallback:"Search for skills"})}${v}`),console.log(),console.log(` ${L}$${v} ${xe}easbot-skills update${v} ${L}${F("cli.example.update_global",{locale:e,fallback:"Update installed skills"})}${v}`),console.log(),console.log(` ${L}$${v} ${xe}easbot-skills experimental_install${v} ${L}${F("cli.example.install",{locale:e,fallback:"Restore from skills-lock.json"})}${v}`),console.log(` ${L}$${v} ${xe}easbot-skills init ${L}[name]${v} ${L}${F("cli.example.init",{locale:e,fallback:"Create a new skill"})}${v}`),console.log(` ${L}$${v} ${xe}easbot-skills experimental_sync${v} ${L}${F("cli.example.sync",{locale:e,fallback:"Sync skills from node_modules"})}${v}`),console.log(),console.log(`${L}${F("cli.banner.try_hint",{locale:e,fallback:"try:"})}${v} easbot-skills add houjallen/agent-skills`),console.log(),console.log(`${L}${F("cli.banner.discover",{locale:e,vars:{url:"https://skills.sh/"},fallback:"Discover more skills at https://skills.sh/"})}${v}`),console.log();}function pp(t){let e=Bt(t),s=(n,l)=>L+F(n,{locale:e,fallback:l})+v;console.log(`
71
+ ${re}${F("cli.help.usage",{locale:e,fallback:"Usage: skills <command> [options]"})}${v}
72
+
73
+ ${re}${F("cli.help.section.manage",{locale:e,fallback:"Manage Skills"})}${v}:
74
+ add <package> Add a skill package (alias: a)
75
+ e.g. houjallen/agent-skills
76
+ https://github.com/houjallen/agent-skills
77
+ use <package>@<skill>
78
+ Generate a prompt for using one skill without installing it
79
+ remove [skills] Remove installed skills
80
+ list, ls List installed skills
81
+ find [query] Search for skills interactively
82
+
83
+ ${re}${F("cli.help.section.find_options",{locale:e,fallback:"Find Options"})}${v}:
84
+ --owner <owner> Search only repositories from a GitHub owner
85
+
86
+ ${re}${F("cli.help.section.updates",{locale:e,fallback:"Updates"})}${v}:
87
+ update [skills...] Update skills to latest versions (alias: upgrade)
88
+
89
+ ${re}${F("cli.help.section.update_options",{locale:e,fallback:"Update Options"})}${v}:
90
+ -g, --global Update global skills only
91
+ -p, --project Update project skills only
92
+ -y, --yes Skip scope prompt (auto-detect: project if in a project, else global)
93
+
94
+ ${re}${F("cli.help.section.project",{locale:e,fallback:"Project"})}${v}:
95
+ experimental_install Restore skills from skills-lock.json
96
+ init [name] Initialize a skill (creates <name>/SKILL.md or ./SKILL.md)
97
+ experimental_sync Sync skills from node_modules into agent directories
98
+
99
+ ${re}${F("cli.help.section.add_options",{locale:e,fallback:"Add Options"})}${v}:
100
+ -g, --global Install skill globally (user-level) instead of project-level
101
+ -a, --agent <agents> Specify agents to install to (use '*' for all agents)
102
+ -s, --skill <skills> Specify skill names to install (use '*' for all skills)
103
+ -l, --list List available skills in the repository without installing
104
+ -y, --yes Skip confirmation prompts
105
+ --copy Copy files instead of symlinking to agent directories
106
+ --subagent <names> Install to Eve subagents (use 'root' for the root agent)
107
+ --all Shorthand for --skill '*' --agent '*' -y
108
+ --full-depth Search all subdirectories even when a root SKILL.md exists
109
+
110
+ ${re}${F("cli.help.section.use_options",{locale:e,fallback:"Use Options"})}${v}:
111
+ -s, --skill <skill> Specify the skill to use
112
+ -a, --agent <agent> Start one supported agent interactively
113
+ --full-depth Search all subdirectories even when a root SKILL.md exists
114
+ --dangerously-accept-openclaw-risks
115
+ Allow unverified OpenClaw community skills
116
+
117
+ ${re}${F("cli.help.section.remove_options",{locale:e,fallback:"Remove Options"})}${v}:
118
+ -g, --global Remove from global scope
119
+ -a, --agent <agents> Remove from specific agents (use '*' for all agents)
120
+ -s, --skill <skills> Specify skills to remove (use '*' for all skills)
121
+ -y, --yes Skip confirmation prompts
122
+ --all Shorthand for --skill '*' --agent '*' -y
123
+
124
+ ${re}${F("cli.help.section.sync_options",{locale:e,fallback:"Experimental Sync Options"})}${v}:
125
+ -a, --agent <agents> Specify agents to install to (use '*' for all agents)
126
+ -y, --yes Skip confirmation prompts
127
+
128
+ ${re}${F("cli.help.section.list_options",{locale:e,fallback:"List Options"})}${v}:
129
+ -g, --global List global skills (default: project)
130
+ -a, --agent <agents> Filter by specific agents
131
+ --json Output as JSON (machine-readable, no ANSI codes)
132
+
133
+ ${re}${F("cli.help.section.options",{locale:e,fallback:"Options"})}${v}:
134
+ --help, -h Show this help message
135
+ --version, -v Show version number
136
+
137
+ ${re}Examples:${v}
138
+ ${L}$${v} easbot-skills add houjallen/agent-skills ${s("cli.example.add","Add a skill package")}
139
+ ${L}$${v} easbot-skills use houjallen/agent-skills@houjallen | claude ${s("cli.example.use","Use a skill one-shot")}
140
+ ${L}$${v} easbot-skills use houjallen/agent-skills --skill houjallen --agent claude ${s("cli.example.use_with_agent","Specify skill + agent")}
141
+ ${L}$${v} easbot-skills add houjallen/agent-skills -g ${s("cli.example.add_global","Install globally")}
142
+ ${L}$${v} easbot-skills add houjallen/agent-skills --agent claude-code cursor ${s("cli.example.add_multi_agent","Install to multiple agents")}
143
+ ${L}$${v} easbot-skills add houjallen/agent-skills --skill pr-review commit ${s("cli.example.add_multi_skill","Install multiple skills")}
144
+ ${L}$${v} easbot-skills remove ${L}# ${s("cli.example.remove_interactive","Interactive remove")}${v}
145
+ ${L}$${v} easbot-skills remove web-design ${L}# ${s("cli.example.remove_by_name","Remove by name")}${v}
146
+ ${L}$${v} easbot-skills rm --global frontend-design
147
+ ${L}$${v} easbot-skills list ${L}# ${s("cli.example.list_project","List project skills")}${v}
148
+ ${L}$${v} easbot-skills ls -g ${L}# ${s("cli.example.list_global","List global skills")}${v}
149
+ ${L}$${v} easbot-skills ls -a claude-code ${L}# ${s("cli.example.list_filter_agent","Filter by agent")}${v}
150
+ ${L}$${v} easbot-skills ls --json ${L}# ${s("cli.example.list_json","JSON output")}${v}
151
+ ${L}$${v} easbot-skills find ${L}# ${s("cli.example.find_interactive","Interactive search")}${v}
152
+ ${L}$${v} easbot-skills find typescript ${L}# ${s("cli.example.find_keyword","Search by keyword")}${v}
153
+ ${L}$${v} easbot-skills find react --owner houjallen ${L}# ${s("cli.example.find_owner","Search within an owner")}${v}
154
+ ${L}$${v} easbot-skills update
155
+ ${L}$${v} easbot-skills update my-skill ${L}# ${s("cli.example.update_one","Update a single skill")}${v}
156
+ ${L}$${v} easbot-skills update -g ${L}# ${s("cli.example.update_global","Update global skills only")}${v}
157
+ ${L}$${v} easbot-skills experimental_install ${L}# ${s("cli.example.install","Restore from lockfile")}${v}
158
+ ${L}$${v} easbot-skills init my-skill ${L}# ${s("cli.example.init","Create a new skill")}${v}
159
+ ${L}$${v} easbot-skills experimental_sync ${L}# ${s("cli.example.sync","Sync from node_modules")}${v}
160
+ ${L}$${v} easbot-skills experimental_sync -y ${L}# ${s("cli.example.sync_no_prompt","Sync without prompts")}${v}
161
+
162
+ ${L}${F("cli.banner.discover",{locale:e,vars:{url:"https://skills.sh/"},fallback:"Discover more skills at https://skills.sh/"})}${v}
163
+ `);}function Ka(t){let e=Bt(t);console.log(`
164
+ ${re}${F("cli.help.remove.usage",{locale:e,fallback:"Usage: easbot skills remove [skills...] [options]"})}${v}
165
+
166
+ ${re}Description:${v}
167
+ ${F("cli.help.remove.description",{locale:e,fallback:"Remove installed skills from agents. If no skill names are provided, an interactive selection menu will be shown."})}
168
+
169
+ ${re}Arguments:${v}
170
+ ${F("cli.help.remove.arguments",{locale:e,fallback:"skills Optional skill names to remove (space-separated)"})}
171
+
172
+ ${re}Options:${v}
173
+ -g, --global Remove from global scope (~/) instead of project scope
174
+ -a, --agent Remove from specific agents (use '*' for all agents)
175
+ -s, --skill Specify skills to remove (use '*' for all skills)
176
+ -y, --yes Skip confirmation prompts
177
+ --all Shorthand for --skill '*' --agent '*' -y
178
+
179
+ ${re}Examples:${v}
180
+ ${L}$${v} easbot-skills remove ${L}# ${F("cli.example.remove_interactive",{locale:e,fallback:"Interactive remove"})}${v}
181
+ ${L}$${v} easbot-skills remove my-skill ${L}# ${F("cli.example.remove_by_name",{locale:e,fallback:"Remove by name"})}${v}
182
+ ${L}$${v} easbot-skills remove skill1 skill2 -y ${L}# ${F("cli.example.remove_all",{locale:e,fallback:"Remove multiple skills"})}${v}
183
+ ${L}$${v} easbot-skills remove --global my-skill ${L}# ${F("cli.example.remove_global",{locale:e,fallback:"Remove from global scope"})}${v}
184
+ ${L}$${v} easbot-skills rm --agent claude-code my-skill ${L}# ${F("cli.example.remove_by_agent",{locale:e,fallback:"Remove from specific agent"})}${v}
185
+ ${L}$${v} easbot-skills remove --all ${L}# ${F("cli.example.remove_all",{locale:e,fallback:"Remove all skills"})}${v}
186
+ ${L}$${v} easbot-skills remove --skill '*' -a cursor ${L}# ${F("cli.example.remove_agent_all",{locale:e,fallback:"Remove all skills from one agent"})}${v}
187
+
188
+ ${L}${F("cli.banner.discover",{locale:e,vars:{url:"https://skills.sh/"},fallback:"Discover more skills at https://skills.sh/"})}${v}
189
+ `);}function Gt(){console.log();}function za(t,e){let s=Bt(e),n=e?.cwd??pt()??process.cwd(),l=t[0]||basename(n),o=t[0]!==void 0,i=o?join(n,l):n,a=join(i,"SKILL.md"),r=o?`${l}/SKILL.md`:"SKILL.md";if(existsSync(a))return console.log(`${xe}${F("cli.init.exists",{locale:s,vars:{path:r},fallback:`Skill already exists at ${r}`})}${v}`),0;o&&mkdirSync(i,{recursive:true});let h=`---
190
+ name: ${l}
191
+ description: A brief description of what this skill does
192
+ ---
193
+
194
+ # ${l}
195
+
196
+ Instructions for the agent to follow when this skill is activated.
197
+
198
+ ## When to use
199
+
200
+ Describe when this skill should be used.
201
+
202
+ ## Instructions
203
+
204
+ 1. First step
205
+ 2. Second step
206
+ 3. Additional steps as needed
207
+ `;return writeFileSync(a,h),console.log(`${xe}${F("cli.init.created",{locale:s,vars:{name:l},fallback:`Initialized skill: ${l}`})}${v}`),console.log(),console.log(`${L}${F("cli.init.created_label",{locale:s,fallback:"Created"})}${v}:`),console.log(` ${r}`),console.log(),console.log(`${L}${F("cli.init.next.title",{locale:s,fallback:"Next steps"})}${v}:`),console.log(` 1. ${F("cli.init.next.edit",{locale:s,vars:{path:r},fallback:`Edit ${r} to define your skill instructions`})}`),console.log(` 2. ${F("cli.init.next.frontmatter",{locale:s,fallback:"Update the name and description in the frontmatter"})}`),console.log(),console.log(`${L}${F("cli.init.publish.title",{locale:s,fallback:"Publishing"})}${v}:`),console.log(` ${L}GitHub:${v} ${F("cli.init.publish.github",{locale:s,vars:{cmd:"easbot skills"},fallback:"Push to a repo, then easbot skills add <owner>/<repo>"})}`),console.log(` ${L}URL:${v} ${F("cli.init.publish.url",{locale:s,vars:{cmd:"easbot skills",path:r},fallback:"Host the file, then easbot skills add https://example.com/"+r})}`),console.log(),console.log(`${L}${F("cli.init.browse_hint",{locale:s,vars:{url:"https://skills.sh/"},fallback:"Browse existing skills for inspiration at https://skills.sh/"})}${v}`),console.log(),0}async function mp(t,e){Ma(e?.version);let n=e?.inAgent??await as();if(t.length===0)return n||Wa(e),{code:0,handled:false};let l=t[0],o=t.slice(1);switch(l){case "find":case "search":case "f":case "s":return n||Gt(),console.log(),await El(o),{code:0,handled:true,command:l};case "init":return n||Gt(),console.log(),{code:za(o,e),handled:true,command:l};case "experimental_install":return n||Gt(),await Ul(o),{code:0,handled:true,command:l};case "i":case "install":case "a":case "add":{n||Gt();let{source:i,options:a}=hs(o);return await at(i,a),{code:0,handled:true,command:l}}case "use":{let{source:i,options:a,errors:r}=ri(o);return await ai(i,a,r),{code:0,handled:true,command:l}}case "remove":case "rm":case "r":{if(o.includes("--help")||o.includes("-h"))return Ka(e),{code:0,handled:true,command:l};let{skills:i,options:a}=Wl(o);return await Ss(i,a),{code:0,handled:true,command:l}}case "experimental_sync":{n||Gt();let{options:i}=bs(o);return await ys(o,i),{code:0,handled:true,command:l}}case "list":case "ls":return await Ol(o),{code:0,handled:true,command:l};case "check":case "update":case "upgrade":return await Zl(o),{code:0,handled:true,command:l};default:{let i=Bt(e);return console.log(F("cli.unknown_command",{locale:i,vars:{command:l??""},fallback:`Unknown command: ${l}`})),console.log(F("cli.help_hint",{locale:i,vars:{cmd:"skills"},fallback:"Run skills --help for usage."})),{code:1,handled:true,command:l}}}}
208
+ export{he as $,Ss as $a,Ot as A,pl as Aa,Ac as B,Ne as Ba,Ic as C,gs as Ca,so as D,Pu as Da,Lc as E,Tu as Ea,Pc as F,rt as Fa,Tc as G,Du as Ga,Dc as H,tn as Ha,Ue as I,ml as Ia,Ft as J,fl as Ja,no as K,hl as Ka,Nc as L,Nu as La,Ec as M,kl as Ma,pt as N,zt as Na,ao as O,sn as Oa,D as P,nn as Pa,Be as Q,vl as Qa,Fc as R,at as Ra,Os as S,hs as Sa,lt as T,Lr as Ta,Ye as U,Nl as Ua,ss as V,El as Va,Mt as W,ys as Wa,$e as X,bs as Xa,el as Y,Ul as Ya,tl as Z,Wr as Za,Kc as _,Ol as _a,Xe as a,je as aa,Wl as ab,Xt as b,kt as ba,qr as bb,Et as c,De as ca,Jr as cb,Ps as d,os as da,Xr as db,gt as e,rs as ea,Yl as eb,xn as f,Hs as fa,Zl as fb,Ke as g,Qe as ga,ri as gb,ji as h,eu as ha,pa as hb,Oi as i,rl as ia,ma as ib,Tn as j,Gs as ja,ai as jb,ze as k,al as ka,fa as kb,st as l,cl as la,Wa as lb,Cn as m,Js as ma,pp as mb,Le as n,ul as na,mp as nb,Rn as o,be as oa,He as p,nu as pa,Ct as q,et as qa,ic as r,as as ra,eo as s,au as sa,Ge as t,cs as ta,to as u,us as ua,Pe as v,No as va,le as w,Eo as wa,es as x,Co as xa,vc as y,ds as ya,xc as z,bt as za};