@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.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
'use strict';var chunkEOOPF3RI_cjs=require('./chunks/chunk-EOOPF3RI.cjs'),fs$1=require('fs'),path=require('path'),xdgBasedir=require('xdg-basedir'),os$1=require('os'),promises=require('fs/promises'),crypto=require('crypto'),y=require('@clack/prompts'),k=require('picocolors'),ws=require('readline'),util=require('util'),stream=require('stream'),er=require('simple-git'),child_process=require('child_process'),detectAgent=require('@vercel/detect-agent'),zlib=require('zlib'),url=require('url');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var y__namespace=/*#__PURE__*/_interopNamespace(y);var k__default=/*#__PURE__*/_interopDefault(k);var ws__namespace=/*#__PURE__*/_interopNamespace(ws);var er__default=/*#__PURE__*/_interopDefault(er);var jt=null,Mt=null,Wt=null;function Ki(t){jt=t;}function Hi(){jt=null;}function ht(){if(jt)return jt;let t=os$1.homedir();return {Path:{home:t,data:process.env.EASBOT_DATA_PATH?.trim()||path.join(xdgBasedir.xdgData??path.join(t,".local","share"),"easbot"),config:process.env.EASBOT_CONFIG_PATH?.trim()||path.join(xdgBasedir.xdgConfig??path.join(t,".config"),"easbot"),state:process.env.EASBOT_STATE_PATH?.trim()||path.join(xdgBasedir.xdgState??path.join(xdgBasedir.xdgData??path.join(t,".local","share"),"easbot"),"state"),cache:process.env.EASBOT_CACHE_PATH?.trim()||path.join(xdgBasedir.xdgCache??path.join(t,".cache"),"easbot"),log:process.env.EASBOT_LOG_PATH?.trim()||path.join(xdgBasedir.xdgState??path.join(xdgBasedir.xdgData??path.join(t,".local","share"),"easbot"),"log"),bin:process.env.EASBOT_BIN_PATH?.trim()||path.join(t,".local","bin")}}}function zi(t){Mt=t;}function Gi(){Mt=null;}function Vn(){if(Mt)return Mt;let t=process.cwd();return {directory:t,worktree:t}}function Bi(t){Wt=t,t&&(jt=t.global,Mt=t.instance);}function Vi(){return Wt}function qi(){return Wt!==null}function Ji(){if(!Wt)throw new Error("Skills agent adapter not set. Call setAgentAdapter() before using skills commands that depend on subAgentRunner.");return Wt}function Te(){return ht().Path.home||os$1.homedir()}function kt(){let t=ht().Path.config;return t||(xdgBasedir.xdgConfig??path.join(Te(),".config"))}function qn(){let t=ht().Path.data;return t||(xdgBasedir.xdgData??path.join(Te(),".local","share"))}function Xi(){let t=ht().Path.state;return t||(xdgBasedir.xdgState??path.join(qn(),"state"))}function Yi(){let t=ht().Path.cache;return t||(xdgBasedir.xdgCache??path.join(Te(),".cache"))}function it(){return Vn().directory||process.cwd()}var b=Te(),Ne=kt()||xdgBasedir.xdgConfig||path.join(b,".config"),Jn=process.env.CODEX_HOME?.trim()||path.join(b,".codex"),Xn=process.env.CLAUDE_CONFIG_DIR?.trim()||path.join(b,".claude"),Yn=process.env.VIBE_HOME?.trim()||path.join(b,".vibe"),Zn=process.env.HERMES_HOME?.trim()||path.join(b,".hermes"),Qn=process.env.AUTOHAND_HOME?.trim()||path.join(b,".autohand"),el=process.env.APPDATA?.trim(),tl=process.env.FLATPAK_XDG_CONFIG_HOME?.trim();function to(t,e){try{let s=JSON.parse(fs$1.readFileSync(t,"utf-8"));return !!(s.dependencies?.[e]||s.devDependencies?.[e])}catch{return false}}function sl(t=b,e=fs$1.existsSync){return e(path.join(t,".openclaw"))?path.join(t,".openclaw/skills"):e(path.join(t,".clawdbot"))?path.join(t,".clawdbot/skills"):e(path.join(t,".moltbot"))?path.join(t,".moltbot/skills"):path.join(t,".openclaw/skills")}var T={easbot:{name:"easbot",displayName:"EASBot",skillsDir:".easbot/skills",get globalSkillsDir(){return path.join(kt(),"skills")},detectInstalled:async()=>true,showInUniversalList:false,showInUniversalPrompt:true},"aider-desk":{name:"aider-desk",displayName:"AiderDesk",skillsDir:".aider-desk/skills",globalSkillsDir:path.join(b,".aider-desk/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".aider-desk"))},amp:{name:"amp",displayName:"Amp",skillsDir:".agents/skills",globalSkillsDir:path.join(Ne,"agents/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(Ne,"amp"))},antigravity:{name:"antigravity",displayName:"Antigravity",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".gemini/antigravity/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".gemini/antigravity"))},"antigravity-cli":{name:"antigravity-cli",displayName:"Antigravity CLI",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".gemini/antigravity-cli/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".gemini/antigravity-cli"))},astrbot:{name:"astrbot",displayName:"AstrBot",skillsDir:"data/skills",globalSkillsDir:path.join(b,".astrbot/data/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(process.cwd(),"data/skills"))||fs$1.existsSync(path.join(b,".astrbot"))},"autohand-code":{name:"autohand-code",displayName:"Autohand Code CLI",skillsDir:".autohand/skills",globalSkillsDir:path.join(Qn,"skills"),detectInstalled:async()=>fs$1.existsSync(Qn)},augment:{name:"augment",displayName:"Augment",skillsDir:".augment/skills",globalSkillsDir:path.join(b,".augment/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".augment"))},bob:{name:"bob",displayName:"IBM Bob",skillsDir:".bob/skills",globalSkillsDir:path.join(b,".bob/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".bob"))},"claude-code":{name:"claude-code",displayName:"Claude Code",skillsDir:".claude/skills",globalSkillsDir:path.join(Xn,"skills"),detectInstalled:async()=>fs$1.existsSync(Xn)},openclaw:{name:"openclaw",displayName:"OpenClaw",skillsDir:"skills",globalSkillsDir:sl(),detectInstalled:async()=>fs$1.existsSync(path.join(b,".openclaw"))||fs$1.existsSync(path.join(b,".clawdbot"))||fs$1.existsSync(path.join(b,".moltbot"))},cline:{name:"cline",displayName:"Cline",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".agents","skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".cline"))},"codearts-agent":{name:"codearts-agent",displayName:"CodeArts Agent",skillsDir:".codeartsdoer/skills",globalSkillsDir:path.join(b,".codeartsdoer/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".codeartsdoer"))},codebuddy:{name:"codebuddy",displayName:"CodeBuddy",skillsDir:".codebuddy/skills",globalSkillsDir:path.join(b,".codebuddy/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(process.cwd(),".codebuddy"))||fs$1.existsSync(path.join(b,".codebuddy"))},codemaker:{name:"codemaker",displayName:"Codemaker",skillsDir:".codemaker/skills",globalSkillsDir:path.join(b,".codemaker/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".codemaker"))},codestudio:{name:"codestudio",displayName:"Code Studio",skillsDir:".codestudio/skills",globalSkillsDir:path.join(b,".codestudio/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".codestudio"))},codex:{name:"codex",displayName:"Codex",skillsDir:".agents/skills",globalSkillsDir:path.join(Jn,"skills"),detectInstalled:async()=>fs$1.existsSync(Jn)||fs$1.existsSync("/etc/codex")},"command-code":{name:"command-code",displayName:"Command Code",skillsDir:".commandcode/skills",globalSkillsDir:path.join(b,".commandcode/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".commandcode"))},continue:{name:"continue",displayName:"Continue",skillsDir:".continue/skills",globalSkillsDir:path.join(b,".continue/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(process.cwd(),".continue"))||fs$1.existsSync(path.join(b,".continue"))},cortex:{name:"cortex",displayName:"Cortex Code",skillsDir:".cortex/skills",globalSkillsDir:path.join(b,".snowflake/cortex/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".snowflake/cortex"))},crush:{name:"crush",displayName:"Crush",skillsDir:".crush/skills",globalSkillsDir:path.join(b,".config/crush/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".config/crush"))},cursor:{name:"cursor",displayName:"Cursor",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".cursor/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".cursor"))},deepagents:{name:"deepagents",displayName:"Deep Agents",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".deepagents/agent/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".deepagents"))},devin:{name:"devin",displayName:"Devin for Terminal",skillsDir:".devin/skills",globalSkillsDir:path.join(Ne,"devin/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(Ne,"devin"))},dexto:{name:"dexto",displayName:"Dexto",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".agents/skills"),showInUniversalPrompt:false,detectInstalled:async()=>fs$1.existsSync(path.join(b,".dexto"))},droid:{name:"droid",displayName:"Droid",skillsDir:".factory/skills",globalSkillsDir:path.join(b,".factory/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".factory"))},eve:{name:"eve",displayName:"Eve",skillsDir:"agent/skills",globalSkillsDir:void 0,detectInstalled:async()=>{let t=process.cwd();return fs$1.existsSync(path.join(t,"agent"))&&to(path.join(t,"package.json"),"eve")}},firebender:{name:"firebender",displayName:"Firebender",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".firebender/skills"),showInUniversalPrompt:false,detectInstalled:async()=>fs$1.existsSync(path.join(b,".firebender"))},forgecode:{name:"forgecode",displayName:"ForgeCode",skillsDir:".forge/skills",globalSkillsDir:path.join(b,".forge/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".forge"))},"gemini-cli":{name:"gemini-cli",displayName:"Gemini CLI",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".gemini/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".gemini"))},"github-copilot":{name:"github-copilot",displayName:"GitHub Copilot",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".copilot/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".copilot"))},goose:{name:"goose",displayName:"Goose",skillsDir:".goose/skills",globalSkillsDir:path.join(Ne,"goose/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(Ne,"goose"))},"hermes-agent":{name:"hermes-agent",displayName:"Hermes Agent",skillsDir:".hermes/skills",globalSkillsDir:path.join(Zn,"skills"),detectInstalled:async()=>fs$1.existsSync(Zn)},"inference-sh":{name:"inference-sh",displayName:"inference.sh",skillsDir:".inferencesh/skills",globalSkillsDir:path.join(b,".inferencesh/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".inferencesh"))},jazz:{name:"jazz",displayName:"Jazz",skillsDir:".jazz/skills",globalSkillsDir:path.join(b,".jazz/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".jazz"))||fs$1.existsSync(path.join(process.cwd(),".jazz"))},junie:{name:"junie",displayName:"Junie",skillsDir:".junie/skills",globalSkillsDir:path.join(b,".junie/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".junie"))},"iflow-cli":{name:"iflow-cli",displayName:"iFlow CLI",skillsDir:".iflow/skills",globalSkillsDir:path.join(b,".iflow/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".iflow"))},kilo:{name:"kilo",displayName:"Kilo Code",skillsDir:".kilocode/skills",globalSkillsDir:path.join(b,".kilocode/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".kilocode"))},"kimi-code-cli":{name:"kimi-code-cli",displayName:"Kimi Code CLI",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".agents/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".kimi-code"))||fs$1.existsSync(path.join(b,".kimi"))},"kiro-cli":{name:"kiro-cli",displayName:"Kiro CLI",skillsDir:".kiro/skills",globalSkillsDir:path.join(b,".kiro/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".kiro"))},kode:{name:"kode",displayName:"Kode",skillsDir:".kode/skills",globalSkillsDir:path.join(b,".kode/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".kode"))},lingma:{name:"lingma",displayName:"Lingma",skillsDir:".lingma/skills",globalSkillsDir:path.join(b,".lingma/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".lingma"))},loaf:{name:"loaf",displayName:"Loaf",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".agents/skills"),showInUniversalPrompt:false,detectInstalled:async()=>fs$1.existsSync(path.join(b,".loaf"))},mcpjam:{name:"mcpjam",displayName:"MCPJam",skillsDir:".mcpjam/skills",globalSkillsDir:path.join(b,".mcpjam/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".mcpjam"))},"mistral-vibe":{name:"mistral-vibe",displayName:"Mistral Vibe",skillsDir:".vibe/skills",globalSkillsDir:path.join(Yn,"skills"),detectInstalled:async()=>fs$1.existsSync(Yn)},moxby:{name:"moxby",displayName:"Moxby",skillsDir:".moxby/skills",globalSkillsDir:path.join(b,".moxby/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".moxby"))},mux:{name:"mux",displayName:"Mux",skillsDir:".mux/skills",globalSkillsDir:path.join(b,".mux/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".mux"))},opencode:{name:"opencode",displayName:"OpenCode",skillsDir:".agents/skills",globalSkillsDir:path.join(Ne,"opencode/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(Ne,"opencode"))},openhands:{name:"openhands",displayName:"OpenHands",skillsDir:".openhands/skills",globalSkillsDir:path.join(b,".openhands/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".openhands"))},ona:{name:"ona",displayName:"Ona",skillsDir:".ona/skills",globalSkillsDir:path.join(b,".ona/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".ona"))},pi:{name:"pi",displayName:"Pi",skillsDir:".pi/skills",globalSkillsDir:path.join(b,".pi/agent/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".pi/agent"))},qoder:{name:"qoder",displayName:"Qoder",skillsDir:".qoder/skills",globalSkillsDir:path.join(b,".qoder/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".qoder"))},"qoder-cn":{name:"qoder-cn",displayName:"Qoder CN",skillsDir:".qoder/skills",globalSkillsDir:path.join(b,".qoder-cn/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".qoder-cn"))},"qwen-code":{name:"qwen-code",displayName:"Qwen Code",skillsDir:".qwen/skills",globalSkillsDir:path.join(b,".qwen/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".qwen"))},replit:{name:"replit",displayName:"Replit",skillsDir:".agents/skills",globalSkillsDir:path.join(Ne,"agents/skills"),showInUniversalList:false,detectInstalled:async()=>fs$1.existsSync(path.join(process.cwd(),".replit"))},reasonix:{name:"reasonix",displayName:"Reasonix",skillsDir:".reasonix/skills",globalSkillsDir:path.join(b,".reasonix/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".reasonix"))},rovodev:{name:"rovodev",displayName:"Rovo Dev",skillsDir:".rovodev/skills",globalSkillsDir:path.join(b,".rovodev/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".rovodev"))},roo:{name:"roo",displayName:"Roo Code",skillsDir:".roo/skills",globalSkillsDir:path.join(b,".roo/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".roo"))},"tabnine-cli":{name:"tabnine-cli",displayName:"Tabnine CLI",skillsDir:".tabnine/agent/skills",globalSkillsDir:path.join(b,".tabnine/agent/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".tabnine"))},terramind:{name:"terramind",displayName:"Terramind",skillsDir:".terramind/skills",globalSkillsDir:path.join(b,".terramind/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".terramind"))},tinycloud:{name:"tinycloud",displayName:"Tinycloud",skillsDir:".tinycloud/skills",globalSkillsDir:path.join(b,".tinycloud/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".tinycloud"))},trae:{name:"trae",displayName:"Trae",skillsDir:".trae/skills",globalSkillsDir:path.join(b,".trae/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".trae"))},"trae-cn":{name:"trae-cn",displayName:"Trae CN",skillsDir:".trae/skills",globalSkillsDir:path.join(b,".trae-cn/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".trae-cn"))},warp:{name:"warp",displayName:"Warp",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".agents/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".warp"))},windsurf:{name:"windsurf",displayName:"Windsurf",skillsDir:".windsurf/skills",globalSkillsDir:path.join(b,".codeium/windsurf/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".codeium/windsurf"))},zed:{name:"zed",displayName:"Zed",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".agents/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(Ne,"zed"))||!!el&&fs$1.existsSync(path.join(el,"Zed"))||!!tl&&fs$1.existsSync(path.join(tl,"zed"))},zencoder:{name:"zencoder",displayName:"Zencoder",skillsDir:".zencoder/skills",globalSkillsDir:path.join(b,".zencoder/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".zencoder"))},zenflow:{name:"zenflow",displayName:"Zenflow",skillsDir:".zencoder/skills",globalSkillsDir:path.join(b,".zencoder/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".zencoder"))},neovate:{name:"neovate",displayName:"Neovate",skillsDir:".neovate/skills",globalSkillsDir:path.join(b,".neovate/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".neovate"))},pochi:{name:"pochi",displayName:"Pochi",skillsDir:".pochi/skills",globalSkillsDir:path.join(b,".pochi/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".pochi"))},promptscript:{name:"promptscript",displayName:"PromptScript",skillsDir:".agents/skills",globalSkillsDir:void 0,showInUniversalPrompt:false,detectInstalled:async()=>fs$1.existsSync(path.join(process.cwd(),".promptscript"))||fs$1.existsSync(path.join(process.cwd(),"promptscript.yaml"))},adal:{name:"adal",displayName:"AdaL",skillsDir:".adal/skills",globalSkillsDir:path.join(b,".adal/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".adal"))},universal:{name:"universal",displayName:"Universal",skillsDir:".agents/skills",globalSkillsDir:path.join(Ne,"agents/skills"),showInUniversalList:false,detectInstalled:async()=>false}};async function Ue(){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 so(t){return T[t]}var ds=path.join("agent","subagents");function Qe(t=process.cwd()){let e=path.join(t,ds);if(!fs$1.existsSync(e))return [];try{return fs$1.readdirSync(e,{withFileTypes:!0}).filter(s=>s.isDirectory()).map(s=>s.name).sort()}catch{return []}}function Ve(){return Object.entries(T).filter(([t,e])=>e.skillsDir===".agents/skills"&&e.showInUniversalList!==false).map(([t])=>t)}function Kt(){return Object.entries(T).filter(([t,e])=>e.skillsDir===".agents/skills"&&e.showInUniversalList!==false&&e.showInUniversalPrompt!==false).map(([t])=>t)}function yt(){return Object.entries(T).filter(([t,e])=>e.skillsDir!==".agents/skills").map(([t])=>t)}function be(t){return T[t].skillsDir===".agents/skills"}function Ht(t,e){let s=path.normalize(path.resolve(e)),n=path.normalize(path.resolve(t));return n.startsWith(s+path.sep)||n===s}function ot(t){return t.startsWith("./")}async function ll(t){let e=[],s=(n,l)=>{if(Ht(n,t)){if(l&&l.length>0)for(let o of l){if(!ot(o))continue;let i=path.dirname(path.join(n,o));Ht(i,t)&&e.push(i);}e.push(path.join(n,"skills"));}};try{let n=await promises.readFile(path.join(t,".claude-plugin/marketplace.json"),"utf-8"),l=JSON.parse(n),o=l.metadata?.pluginRoot;if(o===void 0||ot(o))for(let a of l.plugins??[]){if(typeof a.source!="string"&&a.source!==void 0||a.source!==void 0&&!ot(a.source))continue;let r=path.join(t,o??"",a.source??"");s(r,a.skills);}}catch{}try{let n=await promises.readFile(path.join(t,".claude-plugin/plugin.json"),"utf-8"),l=JSON.parse(n);s(t,l.skills);}catch{}return e}async function il(t){let e=new Map;try{let s=await promises.readFile(path.join(t,".claude-plugin/marketplace.json"),"utf-8"),n=JSON.parse(s),l=n.metadata?.pluginRoot;if(l===void 0||ot(l))for(let i of n.plugins??[]){if(!i.name||typeof i.source!="string"&&i.source!==void 0||i.source!==void 0&&!ot(i.source))continue;let a=path.join(t,l??"",i.source??"");if(Ht(a,t)&&i.skills&&i.skills.length>0)for(let r of i.skills){if(!ot(r))continue;let h=path.join(a,r);Ht(h,t)&&e.set(path.resolve(h),i.name);}}}catch{}try{let s=await promises.readFile(path.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(!ot(l))continue;let o=path.join(t,l);Ht(o,t)&&e.set(path.resolve(o),n.name);}}catch{}return e}var co="skills-lock.json",al=1;function js(t){return path.join(t||process.cwd(),co)}async function Se(t){let e=js(t);try{let s=await promises.readFile(e,"utf-8"),n=JSON.parse(s);return typeof n.version!="number"||!n.skills||n.version<al?Fs():n}catch{return Fs()}}async function Ms(t,e){let s=js(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 promises.writeFile(s,o,"utf-8");}async function Fe(t){let e=[];await
|
|
1
|
+
'use strict';var chunkEOOPF3RI_cjs=require('./chunks/chunk-EOOPF3RI.cjs'),fs$1=require('fs'),path=require('path'),xdgBasedir=require('xdg-basedir'),os$1=require('os'),promises=require('fs/promises'),crypto=require('crypto'),y=require('@clack/prompts'),k=require('picocolors'),ws=require('readline'),util=require('util'),stream=require('stream'),tr=require('simple-git'),child_process=require('child_process'),detectAgent=require('@vercel/detect-agent'),zlib=require('zlib'),utils=require('@easbot/utils'),url=require('url');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var y__namespace=/*#__PURE__*/_interopNamespace(y);var k__default=/*#__PURE__*/_interopDefault(k);var ws__namespace=/*#__PURE__*/_interopNamespace(ws);var tr__default=/*#__PURE__*/_interopDefault(tr);var jt=null,Mt=null,Wt=null;function Hi(t){jt=t;}function zi(){jt=null;}function ht(){if(jt)return jt;let t=os$1.homedir();return {Path:{home:t,data:process.env.EASBOT_DATA_PATH?.trim()||path.join(xdgBasedir.xdgData??path.join(t,".local","share"),"easbot"),config:process.env.EASBOT_CONFIG_PATH?.trim()||path.join(xdgBasedir.xdgConfig??path.join(t,".config"),"easbot"),state:process.env.EASBOT_STATE_PATH?.trim()||path.join(xdgBasedir.xdgState??path.join(xdgBasedir.xdgData??path.join(t,".local","share"),"easbot"),"state"),cache:process.env.EASBOT_CACHE_PATH?.trim()||path.join(xdgBasedir.xdgCache??path.join(t,".cache"),"easbot"),log:process.env.EASBOT_LOG_PATH?.trim()||path.join(xdgBasedir.xdgState??path.join(xdgBasedir.xdgData??path.join(t,".local","share"),"easbot"),"log"),bin:process.env.EASBOT_BIN_PATH?.trim()||path.join(t,".local","bin")}}}function Gi(t){Mt=t;}function Bi(){Mt=null;}function qn(){if(Mt)return Mt;let t=process.cwd();return {directory:t,worktree:t}}function Vi(t){Wt=t,t&&(jt=t.global,Mt=t.instance);}function qi(){return Wt}function Ji(){return Wt!==null}function Xi(){if(!Wt)throw new Error("Skills agent adapter not set. Call setAgentAdapter() before using skills commands that depend on subAgentRunner.");return Wt}function Te(){return ht().Path.home||os$1.homedir()}function kt(){let t=ht().Path.config;return t||(xdgBasedir.xdgConfig??path.join(Te(),".config"))}function Jn(){let t=ht().Path.data;return t||(xdgBasedir.xdgData??path.join(Te(),".local","share"))}function Yi(){let t=ht().Path.state;return t||(xdgBasedir.xdgState??path.join(Jn(),"state"))}function Zi(){let t=ht().Path.cache;return t||(xdgBasedir.xdgCache??path.join(Te(),".cache"))}function it(){return qn().directory||process.cwd()}var b=Te(),Ne=kt()||xdgBasedir.xdgConfig||path.join(b,".config"),Xn=process.env.CODEX_HOME?.trim()||path.join(b,".codex"),Yn=process.env.CLAUDE_CONFIG_DIR?.trim()||path.join(b,".claude"),Zn=process.env.VIBE_HOME?.trim()||path.join(b,".vibe"),Qn=process.env.HERMES_HOME?.trim()||path.join(b,".hermes"),el=process.env.AUTOHAND_HOME?.trim()||path.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(fs$1.readFileSync(t,"utf-8"));return !!(s.dependencies?.[e]||s.devDependencies?.[e])}catch{return false}}function nl(t=b,e=fs$1.existsSync){return e(path.join(t,".openclaw"))?path.join(t,".openclaw/skills"):e(path.join(t,".clawdbot"))?path.join(t,".clawdbot/skills"):e(path.join(t,".moltbot"))?path.join(t,".moltbot/skills"):path.join(t,".openclaw/skills")}var T={easbot:{name:"easbot",displayName:"EASBot",skillsDir:".easbot/skills",get globalSkillsDir(){return path.join(kt(),"skills")},detectInstalled:async()=>true,showInUniversalList:false,showInUniversalPrompt:true},"aider-desk":{name:"aider-desk",displayName:"AiderDesk",skillsDir:".aider-desk/skills",globalSkillsDir:path.join(b,".aider-desk/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".aider-desk"))},amp:{name:"amp",displayName:"Amp",skillsDir:".agents/skills",globalSkillsDir:path.join(Ne,"agents/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(Ne,"amp"))},antigravity:{name:"antigravity",displayName:"Antigravity",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".gemini/antigravity/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".gemini/antigravity"))},"antigravity-cli":{name:"antigravity-cli",displayName:"Antigravity CLI",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".gemini/antigravity-cli/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".gemini/antigravity-cli"))},astrbot:{name:"astrbot",displayName:"AstrBot",skillsDir:"data/skills",globalSkillsDir:path.join(b,".astrbot/data/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(process.cwd(),"data/skills"))||fs$1.existsSync(path.join(b,".astrbot"))},"autohand-code":{name:"autohand-code",displayName:"Autohand Code CLI",skillsDir:".autohand/skills",globalSkillsDir:path.join(el,"skills"),detectInstalled:async()=>fs$1.existsSync(el)},augment:{name:"augment",displayName:"Augment",skillsDir:".augment/skills",globalSkillsDir:path.join(b,".augment/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".augment"))},bob:{name:"bob",displayName:"IBM Bob",skillsDir:".bob/skills",globalSkillsDir:path.join(b,".bob/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".bob"))},"claude-code":{name:"claude-code",displayName:"Claude Code",skillsDir:".claude/skills",globalSkillsDir:path.join(Yn,"skills"),detectInstalled:async()=>fs$1.existsSync(Yn)},openclaw:{name:"openclaw",displayName:"OpenClaw",skillsDir:"skills",globalSkillsDir:nl(),detectInstalled:async()=>fs$1.existsSync(path.join(b,".openclaw"))||fs$1.existsSync(path.join(b,".clawdbot"))||fs$1.existsSync(path.join(b,".moltbot"))},cline:{name:"cline",displayName:"Cline",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".agents","skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".cline"))},"codearts-agent":{name:"codearts-agent",displayName:"CodeArts Agent",skillsDir:".codeartsdoer/skills",globalSkillsDir:path.join(b,".codeartsdoer/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".codeartsdoer"))},codebuddy:{name:"codebuddy",displayName:"CodeBuddy",skillsDir:".codebuddy/skills",globalSkillsDir:path.join(b,".codebuddy/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(process.cwd(),".codebuddy"))||fs$1.existsSync(path.join(b,".codebuddy"))},codemaker:{name:"codemaker",displayName:"Codemaker",skillsDir:".codemaker/skills",globalSkillsDir:path.join(b,".codemaker/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".codemaker"))},codestudio:{name:"codestudio",displayName:"Code Studio",skillsDir:".codestudio/skills",globalSkillsDir:path.join(b,".codestudio/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".codestudio"))},codex:{name:"codex",displayName:"Codex",skillsDir:".agents/skills",globalSkillsDir:path.join(Xn,"skills"),detectInstalled:async()=>fs$1.existsSync(Xn)||fs$1.existsSync("/etc/codex")},"command-code":{name:"command-code",displayName:"Command Code",skillsDir:".commandcode/skills",globalSkillsDir:path.join(b,".commandcode/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".commandcode"))},continue:{name:"continue",displayName:"Continue",skillsDir:".continue/skills",globalSkillsDir:path.join(b,".continue/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(process.cwd(),".continue"))||fs$1.existsSync(path.join(b,".continue"))},cortex:{name:"cortex",displayName:"Cortex Code",skillsDir:".cortex/skills",globalSkillsDir:path.join(b,".snowflake/cortex/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".snowflake/cortex"))},crush:{name:"crush",displayName:"Crush",skillsDir:".crush/skills",globalSkillsDir:path.join(b,".config/crush/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".config/crush"))},cursor:{name:"cursor",displayName:"Cursor",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".cursor/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".cursor"))},deepagents:{name:"deepagents",displayName:"Deep Agents",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".deepagents/agent/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".deepagents"))},devin:{name:"devin",displayName:"Devin for Terminal",skillsDir:".devin/skills",globalSkillsDir:path.join(Ne,"devin/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(Ne,"devin"))},dexto:{name:"dexto",displayName:"Dexto",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".agents/skills"),showInUniversalPrompt:false,detectInstalled:async()=>fs$1.existsSync(path.join(b,".dexto"))},droid:{name:"droid",displayName:"Droid",skillsDir:".factory/skills",globalSkillsDir:path.join(b,".factory/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".factory"))},eve:{name:"eve",displayName:"Eve",skillsDir:"agent/skills",globalSkillsDir:void 0,detectInstalled:async()=>{let t=process.cwd();return fs$1.existsSync(path.join(t,"agent"))&&so(path.join(t,"package.json"),"eve")}},firebender:{name:"firebender",displayName:"Firebender",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".firebender/skills"),showInUniversalPrompt:false,detectInstalled:async()=>fs$1.existsSync(path.join(b,".firebender"))},forgecode:{name:"forgecode",displayName:"ForgeCode",skillsDir:".forge/skills",globalSkillsDir:path.join(b,".forge/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".forge"))},"gemini-cli":{name:"gemini-cli",displayName:"Gemini CLI",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".gemini/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".gemini"))},"github-copilot":{name:"github-copilot",displayName:"GitHub Copilot",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".copilot/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".copilot"))},goose:{name:"goose",displayName:"Goose",skillsDir:".goose/skills",globalSkillsDir:path.join(Ne,"goose/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(Ne,"goose"))},"hermes-agent":{name:"hermes-agent",displayName:"Hermes Agent",skillsDir:".hermes/skills",globalSkillsDir:path.join(Qn,"skills"),detectInstalled:async()=>fs$1.existsSync(Qn)},"inference-sh":{name:"inference-sh",displayName:"inference.sh",skillsDir:".inferencesh/skills",globalSkillsDir:path.join(b,".inferencesh/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".inferencesh"))},jazz:{name:"jazz",displayName:"Jazz",skillsDir:".jazz/skills",globalSkillsDir:path.join(b,".jazz/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".jazz"))||fs$1.existsSync(path.join(process.cwd(),".jazz"))},junie:{name:"junie",displayName:"Junie",skillsDir:".junie/skills",globalSkillsDir:path.join(b,".junie/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".junie"))},"iflow-cli":{name:"iflow-cli",displayName:"iFlow CLI",skillsDir:".iflow/skills",globalSkillsDir:path.join(b,".iflow/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".iflow"))},kilo:{name:"kilo",displayName:"Kilo Code",skillsDir:".kilocode/skills",globalSkillsDir:path.join(b,".kilocode/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".kilocode"))},"kimi-code-cli":{name:"kimi-code-cli",displayName:"Kimi Code CLI",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".agents/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".kimi-code"))||fs$1.existsSync(path.join(b,".kimi"))},"kiro-cli":{name:"kiro-cli",displayName:"Kiro CLI",skillsDir:".kiro/skills",globalSkillsDir:path.join(b,".kiro/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".kiro"))},kode:{name:"kode",displayName:"Kode",skillsDir:".kode/skills",globalSkillsDir:path.join(b,".kode/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".kode"))},lingma:{name:"lingma",displayName:"Lingma",skillsDir:".lingma/skills",globalSkillsDir:path.join(b,".lingma/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".lingma"))},loaf:{name:"loaf",displayName:"Loaf",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".agents/skills"),showInUniversalPrompt:false,detectInstalled:async()=>fs$1.existsSync(path.join(b,".loaf"))},mcpjam:{name:"mcpjam",displayName:"MCPJam",skillsDir:".mcpjam/skills",globalSkillsDir:path.join(b,".mcpjam/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".mcpjam"))},"mistral-vibe":{name:"mistral-vibe",displayName:"Mistral Vibe",skillsDir:".vibe/skills",globalSkillsDir:path.join(Zn,"skills"),detectInstalled:async()=>fs$1.existsSync(Zn)},moxby:{name:"moxby",displayName:"Moxby",skillsDir:".moxby/skills",globalSkillsDir:path.join(b,".moxby/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".moxby"))},mux:{name:"mux",displayName:"Mux",skillsDir:".mux/skills",globalSkillsDir:path.join(b,".mux/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".mux"))},opencode:{name:"opencode",displayName:"OpenCode",skillsDir:".agents/skills",globalSkillsDir:path.join(Ne,"opencode/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(Ne,"opencode"))},openhands:{name:"openhands",displayName:"OpenHands",skillsDir:".openhands/skills",globalSkillsDir:path.join(b,".openhands/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".openhands"))},ona:{name:"ona",displayName:"Ona",skillsDir:".ona/skills",globalSkillsDir:path.join(b,".ona/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".ona"))},pi:{name:"pi",displayName:"Pi",skillsDir:".pi/skills",globalSkillsDir:path.join(b,".pi/agent/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".pi/agent"))},qoder:{name:"qoder",displayName:"Qoder",skillsDir:".qoder/skills",globalSkillsDir:path.join(b,".qoder/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".qoder"))},"qoder-cn":{name:"qoder-cn",displayName:"Qoder CN",skillsDir:".qoder/skills",globalSkillsDir:path.join(b,".qoder-cn/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".qoder-cn"))},"qwen-code":{name:"qwen-code",displayName:"Qwen Code",skillsDir:".qwen/skills",globalSkillsDir:path.join(b,".qwen/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".qwen"))},replit:{name:"replit",displayName:"Replit",skillsDir:".agents/skills",globalSkillsDir:path.join(Ne,"agents/skills"),showInUniversalList:false,detectInstalled:async()=>fs$1.existsSync(path.join(process.cwd(),".replit"))},reasonix:{name:"reasonix",displayName:"Reasonix",skillsDir:".reasonix/skills",globalSkillsDir:path.join(b,".reasonix/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".reasonix"))},rovodev:{name:"rovodev",displayName:"Rovo Dev",skillsDir:".rovodev/skills",globalSkillsDir:path.join(b,".rovodev/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".rovodev"))},roo:{name:"roo",displayName:"Roo Code",skillsDir:".roo/skills",globalSkillsDir:path.join(b,".roo/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".roo"))},"tabnine-cli":{name:"tabnine-cli",displayName:"Tabnine CLI",skillsDir:".tabnine/agent/skills",globalSkillsDir:path.join(b,".tabnine/agent/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".tabnine"))},terramind:{name:"terramind",displayName:"Terramind",skillsDir:".terramind/skills",globalSkillsDir:path.join(b,".terramind/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".terramind"))},tinycloud:{name:"tinycloud",displayName:"Tinycloud",skillsDir:".tinycloud/skills",globalSkillsDir:path.join(b,".tinycloud/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".tinycloud"))},trae:{name:"trae",displayName:"Trae",skillsDir:".trae/skills",globalSkillsDir:path.join(b,".trae/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".trae"))},"trae-cn":{name:"trae-cn",displayName:"Trae CN",skillsDir:".trae/skills",globalSkillsDir:path.join(b,".trae-cn/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".trae-cn"))},warp:{name:"warp",displayName:"Warp",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".agents/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".warp"))},windsurf:{name:"windsurf",displayName:"Windsurf",skillsDir:".windsurf/skills",globalSkillsDir:path.join(b,".codeium/windsurf/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".codeium/windsurf"))},zed:{name:"zed",displayName:"Zed",skillsDir:".agents/skills",globalSkillsDir:path.join(b,".agents/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(Ne,"zed"))||!!tl&&fs$1.existsSync(path.join(tl,"Zed"))||!!sl&&fs$1.existsSync(path.join(sl,"zed"))},zencoder:{name:"zencoder",displayName:"Zencoder",skillsDir:".zencoder/skills",globalSkillsDir:path.join(b,".zencoder/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".zencoder"))},zenflow:{name:"zenflow",displayName:"Zenflow",skillsDir:".zencoder/skills",globalSkillsDir:path.join(b,".zencoder/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".zencoder"))},neovate:{name:"neovate",displayName:"Neovate",skillsDir:".neovate/skills",globalSkillsDir:path.join(b,".neovate/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".neovate"))},pochi:{name:"pochi",displayName:"Pochi",skillsDir:".pochi/skills",globalSkillsDir:path.join(b,".pochi/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".pochi"))},promptscript:{name:"promptscript",displayName:"PromptScript",skillsDir:".agents/skills",globalSkillsDir:void 0,showInUniversalPrompt:false,detectInstalled:async()=>fs$1.existsSync(path.join(process.cwd(),".promptscript"))||fs$1.existsSync(path.join(process.cwd(),"promptscript.yaml"))},adal:{name:"adal",displayName:"AdaL",skillsDir:".adal/skills",globalSkillsDir:path.join(b,".adal/skills"),detectInstalled:async()=>fs$1.existsSync(path.join(b,".adal"))},universal:{name:"universal",displayName:"Universal",skillsDir:".agents/skills",globalSkillsDir:path.join(Ne,"agents/skills"),showInUniversalList:false,detectInstalled:async()=>false}};async function Ue(){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 ds=path.join("agent","subagents");function Qe(t=process.cwd()){let e=path.join(t,ds);if(!fs$1.existsSync(e))return [];try{return fs$1.readdirSync(e,{withFileTypes:!0}).filter(s=>s.isDirectory()).map(s=>s.name).sort()}catch{return []}}function Ve(){return Object.entries(T).filter(([t,e])=>e.skillsDir===".agents/skills"&&e.showInUniversalList!==false).map(([t])=>t)}function Kt(){return Object.entries(T).filter(([t,e])=>e.skillsDir===".agents/skills"&&e.showInUniversalList!==false&&e.showInUniversalPrompt!==false).map(([t])=>t)}function yt(){return Object.entries(T).filter(([t,e])=>e.skillsDir!==".agents/skills").map(([t])=>t)}function be(t){return T[t].skillsDir===".agents/skills"}function Ht(t,e){let s=path.normalize(path.resolve(e)),n=path.normalize(path.resolve(t));return n.startsWith(s+path.sep)||n===s}function ot(t){return t.startsWith("./")}async function il(t){let e=[],s=(n,l)=>{if(Ht(n,t)){if(l&&l.length>0)for(let o of l){if(!ot(o))continue;let i=path.dirname(path.join(n,o));Ht(i,t)&&e.push(i);}e.push(path.join(n,"skills"));}};try{let n=await promises.readFile(path.join(t,".claude-plugin/marketplace.json"),"utf-8"),l=JSON.parse(n),o=l.metadata?.pluginRoot;if(o===void 0||ot(o))for(let a of l.plugins??[]){if(typeof a.source!="string"&&a.source!==void 0||a.source!==void 0&&!ot(a.source))continue;let r=path.join(t,o??"",a.source??"");s(r,a.skills);}}catch{}try{let n=await promises.readFile(path.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 promises.readFile(path.join(t,".claude-plugin/marketplace.json"),"utf-8"),n=JSON.parse(s),l=n.metadata?.pluginRoot;if(l===void 0||ot(l))for(let i of n.plugins??[]){if(!i.name||typeof i.source!="string"&&i.source!==void 0||i.source!==void 0&&!ot(i.source))continue;let a=path.join(t,l??"",i.source??"");if(Ht(a,t)&&i.skills&&i.skills.length>0)for(let r of i.skills){if(!ot(r))continue;let h=path.join(a,r);Ht(h,t)&&e.set(path.resolve(h),i.name);}}}catch{}try{let s=await promises.readFile(path.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(!ot(l))continue;let o=path.join(t,l);Ht(o,t)&&e.set(path.resolve(o),n.name);}}catch{}return e}var uo="skills-lock.json",cl=1;function js(t){return path.join(t||process.cwd(),uo)}async function Se(t){let e=js(t);try{let s=await promises.readFile(e,"utf-8"),n=JSON.parse(s);return typeof n.version!="number"||!n.skills||n.version<cl?Fs():n}catch{return Fs()}}async function Ms(t,e){let s=js(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 promises.writeFile(s,o,"utf-8");}async function Fe(t){let e=[];await ul(t,t,e),e.sort((n,l)=>n.relativePath.localeCompare(l.relativePath));let s=crypto.createHash("sha256");for(let n of e)s.update(n.relativePath),s.update(n.content);return s.digest("hex")}async function ul(t,e,s){let n=await promises.readdir(e,{withFileTypes:true});await Promise.all(n.map(async l=>{let o=path.join(e,l.name);if(l.isDirectory()){if(l.name===".git"||l.name==="node_modules")return;await ul(t,o,s);}else if(l.isFile()){let i=await promises.readFile(o),a=path.relative(t,o).split("\\").join("/");s.push({relativePath:a,content:i});}}));}async function bt(t,e,s){let n=await Se(s);n.skills[t]=e,await Ms(n,s);}async function po(t,e){let s=await Se(e);return t in s.skills?(delete s.skills[t],await Ms(s,e),true):false}function Fs(){return {version:cl,skills:{}}}var zs=["node_modules",".git","dist","build","__pycache__"],pl=[".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 Ws(t){return t.toLowerCase().replace(/[\s_]+/g,"-")}function ko(t){return t.split(path.sep).join("/").replace(/\/+/g,"/")}function fl(){let t=process.env.INSTALL_INTERNAL_SKILLS;return t==="1"||t==="true"}async function Gs(t){try{let e=path.join(t,"SKILL.md");return (await promises.stat(e)).isFile()}catch{return false}}async function je(t,e){try{let s=await promises.readFile(t,"utf-8"),{data:n}=chunkEOOPF3RI_cjs.c(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&&!fl()&&!e?.includeInternal?null:{name:chunkEOOPF3RI_cjs.e(n.name),description:chunkEOOPF3RI_cjs.e(n.description),path:path.dirname(t),rawContent:s,metadata:l}}catch{return null}}async function hl(t,e=0,s=5){if(e>s)return [];try{let[n,l]=await Promise.all([Gs(t),promises.readdir(t,{withFileTypes:!0}).catch(()=>[])]),o=n?[t]:[],i=await Promise.all(l.filter(a=>a.isDirectory()&&!zs.includes(a.name)).map(a=>hl(path.join(t,a.name),e+1,s)));return [...o,...i.flat()]}catch{return []}}function kl(t,e){let s=path.normalize(path.resolve(t)),n=path.normalize(path.resolve(path.join(t,e)));return n.startsWith(s+path.sep)||n===s}async function $e(t,e,s){let n=[],l=new Set,o=await Se(t),i=new Set(Object.keys(o.skills).map(Ws));if(e&&!kl(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?path.join(t,e):t,r=await ol(a),h=c=>{let f=path.resolve(c.path);return r.has(f)&&(c.pluginName=r.get(f)),c},u=c=>{if(i.size===0)return false;let f=ko(path.relative(t,c.path));if(!pl.some(E=>f===E||f.startsWith(`${E}/`)))return false;let A=Ws(c.name),$=Ws(path.basename(c.path));return i.has(A)||i.has($)};if(await Gs(a)){let c=await je(path.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,path.join(a,"skills"),path.join(a,"skills/.curated"),path.join(a,"skills/.experimental"),path.join(a,"skills/.system"),...pl.map(c=>path.join(a,c))],d=new Set(m.slice(1));m.push(...await il(a));let g=async c=>{if(!await Gs(c))return false;let f=await je(path.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 promises.readdir(c,{withFileTypes:!0});for(let A of x){if(!A.isDirectory())continue;let $=path.join(c,A.name);if(!(await g($)||!f)&&!zs.includes(A.name))try{let D=await promises.readdir($,{withFileTypes:!0});for(let F of D)!F.isDirectory()||zs.includes(F.name)||await g(path.join($,F.name));}catch{}}}catch{}}if(n.length===0||s?.fullDepth){let c=await hl(a);for(let f of c){let x=await je(path.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 ne(t){return t.name||path.basename(t.path)}function zt(t,e){let s=e.map(n=>n.toLowerCase());return t.filter(n=>{let l=n.name.toLowerCase(),o=ne(n).toLowerCase();return s.some(i=>i===l||i===o)})}var Bs=".agents",Vs="skills",yo=".agents/skills";function ge(t){return t.toLowerCase().replace(/[^a-z0-9._]+/g,"-").replace(/^[.-]+|[.-]+$/g,"").substring(0,255)||"unnamed-skill"}function le(t,e){let s=path.normalize(path.resolve(t)),n=path.normalize(path.resolve(e));return n.startsWith(s+path.sep)||n===s}function bl(t,e){return le(t,e)||le(e,t)}async function wl(t,e){if(t.isDirectory())return true;if(!t.isSymbolicLink())return false;try{return (await promises.stat(e)).isDirectory()}catch{return false}}function Ee(t,e){let s=t?Te()||os$1.homedir():e||it()||process.cwd();return path.join(s,Bs,Vs)}function at(t,e){let s=e||it()||process.cwd();return path.join(s,ds,ge(t),"skills")}function xe(t,e,s,n){if(be(t))return Ee(e,s);if(t==="eve"&&n)return at(n,s);let l=T[t],o=Te()||os$1.homedir(),i=e?o:s||it()||process.cwd();return e?l.globalSkillsDir===void 0?path.join(i,l.skillsDir):l.globalSkillsDir:path.join(i,l.skillsDir)}function Po(t,e){return path.resolve(path.dirname(t),e)}async function ve(t){try{await promises.rm(t,{recursive:!0,force:!0});}catch{}await promises.mkdir(t,{recursive:true});}async function qs(t){let e=path.resolve(t),s=path.dirname(e),n=path.basename(e);try{let l=await promises.realpath(s);return path.join(l,n)}catch{return e}}async function hs(t,e){try{let s=path.resolve(t),n=path.resolve(e),[l,o]=await Promise.all([promises.realpath(s).catch(()=>s),promises.realpath(n).catch(()=>n)]);if(l===o)return !0;let i=await qs(t),a=await qs(e);if(i===a)return !0;try{if((await promises.lstat(e)).isSymbolicLink()){let c=await promises.readlink(e);if(Po(e,c)===s)return !0;await promises.rm(e);}else await promises.rm(e,{recursive:!0});}catch(g){if(g&&typeof g=="object"&&"code"in g&&g.code==="ELOOP")try{await promises.rm(e,{force:!0});}catch{}}let r=path.dirname(e);await promises.mkdir(r,{recursive:!0});let h=await qs(r),u=path.relative(h,t),m=os$1.platform()==="win32"?"junction":void 0;return await promises.symlink(m==="junction"?s:u,e,m),!0}catch{return false}}async function Vt(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||path.basename(t.path),r=ge(a),h=s.mode??"symlink",u=e==="eve"&&h==="symlink"?xe(e,l,o,i):Ee(l,o),m=path.join(u,r),d=xe(e,l,o,i),g=path.join(d,r);if(!le(u,m))return {success:false,path:g,mode:h,error:"Invalid skill name: potential path traversal detected"};if(!le(d,g))return {success:false,path:g,mode:h,error:"Invalid skill name: potential path traversal detected"};try{if(bl(t.path,g))return {success:!0,path:g,mode:h,skipped:!0};if(h==="copy")return await ve(g),await ms(t.path,g,e),{success:!0,path:g,mode:"copy"};if(bl(t.path,m))return {success:!0,path:m,canonicalPath:m,mode:"symlink",skipped:!0};if(await ve(m),await ms(t.path,m,e),l&&be(e))return {success:!0,path:m,canonicalPath:m,mode:"symlink"};if(!l&&!be(e)){let f=path.join(o,T[e].skillsDir.split("/")[0]);if(!fs$1.existsSync(f))return {success:!0,path:m,canonicalPath:m,mode:"symlink",skipped:!0}}return await hs(m,g)?{success:!0,path:g,canonicalPath:m,mode:"symlink"}:(await ve(g),await ms(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 Do=new Set(["metadata.json"]),To=new Set([".git","__pycache__","__pypackages__"]),No=(t,e=false)=>!!(Do.has(t)||e&&To.has(t));function et(t){let{data:e,content:s}=chunkEOOPF3RI_cjs.c(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 ms(t,e,s){await promises.mkdir(e,{recursive:true});let n=await promises.readdir(t,{withFileTypes:true});await Promise.all(n.filter(l=>!To(l.name,l.isDirectory())).map(async l=>{let o=path.join(t,l.name),i=path.join(e,l.name);if(l.isDirectory())await ms(o,i,s);else try{if(s==="eve"&&l.name.toLowerCase()==="skill.md"){await promises.writeFile(i,et(await promises.readFile(o,"utf-8")));return}await promises.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 No(t){return t.some(e=>path.basename(e.path).toLowerCase()==="skill.md")}function fs(t){return `${ge(t)}.md`}function Eo(t){let e=t.find(n=>path.basename(n.path).toLowerCase()==="skill.md");if(e)return et(e.contents);let s=t.find(n=>path.extname(n.path).toLowerCase()===".md");return s?et(s.contents):""}async function qt(t,e,s={}){let n=T[e],l=ge(t);if(s.global&&n.globalSkillsDir===void 0)return false;let o=s.global?n.globalSkillsDir:e==="eve"&&s.eveSubagent?at(s.eveSubagent,s.cwd):path.join(s.cwd||process.cwd(),n.skillsDir),i=path.join(o,l);if(!le(o,i))return false;try{return await promises.access(i),!0}catch{return false}}function ks(t,e,s={}){T[e];s.cwd||process.cwd();let o=ge(t),i=xe(e,s.global??false,s.cwd,s.eveSubagent),a=path.join(i,o);if(!le(i,a))throw new Error("Invalid skill name: potential path traversal detected");return a}function qe(t,e={}){let s=ge(t),n=e.agent==="eve"?xe("eve",e.global??false,e.cwd,e.eveSubagent):Ee(e.global??false,e.cwd),l=path.join(n,s);if(!le(n,l))throw new Error("Invalid skill name: potential path traversal detected");return l}async function Co(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=ge(t.installName),h=e==="eve"&&i==="symlink"?xe(e,l,o,a):Ee(l,o),u=path.join(h,r),g=xe(e,l,o,a),d=path.join(g,r);if(!le(h,u))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};if(!le(g,d))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};try{if(i==="copy"){await ve(d);let x=e==="eve"?fs(t.installName):"SKILL.md",A=path.join(d,x);return await promises.writeFile(A,e==="eve"?et(t.content):t.content,"utf-8"),{success:!0,path:d,mode:"copy"}}await ve(u);let m=e==="eve"?fs(t.installName):"SKILL.md",c=path.join(u,m);if(await promises.writeFile(c,e==="eve"?et(t.content):t.content,"utf-8"),l&&be(e))return {success:!0,path:u,canonicalPath:u,mode:"symlink"};if(!await hs(u,d)){await ve(d);let x=e==="eve"?fs(t.installName):"SKILL.md",A=path.join(d,x);return await promises.writeFile(A,e==="eve"?et(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 Qs(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=ge(t.installName),h=e==="eve"&&i==="symlink"?xe(e,l,o,a):Ee(l,o),u=path.join(h,r),g=xe(e,l,o,a),d=path.join(g,r);if(!le(h,u))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};if(!le(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=path.join(c,f);if(!le(c,A))continue;let $=path.dirname(A);$!==c&&await promises.mkdir($,{recursive:true}),await promises.writeFile(A,e==="eve"&&path.basename(f).toLowerCase()==="skill.md"&&typeof x=="string"?et(x):x);}}try{return i==="copy"?(await ve(d),await m(d),{success:!0,path:d,mode:"copy"}):(await ve(u),await m(u),l&&be(e)?{success:!0,path:u,canonicalPath:u,mode:"symlink"}:await hs(u,d)?{success:!0,path:d,canonicalPath:u,mode:"symlink"}:(await ve(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 ys(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=ge(t.installName),h=xe(e,l,o,a);if(e==="eve"&&!No(t.files)){let c=path.join(h,fs(t.installName));if(!le(h,c))return {success:false,path:c,mode:i,error:"Invalid skill name: potential path traversal detected"};try{return await promises.mkdir(h,{recursive:!0}),await promises.rm(c,{recursive:!0,force:!0}),await promises.writeFile(c,Eo(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"?xe(e,l,o,a):Ee(l,o),g=path.join(u,r),d=path.join(h,r);if(!le(u,g))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};if(!le(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=path.join(c,f.path);if(!le(c,x))continue;let A=path.dirname(x);A!==c&&await promises.mkdir(A,{recursive:true}),await promises.writeFile(x,e==="eve"&&path.basename(f.path).toLowerCase()==="skill.md"?et(f.contents):f.contents,"utf-8");}}try{if(i==="copy")return await ve(d),await m(d),{success:!0,path:d,mode:"copy"};if(await ve(g),await m(g),l&&be(e))return {success:!0,path:g,canonicalPath:g,mode:"symlink"};if(!l&&!be(e)){let f=path.join(o,T[e].skillsDir.split("/")[0]);if(!fs$1.existsSync(f))return {success:!0,path:g,canonicalPath:g,mode:"symlink",skipped:!0}}return await hs(g,d)?{success:!0,path:d,canonicalPath:g,mode:"symlink"}:(await ve(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 en(t={}){let e=t.cwd||process.cwd(),s=new Map,n=[],l=await Ue(),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:Ee(r,e)});for(let u of i){let g=T[u];if(r&&g.globalSkillsDir===void 0)continue;let d=r?g.globalSkillsDir:path.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 Qe(e)){let c=at(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:path.join(e,g.skillsDir);n.some(m=>m.path===d&&m.global===r)||fs$1.existsSync(d)&&n.push({global:r,path:d,agentType:u});}}for(let r of n)try{let h=await promises.readdir(r.path,{withFileTypes:!0});for(let u of h){let g=path.join(r.path,u.name);if(!await bl(u,g))continue;let d=path.join(g,"SKILL.md");try{await promises.stat(d);}catch{continue}let m=await je(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=ge(m.name),A=[];for(let $ of i){let E=T[$];if(r.global&&E.globalSkillsDir===void 0)continue;let D=xe($,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=path.join(D,L);if(le(D,w))try{await promises.access(w),F=!0;break}catch{}}if(!F)try{let L=await promises.readdir(D,{withFileTypes:!0});for(let w of L){let N=path.join(D,w.name);if(await bl(w,N)&&le(D,N))try{let U=path.join(N,"SKILL.md");await promises.stat(U);let M=await je(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 Je(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 Jt(t){let e=t.match(/^([^/]+)\/([^/]+)$/);return e?{owner:e[1],repo:e[2]}:null}async function vt(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 bs(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 Uo(t){return path.isAbsolute(t)||t.startsWith("./")||t.startsWith("../")||t==="."||t===".."||/^[a-zA-Z]:[/\\]/.test(t)}var Oo={"coinbase/agentWallet":"coinbase/agentic-wallet-skills"};function tn(t){try{return decodeURIComponent(t)}catch{return t}}function Fo(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 jo(t){let e=t.indexOf("#");if(e<0)return {inputWithoutFragment:t};let s=t.slice(0,e),n=t.slice(e+1);if(!n||!Fo(s))return {inputWithoutFragment:t};let l=n.indexOf("@");if(l===-1)return {inputWithoutFragment:s,ref:tn(n)};let o=n.slice(0,l),i=n.slice(l+1);return {inputWithoutFragment:s,ref:o?tn(o):void 0,skillFilter:i?tn(i):void 0}}function $l(t,e,s){return e?`${t}#${e}${s?`@${s}`:""}`:t}function ct(t){if(Uo(t)){let f=path.resolve(t);return {type:"local",url:f,localPath:f}}let{inputWithoutFragment:e,ref:s,skillFilter:n}=jo(t);t=e;let l=Oo[t];l&&(t=l);let o=t.match(/^github:(.+)$/);if(o)return ct($l(o[1],s,n));let i=t.match(/^gitlab:(.+)$/);if(i)return ct($l(`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:$&&bs($)}}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&&bs(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&&bs(A),...n?{skillFilter:n}:{}}}return Mo(t)?{type:"well-known",url:t}:{type:"git",url:t,...s?{ref:s}:{}}}function Mo(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 Ho=new stream.Writable({write(t,e,s){s();}}),zo=k__default.default.green("\u25C6"),Go=k__default.default.red("\u25A0"),Bo=k__default.default.green("\u25C7"),Vo=k__default.default.green("\u25CF"),qo=k__default.default.dim("\u25CB");k__default.default.green("\u2713");var Jo=k__default.default.green("\u2022"),ce=k__default.default.dim("\u2502"),xt=k__default.default.dim("\u2500"),Xo=Symbol("cancel");function Yo(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 Zo(t,e){let s=util.stripVTControlCharacters(t),n=Math.max(1,e),l=Yo(s);return Math.max(1,Math.ceil(l/n))}function Qo(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+Zo(l,s),0)}async function At(t){let{message:e,items:s,maxVisible:n=8,initialSelected:l=[],required:o=false,lockedSection:i}=t;return new Promise(a=>{let r=ws__namespace.createInterface({input:process.stdin,output:Ho,terminal:false});process.stdin.isTTY&&process.stdin.setRawMode(true),ws__namespace.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"?zo:C==="cancel"?Go:Bo;if(L.push(`${N} ${k__default.default.bold(e)}`),C==="active"){if(i&&i.items.length>0){L.push(`${ce}`);let ee=`${k__default.default.bold(i.title)} ${k__default.default.dim("\u2500\u2500 always included")}`;L.push(`${ce} ${xt}${xt} ${ee} ${xt.repeat(12)}`);for(let we of i.items)L.push(`${ce} ${Jo} ${k__default.default.bold(we.label)}`);i.hiddenCount&&i.hiddenCount>0&&L.push(`${ce} ${k__default.default.dim(`...and ${i.hiddenCount} more`)}`),L.push(`${ce}`),L.push(`${ce} ${xt}${xt} ${k__default.default.bold("Additional agents")} ${xt.repeat(29)}`);}let U=`${ce} ${k__default.default.dim("Search:")} ${h}${k__default.default.inverse(" ")}`;L.push(U),L.push(`${ce} ${k__default.default.dim("\u2191\u2193 move, space select, enter confirm")}`),L.push(`${ce}`);let M=Math.max(0,Math.min(u-Math.floor(n/2),w.length-n)),B=Math.min(w.length,M+n),de=w.slice(M,B);if(w.length===0)L.push(`${ce} ${k__default.default.dim("No matches found")}`);else {for(let pe=0;pe<de.length;pe++){let Pe=de[pe],ze=M+pe,_t=g.has(Pe.value),Ce=ze===u,Re=_t?Vo:qo,as=Ce?k__default.default.underline(Pe.label):Pe.label,S=Pe.hint?k__default.default.dim(` (${Pe.hint})`):"",_=Ce?k__default.default.cyan("\u276F"):" ";L.push(`${ce} ${_} ${Re} ${as}${S}`);}let ee=M,we=w.length-B;if(ee>0||we>0){let pe=[];ee>0&&pe.push(`\u2191 ${ee} more`),we>0&&pe.push(`\u2193 ${we} more`),L.push(`${ce} ${k__default.default.dim(pe.join(" "))}`);}}L.push(`${ce}`);let te=[...i?i.items.map(ee=>ee.label):[],...s.filter(ee=>g.has(ee.value)).map(ee=>ee.label)];if(te.length===0)L.push(`${ce} ${k__default.default.dim("Selected: (none)")}`);else {let ee=te.length<=3?te.join(", "):`${te.slice(0,3).join(", ")} +${te.length-3} more`;L.push(`${ce} ${k__default.default.green("Selected:")} ${ee}`);}L.push(`${k__default.default.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(`${ce} ${k__default.default.dim(U.join(", "))}`);}else C==="cancel"&&L.push(`${ce} ${k__default.default.strikethrough(k__default.default.dim("Cancelled"))}`);process.stdout.write(L.join(`
|
|
6
|
+
${s.replace(/^\r?\n/u,"")}`}async function ms(t,e,s){await promises.mkdir(e,{recursive:true});let n=await promises.readdir(t,{withFileTypes:true});await Promise.all(n.filter(l=>!No(l.name,l.isDirectory())).map(async l=>{let o=path.join(t,l.name),i=path.join(e,l.name);if(l.isDirectory())await ms(o,i,s);else try{if(s==="eve"&&l.name.toLowerCase()==="skill.md"){await promises.writeFile(i,et(await promises.readFile(o,"utf-8")));return}await promises.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=>path.basename(e.path).toLowerCase()==="skill.md")}function fs(t){return `${ge(t)}.md`}function Co(t){let e=t.find(n=>path.basename(n.path).toLowerCase()==="skill.md");if(e)return et(e.contents);let s=t.find(n=>path.extname(n.path).toLowerCase()===".md");return s?et(s.contents):""}async function qt(t,e,s={}){let n=T[e],l=ge(t);if(s.global&&n.globalSkillsDir===void 0)return false;let o=s.global?n.globalSkillsDir:e==="eve"&&s.eveSubagent?at(s.eveSubagent,s.cwd):path.join(s.cwd||process.cwd(),n.skillsDir),i=path.join(o,l);if(!le(o,i))return false;try{return await promises.access(i),!0}catch{return false}}function ks(t,e,s={}){T[e];s.cwd||process.cwd();let o=ge(t),i=xe(e,s.global??false,s.cwd,s.eveSubagent),a=path.join(i,o);if(!le(i,a))throw new Error("Invalid skill name: potential path traversal detected");return a}function qe(t,e={}){let s=ge(t),n=e.agent==="eve"?xe("eve",e.global??false,e.cwd,e.eveSubagent):Ee(e.global??false,e.cwd),l=path.join(n,s);if(!le(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=ge(t.installName),h=e==="eve"&&i==="symlink"?xe(e,l,o,a):Ee(l,o),u=path.join(h,r),m=xe(e,l,o,a),d=path.join(m,r);if(!le(h,u))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};if(!le(m,d))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};try{if(i==="copy"){await ve(d);let x=e==="eve"?fs(t.installName):"SKILL.md",A=path.join(d,x);return await promises.writeFile(A,e==="eve"?et(t.content):t.content,"utf-8"),{success:!0,path:d,mode:"copy"}}await ve(u);let g=e==="eve"?fs(t.installName):"SKILL.md",c=path.join(u,g);if(await promises.writeFile(c,e==="eve"?et(t.content):t.content,"utf-8"),l&&be(e))return {success:!0,path:u,canonicalPath:u,mode:"symlink"};if(!await hs(u,d)){await ve(d);let x=e==="eve"?fs(t.installName):"SKILL.md",A=path.join(d,x);return await promises.writeFile(A,e==="eve"?et(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 Qs(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=ge(t.installName),h=e==="eve"&&i==="symlink"?xe(e,l,o,a):Ee(l,o),u=path.join(h,r),m=xe(e,l,o,a),d=path.join(m,r);if(!le(h,u))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};if(!le(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=path.join(c,f);if(!le(c,A))continue;let $=path.dirname(A);$!==c&&await promises.mkdir($,{recursive:true}),await promises.writeFile(A,e==="eve"&&path.basename(f).toLowerCase()==="skill.md"&&typeof x=="string"?et(x):x);}}try{return i==="copy"?(await ve(d),await g(d),{success:!0,path:d,mode:"copy"}):(await ve(u),await g(u),l&&be(e)?{success:!0,path:u,canonicalPath:u,mode:"symlink"}:await hs(u,d)?{success:!0,path:d,canonicalPath:u,mode:"symlink"}:(await ve(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 ys(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=ge(t.installName),h=xe(e,l,o,a);if(e==="eve"&&!Eo(t.files)){let c=path.join(h,fs(t.installName));if(!le(h,c))return {success:false,path:c,mode:i,error:"Invalid skill name: potential path traversal detected"};try{return await promises.mkdir(h,{recursive:!0}),await promises.rm(c,{recursive:!0,force:!0}),await promises.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"?xe(e,l,o,a):Ee(l,o),m=path.join(u,r),d=path.join(h,r);if(!le(u,m))return {success:false,path:d,mode:i,error:"Invalid skill name: potential path traversal detected"};if(!le(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=path.join(c,f.path);if(!le(c,x))continue;let A=path.dirname(x);A!==c&&await promises.mkdir(A,{recursive:true}),await promises.writeFile(x,e==="eve"&&path.basename(f.path).toLowerCase()==="skill.md"?et(f.contents):f.contents,"utf-8");}}try{if(i==="copy")return await ve(d),await g(d),{success:!0,path:d,mode:"copy"};if(await ve(m),await g(m),l&&be(e))return {success:!0,path:m,canonicalPath:m,mode:"symlink"};if(!l&&!be(e)){let f=path.join(o,T[e].skillsDir.split("/")[0]);if(!fs$1.existsSync(f))return {success:!0,path:m,canonicalPath:m,mode:"symlink",skipped:!0}}return await hs(m,d)?{success:!0,path:d,canonicalPath:m,mode:"symlink"}:(await ve(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 en(t={}){let e=t.cwd||process.cwd(),s=new Map,n=[],l=await Ue(),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:Ee(r,e)});for(let u of i){let m=T[u];if(r&&m.globalSkillsDir===void 0)continue;let d=r?m.globalSkillsDir:path.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 Qe(e)){let c=at(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:path.join(e,m.skillsDir);n.some(g=>g.path===d&&g.global===r)||fs$1.existsSync(d)&&n.push({global:r,path:d,agentType:u});}}for(let r of n)try{let h=await promises.readdir(r.path,{withFileTypes:!0});for(let u of h){let m=path.join(r.path,u.name);if(!await wl(u,m))continue;let d=path.join(m,"SKILL.md");try{await promises.stat(d);}catch{continue}let g=await je(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=ge(g.name),A=[];for(let $ of i){let E=T[$];if(r.global&&E.globalSkillsDir===void 0)continue;let D=xe($,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=path.join(D,L);if(le(D,w))try{await promises.access(w),F=!0;break}catch{}}if(!F)try{let L=await promises.readdir(D,{withFileTypes:!0});for(let w of L){let N=path.join(D,w.name);if(await wl(w,N)&&le(D,N))try{let U=path.join(N,"SKILL.md");await promises.stat(U);let M=await je(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 Je(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 Jt(t){let e=t.match(/^([^/]+)\/([^/]+)$/);return e?{owner:e[1],repo:e[2]}:null}async function vt(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 bs(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 path.isAbsolute(t)||t.startsWith("./")||t.startsWith("../")||t==="."||t===".."||/^[a-zA-Z]:[/\\]/.test(t)}var Fo={"coinbase/agentWallet":"coinbase/agentic-wallet-skills"};function tn(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:tn(n)};let o=n.slice(0,l),i=n.slice(l+1);return {inputWithoutFragment:s,ref:o?tn(o):void 0,skillFilter:i?tn(i):void 0}}function vl(t,e,s){return e?`${t}#${e}${s?`@${s}`:""}`:t}function ct(t){if(Oo(t)){let f=path.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 ct(vl(o[1],s,n));let i=t.match(/^gitlab:(.+)$/);if(i)return ct(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:$&&bs($)}}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&&bs(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&&bs(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 stream.Writable({write(t,e,s){s();}}),Go=k__default.default.green("\u25C6"),Bo=k__default.default.red("\u25A0"),Vo=k__default.default.green("\u25C7"),qo=k__default.default.green("\u25CF"),Jo=k__default.default.dim("\u25CB");k__default.default.green("\u2713");var Xo=k__default.default.green("\u2022"),ce=k__default.default.dim("\u2502"),xt=k__default.default.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=util.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 At(t){let{message:e,items:s,maxVisible:n=8,initialSelected:l=[],required:o=false,lockedSection:i}=t;return new Promise(a=>{let r=ws__namespace.createInterface({input:process.stdin,output:zo,terminal:false});process.stdin.isTTY&&process.stdin.setRawMode(true),ws__namespace.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"?Go:C==="cancel"?Bo:Vo;if(L.push(`${N} ${k__default.default.bold(e)}`),C==="active"){if(i&&i.items.length>0){L.push(`${ce}`);let ee=`${k__default.default.bold(i.title)} ${k__default.default.dim("\u2500\u2500 always included")}`;L.push(`${ce} ${xt}${xt} ${ee} ${xt.repeat(12)}`);for(let we of i.items)L.push(`${ce} ${Xo} ${k__default.default.bold(we.label)}`);i.hiddenCount&&i.hiddenCount>0&&L.push(`${ce} ${k__default.default.dim(`...and ${i.hiddenCount} more`)}`),L.push(`${ce}`),L.push(`${ce} ${xt}${xt} ${k__default.default.bold("Additional agents")} ${xt.repeat(29)}`);}let U=`${ce} ${k__default.default.dim("Search:")} ${h}${k__default.default.inverse(" ")}`;L.push(U),L.push(`${ce} ${k__default.default.dim("\u2191\u2193 move, space select, enter confirm")}`),L.push(`${ce}`);let M=Math.max(0,Math.min(u-Math.floor(n/2),w.length-n)),B=Math.min(w.length,M+n),de=w.slice(M,B);if(w.length===0)L.push(`${ce} ${k__default.default.dim("No matches found")}`);else {for(let pe=0;pe<de.length;pe++){let Pe=de[pe],ze=M+pe,_t=m.has(Pe.value),Ce=ze===u,Re=_t?qo:Jo,as=Ce?k__default.default.underline(Pe.label):Pe.label,S=Pe.hint?k__default.default.dim(` (${Pe.hint})`):"",_=Ce?k__default.default.cyan("\u276F"):" ";L.push(`${ce} ${_} ${Re} ${as}${S}`);}let ee=M,we=w.length-B;if(ee>0||we>0){let pe=[];ee>0&&pe.push(`\u2191 ${ee} more`),we>0&&pe.push(`\u2193 ${we} more`),L.push(`${ce} ${k__default.default.dim(pe.join(" "))}`);}}L.push(`${ce}`);let te=[...i?i.items.map(ee=>ee.label):[],...s.filter(ee=>m.has(ee.value)).map(ee=>ee.label)];if(te.length===0)L.push(`${ce} ${k__default.default.dim("Selected: (none)")}`);else {let ee=te.length<=3?te.join(", "):`${te.slice(0,3).join(", ")} +${te.length-3} more`;L.push(`${ce} ${k__default.default.green("Selected:")} ${ee}`);}L.push(`${k__default.default.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(`${ce} ${k__default.default.dim(U.join(", "))}`);}else C==="cancel"&&L.push(`${ce} ${k__default.default.strikethrough(k__default.default.dim("Cancelled"))}`);process.stdout.write(L.join(`
|
|
7
7
|
`)+`
|
|
8
|
-
`),d=
|
|
8
|
+
`),d=er(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(Yo);},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 sn=3e5,nn=(()=>{let t=process.env.SKILLS_CLONE_TIMEOUT_MS;if(!t)return sn;let e=Number.parseInt(t,10);return Number.isFinite(e)&&e>0?e:sn})(),Ll=util.promisify(child_process.execFile),Me=class extends Error{constructor(s,n,l=false,o=false){super(s);chunkEOOPF3RI_cjs.a(this,"url");chunkEOOPF3RI_cjs.a(this,"isTimeout");chunkEOOPF3RI_cjs.a(this,"isAuthError");this.name="GitCloneError",this.url=n,this.isTimeout=l,this.isAuthError=o;}};function Tl(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 Nl(t){try{let e=new URL(t);return e.protocol==="https:"&&e.hostname==="github.com"}catch{return false}}function ln(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 ar(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")||ln(t)}function Il(t){let e={...process.env,GIT_TERMINAL_PROMPT:"0",GIT_LFS_SKIP_SMUDGE:"1",...t};return tr__default.default({timeout:{block:nn},config:["filter.lfs.required=false","filter.lfs.smudge=","filter.lfs.clean=","filter.lfs.process="]}).env(e)}async function Pl(t){try{await promises.rm(t,{recursive:!0,force:!0});}catch{}await promises.mkdir(t,{recursive:true});}async function cr(t,e,s){let n=t.slug;try{let{stdout:o,stderr:i}=await Ll("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 Ll("gh",["repo","clone",n,e,"--",...s?["--depth=1","--branch",s]:["--depth=1"]],{timeout:nn,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),true}function ur(t,e,s){return e&&ln(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 ms(t,e,s){await promises.mkdir(e,{rec
|
|
|
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 We(t,e){let s=await promises.mkdtemp(path.join(os$1.tmpdir(),"skills-")),n=e?["--depth","1","--branch",e]:["--depth","1"],l=
|
|
18
|
+
- For HTTPS: Run 'gh auth login' or configure git credentials`}async function We(t,e){let s=await promises.mkdtemp(path.join(os$1.tmpdir(),"skills-")),n=e?["--depth","1","--branch",e]:["--depth","1"],l=Tl(t);try{return await Il().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=ar(i);if(a){try{await promises.rm(s,{recursive:!0,force:!0});}catch{}let h=Math.round(nn/1e3);throw new Me(`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&&Tl(t)){try{if(await Il(s),await ar(l,s,e))return s}catch{}try{return await Il(s),await Ll({GIT_SSH_COMMAND:process.env.GIT_SSH_COMMAND??"ssh -o BatchMode=yes"}).clone(l.sshUrl,s,n),s}catch{}}try{await promises.rm(s,{recursive:!0,force:!0});}catch{}throw r?new Me(cr(t,l,i),t,false,true):new Me(`Failed to clone ${t}: ${i}`,t,false,false)}}async function tt(t){let e=path.normalize(path.resolve(t)),s=path.normalize(path.resolve(os$1.tmpdir()));if(!e.startsWith(s+path.sep)&&e!==s)throw new Error("Attempted to clean up directory outside of temp directory");await promises.rm(t,{recursive:true,force:true});}var ur="https://add-skill.vercel.sh/t",dr="https://add-skill.vercel.sh/audit",on=null,rn=null;function cn(t){rn=t;}function pr(){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 gr(){return !process.env.DISABLE_TELEMETRY&&!process.env.DO_NOT_TRACK}function $s(t){on=t;}async function un(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(`${dr}?${n.toString()}`,{signal:l.signal});return clearTimeout(o),i.ok?await i.json():null}catch{return null}}var an=[];function he(t){if(gr())try{let e=new URLSearchParams;on&&e.set("v",on),pr()&&e.set("ci","1"),rn&&e.set("agent",rn);for(let[n,l]of Object.entries(t))l!=null&&e.set(n,String(l));let s=fetch(`${ur}?${e.toString()}`).catch(()=>{}).then(()=>{});an.push(s);}catch{}}async function mr(t=5e3){if(an.length===0)return;let e=new Promise(s=>setTimeout(s,t));await Promise.race([Promise.all(an),e]);}var Lt=null,hr={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 Xe(){return Lt||(Lt=await detectAgent.determineAgent(),Lt.isAgent&&cn(Lt.agent.name),Lt)}async function Xt(){return (await Xe()).isAgent}async function kr(){let t=await Xe();return t.isAgent?t.agent.name:null}function Yt(t){return hr[t]??null}var dn=class{constructor(){chunkEOOPF3RI_cjs.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]}},Zt=new dn;function Nl(t){Zt.register(t);}function El(t){return Zt.findProvider(t)}function Cl(){return Zt.getProviders()}var Rl="https://schemas.agentskills.io/discovery/0.2.0/schema.json",Sr=50*1024*1024,$r=1e3,Qt=class{constructor(){chunkEOOPF3RI_cjs.a(this,"id","well-known");chunkEOOPF3RI_cjs.a(this,"displayName","Well-Known Skills");chunkEOOPF3RI_cjs.a(this,"WELL_KNOWN_PATHS",[".well-known/agent-skills",".well-known/skills"]);chunkEOOPF3RI_cjs.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===Rl){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:Rl,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}=chunkEOOPF3RI_cjs.c(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}=chunkEOOPF3RI_cjs.c(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}=chunkEOOPF3RI_cjs.c(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:chunkEOOPF3RI_cjs.e(e.name),description:chunkEOOPF3RI_cjs.e(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:${crypto.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>Sr)throw new Error("Archive exceeds maximum unpacked size");if(e.size>=$r)throw new Error("Archive contains too many files");e.set(o,n);}extractTarGz(e){let s=zlib.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),B;if(g===0)B=M;else if(g===8)B=zlib.inflateRawSync(M);else throw new Error(`Unsupported zip compression method: ${g}`);if(B.byteLength!==m)throw new Error("Zip entry size mismatch");this.addArchiveFile(i,F,new Uint8Array(B),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}},ut=new Qt;var Tr=".agents",gn=".skill-lock.json",_l=3;function hn(){let t=kt(),e=Te(),s=process.env.XDG_STATE_HOME;return s?path.join(s,"skills",gn):t?path.join(t,"skills",gn):path.join(e||os$1.homedir(),Tr,gn)}async function Ae(){let t=hn();try{let e=await promises.readFile(t,"utf-8"),s=JSON.parse(e);return typeof s.version!="number"||!s.skills||s.version<_l?mn():s}catch{return mn()}}async function es(t){let e=hn();await promises.mkdir(path.dirname(e),{recursive:true});let s=JSON.stringify(t,null,2);await promises.writeFile(e,s,"utf-8");}function Nr(t){return crypto.createHash("sha256").update(t,"utf-8").digest("hex")}var fn=false;function Er(){fn=false;}function st(){if(process.env.GITHUB_TOKEN)return process.env.GITHUB_TOKEN;if(process.env.GH_TOKEN)return process.env.GH_TOKEN;fn||(process.stderr.write(`${k__default.default.yellow("\u2502")} ${k__default.default.yellow("GitHub rate limit reached")} \u2014 using your ${k__default.default.cyan("gh")} login to continue.
|
|
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 promises.rm(s,{recursive:!0,force:!0});}catch{}throw r?new Me(ur(t,l,i),t,false,true):new Me(`Failed to clone ${t}: ${i}`,t,false,false)}}async function tt(t){let e=path.normalize(path.resolve(t)),s=path.normalize(path.resolve(os$1.tmpdir()));if(!e.startsWith(s+path.sep)&&e!==s)throw new Error("Attempted to clean up directory outside of temp directory");await promises.rm(t,{recursive:true,force:true});}var dr="https://add-skill.vercel.sh/t",pr="https://add-skill.vercel.sh/audit",on=null,rn=null;function cn(t){rn=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 $s(t){on=t;}async function un(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 an=[];function he(t){if(mr())try{let e=new URLSearchParams;on&&e.set("v",on),gr()&&e.set("ci","1"),rn&&e.set("agent",rn);for(let[n,l]of Object.entries(t))l!=null&&e.set(n,String(l));let s=fetch(`${dr}?${e.toString()}`).catch(()=>{}).then(()=>{});an.push(s);}catch{}}async function fr(t=5e3){if(an.length===0)return;let e=new Promise(s=>setTimeout(s,t));await Promise.race([Promise.all(an),e]);}var Lt=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 Xe(){return Lt||(Lt=await detectAgent.determineAgent(),Lt.isAgent&&cn(Lt.agent.name),Lt)}async function Xt(){return (await Xe()).isAgent}async function yr(){let t=await Xe();return t.isAgent?t.agent.name:null}function Yt(t){return kr[t]??null}var dn=class{constructor(){chunkEOOPF3RI_cjs.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]}},Zt=new dn;function El(t){Zt.register(t);}function Cl(t){return Zt.findProvider(t)}function Rl(){return Zt.getProviders()}var _l="https://schemas.agentskills.io/discovery/0.2.0/schema.json",$r=50*1024*1024,vr=1e3,Qt=class{constructor(){chunkEOOPF3RI_cjs.a(this,"id","well-known");chunkEOOPF3RI_cjs.a(this,"displayName","Well-Known Skills");chunkEOOPF3RI_cjs.a(this,"WELL_KNOWN_PATHS",[".well-known/agent-skills",".well-known/skills"]);chunkEOOPF3RI_cjs.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===_l){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:_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}=chunkEOOPF3RI_cjs.c(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}=chunkEOOPF3RI_cjs.c(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}=chunkEOOPF3RI_cjs.c(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:chunkEOOPF3RI_cjs.e(e.name),description:chunkEOOPF3RI_cjs.e(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:${crypto.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=zlib.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),B;if(m===0)B=M;else if(m===8)B=zlib.inflateRawSync(M);else throw new Error(`Unsupported zip compression method: ${m}`);if(B.byteLength!==g)throw new Error("Zip entry size mismatch");this.addArchiveFile(i,F,new Uint8Array(B),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}},ut=new Qt;var Nr=".agents",gn=".skill-lock.json",Ul=3;function hn(){let t=kt(),e=Te(),s=process.env.XDG_STATE_HOME;return s?path.join(s,"skills",gn):t?path.join(t,"skills",gn):path.join(e||os$1.homedir(),Nr,gn)}async function Ae(){let t=hn();try{let e=await promises.readFile(t,"utf-8"),s=JSON.parse(e);return typeof s.version!="number"||!s.skills||s.version<Ul?mn():s}catch{return mn()}}async function es(t){let e=hn();await promises.mkdir(path.dirname(e),{recursive:true});let s=JSON.stringify(t,null,2);await promises.writeFile(e,s,"utf-8");}function Er(t){return crypto.createHash("sha256").update(t,"utf-8").digest("hex")}var fn=false;function Cr(){fn=false;}function st(){if(process.env.GITHUB_TOKEN)return process.env.GITHUB_TOKEN;if(process.env.GH_TOKEN)return process.env.GH_TOKEN;fn||(process.stderr.write(`${k__default.default.yellow("\u2502")} ${k__default.default.yellow("GitHub rate limit reached")} \u2014 using your ${k__default.default.cyan("gh")} login to continue.
|
|
24
24
|
${k__default.default.yellow("\u2502")} ${k__default.default.dim(`Tip: set ${k__default.default.cyan("GITHUB_TOKEN")} to avoid this prompt, or use ${k__default.default.cyan("--full-depth")} to clone instead.
|
|
25
|
-
`)}`),fn=true);try{let t=child_process.execSync("gh auth token",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();if(t)return t}catch{}return null}async function Cr(t,e,s,n){let{fetchRepoTree:l,getSkillFolderHashFromTree:o}=await import('./chunks/blob-BHATBRFW.cjs'),i=await l(t,n,s??void 0);return i?o(i,e):null}async function vs(t,e){let s=await Ae(),n=new Date().toISOString(),l=s.skills[t];s.skills[t]={...e,installedAt:l?.installedAt??n,updatedAt:n},await es(s);}async function kn(t){let e=await Ae();return t in e.skills?(delete e.skills[t],await es(e),true):false}async function yn(t){return (await Ae()).skills[t]??null}async function bn(){return (await Ae()).skills}async function Rr(){let t=await Ae(),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 mn(){return {version:_l,skills:{},dismissed:{}}}async function wn(t){return (await Ae()).dismissed?.[t]===true}async function It(t){let e=await Ae();e.dismissed||(e.dismissed={}),e.dismissed[t]=true,await es(e);}async function xs(){return (await Ae()).lastSelectedAgents}async function As(t){let e=await Ae();e.lastSelectedAgents=t,await es(e);}var Ul={version:"0.2.49"};var jl=t=>typeof t=="symbol",Ml="eve agent";async function Wr(t){let e=Jt(t);return e?vt(e.owner,e.repo):false}function Kr(t,e){return t.startsWith("git@")||t.startsWith("ssh://")?t:e}function vn(t){$s(t);}function Ol(t){switch(t){case "critical":return k__default.default.red(k__default.default.bold("Critical Risk"));case "high":return k__default.default.red("High Risk");case "medium":return k__default.default.yellow("Med Risk");case "low":return k__default.default.green("Low Risk");case "safe":return k__default.default.green("Safe");default:return k__default.default.dim("--")}}function Hr(t){if(!t)return k__default.default.dim("--");let e=t.alerts??0;return e>0?k__default.default.red(`${e} alert${e!==1?"s":""}`):k__default.default.green("0 alerts")}function Pt(t,e){let s=chunkEOOPF3RI_cjs.d(t),n=Math.max(0,e-s.length);return t+" ".repeat(n)}function zr(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=Pt("",l+2)+Pt(k__default.default.dim("Gen"),18)+Pt(k__default.default.dim("Socket"),18)+k__default.default.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?Ol(r.ath.risk):k__default.default.dim("--"),g=r?.socket?Hr(r.socket):k__default.default.dim("--"),d=r?.snyk?Ol(r.snyk.risk):k__default.default.dim("--");o.push(Pt(k__default.default.cyan(h),l+2)+Pt(u,18)+Pt(g,18)+d);}return o.push(""),o.push(`${k__default.default.dim("Details:")} ${k__default.default.dim(`https://skills.sh/${s}`)}`),o}function Dt(t,e){let s=os$1.homedir();return t===s||t.startsWith(s+path.sep)?"~"+t.slice(s.length):t===e||t.startsWith(e+path.sep)?"."+t.slice(e.length):t}function Gr(t){let e=crypto.createHash("sha256");return e.update("SKILL.md"),e.update(t),e.digest("hex")}function me(t,e=5){if(t.length<=e)return t.join(", ");let s=t.slice(0,e),n=t.length-e;return `${s.join(", ")} +${n} more`}function Br(t){let e=t.map(n=>k__default.default.cyan(ne(n))),s=me(e,3);return chunkEOOPF3RI_cjs.d(s).length<=80?s:`${t.length} selected skills`}function Vr(t){return `Detected an eve project. Install ${Br(t)} for your ${Ml} to use?`}function xn(t){let e=[],s=[];for(let n of t)be(n)?e.push(T[n].displayName):s.push(T[n].displayName);return {universal:e,symlinked:s}}function qr(t,e){let s=[],{universal:n,symlinked:l}=xn(t);if(e==="symlink")n.length>0&&s.push(` ${k__default.default.green("universal:")} ${me(n)}`),l.length>0&&s.push(` ${k__default.default.dim("symlink \u2192")} ${me(l)}`);else {let o=t.map(i=>T[i].displayName);s.push(` ${k__default.default.dim("copy \u2192")} ${me(o)}`);}return s}function Is(t){let e=T[t.agent].displayName;return t.subagent?`${e} (${t.subagent})`:e}function Fl(t){return t.subagent?`${t.agent}:${t.subagent}`:t.agent}function Jr(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 Xr(t,e){let s=[],n=t.filter(a=>!a.subagent).map(a=>a.agent),l=t.filter(a=>a.subagent).map(Is),{universal:o,symlinked:i}=xn(n);if(e==="symlink")o.length>0&&s.push(` ${k__default.default.green("universal:")} ${me(o)}`),i.length>0&&s.push(` ${k__default.default.dim("symlink \u2192")} ${me(i)}`),l.length>0&&s.push(` ${k__default.default.dim("copy \u2192")} ${me(l)}`);else {let a=t.map(Is);s.push(` ${k__default.default.dim("copy \u2192")} ${me(a)}`);}return s}function Sn(t){let e=Ve(),s=[...t];for(let n of e)s.includes(n)||s.push(n);return s}function Wl(t,e){let s=[],{universal:n}=xn(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__default.default.green("universal:")} ${me(n)}`),o.length>0&&s.push(` ${k__default.default.dim("symlinked:")} ${me(o)}`),i.length>0&&s.push(` ${k__default.default.yellow("copied:")} ${me(i)}`),s}function Kl(t){return y__namespace.multiselect({...t,options:t.options,message:`${t.message} ${k__default.default.dim("(space to toggle)")}`})}async function Hl(t,e){let s;try{s=await xs();}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 At({message:t,items:e,initialSelected:i,required:true});if(!jl(a))try{await As(a);}catch{}return a}async function $n(t){let e=u=>!t.global||T[u].globalSkillsDir,s=Ve().filter(e),n=Kt().filter(e),l=yt().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 xs();}catch{}let r=a?a.filter(u=>l.includes(u)&&!s.includes(u)):[],h=await At({message:"Which agents do you want to install to?",items:i,initialSelected:r,lockedSection:o});if(!jl(h))try{await As(h);}catch{}return h}var Yr=Ul.version;$s(Yr);async function Zr(t,e,s,n){n.start("Discovering skills from well-known endpoint...");let l=await ut.fetchAllSkills(e);l.length===0&&(n.stop(k__default.default.red("No skills found")),y__namespace.outro(k__default.default.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__default.default.green(l.length)} skill${l.length>1?"s":""}`);for(let w of l)y__namespace.log.info(`Skill: ${k__default.default.cyan(w.installName)}`),y__namespace.log.message(k__default.default.dim(w.description)),w.files.size>1&&y__namespace.log.message(k__default.default.dim(` Files: ${Array.from(w.files.keys()).join(", ")}`));if(s.list){console.log(),y__namespace.log.step(k__default.default.bold("Available Skills"));for(let w of l)y__namespace.log.message(` ${k__default.default.cyan(w.installName)}`),y__namespace.log.message(` ${k__default.default.dim(w.description)}`),w.files.size>1&&y__namespace.log.message(` ${k__default.default.dim(`Files: ${w.files.size}`)}`);console.log(),y__namespace.outro("Run without --list to install"),process.exit(0);}let o;if(s.skill?.includes("*"))o=l,y__namespace.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__namespace.log.error(`No matching skills found for: ${s.skill.join(", ")}`),y__namespace.log.info("Available skills:");for(let w of l)y__namespace.log.message(` - ${w.installName}`);process.exit(1);}}else if(l.length===1){o=l;let w=l[0];y__namespace.log.info(`Skill: ${k__default.default.cyan(w.installName)}`);}else if(s.yes)o=l,y__namespace.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 Kl({message:"Select skills to install",options:w,required:true});y__namespace.isCancel(N)&&(y__namespace.cancel("Installation cancelled"),process.exit(0)),o=N;}let i,a=Object.keys(T);if(s.agent?.includes("*"))i=a,y__namespace.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__namespace.log.error(`Invalid agents: ${w.join(", ")}`),y__namespace.log.info(`Valid agents: ${a.join(", ")}`),process.exit(1)),i=s.agent;}else {n.start("Loading agents...");let w=await Ue(),N=Object.keys(T).length;if(n.stop(`${N} agents`),w.length===0)if(s.yes)i=a,y__namespace.log.info("Installing to all agents");else {y__namespace.log.info("Select agents to install skills to");let U=Object.entries(T).map(([B,de])=>({value:B,label:de.displayName})),M=await Hl("Which agents do you want to install to?",U);y__namespace.isCancel(M)&&(y__namespace.cancel("Installation cancelled"),process.exit(0)),i=M;}else if(w.length===1||s.yes)if(i=Sn(w),w.length===1){let U=w[0];y__namespace.log.info(`Installing to: ${k__default.default.cyan(T[U].displayName)}`);}else y__namespace.log.info(`Installing to: ${w.map(U=>k__default.default.cyan(T[U].displayName)).join(", ")}`);else {let U=await $n({global:s.global});y__namespace.isCancel(U)&&(y__namespace.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__namespace.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__namespace.isCancel(w)&&(y__namespace.cancel("Installation cancelled"),process.exit(0)),r=w;}let u=s.copy?"copy":"symlink",g=new Set(i.map(w=>T[w].skillsDir));if(!s.copy&&!s.yes&&g.size>1){let w=await y__namespace.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__namespace.isCancel(w)&&(y__namespace.cancel("Installation cancelled"),process.exit(0)),u=w;}else g.size<=1&&(u="copy");let d=process.cwd(),m=[];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 qt(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){m.length>0&&m.push("");let N=qe(w.installName,{global:r}),U=Dt(N,d);m.push(`${k__default.default.cyan(U)}`),m.push(...qr(i,u)),w.files.size>1&&m.push(` ${k__default.default.dim("files:")} ${w.files.size}`);let M=x.get(w.installName),B=i.filter(de=>M?.get(de)).map(de=>T[de].displayName);B.length>0&&m.push(` ${k__default.default.yellow("overwrites:")} ${me(B)}`);}if(console.log(),y__namespace.note(m.join(`
|
|
26
|
-
`),"Installation Summary"),!s.yes){let w=await y__namespace.confirm({message:"Proceed with installation?"});(y__namespace.isCancel(w)||!w)&&(y__namespace.cancel("Installation cancelled"),process.exit(0));}let A=ut.getSourceIdentifier(e),$=
|
|
27
|
-
`),de),U.length>0&&(y__namespace.log.warn(k__default.default.yellow(`Symlinks failed for: ${me(M)}`)),y__namespace.log.message(k__default.default.dim(" Files were copied instead. On Windows, enable Developer Mode for symlink support.")));}if(F.length>0){console.log(),y__namespace.log.error(k__default.default.red(`Failed to install ${F.length}`));for(let w of F)y__namespace.log.message(` ${k__default.default.red("\u2717")} ${w.skill} \u2192 ${w.agent}: ${k__default.default.dim(w.error)}`);}console.log(),y__namespace.outro(k__default.default.green("Done!")+k__default.default.dim(" Review skills before use; they run with full agent permissions.")),await zl(s,i);}async function nt(t,e={}){let s=t[0],n=false,l=()=>{n||(y__namespace.log.message(k__default.default.dim("Tip: use the --yes (-y) and --global (-g) flags to install without prompts.")),n=true);};s||(console.log(),console.log(k__default.default.bgRed(k__default.default.white(k__default.default.bold(" ERROR ")))+" "+k__default.default.red("Missing required argument: source")),console.log(),console.log(k__default.default.dim(" Usage:")),console.log(` ${k__default.default.cyan("easbot skills add")} ${k__default.default.yellow("<source>")} ${k__default.default.dim("[options]")}`),console.log(),console.log(k__default.default.dim(" Example:")),console.log(` ${k__default.default.cyan("easbot skills add")} ${k__default.default.yellow("houjallen/agent-skills")}`),console.log(),process.exit(1)),e.all&&(e.skill=["*"],e.agent=["*"],e.yes=true);let o=await Xe();if(o.isAgent&&(e.yes=true,!e.agent||e.agent.length===0)){let a=Yt(o.agent.name);a&&(e.agent=Sn([a]));}console.log(),o.isAgent||y__namespace.intro(k__default.default.bgCyan(k__default.default.black(" skills "))),o.isAgent?y__namespace.log.info(k__default.default.bgCyan(k__default.default.black(k__default.default.bold(` ${o.agent.name} `)))+" Agent detected \u2014 installing non-interactively"):process.stdin.isTTY||l();let i=null;try{let a=y__namespace.spinner();a.start("Parsing source...");let r=ct(s);a.stop(`Source: ${r.type==="local"?r.localPath:r.url}${r.ref?` @ ${k__default.default.yellow(r.ref)}`:""}${r.subpath?` (${r.subpath})`:""}${r.skillFilter?` ${k__default.default.dim("@")}${k__default.default.cyan(r.skillFilter)}`:""}`);let h=Je(r),u=(()=>{if(!h)return Promise.resolve(null);let S=Jt(h);return S?vt(S.owner,S.repo).catch(()=>null):Promise.resolve(null)})();if(r.type==="well-known"){await Zr(s,r.url,e,a);return}r.skillFilter&&(e.skill=e.skill||[],e.skill.includes(r.skillFilter)||e.skill.push(r.skillFilter));let g=!!(e.skill&&e.skill.length>0),d,m=null;if(r.type==="local")a.start("Validating local path..."),fs$1.existsSync(r.localPath)||(a.stop(k__default.default.red("Path not found")),y__namespace.outro(k__default.default.red(`Local path does not exist: ${r.localPath}`)),process.exit(1)),a.stop("Local path validated"),a.start("Discovering skills..."),d=await $e(r.localPath,r.subpath,{includeInternal:g,fullDepth:e.fullDepth});else if(r.type==="github"&&!e.fullDepth){let S=["vercel","houjallen","heygen-com"],_=Je(r),O=_?.split("/")[0]?.toLowerCase(),R=!!_&&Object.hasOwn(chunkEOOPF3RI_cjs.f,_.toLowerCase());_&&O&&(R||S.includes(O))&&(a.start("Fetching skills..."),m=await chunkEOOPF3RI_cjs.l(_,{subpath:r.subpath,skillFilter:r.skillFilter,ref:r.ref,getToken:st,includeInternal:g}),m||a.stop(k__default.default.dim("Falling back to clone..."))),m?(d=m.skills,a.stop(`Found ${k__default.default.green(d.length)} skill${d.length>1?"s":""}`)):(a.start("Cloning repository..."),i=await We(r.url,r.ref),a.stop("Repository cloned"),a.start("Discovering skills..."),d=await $e(i,r.subpath,{includeInternal:g,fullDepth:e.fullDepth}));}else a.start("Cloning repository..."),i=await We(r.url,r.ref),a.stop("Repository cloned"),a.start("Discovering skills..."),d=await $e(i,r.subpath,{includeInternal:g,fullDepth:e.fullDepth});if(d.length===0&&(a.stop(k__default.default.red("No skills found")),y__namespace.outro(k__default.default.red("No valid skills found. Skills require a SKILL.md with name and description.")),await ke(i),process.exit(1)),m||a.stop(`Found ${k__default.default.green(d.length)} skill${d.length>1?"s":""}`),e.list){console.log(),y__namespace.log.step(k__default.default.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__default.default.bold(K));for(let H of S[R])y__namespace.log.message(` ${k__default.default.cyan(ne(H))}`),y__namespace.log.message(` ${k__default.default.dim(H.description)}`);console.log();}if(_.length>0){O.length>0&&console.log(k__default.default.bold("General"));for(let R of _)y__namespace.log.message(` ${k__default.default.cyan(ne(R))}`),y__namespace.log.message(` ${k__default.default.dim(R.description)}`);}console.log(),y__namespace.outro("Use --skill <name> to install specific skills"),await ke(i),process.exit(0);}let c;if(e.skill?.includes("*"))c=d,y__namespace.log.info(`Installing all ${d.length} skills`);else if(e.skill&&e.skill.length>0){if(c=zt(d,e.skill),c.length===0){y__namespace.log.error(`No matching skills found for: ${e.skill.join(", ")}`),y__namespace.log.info("Available skills:");for(let S of d)y__namespace.log.message(` - ${ne(S)}`);await ke(i),process.exit(1);}y__namespace.log.info(`Selected ${c.length} skill${c.length!==1?"s":""}: ${c.map(S=>k__default.default.cyan(ne(S))).join(", ")}`);}else if(d.length===1){c=d;let S=d[0];y__namespace.log.info(`Skill: ${k__default.default.cyan(ne(S))}`),y__namespace.log.message(k__default.default.dim(S.description));}else if(e.yes)c=d,y__namespace.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):ne(R).localeCompare(ne(K))),_=S.some(R=>R.pluginName),O;if(_){let R=H=>H.split("-").map(q=>q.charAt(0).toUpperCase()+q.slice(1)).join(" "),K={};for(let H of S){let q=H.pluginName?R(H.pluginName):"Other";K[q]||(K[q]=[]),K[q].push({value:H,label:ne(H),hint:H.description.length>60?H.description.slice(0,57)+"...":H.description});}O=await y__namespace.groupMultiselect({message:`Select skills to install ${k__default.default.dim("(space to toggle)")}`,options:K,required:!0});}else {let R=S.map(K=>({value:K,label:ne(K),hint:K.description.length>60?K.description.slice(0,57)+"...":K.description}));O=await Kl({message:"Select skills to install",options:R,required:!0});}y__namespace.isCancel(O)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0)),c=O;}let f=Je(r),x=f?un(f,c.map(S=>ne(S))):Promise.resolve(null),A,$=Object.keys(T);if(e.agent?.includes("*"))A=$,y__namespace.log.info(`Installing to all ${A.length} agents`);else if(e.agent&&e.agent.length>0){let S=e.agent.filter(_=>!$.includes(_));S.length>0&&(y__namespace.log.error(`Invalid agents: ${S.join(", ")}`),y__namespace.log.info(`Valid agents: ${$.join(", ")}`),await ke(i),process.exit(1)),A=e.agent;}else {a.start("Loading agents...");let S=await Ue(),_=Object.keys(T).length;if(a.stop(`${_} agents`),S.includes("eve")&&(e.yes||!o.isAgent)){let O=e.yes?!0:await y__namespace.confirm({message:Vr(c),initialValue:!0});if(y__namespace.isCancel(O)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0)),O)A=["eve"],y__namespace.log.info(`Installing to: ${k__default.default.cyan(Ml)}`);else {let R=await $n({global:e.global});y__namespace.isCancel(R)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0)),A=R;}}else if(S.length===0)if(e.yes)A=$,y__namespace.log.info("Installing to all agents");else {y__namespace.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 Hl("Which agents do you want to install to?",O);y__namespace.isCancel(R)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0)),A=R;}else if(S.length===1||e.yes)if(A=Sn(S),S.length===1){let O=S[0];y__namespace.log.info(`Installing to: ${k__default.default.cyan(T[O].displayName)}`);}else y__namespace.log.info(`Installing to: ${S.map(O=>k__default.default.cyan(T[O].displayName)).join(", ")}`);else {let O=await $n({global:e.global});y__namespace.isCancel(O)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0)),A=O;}}e.subagent&&e.subagent.length>0&&!A.includes("eve")&&(A=[...A,"eve"]);let E=[void 0];if(A.includes("eve")){let S=Qe(process.cwd());if(e.subagent&&e.subagent.length>0)E=e.subagent.map(_=>_==="root"||_==="."?void 0:_);else if(S.length>0&&!e.yes){let _=[{value:"",label:"Root agent",hint:"agent/skills"},...S.map(R=>({value:R,label:R,hint:`agent/subagents/${R}/skills`}))],O=await y__namespace.multiselect({message:"Where should Eve skills be installed?",options:_,initialValues:[""],required:!0});y__namespace.isCancel(O)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0)),E=O.map(R=>R===""?void 0:R);}}let D=Jr(A,E),F=e.global??!1,C=A.some(S=>T[S].globalSkillsDir!==void 0);if(e.global===void 0&&!e.yes&&C){let S=await y__namespace.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__namespace.isCancel(S)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0)),F=S;}let L=e.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.copy&&!e.yes&&N.size>1&&!w){let S=await y__namespace.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__namespace.isCancel(S)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0)),L=S;}else (N.size<=1||w)&&(L="copy");let U=process.cwd(),M=[],B=await Promise.all(c.flatMap(S=>D.map(async _=>({skillName:S.name,target:_,installed:await qt(S.name,_.agent,{global:F,eveSubagent:_.subagent})})))),de=new Map;for(let{skillName:S,target:_,installed:O}of B)de.has(S)||de.set(S,new Map),de.get(S).set(Fl(_),O);let te={},ee=[];for(let S of c)if(S.pluginName){let _=S.pluginName;te[_]||(te[_]=[]),te[_].push(S);}else ee.push(S);let we=S=>{for(let _ of S){M.length>0&&M.push("");let O=D.length===1?qe(_.name,{global:F,agent:D[0].agent,eveSubagent:D[0].subagent}):qe(_.name,{global:F}),R=Dt(O,U);M.push(`${k__default.default.cyan(R)}`),M.push(...Xr(D,L));let K=de.get(_.name),H=D.filter(q=>K?.get(Fl(q))).map(Is);H.length>0&&M.push(` ${k__default.default.yellow("overwrites:")} ${me(H)}`);}},pe=Object.keys(te).sort();for(let S of pe){let _=S.split("-").map(O=>O.charAt(0).toUpperCase()+O.slice(1)).join(" ");M.push(""),M.push(k__default.default.bold(_)),we(te[S]);}ee.length>0&&(pe.length>0&&(M.push(""),M.push(k__default.default.bold("General"))),we(ee)),console.log(),y__namespace.note(M.join(`
|
|
28
|
-
`),"Installation Summary");try{let S=await x;if(S&&f){let _=
|
|
29
|
-
`),"Security Risk Assessments");}}catch{}if(!e.yes){let S=await y__namespace.confirm({message:"Proceed with installation?"});(y__namespace.isCancel(S)||!S)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0));}a.start("Installing skills...");let Pe=[];for(let S of c)for(let _ of D){let{agent:O,subagent:R}=_,K;if(
|
|
30
|
-
`),
|
|
31
|
-
`))y__namespace.log.message(k__default.default.dim(r));}else y__namespace.log.error(a instanceof Error?a.message:"Unknown error occurred");l(),y__namespace.outro(k__default.default.red("Installation failed")),process.exit(1);}finally{await ke(i);}}async function ke(t){if(t)try{await tt(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
|
+
`)}`),fn=true);try{let t=child_process.execSync("gh auth token",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();if(t)return t}catch{}return null}async function Rr(t,e,s,n){let{fetchRepoTree:l,getSkillFolderHashFromTree:o}=await import('./chunks/blob-BHATBRFW.cjs'),i=await l(t,n,s??void 0);return i?o(i,e):null}async function vs(t,e){let s=await Ae(),n=new Date().toISOString(),l=s.skills[t];s.skills[t]={...e,installedAt:l?.installedAt??n,updatedAt:n},await es(s);}async function kn(t){let e=await Ae();return t in e.skills?(delete e.skills[t],await es(e),true):false}async function yn(t){return (await Ae()).skills[t]??null}async function bn(){return (await Ae()).skills}async function _r(){let t=await Ae(),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 mn(){return {version:Ul,skills:{},dismissed:{}}}async function wn(t){return (await Ae()).dismissed?.[t]===true}async function It(t){let e=await Ae();e.dismissed||(e.dismissed={}),e.dismissed[t]=true,await es(e);}async function xs(){return (await Ae()).lastSelectedAgents}async function As(t){let e=await Ae();e.lastSelectedAgents=t,await es(e);}var Ol={version:"0.3.2"};var Ml=t=>typeof t=="symbol",Wl="eve agent";async function Kr(t){let e=Jt(t);return e?vt(e.owner,e.repo):false}function Hr(t,e){return t.startsWith("git@")||t.startsWith("ssh://")?t:e}function vn(t){$s(t);}function Fl(t){switch(t){case "critical":return k__default.default.red(k__default.default.bold("Critical Risk"));case "high":return k__default.default.red("High Risk");case "medium":return k__default.default.yellow("Med Risk");case "low":return k__default.default.green("Low Risk");case "safe":return k__default.default.green("Safe");default:return k__default.default.dim("--")}}function zr(t){if(!t)return k__default.default.dim("--");let e=t.alerts??0;return e>0?k__default.default.red(`${e} alert${e!==1?"s":""}`):k__default.default.green("0 alerts")}function Pt(t,e){let s=chunkEOOPF3RI_cjs.d(t),n=Math.max(0,e-s.length);return t+" ".repeat(n)}function Gr(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=Pt("",l+2)+Pt(k__default.default.dim("Gen"),18)+Pt(k__default.default.dim("Socket"),18)+k__default.default.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?Fl(r.ath.risk):k__default.default.dim("--"),m=r?.socket?zr(r.socket):k__default.default.dim("--"),d=r?.snyk?Fl(r.snyk.risk):k__default.default.dim("--");o.push(Pt(k__default.default.cyan(h),l+2)+Pt(u,18)+Pt(m,18)+d);}return o.push(""),o.push(`${k__default.default.dim("Details:")} ${k__default.default.dim(`https://skills.sh/${s}`)}`),o}function Dt(t,e){let s=os$1.homedir();return t===s||t.startsWith(s+path.sep)?"~"+t.slice(s.length):t===e||t.startsWith(e+path.sep)?"."+t.slice(e.length):t}function Br(t){let e=crypto.createHash("sha256");return e.update("SKILL.md"),e.update(t),e.digest("hex")}function me(t,e=5){if(t.length<=e)return t.join(", ");let s=t.slice(0,e),n=t.length-e;return `${s.join(", ")} +${n} more`}function Vr(t){let e=t.map(n=>k__default.default.cyan(ne(n))),s=me(e,3);return chunkEOOPF3RI_cjs.d(s).length<=80?s:`${t.length} selected skills`}function qr(t){return `Detected an eve project. Install ${Vr(t)} for your ${Wl} to use?`}function xn(t){let e=[],s=[];for(let n of t)be(n)?e.push(T[n].displayName):s.push(T[n].displayName);return {universal:e,symlinked:s}}function Jr(t,e){let s=[],{universal:n,symlinked:l}=xn(t);if(e==="symlink")n.length>0&&s.push(` ${k__default.default.green("universal:")} ${me(n)}`),l.length>0&&s.push(` ${k__default.default.dim("symlink \u2192")} ${me(l)}`);else {let o=t.map(i=>T[i].displayName);s.push(` ${k__default.default.dim("copy \u2192")} ${me(o)}`);}return s}function Is(t){let e=T[t.agent].displayName;return t.subagent?`${e} (${t.subagent})`:e}function jl(t){return t.subagent?`${t.agent}:${t.subagent}`:t.agent}function Xr(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 Yr(t,e){let s=[],n=t.filter(a=>!a.subagent).map(a=>a.agent),l=t.filter(a=>a.subagent).map(Is),{universal:o,symlinked:i}=xn(n);if(e==="symlink")o.length>0&&s.push(` ${k__default.default.green("universal:")} ${me(o)}`),i.length>0&&s.push(` ${k__default.default.dim("symlink \u2192")} ${me(i)}`),l.length>0&&s.push(` ${k__default.default.dim("copy \u2192")} ${me(l)}`);else {let a=t.map(Is);s.push(` ${k__default.default.dim("copy \u2192")} ${me(a)}`);}return s}function Sn(t){let e=Ve(),s=[...t];for(let n of e)s.includes(n)||s.push(n);return s}function Kl(t,e){let s=[],{universal:n}=xn(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__default.default.green("universal:")} ${me(n)}`),o.length>0&&s.push(` ${k__default.default.dim("symlinked:")} ${me(o)}`),i.length>0&&s.push(` ${k__default.default.yellow("copied:")} ${me(i)}`),s}function Hl(t){return y__namespace.multiselect({...t,options:t.options,message:`${t.message} ${k__default.default.dim("(space to toggle)")}`})}async function zl(t,e){let s;try{s=await xs();}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 At({message:t,items:e,initialSelected:i,required:true});if(!Ml(a))try{await As(a);}catch{}return a}async function $n(t){let e=u=>!t.global||T[u].globalSkillsDir,s=Ve().filter(e),n=Kt().filter(e),l=yt().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 xs();}catch{}let r=a?a.filter(u=>l.includes(u)&&!s.includes(u)):[],h=await At({message:"Which agents do you want to install to?",items:i,initialSelected:r,lockedSection:o});if(!Ml(h))try{await As(h);}catch{}return h}var Zr=Ol.version;$s(Zr);async function Qr(t,e,s,n){n.start("Discovering skills from well-known endpoint...");let l=await ut.fetchAllSkills(e);l.length===0&&(n.stop(k__default.default.red("No skills found")),y__namespace.outro(k__default.default.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__default.default.green(l.length)} skill${l.length>1?"s":""}`);for(let w of l)y__namespace.log.info(`Skill: ${k__default.default.cyan(w.installName)}`),y__namespace.log.message(k__default.default.dim(w.description)),w.files.size>1&&y__namespace.log.message(k__default.default.dim(` Files: ${Array.from(w.files.keys()).join(", ")}`));if(s.list){console.log(),y__namespace.log.step(k__default.default.bold("Available Skills"));for(let w of l)y__namespace.log.message(` ${k__default.default.cyan(w.installName)}`),y__namespace.log.message(` ${k__default.default.dim(w.description)}`),w.files.size>1&&y__namespace.log.message(` ${k__default.default.dim(`Files: ${w.files.size}`)}`);console.log(),y__namespace.outro("Run without --list to install"),process.exit(0);}let o;if(s.skill?.includes("*"))o=l,y__namespace.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__namespace.log.error(`No matching skills found for: ${s.skill.join(", ")}`),y__namespace.log.info("Available skills:");for(let w of l)y__namespace.log.message(` - ${w.installName}`);process.exit(1);}}else if(l.length===1){o=l;let w=l[0];y__namespace.log.info(`Skill: ${k__default.default.cyan(w.installName)}`);}else if(s.yes)o=l,y__namespace.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 Hl({message:"Select skills to install",options:w,required:true});y__namespace.isCancel(N)&&(y__namespace.cancel("Installation cancelled"),process.exit(0)),o=N;}let i,a=Object.keys(T);if(s.agent?.includes("*"))i=a,y__namespace.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__namespace.log.error(`Invalid agents: ${w.join(", ")}`),y__namespace.log.info(`Valid agents: ${a.join(", ")}`),process.exit(1)),i=s.agent;}else {n.start("Loading agents...");let w=await Ue(),N=Object.keys(T).length;if(n.stop(`${N} agents`),w.length===0)if(s.yes)i=a,y__namespace.log.info("Installing to all agents");else {y__namespace.log.info("Select agents to install skills to");let U=Object.entries(T).map(([B,de])=>({value:B,label:de.displayName})),M=await zl("Which agents do you want to install to?",U);y__namespace.isCancel(M)&&(y__namespace.cancel("Installation cancelled"),process.exit(0)),i=M;}else if(w.length===1||s.yes)if(i=Sn(w),w.length===1){let U=w[0];y__namespace.log.info(`Installing to: ${k__default.default.cyan(T[U].displayName)}`);}else y__namespace.log.info(`Installing to: ${w.map(U=>k__default.default.cyan(T[U].displayName)).join(", ")}`);else {let U=await $n({global:s.global});y__namespace.isCancel(U)&&(y__namespace.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__namespace.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__namespace.isCancel(w)&&(y__namespace.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__namespace.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__namespace.isCancel(w)&&(y__namespace.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 qt(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=qe(w.installName,{global:r}),U=Dt(N,d);g.push(`${k__default.default.cyan(U)}`),g.push(...Jr(i,u)),w.files.size>1&&g.push(` ${k__default.default.dim("files:")} ${w.files.size}`);let M=x.get(w.installName),B=i.filter(de=>M?.get(de)).map(de=>T[de].displayName);B.length>0&&g.push(` ${k__default.default.yellow("overwrites:")} ${me(B)}`);}if(console.log(),y__namespace.note(g.join(`
|
|
26
|
+
`),"Installation Summary"),!s.yes){let w=await y__namespace.confirm({message:"Proceed with installation?"});(y__namespace.isCancel(w)||!w)&&(y__namespace.cancel("Installation cancelled"),process.exit(0));}let A=ut.getSourceIdentifier(e),$=Kr(A).catch(()=>null);n.start("Installing skills...");let E=[];for(let w of o)for(let N of i){let U=await Qs(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&&he({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 vs(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(B=>B.skill===N.installName),M=U?.canonicalPath||U?.path;if(M){let B=await Fe(M);await bt(N.installName,{source:A,sourceType:"well-known",computedHash:B},d);}}catch{}}if(D.length>0){let w=new Map;for(let te of D){let ee=w.get(te.skill)||[];ee.push(te),w.set(te.skill,ee);}let N=w.size,U=D.filter(te=>te.mode==="symlink"&&te.symlinkFailed),M=U.map(te=>te.agent),B=[];for(let[te,ee]of w){let we=ee[0];if(we.mode==="copy"){B.push(`${k__default.default.green("\u2713")} ${te} ${k__default.default.dim("(copied)")}`);for(let pe of ee){let Pe=Dt(pe.path,d);B.push(` ${k__default.default.dim("\u2192")} ${Pe}`);}}else {if(we.canonicalPath){let pe=Dt(we.canonicalPath,d);B.push(`${k__default.default.green("\u2713")} ${pe}`);}else B.push(`${k__default.default.green("\u2713")} ${te}`);B.push(...Kl(ee,i));}}let de=k__default.default.green(`Installed ${N} skill${N!==1?"s":""}`);y__namespace.note(B.join(`
|
|
27
|
+
`),de),U.length>0&&(y__namespace.log.warn(k__default.default.yellow(`Symlinks failed for: ${me(M)}`)),y__namespace.log.message(k__default.default.dim(" Files were copied instead. On Windows, enable Developer Mode for symlink support.")));}if(F.length>0){console.log(),y__namespace.log.error(k__default.default.red(`Failed to install ${F.length}`));for(let w of F)y__namespace.log.message(` ${k__default.default.red("\u2717")} ${w.skill} \u2192 ${w.agent}: ${k__default.default.dim(w.error)}`);}console.log(),y__namespace.outro(k__default.default.green("Done!")+k__default.default.dim(" Review skills before use; they run with full agent permissions.")),await Gl(s,i);}async function nt(t,e={}){let s=t[0],n=false,l=()=>{n||(y__namespace.log.message(k__default.default.dim("Tip: use the --yes (-y) and --global (-g) flags to install without prompts.")),n=true);};s||(console.log(),console.log(k__default.default.bgRed(k__default.default.white(k__default.default.bold(" ERROR ")))+" "+k__default.default.red("Missing required argument: source")),console.log(),console.log(k__default.default.dim(" Usage:")),console.log(` ${k__default.default.cyan("easbot skills add")} ${k__default.default.yellow("<source>")} ${k__default.default.dim("[options]")}`),console.log(),console.log(k__default.default.dim(" Example:")),console.log(` ${k__default.default.cyan("easbot skills add")} ${k__default.default.yellow("houjallen/agent-skills")}`),console.log(),process.exit(1)),e.all&&(e.skill=["*"],e.agent=["*"],e.yes=true);let o=await Xe();if(o.isAgent&&(e.yes=true,!e.agent||e.agent.length===0)){let a=Yt(o.agent.name);a&&(e.agent=Sn([a]));}console.log(),o.isAgent||y__namespace.intro(k__default.default.bgCyan(k__default.default.black(" skills "))),o.isAgent?y__namespace.log.info(k__default.default.bgCyan(k__default.default.black(k__default.default.bold(` ${o.agent.name} `)))+" Agent detected \u2014 installing non-interactively"):process.stdin.isTTY||l();let i=null;try{let a=y__namespace.spinner();a.start("Parsing source...");let r=ct(s);a.stop(`Source: ${r.type==="local"?r.localPath:r.url}${r.ref?` @ ${k__default.default.yellow(r.ref)}`:""}${r.subpath?` (${r.subpath})`:""}${r.skillFilter?` ${k__default.default.dim("@")}${k__default.default.cyan(r.skillFilter)}`:""}`);let h=Je(r),u=(()=>{if(!h)return Promise.resolve(null);let S=Jt(h);return S?vt(S.owner,S.repo).catch(()=>null):Promise.resolve(null)})();if(r.type==="well-known"){await Qr(s,r.url,e,a);return}r.skillFilter&&(e.skill=e.skill||[],e.skill.includes(r.skillFilter)||e.skill.push(r.skillFilter));let m=!!(e.skill&&e.skill.length>0),d,g=null;if(r.type==="local")a.start("Validating local path..."),fs$1.existsSync(r.localPath)||(a.stop(k__default.default.red("Path not found")),y__namespace.outro(k__default.default.red(`Local path does not exist: ${r.localPath}`)),process.exit(1)),a.stop("Local path validated"),a.start("Discovering skills..."),d=await $e(r.localPath,r.subpath,{includeInternal:m,fullDepth:e.fullDepth});else if(r.type==="github"&&!e.fullDepth){let S=["vercel","houjallen","heygen-com"],_=Je(r),O=_?.split("/")[0]?.toLowerCase(),R=!!_&&Object.hasOwn(chunkEOOPF3RI_cjs.f,_.toLowerCase());_&&O&&(R||S.includes(O))&&(a.start("Fetching skills..."),g=await chunkEOOPF3RI_cjs.l(_,{subpath:r.subpath,skillFilter:r.skillFilter,ref:r.ref,getToken:st,includeInternal:m}),g||a.stop(k__default.default.dim("Falling back to clone..."))),g?(d=g.skills,a.stop(`Found ${k__default.default.green(d.length)} skill${d.length>1?"s":""}`)):(a.start("Cloning repository..."),i=await We(r.url,r.ref),a.stop("Repository cloned"),a.start("Discovering skills..."),d=await $e(i,r.subpath,{includeInternal:m,fullDepth:e.fullDepth}));}else a.start("Cloning repository..."),i=await We(r.url,r.ref),a.stop("Repository cloned"),a.start("Discovering skills..."),d=await $e(i,r.subpath,{includeInternal:m,fullDepth:e.fullDepth});if(d.length===0&&(a.stop(k__default.default.red("No skills found")),y__namespace.outro(k__default.default.red("No valid skills found. Skills require a SKILL.md with name and description.")),await ke(i),process.exit(1)),g||a.stop(`Found ${k__default.default.green(d.length)} skill${d.length>1?"s":""}`),e.list){console.log(),y__namespace.log.step(k__default.default.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__default.default.bold(K));for(let H of S[R])y__namespace.log.message(` ${k__default.default.cyan(ne(H))}`),y__namespace.log.message(` ${k__default.default.dim(H.description)}`);console.log();}if(_.length>0){O.length>0&&console.log(k__default.default.bold("General"));for(let R of _)y__namespace.log.message(` ${k__default.default.cyan(ne(R))}`),y__namespace.log.message(` ${k__default.default.dim(R.description)}`);}console.log(),y__namespace.outro("Use --skill <name> to install specific skills"),await ke(i),process.exit(0);}let c;if(e.skill?.includes("*"))c=d,y__namespace.log.info(`Installing all ${d.length} skills`);else if(e.skill&&e.skill.length>0){if(c=zt(d,e.skill),c.length===0){y__namespace.log.error(`No matching skills found for: ${e.skill.join(", ")}`),y__namespace.log.info("Available skills:");for(let S of d)y__namespace.log.message(` - ${ne(S)}`);await ke(i),process.exit(1);}y__namespace.log.info(`Selected ${c.length} skill${c.length!==1?"s":""}: ${c.map(S=>k__default.default.cyan(ne(S))).join(", ")}`);}else if(d.length===1){c=d;let S=d[0];y__namespace.log.info(`Skill: ${k__default.default.cyan(ne(S))}`),y__namespace.log.message(k__default.default.dim(S.description));}else if(e.yes)c=d,y__namespace.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):ne(R).localeCompare(ne(K))),_=S.some(R=>R.pluginName),O;if(_){let R=H=>H.split("-").map(q=>q.charAt(0).toUpperCase()+q.slice(1)).join(" "),K={};for(let H of S){let q=H.pluginName?R(H.pluginName):"Other";K[q]||(K[q]=[]),K[q].push({value:H,label:ne(H),hint:H.description.length>60?H.description.slice(0,57)+"...":H.description});}O=await y__namespace.groupMultiselect({message:`Select skills to install ${k__default.default.dim("(space to toggle)")}`,options:K,required:!0});}else {let R=S.map(K=>({value:K,label:ne(K),hint:K.description.length>60?K.description.slice(0,57)+"...":K.description}));O=await Hl({message:"Select skills to install",options:R,required:!0});}y__namespace.isCancel(O)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0)),c=O;}let f=Je(r),x=f?un(f,c.map(S=>ne(S))):Promise.resolve(null),A,$=Object.keys(T);if(e.agent?.includes("*"))A=$,y__namespace.log.info(`Installing to all ${A.length} agents`);else if(e.agent&&e.agent.length>0){let S=e.agent.filter(_=>!$.includes(_));S.length>0&&(y__namespace.log.error(`Invalid agents: ${S.join(", ")}`),y__namespace.log.info(`Valid agents: ${$.join(", ")}`),await ke(i),process.exit(1)),A=e.agent;}else {a.start("Loading agents...");let S=await Ue(),_=Object.keys(T).length;if(a.stop(`${_} agents`),S.includes("eve")&&(e.yes||!o.isAgent)){let O=e.yes?!0:await y__namespace.confirm({message:qr(c),initialValue:!0});if(y__namespace.isCancel(O)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0)),O)A=["eve"],y__namespace.log.info(`Installing to: ${k__default.default.cyan(Wl)}`);else {let R=await $n({global:e.global});y__namespace.isCancel(R)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0)),A=R;}}else if(S.length===0)if(e.yes)A=$,y__namespace.log.info("Installing to all agents");else {y__namespace.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 zl("Which agents do you want to install to?",O);y__namespace.isCancel(R)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0)),A=R;}else if(S.length===1||e.yes)if(A=Sn(S),S.length===1){let O=S[0];y__namespace.log.info(`Installing to: ${k__default.default.cyan(T[O].displayName)}`);}else y__namespace.log.info(`Installing to: ${S.map(O=>k__default.default.cyan(T[O].displayName)).join(", ")}`);else {let O=await $n({global:e.global});y__namespace.isCancel(O)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0)),A=O;}}e.subagent&&e.subagent.length>0&&!A.includes("eve")&&(A=[...A,"eve"]);let E=[void 0];if(A.includes("eve")){let S=Qe(process.cwd());if(e.subagent&&e.subagent.length>0)E=e.subagent.map(_=>_==="root"||_==="."?void 0:_);else if(S.length>0&&!e.yes){let _=[{value:"",label:"Root agent",hint:"agent/skills"},...S.map(R=>({value:R,label:R,hint:`agent/subagents/${R}/skills`}))],O=await y__namespace.multiselect({message:"Where should Eve skills be installed?",options:_,initialValues:[""],required:!0});y__namespace.isCancel(O)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0)),E=O.map(R=>R===""?void 0:R);}}let D=Xr(A,E),F=e.global??!1,C=A.some(S=>T[S].globalSkillsDir!==void 0);if(e.global===void 0&&!e.yes&&C){let S=await y__namespace.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__namespace.isCancel(S)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0)),F=S;}let L=e.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.copy&&!e.yes&&N.size>1&&!w){let S=await y__namespace.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__namespace.isCancel(S)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0)),L=S;}else (N.size<=1||w)&&(L="copy");let U=process.cwd(),M=[],B=await Promise.all(c.flatMap(S=>D.map(async _=>({skillName:S.name,target:_,installed:await qt(S.name,_.agent,{global:F,eveSubagent:_.subagent})})))),de=new Map;for(let{skillName:S,target:_,installed:O}of B)de.has(S)||de.set(S,new Map),de.get(S).set(jl(_),O);let te={},ee=[];for(let S of c)if(S.pluginName){let _=S.pluginName;te[_]||(te[_]=[]),te[_].push(S);}else ee.push(S);let we=S=>{for(let _ of S){M.length>0&&M.push("");let O=D.length===1?qe(_.name,{global:F,agent:D[0].agent,eveSubagent:D[0].subagent}):qe(_.name,{global:F}),R=Dt(O,U);M.push(`${k__default.default.cyan(R)}`),M.push(...Yr(D,L));let K=de.get(_.name),H=D.filter(q=>K?.get(jl(q))).map(Is);H.length>0&&M.push(` ${k__default.default.yellow("overwrites:")} ${me(H)}`);}},pe=Object.keys(te).sort();for(let S of pe){let _=S.split("-").map(O=>O.charAt(0).toUpperCase()+O.slice(1)).join(" ");M.push(""),M.push(k__default.default.bold(_)),we(te[S]);}ee.length>0&&(pe.length>0&&(M.push(""),M.push(k__default.default.bold("General"))),we(ee)),console.log(),y__namespace.note(M.join(`
|
|
28
|
+
`),"Installation Summary");try{let S=await x;if(S&&f){let _=Gr(S,c.map(O=>({slug:ne(O),displayName:ne(O)})),f);_.length>0&&y__namespace.note(_.join(`
|
|
29
|
+
`),"Security Risk Assessments");}}catch{}if(!e.yes){let S=await y__namespace.confirm({message:"Proceed with installation?"});(y__namespace.isCancel(S)||!S)&&(y__namespace.cancel("Installation cancelled"),await ke(i),process.exit(0));}a.start("Installing skills...");let Pe=[];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 ys({installName:H.name,files:H.files},O,{global:F,mode:L,eveSubagent:R});}else i&&S.path===i&&S.rawContent?K=await ys({installName:S.name,files:[{path:"SKILL.md",contents:S.rawContent}]},O,{global:F,mode:L}):K=await Vt(S,O,{global:F,mode:L,eveSubagent:R});Pe.push({skill:ne(S),agent:Is(_),pluginName:S.pluginName,...K});}a.stop("Installation complete"),console.log();let ze=Pe.filter(S=>S.success),_t=Pe.filter(S=>!S.success),Ce={};for(let S of c)g&&"repoPath"in S?Ce[S.name]=S.repoPath:i&&S.path===i?Ce[S.name]="SKILL.md":i&&S.path.startsWith(i+path.sep)&&(Ce[S.name]=`${S.path.slice(i.length+1).split(path.sep).join("/")}/SKILL.md`);let Re=Je(r),as=Hr(r.url,Re);if(Re&&(Jt(Re)?await u===!1&&he({event:"install",source:Re,skills:c.map(O=>O.name).join(","),agents:A.join(","),...F&&{global:"1"},skillFiles:JSON.stringify(Ce)}):he({event:"install",source:Re,skills:c.map(_=>_.name).join(","),agents:A.join(","),...F&&{global:"1"},skillFiles:JSON.stringify(Ce)})),ze.length>0&&F&&Re){let S=new Set(ze.map(O=>O.skill)),_;r.type==="github"&&!g&&(_=await chunkEOOPF3RI_cjs.i(Re,r.ref,st));for(let O of c){let R=ne(O);if(S.has(R))try{let K="",H=Ce[O.name];if(g&&H){let q=chunkEOOPF3RI_cjs.j(g.tree,H);q&&(K=q);}else if(r.type==="github"&&H&&_){let q=chunkEOOPF3RI_cjs.j(_,H);q&&(K=q);}else if(H&&i){let q=path.join(i,path.dirname(H)),Ut=await Fe(q);Ut&&(K=Ut);}await vs(O.name,{source:as||Re,sourceType:r.type,sourceUrl:r.url,ref:r.ref,skillPath:H,skillFolderHash:K,pluginName:O.pluginName});}catch{}}}if(ze.length>0&&!F){let S=new Set(ze.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=ne(R);if(S.has(K))try{let H=g&&"snapshotHash"in R?R.snapshotHash:i&&R.path===i&&R.rawContent?Br(R.rawContent):await Fe(R.path),q=Ce[R.name];await bt(R.name,{source:as||r.url,ref:r.ref,sourceType:r.type,...q&&{skillPath:q},computedHash:H,...O&&{subagents:_}},U);}catch{}}}if(ze.length>0){let S=new Map,_={},O=[];for(let re of ze){let Ge=S.get(re.skill)||[];if(Ge.push(re),S.set(re.skill,Ge),Ge.length===1)if(re.pluginName){let _e=re.pluginName;_[_e]||(_[_e]=[]),_[_e].push(re);}else O.push(re);}let R=S.size,K=ze.filter(re=>re.mode==="symlink"&&re.symlinkFailed),H=K.map(re=>re.agent),q=[],Ut=re=>{for(let Ge of re){let _e=S.get(Ge.skill)||[],Cs=_e[0];if(Cs.mode==="copy"){q.push(`${k__default.default.green("\u2713")} ${Ge.skill} ${k__default.default.dim("(copied)")}`);for(let Rs of _e){let Mi=Dt(Rs.path,U);q.push(` ${k__default.default.dim("\u2192")} ${Mi}`);}}else {if(Cs.canonicalPath){let Rs=Dt(Cs.canonicalPath,U);q.push(`${k__default.default.green("\u2713")} ${Rs}`);}else q.push(`${k__default.default.green("\u2713")} ${Ge.skill}`);q.push(...Kl(_e,A));}}},zn=Object.keys(_).sort();for(let re of zn){let Ge=re.split("-").map(_e=>_e.charAt(0).toUpperCase()+_e.slice(1)).join(" ");q.push(""),q.push(k__default.default.bold(Ge)),Ut(_[re]);}O.length>0&&(zn.length>0&&(q.push(""),q.push(k__default.default.bold("General"))),Ut(O));let ji=k__default.default.green(`Installed ${R} skill${R!==1?"s":""}`);y__namespace.note(q.join(`
|
|
30
|
+
`),ji),K.length>0&&(y__namespace.log.warn(k__default.default.yellow(`Symlinks failed for: ${me(H)}`)),y__namespace.log.message(k__default.default.dim(" Files were copied instead. On Windows, enable Developer Mode for symlink support.")));}if(_t.length>0){console.log(),y__namespace.log.error(k__default.default.red(`Failed to install ${_t.length}`));for(let S of _t)y__namespace.log.message(` ${k__default.default.red("\u2717")} ${S.skill} \u2192 ${S.agent}: ${k__default.default.dim(S.error)}`);}console.log(),y__namespace.outro(k__default.default.green("Done!")+k__default.default.dim(" Review skills before use; they run with full agent permissions.")),await Gl(e,A);}catch(a){if(a instanceof Me){y__namespace.log.error(k__default.default.red("Failed to clone repository"));for(let r of a.message.split(`
|
|
31
|
+
`))y__namespace.log.message(k__default.default.dim(r));}else y__namespace.log.error(a instanceof Error?a.message:"Unknown error occurred");l(),y__namespace.outro(k__default.default.red("Installation failed")),process.exit(1);}finally{await ke(i);}}async function ke(t){if(t)try{await tt(t);}catch{}}async function Gl(t,e){if(process.stdin.isTTY&&!t?.yes)try{if(await wn("findSkillsPrompt"))return;if(await qt("find-skills","claude-code",{global:!0})){await It("findSkillsPrompt");return}console.log(),y__namespace.log.message(k__default.default.dim("One-time prompt - you won't be asked again if you dismiss."));let l=await y__namespace.confirm({message:`Install the ${k__default.default.cyan("find-skills")} skill? It helps your agent discover and suggest skills.`});if(y__namespace.isCancel(l)){await It("findSkillsPrompt");return}if(l){await It("findSkillsPrompt");let o=e?.filter(i=>i!=="replit");if(!o||o.length===0)return;console.log(),y__namespace.log.step("Installing find-skills skill...");try{await nt(["houjallen/skills"],{skill:["find-skills"],global:!0,yes:!0,agent:o});}catch{y__namespace.log.warn("Failed to install find-skills. You can try again with:"),y__namespace.log.message(k__default.default.dim(" easbot skills add houjallen/skills@find-skills -g -y --all"));}}else await It("findSkillsPrompt"),y__namespace.log.message(k__default.default.dim("You can install it later with: easbot skills add houjallen/skills@find-skills"));}catch{}}function ts(t){let e={},s=[];for(let n=0;n<t.length;n++){let l=t[n];if(l==="-g"||l==="--global")e.global=true;else if(l==="-y"||l==="--yes")e.yes=true;else if(l==="-l"||l==="--list")e.list=true;else if(l==="--all")e.all=true;else if(l==="-a"||l==="--agent"){e.agent=e.agent||[],n++;let o=t[n];for(;n<t.length&&o&&!o.startsWith("-");)e.agent.push(o),n++,o=t[n];n--;}else if(l==="-s"||l==="--skill"){e.skill=e.skill||[],n++;let o=t[n];for(;n<t.length&&o&&!o.startsWith("-");)e.skill.push(o),n++,o=t[n];n--;}else if(l==="--full-depth")e.fullDepth=true;else if(l==="--copy")e.copy=true;else if(l==="--subagent"){e.subagent=e.subagent||[],n++;let o=t[n];for(;n<t.length&&o&&!o.startsWith("-");)e.subagent.push(o),n++,o=t[n];n--;}else l&&!l.startsWith("-")&&s.push(l);}return {source:s,options:e}}var An=utils.Log.create({service:"skills-find"}),X="\x1B[0m",Ps="\x1B[1m",ue="\x1B[38;5;102m",Tt="\x1B[38;5;145m",Vl="\x1B[36m";var ta=process.env.SKILLS_API_URL||"https://skills.sh";function ql(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 sa=/^[a-z0-9](?:[a-z0-9-]{0,38})$/i;function Jl(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(!sa.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 Ln(t,e){try{let s=new URLSearchParams({q:t,limit:"10"});e&&s.set("owner",e);let n=`${ta}/api/search?${s.toString()}`,l=await fetch(n);return l.ok?(await l.json()).skills.map(i=>({name:chunkEOOPF3RI_cjs.e(i.name),slug:chunkEOOPF3RI_cjs.e(i.id),source:chunkEOOPF3RI_cjs.e(i.source||""),installs:i.installs})).sort((i,a)=>(a.installs||0)-(i.installs||0)):[]}catch{return []}}var na="\x1B[?25l",la="\x1B[?25h",ia="\x1B[J",oa=t=>`\x1B[${t}A`,ra=t=>`\x1B[${t}G`;async function aa(t="",e){let s=[],n=0,l=t,o=false,i=null,a=0;process.stdin.isTTY&&process.stdin.setRawMode(true),ws__namespace.emitKeypressEvents(process.stdin),process.stdin.resume(),process.stdout.write(na);function r(){a>0&&process.stdout.write(oa(a)+ra(1)),process.stdout.write(ia);let u=[],m=`${Ps}_${X}`;if(u.push(`${Tt}Search skills:${X} ${l}${m}`),u.push(""),!l||l.length<2)u.push(`${ue}Start typing to search (min 2 chars)${X}`);else if(s.length===0&&o)u.push(`${ue}Searching...${X}`);else if(s.length===0)u.push(`${ue}No skills found${X}`);else {let g=s.slice(0,8);for(let c=0;c<g.length;c++){let f=g[c],x=c===n,A=x?`${Ps}>${X}`:" ",$=x?`${Ps}${f.name}${X}`:`${Tt}${f.name}${X}`,E=f.source?` ${ue}${f.source}${X}`:"",D=ql(f.installs),F=D?` ${Vl}${D}${X}`:"",C=o&&c===0?` ${ue}...${X}`:"";u.push(` ${A} ${$}${E}${F}${C}`);}}u.push(""),u.push(`${ue}up/down navigate | enter select | esc cancel${X}`);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 Ln(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(la),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 ca(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 ua(t,e){return await vt(t,e)===false}async function In(t){let{query:e,options:s,errors:n}=Jl(t),l=s.owner,o=!process.stdin.isTTY;An.debug("runFind enter",{args:t,query:e,owner:l,errors:n,isNonInteractive:o,stdinTTY:process.stdin.isTTY});let i=`${ue}Tip: if running in a coding agent, follow these steps:${X}
|
|
33
33
|
${ue} 1) easbot skills find [query] [--owner <owner>]${X}
|
|
34
|
-
${ue} 2) easbot skills add <owner/repo@skill>${X}`;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 An(e,l);if(he({event:"find",query:e,resultCount:String(m.length)}),m.length===0){let c=l?` from owner "${l}"`:"";console.log(`${ue}No skills found for "${e}"${c}${X}`);return}console.log(`${ue}Install with${X} easbot skills add <owner/repo@skill>`),console.log();for(let c of m.slice(0,6)){let f=c.source||c.slug,x=Vl(c.installs);console.log(`${Tt}${f}@${c.name}${X}${x?` ${Bl}${x}${X}`:""}`),console.log(`${ue}\u2514 https://skills.sh/${c.slug}${X}`),console.log();}return}if(o||await Xt()){console.log(i),console.log(),console.log(`${ue}Usage: easbot skills find <query> [--owner <owner>]${X}`);return}let a=await oa("",l);if(he({event:"find",query:"",resultCount:a?"1":"0",interactive:"1"}),!a){console.log(`${ue}Search cancelled${X}`),console.log();return}let r=a.source||a.slug,h=a.name;console.log(),console.log(`${Tt}Installing ${Ps}${h}${X} from ${ue}${r}${X}...`),console.log();let{source:u,options:g}=ts([r,"--skill",h]);await nt(u,g),console.log();let d=ra(r);d&&await aa(d.owner,d.repo)?console.log(`${ue}View the skill at${X} ${Tt}https://skills.sh/${a.slug}${X}`):console.log(`${ue}Discover more skills at${X} ${Tt}https://skills.sh${X}`),console.log();}var Le="\x1B[0m",In="\x1B[1m",Nt="\x1B[38;5;102m";var ua="\x1B[36m",Jl="\x1B[33m";function Ds(t,e){let s=os$1.homedir();return t.startsWith(s)?t.replace(s,"~"):t.startsWith(e)?"."+t.slice(e.length):t}function da(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 Xl(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 Pn(t){let e=Xl(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(`${Jl}Invalid agents: ${m.join(", ")}${Le}`),console.log(`${Nt}Valid agents: ${d.join(", ")}${Le}`),process.exit(1)),n=e.agent;}let l=await en({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 bn(),i=process.cwd(),a=s?"Global":"Project";if(l.length===0){if(e.json){console.log("[]");return}console.log(`${Nt}No ${a.toLowerCase()} skills found.${Le}`),console.log(s?`${Nt}Try listing project skills without -g${Le}`:`${Nt}Try listing global skills with -g${Le}`);return}function r(d,m=false,c=0,f=0){let x=m?" ":"",A=Ds(d.canonicalPath,i),$=d.agents.map(C=>T[C].displayName),E=d.agents.length>0?da($):`${Jl}not linked${Le}`,D=chunkEOOPF3RI_cjs.e(d.name).padEnd(c),F=A.padEnd(f);console.log(`${x}${ua}${D}${Le} ${Nt}${F}${Le} ${Nt}Agents:${Le} ${E}`);}console.log(`${In}${a} Skills${Le}`),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=Object.keys(h).sort();for(let m of d){let c=m.split("-").map(x=>x.charAt(0).toUpperCase()+x.slice(1)).join(" ");console.log(`${In}${c}${Le}`);let f=h[m];if(f){let x=0,A=0;for(let $ of f){let E=chunkEOOPF3RI_cjs.e($.name).length,D=Ds($.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(`${In}General${Le}`);let m=0,c=0;for(let f of u){let x=chunkEOOPF3RI_cjs.e(f.name).length,A=Ds(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=0,m=0;for(let c of l){let f=chunkEOOPF3RI_cjs.e(c.name).length,x=Ds(c.canonicalPath,i).length;f>d&&(d=f),x>m&&(m=x);}for(let c of l)r(c,false,d,m);console.log();}}async function ss(t,e){let s=await Xe();s.isAgent&&(e.yes=true,y__namespace.log.info(k__default.default.bgCyan(k__default.default.black(k__default.default.bold(` ${s.agent.name} `)))+" Agent detected \u2014 removing non-interactively"));let n=e.global??false,l=process.cwd(),o=y__namespace.spinner();o.start("Scanning for installed skills...");let i=new Set,a=async c=>{try{let f=await promises.readdir(c,{withFileTypes:!0});for(let x of f)x.isDirectory()&&i.add(x.name);}catch(f){f instanceof Error&&f.code!=="ENOENT"&&y__namespace.log.warn(`Could not scan directory ${c}: ${f.message}`);}};if(n){await a(Ee(true,l));for(let c of Object.values(T))c.globalSkillsDir!==void 0&&await a(c.globalSkillsDir);}else {await a(Ee(false,l));for(let c of Object.values(T))await a(path.join(l,c.skillsDir));for(let c of Qe(l))await a(at(c,l));}let r=Array.from(i).sort();if(o.stop(`Found ${r.length} unique installed skill(s)`),r.length===0){y__namespace.outro(k__default.default.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__namespace.log.error(`Invalid agents: ${f.join(", ")}`),y__namespace.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__namespace.log.error(`No matching skills found for: ${t.join(", ")}`);return}}else {let c=r.map(x=>({value:x,label:x})),f=await y__namespace.multiselect({message:`Select skills to remove ${k__default.default.dim("(space to toggle)")}`,options:c,required:true});y__namespace.isCancel(f)&&(y__namespace.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__namespace.log.info("Skills to remove:");for(let f of h)y__namespace.log.message(` ${k__default.default.red("\u2022")} ${f}`);console.log();let c=await y__namespace.confirm({message:`Are you sure you want to uninstall ${h.length} skill(s)?`});(y__namespace.isCancel(c)||!c)&&(y__namespace.cancel("Removal cancelled"),process.exit(0));}o.start("Removing skills...");let g=[];for(let c of h)try{let f=qe(c,{global:n,cwd:l});for(let C of u){let L=T[C],w=ks(c,C,{global:n,cwd:l}),N=new Set([w]),U=ge(c);if(n&&L.globalSkillsDir)N.add(path.join(L.globalSkillsDir,U));else if(N.add(path.join(l,L.skillsDir,U)),C==="eve")for(let M of Qe(l))N.add(path.join(at(M,l),U));for(let M of N)if(M!==f)try{await promises.lstat(M).catch(()=>null)&&await promises.rm(M,{recursive:!0,force:!0});}catch(B){y__namespace.log.warn(`Could not remove skill from ${L.displayName}: ${B instanceof Error?B.message:String(B)}`);}}let A=(await Ue()).filter(C=>!u.includes(C)),$=!1;for(let C of A){let L=ks(c,C,{global:n,cwd:l});if(await promises.lstat(L).catch(()=>null)){$=!0;break}}$||await promises.rm(f,{recursive:!0,force:!0});let E=n?await yn(c):null,D=E?.source||"local",F=E?.sourceType||"local";n&&await kn(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)he({event:"remove",source:f,skills:x.skills.join(","),agents:u.join(","),...n&&{global:"1"},sourceType:x.sourceType});}if(d.length>0&&y__namespace.log.success(k__default.default.green(`Successfully removed ${d.length} skill(s)`)),m.length>0){y__namespace.log.error(k__default.default.red(`Failed to remove ${m.length} skill(s)`));for(let c of m)y__namespace.log.message(` ${k__default.default.red("\u2717")} ${c.skill}: ${c.error}`);}console.log(),y__namespace.outro(k__default.default.green("Done!"));}function Dn(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 Et(t,e){return e?`${t}#${e}`:t}function ga(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 ma(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 fa(t,e,s){if(!ma(t))return Et(t,s);let n=ga(e),l=n?`${t}/${n}`:t;return s?`${l}#${s}`:l}function Ql(t){return t.skillPath?fa(t.source,t.skillPath,t.ref):Et(t.sourceUrl,t.ref)}var ri=path.dirname(url.fileURLToPath(chunkEOOPF3RI_cjs.b)),W="\x1B[0m",ei="\x1B[1m",Q="\x1B[38;5;102m",ie="\x1B[38;5;145m";function ai(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 ci(t){let e=t||process.cwd(),s=path.join(e,"skills-lock.json");if(fs$1.existsSync(s))return true;let n=path.join(e,".agents","skills");try{let l=fs$1.readdirSync(n,{withFileTypes:!0});for(let o of l)if(o.isDirectory()){let i=path.join(n,o.name,"SKILL.md");if(fs$1.existsSync(i))return !0}}catch{}return false}async function ui(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 ci()?"project":"global";let e=await y__namespace.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__namespace.isCancel(e)&&(y__namespace.cancel("Cancelled"),process.exit(0)),e}function Nn(t,e){if(!e||e.length===0)return true;let s=t.toLowerCase();return e.some(n=>n.toLowerCase()===s)}function ya(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 ba(t){let e=t.sourceUrl;if(t.sourceType==="well-known"){let s=e.indexOf("/.well-known/");s!==-1&&(e=e.slice(0,s));}return Et(e,t.ref)}function ti(t){if(t.length===0)return;console.log(),console.log(`${Q}${t.length} skill(s) cannot be checked automatically:${W}`);let e=new Map;for(let s of t){let n=ba(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(` ${ie}\u2022${W} ${chunkEOOPF3RI_cjs.e(l.name)} ${Q}(${l.reason})${W}`);}else {let l=n[0].reason,o=n.map(i=>chunkEOOPF3RI_cjs.e(i.name)).join(", ");console.log(` ${ie}\u2022${W} ${o} ${Q}(${l})${W}`);}console.log(` ${Q}To update: ${ie}easbot skills add ${s} -g -y${W}`);}}async function wa(t){let e=await Se(),s=[];for(let[n,l]of Object.entries(e.skills))Nn(n,t)&&(l.sourceType==="node_modules"||l.sourceType==="local"||s.push({name:n,source:l.source,entry:l}));return s}async function Tn(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(`${Q}Warning:${W} The following skills from ${Q}${t}${W} appear to have been deleted upstream:`);for(let r of i)console.log(` ${Q}\u2022${W} ${r}`);if(l.yes||!process.stdin.isTTY)console.log(`${Q}Skipping deletion in non-interactive mode.${W}`);else {let r=await y__namespace.confirm({message:"Would you like to remove the local copies of these deleted skills?"});if(r&&!y__namespace.isCancel(r))for(let h of i)console.log(`${Q}Removing${W} ${h}...`),await ss([h],{yes:true,global:n});}}return i}async function Sa(t={}){let e=await Ae(),s=Object.keys(e.skills),n=0,l=0;if(s.length===0)return t.skills||(console.log(`${Q}No global skills tracked in lock file.${W}`),console.log(`${Q}Install skills with${W} ${ie}easbot skills add <package> -g${W}`)),{successCount:n,failCount:l,checkedCount:0};let o=[],i=[],a=[];for(let u of s){if(!Nn(u,t.skills))continue;let g=e.skills[u];if(g){if(!g.skillFolderHash||!g.skillPath){i.push({name:u,reason:ya(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${Q}Checking skills from source: ${u}${W}\x1B[K
|
|
35
|
-
`);try{if(d.sourceType==="github"){let D=await chunkEOOPF3RI_cjs.i(u,d.ref,st);if(!D){console.log(` ${Q}\u2717 Failed to fetch tree for ${u}${W}`);continue}let F=chunkEOOPF3RI_cjs.k(D),C=Object.entries(e.skills).filter(([N,U])=>U.source===u).map(([N,U])=>N),L=await Tn(u,C,e.skills,!0,t,F),w=new Set(L);for(let{name:N,entry:U}of g){if(w.has(N))continue;let M=chunkEOOPF3RI_cjs.j(D,U.skillPath);M&&M!==U.skillFolderHash&&o.push({name:N,source:u,entry:U});}continue}c=await We(m,d.ref);let x=(await $e(c)).map(D=>path.join(path.relative(c,D.path),"SKILL.md").split(path.sep).join("/")),A=Object.entries(e.skills).filter(([D,F])=>F.source===u).map(([D,F])=>D),$=await Tn(u,A,e.skills,!0,t,x),E=new Set($);for(let{name:D,entry:F}of g){if(E.has(D))continue;let C=F.skillPath;if(!x.includes(C))continue;let L=await Fe(path.join(c,path.dirname(C)));L&&L!==F.skillFolderHash&&o.push({name:D,source:u,entry:F});}}catch{console.log(` ${Q}\u2717 Failed to check skills from ${u}${W}`);}finally{c&&await tt(c);}}a.length>0&&process.stdout.write("\r\x1B[K");let h=a.length+i.length;if(a.length===0&&i.length===0)return t.skills||console.log(`${Q}No global skills to check.${W}`),{successCount:n,failCount:l,checkedCount:0};if(a.length===0&&i.length>0)return ti(i),{successCount:n,failCount:l,checkedCount:h};if(o.length===0)return console.log(`${ie}\u2713 All global skills are up to date${W}`),{successCount:n,failCount:l,checkedCount:h};console.log(`${ie}Found ${o.length} global update(s)${W}`),console.log();for(let u of o){let g=chunkEOOPF3RI_cjs.e(u.name);console.log(`${ie}Updating ${g}...${W}`);let d=Ql(u.entry),m=path.join(ri,"..","bin","cli.mjs");if(!fs$1.existsSync(m)){l++,console.log(` ${Q}\u2717 Failed to update ${g}: CLI entrypoint not found at ${m}${W}`);continue}child_process.spawnSync(process.execPath,[m,"add",d,"-g","-y"],{stdio:["inherit","pipe","pipe"],encoding:"utf-8",shell:process.platform==="win32"}).status===0?(n++,console.log(` ${ie}\u2713${W} Updated ${g}`)):(l++,console.log(` ${Q}\u2717 Failed to update ${g}${W}`));}return ti(i),{successCount:n,failCount:l,checkedCount:h}}async function $a(t={}){let e=await wa(t.skills),s=0,n=0;if(e.length===0)return t.skills||(console.log(`${Q}No project skills to update.${W}`),console.log(`${Q}Install project skills with${W} ${ie}easbot skills add <package>${W}`)),{successCount:s,failCount:n,foundCount:0};let l=e.filter(m=>m.entry.skillPath),o=e.filter(m=>!m.entry.skillPath);if(l.length===0)return console.log(`${Q}No project skills can be updated in place.${W}`),si(o),{successCount:s,failCount:n,foundCount:e.length};let i=process.cwd(),a=[],r=false;for(let[m,c]of Object.entries(T))if(be(m))!r&&fs$1.existsSync(path.join(i,".agents"))&&(r=true);else {let f=c.skillsDir.split("/")[0];fs$1.existsSync(path.join(i,f))&&a.push(c.displayName);}let h=[];r&&h.push("Universal"),h.push(...a),h.length>0&&console.log(`${ie}Updating for: ${h.join(", ")}${W}`),console.log(`${ie}Refreshing ${l.length} skill(s)...${W}`),console.log();let u=new Map;for(let m of l){let c=m.entry.source,f=u.get(c)||[];f.push(m),u.set(c,f);}let g=await Se(),d=path.join(ri,"..","bin","cli.mjs");if(!fs$1.existsSync(d))return console.log(`${Q}\u2717 CLI entrypoint not found at ${d}${W}`),{successCount:s,failCount:l.length,foundCount:e.length};for(let[m,c]of u){let f=c[0].entry,x=f.source,A=f.ref,$=Object.entries(g.skills).filter(([C,L])=>L.source===m).map(([C,L])=>C),E=null,D=[];try{E=await We(x,A);let L=(await $e(E)).map(w=>{let N=path.relative(E,w.path);return path.join(N,"SKILL.md").split(path.sep).join("/")});D=await Tn(m,$,g.skills,!1,t,L);}catch{console.log(`${Q}\u2717 Failed to check for deleted skills from ${m}${W}`);}finally{E&&await tt(E);}let F=c.filter(C=>!D.includes(C.name));for(let C of F){let L=chunkEOOPF3RI_cjs.e(C.name);console.log(`${ie}Updating ${L}...${W}`);let w=Et(C.entry.source,C.entry.ref),N=C.entry.subagents,U=N&&N.length>0?["--subagent",...N.map(B=>B===""?"root":B)]:[];child_process.spawnSync(process.execPath,[d,"add",w,"--skill",C.name,...U,"-y"],{stdio:["inherit","pipe","pipe"],encoding:"utf-8",shell:process.platform==="win32"}).status===0?(s++,console.log(` ${ie}\u2713${W} Updated ${L}`)):(n++,console.log(` ${Q}\u2717 Failed to update ${L}${W}`));}}return si(o),{successCount:s,failCount:n,foundCount:e.length}}function si(t){if(t.length!==0){console.log(),console.log(`${Q}${t.length} project skill(s) cannot be updated automatically (installed before skillPath tracking):${W}`);for(let e of t){let s=Et(e.entry.source,e.entry.ref);console.log(` ${ie}\u2022${W} ${chunkEOOPF3RI_cjs.e(e.name)}`),console.log(` ${Q}To refresh: ${ie}easbot skills add ${s} -y${W}`);}}}async function En(t=[]){let e=ai(t),s=await ui(e);e.skills?console.log(`${ie}Updating ${e.skills.join(", ")}...${W}`):console.log(`${ie}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(`${ei}Global Skills${W}`);let{successCount:i,failCount:a,checkedCount:r}=await Sa(e);n+=i,l+=a,o+=r,s==="both"&&!e.skills&&console.log();}if(s==="project"||s==="both"){s==="both"&&!e.skills&&console.log(`${ei}Project Skills${W}`);let{successCount:i,failCount:a,foundCount:r}=await $a(e);n+=i,l+=a,o+=r;}e.skills&&o===0&&console.log(`${Q}No installed skills found matching: ${e.skills.join(", ")}${W}`),console.log(),n>0&&console.log(`${ie}\u2713 Updated ${n} skill(s)${W}`),l>0&&console.log(`${Q}Failed to update ${l} skill(s)${W}`),he({event:"update",scope:s,skillCount:String(n+l),successCount:String(n),failCount:String(l)}),console.log();}var pi=t=>typeof t=="symbol";function gi(t,e){let s=os$1.homedir();return t===s||t.startsWith(s+path.sep)?"~"+t.slice(s.length):t===e||t.startsWith(e+path.sep)?"."+t.slice(e.length):t}async function xa(t){let e=path.join(t,"node_modules"),s=[],n;try{n=await promises.readdir(e);}catch{return s}let l=async(o,i)=>{let a=await je(path.join(o,"SKILL.md"));if(a){s.push({...a,packageName:i});return}let r=[o,path.join(o,"skills"),path.join(o,".agents","skills")];for(let h of r)try{let u=await promises.readdir(h);for(let g of u){let d=path.join(h,g);try{if(!(await promises.stat(d)).isDirectory())continue}catch{continue}let m=await je(path.join(d,"SKILL.md"));m&&s.push({...m,packageName:i});}}catch{}};return await Promise.all(n.map(async o=>{if(o.startsWith("."))return;let i=path.join(e,o);try{if(!(await promises.stat(i)).isDirectory())return}catch{return}if(o.startsWith("@"))try{let a=await promises.readdir(i);await Promise.all(a.map(async r=>{let h=path.join(i,r);try{if(!(await promises.stat(h)).isDirectory())return}catch{return}await l(h,`${o}/${r}`);}));}catch{}else await l(i,o);})),s}async function ns(t,e={}){let s=process.cwd(),n=await Xe();if(n.isAgent&&(e.yes=true,!e.agent||e.agent.length===0)){let $=Yt(n.agent.name);if($){let E=[$];for(let D of Ve())E.includes(D)||E.push(D);e.agent=E;}}console.log(),n.isAgent||y__namespace.intro(k__default.default.bgCyan(k__default.default.black(" skills experimental_sync "))),n.isAgent&&y__namespace.log.info(k__default.default.bgCyan(k__default.default.black(k__default.default.bold(` ${n.agent.name} `)))+" Agent detected \u2014 installing non-interactively");let l=y__namespace.spinner();l.start("Scanning node_modules for skills...");let o=await xa(s);if(o.length===0){l.stop(k__default.default.yellow("No skills found")),y__namespace.outro(k__default.default.dim("No SKILL.md files found in node_modules."));return}l.stop(`Found ${k__default.default.green(String(o.length))} skill${o.length>1?"s":""} in node_modules`);for(let $ of o)y__namespace.log.info(`${k__default.default.cyan($.name)} ${k__default.default.dim(`from ${$.packageName}`)}`),$.description&&y__namespace.log.message(k__default.default.dim(` ${$.description}`));let i=await Se(s),a=[],r=[];if(e.force)a.push(...o),y__namespace.log.info(k__default.default.dim("Force mode: reinstalling all skills"));else {for(let $ of o){let E=i.skills[$.name];if(E&&await Fe($.path)===E.computedHash){r.push($.name);continue}a.push($);}if(r.length>0&&y__namespace.log.info(k__default.default.dim(`${r.length} skill${r.length!==1?"s":""} already up to date`)),a.length===0){console.log(),y__namespace.outro(k__default.default.green("All skills are up to date."));return}}y__namespace.log.info(`${a.length} skill${a.length!==1?"s":""} to install/update`);let h,u=Object.keys(T),g=Ve(),d=Kt();if(e.agent?.includes("*"))h=u,y__namespace.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__namespace.log.error(`Invalid agents: ${$.join(", ")}`),y__namespace.log.info(`Valid agents: ${u.join(", ")}`),process.exit(1)),h=e.agent;}else {l.start("Loading agents...");let $=await Ue(),E=Object.keys(T).length;if(l.stop(`${E} agents`),$.length===0)if(e.yes)h=g,y__namespace.log.info("Installing to universal agents");else {let F=yt().map(L=>({value:L,label:T[L].displayName,hint:T[L].skillsDir})),C=await At({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:g.length-d.length}});pi(C)&&(y__namespace.cancel("Sync cancelled"),process.exit(0)),h=C;}else if($.length===1||e.yes){h=[...$];for(let D of g)h.includes(D)||h.push(D);}else {let F=yt().filter(L=>$.includes(L)).map(L=>({value:L,label:T[L].displayName,hint:T[L].skillsDir})),C=await At({message:"Which agents do you want to install to?",items:F,initialSelected:$.filter(L=>!g.includes(L)),lockedSection:{title:"Universal (.agents/skills)",items:d.map(L=>({value:L,label:T[L].displayName})),hiddenCount:g.length-d.length}});pi(C)&&(y__namespace.cancel("Sync cancelled"),process.exit(0)),h=C;}}let m=[];for(let $ of a){let E=qe($.name,{global:false}),D=gi(E,s);m.push(`${k__default.default.cyan($.name)} ${k__default.default.dim(`\u2190 ${$.packageName}`)}`),m.push(` ${k__default.default.dim(D)}`);}if(console.log(),y__namespace.note(m.join(`
|
|
36
|
-
`),"Sync Summary"),!e.yes){let $=await y__namespace.confirm({message:"Proceed with sync?"});(y__namespace.isCancel($)||!$)&&(y__namespace.cancel("Sync cancelled"),process.exit(0));}l.start("Syncing skills...");let c=[];for(let $ of a)for(let E of h){let D=await Vt($,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 Fe($.path);await bt($.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__namespace.log.error(k__default.default.red(`Failed to install ${x.length}`));for(let $ of x)y__namespace.log.message(` ${k__default.default.red("\u2717")} ${$.skill} \u2192 ${$.agent}: ${k__default.default.dim($.error)}`);}he({event:"experimental_sync",skillCount:String(a.length),successCount:String(A.size),agents:h.join(",")}),console.log(),y__namespace.outro(k__default.default.green("Done!")+k__default.default.dim(" Review skills before use; they run with full agent permissions."));}function ls(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
|
+
${ue} 2) easbot skills add <owner/repo@skill>${X}`;if(n.length>0){for(let g of n)console.error(g);console.error("Usage: easbot skills find <query> [--owner <owner>]");return}if(e){An.debug("runFind enter query branch",{query:e,owner:l});let g=await Ln(e,l);if(An.debug("runFind searchSkillsAPI returned",{count:g.length}),he({event:"find",query:e,resultCount:String(g.length)}),g.length===0){let c=l?` from owner "${l}"`:"";console.log(`${ue}No skills found for "${e}"${c}${X}`);return}console.log(`${ue}Install with${X} easbot skills add <owner/repo@skill>`),console.log();for(let c of g.slice(0,6)){let f=c.source||c.slug,x=ql(c.installs);console.log(`${Tt}${f}@${c.name}${X}${x?` ${Vl}${x}${X}`:""}`),console.log(`${ue}\u2514 https://skills.sh/${c.slug}${X}`),console.log();}return}if(o||await Xt()){console.log(i),console.log(),console.log(`${ue}Usage: easbot skills find <query> [--owner <owner>]${X}`);return}let a=await aa("",l);if(he({event:"find",query:"",resultCount:a?"1":"0",interactive:"1"}),!a){console.log(`${ue}Search cancelled${X}`),console.log();return}let r=a.source||a.slug,h=a.name;console.log(),console.log(`${Tt}Installing ${Ps}${h}${X} from ${ue}${r}${X}...`),console.log();let{source:u,options:m}=ts([r,"--skill",h]);await nt(u,m),console.log();let d=ca(r);d&&await ua(d.owner,d.repo)?console.log(`${ue}View the skill at${X} ${Tt}https://skills.sh/${a.slug}${X}`):console.log(`${ue}Discover more skills at${X} ${Tt}https://skills.sh${X}`),console.log();}var Le="\x1B[0m",Pn="\x1B[1m",Nt="\x1B[38;5;102m";var pa="\x1B[36m",Xl="\x1B[33m";function Ds(t,e){let s=os$1.homedir();return t.startsWith(s)?t.replace(s,"~"):t.startsWith(e)?"."+t.slice(e.length):t}function ga(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),g=e.agent.filter(c=>!d.includes(c));g.length>0&&(console.log(`${Xl}Invalid agents: ${g.join(", ")}${Le}`),console.log(`${Nt}Valid agents: ${d.join(", ")}${Le}`),process.exit(1)),n=e.agent;}let l=await en({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 bn(),i=process.cwd(),a=s?"Global":"Project";if(l.length===0){if(e.json){console.log("[]");return}console.log(`${Nt}No ${a.toLowerCase()} skills found.${Le}`),console.log(s?`${Nt}Try listing project skills without -g${Le}`:`${Nt}Try listing global skills with -g${Le}`);return}function r(d,g=false,c=0,f=0){let x=g?" ":"",A=Ds(d.canonicalPath,i),$=d.agents.map(C=>T[C].displayName),E=d.agents.length>0?ga($):`${Xl}not linked${Le}`,D=chunkEOOPF3RI_cjs.e(d.name).padEnd(c),F=A.padEnd(f);console.log(`${x}${pa}${D}${Le} ${Nt}${F}${Le} ${Nt}Agents:${Le} ${E}`);}console.log(`${Pn}${a} Skills${Le}`),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=Object.keys(h).sort();for(let g of d){let c=g.split("-").map(x=>x.charAt(0).toUpperCase()+x.slice(1)).join(" ");console.log(`${Pn}${c}${Le}`);let f=h[g];if(f){let x=0,A=0;for(let $ of f){let E=chunkEOOPF3RI_cjs.e($.name).length,D=Ds($.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${Le}`);let g=0,c=0;for(let f of u){let x=chunkEOOPF3RI_cjs.e(f.name).length,A=Ds(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=0,g=0;for(let c of l){let f=chunkEOOPF3RI_cjs.e(c.name).length,x=Ds(c.canonicalPath,i).length;f>d&&(d=f),x>g&&(g=x);}for(let c of l)r(c,false,d,g);console.log();}}async function ss(t,e){let s=await Xe();s.isAgent&&(e.yes=true,y__namespace.log.info(k__default.default.bgCyan(k__default.default.black(k__default.default.bold(` ${s.agent.name} `)))+" Agent detected \u2014 removing non-interactively"));let n=e.global??false,l=process.cwd(),o=y__namespace.spinner();o.start("Scanning for installed skills...");let i=new Set,a=async c=>{try{let f=await promises.readdir(c,{withFileTypes:!0});for(let x of f)x.isDirectory()&&i.add(x.name);}catch(f){f instanceof Error&&f.code!=="ENOENT"&&y__namespace.log.warn(`Could not scan directory ${c}: ${f.message}`);}};if(n){await a(Ee(true,l));for(let c of Object.values(T))c.globalSkillsDir!==void 0&&await a(c.globalSkillsDir);}else {await a(Ee(false,l));for(let c of Object.values(T))await a(path.join(l,c.skillsDir));for(let c of Qe(l))await a(at(c,l));}let r=Array.from(i).sort();if(o.stop(`Found ${r.length} unique installed skill(s)`),r.length===0){y__namespace.outro(k__default.default.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__namespace.log.error(`Invalid agents: ${f.join(", ")}`),y__namespace.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__namespace.log.error(`No matching skills found for: ${t.join(", ")}`);return}}else {let c=r.map(x=>({value:x,label:x})),f=await y__namespace.multiselect({message:`Select skills to remove ${k__default.default.dim("(space to toggle)")}`,options:c,required:true});y__namespace.isCancel(f)&&(y__namespace.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__namespace.log.info("Skills to remove:");for(let f of h)y__namespace.log.message(` ${k__default.default.red("\u2022")} ${f}`);console.log();let c=await y__namespace.confirm({message:`Are you sure you want to uninstall ${h.length} skill(s)?`});(y__namespace.isCancel(c)||!c)&&(y__namespace.cancel("Removal cancelled"),process.exit(0));}o.start("Removing skills...");let m=[];for(let c of h)try{let f=qe(c,{global:n,cwd:l});for(let C of u){let L=T[C],w=ks(c,C,{global:n,cwd:l}),N=new Set([w]),U=ge(c);if(n&&L.globalSkillsDir)N.add(path.join(L.globalSkillsDir,U));else if(N.add(path.join(l,L.skillsDir,U)),C==="eve")for(let M of Qe(l))N.add(path.join(at(M,l),U));for(let M of N)if(M!==f)try{await promises.lstat(M).catch(()=>null)&&await promises.rm(M,{recursive:!0,force:!0});}catch(B){y__namespace.log.warn(`Could not remove skill from ${L.displayName}: ${B instanceof Error?B.message:String(B)}`);}}let A=(await Ue()).filter(C=>!u.includes(C)),$=!1;for(let C of A){let L=ks(c,C,{global:n,cwd:l});if(await promises.lstat(L).catch(()=>null)){$=!0;break}}$||await promises.rm(f,{recursive:!0,force:!0});let E=n?await yn(c):null,D=E?.source||"local",F=E?.sourceType||"local";n&&await kn(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)he({event:"remove",source:f,skills:x.skills.join(","),agents:u.join(","),...n&&{global:"1"},sourceType:x.sourceType});}if(d.length>0&&y__namespace.log.success(k__default.default.green(`Successfully removed ${d.length} skill(s)`)),g.length>0){y__namespace.log.error(k__default.default.red(`Failed to remove ${g.length} skill(s)`));for(let c of g)y__namespace.log.message(` ${k__default.default.red("\u2717")} ${c.skill}: ${c.error}`);}console.log(),y__namespace.outro(k__default.default.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 Et(t,e){return e?`${t}#${e}`:t}function fa(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 ha(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 ka(t,e,s){if(!ha(t))return Et(t,s);let n=fa(e),l=n?`${t}/${n}`:t;return s?`${l}#${s}`:l}function ei(t){return t.skillPath?ka(t.source,t.skillPath,t.ref):Et(t.sourceUrl,t.ref)}var ai=path.dirname(url.fileURLToPath(chunkEOOPF3RI_cjs.b)),W="\x1B[0m",ti="\x1B[1m",Q="\x1B[38;5;102m",ie="\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=path.join(e,"skills-lock.json");if(fs$1.existsSync(s))return true;let n=path.join(e,".agents","skills");try{let l=fs$1.readdirSync(n,{withFileTypes:!0});for(let o of l)if(o.isDirectory()){let i=path.join(n,o.name,"SKILL.md");if(fs$1.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__namespace.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__namespace.isCancel(e)&&(y__namespace.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 wa(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 Sa(t){let e=t.sourceUrl;if(t.sourceType==="well-known"){let s=e.indexOf("/.well-known/");s!==-1&&(e=e.slice(0,s));}return Et(e,t.ref)}function si(t){if(t.length===0)return;console.log(),console.log(`${Q}${t.length} skill(s) cannot be checked automatically:${W}`);let e=new Map;for(let s of t){let n=Sa(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(` ${ie}\u2022${W} ${chunkEOOPF3RI_cjs.e(l.name)} ${Q}(${l.reason})${W}`);}else {let l=n[0].reason,o=n.map(i=>chunkEOOPF3RI_cjs.e(i.name)).join(", ");console.log(` ${ie}\u2022${W} ${o} ${Q}(${l})${W}`);}console.log(` ${Q}To update: ${ie}easbot skills add ${s} -g -y${W}`);}}async function $a(t){let e=await Se(),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(`${Q}Warning:${W} The following skills from ${Q}${t}${W} appear to have been deleted upstream:`);for(let r of i)console.log(` ${Q}\u2022${W} ${r}`);if(l.yes||!process.stdin.isTTY)console.log(`${Q}Skipping deletion in non-interactive mode.${W}`);else {let r=await y__namespace.confirm({message:"Would you like to remove the local copies of these deleted skills?"});if(r&&!y__namespace.isCancel(r))for(let h of i)console.log(`${Q}Removing${W} ${h}...`),await ss([h],{yes:true,global:n});}}return i}async function va(t={}){let e=await Ae(),s=Object.keys(e.skills),n=0,l=0;if(s.length===0)return t.skills||(console.log(`${Q}No global skills tracked in lock file.${W}`),console.log(`${Q}Install skills with${W} ${ie}easbot skills add <package> -g${W}`)),{successCount:n,failCount:l,checkedCount:0};let o=[],i=[],a=[];for(let u of s){if(!En(u,t.skills))continue;let m=e.skills[u];if(m){if(!m.skillFolderHash||!m.skillPath){i.push({name:u,reason:wa(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${Q}Checking skills from source: ${u}${W}\x1B[K
|
|
35
|
+
`);try{if(d.sourceType==="github"){let D=await chunkEOOPF3RI_cjs.i(u,d.ref,st);if(!D){console.log(` ${Q}\u2717 Failed to fetch tree for ${u}${W}`);continue}let F=chunkEOOPF3RI_cjs.k(D),C=Object.entries(e.skills).filter(([N,U])=>U.source===u).map(([N,U])=>N),L=await Nn(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=chunkEOOPF3RI_cjs.j(D,U.skillPath);M&&M!==U.skillFolderHash&&o.push({name:N,source:u,entry:U});}continue}c=await We(g,d.ref);let x=(await $e(c)).map(D=>path.join(path.relative(c,D.path),"SKILL.md").split(path.sep).join("/")),A=Object.entries(e.skills).filter(([D,F])=>F.source===u).map(([D,F])=>D),$=await Nn(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 Fe(path.join(c,path.dirname(C)));L&&L!==F.skillFolderHash&&o.push({name:D,source:u,entry:F});}}catch{console.log(` ${Q}\u2717 Failed to check skills from ${u}${W}`);}finally{c&&await tt(c);}}a.length>0&&process.stdout.write("\r\x1B[K");let h=a.length+i.length;if(a.length===0&&i.length===0)return t.skills||console.log(`${Q}No global skills to check.${W}`),{successCount:n,failCount:l,checkedCount:0};if(a.length===0&&i.length>0)return si(i),{successCount:n,failCount:l,checkedCount:h};if(o.length===0)return console.log(`${ie}\u2713 All global skills are up to date${W}`),{successCount:n,failCount:l,checkedCount:h};console.log(`${ie}Found ${o.length} global update(s)${W}`),console.log();for(let u of o){let m=chunkEOOPF3RI_cjs.e(u.name);console.log(`${ie}Updating ${m}...${W}`);let d=ei(u.entry),g=path.join(ai,"..","bin","cli.mjs");if(!fs$1.existsSync(g)){l++,console.log(` ${Q}\u2717 Failed to update ${m}: CLI entrypoint not found at ${g}${W}`);continue}child_process.spawnSync(process.execPath,[g,"add",d,"-g","-y"],{stdio:["inherit","pipe","pipe"],encoding:"utf-8",shell:process.platform==="win32"}).status===0?(n++,console.log(` ${ie}\u2713${W} Updated ${m}`)):(l++,console.log(` ${Q}\u2717 Failed to update ${m}${W}`));}return si(i),{successCount:n,failCount:l,checkedCount:h}}async function xa(t={}){let e=await $a(t.skills),s=0,n=0;if(e.length===0)return t.skills||(console.log(`${Q}No project skills to update.${W}`),console.log(`${Q}Install project skills with${W} ${ie}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(`${Q}No project skills can be updated in place.${W}`),ni(o),{successCount:s,failCount:n,foundCount:e.length};let i=process.cwd(),a=[],r=false;for(let[g,c]of Object.entries(T))if(be(g))!r&&fs$1.existsSync(path.join(i,".agents"))&&(r=true);else {let f=c.skillsDir.split("/")[0];fs$1.existsSync(path.join(i,f))&&a.push(c.displayName);}let h=[];r&&h.push("Universal"),h.push(...a),h.length>0&&console.log(`${ie}Updating for: ${h.join(", ")}${W}`),console.log(`${ie}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 Se(),d=path.join(ai,"..","bin","cli.mjs");if(!fs$1.existsSync(d))return console.log(`${Q}\u2717 CLI entrypoint not found at ${d}${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 We(x,A);let L=(await $e(E)).map(w=>{let N=path.relative(E,w.path);return path.join(N,"SKILL.md").split(path.sep).join("/")});D=await Nn(g,$,m.skills,!1,t,L);}catch{console.log(`${Q}\u2717 Failed to check for deleted skills from ${g}${W}`);}finally{E&&await tt(E);}let F=c.filter(C=>!D.includes(C.name));for(let C of F){let L=chunkEOOPF3RI_cjs.e(C.name);console.log(`${ie}Updating ${L}...${W}`);let w=Et(C.entry.source,C.entry.ref),N=C.entry.subagents,U=N&&N.length>0?["--subagent",...N.map(B=>B===""?"root":B)]:[];child_process.spawnSync(process.execPath,[d,"add",w,"--skill",C.name,...U,"-y"],{stdio:["inherit","pipe","pipe"],encoding:"utf-8",shell:process.platform==="win32"}).status===0?(s++,console.log(` ${ie}\u2713${W} Updated ${L}`)):(n++,console.log(` ${Q}\u2717 Failed to update ${L}${W}`));}}return ni(o),{successCount:s,failCount:n,foundCount:e.length}}function ni(t){if(t.length!==0){console.log(),console.log(`${Q}${t.length} project skill(s) cannot be updated automatically (installed before skillPath tracking):${W}`);for(let e of t){let s=Et(e.entry.source,e.entry.ref);console.log(` ${ie}\u2022${W} ${chunkEOOPF3RI_cjs.e(e.name)}`),console.log(` ${Q}To refresh: ${ie}easbot skills add ${s} -y${W}`);}}}async function Cn(t=[]){let e=ci(t),s=await di(e);e.skills?console.log(`${ie}Updating ${e.skills.join(", ")}...${W}`):console.log(`${ie}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(`${ti}Global Skills${W}`);let{successCount:i,failCount:a,checkedCount:r}=await va(e);n+=i,l+=a,o+=r,s==="both"&&!e.skills&&console.log();}if(s==="project"||s==="both"){s==="both"&&!e.skills&&console.log(`${ti}Project Skills${W}`);let{successCount:i,failCount:a,foundCount:r}=await xa(e);n+=i,l+=a,o+=r;}e.skills&&o===0&&console.log(`${Q}No installed skills found matching: ${e.skills.join(", ")}${W}`),console.log(),n>0&&console.log(`${ie}\u2713 Updated ${n} skill(s)${W}`),l>0&&console.log(`${Q}Failed to update ${l} skill(s)${W}`),he({event:"update",scope:s,skillCount:String(n+l),successCount:String(n),failCount:String(l)}),console.log();}var gi=t=>typeof t=="symbol";function mi(t,e){let s=os$1.homedir();return t===s||t.startsWith(s+path.sep)?"~"+t.slice(s.length):t===e||t.startsWith(e+path.sep)?"."+t.slice(e.length):t}async function La(t){let e=path.join(t,"node_modules"),s=[],n;try{n=await promises.readdir(e);}catch{return s}let l=async(o,i)=>{let a=await je(path.join(o,"SKILL.md"));if(a){s.push({...a,packageName:i});return}let r=[o,path.join(o,"skills"),path.join(o,".agents","skills")];for(let h of r)try{let u=await promises.readdir(h);for(let m of u){let d=path.join(h,m);try{if(!(await promises.stat(d)).isDirectory())continue}catch{continue}let g=await je(path.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=path.join(e,o);try{if(!(await promises.stat(i)).isDirectory())return}catch{return}if(o.startsWith("@"))try{let a=await promises.readdir(i);await Promise.all(a.map(async r=>{let h=path.join(i,r);try{if(!(await promises.stat(h)).isDirectory())return}catch{return}await l(h,`${o}/${r}`);}));}catch{}else await l(i,o);})),s}async function ns(t,e={}){let s=process.cwd(),n=await Xe();if(n.isAgent&&(e.yes=true,!e.agent||e.agent.length===0)){let $=Yt(n.agent.name);if($){let E=[$];for(let D of Ve())E.includes(D)||E.push(D);e.agent=E;}}console.log(),n.isAgent||y__namespace.intro(k__default.default.bgCyan(k__default.default.black(" skills experimental_sync "))),n.isAgent&&y__namespace.log.info(k__default.default.bgCyan(k__default.default.black(k__default.default.bold(` ${n.agent.name} `)))+" Agent detected \u2014 installing non-interactively");let l=y__namespace.spinner();l.start("Scanning node_modules for skills...");let o=await La(s);if(o.length===0){l.stop(k__default.default.yellow("No skills found")),y__namespace.outro(k__default.default.dim("No SKILL.md files found in node_modules."));return}l.stop(`Found ${k__default.default.green(String(o.length))} skill${o.length>1?"s":""} in node_modules`);for(let $ of o)y__namespace.log.info(`${k__default.default.cyan($.name)} ${k__default.default.dim(`from ${$.packageName}`)}`),$.description&&y__namespace.log.message(k__default.default.dim(` ${$.description}`));let i=await Se(s),a=[],r=[];if(e.force)a.push(...o),y__namespace.log.info(k__default.default.dim("Force mode: reinstalling all skills"));else {for(let $ of o){let E=i.skills[$.name];if(E&&await Fe($.path)===E.computedHash){r.push($.name);continue}a.push($);}if(r.length>0&&y__namespace.log.info(k__default.default.dim(`${r.length} skill${r.length!==1?"s":""} already up to date`)),a.length===0){console.log(),y__namespace.outro(k__default.default.green("All skills are up to date."));return}}y__namespace.log.info(`${a.length} skill${a.length!==1?"s":""} to install/update`);let h,u=Object.keys(T),m=Ve(),d=Kt();if(e.agent?.includes("*"))h=u,y__namespace.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__namespace.log.error(`Invalid agents: ${$.join(", ")}`),y__namespace.log.info(`Valid agents: ${u.join(", ")}`),process.exit(1)),h=e.agent;}else {l.start("Loading agents...");let $=await Ue(),E=Object.keys(T).length;if(l.stop(`${E} agents`),$.length===0)if(e.yes)h=m,y__namespace.log.info("Installing to universal agents");else {let F=yt().map(L=>({value:L,label:T[L].displayName,hint:T[L].skillsDir})),C=await At({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}});gi(C)&&(y__namespace.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=yt().filter(L=>$.includes(L)).map(L=>({value:L,label:T[L].displayName,hint:T[L].skillsDir})),C=await At({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}});gi(C)&&(y__namespace.cancel("Sync cancelled"),process.exit(0)),h=C;}}let g=[];for(let $ of a){let E=qe($.name,{global:false}),D=mi(E,s);g.push(`${k__default.default.cyan($.name)} ${k__default.default.dim(`\u2190 ${$.packageName}`)}`),g.push(` ${k__default.default.dim(D)}`);}if(console.log(),y__namespace.note(g.join(`
|
|
36
|
+
`),"Sync Summary"),!e.yes){let $=await y__namespace.confirm({message:"Proceed with sync?"});(y__namespace.isCancel($)||!$)&&(y__namespace.cancel("Sync cancelled"),process.exit(0));}l.start("Syncing skills...");let c=[];for(let $ of a)for(let E of h){let D=await Vt($,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 Fe($.path);await bt($.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=mi(w.canonicalPath,s);E.push(`${k__default.default.green("\u2713")} ${C} ${k__default.default.dim(`\u2190 ${N}`)}`),E.push(` ${k__default.default.dim(U)}`);}else E.push(`${k__default.default.green("\u2713")} ${C} ${k__default.default.dim(`\u2190 ${N}`)}`);}let D=$.size,F=k__default.default.green(`Synced ${D} skill${D!==1?"s":""}`);y__namespace.note(E.join(`
|
|
37
|
+
`),F);}if(x.length>0){console.log(),y__namespace.log.error(k__default.default.red(`Failed to install ${x.length}`));for(let $ of x)y__namespace.log.message(` ${k__default.default.red("\u2717")} ${$.skill} \u2192 ${$.agent}: ${k__default.default.dim($.error)}`);}he({event:"experimental_sync",skillCount:String(a.length),successCount:String(A.size),agents:h.join(",")}),console.log(),y__namespace.outro(k__default.default.green("Done!")+k__default.default.dim(" Review skills before use; they run with full agent permissions."));}function ls(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 Un(t){let e=process.cwd(),s=await Se(e),n=Object.entries(s.skills);if(n.length===0){y__namespace.log.warn("No project skills found in skills-lock.json"),y__namespace.log.info(`Add project-level skills with ${k__default.default.cyan("easbot skills add <package>")} (without ${k__default.default.cyan("-g")})`);return}let l=Ve(),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__namespace.log.info(`Restoring ${k__default.default.cyan(String(a))} skill${a!==1?"s":""} from skills-lock.json into ${k__default.default.dim(".agents/skills/")}`);for(let[r,{skills:h}]of i)try{await nt([r],{skill:h,agent:l,yes:!0});}catch(u){y__namespace.log.error(`Failed to install from ${k__default.default.cyan(r)}: ${u instanceof Error?u.message:"Unknown error"}`);}if(o.length>0){y__namespace.log.info(`${k__default.default.cyan(String(o.length))} skill${o.length!==1?"s":""} from node_modules`);try{let{options:r}=ls(t);await ns(t,{...r,yes:!0,agent:l});}catch(r){y__namespace.log.error(`Failed to sync node_modules skills: ${r instanceof Error?r.message:"Unknown error"}`);}}}var _a=["vercel","houjallen","heygen-com"],Ua=new Set(["metadata.json"]),Oa=new Set([".git","__pycache__","__pypackages__"]),Fn={"claude-code":{command:"claude",args:[]},codex:{command:"codex",args:[]}},$i=Object.keys(Fn);function jn(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(...Ka(s.agent)),{source:e,options:s,errors:n}}function vi(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 xi(t){let e=await promises.mkdtemp(path.join(os$1.tmpdir(),"skills-use-")),s=path.join(e,ge(t.directoryName||t.name));if(!Wn(e,s))throw new Error("Invalid skill name: potential path traversal detected");await promises.mkdir(s,{recursive:true}),t.kind==="blob"?await Ha(s,t.files):t.kind==="well-known"?await za(s,t.files):await Ti(t.path,s);let n=t.rawContent??await promises.readFile(path.join(s,"SKILL.md"),"utf-8"),l=await Ni(s,s);return {tempRoot:e,skillDir:s,skillMd:n,hasSupportingFiles:l}}async function Mn(t,e={},s=[]){let n=null;try{if(e.help){console.log(yi());return}s.length>0&&Ze(s.join(`
|
|
46
46
|
`)),t.length===0&&Ze(`Missing required argument: source
|
|
47
47
|
|
|
48
|
-
${
|
|
49
|
-
`));let h=
|
|
48
|
+
${yi()}`),t.length>1&&Ze(`Expected one source, received ${t.length}: ${t.join(", ")}`);let l=e.agent?.[0];l&&!Fn[l]&&Ze(Pi(l));let o=t[0],i=ct(o);Je(i)?.split("/")[0]?.toLowerCase()==="openclaw"&&!e.dangerouslyAcceptOpenclawRisks&&Ze(["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=ja(i.skillFilter,e.skill),u=h!==void 0,m;if(i.type==="well-known"){let c=await ut.fetchAllSkills(i.url);m=Wa(c,h,o);}else {let c,f=null;if(i.type==="local")fs$1.existsSync(i.localPath)||Ze(`Local path does not exist: ${i.localPath}`),c=await $e(i.localPath,i.subpath,{includeInternal:u,fullDepth:e.fullDepth});else if(i.type==="github"&&!e.fullDepth){let A=Je(i),$=A?.split("/")[0]?.toLowerCase();A&&$&&_a.includes($)&&(f=await chunkEOOPF3RI_cjs.l(A,{subpath:i.subpath,skillFilter:h,ref:i.ref,getToken:st,includeInternal:u})),f?c=f.skills:(n=await We(i.url,i.ref),c=await $e(n,i.subpath,{includeInternal:u,fullDepth:e.fullDepth}));}else n=await We(i.url,i.ref),c=await $e(n,i.subpath,{includeInternal:u,fullDepth:e.fullDepth});let x=Ma(c,h,o);f&&Ga(x)?m={kind:"blob",name:x.name,directoryName:x.name,rawContent:x.rawContent??Ba(x.files),files:x.files}:m={kind:"disk",name:x.name,directoryName:x.name,rawContent:x.rawContent,path:x.path};}let d=await xi(m);await bi(n),n=null;let g=vi({skillMd:d.skillMd,supportDir:d.skillDir,hasSupportingFiles:d.hasSupportingFiles});if(l){let c=await Ai(l,g);c!==0&&process.exit(c);return}process.stdout.write(g);}catch(l){await bi(n),l instanceof Me&&Ze(l.message),l instanceof ye&&Ze(l.message),Ze(l instanceof Error?l.message:"Unknown error");}}async function Ai(t,e,s=Fa){let n=Fn[t];if(!n)throw new ye(Pi(t));return new Promise((l,o)=>{let i=s(n.command,[...n.args,e],{stdio:"inherit"}),a=false;i.on("error",r=>{if(!a){if(a=true,r.code==="ENOENT"){o(new ye(`Could not launch ${T[t].displayName}: command not found: ${n.command}`));return}o(r);}}),i.on("close",r=>{a||(a=true,l(r??1));});})}function Fa(t,e){return child_process.spawn(t,e,{stdio:"inherit"})}function yi(){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 (${$i.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 ja(t,e){if(t&&e){if(t.toLowerCase()!==e.toLowerCase())throw new ye(`Conflicting skill selectors: source selects "${t}" but --skill selects "${e}". Provide one selector.`);return e}return e??t}function Ma(t,e,s){if(t.length===0)throw new ye("No valid skills found. Skills require a SKILL.md with name and description.");if(!e){if(t.length===1)return t[0];throw new ye(Li(s,t.map(ne)))}let n=zt(t,[e]);if(n.length===0)throw new ye(Ii(e,t.map(ne)));if(n.length>1)throw new ye(`Skill selector "${e}" matched multiple skills.`);return n[0]}function Wa(t,e,s){if(t.length===0)throw new ye("No skills found at this URL. Make sure the server has a /.well-known/agent-skills/index.json or /.well-known/skills/index.json file.");let n;if(e){if(n=t.filter(o=>o.installName.toLowerCase()===e.toLowerCase()||o.name.toLowerCase()===e.toLowerCase()),n.length===0)throw new ye(Ii(e,t.map(o=>o.installName)));if(n.length>1)throw new ye(`Skill selector "${e}" matched multiple skills.`)}else {if(t.length!==1)throw new ye(Li(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 Li(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 Wa(t,e){for(let s of e)await Pi(t,s.path,s.contents);}async function Ka(t,e){for(let[s,n]of e)await Pi(t,s,n);}async function Pi(t,e,s){let n=path.join(t,e);Mn(t,n)&&(await promises.mkdir(path.dirname(n),{recursive:true}),typeof s=="string"?await promises.writeFile(n,s,"utf-8"):await promises.writeFile(n,s));}async function Di(t,e){await promises.mkdir(e,{recursive:true});let s=await promises.readdir(t,{withFileTypes:true});await Promise.all(s.filter(n=>!Ga(n.name,n.isDirectory())).map(async n=>{let l=path.join(t,n.name),o=path.join(e,n.name);if(Mn(e,o)){if(n.isDirectory()){await Di(l,o);return}try{await promises.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 Ti(t,e){let s=await promises.readdir(e,{withFileTypes:true});for(let n of s){let l=path.join(e,n.name),o=path.relative(t,l).split(path.sep).join("/");if(n.isDirectory()){if(await Ti(t,l))return true}else if(o.toLowerCase()!=="skill.md")return true}return false}function Ha(t){return Array.isArray(t.files)}function za(t){return t.find(s=>s.path.toLowerCase()==="skill.md")?.contents??""}function Ga(t,e){return Ra.has(t)||e&&_a.has(t)}function Mn(t,e){let s=path.normalize(path.resolve(t)),n=path.normalize(path.resolve(e));return n.startsWith(s+path.sep)||n===s}async function yi(t){t&&await tt(t).catch(()=>{});}function Ze(t){console.error(t),process.exit(1);}var ye=class extends Error{};var Ni={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 Va=Ni.languages,qa=Va.filter(t=>t.supported).map(t=>t.value),mt={defaultLocale:"zh-CN",locales:qa},is={},Ns=(t,e)=>{let s=is[t]||{translation:{}};return is[t]={translation:{...s.translation,...e.translation}},is[t]},Es=(t=mt.defaultLocale)=>(is[t]||Ns(t,{translation:{}}),{locale:t,resources:is[t]||{translation:{}}});var Ja={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"}},Ei=Ja;var Xa={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"}},Ci=Xa;var Ya=()=>{Es("zh-CN"),Es("en-US"),Ns("zh-CN",Ei),Ns("en-US",Ci);};Ya();var Wn=new Map;var Kn=new Map;var Za=t=>{if(Kn.has(t))return Kn.get(t);let e=/{{\s*(\w+)\s*}}/g,s=[],n;for(;(n=e.exec(t))!==null;){let i=n[1];i&&!s.includes(i)&&s.push(i);}let l=new RegExp("{{\\s*("+s.join("|")+")\\s*}}","g"),o={keys:s,regex:l};return Kn.set(t,o),o},Ri=(t,e)=>{if(!t||typeof t!="string")return "";if(!e||Object.keys(e).length===0)return t;let{regex:s,keys:n}=Za(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)})},Qa=t=>t&&mt.locales.includes(t)?t:mt.defaultLocale,_i=t=>{if(!Wn.has(t)){let{resources:e}=Es(t);Wn.set(t,e);}return Wn.get(t)},ec=(t,e={})=>{let s=Qa(e.locale),l=_i(s)?.translation[t];if(l&&typeof l=="string"){let o=Ri(l,e.vars);return o!=null?String(o):String(t)}if(s!==mt.defaultLocale){let i=_i(mt.defaultLocale)?.translation[t];if(i&&typeof i=="string"){let a=Ri(i,e.vars);return a!=null?String(a):String(t)}}return String(e.fallback??t)},j=ec;var v="\x1B[0m",oe="\x1B[1m",I="\x1B[38;5;102m",Ie="\x1B[38;5;145m";function ic(t){return t&&vn(t),t??"0.0.0"}function rs(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 Oi(t){let e=rs(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} ${Ie}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} ${Ie}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} ${Ie}easbot skills remove${v} ${I}${j("cli.example.remove_interactive",{locale:e,fallback:"Remove installed skills"})}${v}`),console.log(` ${I}$${v} ${Ie}easbot skills list${v} ${I}${j("cli.example.list_project",{locale:e,fallback:"List installed skills"})}${v}`),console.log(` ${I}$${v} ${Ie}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} ${Ie}easbot skills update${v} ${I}${j("cli.example.update_global",{locale:e,fallback:"Update installed skills"})}${v}`),console.log(),console.log(` ${I}$${v} ${Ie}easbot skills experimental_install${v} ${I}${j("cli.example.install",{locale:e,fallback:"Restore from skills-lock.json"})}${v}`),console.log(` ${I}$${v} ${Ie}easbot skills init ${I}[name]${v} ${I}${j("cli.example.init",{locale:e,fallback:"Create a new skill"})}${v}`),console.log(` ${I}$${v} ${Ie}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 oc(t){let e=rs(t),s=(n,l)=>I+j(n,{locale:e,fallback:l})+v;console.log(`
|
|
67
|
+
`)}function Ii(t,e){return [`No matching skill found for: ${t}`,"Available skills:",...e.map(s=>` - ${s}`)].join(`
|
|
68
|
+
`)}function Ka(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 Pi(t){return [`Running ${T[t].displayName} is not supported yet.`,`Supported agents for skills use --agent: ${$i.join(", ")}`].join(`
|
|
70
|
+
`)}async function Ha(t,e){for(let s of e)await Di(t,s.path,s.contents);}async function za(t,e){for(let[s,n]of e)await Di(t,s,n);}async function Di(t,e,s){let n=path.join(t,e);Wn(t,n)&&(await promises.mkdir(path.dirname(n),{recursive:true}),typeof s=="string"?await promises.writeFile(n,s,"utf-8"):await promises.writeFile(n,s));}async function Ti(t,e){await promises.mkdir(e,{recursive:true});let s=await promises.readdir(t,{withFileTypes:true});await Promise.all(s.filter(n=>!Va(n.name,n.isDirectory())).map(async n=>{let l=path.join(t,n.name),o=path.join(e,n.name);if(Wn(e,o)){if(n.isDirectory()){await Ti(l,o);return}try{await promises.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 promises.readdir(e,{withFileTypes:true});for(let n of s){let l=path.join(e,n.name),o=path.relative(t,l).split(path.sep).join("/");if(n.isDirectory()){if(await Ni(t,l))return true}else if(o.toLowerCase()!=="skill.md")return true}return false}function Ga(t){return Array.isArray(t.files)}function Ba(t){return t.find(s=>s.path.toLowerCase()==="skill.md")?.contents??""}function Va(t,e){return Ua.has(t)||e&&Oa.has(t)}function Wn(t,e){let s=path.normalize(path.resolve(t)),n=path.normalize(path.resolve(e));return n.startsWith(s+path.sep)||n===s}async function bi(t){t&&await tt(t).catch(()=>{});}function Ze(t){console.error(t),process.exit(1);}var ye=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 Ja=Ei.languages,Xa=Ja.filter(t=>t.supported).map(t=>t.value),mt={defaultLocale:"zh-CN",locales:Xa},is={},Ns=(t,e)=>{let s=is[t]||{translation:{}};return is[t]={translation:{...s.translation,...e.translation}},is[t]},Es=(t=mt.defaultLocale)=>(is[t]||Ns(t,{translation:{}}),{locale:t,resources:is[t]||{translation:{}}});var Ya={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=Ya;var Za={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=Za;var Qa=()=>{Es("zh-CN"),Es("en-US"),Ns("zh-CN",Ci),Ns("en-US",Ri);};Qa();var Kn=new Map;var Hn=new Map;var ec=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}=ec(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)})},tc=t=>t&&mt.locales.includes(t)?t:mt.defaultLocale,Ui=t=>{if(!Kn.has(t)){let{resources:e}=Es(t);Kn.set(t,e);}return Kn.get(t)},sc=(t,e={})=>{let s=tc(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!==mt.defaultLocale){let i=Ui(mt.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=sc;var v="\x1B[0m",oe="\x1B[1m",I="\x1B[38;5;102m",Ie="\x1B[38;5;145m";function rc(t){return t&&vn(t),t??"0.0.0"}function rs(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=rs(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} ${Ie}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} ${Ie}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} ${Ie}easbot skills remove${v} ${I}${j("cli.example.remove_interactive",{locale:e,fallback:"Remove installed skills"})}${v}`),console.log(` ${I}$${v} ${Ie}easbot skills list${v} ${I}${j("cli.example.list_project",{locale:e,fallback:"List installed skills"})}${v}`),console.log(` ${I}$${v} ${Ie}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} ${Ie}easbot skills update${v} ${I}${j("cli.example.update_global",{locale:e,fallback:"Update installed skills"})}${v}`),console.log(),console.log(` ${I}$${v} ${Ie}easbot skills experimental_install${v} ${I}${j("cli.example.install",{locale:e,fallback:"Restore from skills-lock.json"})}${v}`),console.log(` ${I}$${v} ${Ie}easbot skills init ${I}[name]${v} ${I}${j("cli.example.init",{locale:e,fallback:"Create a new skill"})}${v}`),console.log(` ${I}$${v} ${Ie}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 ac(t){let e=rs(t),s=(n,l)=>I+j(n,{locale:e,fallback:l})+v;console.log(`
|
|
71
71
|
${oe}${j("cli.help.usage",{locale:e,fallback:"Usage: skills <command> [options]"})}${v}
|
|
72
72
|
|
|
73
73
|
${oe}${j("cli.help.section.manage",{locale:e,fallback:"Manage Skills"})}${v}:
|
|
@@ -160,7 +160,7 @@ ${oe}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 cc(t){let e=rs(t);console.log(`
|
|
164
164
|
${oe}${j("cli.help.remove.usage",{locale:e,fallback:"Usage: easbot skills remove [skills...] [options]"})}${v}
|
|
165
165
|
|
|
166
166
|
${oe}Description:${v}
|
|
@@ -186,7 +186,7 @@ ${oe}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 os(){console.log();}function
|
|
189
|
+
`);}function os(){console.log();}function uc(t,e){let s=rs(e),n=e?.cwd??it()??process.cwd(),l=t[0]||path.basename(n),o=t[0]!==void 0,i=o?path.join(n,l):n,a=path.join(i,"SKILL.md"),r=o?`${l}/SKILL.md`:"SKILL.md";if(fs$1.existsSync(a))return console.log(`${Ie}${j("cli.init.exists",{locale:s,vars:{path:r},fallback:`Skill already exists at ${r}`})}${v}`),0;o&&fs$1.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 fs$1.writeFileSync(a,h),console.log(`${Ie}${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
|
-
Object.defineProperty(exports,"BLOB_ALLOWED_REPOS",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.f}});Object.defineProperty(exports,"fetchRepoTree",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.i}});Object.defineProperty(exports,"findSkillMdPaths",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.k}});Object.defineProperty(exports,"getSkillFolderHashFromTree",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.j}});Object.defineProperty(exports,"parseFrontmatter",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.c}});Object.defineProperty(exports,"resetRepoTreeAuthState",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.h}});Object.defineProperty(exports,"sanitizeMetadata",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.e}});Object.defineProperty(exports,"stripTerminalEscapes",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.d}});Object.defineProperty(exports,"toSkillSlug",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.g}});Object.defineProperty(exports,"tryBlobInstall",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.l}});exports.AGENTS_DIR=Bs;exports.DEFAULT_CLONE_TIMEOUT_MS=sn;exports.EVE_SUBAGENTS_DIR=ds;exports.GitCloneError=Me;exports.SKILLS_SUBDIR=Vs;exports.UNIVERSAL_SKILLS_DIR=
|
|
207
|
+
`;return fs$1.writeFileSync(a,h),console.log(`${Ie}${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 dc(t,e){rc(e?.version);let n=e?.inAgent??await Xt();if(t.length===0)return n||Fi(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||os(),console.log(),await In(o),{code:0,handled:true,command:l};case "init":return n||os(),console.log(),{code:uc(o,e),handled:true,command:l};case "experimental_install":return n||os(),await Un(o),{code:0,handled:true,command:l};case "i":case "install":case "a":case "add":{n||os();let{source:i,options:a}=ts(o);return await nt(i,a),{code:0,handled:true,command:l}}case "use":{let{source:i,options:a,errors:r}=jn(o);return await Mn(i,a,r),{code:0,handled:true,command:l}}case "remove":case "rm":case "r":{if(o.includes("--help")||o.includes("-h"))return cc(e),{code:0,handled:true,command:l};let{skills:i,options:a}=Tn(o);return await ss(i,a),{code:0,handled:true,command:l}}case "experimental_sync":{n||os();let{options:i}=ls(o);return await ns(o,i),{code:0,handled:true,command:l}}case "list":case "ls":return await Dn(o),{code:0,handled:true,command:l};case "check":case "update":case "upgrade":return await Cn(o),{code:0,handled:true,command:l};default:{let i=rs(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
|
+
Object.defineProperty(exports,"BLOB_ALLOWED_REPOS",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.f}});Object.defineProperty(exports,"fetchRepoTree",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.i}});Object.defineProperty(exports,"findSkillMdPaths",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.k}});Object.defineProperty(exports,"getSkillFolderHashFromTree",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.j}});Object.defineProperty(exports,"parseFrontmatter",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.c}});Object.defineProperty(exports,"resetRepoTreeAuthState",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.h}});Object.defineProperty(exports,"sanitizeMetadata",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.e}});Object.defineProperty(exports,"stripTerminalEscapes",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.d}});Object.defineProperty(exports,"toSkillSlug",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.g}});Object.defineProperty(exports,"tryBlobInstall",{enumerable:true,get:function(){return chunkEOOPF3RI_cjs.l}});exports.AGENTS_DIR=Bs;exports.DEFAULT_CLONE_TIMEOUT_MS=sn;exports.EVE_SUBAGENTS_DIR=ds;exports.GitCloneError=Me;exports.SKILLS_SUBDIR=Vs;exports.UNIVERSAL_SKILLS_DIR=yo;exports.WellKnownProvider=Qt;exports.addSkillToLocalLock=bt;exports.addSkillToLock=vs;exports.agents=T;exports.buildUsePrompt=vi;exports.cleanupTempDir=tt;exports.cloneRepo=We;exports.computeContentHash=Er;exports.computeSkillFolderHash=Fe;exports.detectAgent=Xe;exports.detectInstalledAgents=Ue;exports.discoverSkills=$e;exports.dismissPrompt=It;exports.fetchAuditData=un;exports.fetchSkillFolderHash=Rr;exports.filterSkills=zt;exports.findProvider=Cl;exports.flushTelemetry=fr;exports.getAgentAdapter=qi;exports.getAgentBaseDir=xe;exports.getAgentConfig=no;exports.getAgentName=yr;exports.getAgentType=Yt;exports.getAllLockedSkills=bn;exports.getCanonicalPath=qe;exports.getCanonicalSkillsDir=Ee;exports.getEveSubagentSkillsDir=at;exports.getEveSubagents=Qe;exports.getGitHubToken=st;exports.getGlobal=ht;exports.getHomeDir=Te;exports.getInstallPath=ks;exports.getInstance=qn;exports.getLastSelectedAgents=xs;exports.getLocalLockPath=js;exports.getNonUniversalAgents=yt;exports.getOpenClawGlobalSkillsDir=nl;exports.getOwnerRepo=Je;exports.getProjectDirectory=it;exports.getProviders=Rl;exports.getSkillDisplayName=ne;exports.getSkillFromLock=yn;exports.getSkillLockPath=hn;exports.getSkillsBySource=_r;exports.getUniversalAgents=Ve;exports.getVisibleUniversalAgents=Kt;exports.getXdgCache=Zi;exports.getXdgConfig=kt;exports.getXdgData=Jn;exports.getXdgState=Yi;exports.handleSkillsCli=dc;exports.hasAgentAdapter=Ji;exports.hasProjectSkills=ui;exports.initTelemetry=vn;exports.installBlobSkillForAgent=ys;exports.installRemoteSkillForAgent=Ro;exports.installSkillForAgent=Vt;exports.installWellKnownSkillForAgent=Qs;exports.isGitHubHttpsCloneUrl=Nl;exports.isGitHubSsoAuthError=ln;exports.isPromptDismissed=wn;exports.isRepoPrivate=vt;exports.isRunningInAgent=Xt;exports.isSkillInstalled=qt;exports.isSubpathSafe=kl;exports.isUniversalAgent=be;exports.launchAgentInteractively=Ai;exports.listInstalledSkills=en;exports.matchesSkillFilter=En;exports.materializeUseSkill=xi;exports.parseAddOptions=ts;exports.parseFindOptions=Jl;exports.parseGitHubRepoUrl=Tl;exports.parseListOptions=Yl;exports.parseOwnerRepo=Jt;exports.parseRemoveOptions=Tn;exports.parseSkillMd=je;exports.parseSource=ct;exports.parseSyncOptions=ls;exports.parseUpdateOptions=ci;exports.parseUseOptions=jn;exports.readLocalLock=Se;exports.readSkillLock=Ae;exports.registerProvider=El;exports.registry=Zt;exports.removeCommand=ss;exports.removeSkillFromLocalLock=po;exports.removeSkillFromLock=kn;exports.renderBanner=Fi;exports.renderHelp=ac;exports.requireAgentAdapter=Xi;exports.resetGhAuthWarning=Cr;exports.resetGlobalAdapter=zi;exports.resetInstanceAdapter=Bi;exports.resolveUpdateScope=di;exports.runAdd=nt;exports.runFind=In;exports.runInstallFromLock=Un;exports.runList=Dn;exports.runSync=ns;exports.runUpdate=Cn;exports.runUse=Mn;exports.sanitizeName=ge;exports.sanitizeSubpath=bs;exports.saveSelectedAgents=As;exports.searchSkillsAPI=Ln;exports.setAgentAdapter=Vi;exports.setDetectedAgent=cn;exports.setGlobalAdapter=Hi;exports.setInstanceAdapter=Gi;exports.setVersion=$s;exports.shouldInstallInternalSkills=fl;exports.track=he;exports.wellKnownProvider=ut;exports.writeLocalLock=Ms;exports.writeSkillLock=es;
|