@easbot/skills 0.2.49 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +31 -31
- package/dist/index.mjs +31 -31
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {a,b as b$1,d,e,k as k$1,h,i,j as j$1,c}from'./chunks/chunk-MH2XZDJ5.mjs';export{e as BLOB_ALLOWED_REPOS,h as fetchRepoTree,j as findSkillMdPaths,i as getSkillFolderHashFromTree,b as parseFrontmatter,g as resetRepoTreeAuthState,d as sanitizeMetadata,c as stripTerminalEscapes,f as toSkillSlug,k as tryBlobInstall}from'./chunks/chunk-MH2XZDJ5.mjs';import {existsSync,readdirSync,readFileSync,mkdirSync,writeFileSync}from'fs';import {join,dirname,relative,normalize,resolve,sep,basename,extname,isAbsolute}from'path';import {xdgConfig,xdgState,xdgData,xdgCache}from'xdg-basedir';import {homedir,tmpdir,platform}from'os';import {readFile,writeFile,readdir,mkdir,cp,access,rm,stat,mkdtemp,lstat,realpath,readlink,symlink}from'fs/promises';import {createHash}from'crypto';import*as y from'@clack/prompts';import k from'picocolors';import*as Ss from'readline';import {promisify,stripVTControlCharacters}from'util';import {Writable}from'stream';import tr from'simple-git';import {execFile,execSync,spawn,spawnSync}from'child_process';import {determineAgent}from'@vercel/detect-agent';import {gunzipSync,inflateRawSync}from'zlib';import {fileURLToPath}from'url';var Mt=null,Wt=null,Kt=null;function Hi(t){Mt=t;}function zi(){Mt=null;}function kt(){if(Mt)return Mt;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 Gi(t){Wt=t;}function Bi(){Wt=null;}function qn(){if(Wt)return Wt;let t=process.cwd();return {directory:t,worktree:t}}function Vi(t){Kt=t,t&&(Mt=t.global,Wt=t.instance);}function qi(){return Kt}function Ji(){return Kt!==null}function Xi(){if(!Kt)throw new Error("Skills agent adapter not set. Call setAgentAdapter() before using skills commands that depend on subAgentRunner.");return Kt}function Ne(){return kt().Path.home||homedir()}function yt(){let t=kt().Path.config;return t||(xdgConfig??join(Ne(),".config"))}function Jn(){let t=kt().Path.data;return t||(xdgData??join(Ne(),".local","share"))}function Yi(){let t=kt().Path.state;return t||(xdgState??join(Jn(),"state"))}function Zi(){let t=kt().Path.cache;return t||(xdgCache??join(Ne(),".cache"))}function ot(){return qn().directory||process.cwd()}var b=Ne(),Ee=yt()||xdgConfig||join(b,".config"),Xn=process.env.CODEX_HOME?.trim()||join(b,".codex"),Yn=process.env.CLAUDE_CONFIG_DIR?.trim()||join(b,".claude"),Zn=process.env.VIBE_HOME?.trim()||join(b,".vibe"),Qn=process.env.HERMES_HOME?.trim()||join(b,".hermes"),el=process.env.AUTOHAND_HOME?.trim()||join(b,".autohand"),tl=process.env.APPDATA?.trim(),sl=process.env.FLATPAK_XDG_CONFIG_HOME?.trim();function so(t,e){try{let s=JSON.parse(readFileSync(t,"utf-8"));return !!(s.dependencies?.[e]||s.devDependencies?.[e])}catch{return false}}function nl(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 T={easbot:{name:"easbot",displayName:"EASBot",skillsDir:".easbot/skills",get globalSkillsDir(){return join(yt(),"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(Ee,"agents/skills"),detectInstalled:async()=>existsSync(join(Ee,"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(el,"skills"),detectInstalled:async()=>existsSync(el)},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(Yn,"skills"),detectInstalled:async()=>existsSync(Yn)},openclaw:{name:"openclaw",displayName:"OpenClaw",skillsDir:"skills",globalSkillsDir:nl(),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(Xn,"skills"),detectInstalled:async()=>existsSync(Xn)||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(Ee,"devin/skills"),detectInstalled:async()=>existsSync(join(Ee,"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"))&&so(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(Ee,"goose/skills"),detectInstalled:async()=>existsSync(join(Ee,"goose"))},"hermes-agent":{name:"hermes-agent",displayName:"Hermes Agent",skillsDir:".hermes/skills",globalSkillsDir:join(Qn,"skills"),detectInstalled:async()=>existsSync(Qn)},"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(Zn,"skills"),detectInstalled:async()=>existsSync(Zn)},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(Ee,"opencode/skills"),detectInstalled:async()=>existsSync(join(Ee,"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(Ee,"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(Ee,"zed"))||!!tl&&existsSync(join(tl,"Zed"))||!!sl&&existsSync(join(sl,"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(Ee,"agents/skills"),showInUniversalList:false,detectInstalled:async()=>false}};async function Oe(){return (await Promise.all(Object.entries(T).map(async([e,s])=>({type:e,installed:await s.detectInstalled()})))).filter(e=>e.installed).map(e=>e.type)}function no(t){return T[t]}var ps=join("agent","subagents");function et(t=process.cwd()){let e=join(t,ps);if(!existsSync(e))return [];try{return readdirSync(e,{withFileTypes:!0}).filter(s=>s.isDirectory()).map(s=>s.name).sort()}catch{return []}}function qe(){return Object.entries(T).filter(([t,e])=>e.skillsDir===".agents/skills"&&e.showInUniversalList!==false).map(([t])=>t)}function Ht(){return Object.entries(T).filter(([t,e])=>e.skillsDir===".agents/skills"&&e.showInUniversalList!==false&&e.showInUniversalPrompt!==false).map(([t])=>t)}function bt(){return Object.entries(T).filter(([t,e])=>e.skillsDir!==".agents/skills").map(([t])=>t)}function we(t){return T[t].skillsDir===".agents/skills"}function zt(t,e){let s=normalize(resolve(e)),n=normalize(resolve(t));return n.startsWith(s+sep)||n===s}function rt(t){return t.startsWith("./")}async function il(t){let e=[],s=(n,l)=>{if(zt(n,t)){if(l&&l.length>0)for(let o of l){if(!rt(o))continue;let i=dirname(join(n,o));zt(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||rt(o))for(let a of l.plugins??[]){if(typeof a.source!="string"&&a.source!==void 0||a.source!==void 0&&!rt(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 ol(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||rt(l))for(let i of n.plugins??[]){if(!i.name||typeof i.source!="string"&&i.source!==void 0||i.source!==void 0&&!rt(i.source))continue;let a=join(t,l??"",i.source??"");if(zt(a,t)&&i.skills&&i.skills.length>0)for(let r of i.skills){if(!rt(r))continue;let h=join(a,r);zt(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(!rt(l))continue;let o=join(t,l);zt(o,t)&&e.set(resolve(o),n.name);}}catch{}return e}var uo="skills-lock.json",cl=1;function Ms(t){return join(t||process.cwd(),uo)}async function $e(t){let e=Ms(t);try{let s=await readFile(e,"utf-8"),n=JSON.parse(s);return typeof n.version!="number"||!n.skills||n.version<cl?js():n}catch{return js()}}async function Ws(t,e){let s=Ms(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)+`
|
|
2
|
-
`;await writeFile(s,o,"utf-8");}async function je(t){let e=[];await
|
|
1
|
+
import {a,b as b$1,d,e,k as k$1,h,i,j as j$1,c}from'./chunks/chunk-MH2XZDJ5.mjs';export{e as BLOB_ALLOWED_REPOS,h as fetchRepoTree,j as findSkillMdPaths,i as getSkillFolderHashFromTree,b as parseFrontmatter,g as resetRepoTreeAuthState,d as sanitizeMetadata,c as stripTerminalEscapes,f as toSkillSlug,k as tryBlobInstall}from'./chunks/chunk-MH2XZDJ5.mjs';import {existsSync,readdirSync,readFileSync,mkdirSync,writeFileSync}from'fs';import {join,dirname,relative,normalize,resolve,sep,basename,extname,isAbsolute}from'path';import {xdgConfig,xdgState,xdgData,xdgCache}from'xdg-basedir';import {homedir,tmpdir,platform}from'os';import {readFile,writeFile,readdir,mkdir,cp,access,rm,stat,mkdtemp,lstat,realpath,readlink,symlink}from'fs/promises';import {createHash}from'crypto';import*as y from'@clack/prompts';import k from'picocolors';import*as Ss from'readline';import {promisify,stripVTControlCharacters}from'util';import {Writable}from'stream';import sr from'simple-git';import {execFile,execSync,spawn,spawnSync}from'child_process';import {determineAgent}from'@vercel/detect-agent';import {gunzipSync,inflateRawSync}from'zlib';import {Log}from'@easbot/utils';import {fileURLToPath}from'url';var Mt=null,Wt=null,Kt=null;function zi(t){Mt=t;}function Gi(){Mt=null;}function kt(){if(Mt)return Mt;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 Bi(t){Wt=t;}function Vi(){Wt=null;}function Jn(){if(Wt)return Wt;let t=process.cwd();return {directory:t,worktree:t}}function qi(t){Kt=t,t&&(Mt=t.global,Wt=t.instance);}function Ji(){return Kt}function Xi(){return Kt!==null}function Yi(){if(!Kt)throw new Error("Skills agent adapter not set. Call setAgentAdapter() before using skills commands that depend on subAgentRunner.");return Kt}function Ne(){return kt().Path.home||homedir()}function yt(){let t=kt().Path.config;return t||(xdgConfig??join(Ne(),".config"))}function Xn(){let t=kt().Path.data;return t||(xdgData??join(Ne(),".local","share"))}function Zi(){let t=kt().Path.state;return t||(xdgState??join(Xn(),"state"))}function Qi(){let t=kt().Path.cache;return t||(xdgCache??join(Ne(),".cache"))}function ot(){return Jn().directory||process.cwd()}var b=Ne(),Ee=yt()||xdgConfig||join(b,".config"),Yn=process.env.CODEX_HOME?.trim()||join(b,".codex"),Zn=process.env.CLAUDE_CONFIG_DIR?.trim()||join(b,".claude"),Qn=process.env.VIBE_HOME?.trim()||join(b,".vibe"),el=process.env.HERMES_HOME?.trim()||join(b,".hermes"),tl=process.env.AUTOHAND_HOME?.trim()||join(b,".autohand"),sl=process.env.APPDATA?.trim(),nl=process.env.FLATPAK_XDG_CONFIG_HOME?.trim();function no(t,e){try{let s=JSON.parse(readFileSync(t,"utf-8"));return !!(s.dependencies?.[e]||s.devDependencies?.[e])}catch{return false}}function ll(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 T={easbot:{name:"easbot",displayName:"EASBot",skillsDir:".easbot/skills",get globalSkillsDir(){return join(yt(),"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(Ee,"agents/skills"),detectInstalled:async()=>existsSync(join(Ee,"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(tl,"skills"),detectInstalled:async()=>existsSync(tl)},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(Zn,"skills"),detectInstalled:async()=>existsSync(Zn)},openclaw:{name:"openclaw",displayName:"OpenClaw",skillsDir:"skills",globalSkillsDir:ll(),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(Yn,"skills"),detectInstalled:async()=>existsSync(Yn)||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(Ee,"devin/skills"),detectInstalled:async()=>existsSync(join(Ee,"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"))&&no(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(Ee,"goose/skills"),detectInstalled:async()=>existsSync(join(Ee,"goose"))},"hermes-agent":{name:"hermes-agent",displayName:"Hermes Agent",skillsDir:".hermes/skills",globalSkillsDir:join(el,"skills"),detectInstalled:async()=>existsSync(el)},"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(Qn,"skills"),detectInstalled:async()=>existsSync(Qn)},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(Ee,"opencode/skills"),detectInstalled:async()=>existsSync(join(Ee,"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(Ee,"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(Ee,"zed"))||!!sl&&existsSync(join(sl,"Zed"))||!!nl&&existsSync(join(nl,"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(Ee,"agents/skills"),showInUniversalList:false,detectInstalled:async()=>false}};async function Oe(){return (await Promise.all(Object.entries(T).map(async([e,s])=>({type:e,installed:await s.detectInstalled()})))).filter(e=>e.installed).map(e=>e.type)}function lo(t){return T[t]}var ps=join("agent","subagents");function et(t=process.cwd()){let e=join(t,ps);if(!existsSync(e))return [];try{return readdirSync(e,{withFileTypes:!0}).filter(s=>s.isDirectory()).map(s=>s.name).sort()}catch{return []}}function qe(){return Object.entries(T).filter(([t,e])=>e.skillsDir===".agents/skills"&&e.showInUniversalList!==false).map(([t])=>t)}function Ht(){return Object.entries(T).filter(([t,e])=>e.skillsDir===".agents/skills"&&e.showInUniversalList!==false&&e.showInUniversalPrompt!==false).map(([t])=>t)}function bt(){return Object.entries(T).filter(([t,e])=>e.skillsDir!==".agents/skills").map(([t])=>t)}function we(t){return T[t].skillsDir===".agents/skills"}function zt(t,e){let s=normalize(resolve(e)),n=normalize(resolve(t));return n.startsWith(s+sep)||n===s}function rt(t){return t.startsWith("./")}async function ol(t){let e=[],s=(n,l)=>{if(zt(n,t)){if(l&&l.length>0)for(let o of l){if(!rt(o))continue;let i=dirname(join(n,o));zt(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||rt(o))for(let a of l.plugins??[]){if(typeof a.source!="string"&&a.source!==void 0||a.source!==void 0&&!rt(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 rl(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||rt(l))for(let i of n.plugins??[]){if(!i.name||typeof i.source!="string"&&i.source!==void 0||i.source!==void 0&&!rt(i.source))continue;let a=join(t,l??"",i.source??"");if(zt(a,t)&&i.skills&&i.skills.length>0)for(let r of i.skills){if(!rt(r))continue;let h=join(a,r);zt(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(!rt(l))continue;let o=join(t,l);zt(o,t)&&e.set(resolve(o),n.name);}}catch{}return e}var po="skills-lock.json",ul=1;function Ms(t){return join(t||process.cwd(),po)}async function $e(t){let e=Ms(t);try{let s=await readFile(e,"utf-8"),n=JSON.parse(s);return typeof n.version!="number"||!n.skills||n.version<ul?js():n}catch{return js()}}async function Ws(t,e){let s=Ms(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)+`
|
|
2
|
+
`;await writeFile(s,o,"utf-8");}async function je(t){let e=[];await dl(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 dl(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 dl(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 wt(t,e,s){let n=await $e(s);n.skills[t]=e,await Ws(n,s);}async function go(t,e){let s=await $e(e);return t in s.skills?(delete s.skills[t],await Ws(s,e),true):false}function js(){return {version:ul,skills:{}}}var Gs=["node_modules",".git","dist","build","__pycache__"],gl=[".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 Ks(t){return t.toLowerCase().replace(/[\s_]+/g,"-")}function yo(t){return t.split(sep).join("/").replace(/\/+/g,"/")}function hl(){let t=process.env.INSTALL_INTERNAL_SKILLS;return t==="1"||t==="true"}async function Bs(t){try{let e=join(t,"SKILL.md");return (await stat(e)).isFile()}catch{return false}}async function Me(t,e){try{let s=await readFile(t,"utf-8"),{data:n}=b$1(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&&!hl()&&!e?.includeInternal?null:{name:d(n.name),description:d(n.description),path:dirname(t),rawContent:s,metadata:l}}catch{return null}}async function kl(t,e=0,s=5){if(e>s)return [];try{let[n,l]=await Promise.all([Bs(t),readdir(t,{withFileTypes:!0}).catch(()=>[])]),o=n?[t]:[],i=await Promise.all(l.filter(a=>a.isDirectory()&&!Gs.includes(a.name)).map(a=>kl(join(t,a.name),e+1,s)));return [...o,...i.flat()]}catch{return []}}function yl(t,e){let s=normalize(resolve(t)),n=normalize(resolve(join(t,e)));return n.startsWith(s+sep)||n===s}async function ve(t,e,s){let n=[],l=new Set,o=await $e(t),i=new Set(Object.keys(o.skills).map(Ks));if(e&&!yl(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 rl(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=yo(relative(t,c.path));if(!gl.some(E=>f===E||f.startsWith(`${E}/`)))return false;let A=Ks(c.name),$=Ks(basename(c.path));return i.has(A)||i.has($)};if(await Bs(a)){let c=await Me(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"),...gl.map(c=>join(a,c))],d=new Set(m.slice(1));m.push(...await ol(a));let g=async c=>{if(!await Bs(c))return false;let f=await Me(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 $=join(c,A.name);if(!(await g($)||!f)&&!Gs.includes(A.name))try{let D=await readdir($,{withFileTypes:!0});for(let F of D)!F.isDirectory()||Gs.includes(F.name)||await g(join($,F.name));}catch{}}}catch{}}if(n.length===0||s?.fullDepth){let c=await kl(a);for(let f of c){let x=await Me(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 Gt(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 Vs=".agents",qs="skills",bo=".agents/skills";function me(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 wl(t,e){return ie(t,e)||ie(e,t)}async function Sl(t,e){if(t.isDirectory())return true;if(!t.isSymbolicLink())return false;try{return (await stat(e)).isDirectory()}catch{return false}}function Ce(t,e){let s=t?Ne()||homedir():e||ot()||process.cwd();return join(s,Vs,qs)}function ct(t,e){let s=e||ot()||process.cwd();return join(s,ps,me(t),"skills")}function Ae(t,e,s,n){if(we(t))return Ce(e,s);if(t==="eve"&&n)return ct(n,s);let l=T[t],o=Ne()||homedir(),i=e?o:s||ot()||process.cwd();return e?l.globalSkillsDir===void 0?join(i,l.skillsDir):l.globalSkillsDir:join(i,l.skillsDir)}function Do(t,e){return resolve(dirname(t),e)}async function xe(t){try{await rm(t,{recursive:!0,force:!0});}catch{}await mkdir(t,{recursive:true});}async function Js(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 ks(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 Js(t),a=await Js(e);if(i===a)return !0;try{if((await lstat(e)).isSymbolicLink()){let c=await readlink(e);if(Do(e,c)===s)return !0;await rm(e);}else await rm(e,{recursive:!0});}catch(g){if(g&&typeof g=="object"&&"code"in g&&g.code==="ELOOP")try{await rm(e,{force:!0});}catch{}}let r=dirname(e);await mkdir(r,{recursive:!0});let h=await Js(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 qt(t,e,s={}){let n=T[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=me(a),h=s.mode??"symlink",u=e==="eve"&&h==="symlink"?Ae(e,l,o,i):Ce(l,o),m=join(u,r),d=Ae(e,l,o,i),g=join(d,r);if(!ie(u,m))return {success:false,path:g,mode:h,error:"Invalid skill name: potential path traversal detected"};if(!ie(d,g))return {success:false,path:g,mode:h,error:"Invalid skill name: potential path traversal detected"};try{if(wl(t.path,g))return {success:!0,path:g,mode:h,skipped:!0};if(h==="copy")return await xe(g),await fs(t.path,g,e),{success:!0,path:g,mode:"copy"};if(wl(t.path,m))return {success:!0,path:m,canonicalPath:m,mode:"symlink",skipped:!0};if(await xe(m),await fs(t.path,m,e),l&&we(e))return {success:!0,path:m,canonicalPath:m,mode:"symlink"};if(!l&&!we(e)){let f=join(o,T[e].skillsDir.split("/")[0]);if(!existsSync(f))return {success:!0,path:m,canonicalPath:m,mode:"symlink",skipped:!0}}return await ks(m,g)?{success:!0,path:g,canonicalPath:m,mode:"symlink"}:(await xe(g),await fs(t.path,g,e),{success:!0,path:g,canonicalPath:m,mode:"symlink",symlinkFailed:!0})}catch(c){return {success:false,path:g,mode:h,error:c instanceof Error?c.message:"Unknown error"}}}var To=new Set(["metadata.json"]),No=new Set([".git","__pycache__","__pypackages__"]),Eo=(t,e=false)=>!!(To.has(t)||e&&No.has(t));function tt(t){let{data:e,content:s}=b$1(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,""):`---
|
|
3
3
|
${l.map(i=>`${i}: ${JSON.stringify(n[i])}`).join(`
|
|
4
4
|
`)}
|
|
5
5
|
---
|
|
6
|
-
${s.replace(/^\r?\n/u,"")}`}async function fs(t,e,s){await mkdir(e,{recursive:true});let n=await readdir(t,{withFileTypes:true});await Promise.all(n.filter(l=>!No(l.name,l.isDirectory())).map(async l=>{let o=join(t,l.name),i=join(e,l.name);if(l.isDirectory())await fs(o,i,s);else try{if(s==="eve"&&l.name.toLowerCase()==="skill.md"){await writeFile(i,tt(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 Eo(t){return t.some(e=>basename(e.path).toLowerCase()==="skill.md")}function hs(t){return `${me(t)}.md`}function Co(t){let e=t.find(n=>basename(n.path).toLowerCase()==="skill.md");if(e)return tt(e.contents);let s=t.find(n=>extname(n.path).toLowerCase()===".md");return s?tt(s.contents):""}async function Jt(t,e,s={}){let n=T[e],l=me(t);if(s.global&&n.globalSkillsDir===void 0)return false;let o=s.global?n.globalSkillsDir:e==="eve"&&s.eveSubagent?ct(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 ys(t,e,s={}){T[e];s.cwd||process.cwd();let o=me(t),i=Ae(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 Je(t,e={}){let s=me(t),n=e.agent==="eve"?Ae("eve",e.global??false,e.cwd,e.eveSubagent):Ce(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 Ro(t,e,s={}){let n=T[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=me(t.installName),h=e==="eve"&&i==="symlink"?Ae(e,l,o,a):Ce(l,o),u=join(h,r),g=Ae(e,l,o,a),d=join(g,r);if(!ie(h,u))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};if(!ie(g,d))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};try{if(i==="copy"){await xe(d);let x=e==="eve"?hs(t.installName):"SKILL.md",A=join(d,x);return await writeFile(A,e==="eve"?tt(t.content):t.content,"utf-8"),{success:!0,path:d,mode:"copy"}}await xe(u);let m=e==="eve"?hs(t.installName):"SKILL.md",c=join(u,m);if(await writeFile(c,e==="eve"?tt(t.content):t.content,"utf-8"),l&&we(e))return {success:!0,path:u,canonicalPath:u,mode:"symlink"};if(!await ks(u,d)){await xe(d);let x=e==="eve"?hs(t.installName):"SKILL.md",A=join(d,x);return await writeFile(A,e==="eve"?tt(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(m){return {success:false,path:d,mode:i,error:m instanceof Error?m.message:"Unknown error"}}}async function en(t,e,s={}){let n=T[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=me(t.installName),h=e==="eve"&&i==="symlink"?Ae(e,l,o,a):Ce(l,o),u=join(h,r),g=Ae(e,l,o,a),d=join(g,r);if(!ie(h,u))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};if(!ie(g,d))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};async function m(c){for(let[f,x]of t.files){let A=join(c,f);if(!ie(c,A))continue;let $=dirname(A);$!==c&&await mkdir($,{recursive:true}),await writeFile(A,e==="eve"&&basename(f).toLowerCase()==="skill.md"&&typeof x=="string"?tt(x):x);}}try{return i==="copy"?(await xe(d),await m(d),{success:!0,path:d,mode:"copy"}):(await xe(u),await m(u),l&&we(e)?{success:!0,path:u,canonicalPath:u,mode:"symlink"}:await ks(u,d)?{success:!0,path:d,canonicalPath:u,mode:"symlink"}:(await xe(d),await m(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 bs(t,e,s={}){let n=T[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=me(t.installName),h=Ae(e,l,o,a);if(e==="eve"&&!Eo(t.files)){let c=join(h,hs(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,Co(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"?Ae(e,l,o,a):Ce(l,o),g=join(u,r),d=join(h,r);if(!ie(u,g))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 m(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"?tt(f.contents):f.contents,"utf-8");}}try{if(i==="copy")return await xe(d),await m(d),{success:!0,path:d,mode:"copy"};if(await xe(g),await m(g),l&&we(e))return {success:!0,path:g,canonicalPath:g,mode:"symlink"};if(!l&&!we(e)){let f=join(o,T[e].skillsDir.split("/")[0]);if(!existsSync(f))return {success:!0,path:g,canonicalPath:g,mode:"symlink",skipped:!0}}return await ks(g,d)?{success:!0,path:d,canonicalPath:g,mode:"symlink"}:(await xe(d),await m(d),{success:!0,path:d,canonicalPath:g,mode:"symlink",symlinkFailed:!0})}catch(c){return {success:false,path:d,mode:i,error:c instanceof Error?c.message:"Unknown error"}}}async function tn(t={}){let e=t.cwd||process.cwd(),s=new Map,n=[],l=await Oe(),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:Ce(r,e)});for(let u of i){let g=T[u];if(r&&g.globalSkillsDir===void 0)continue;let d=r?g.globalSkillsDir:join(e,g.skillsDir);if(n.some(m=>m.path===d&&m.global===r)||n.push({global:r,path:d,agentType:u}),u==="eve"&&!r)for(let m of et(e)){let c=ct(m,e);n.some(f=>f.path===c&&f.global===r)||n.push({global:r,path:c,agentType:u});}}let h=Object.keys(T);for(let u of h){if(i.includes(u))continue;let g=T[u];if(r&&g.globalSkillsDir===void 0)continue;let d=r?g.globalSkillsDir:join(e,g.skillsDir);n.some(m=>m.path===d&&m.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 g=join(r.path,u.name);if(!await wl(u,g))continue;let d=join(g,"SKILL.md");try{await stat(d);}catch{continue}let m=await Me(d);if(!m)continue;let c=r.global?"global":"project",f=`${c}:${m.name}`;if(r.agentType){if(s.has(f)){let $=s.get(f);$.agents.includes(r.agentType)||$.agents.push(r.agentType);}else s.set(f,{name:m.name,description:m.description,path:g,canonicalPath:g,scope:c,agents:[r.agentType]});continue}let x=me(m.name),A=[];for(let $ of i){let E=T[$];if(r.global&&E.globalSkillsDir===void 0)continue;let D=Ae($,r.global,e),F=!1,C=Array.from(new Set([u.name,x,m.name.toLowerCase().replace(/\s+/g,"-").replace(/[/\\:\0]/g,"")]));for(let L of C){let w=join(D,L);if(ie(D,w))try{await access(w),F=!0;break}catch{}}if(!F)try{let L=await readdir(D,{withFileTypes:!0});for(let w of L){let N=join(D,w.name);if(await wl(w,N)&&ie(D,N))try{let U=join(N,"SKILL.md");await stat(U);let M=await Me(U);if(M&&M.name===m.name){F=!0;break}}catch{}}}catch{}F&&A.push($);}if(s.has(f)){let $=s.get(f);for(let E of A)$.agents.includes(E)||$.agents.push(E);}else s.set(f,{name:m.name,description:m.description,path:g,canonicalPath:g,scope:c,agents:A});}}catch{}return Array.from(s.values())}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 xt(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 ws(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 Oo(t){return isAbsolute(t)||t.startsWith("./")||t.startsWith("../")||t==="."||t===".."||/^[a-zA-Z]:[/\\]/.test(t)}var Fo={"coinbase/agentWallet":"coinbase/agentic-wallet-skills"};function sn(t){try{return decodeURIComponent(t)}catch{return t}}function jo(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 Mo(t){let e=t.indexOf("#");if(e<0)return {inputWithoutFragment:t};let s=t.slice(0,e),n=t.slice(e+1);if(!n||!jo(s))return {inputWithoutFragment:t};let l=n.indexOf("@");if(l===-1)return {inputWithoutFragment:s,ref:sn(n)};let o=n.slice(0,l),i=n.slice(l+1);return {inputWithoutFragment:s,ref:o?sn(o):void 0,skillFilter:i?sn(i):void 0}}function vl(t,e,s){return e?`${t}#${e}${s?`@${s}`:""}`:t}function ut(t){if(Oo(t)){let f=resolve(t);return {type:"local",url:f,localPath:f}}let{inputWithoutFragment:e,ref:s,skillFilter:n}=Mo(t);t=e;let l=Fo[t];l&&(t=l);let o=t.match(/^github:(.+)$/);if(o)return ut(vl(o[1],s,n));let i=t.match(/^gitlab:(.+)$/);if(i)return ut(vl(`https://gitlab.com/${i[1]}`,s,n));let a=t.match(/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/(.+)/);if(a){let[,f,x,A,$]=a;return {type:"github",url:`https://github.com/${f}/${x}.git`,ref:A||s,subpath:$&&ws($)}}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,$,E]=u;if(x!=="github.com"&&A)return {type:"gitlab",url:`${f}://${x}/${A.replace(/\.git$/,"")}.git`,ref:$||s,subpath:E&&ws(E)}}let g=t.match(/^(https?):\/\/([^/]+)\/(.+?)\/-\/tree\/([^/]+)$/);if(g){let[,f,x,A,$]=g;if(x!=="github.com"&&A)return {type:"gitlab",url:`${f}://${x}/${A.replace(/\.git$/,"")}.git`,ref:$||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 m=t.match(/^([^/]+)\/([^/@]+)@(.+)$/);if(m&&!t.includes(":")&&!t.startsWith(".")&&!t.startsWith("/")){let[,f,x,A]=m;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&&ws(A),...n?{skillFilter:n}:{}}}return Wo(t)?{type:"well-known",url:t}:{type:"git",url:t,...s?{ref:s}:{}}}function Wo(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 zo=new Writable({write(t,e,s){s();}}),Go=k.green("\u25C6"),Bo=k.red("\u25A0"),Vo=k.green("\u25C7"),qo=k.green("\u25CF"),Jo=k.dim("\u25CB");k.green("\u2713");var Xo=k.green("\u2022"),ue=k.dim("\u2502"),At=k.dim("\u2500"),Yo=Symbol("cancel");function Zo(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 Qo(t,e){let s=stripVTControlCharacters(t),n=Math.max(1,e),l=Zo(s);return Math.max(1,Math.ceil(l/n))}function er(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+Qo(l,s),0)}async function Lt(t){let{message:e,items:s,maxVisible:n=8,initialSelected:l=[],required:o=false,lockedSection:i}=t;return new Promise(a=>{let r=Ss.createInterface({input:process.stdin,output:zo,terminal:false});process.stdin.isTTY&&process.stdin.setRawMode(true),Ss.emitKeypressEvents(process.stdin,r);let h="",u=0,g=new Set(l),d=0,m=i?i.items.map(C=>C.value):[],c=(C,L)=>{if(!L)return true;let w=L.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 L=[],w=f(),N=C==="active"?Go:C==="cancel"?Bo:Vo;if(L.push(`${N} ${k.bold(e)}`),C==="active"){if(i&&i.items.length>0){L.push(`${ue}`);let te=`${k.bold(i.title)} ${k.dim("\u2500\u2500 always included")}`;L.push(`${ue} ${At}${At} ${te} ${At.repeat(12)}`);for(let Se of i.items)L.push(`${ue} ${Xo} ${k.bold(Se.label)}`);i.hiddenCount&&i.hiddenCount>0&&L.push(`${ue} ${k.dim(`...and ${i.hiddenCount} more`)}`),L.push(`${ue}`),L.push(`${ue} ${At}${At} ${k.bold("Additional agents")} ${At.repeat(29)}`);}let U=`${ue} ${k.dim("Search:")} ${h}${k.inverse(" ")}`;L.push(U),L.push(`${ue} ${k.dim("\u2191\u2193 move, space select, enter confirm")}`),L.push(`${ue}`);let M=Math.max(0,Math.min(u-Math.floor(n/2),w.length-n)),G=Math.min(w.length,M+n),pe=w.slice(M,G);if(w.length===0)L.push(`${ue} ${k.dim("No matches found")}`);else {for(let ge=0;ge<pe.length;ge++){let De=pe[ge],Ge=M+ge,Ut=g.has(De.value),Re=Ge===u,_e=Ut?qo:Jo,cs=Re?k.underline(De.label):De.label,S=De.hint?k.dim(` (${De.hint})`):"",_=Re?k.cyan("\u276F"):" ";L.push(`${ue} ${_} ${_e} ${cs}${S}`);}let te=M,Se=w.length-G;if(te>0||Se>0){let ge=[];te>0&&ge.push(`\u2191 ${te} more`),Se>0&&ge.push(`\u2193 ${Se} more`),L.push(`${ue} ${k.dim(ge.join(" "))}`);}}L.push(`${ue}`);let se=[...i?i.items.map(te=>te.label):[],...s.filter(te=>g.has(te.value)).map(te=>te.label)];if(se.length===0)L.push(`${ue} ${k.dim("Selected: (none)")}`);else {let te=se.length<=3?se.join(", "):`${se.slice(0,3).join(", ")} +${se.length-3} more`;L.push(`${ue} ${k.green("Selected:")} ${te}`);}L.push(`${k.dim("\u2514")}`);}else if(C==="submit"){let U=[...i?i.items.map(M=>M.label):[],...s.filter(M=>g.has(M.value)).map(M=>M.label)];L.push(`${ue} ${k.dim(U.join(", "))}`);}else C==="cancel"&&L.push(`${ue} ${k.strikethrough(k.dim("Cancelled"))}`);process.stdout.write(L.join(`
|
|
6
|
+
${s.replace(/^\r?\n/u,"")}`}async function fs(t,e,s){await mkdir(e,{recursive:true});let n=await readdir(t,{withFileTypes:true});await Promise.all(n.filter(l=>!Eo(l.name,l.isDirectory())).map(async l=>{let o=join(t,l.name),i=join(e,l.name);if(l.isDirectory())await fs(o,i,s);else try{if(s==="eve"&&l.name.toLowerCase()==="skill.md"){await writeFile(i,tt(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 Co(t){return t.some(e=>basename(e.path).toLowerCase()==="skill.md")}function hs(t){return `${me(t)}.md`}function Ro(t){let e=t.find(n=>basename(n.path).toLowerCase()==="skill.md");if(e)return tt(e.contents);let s=t.find(n=>extname(n.path).toLowerCase()===".md");return s?tt(s.contents):""}async function Jt(t,e,s={}){let n=T[e],l=me(t);if(s.global&&n.globalSkillsDir===void 0)return false;let o=s.global?n.globalSkillsDir:e==="eve"&&s.eveSubagent?ct(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 ys(t,e,s={}){T[e];s.cwd||process.cwd();let o=me(t),i=Ae(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 Je(t,e={}){let s=me(t),n=e.agent==="eve"?Ae("eve",e.global??false,e.cwd,e.eveSubagent):Ce(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 _o(t,e,s={}){let n=T[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=me(t.installName),h=e==="eve"&&i==="symlink"?Ae(e,l,o,a):Ce(l,o),u=join(h,r),m=Ae(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 xe(d);let x=e==="eve"?hs(t.installName):"SKILL.md",A=join(d,x);return await writeFile(A,e==="eve"?tt(t.content):t.content,"utf-8"),{success:!0,path:d,mode:"copy"}}await xe(u);let g=e==="eve"?hs(t.installName):"SKILL.md",c=join(u,g);if(await writeFile(c,e==="eve"?tt(t.content):t.content,"utf-8"),l&&we(e))return {success:!0,path:u,canonicalPath:u,mode:"symlink"};if(!await ks(u,d)){await xe(d);let x=e==="eve"?hs(t.installName):"SKILL.md",A=join(d,x);return await writeFile(A,e==="eve"?tt(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(g){return {success:false,path:d,mode:i,error:g instanceof Error?g.message:"Unknown error"}}}async function en(t,e,s={}){let n=T[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=me(t.installName),h=e==="eve"&&i==="symlink"?Ae(e,l,o,a):Ce(l,o),u=join(h,r),m=Ae(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 g(c){for(let[f,x]of t.files){let A=join(c,f);if(!ie(c,A))continue;let $=dirname(A);$!==c&&await mkdir($,{recursive:true}),await writeFile(A,e==="eve"&&basename(f).toLowerCase()==="skill.md"&&typeof x=="string"?tt(x):x);}}try{return i==="copy"?(await xe(d),await g(d),{success:!0,path:d,mode:"copy"}):(await xe(u),await g(u),l&&we(e)?{success:!0,path:u,canonicalPath:u,mode:"symlink"}:await ks(u,d)?{success:!0,path:d,canonicalPath:u,mode:"symlink"}:(await xe(d),await g(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 bs(t,e,s={}){let n=T[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=me(t.installName),h=Ae(e,l,o,a);if(e==="eve"&&!Co(t.files)){let c=join(h,hs(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,Ro(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"?Ae(e,l,o,a):Ce(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 g(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"?tt(f.contents):f.contents,"utf-8");}}try{if(i==="copy")return await xe(d),await g(d),{success:!0,path:d,mode:"copy"};if(await xe(m),await g(m),l&&we(e))return {success:!0,path:m,canonicalPath:m,mode:"symlink"};if(!l&&!we(e)){let f=join(o,T[e].skillsDir.split("/")[0]);if(!existsSync(f))return {success:!0,path:m,canonicalPath:m,mode:"symlink",skipped:!0}}return await ks(m,d)?{success:!0,path:d,canonicalPath:m,mode:"symlink"}:(await xe(d),await g(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 tn(t={}){let e=t.cwd||process.cwd(),s=new Map,n=[],l=await Oe(),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:Ce(r,e)});for(let u of i){let m=T[u];if(r&&m.globalSkillsDir===void 0)continue;let d=r?m.globalSkillsDir:join(e,m.skillsDir);if(n.some(g=>g.path===d&&g.global===r)||n.push({global:r,path:d,agentType:u}),u==="eve"&&!r)for(let g of et(e)){let c=ct(g,e);n.some(f=>f.path===c&&f.global===r)||n.push({global:r,path:c,agentType:u});}}let h=Object.keys(T);for(let u of h){if(i.includes(u))continue;let m=T[u];if(r&&m.globalSkillsDir===void 0)continue;let d=r?m.globalSkillsDir:join(e,m.skillsDir);n.some(g=>g.path===d&&g.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 Sl(u,m))continue;let d=join(m,"SKILL.md");try{await stat(d);}catch{continue}let g=await Me(d);if(!g)continue;let c=r.global?"global":"project",f=`${c}:${g.name}`;if(r.agentType){if(s.has(f)){let $=s.get(f);$.agents.includes(r.agentType)||$.agents.push(r.agentType);}else s.set(f,{name:g.name,description:g.description,path:m,canonicalPath:m,scope:c,agents:[r.agentType]});continue}let x=me(g.name),A=[];for(let $ of i){let E=T[$];if(r.global&&E.globalSkillsDir===void 0)continue;let D=Ae($,r.global,e),F=!1,C=Array.from(new Set([u.name,x,g.name.toLowerCase().replace(/\s+/g,"-").replace(/[/\\:\0]/g,"")]));for(let L of C){let w=join(D,L);if(ie(D,w))try{await access(w),F=!0;break}catch{}}if(!F)try{let L=await readdir(D,{withFileTypes:!0});for(let w of L){let N=join(D,w.name);if(await Sl(w,N)&&ie(D,N))try{let U=join(N,"SKILL.md");await stat(U);let M=await Me(U);if(M&&M.name===g.name){F=!0;break}}catch{}}}catch{}F&&A.push($);}if(s.has(f)){let $=s.get(f);for(let E of A)$.agents.includes(E)||$.agents.push(E);}else s.set(f,{name:g.name,description:g.description,path:m,canonicalPath:m,scope:c,agents:A});}}catch{}return Array.from(s.values())}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 xt(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 ws(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 Fo(t){return isAbsolute(t)||t.startsWith("./")||t.startsWith("../")||t==="."||t===".."||/^[a-zA-Z]:[/\\]/.test(t)}var jo={"coinbase/agentWallet":"coinbase/agentic-wallet-skills"};function sn(t){try{return decodeURIComponent(t)}catch{return t}}function Mo(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 Wo(t){let e=t.indexOf("#");if(e<0)return {inputWithoutFragment:t};let s=t.slice(0,e),n=t.slice(e+1);if(!n||!Mo(s))return {inputWithoutFragment:t};let l=n.indexOf("@");if(l===-1)return {inputWithoutFragment:s,ref:sn(n)};let o=n.slice(0,l),i=n.slice(l+1);return {inputWithoutFragment:s,ref:o?sn(o):void 0,skillFilter:i?sn(i):void 0}}function xl(t,e,s){return e?`${t}#${e}${s?`@${s}`:""}`:t}function ut(t){if(Fo(t)){let f=resolve(t);return {type:"local",url:f,localPath:f}}let{inputWithoutFragment:e,ref:s,skillFilter:n}=Wo(t);t=e;let l=jo[t];l&&(t=l);let o=t.match(/^github:(.+)$/);if(o)return ut(xl(o[1],s,n));let i=t.match(/^gitlab:(.+)$/);if(i)return ut(xl(`https://gitlab.com/${i[1]}`,s,n));let a=t.match(/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/(.+)/);if(a){let[,f,x,A,$]=a;return {type:"github",url:`https://github.com/${f}/${x}.git`,ref:A||s,subpath:$&&ws($)}}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,$,E]=u;if(x!=="github.com"&&A)return {type:"gitlab",url:`${f}://${x}/${A.replace(/\.git$/,"")}.git`,ref:$||s,subpath:E&&ws(E)}}let m=t.match(/^(https?):\/\/([^/]+)\/(.+?)\/-\/tree\/([^/]+)$/);if(m){let[,f,x,A,$]=m;if(x!=="github.com"&&A)return {type:"gitlab",url:`${f}://${x}/${A.replace(/\.git$/,"")}.git`,ref:$||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 g=t.match(/^([^/]+)\/([^/@]+)@(.+)$/);if(g&&!t.includes(":")&&!t.startsWith(".")&&!t.startsWith("/")){let[,f,x,A]=g;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&&ws(A),...n?{skillFilter:n}:{}}}return Ko(t)?{type:"well-known",url:t}:{type:"git",url:t,...s?{ref:s}:{}}}function Ko(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 Go=new Writable({write(t,e,s){s();}}),Bo=k.green("\u25C6"),Vo=k.red("\u25A0"),qo=k.green("\u25C7"),Jo=k.green("\u25CF"),Xo=k.dim("\u25CB");k.green("\u2713");var Yo=k.green("\u2022"),ue=k.dim("\u2502"),At=k.dim("\u2500"),Zo=Symbol("cancel");function Qo(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 er(t,e){let s=stripVTControlCharacters(t),n=Math.max(1,e),l=Qo(s);return Math.max(1,Math.ceil(l/n))}function tr(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+er(l,s),0)}async function Lt(t){let{message:e,items:s,maxVisible:n=8,initialSelected:l=[],required:o=false,lockedSection:i}=t;return new Promise(a=>{let r=Ss.createInterface({input:process.stdin,output:Go,terminal:false});process.stdin.isTTY&&process.stdin.setRawMode(true),Ss.emitKeypressEvents(process.stdin,r);let h="",u=0,m=new Set(l),d=0,g=i?i.items.map(C=>C.value):[],c=(C,L)=>{if(!L)return true;let w=L.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 L=[],w=f(),N=C==="active"?Bo:C==="cancel"?Vo:qo;if(L.push(`${N} ${k.bold(e)}`),C==="active"){if(i&&i.items.length>0){L.push(`${ue}`);let te=`${k.bold(i.title)} ${k.dim("\u2500\u2500 always included")}`;L.push(`${ue} ${At}${At} ${te} ${At.repeat(12)}`);for(let Se of i.items)L.push(`${ue} ${Yo} ${k.bold(Se.label)}`);i.hiddenCount&&i.hiddenCount>0&&L.push(`${ue} ${k.dim(`...and ${i.hiddenCount} more`)}`),L.push(`${ue}`),L.push(`${ue} ${At}${At} ${k.bold("Additional agents")} ${At.repeat(29)}`);}let U=`${ue} ${k.dim("Search:")} ${h}${k.inverse(" ")}`;L.push(U),L.push(`${ue} ${k.dim("\u2191\u2193 move, space select, enter confirm")}`),L.push(`${ue}`);let M=Math.max(0,Math.min(u-Math.floor(n/2),w.length-n)),G=Math.min(w.length,M+n),pe=w.slice(M,G);if(w.length===0)L.push(`${ue} ${k.dim("No matches found")}`);else {for(let ge=0;ge<pe.length;ge++){let De=pe[ge],Ge=M+ge,Ut=m.has(De.value),Re=Ge===u,_e=Ut?Jo:Xo,cs=Re?k.underline(De.label):De.label,S=De.hint?k.dim(` (${De.hint})`):"",_=Re?k.cyan("\u276F"):" ";L.push(`${ue} ${_} ${_e} ${cs}${S}`);}let te=M,Se=w.length-G;if(te>0||Se>0){let ge=[];te>0&&ge.push(`\u2191 ${te} more`),Se>0&&ge.push(`\u2193 ${Se} more`),L.push(`${ue} ${k.dim(ge.join(" "))}`);}}L.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)L.push(`${ue} ${k.dim("Selected: (none)")}`);else {let te=se.length<=3?se.join(", "):`${se.slice(0,3).join(", ")} +${se.length-3} more`;L.push(`${ue} ${k.green("Selected:")} ${te}`);}L.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)];L.push(`${ue} ${k.dim(U.join(", "))}`);}else C==="cancel"&&L.push(`${ue} ${k.strikethrough(k.dim("Cancelled"))}`);process.stdout.write(L.join(`
|
|
7
7
|
`)+`
|
|
8
|
-
`),d=
|
|
8
|
+
`),d=tr(L,process.stdout.columns);},$=()=>{process.stdin.removeListener("keypress",F),process.stdin.isTTY&&process.stdin.setRawMode(false),r.close();},E=()=>{o&&m.size===0&&g.length===0||(A("submit"),$(),a([...g,...Array.from(m)]));},D=()=>{A("cancel"),$(),a(Zo);},F=(C,L)=>{if(!L)return;let w=f();if(L.name==="return"){E();return}if(L.name==="escape"||L.ctrl&&L.name==="c"){D();return}if(L.name==="up"){u=Math.max(0,u-1),A();return}if(L.name==="down"){u=Math.min(w.length-1,u+1),A();return}if(L.name==="space"){let N=w[u];N&&(m.has(N.value)?m.delete(N.value):m.add(N.value)),A();return}if(L.name==="backspace"){h=h.slice(0,-1),u=0,A();return}if(L.sequence&&!L.ctrl&&!L.meta&&L.sequence.length===1){h+=L.sequence,u=0,A();return}};process.stdin.on("keypress",F),A();})}var nn=3e5,ln=(()=>{let t=process.env.SKILLS_CLONE_TIMEOUT_MS;if(!t)return nn;let e=Number.parseInt(t,10);return Number.isFinite(e)&&e>0?e:nn})(),Il=promisify(execFile),We=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 Nl(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 El(t){try{let e=new URL(t);return e.protocol==="https:"&&e.hostname==="github.com"}catch{return false}}function on(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 cr(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")||on(t)}function Pl(t){let e={...process.env,GIT_TERMINAL_PROMPT:"0",GIT_LFS_SKIP_SMUDGE:"1",...t};return sr({timeout:{block:ln},config:["filter.lfs.required=false","filter.lfs.smudge=","filter.lfs.clean=","filter.lfs.process="]}).env(e)}async function Dl(t){try{await rm(t,{recursive:!0,force:!0});}catch{}await mkdir(t,{recursive:true});}async function ur(t,e,s){let n=t.slug;try{let{stdout:o,stderr:i}=await Il("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 Il("gh",["repo","clone",n,e,"--",...s?["--depth=1","--branch",s]:["--depth=1"]],{timeout:ln,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),true}function dr(t,e,s){return e&&on(s)?`GitHub blocked HTTPS access to ${t} because the organization enforces SAML SSO.
|
|
9
9
|
skills tried your existing git credentials and available fallbacks, but none succeeded.
|
|
10
10
|
- Re-authorize your GitHub credentials/app for that org's SSO policy
|
|
11
11
|
- Or rerun with SSH: easbot skills add ${e.sshUrl}
|
|
@@ -15,26 +15,26 @@ ${s.replace(/^\r?\n/u,"")}`}async function fs(t,e,s){await mkdir(e,{recursive:tr
|
|
|
15
15
|
- Check access with: gh auth status -h github.com or ssh -T git@github.com`:`Authentication failed for ${t}.
|
|
16
16
|
- For private repos, ensure you have access
|
|
17
17
|
- For SSH: Check your keys with 'ssh -T git@github.com'
|
|
18
|
-
- For HTTPS: Run 'gh auth login' or configure git credentials`}async function Ke(t,e){let s=await mkdtemp(join(tmpdir(),"skills-")),n=e?["--depth","1","--branch",e]:["--depth","1"],l=
|
|
18
|
+
- For HTTPS: Run 'gh auth login' or configure git credentials`}async function Ke(t,e){let s=await mkdtemp(join(tmpdir(),"skills-")),n=e?["--depth","1","--branch",e]:["--depth","1"],l=Nl(t);try{return await Pl().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=cr(i);if(a){try{await rm(s,{recursive:!0,force:!0});}catch{}let h=Math.round(ln/1e3);throw new We(`Clone timed out after ${h}s. Common causes:
|
|
19
19
|
- Large repository: raise the timeout with SKILLS_CLONE_TIMEOUT_MS=600000 (10m)
|
|
20
20
|
- Slow network: retry, or clone manually and pass the local path to 'skills add'
|
|
21
21
|
- Private repo without credentials: ensure auth is configured
|
|
22
22
|
- For SSH: ssh-add -l (to check loaded keys)
|
|
23
|
-
- For HTTPS: gh auth status (if using GitHub CLI)`,t,true,false)}if(r&&l&&Nl(t)){try{if(await Pl(s),await cr(l,s,e))return s}catch{}try{return await Pl(s),await Il({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 We(ur(t,l,i),t,false,true):new We(`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 dr="https://add-skill.vercel.sh/t",pr="https://add-skill.vercel.sh/audit",rn=null,an=null;function un(t){an=t;}function gr(){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 mr(){return !process.env.DISABLE_TELEMETRY&&!process.env.DO_NOT_TRACK}function vs(t){rn=t;}async function dn(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(`${pr}?${n.toString()}`,{signal:l.signal});return clearTimeout(o),i.ok?await i.json():null}catch{return null}}var cn=[];function ke(t){if(mr())try{let e=new URLSearchParams;rn&&e.set("v",rn),gr()&&e.set("ci","1"),an&&e.set("agent",an);for(let[n,l]of Object.entries(t))l!=null&&e.set(n,String(l));let s=fetch(`${dr}?${e.toString()}`).catch(()=>{}).then(()=>{});cn.push(s);}catch{}}async function fr(t=5e3){if(cn.length===0)return;let e=new Promise(s=>setTimeout(s,t));await Promise.race([Promise.all(cn),e]);}var It=null,kr={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 Ye(){return It||(It=await determineAgent(),It.isAgent&&un(It.agent.name),It)}async function Yt(){return (await Ye()).isAgent}async function yr(){let t=await Ye();return t.isAgent?t.agent.name:null}function Zt(t){return kr[t]??null}var pn=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]}},Qt=new pn;function El(t){Qt.register(t);}function Cl(t){return Qt.findProvider(t)}function Rl(){return Qt.getProviders()}var _l="https://schemas.agentskills.io/discovery/0.2.0/schema.json",$r=50*1024*1024,vr=1e3,es=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(),g=this.normalizeIndex(u,i,r);if(!g)continue;o.push({index:g.index,entries:g.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===_l){let r=[],h=[];for(let u of l.skills){if(!this.isValidSkillEntryV2(u))continue;let g=new URL(u.url,s).toString();r.push({version:"0.2.0",name:u.name,description:u.description,type:u.type,artifactUrl:g,digest:u.digest,indexEntry:u}),h.push(u);}return r.length===0?null:{index:{$schema:_l,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}=b$1(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(g=>g.toLowerCase()!=="skill.md").map(async g=>{try{let d=`${s}/${g}`,m=await fetch(d);if(m.ok){let c=await m.arrayBuffer();return {path:g,content:new Uint8Array(c)}}}catch{}return null}),u=await Promise.all(h);for(let g of u)g&&a.set(g.path,g.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}=b$1(h);if(typeof u.name!="string"||typeof u.description!="string")return null;let g=new Map;return g.set("SKILL.md",h),this.createSkill({name:u.name,description:u.description,content:h,installName:e.name,sourceUrl:e.artifactUrl,metadata:u.metadata,files:g,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}=b$1(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:d(e.name),description:d(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>$r)throw new Error("Archive exceeds maximum unpacked size");if(e.size>=vr)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),g=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,g,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),g=s.readUInt16LE(r+10),d=s.readUInt32LE(r+20),m=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.readUInt32LE(r+42),E=r+46,D=s.subarray(E,E+c),F=new TextDecoder(u&2048?"utf-8":void 0).decode(D);if(r=E+c+f+x,F.endsWith("/"))continue;if(u&1)throw new Error("Encrypted zip entries are not supported");let L=A>>>16&61440;if(L===40960||L===4096)throw new Error("Archive links are not supported");if(s.readUInt32LE($)!==67324752)throw new Error("Invalid zip local header");let w=s.readUInt16LE($+26),N=s.readUInt16LE($+28),U=$+30+w+N,M=s.subarray(U,U+d),G;if(g===0)G=M;else if(g===8)G=inflateRawSync(M);else throw new Error(`Unsupported zip compression method: ${g}`);if(G.byteLength!==m)throw new Error("Zip entry size mismatch");this.addArchiveFile(i,F,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}},dt=new es;var Nr=".agents",mn=".skill-lock.json",Ul=3;function kn(){let t=yt(),e=Ne(),s=process.env.XDG_STATE_HOME;return s?join(s,"skills",mn):t?join(t,"skills",mn):join(e||homedir(),Nr,mn)}async function Le(){let t=kn();try{let e=await readFile(t,"utf-8"),s=JSON.parse(e);return typeof s.version!="number"||!s.skills||s.version<Ul?fn():s}catch{return fn()}}async function ts(t){let e=kn();await mkdir(dirname(e),{recursive:true});let s=JSON.stringify(t,null,2);await writeFile(e,s,"utf-8");}function Er(t){return createHash("sha256").update(t,"utf-8").digest("hex")}var hn=false;function Cr(){hn=false;}function nt(){if(process.env.GITHUB_TOKEN)return process.env.GITHUB_TOKEN;if(process.env.GH_TOKEN)return process.env.GH_TOKEN;hn||(process.stderr.write(`${k.yellow("\u2502")} ${k.yellow("GitHub rate limit reached")} \u2014 using your ${k.cyan("gh")} login to continue.
|
|
23
|
+
- For HTTPS: gh auth status (if using GitHub CLI)`,t,true,false)}if(r&&l&&El(t)){try{if(await Dl(s),await ur(l,s,e))return s}catch{}try{return await Dl(s),await Pl({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 We(dr(t,l,i),t,false,true):new We(`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 pr="https://add-skill.vercel.sh/t",gr="https://add-skill.vercel.sh/audit",rn=null,an=null;function un(t){an=t;}function mr(){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 fr(){return !process.env.DISABLE_TELEMETRY&&!process.env.DO_NOT_TRACK}function vs(t){rn=t;}async function dn(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(`${gr}?${n.toString()}`,{signal:l.signal});return clearTimeout(o),i.ok?await i.json():null}catch{return null}}var cn=[];function ke(t){if(fr())try{let e=new URLSearchParams;rn&&e.set("v",rn),mr()&&e.set("ci","1"),an&&e.set("agent",an);for(let[n,l]of Object.entries(t))l!=null&&e.set(n,String(l));let s=fetch(`${pr}?${e.toString()}`).catch(()=>{}).then(()=>{});cn.push(s);}catch{}}async function hr(t=5e3){if(cn.length===0)return;let e=new Promise(s=>setTimeout(s,t));await Promise.race([Promise.all(cn),e]);}var It=null,yr={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 Ye(){return It||(It=await determineAgent(),It.isAgent&&un(It.agent.name),It)}async function Yt(){return (await Ye()).isAgent}async function br(){let t=await Ye();return t.isAgent?t.agent.name:null}function Zt(t){return yr[t]??null}var pn=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]}},Qt=new pn;function Cl(t){Qt.register(t);}function Rl(t){return Qt.findProvider(t)}function _l(){return Qt.getProviders()}var Ul="https://schemas.agentskills.io/discovery/0.2.0/schema.json",vr=50*1024*1024,xr=1e3,es=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===Ul){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:Ul,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}=b$1(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}`,g=await fetch(d);if(g.ok){let c=await g.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}=b$1(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}=b$1(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:d(e.name),description:d(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>vr)throw new Error("Archive exceeds maximum unpacked size");if(e.size>=xr)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),g=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.readUInt32LE(r+42),E=r+46,D=s.subarray(E,E+c),F=new TextDecoder(u&2048?"utf-8":void 0).decode(D);if(r=E+c+f+x,F.endsWith("/"))continue;if(u&1)throw new Error("Encrypted zip entries are not supported");let L=A>>>16&61440;if(L===40960||L===4096)throw new Error("Archive links are not supported");if(s.readUInt32LE($)!==67324752)throw new Error("Invalid zip local header");let w=s.readUInt16LE($+26),N=s.readUInt16LE($+28),U=$+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!==g)throw new Error("Zip entry size mismatch");this.addArchiveFile(i,F,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}},dt=new es;var Er=".agents",mn=".skill-lock.json",Ol=3;function kn(){let t=yt(),e=Ne(),s=process.env.XDG_STATE_HOME;return s?join(s,"skills",mn):t?join(t,"skills",mn):join(e||homedir(),Er,mn)}async function Le(){let t=kn();try{let e=await readFile(t,"utf-8"),s=JSON.parse(e);return typeof s.version!="number"||!s.skills||s.version<Ol?fn():s}catch{return fn()}}async function ts(t){let e=kn();await mkdir(dirname(e),{recursive:true});let s=JSON.stringify(t,null,2);await writeFile(e,s,"utf-8");}function Cr(t){return createHash("sha256").update(t,"utf-8").digest("hex")}var hn=false;function Rr(){hn=false;}function nt(){if(process.env.GITHUB_TOKEN)return process.env.GITHUB_TOKEN;if(process.env.GH_TOKEN)return process.env.GH_TOKEN;hn||(process.stderr.write(`${k.yellow("\u2502")} ${k.yellow("GitHub rate limit reached")} \u2014 using your ${k.cyan("gh")} login to continue.
|
|
24
24
|
${k.yellow("\u2502")} ${k.dim(`Tip: set ${k.cyan("GITHUB_TOKEN")} to avoid this prompt, or use ${k.cyan("--full-depth")} to clone instead.
|
|
25
|
-
`)}`),hn=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
|
|
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=dt.getSourceIdentifier(e),$=
|
|
27
|
-
`),pe),U.length>0&&(y.log.warn(k.yellow(`Symlinks failed for: ${fe(M)}`)),y.log.message(k.dim(" Files were copied instead. On Windows, enable Developer Mode for symlink support.")));}if(F.length>0){console.log(),y.log.error(k.red(`Failed to install ${F.length}`));for(let w of F)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
|
|
28
|
-
`),"Installation Summary");try{let S=await x;if(S&&f){let _=
|
|
29
|
-
`),"Security Risk Assessments");}}catch{}if(!e$1.yes){let S=await y.confirm({message:"Proceed with installation?"});(y.isCancel(S)||!S)&&(y.cancel("Installation cancelled"),await ye(i$1),process.exit(0));}a.start("Installing skills...");let De=[];for(let S of c)for(let _ of D){let{agent:O,subagent:R}=_,K;if(
|
|
30
|
-
`),
|
|
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 ye(i$1);}}async function ye(t){if(t)try{await st(t);}catch{}}async function
|
|
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
|
|
25
|
+
`)}`),hn=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 _r(t,e,s,n){let{fetchRepoTree:l,getSkillFolderHashFromTree:o}=await import('./chunks/blob-SJSODFTU.mjs'),i=await l(t,n,s??void 0);return i?o(i,e):null}async function xs(t,e){let s=await Le(),n=new Date().toISOString(),l=s.skills[t];s.skills[t]={...e,installedAt:l?.installedAt??n,updatedAt:n},await ts(s);}async function yn(t){let e=await Le();return t in e.skills?(delete e.skills[t],await ts(e),true):false}async function bn(t){return (await Le()).skills[t]??null}async function wn(){return (await Le()).skills}async function Ur(){let t=await Le(),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 fn(){return {version:Ol,skills:{},dismissed:{}}}async function Sn(t){return (await Le()).dismissed?.[t]===true}async function Pt(t){let e=await Le();e.dismissed||(e.dismissed={}),e.dismissed[t]=true,await ts(e);}async function As(){return (await Le()).lastSelectedAgents}async function Ls(t){let e=await Le();e.lastSelectedAgents=t,await ts(e);}var Fl={version:"0.3.2"};var Wl=t=>typeof t=="symbol",Kl="eve agent";async function Hr(t){let e=Xt(t);return e?xt(e.owner,e.repo):false}function zr(t,e){return t.startsWith("git@")||t.startsWith("ssh://")?t:e}function xn(t){vs(t);}function jl(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 Gr(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 Dt(t,e){let s=c(t),n=Math.max(0,e-s.length);return t+" ".repeat(n)}function Br(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=Dt("",l+2)+Dt(k.dim("Gen"),18)+Dt(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?jl(r.ath.risk):k.dim("--"),m=r?.socket?Gr(r.socket):k.dim("--"),d=r?.snyk?jl(r.snyk.risk):k.dim("--");o.push(Dt(k.cyan(h),l+2)+Dt(u,18)+Dt(m,18)+d);}return o.push(""),o.push(`${k.dim("Details:")} ${k.dim(`https://skills.sh/${s}`)}`),o}function Tt(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 Vr(t){let e=createHash("sha256");return e.update("SKILL.md"),e.update(t),e.digest("hex")}function fe(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 qr(t){let e=t.map(n=>k.cyan(le(n))),s=fe(e,3);return c(s).length<=80?s:`${t.length} selected skills`}function Jr(t){return `Detected an eve project. Install ${qr(t)} for your ${Kl} to use?`}function An(t){let e=[],s=[];for(let n of t)we(n)?e.push(T[n].displayName):s.push(T[n].displayName);return {universal:e,symlinked:s}}function Xr(t,e){let s=[],{universal:n,symlinked:l}=An(t);if(e==="symlink")n.length>0&&s.push(` ${k.green("universal:")} ${fe(n)}`),l.length>0&&s.push(` ${k.dim("symlink \u2192")} ${fe(l)}`);else {let o=t.map(i=>T[i].displayName);s.push(` ${k.dim("copy \u2192")} ${fe(o)}`);}return s}function Ps(t){let e=T[t.agent].displayName;return t.subagent?`${e} (${t.subagent})`:e}function Ml(t){return t.subagent?`${t.agent}:${t.subagent}`:t.agent}function Yr(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 Zr(t,e){let s=[],n=t.filter(a=>!a.subagent).map(a=>a.agent),l=t.filter(a=>a.subagent).map(Ps),{universal:o,symlinked:i}=An(n);if(e==="symlink")o.length>0&&s.push(` ${k.green("universal:")} ${fe(o)}`),i.length>0&&s.push(` ${k.dim("symlink \u2192")} ${fe(i)}`),l.length>0&&s.push(` ${k.dim("copy \u2192")} ${fe(l)}`);else {let a=t.map(Ps);s.push(` ${k.dim("copy \u2192")} ${fe(a)}`);}return s}function $n(t){let e=qe(),s=[...t];for(let n of e)s.includes(n)||s.push(n);return s}function Hl(t,e){let s=[],{universal:n}=An(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:")} ${fe(n)}`),o.length>0&&s.push(` ${k.dim("symlinked:")} ${fe(o)}`),i.length>0&&s.push(` ${k.yellow("copied:")} ${fe(i)}`),s}function zl(t){return y.multiselect({...t,options:t.options,message:`${t.message} ${k.dim("(space to toggle)")}`})}async function Gl(t,e){let s;try{s=await As();}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 Lt({message:t,items:e,initialSelected:i,required:true});if(!Wl(a))try{await Ls(a);}catch{}return a}async function vn(t){let e=u=>!t.global||T[u].globalSkillsDir,s=qe().filter(e),n=Ht().filter(e),l=bt().filter(u=>u!=="eve"&&e(u)),o={title:"Universal (.agents/skills)",items:n.map(u=>({value:u,label:T[u].displayName})),hiddenCount:s.length-n.length},i=l.map(u=>({value:u,label:T[u].displayName,hint:t.global?T[u].globalSkillsDir:T[u].skillsDir})),a;try{a=await As();}catch{}let r=a?a.filter(u=>l.includes(u)&&!s.includes(u)):[],h=await Lt({message:"Which agents do you want to install to?",items:i,initialSelected:r,lockedSection:o});if(!Wl(h))try{await Ls(h);}catch{}return h}var Qr=Fl.version;vs(Qr);async function ea(t,e,s,n){n.start("Discovering skills from well-known endpoint...");let l=await dt.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 zl({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(T);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 Oe(),N=Object.keys(T).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(T).map(([G,pe])=>({value:G,label:pe.displayName})),M=await Gl("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=$n(w),w.length===1){let U=w[0];y.log.info(`Installing to: ${k.cyan(T[U].displayName)}`);}else y.log.info(`Installing to: ${w.map(U=>k.cyan(T[U].displayName)).join(", ")}`);else {let U=await vn({global:s.global});y.isCancel(U)&&(y.cancel("Installation cancelled"),process.exit(0)),i=U;}}let r=s.global??false,h=i.some(w=>T[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=>T[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(),g=[];i.map(w=>T[w].displayName);let f=await Promise.all(o.flatMap(w=>i.map(async N=>({skillName:w.installName,agent:N,installed:await Jt(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){g.length>0&&g.push("");let N=Je(w.installName,{global:r}),U=Tt(N,d);g.push(`${k.cyan(U)}`),g.push(...Xr(i,u)),w.files.size>1&&g.push(` ${k.dim("files:")} ${w.files.size}`);let M=x.get(w.installName),G=i.filter(pe=>M?.get(pe)).map(pe=>T[pe].displayName);G.length>0&&g.push(` ${k.yellow("overwrites:")} ${fe(G)}`);}if(console.log(),y.note(g.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=dt.getSourceIdentifier(e),$=Hr(A).catch(()=>null);n.start("Installing skills...");let E=[];for(let w of o)for(let N of i){let U=await en(w,N,{global:r,mode:u});E.push({skill:w.installName,agent:T[N].displayName,...U});}n.stop("Installation complete"),console.log();let D=E.filter(w=>w.success),F=E.filter(w=>!w.success),C={};for(let w of o)C[w.installName]=w.sourceUrl;if(await $!==true&&ke({event:"install",source:A,skills:o.map(w=>w.installName).join(","),agents:i.join(","),...r&&{global:"1"},skillFiles:JSON.stringify(C),sourceType:"well-known"}),D.length>0&&r){let w=new Set(D.map(N=>N.skill));for(let N of o)if(w.has(N.installName))try{await xs(N.installName,{source:A,sourceType:"well-known",sourceUrl:N.sourceUrl,skillFolderHash:""});}catch{}}if(D.length>0&&!r){let w=new Set(D.map(N=>N.skill));for(let N of o)if(w.has(N.installName))try{let U=D.find(G=>G.skill===N.installName),M=U?.canonicalPath||U?.path;if(M){let G=await je(M);await wt(N.installName,{source:A,sourceType:"well-known",computedHash:G},d);}}catch{}}if(D.length>0){let w=new Map;for(let se of D){let te=w.get(se.skill)||[];te.push(se),w.set(se.skill,te);}let N=w.size,U=D.filter(se=>se.mode==="symlink"&&se.symlinkFailed),M=U.map(se=>se.agent),G=[];for(let[se,te]of w){let Se=te[0];if(Se.mode==="copy"){G.push(`${k.green("\u2713")} ${se} ${k.dim("(copied)")}`);for(let ge of te){let De=Tt(ge.path,d);G.push(` ${k.dim("\u2192")} ${De}`);}}else {if(Se.canonicalPath){let ge=Tt(Se.canonicalPath,d);G.push(`${k.green("\u2713")} ${ge}`);}else G.push(`${k.green("\u2713")} ${se}`);G.push(...Hl(te,i));}}let pe=k.green(`Installed ${N} skill${N!==1?"s":""}`);y.note(G.join(`
|
|
27
|
+
`),pe),U.length>0&&(y.log.warn(k.yellow(`Symlinks failed for: ${fe(M)}`)),y.log.message(k.dim(" Files were copied instead. On Windows, enable Developer Mode for symlink support.")));}if(F.length>0){console.log(),y.log.error(k.red(`Failed to install ${F.length}`));for(let w of F)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 Bl(s,i);}async function lt(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 Ye();if(o.isAgent&&(e$1.yes=true,!e$1.agent||e$1.agent.length===0)){let a=Zt(o.agent.name);a&&(e$1.agent=$n([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=ut(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 S=Xt(h$1);return S?xt(S.owner,S.repo).catch(()=>null):Promise.resolve(null)})();if(r.type==="well-known"){await ea(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,g=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 ve(r.localPath,r.subpath,{includeInternal:m,fullDepth:e$1.fullDepth});else if(r.type==="github"&&!e$1.fullDepth){let S=["vercel","houjallen","heygen-com"],_=Xe(r),O=_?.split("/")[0]?.toLowerCase(),R=!!_&&Object.hasOwn(e,_.toLowerCase());_&&O&&(R||S.includes(O))&&(a.start("Fetching skills..."),g=await k$1(_,{subpath:r.subpath,skillFilter:r.skillFilter,ref:r.ref,getToken:nt,includeInternal:m}),g||a.stop(k.dim("Falling back to clone..."))),g?(d=g.skills,a.stop(`Found ${k.green(d.length)} skill${d.length>1?"s":""}`)):(a.start("Cloning repository..."),i$1=await Ke(r.url,r.ref),a.stop("Repository cloned"),a.start("Discovering skills..."),d=await ve(i$1,r.subpath,{includeInternal:m,fullDepth:e$1.fullDepth}));}else a.start("Cloning repository..."),i$1=await Ke(r.url,r.ref),a.stop("Repository cloned"),a.start("Discovering skills..."),d=await ve(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 ye(i$1),process.exit(1)),g||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 S={},_=[];for(let R of d)if(R.pluginName){let K=R.pluginName;S[K]||(S[K]=[]),S[K].push(R);}else _.push(R);let O=Object.keys(S).sort();for(let R of O){let K=R.split("-").map(H=>H.charAt(0).toUpperCase()+H.slice(1)).join(" ");console.log(k.bold(K));for(let H of S[R])y.log.message(` ${k.cyan(le(H))}`),y.log.message(` ${k.dim(H.description)}`);console.log();}if(_.length>0){O.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 ye(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=Gt(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 S of d)y.log.message(` - ${le(S)}`);await ye(i$1),process.exit(1);}y.log.info(`Selected ${c.length} skill${c.length!==1?"s":""}: ${c.map(S=>k.cyan(le(S))).join(", ")}`);}else if(d.length===1){c=d;let S=d[0];y.log.info(`Skill: ${k.cyan(le(S))}`),y.log.message(k.dim(S.description));}else if(e$1.yes)c=d,y.log.info(`Installing all ${d.length} skills`);else {let S=[...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))),_=S.some(R=>R.pluginName),O;if(_){let R=H=>H.split("-").map(J=>J.charAt(0).toUpperCase()+J.slice(1)).join(" "),K={};for(let H of S){let J=H.pluginName?R(H.pluginName):"Other";K[J]||(K[J]=[]),K[J].push({value:H,label:le(H),hint:H.description.length>60?H.description.slice(0,57)+"...":H.description});}O=await y.groupMultiselect({message:`Select skills to install ${k.dim("(space to toggle)")}`,options:K,required:!0});}else {let R=S.map(K=>({value:K,label:le(K),hint:K.description.length>60?K.description.slice(0,57)+"...":K.description}));O=await zl({message:"Select skills to install",options:R,required:!0});}y.isCancel(O)&&(y.cancel("Installation cancelled"),await ye(i$1),process.exit(0)),c=O;}let f=Xe(r),x=f?dn(f,c.map(S=>le(S))):Promise.resolve(null),A,$=Object.keys(T);if(e$1.agent?.includes("*"))A=$,y.log.info(`Installing to all ${A.length} agents`);else if(e$1.agent&&e$1.agent.length>0){let S=e$1.agent.filter(_=>!$.includes(_));S.length>0&&(y.log.error(`Invalid agents: ${S.join(", ")}`),y.log.info(`Valid agents: ${$.join(", ")}`),await ye(i$1),process.exit(1)),A=e$1.agent;}else {a.start("Loading agents...");let S=await Oe(),_=Object.keys(T).length;if(a.stop(`${_} agents`),S.includes("eve")&&(e$1.yes||!o.isAgent)){let O=e$1.yes?!0:await y.confirm({message:Jr(c),initialValue:!0});if(y.isCancel(O)&&(y.cancel("Installation cancelled"),await ye(i$1),process.exit(0)),O)A=["eve"],y.log.info(`Installing to: ${k.cyan(Kl)}`);else {let R=await vn({global:e$1.global});y.isCancel(R)&&(y.cancel("Installation cancelled"),await ye(i$1),process.exit(0)),A=R;}}else if(S.length===0)if(e$1.yes)A=$,y.log.info("Installing to all agents");else {y.log.info("Select agents to install skills to");let O=Object.entries(T).filter(([K])=>K!=="eve").map(([K,H])=>({value:K,label:H.displayName})),R=await Gl("Which agents do you want to install to?",O);y.isCancel(R)&&(y.cancel("Installation cancelled"),await ye(i$1),process.exit(0)),A=R;}else if(S.length===1||e$1.yes)if(A=$n(S),S.length===1){let O=S[0];y.log.info(`Installing to: ${k.cyan(T[O].displayName)}`);}else y.log.info(`Installing to: ${S.map(O=>k.cyan(T[O].displayName)).join(", ")}`);else {let O=await vn({global:e$1.global});y.isCancel(O)&&(y.cancel("Installation cancelled"),await ye(i$1),process.exit(0)),A=O;}}e$1.subagent&&e$1.subagent.length>0&&!A.includes("eve")&&(A=[...A,"eve"]);let E=[void 0];if(A.includes("eve")){let S=et(process.cwd());if(e$1.subagent&&e$1.subagent.length>0)E=e$1.subagent.map(_=>_==="root"||_==="."?void 0:_);else if(S.length>0&&!e$1.yes){let _=[{value:"",label:"Root agent",hint:"agent/skills"},...S.map(R=>({value:R,label:R,hint:`agent/subagents/${R}/skills`}))],O=await y.multiselect({message:"Where should Eve skills be installed?",options:_,initialValues:[""],required:!0});y.isCancel(O)&&(y.cancel("Installation cancelled"),await ye(i$1),process.exit(0)),E=O.map(R=>R===""?void 0:R);}}let D=Yr(A,E),F=e$1.global??!1,C=A.some(S=>T[S].globalSkillsDir!==void 0);if(e$1.global===void 0&&!e$1.yes&&C){let S=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(S)&&(y.cancel("Installation cancelled"),await ye(i$1),process.exit(0)),F=S;}let L=e$1.copy?"copy":"symlink",w=D.every(S=>S.agent==="eve"),N=new Set(D.map(S=>S.subagent?`eve:subagent:${S.subagent}`:T[S.agent].skillsDir));if(!e$1.copy&&!e$1.yes&&N.size>1&&!w){let S=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(S)&&(y.cancel("Installation cancelled"),await ye(i$1),process.exit(0)),L=S;}else (N.size<=1||w)&&(L="copy");let U=process.cwd(),M=[],G=await Promise.all(c.flatMap(S=>D.map(async _=>({skillName:S.name,target:_,installed:await Jt(S.name,_.agent,{global:F,eveSubagent:_.subagent})})))),pe=new Map;for(let{skillName:S,target:_,installed:O}of G)pe.has(S)||pe.set(S,new Map),pe.get(S).set(Ml(_),O);let se={},te=[];for(let S of c)if(S.pluginName){let _=S.pluginName;se[_]||(se[_]=[]),se[_].push(S);}else te.push(S);let Se=S=>{for(let _ of S){M.length>0&&M.push("");let O=D.length===1?Je(_.name,{global:F,agent:D[0].agent,eveSubagent:D[0].subagent}):Je(_.name,{global:F}),R=Tt(O,U);M.push(`${k.cyan(R)}`),M.push(...Zr(D,L));let K=pe.get(_.name),H=D.filter(J=>K?.get(Ml(J))).map(Ps);H.length>0&&M.push(` ${k.yellow("overwrites:")} ${fe(H)}`);}},ge=Object.keys(se).sort();for(let S of ge){let _=S.split("-").map(O=>O.charAt(0).toUpperCase()+O.slice(1)).join(" ");M.push(""),M.push(k.bold(_)),Se(se[S]);}te.length>0&&(ge.length>0&&(M.push(""),M.push(k.bold("General"))),Se(te)),console.log(),y.note(M.join(`
|
|
28
|
+
`),"Installation Summary");try{let S=await x;if(S&&f){let _=Br(S,c.map(O=>({slug:le(O),displayName:le(O)})),f);_.length>0&&y.note(_.join(`
|
|
29
|
+
`),"Security Risk Assessments");}}catch{}if(!e$1.yes){let S=await y.confirm({message:"Proceed with installation?"});(y.isCancel(S)||!S)&&(y.cancel("Installation cancelled"),await ye(i$1),process.exit(0));}a.start("Installing skills...");let De=[];for(let S of c)for(let _ of D){let{agent:O,subagent:R}=_,K;if(g&&"files"in S){let H=S;K=await bs({installName:H.name,files:H.files},O,{global:F,mode:L,eveSubagent:R});}else i$1&&S.path===i$1&&S.rawContent?K=await bs({installName:S.name,files:[{path:"SKILL.md",contents:S.rawContent}]},O,{global:F,mode:L}):K=await qt(S,O,{global:F,mode:L,eveSubagent:R});De.push({skill:le(S),agent:Ps(_),pluginName:S.pluginName,...K});}a.stop("Installation complete"),console.log();let Ge=De.filter(S=>S.success),Ut=De.filter(S=>!S.success),Re={};for(let S of c)g&&"repoPath"in S?Re[S.name]=S.repoPath:i$1&&S.path===i$1?Re[S.name]="SKILL.md":i$1&&S.path.startsWith(i$1+sep)&&(Re[S.name]=`${S.path.slice(i$1.length+1).split(sep).join("/")}/SKILL.md`);let _e=Xe(r),cs=zr(r.url,_e);if(_e&&(Xt(_e)?await u===!1&&ke({event:"install",source:_e,skills:c.map(O=>O.name).join(","),agents:A.join(","),...F&&{global:"1"},skillFiles:JSON.stringify(Re)}):ke({event:"install",source:_e,skills:c.map(_=>_.name).join(","),agents:A.join(","),...F&&{global:"1"},skillFiles:JSON.stringify(Re)})),Ge.length>0&&F&&_e){let S=new Set(Ge.map(O=>O.skill)),_;r.type==="github"&&!g&&(_=await h(_e,r.ref,nt));for(let O of c){let R=le(O);if(S.has(R))try{let K="",H=Re[O.name];if(g&&H){let J=i(g.tree,H);J&&(K=J);}else if(r.type==="github"&&H&&_){let J=i(_,H);J&&(K=J);}else if(H&&i$1){let J=join(i$1,dirname(H)),Ot=await je(J);Ot&&(K=Ot);}await xs(O.name,{source:cs||_e,sourceType:r.type,sourceUrl:r.url,ref:r.ref,skillPath:H,skillFolderHash:K,pluginName:O.pluginName});}catch{}}}if(Ge.length>0&&!F){let S=new Set(Ge.map(R=>R.skill)),_=A.includes("eve")?E.map(R=>R??""):void 0,O=_&&(_.length>1||_.some(R=>R!==""));for(let R of c){let K=le(R);if(S.has(K))try{let H=g&&"snapshotHash"in R?R.snapshotHash:i$1&&R.path===i$1&&R.rawContent?Vr(R.rawContent):await je(R.path),J=Re[R.name];await wt(R.name,{source:cs||r.url,ref:r.ref,sourceType:r.type,...J&&{skillPath:J},computedHash:H,...O&&{subagents:_}},U);}catch{}}}if(Ge.length>0){let S=new Map,_={},O=[];for(let ae of Ge){let Be=S.get(ae.skill)||[];if(Be.push(ae),S.set(ae.skill,Be),Be.length===1)if(ae.pluginName){let Ue=ae.pluginName;_[Ue]||(_[Ue]=[]),_[Ue].push(ae);}else O.push(ae);}let R=S.size,K=Ge.filter(ae=>ae.mode==="symlink"&&ae.symlinkFailed),H=K.map(ae=>ae.agent),J=[],Ot=ae=>{for(let Be of ae){let Ue=S.get(Be.skill)||[],Rs=Ue[0];if(Rs.mode==="copy"){J.push(`${k.green("\u2713")} ${Be.skill} ${k.dim("(copied)")}`);for(let _s of Ue){let Wi=Tt(_s.path,U);J.push(` ${k.dim("\u2192")} ${Wi}`);}}else {if(Rs.canonicalPath){let _s=Tt(Rs.canonicalPath,U);J.push(`${k.green("\u2713")} ${_s}`);}else J.push(`${k.green("\u2713")} ${Be.skill}`);J.push(...Hl(Ue,A));}}},Gn=Object.keys(_).sort();for(let ae of Gn){let Be=ae.split("-").map(Ue=>Ue.charAt(0).toUpperCase()+Ue.slice(1)).join(" ");J.push(""),J.push(k.bold(Be)),Ot(_[ae]);}O.length>0&&(Gn.length>0&&(J.push(""),J.push(k.bold("General"))),Ot(O));let Mi=k.green(`Installed ${R} skill${R!==1?"s":""}`);y.note(J.join(`
|
|
30
|
+
`),Mi),K.length>0&&(y.log.warn(k.yellow(`Symlinks failed for: ${fe(H)}`)),y.log.message(k.dim(" Files were copied instead. On Windows, enable Developer Mode for symlink support.")));}if(Ut.length>0){console.log(),y.log.error(k.red(`Failed to install ${Ut.length}`));for(let S of Ut)y.log.message(` ${k.red("\u2717")} ${S.skill} \u2192 ${S.agent}: ${k.dim(S.error)}`);}console.log(),y.outro(k.green("Done!")+k.dim(" Review skills before use; they run with full agent permissions.")),await Bl(e$1,A);}catch(a){if(a instanceof We){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 ye(i$1);}}async function ye(t){if(t)try{await st(t);}catch{}}async function Bl(t,e){if(process.stdin.isTTY&&!t?.yes)try{if(await Sn("findSkillsPrompt"))return;if(await Jt("find-skills","claude-code",{global:!0})){await Pt("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 Pt("findSkillsPrompt");return}if(l){await Pt("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 lt(["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 Pt("findSkillsPrompt"),y.log.message(k.dim("You can install it later with: easbot skills add houjallen/skills@find-skills"));}catch{}}function ss(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 Ln=Log.create({service:"skills-find"}),Y="\x1B[0m",Ds="\x1B[1m",de="\x1B[38;5;102m",Nt="\x1B[38;5;145m",ql="\x1B[36m";var sa=process.env.SKILLS_API_URL||"https://skills.sh";function Jl(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 na=/^[a-z0-9](?:[a-z0-9-]{0,38})$/i;function Xl(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(!na.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 In(t,e){try{let s=new URLSearchParams({q:t,limit:"10"});e&&s.set("owner",e);let n=`${sa}/api/search?${s.toString()}`,l=await fetch(n);return l.ok?(await l.json()).skills.map(i=>({name:d(i.name),slug:d(i.id),source:d(i.source||""),installs:i.installs})).sort((i,a)=>(a.installs||0)-(i.installs||0)):[]}catch{return []}}var la="\x1B[?25l",ia="\x1B[?25h",oa="\x1B[J",ra=t=>`\x1B[${t}A`,aa=t=>`\x1B[${t}G`;async function ca(t="",e){let s=[],n=0,l=t,o=false,i=null,a=0;process.stdin.isTTY&&process.stdin.setRawMode(true),Ss.emitKeypressEvents(process.stdin),process.stdin.resume(),process.stdout.write(la);function r(){a>0&&process.stdout.write(ra(a)+aa(1)),process.stdout.write(oa);let u=[],m=`${Ds}_${Y}`;if(u.push(`${Nt}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 g=s.slice(0,8);for(let c=0;c<g.length;c++){let f=g[c],x=c===n,A=x?`${Ds}>${Y}`:" ",$=x?`${Ds}${f.name}${Y}`:`${Nt}${f.name}${Y}`,E=f.source?` ${de}${f.source}${Y}`:"",D=Jl(f.installs),F=D?` ${ql}${D}${Y}`:"",C=o&&c===0?` ${de}...${Y}`:"";u.push(` ${A} ${$}${E}${F}${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 In(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(ia),process.stdin.pause();}function d(g,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 ua(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 da(t,e){return await xt(t,e)===false}async function Pn(t){let{query:e,options:s,errors:n}=Xl(t),l=s.owner,o=!process.stdin.isTTY;Ln.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
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 m of n)console.error(m);console.error("Usage: easbot skills find <query> [--owner <owner>]");return}if(e){let m=await Ln(e,l);if(ke({event:"find",query:e,resultCount:String(m.length)}),m.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 m.slice(0,6)){let f=c.source||c.slug,x=ql(c.installs);console.log(`${Nt}${f}@${c.name}${Y}${x?` ${Vl}${x}${Y}`:""}`),console.log(`${de}\u2514 https://skills.sh/${c.slug}${Y}`),console.log();}return}if(o||await Yt()){console.log(i),console.log(),console.log(`${de}Usage: easbot skills find <query> [--owner <owner>]${Y}`);return}let a=await ra("",l);if(ke({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(`${Nt}Installing ${Ds}${h}${Y} from ${de}${r}${Y}...`),console.log();let{source:u,options:g}=ss([r,"--skill",h]);await lt(u,g),console.log();let d=aa(r);d&&await ca(d.owner,d.repo)?console.log(`${de}View the skill at${Y} ${Nt}https://skills.sh/${a.slug}${Y}`):console.log(`${de}Discover more skills at${Y} ${Nt}https://skills.sh${Y}`),console.log();}var Ie="\x1B[0m",Pn="\x1B[1m",Et="\x1B[38;5;102m";var da="\x1B[36m",Xl="\x1B[33m";function Ts(t,e){let s=homedir();return t.startsWith(s)?t.replace(s,"~"):t.startsWith(e)?"."+t.slice(e.length):t}function pa(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 Yl(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 Dn(t){let e=Yl(t),s=e.global===true,n;if(e.agent&&e.agent.length>0){let d=Object.keys(T),m=e.agent.filter(c=>!d.includes(c));m.length>0&&(console.log(`${Xl}Invalid agents: ${m.join(", ")}${Ie}`),console.log(`${Et}Valid agents: ${d.join(", ")}${Ie}`),process.exit(1)),n=e.agent;}let l=await tn({global:s,agentFilter:n});if(e.json){let d=l.map(m=>({name:m.name,path:m.canonicalPath,scope:m.scope,agents:m.agents.map(c=>T[c].displayName)}));console.log(JSON.stringify(d,null,2));return}let o=await wn(),i=process.cwd(),a=s?"Global":"Project";if(l.length===0){if(e.json){console.log("[]");return}console.log(`${Et}No ${a.toLowerCase()} skills found.${Ie}`),console.log(s?`${Et}Try listing project skills without -g${Ie}`:`${Et}Try listing global skills with -g${Ie}`);return}function r(d$1,m=false,c=0,f=0){let x=m?" ":"",A=Ts(d$1.canonicalPath,i),$=d$1.agents.map(C=>T[C].displayName),E=d$1.agents.length>0?pa($):`${Xl}not linked${Ie}`,D=d(d$1.name).padEnd(c),F=A.padEnd(f);console.log(`${x}${da}${D}${Ie} ${Et}${F}${Ie} ${Et}Agents:${Ie} ${E}`);}console.log(`${Pn}${a} Skills${Ie}`),console.log();let h={},u=[];for(let d of l){let m=o[d.name];if(m?.pluginName){let c=m.pluginName;h[c]||(h[c]=[]),h[c].push(d);}else u.push(d);}if(Object.keys(h).length>0){let d$1=Object.keys(h).sort();for(let m of d$1){let c=m.split("-").map(x=>x.charAt(0).toUpperCase()+x.slice(1)).join(" ");console.log(`${Pn}${c}${Ie}`);let f=h[m];if(f){let x=0,A=0;for(let $ of f){let E=d($.name).length,D=Ts($.canonicalPath,i).length;E>x&&(x=E),D>A&&(A=D);}for(let $ of f)r($,true,x,A);}console.log();}if(u.length>0){console.log(`${Pn}General${Ie}`);let m=0,c=0;for(let f of u){let x=d(f.name).length,A=Ts(f.canonicalPath,i).length;x>m&&(m=x),A>c&&(c=A);}for(let f of u)r(f,true,m,c);console.log();}}else {let d$1=0,m=0;for(let c of l){let f=d(c.name).length,x=Ts(c.canonicalPath,i).length;f>d$1&&(d$1=f),x>m&&(m=x);}for(let c of l)r(c,false,d$1,m);console.log();}}async function ns(t,e){let s=await Ye();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(Ce(true,l));for(let c of Object.values(T))c.globalSkillsDir!==void 0&&await a(c.globalSkillsDir);}else {await a(Ce(false,l));for(let c of Object.values(T))await a(join(l,c.skillsDir));for(let c of et(l))await a(ct(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(T),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(T),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 g=[];for(let c of h)try{let f=Je(c,{global:n,cwd:l});for(let C of u){let L=T[C],w=ys(c,C,{global:n,cwd:l}),N=new Set([w]),U=me(c);if(n&&L.globalSkillsDir)N.add(join(L.globalSkillsDir,U));else if(N.add(join(l,L.skillsDir,U)),C==="eve")for(let M of et(l))N.add(join(ct(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 ${L.displayName}: ${G instanceof Error?G.message:String(G)}`);}}let A=(await Oe()).filter(C=>!u.includes(C)),$=!1;for(let C of A){let L=ys(c,C,{global:n,cwd:l});if(await lstat(L).catch(()=>null)){$=!0;break}}$||await rm(f,{recursive:!0,force:!0});let E=n?await bn(c):null,D=E?.source||"local",F=E?.sourceType||"local";n&&await yn(c),g.push({skill:c,success:!0,source:D,sourceType:F});}catch(f){g.push({skill:c,success:false,error:f instanceof Error?f.message:String(f)});}o.stop("Removal process complete");let d=g.filter(c=>c.success),m=g.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)ke({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)`)),m.length>0){y.log.error(k.red(`Failed to remove ${m.length} skill(s)`));for(let c of m)y.log.message(` ${k.red("\u2717")} ${c.skill}: ${c.error}`);}console.log(),y.outro(k.green("Done!"));}function Tn(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 Ct(t,e){return e?`${t}#${e}`:t}function ma(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 fa(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 ha(t,e,s){if(!fa(t))return Ct(t,s);let n=ma(e),l=n?`${t}/${n}`:t;return s?`${l}#${s}`:l}function ei(t){return t.skillPath?ha(t.source,t.skillPath,t.ref):Ct(t.sourceUrl,t.ref)}var ai=dirname(fileURLToPath(import.meta.url)),W="\x1B[0m",ti="\x1B[1m",ee="\x1B[38;5;102m",oe="\x1B[38;5;145m";function ci(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 ui(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 di(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 ui()?"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 En(t,e){if(!e||e.length===0)return true;let s=t.toLowerCase();return e.some(n=>n.toLowerCase()===s)}function ba(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 wa(t){let e=t.sourceUrl;if(t.sourceType==="well-known"){let s=e.indexOf("/.well-known/");s!==-1&&(e=e.slice(0,s));}return Ct(e,t.ref)}function si(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=wa(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} ${d(l.name)} ${ee}(${l.reason})${W}`);}else {let l=n[0].reason,o=n.map(i=>d(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 Sa(t){let e=await $e(),s=[];for(let[n,l]of Object.entries(e.skills))En(n,t)&&(l.sourceType==="node_modules"||l.sourceType==="local"||s.push({name:n,source:l.source,entry:l}));return s}async function Nn(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 ns([h],{yes:true,global:n});}}return i}async function $a(t={}){let e=await Le(),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(!En(u,t.skills))continue;let g=e.skills[u];if(g){if(!g.skillFolderHash||!g.skillPath){i$1.push({name:u,reason:ba(g),sourceUrl:g.sourceUrl,sourceType:g.sourceType,ref:g.ref});continue}a.push({name:u,entry:g});}}let r=new Map;for(let u of a){let g=u.entry.source,d=r.get(g)||[];d.push(u),r.set(g,d);}for(let[u,g]of r){let d=g[0].entry,m=d.sourceUrl||d.source,c=null;process.stdout.write(`\r${ee}Checking skills from source: ${u}${W}\x1B[K
|
|
35
|
-
`);try{if(d.sourceType==="github"){let D=await h(u,d.ref,nt);if(!D){console.log(` ${ee}\u2717 Failed to fetch tree for ${u}${W}`);continue}let F=j$1(D),C=Object.entries(e.skills).filter(([N,U])=>U.source===u).map(([N,U])=>N),L=await
|
|
36
|
-
`),"Sync Summary"),!e.yes){let $=await y.confirm({message:"Proceed with sync?"});(y.isCancel($)||!$)&&(y.cancel("Sync cancelled"),process.exit(0));}l.start("Syncing skills...");let c=[];for(let $ of a)for(let E of h){let D=await qt($,E,{global:false,cwd:s,mode:"symlink"});c.push({skill:$.name,packageName:$.packageName,agent:T[E].displayName,success:D.success,path:D.path,canonicalPath:D.canonicalPath,error:D.error});}l.stop("Sync complete");let f=c.filter($=>$.success),x=c.filter($=>!$.success),A=new Set(f.map($=>$.skill));for(let $ of a)if(A.has($.name))try{let E=await je($.path);await wt($.name,{source:$.packageName,sourceType:"node_modules",computedHash:E},s);}catch{}if(console.log(),f.length>0){let $=new Map;for(let C of f){let L=$.get(C.skill)||[];L.push(C),$.set(C.skill,L);}let E=[];for(let[C,L]of $){let w=L[0],N=a.find(U=>U.name===C)?.packageName;if(w.canonicalPath){let U=
|
|
37
|
-
`),F);}if(x.length>0){console.log(),y.log.error(k.red(`Failed to install ${x.length}`));for(let $ of x)y.log.message(` ${k.red("\u2717")} ${$.skill} \u2192 ${$.agent}: ${k.dim($.error)}`);}ke({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 is(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
|
|
34
|
+
${de} 2) easbot skills add <owner/repo@skill>${Y}`;if(n.length>0){for(let g of n)console.error(g);console.error("Usage: easbot skills find <query> [--owner <owner>]");return}if(e){Ln.debug("runFind enter query branch",{query:e,owner:l});let g=await In(e,l);if(Ln.debug("runFind searchSkillsAPI returned",{count:g.length}),ke({event:"find",query:e,resultCount:String(g.length)}),g.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 g.slice(0,6)){let f=c.source||c.slug,x=Jl(c.installs);console.log(`${Nt}${f}@${c.name}${Y}${x?` ${ql}${x}${Y}`:""}`),console.log(`${de}\u2514 https://skills.sh/${c.slug}${Y}`),console.log();}return}if(o||await Yt()){console.log(i),console.log(),console.log(`${de}Usage: easbot skills find <query> [--owner <owner>]${Y}`);return}let a=await ca("",l);if(ke({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(`${Nt}Installing ${Ds}${h}${Y} from ${de}${r}${Y}...`),console.log();let{source:u,options:m}=ss([r,"--skill",h]);await lt(u,m),console.log();let d=ua(r);d&&await da(d.owner,d.repo)?console.log(`${de}View the skill at${Y} ${Nt}https://skills.sh/${a.slug}${Y}`):console.log(`${de}Discover more skills at${Y} ${Nt}https://skills.sh${Y}`),console.log();}var Ie="\x1B[0m",Dn="\x1B[1m",Et="\x1B[38;5;102m";var ga="\x1B[36m",Yl="\x1B[33m";function Ts(t,e){let s=homedir();return t.startsWith(s)?t.replace(s,"~"):t.startsWith(e)?"."+t.slice(e.length):t}function ma(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 Zl(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 Tn(t){let e=Zl(t),s=e.global===true,n;if(e.agent&&e.agent.length>0){let d=Object.keys(T),g=e.agent.filter(c=>!d.includes(c));g.length>0&&(console.log(`${Yl}Invalid agents: ${g.join(", ")}${Ie}`),console.log(`${Et}Valid agents: ${d.join(", ")}${Ie}`),process.exit(1)),n=e.agent;}let l=await tn({global:s,agentFilter:n});if(e.json){let d=l.map(g=>({name:g.name,path:g.canonicalPath,scope:g.scope,agents:g.agents.map(c=>T[c].displayName)}));console.log(JSON.stringify(d,null,2));return}let o=await wn(),i=process.cwd(),a=s?"Global":"Project";if(l.length===0){if(e.json){console.log("[]");return}console.log(`${Et}No ${a.toLowerCase()} skills found.${Ie}`),console.log(s?`${Et}Try listing project skills without -g${Ie}`:`${Et}Try listing global skills with -g${Ie}`);return}function r(d$1,g=false,c=0,f=0){let x=g?" ":"",A=Ts(d$1.canonicalPath,i),$=d$1.agents.map(C=>T[C].displayName),E=d$1.agents.length>0?ma($):`${Yl}not linked${Ie}`,D=d(d$1.name).padEnd(c),F=A.padEnd(f);console.log(`${x}${ga}${D}${Ie} ${Et}${F}${Ie} ${Et}Agents:${Ie} ${E}`);}console.log(`${Dn}${a} Skills${Ie}`),console.log();let h={},u=[];for(let d of l){let g=o[d.name];if(g?.pluginName){let c=g.pluginName;h[c]||(h[c]=[]),h[c].push(d);}else u.push(d);}if(Object.keys(h).length>0){let d$1=Object.keys(h).sort();for(let g of d$1){let c=g.split("-").map(x=>x.charAt(0).toUpperCase()+x.slice(1)).join(" ");console.log(`${Dn}${c}${Ie}`);let f=h[g];if(f){let x=0,A=0;for(let $ of f){let E=d($.name).length,D=Ts($.canonicalPath,i).length;E>x&&(x=E),D>A&&(A=D);}for(let $ of f)r($,true,x,A);}console.log();}if(u.length>0){console.log(`${Dn}General${Ie}`);let g=0,c=0;for(let f of u){let x=d(f.name).length,A=Ts(f.canonicalPath,i).length;x>g&&(g=x),A>c&&(c=A);}for(let f of u)r(f,true,g,c);console.log();}}else {let d$1=0,g=0;for(let c of l){let f=d(c.name).length,x=Ts(c.canonicalPath,i).length;f>d$1&&(d$1=f),x>g&&(g=x);}for(let c of l)r(c,false,d$1,g);console.log();}}async function ns(t,e){let s=await Ye();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(Ce(true,l));for(let c of Object.values(T))c.globalSkillsDir!==void 0&&await a(c.globalSkillsDir);}else {await a(Ce(false,l));for(let c of Object.values(T))await a(join(l,c.skillsDir));for(let c of et(l))await a(ct(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(T),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(T),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=Je(c,{global:n,cwd:l});for(let C of u){let L=T[C],w=ys(c,C,{global:n,cwd:l}),N=new Set([w]),U=me(c);if(n&&L.globalSkillsDir)N.add(join(L.globalSkillsDir,U));else if(N.add(join(l,L.skillsDir,U)),C==="eve")for(let M of et(l))N.add(join(ct(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 ${L.displayName}: ${G instanceof Error?G.message:String(G)}`);}}let A=(await Oe()).filter(C=>!u.includes(C)),$=!1;for(let C of A){let L=ys(c,C,{global:n,cwd:l});if(await lstat(L).catch(()=>null)){$=!0;break}}$||await rm(f,{recursive:!0,force:!0});let E=n?await bn(c):null,D=E?.source||"local",F=E?.sourceType||"local";n&&await yn(c),m.push({skill:c,success:!0,source:D,sourceType:F});}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),g=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)ke({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)`)),g.length>0){y.log.error(k.red(`Failed to remove ${g.length} skill(s)`));for(let c of g)y.log.message(` ${k.red("\u2717")} ${c.skill}: ${c.error}`);}console.log(),y.outro(k.green("Done!"));}function Nn(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 Ct(t,e){return e?`${t}#${e}`:t}function ha(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 ka(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 ya(t,e,s){if(!ka(t))return Ct(t,s);let n=ha(e),l=n?`${t}/${n}`:t;return s?`${l}#${s}`:l}function ti(t){return t.skillPath?ya(t.source,t.skillPath,t.ref):Ct(t.sourceUrl,t.ref)}var ci=dirname(fileURLToPath(import.meta.url)),W="\x1B[0m",si="\x1B[1m",ee="\x1B[38;5;102m",oe="\x1B[38;5;145m";function ui(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 di(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 pi(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 di()?"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 Cn(t,e){if(!e||e.length===0)return true;let s=t.toLowerCase();return e.some(n=>n.toLowerCase()===s)}function Sa(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 $a(t){let e=t.sourceUrl;if(t.sourceType==="well-known"){let s=e.indexOf("/.well-known/");s!==-1&&(e=e.slice(0,s));}return Ct(e,t.ref)}function ni(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=$a(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} ${d(l.name)} ${ee}(${l.reason})${W}`);}else {let l=n[0].reason,o=n.map(i=>d(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 va(t){let e=await $e(),s=[];for(let[n,l]of Object.entries(e.skills))Cn(n,t)&&(l.sourceType==="node_modules"||l.sourceType==="local"||s.push({name:n,source:l.source,entry:l}));return s}async function En(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 ns([h],{yes:true,global:n});}}return i}async function xa(t={}){let e=await Le(),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(!Cn(u,t.skills))continue;let m=e.skills[u];if(m){if(!m.skillFolderHash||!m.skillPath){i$1.push({name:u,reason:Sa(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,g=d.sourceUrl||d.source,c=null;process.stdout.write(`\r${ee}Checking skills from source: ${u}${W}\x1B[K
|
|
35
|
+
`);try{if(d.sourceType==="github"){let D=await h(u,d.ref,nt);if(!D){console.log(` ${ee}\u2717 Failed to fetch tree for ${u}${W}`);continue}let F=j$1(D),C=Object.entries(e.skills).filter(([N,U])=>U.source===u).map(([N,U])=>N),L=await En(u,C,e.skills,!0,t,F),w=new Set(L);for(let{name:N,entry:U}of m){if(w.has(N))continue;let M=i(D,U.skillPath);M&&M!==U.skillFolderHash&&o.push({name:N,source:u,entry:U});}continue}c=await Ke(g,d.ref);let x=(await ve(c)).map(D=>join(relative(c,D.path),"SKILL.md").split(sep).join("/")),A=Object.entries(e.skills).filter(([D,F])=>F.source===u).map(([D,F])=>D),$=await En(u,A,e.skills,!0,t,x),E=new Set($);for(let{name:D,entry:F}of m){if(E.has(D))continue;let C=F.skillPath;if(!x.includes(C))continue;let L=await je(join(c,dirname(C)));L&&L!==F.skillFolderHash&&o.push({name:D,source:u,entry:F});}}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 ni(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=d(u.name);console.log(`${oe}Updating ${m}...${W}`);let d$1=ti(u.entry),g=join(ci,"..","bin","cli.mjs");if(!existsSync(g)){l++,console.log(` ${ee}\u2717 Failed to update ${m}: CLI entrypoint not found at ${g}${W}`);continue}spawnSync(process.execPath,[g,"add",d$1,"-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 ni(i$1),{successCount:n,failCount:l,checkedCount:h$1}}async function Aa(t={}){let e=await va(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(g=>g.entry.skillPath),o=e.filter(g=>!g.entry.skillPath);if(l.length===0)return console.log(`${ee}No project skills can be updated in place.${W}`),li(o),{successCount:s,failCount:n,foundCount:e.length};let i=process.cwd(),a=[],r=false;for(let[g,c]of Object.entries(T))if(we(g))!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 g of l){let c=g.entry.source,f=u.get(c)||[];f.push(g),u.set(c,f);}let m=await $e(),d$1=join(ci,"..","bin","cli.mjs");if(!existsSync(d$1))return console.log(`${ee}\u2717 CLI entrypoint not found at ${d$1}${W}`),{successCount:s,failCount:l.length,foundCount:e.length};for(let[g,c]of u){let f=c[0].entry,x=f.source,A=f.ref,$=Object.entries(m.skills).filter(([C,L])=>L.source===g).map(([C,L])=>C),E=null,D=[];try{E=await Ke(x,A);let L=(await ve(E)).map(w=>{let N=relative(E,w.path);return join(N,"SKILL.md").split(sep).join("/")});D=await En(g,$,m.skills,!1,t,L);}catch{console.log(`${ee}\u2717 Failed to check for deleted skills from ${g}${W}`);}finally{E&&await st(E);}let F=c.filter(C=>!D.includes(C.name));for(let C of F){let L=d(C.name);console.log(`${oe}Updating ${L}...${W}`);let w=Ct(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$1,"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 ${L}`)):(n++,console.log(` ${ee}\u2717 Failed to update ${L}${W}`));}}return li(o),{successCount:s,failCount:n,foundCount:e.length}}function li(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=Ct(e.entry.source,e.entry.ref);console.log(` ${oe}\u2022${W} ${d(e.name)}`),console.log(` ${ee}To refresh: ${oe}easbot skills add ${s} -y${W}`);}}}async function Rn(t=[]){let e=ui(t),s=await pi(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(`${si}Global Skills${W}`);let{successCount:i,failCount:a,checkedCount:r}=await xa(e);n+=i,l+=a,o+=r,s==="both"&&!e.skills&&console.log();}if(s==="project"||s==="both"){s==="both"&&!e.skills&&console.log(`${si}Project Skills${W}`);let{successCount:i,failCount:a,foundCount:r}=await Aa(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}`),ke({event:"update",scope:s,skillCount:String(n+l),successCount:String(n),failCount:String(l)}),console.log();}var mi=t=>typeof t=="symbol";function fi(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 Ia(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 Me(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 g=await Me(join(d,"SKILL.md"));g&&s.push({...g,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 ls(t,e={}){let s=process.cwd(),n=await Ye();if(n.isAgent&&(e.yes=true,!e.agent||e.agent.length===0)){let $=Zt(n.agent.name);if($){let E=[$];for(let D of qe())E.includes(D)||E.push(D);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 Ia(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 $ of o)y.log.info(`${k.cyan($.name)} ${k.dim(`from ${$.packageName}`)}`),$.description&&y.log.message(k.dim(` ${$.description}`));let i=await $e(s),a=[],r=[];if(e.force)a.push(...o),y.log.info(k.dim("Force mode: reinstalling all skills"));else {for(let $ of o){let E=i.skills[$.name];if(E&&await je($.path)===E.computedHash){r.push($.name);continue}a.push($);}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(T),m=qe(),d=Ht();if(e.agent?.includes("*"))h=u,y.log.info(`Installing to all ${h.length} agents`);else if(e.agent&&e.agent.length>0){let $=e.agent.filter(E=>!u.includes(E));$.length>0&&(y.log.error(`Invalid agents: ${$.join(", ")}`),y.log.info(`Valid agents: ${u.join(", ")}`),process.exit(1)),h=e.agent;}else {l.start("Loading agents...");let $=await Oe(),E=Object.keys(T).length;if(l.stop(`${E} agents`),$.length===0)if(e.yes)h=m,y.log.info("Installing to universal agents");else {let F=bt().map(L=>({value:L,label:T[L].displayName,hint:T[L].skillsDir})),C=await Lt({message:"Which agents do you want to install to?",items:F,initialSelected:[],lockedSection:{title:"Universal (.agents/skills)",items:d.map(L=>({value:L,label:T[L].displayName})),hiddenCount:m.length-d.length}});mi(C)&&(y.cancel("Sync cancelled"),process.exit(0)),h=C;}else if($.length===1||e.yes){h=[...$];for(let D of m)h.includes(D)||h.push(D);}else {let F=bt().filter(L=>$.includes(L)).map(L=>({value:L,label:T[L].displayName,hint:T[L].skillsDir})),C=await Lt({message:"Which agents do you want to install to?",items:F,initialSelected:$.filter(L=>!m.includes(L)),lockedSection:{title:"Universal (.agents/skills)",items:d.map(L=>({value:L,label:T[L].displayName})),hiddenCount:m.length-d.length}});mi(C)&&(y.cancel("Sync cancelled"),process.exit(0)),h=C;}}let g=[];for(let $ of a){let E=Je($.name,{global:false}),D=fi(E,s);g.push(`${k.cyan($.name)} ${k.dim(`\u2190 ${$.packageName}`)}`),g.push(` ${k.dim(D)}`);}if(console.log(),y.note(g.join(`
|
|
36
|
+
`),"Sync Summary"),!e.yes){let $=await y.confirm({message:"Proceed with sync?"});(y.isCancel($)||!$)&&(y.cancel("Sync cancelled"),process.exit(0));}l.start("Syncing skills...");let c=[];for(let $ of a)for(let E of h){let D=await qt($,E,{global:false,cwd:s,mode:"symlink"});c.push({skill:$.name,packageName:$.packageName,agent:T[E].displayName,success:D.success,path:D.path,canonicalPath:D.canonicalPath,error:D.error});}l.stop("Sync complete");let f=c.filter($=>$.success),x=c.filter($=>!$.success),A=new Set(f.map($=>$.skill));for(let $ of a)if(A.has($.name))try{let E=await je($.path);await wt($.name,{source:$.packageName,sourceType:"node_modules",computedHash:E},s);}catch{}if(console.log(),f.length>0){let $=new Map;for(let C of f){let L=$.get(C.skill)||[];L.push(C),$.set(C.skill,L);}let E=[];for(let[C,L]of $){let w=L[0],N=a.find(U=>U.name===C)?.packageName;if(w.canonicalPath){let U=fi(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 D=$.size,F=k.green(`Synced ${D} skill${D!==1?"s":""}`);y.note(E.join(`
|
|
37
|
+
`),F);}if(x.length>0){console.log(),y.log.error(k.red(`Failed to install ${x.length}`));for(let $ of x)y.log.message(` ${k.red("\u2717")} ${$.skill} \u2192 ${$.agent}: ${k.dim($.error)}`);}ke({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 is(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 On(t){let e=process.cwd(),s=await $e(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=qe(),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 lt([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}=is(t);await ls(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 Ua=["vercel","houjallen","heygen-com"],Oa=new Set(["metadata.json"]),Fa=new Set([".git","__pycache__","__pypackages__"]),jn={"claude-code":{command:"claude",args:[]},codex:{command:"codex",args:[]}},vi=Object.keys(jn);function Mn(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(...Ha(s.agent)),{source:e,options:s,errors:n}}function xi(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
38
|
${t.skillMd}
|
|
39
39
|
</SKILL.md>`];return t.hasSupportingFiles&&t.supportDir&&e.push(`Supporting files for this skill were downloaded to:
|
|
40
40
|
${t.supportDir}
|
|
@@ -42,17 +42,17 @@ ${t.supportDir}
|
|
|
42
42
|
When the SKILL.md references relative paths, read them from that directory.`),e.join(`
|
|
43
43
|
|
|
44
44
|
`)+`
|
|
45
|
-
`}async function
|
|
45
|
+
`}async function Ai(t){let e=await mkdtemp(join(tmpdir(),"skills-use-")),s=join(e,me(t.directoryName||t.name));if(!Kn(e,s))throw new Error("Invalid skill name: potential path traversal detected");await mkdir(s,{recursive:true}),t.kind==="blob"?await za(s,t.files):t.kind==="well-known"?await Ga(s,t.files):await Ni(t.path,s);let n=t.rawContent??await readFile(join(s,"SKILL.md"),"utf-8"),l=await Ei(s,s);return {tempRoot:e,skillDir:s,skillMd:n,hasSupportingFiles:l}}async function Wn(t,e={},s=[]){let n=null;try{if(e.help){console.log(bi());return}s.length>0&&Qe(s.join(`
|
|
46
46
|
`)),t.length===0&&Qe(`Missing required argument: source
|
|
47
47
|
|
|
48
|
-
${
|
|
49
|
-
`));let h=
|
|
48
|
+
${bi()}`),t.length>1&&Qe(`Expected one source, received ${t.length}: ${t.join(", ")}`);let l=e.agent?.[0];l&&!jn[l]&&Qe(Di(l));let o=t[0],i=ut(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=Ma(i.skillFilter,e.skill),u=h!==void 0,m;if(i.type==="well-known"){let c=await dt.fetchAllSkills(i.url);m=Ka(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 ve(i.localPath,i.subpath,{includeInternal:u,fullDepth:e.fullDepth});else if(i.type==="github"&&!e.fullDepth){let A=Xe(i),$=A?.split("/")[0]?.toLowerCase();A&&$&&Ua.includes($)&&(f=await k$1(A,{subpath:i.subpath,skillFilter:h,ref:i.ref,getToken:nt,includeInternal:u})),f?c=f.skills:(n=await Ke(i.url,i.ref),c=await ve(n,i.subpath,{includeInternal:u,fullDepth:e.fullDepth}));}else n=await Ke(i.url,i.ref),c=await ve(n,i.subpath,{includeInternal:u,fullDepth:e.fullDepth});let x=Wa(c,h,o);f&&Ba(x)?m={kind:"blob",name:x.name,directoryName:x.name,rawContent:x.rawContent??Va(x.files),files:x.files}:m={kind:"disk",name:x.name,directoryName:x.name,rawContent:x.rawContent,path:x.path};}let d=await Ai(m);await wi(n),n=null;let g=xi({skillMd:d.skillMd,supportDir:d.skillDir,hasSupportingFiles:d.hasSupportingFiles});if(l){let c=await Li(l,g);c!==0&&process.exit(c);return}process.stdout.write(g);}catch(l){await wi(n),l instanceof We&&Qe(l.message),l instanceof be&&Qe(l.message),Qe(l instanceof Error?l.message:"Unknown error");}}async function Li(t,e,s=ja){let n=jn[t];if(!n)throw new be(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 be(`Could not launch ${T[t].displayName}: command not found: ${n.command}`));return}o(r);}}),i.on("close",r=>{a||(a=true,l(r??1));});})}function ja(t,e){return spawn(t,e,{stdio:"inherit"})}function bi(){return `Usage: skills use <source>[@<skill>] [options]
|
|
50
50
|
|
|
51
51
|
Generate a prompt for using one skill without installing it.
|
|
52
52
|
|
|
53
53
|
Options:
|
|
54
54
|
-s, --skill <skill> Select the skill to use
|
|
55
|
-
-a, --agent <agent> Start one supported agent interactively (${
|
|
55
|
+
-a, --agent <agent> Start one supported agent interactively (${vi.join(", ")})
|
|
56
56
|
--full-depth Search nested directories like skills add --full-depth
|
|
57
57
|
--dangerously-accept-openclaw-risks
|
|
58
58
|
Allow unverified OpenClaw community skills
|
|
@@ -61,13 +61,13 @@ Options:
|
|
|
61
61
|
Examples:
|
|
62
62
|
skills use houjallen/agent-skills@web-design-guidelines | claude
|
|
63
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
|
|
64
|
+
skills use houjallen/agent-skills@web-design-guidelines --agent codex`}function Ma(t,e){if(t&&e){if(t.toLowerCase()!==e.toLowerCase())throw new be(`Conflicting skill selectors: source selects "${t}" but --skill selects "${e}". Provide one selector.`);return e}return e??t}function Wa(t,e,s){if(t.length===0)throw new be("No valid skills found. Skills require a SKILL.md with name and description.");if(!e){if(t.length===1)return t[0];throw new be(Ii(s,t.map(le)))}let n=Gt(t,[e]);if(n.length===0)throw new be(Pi(e,t.map(le)));if(n.length>1)throw new be(`Skill selector "${e}" matched multiple skills.`);return n[0]}function Ka(t,e,s){if(t.length===0)throw new be("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 be(Pi(e,t.map(o=>o.installName)));if(n.length>1)throw new be(`Skill selector "${e}" matched multiple skills.`)}else {if(t.length!==1)throw new be(Ii(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 Ii(t,e){return ["This source contains multiple skills. Specify exactly one skill:",...e.map(s=>` - ${s}`),"",`Examples:
|
|
65
65
|
skills use ${t}@${e[0]??"<skill>"}
|
|
66
66
|
skills use ${t} --skill ${e[0]??"<skill>"}`].join(`
|
|
67
|
-
`)}function
|
|
68
|
-
`)}function
|
|
69
|
-
Valid agents: ${s.join(", ")}`),e}function
|
|
70
|
-
`)}async function Ka(t,e){for(let s of e)await Di(t,s.path,s.contents);}async function Ha(t,e){for(let[s,n]of e)await Di(t,s,n);}async function Di(t,e,s){let n=join(t,e);Wn(t,n)&&(await mkdir(dirname(n),{recursive:true}),typeof s=="string"?await writeFile(n,s,"utf-8"):await writeFile(n,s));}async function Ti(t,e){await mkdir(e,{recursive:true});let s=await readdir(t,{withFileTypes:true});await Promise.all(s.filter(n=>!Ba(n.name,n.isDirectory())).map(async n=>{let l=join(t,n.name),o=join(e,n.name);if(Wn(e,o)){if(n.isDirectory()){await Ti(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 Ni(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 Ni(t,l))return true}else if(o.toLowerCase()!=="skill.md")return true}return false}function za(t){return Array.isArray(t.files)}function Ga(t){return t.find(s=>s.path.toLowerCase()==="skill.md")?.contents??""}function Ba(t,e){return _a.has(t)||e&&Ua.has(t)}function Wn(t,e){let s=normalize(resolve(t)),n=normalize(resolve(e));return n.startsWith(s+sep)||n===s}async function bi(t){t&&await st(t).catch(()=>{});}function Qe(t){console.error(t),process.exit(1);}var be=class extends Error{};var Ei={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 qa=Ei.languages,Ja=qa.filter(t=>t.supported).map(t=>t.value),ft={defaultLocale:"zh-CN",locales:Ja},os={},Es=(t,e)=>{let s=os[t]||{translation:{}};return os[t]={translation:{...s.translation,...e.translation}},os[t]},Cs=(t=ft.defaultLocale)=>(os[t]||Es(t,{translation:{}}),{locale:t,resources:os[t]||{translation:{}}});var Xa={translation:{"cli.banner.tagline":"\u5F00\u653E 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.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"}},Ci=Xa;var Ya={translation:{"cli.banner.tagline":"The open 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.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"}},Ri=Ya;var Za=()=>{Cs("zh-CN"),Cs("en-US"),Es("zh-CN",Ci),Es("en-US",Ri);};Za();var Kn=new Map;var Hn=new Map;var Qa=t=>{if(Hn.has(t))return Hn.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 Hn.set(t,o),o},_i=(t,e)=>{if(!t||typeof t!="string")return "";if(!e||Object.keys(e).length===0)return t;let{regex:s,keys:n}=Qa(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)})},ec=t=>t&&ft.locales.includes(t)?t:ft.defaultLocale,Ui=t=>{if(!Kn.has(t)){let{resources:e}=Cs(t);Kn.set(t,e);}return Kn.get(t)},tc=(t,e={})=>{let s=ec(e.locale),l=Ui(s)?.translation[t];if(l&&typeof l=="string"){let o=_i(l,e.vars);return o!=null?String(o):String(t)}if(s!==ft.defaultLocale){let i=Ui(ft.defaultLocale)?.translation[t];if(i&&typeof i=="string"){let a=_i(i,e.vars);return a!=null?String(a):String(t)}}return String(e.fallback??t)},j=tc;var v="\x1B[0m",re="\x1B[1m",I="\x1B[38;5;102m",Pe="\x1B[38;5;145m";function oc(t){return t&&xn(t),t??"0.0.0"}function as(t){if(t?.locale)return t.locale;let e=process.env.EASBOT_LANG?.trim()||process.env.LANG?.trim();if(e){if(/^zh/i.test(e))return "zh-CN";if(/^en/i.test(e))return "en-US"}return "en-US"}function Fi(t){let e=as(t);console.log(),console.log(`${I}${j("cli.banner.tagline",{locale:e,fallback:"The open agent skills ecosystem"})}${v}`),console.log(),console.log(` ${I}$${v} ${Pe}easbot skills add ${I}<package>${v} ${I}${j("cli.banner.cmd.add",{locale:e,vars:{cmd:"",dim:"",reset:""},fallback:"Add a new skill"})}${v}`),console.log(` ${I}$${v} ${Pe}easbot skills use ${I}<package>@<skill>${v} ${I}${j("cli.banner.cmd.use",{locale:e,vars:{cmd:"",dim:"",reset:""},fallback:"Use a skill without installing"})}${v}`),console.log(` ${I}$${v} ${Pe}easbot skills remove${v} ${I}${j("cli.example.remove_interactive",{locale:e,fallback:"Remove installed skills"})}${v}`),console.log(` ${I}$${v} ${Pe}easbot skills list${v} ${I}${j("cli.example.list_project",{locale:e,fallback:"List installed skills"})}${v}`),console.log(` ${I}$${v} ${Pe}easbot skills find ${I}[query]${v} ${I}${j("cli.example.find_interactive",{locale:e,fallback:"Search for skills"})}${v}`),console.log(),console.log(` ${I}$${v} ${Pe}easbot skills update${v} ${I}${j("cli.example.update_global",{locale:e,fallback:"Update installed skills"})}${v}`),console.log(),console.log(` ${I}$${v} ${Pe}easbot skills experimental_install${v} ${I}${j("cli.example.install",{locale:e,fallback:"Restore from skills-lock.json"})}${v}`),console.log(` ${I}$${v} ${Pe}easbot skills init ${I}[name]${v} ${I}${j("cli.example.init",{locale:e,fallback:"Create a new skill"})}${v}`),console.log(` ${I}$${v} ${Pe}easbot skills experimental_sync${v} ${I}${j("cli.example.sync",{locale:e,fallback:"Sync skills from node_modules"})}${v}`),console.log(),console.log(`${I}${j("cli.banner.try_hint",{locale:e,fallback:"try:"})}${v} easbot skills add houjallen/agent-skills`),console.log(),console.log(`${I}${j("cli.banner.discover",{locale:e,vars:{url:"https://skills.sh/"},fallback:"Discover more skills at https://skills.sh/"})}${v}`),console.log();}function rc(t){let e=as(t),s=(n,l)=>I+j(n,{locale:e,fallback:l})+v;console.log(`
|
|
67
|
+
`)}function Pi(t,e){return [`No matching skill found for: ${t}`,"Available skills:",...e.map(s=>` - ${s}`)].join(`
|
|
68
|
+
`)}function Ha(t){if(!t||t.length===0)return [];let e=[],s=Object.keys(T),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 ${T[t].displayName} is not supported yet.`,`Supported agents for skills use --agent: ${vi.join(", ")}`].join(`
|
|
70
|
+
`)}async function za(t,e){for(let s of e)await Ti(t,s.path,s.contents);}async function Ga(t,e){for(let[s,n]of e)await Ti(t,s,n);}async function Ti(t,e,s){let n=join(t,e);Kn(t,n)&&(await mkdir(dirname(n),{recursive:true}),typeof s=="string"?await writeFile(n,s,"utf-8"):await writeFile(n,s));}async function Ni(t,e){await mkdir(e,{recursive:true});let s=await readdir(t,{withFileTypes:true});await Promise.all(s.filter(n=>!qa(n.name,n.isDirectory())).map(async n=>{let l=join(t,n.name),o=join(e,n.name);if(Kn(e,o)){if(n.isDirectory()){await Ni(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 Ei(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 Ei(t,l))return true}else if(o.toLowerCase()!=="skill.md")return true}return false}function Ba(t){return Array.isArray(t.files)}function Va(t){return t.find(s=>s.path.toLowerCase()==="skill.md")?.contents??""}function qa(t,e){return Oa.has(t)||e&&Fa.has(t)}function Kn(t,e){let s=normalize(resolve(t)),n=normalize(resolve(e));return n.startsWith(s+sep)||n===s}async function wi(t){t&&await st(t).catch(()=>{});}function Qe(t){console.error(t),process.exit(1);}var be=class extends Error{};var Ci={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 Xa=Ci.languages,Ya=Xa.filter(t=>t.supported).map(t=>t.value),ft={defaultLocale:"zh-CN",locales:Ya},os={},Es=(t,e)=>{let s=os[t]||{translation:{}};return os[t]={translation:{...s.translation,...e.translation}},os[t]},Cs=(t=ft.defaultLocale)=>(os[t]||Es(t,{translation:{}}),{locale:t,resources:os[t]||{translation:{}}});var Za={translation:{"cli.banner.tagline":"\u5F00\u653E 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.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"}},Ri=Za;var Qa={translation:{"cli.banner.tagline":"The open 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.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"}},_i=Qa;var ec=()=>{Cs("zh-CN"),Cs("en-US"),Es("zh-CN",Ri),Es("en-US",_i);};ec();var Hn=new Map;var zn=new Map;var tc=t=>{if(zn.has(t))return zn.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 zn.set(t,o),o},Ui=(t,e)=>{if(!t||typeof t!="string")return "";if(!e||Object.keys(e).length===0)return t;let{regex:s,keys:n}=tc(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)})},sc=t=>t&&ft.locales.includes(t)?t:ft.defaultLocale,Oi=t=>{if(!Hn.has(t)){let{resources:e}=Cs(t);Hn.set(t,e);}return Hn.get(t)},nc=(t,e={})=>{let s=sc(e.locale),l=Oi(s)?.translation[t];if(l&&typeof l=="string"){let o=Ui(l,e.vars);return o!=null?String(o):String(t)}if(s!==ft.defaultLocale){let i=Oi(ft.defaultLocale)?.translation[t];if(i&&typeof i=="string"){let a=Ui(i,e.vars);return a!=null?String(a):String(t)}}return String(e.fallback??t)},j=nc;var v="\x1B[0m",re="\x1B[1m",I="\x1B[38;5;102m",Pe="\x1B[38;5;145m";function ac(t){return t&&xn(t),t??"0.0.0"}function as(t){if(t?.locale)return t.locale;let e=process.env.EASBOT_LANG?.trim()||process.env.LANG?.trim();if(e){if(/^zh/i.test(e))return "zh-CN";if(/^en/i.test(e))return "en-US"}return "en-US"}function ji(t){let e=as(t);console.log(),console.log(`${I}${j("cli.banner.tagline",{locale:e,fallback:"The open agent skills ecosystem"})}${v}`),console.log(),console.log(` ${I}$${v} ${Pe}easbot skills add ${I}<package>${v} ${I}${j("cli.banner.cmd.add",{locale:e,vars:{cmd:"",dim:"",reset:""},fallback:"Add a new skill"})}${v}`),console.log(` ${I}$${v} ${Pe}easbot skills use ${I}<package>@<skill>${v} ${I}${j("cli.banner.cmd.use",{locale:e,vars:{cmd:"",dim:"",reset:""},fallback:"Use a skill without installing"})}${v}`),console.log(` ${I}$${v} ${Pe}easbot skills remove${v} ${I}${j("cli.example.remove_interactive",{locale:e,fallback:"Remove installed skills"})}${v}`),console.log(` ${I}$${v} ${Pe}easbot skills list${v} ${I}${j("cli.example.list_project",{locale:e,fallback:"List installed skills"})}${v}`),console.log(` ${I}$${v} ${Pe}easbot skills find ${I}[query]${v} ${I}${j("cli.example.find_interactive",{locale:e,fallback:"Search for skills"})}${v}`),console.log(),console.log(` ${I}$${v} ${Pe}easbot skills update${v} ${I}${j("cli.example.update_global",{locale:e,fallback:"Update installed skills"})}${v}`),console.log(),console.log(` ${I}$${v} ${Pe}easbot skills experimental_install${v} ${I}${j("cli.example.install",{locale:e,fallback:"Restore from skills-lock.json"})}${v}`),console.log(` ${I}$${v} ${Pe}easbot skills init ${I}[name]${v} ${I}${j("cli.example.init",{locale:e,fallback:"Create a new skill"})}${v}`),console.log(` ${I}$${v} ${Pe}easbot skills experimental_sync${v} ${I}${j("cli.example.sync",{locale:e,fallback:"Sync skills from node_modules"})}${v}`),console.log(),console.log(`${I}${j("cli.banner.try_hint",{locale:e,fallback:"try:"})}${v} easbot skills add houjallen/agent-skills`),console.log(),console.log(`${I}${j("cli.banner.discover",{locale:e,vars:{url:"https://skills.sh/"},fallback:"Discover more skills at https://skills.sh/"})}${v}`),console.log();}function cc(t){let e=as(t),s=(n,l)=>I+j(n,{locale:e,fallback:l})+v;console.log(`
|
|
71
71
|
${re}${j("cli.help.usage",{locale:e,fallback:"Usage: skills <command> [options]"})}${v}
|
|
72
72
|
|
|
73
73
|
${re}${j("cli.help.section.manage",{locale:e,fallback:"Manage Skills"})}${v}:
|
|
@@ -160,7 +160,7 @@ ${re}Examples:${v}
|
|
|
160
160
|
${I}$${v} easbot skills experimental_sync -y ${I}# ${s("cli.example.sync_no_prompt","Sync without prompts")}${v}
|
|
161
161
|
|
|
162
162
|
${I}${j("cli.banner.discover",{locale:e,vars:{url:"https://skills.sh/"},fallback:"Discover more skills at https://skills.sh/"})}${v}
|
|
163
|
-
`);}function
|
|
163
|
+
`);}function uc(t){let e=as(t);console.log(`
|
|
164
164
|
${re}${j("cli.help.remove.usage",{locale:e,fallback:"Usage: easbot skills remove [skills...] [options]"})}${v}
|
|
165
165
|
|
|
166
166
|
${re}Description:${v}
|
|
@@ -186,7 +186,7 @@ ${re}Examples:${v}
|
|
|
186
186
|
${I}$${v} easbot skills remove --skill '*' -a cursor ${I}# ${j("cli.example.remove_agent_all",{locale:e,fallback:"Remove all skills from one agent"})}${v}
|
|
187
187
|
|
|
188
188
|
${I}${j("cli.banner.discover",{locale:e,vars:{url:"https://skills.sh/"},fallback:"Discover more skills at https://skills.sh/"})}${v}
|
|
189
|
-
`);}function rs(){console.log();}function
|
|
189
|
+
`);}function rs(){console.log();}function dc(t,e){let s=as(e),n=e?.cwd??ot()??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(`${Pe}${j("cli.init.exists",{locale:s,vars:{path:r},fallback:`Skill already exists at ${r}`})}${v}`),0;o&&mkdirSync(i,{recursive:true});let h=`---
|
|
190
190
|
name: ${l}
|
|
191
191
|
description: A brief description of what this skill does
|
|
192
192
|
---
|
|
@@ -204,5 +204,5 @@ Describe when this skill should be used.
|
|
|
204
204
|
1. First step
|
|
205
205
|
2. Second step
|
|
206
206
|
3. Additional steps as needed
|
|
207
|
-
`;return writeFileSync(a,h),console.log(`${Pe}${j("cli.init.created",{locale:s,vars:{name:l},fallback:`Initialized skill: ${l}`})}${v}`),console.log(),console.log(`${I}${j("cli.init.created_label",{locale:s,fallback:"Created"})}${v}:`),console.log(` ${r}`),console.log(),console.log(`${I}${j("cli.init.next.title",{locale:s,fallback:"Next steps"})}${v}:`),console.log(` 1. ${j("cli.init.next.edit",{locale:s,vars:{path:r},fallback:`Edit ${r} to define your skill instructions`})}`),console.log(` 2. ${j("cli.init.next.frontmatter",{locale:s,fallback:"Update the name and description in the frontmatter"})}`),console.log(),console.log(`${I}${j("cli.init.publish.title",{locale:s,fallback:"Publishing"})}${v}:`),console.log(` ${I}GitHub:${v} ${j("cli.init.publish.github",{locale:s,vars:{cmd:"easbot skills"},fallback:"Push to a repo, then easbot skills add <owner>/<repo>"})}`),console.log(` ${I}URL:${v} ${j("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(`${I}${j("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
|
|
208
|
-
export{Vs as AGENTS_DIR,nn as DEFAULT_CLONE_TIMEOUT_MS,ps as EVE_SUBAGENTS_DIR,We as GitCloneError,qs as SKILLS_SUBDIR,
|
|
207
|
+
`;return writeFileSync(a,h),console.log(`${Pe}${j("cli.init.created",{locale:s,vars:{name:l},fallback:`Initialized skill: ${l}`})}${v}`),console.log(),console.log(`${I}${j("cli.init.created_label",{locale:s,fallback:"Created"})}${v}:`),console.log(` ${r}`),console.log(),console.log(`${I}${j("cli.init.next.title",{locale:s,fallback:"Next steps"})}${v}:`),console.log(` 1. ${j("cli.init.next.edit",{locale:s,vars:{path:r},fallback:`Edit ${r} to define your skill instructions`})}`),console.log(` 2. ${j("cli.init.next.frontmatter",{locale:s,fallback:"Update the name and description in the frontmatter"})}`),console.log(),console.log(`${I}${j("cli.init.publish.title",{locale:s,fallback:"Publishing"})}${v}:`),console.log(` ${I}GitHub:${v} ${j("cli.init.publish.github",{locale:s,vars:{cmd:"easbot skills"},fallback:"Push to a repo, then easbot skills add <owner>/<repo>"})}`),console.log(` ${I}URL:${v} ${j("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(`${I}${j("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 pc(t,e){ac(e?.version);let n=e?.inAgent??await Yt();if(t.length===0)return n||ji(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||rs(),console.log(),await Pn(o),{code:0,handled:true,command:l};case "init":return n||rs(),console.log(),{code:dc(o,e),handled:true,command:l};case "experimental_install":return n||rs(),await On(o),{code:0,handled:true,command:l};case "i":case "install":case "a":case "add":{n||rs();let{source:i,options:a}=ss(o);return await lt(i,a),{code:0,handled:true,command:l}}case "use":{let{source:i,options:a,errors:r}=Mn(o);return await Wn(i,a,r),{code:0,handled:true,command:l}}case "remove":case "rm":case "r":{if(o.includes("--help")||o.includes("-h"))return uc(e),{code:0,handled:true,command:l};let{skills:i,options:a}=Nn(o);return await ns(i,a),{code:0,handled:true,command:l}}case "experimental_sync":{n||rs();let{options:i}=is(o);return await ls(o,i),{code:0,handled:true,command:l}}case "list":case "ls":return await Tn(o),{code:0,handled:true,command:l};case "check":case "update":case "upgrade":return await Rn(o),{code:0,handled:true,command:l};default:{let i=as(e);return console.log(j("cli.unknown_command",{locale:i,vars:{command:l??""},fallback:`Unknown command: ${l}`})),console.log(j("cli.help_hint",{locale:i,vars:{cmd:"skills"},fallback:"Run skills --help for usage."})),{code:1,handled:true,command:l}}}}
|
|
208
|
+
export{Vs as AGENTS_DIR,nn as DEFAULT_CLONE_TIMEOUT_MS,ps as EVE_SUBAGENTS_DIR,We as GitCloneError,qs as SKILLS_SUBDIR,bo as UNIVERSAL_SKILLS_DIR,es as WellKnownProvider,wt as addSkillToLocalLock,xs as addSkillToLock,T as agents,xi as buildUsePrompt,st as cleanupTempDir,Ke as cloneRepo,Cr as computeContentHash,je as computeSkillFolderHash,Ye as detectAgent,Oe as detectInstalledAgents,ve as discoverSkills,Pt as dismissPrompt,dn as fetchAuditData,_r as fetchSkillFolderHash,Gt as filterSkills,Rl as findProvider,hr as flushTelemetry,Ji as getAgentAdapter,Ae as getAgentBaseDir,lo as getAgentConfig,br as getAgentName,Zt as getAgentType,wn as getAllLockedSkills,Je as getCanonicalPath,Ce as getCanonicalSkillsDir,ct as getEveSubagentSkillsDir,et as getEveSubagents,nt as getGitHubToken,kt as getGlobal,Ne as getHomeDir,ys as getInstallPath,Jn as getInstance,As as getLastSelectedAgents,Ms as getLocalLockPath,bt as getNonUniversalAgents,ll as getOpenClawGlobalSkillsDir,Xe as getOwnerRepo,ot as getProjectDirectory,_l as getProviders,le as getSkillDisplayName,bn as getSkillFromLock,kn as getSkillLockPath,Ur as getSkillsBySource,qe as getUniversalAgents,Ht as getVisibleUniversalAgents,Qi as getXdgCache,yt as getXdgConfig,Xn as getXdgData,Zi as getXdgState,pc as handleSkillsCli,Xi as hasAgentAdapter,di as hasProjectSkills,xn as initTelemetry,bs as installBlobSkillForAgent,_o as installRemoteSkillForAgent,qt as installSkillForAgent,en as installWellKnownSkillForAgent,El as isGitHubHttpsCloneUrl,on as isGitHubSsoAuthError,Sn as isPromptDismissed,xt as isRepoPrivate,Yt as isRunningInAgent,Jt as isSkillInstalled,yl as isSubpathSafe,we as isUniversalAgent,Li as launchAgentInteractively,tn as listInstalledSkills,Cn as matchesSkillFilter,Ai as materializeUseSkill,ss as parseAddOptions,Xl as parseFindOptions,Nl as parseGitHubRepoUrl,Zl as parseListOptions,Xt as parseOwnerRepo,Nn as parseRemoveOptions,Me as parseSkillMd,ut as parseSource,is as parseSyncOptions,ui as parseUpdateOptions,Mn as parseUseOptions,$e as readLocalLock,Le as readSkillLock,Cl as registerProvider,Qt as registry,ns as removeCommand,go as removeSkillFromLocalLock,yn as removeSkillFromLock,ji as renderBanner,cc as renderHelp,Yi as requireAgentAdapter,Rr as resetGhAuthWarning,Gi as resetGlobalAdapter,Vi as resetInstanceAdapter,pi as resolveUpdateScope,lt as runAdd,Pn as runFind,On as runInstallFromLock,Tn as runList,ls as runSync,Rn as runUpdate,Wn as runUse,me as sanitizeName,ws as sanitizeSubpath,Ls as saveSelectedAgents,In as searchSkillsAPI,qi as setAgentAdapter,un as setDetectedAgent,zi as setGlobalAdapter,Bi as setInstanceAdapter,vs as setVersion,hl as shouldInstallInternalSkills,ke as track,dt as wellKnownProvider,Ws as writeLocalLock,ts as writeSkillLock};
|