@tech-leads-club/agent-skills 1.4.2 → 1.4.4

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/README.md CHANGED
@@ -68,7 +68,7 @@ packages/skills-catalog/skills/
68
68
 
69
69
  ## 🛡️ Security & Trust
70
70
 
71
- Your environment's safety is our top priority. Unlike open marketplaces where **13.4% of skills contain critical issues**, `agent-skills` is a managed, hardened library: 100% open source (no binaries), static analysis in CI/CD, immutable integrity via lockfiles and content hashing, and human-curated prompts. The CLI uses defense-in-depth (sanitization, path isolation, symlink guards, atomic lockfile, audit trail); every skill is scanned with [mcp-scan](https://github.com/invariantlabs-ai/mcp-scan) before publishing.
71
+ Your environment's safety is our top priority. Unlike open marketplaces where **13.4% of skills contain critical issues**, `agent-skills` is a managed, hardened library: 100% open source (no binaries), static analysis in CI/CD, immutable integrity via lockfiles and content hashing, and human-curated prompts. The CLI uses defense-in-depth (sanitization, path isolation, symlink guards, atomic lockfile, audit trail); every skill is scanned with [Snyk Agent Scan](https://github.com/snyk/agent-scan) (formerly mcp-scan) before publishing.
72
72
 
73
73
  → **Full threat model, implementation details, and vulnerability reporting:** [SECURITY.md](SECURITY.md)
74
74
 
package/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
- var dl=Object.defineProperty;var _=(e,t)=>()=>(e&&(t=e(e=0)),t);var Lt=(e,t)=>{for(var o in t)dl(e,o,{get:t[o],enumerable:!0})};import{existsSync as Cn}from"node:fs";import{dirname as ul,join as Tn,parse as ml,resolve as pl}from"node:path";function Fe(e=process.cwd()){let t=pl(e),o=ml(t).root;for(;t!==o;){if((Cn(Tn(t,"package.json"))||Cn(Tn(t,".git")))&&!t.endsWith("packages/cli"))return t;t=ul(t)}return e}var To=_(()=>{"use strict"});import{existsSync as D,readdirSync as gl}from"node:fs";import{homedir as fl}from"node:os";import{join as b}from"node:path";function wo(){return Object.entries(so).filter(([,e])=>e.detectInstalled()).map(([e])=>e)}function Ne(e){return so[e]}function An(){return Object.keys(so).sort((e,t)=>so[e].displayName.localeCompare(so[t].displayName))}var E,z,so,wn,lo=_(()=>{"use strict";To();E=fl(),z=Fe(),so={cursor:{name:"cursor",displayName:"Cursor",description:"AI-first code editor built on VS Code",skillsDir:".cursor/skills",globalSkillsDir:b(E,".cursor/skills"),detectInstalled:()=>D(b(E,".cursor"))||D(b(z,".cursor"))},"claude-code":{name:"claude-code",displayName:"Claude Code",description:"Anthropic's agentic coding tool",skillsDir:".claude/skills",globalSkillsDir:b(E,".claude/skills"),detectInstalled:()=>D(b(E,".claude"))||D(b(z,".claude"))},"github-copilot":{name:"github-copilot",displayName:"GitHub Copilot",description:"AI pair programmer by GitHub/Microsoft",skillsDir:".github/skills",globalSkillsDir:b(E,".copilot/skills"),detectInstalled:()=>D(b(E,".copilot"))||D(b(z,".github"))},windsurf:{name:"windsurf",displayName:"Windsurf",description:"AI IDE with Cascade flow (Codeium)",skillsDir:".windsurf/skills",globalSkillsDir:b(E,".codeium/windsurf/skills"),detectInstalled:()=>D(b(E,".codeium/windsurf"))||D(b(z,".windsurf"))},cline:{name:"cline",displayName:"Cline",description:"Autonomous AI coding agent for VS Code",skillsDir:".cline/skills",globalSkillsDir:b(E,".cline/skills"),detectInstalled:()=>D(b(E,".cline"))||D(b(z,".cline"))||wn("saoudrizwan","claude-dev")},aider:{name:"aider",displayName:"Aider",description:"AI pair programming in terminal",skillsDir:".aider/skills",globalSkillsDir:b(E,".aider/skills"),detectInstalled:()=>D(b(E,".aider"))||D(b(z,".aider"))},codex:{name:"codex",displayName:"OpenAI Codex",description:"OpenAI's coding agent",skillsDir:".codex/skills",globalSkillsDir:b(E,".codex/skills"),detectInstalled:()=>D(b(E,".codex"))||D(b(z,".codex"))},gemini:{name:"gemini",displayName:"Gemini CLI",description:"Google's AI coding assistant",skillsDir:".gemini/skills",globalSkillsDir:b(E,".gemini/skills"),detectInstalled:()=>D(b(E,".gemini"))||D(b(z,".gemini"))},antigravity:{name:"antigravity",displayName:"Antigravity",description:"Google's agentic coding (VS Code)",skillsDir:".agent/skills",globalSkillsDir:b(E,".gemini/antigravity/skills"),detectInstalled:()=>D(b(E,".gemini/antigravity"))||D(b(z,".agent"))},roo:{name:"roo",displayName:"Roo Code",description:"AI coding assistant for VS Code",skillsDir:".roo/skills",globalSkillsDir:b(E,".roo/skills"),detectInstalled:()=>D(b(E,".roo"))||D(b(z,".roo"))||wn("RooVetGit","roo-cline")},kilocode:{name:"kilocode",displayName:"Kilo Code",description:"AI coding agent with auto-launch",skillsDir:".kilocode/skills",globalSkillsDir:b(E,".kilocode/skills"),detectInstalled:()=>D(b(E,".kilocode"))||D(b(z,".kilocode"))},trae:{name:"trae",displayName:"TRAE",description:"AI IDE with SOLO mode and custom agents",skillsDir:".trae/skills",globalSkillsDir:b(E,".trae/skills"),detectInstalled:()=>D(b(E,".trae"))||D(b(z,".trae"))},kiro:{name:"kiro",displayName:"Kiro",description:"AI Agent with workspace and global skill scopes",skillsDir:".kiro/skills",globalSkillsDir:b(E,".kiro/skills"),detectInstalled:()=>D(b(E,".kiro"))||D(b(z,".kiro"))},"amazon-q":{name:"amazon-q",displayName:"Amazon Q",description:"AWS AI coding assistant",skillsDir:".amazonq/skills",globalSkillsDir:b(E,".amazonq/skills"),detectInstalled:()=>D(b(E,".amazonq"))||D(b(z,".amazonq"))},augment:{name:"augment",displayName:"Augment",description:"AI code assistant with context engine",skillsDir:".augment/skills",globalSkillsDir:b(E,".augment/skills"),detectInstalled:()=>D(b(E,".augment"))||D(b(z,".augment"))},tabnine:{name:"tabnine",displayName:"Tabnine",description:"AI code completions with privacy focus",skillsDir:".tabnine/skills",globalSkillsDir:b(E,".tabnine/skills"),detectInstalled:()=>D(b(E,".tabnine"))||D(b(z,".tabnine"))},opencode:{name:"opencode",displayName:"OpenCode",description:"Open-source AI coding terminal",skillsDir:".opencode/skills",globalSkillsDir:b(E,".config/opencode/skills"),detectInstalled:()=>D(b(E,".config/opencode"))||D(b(z,".opencode"))||D(b(z,".config/opencode"))},sourcegraph:{name:"sourcegraph",displayName:"Sourcegraph Cody",description:"AI assistant with codebase context",skillsDir:".sourcegraph/skills",globalSkillsDir:b(E,".sourcegraph/skills"),detectInstalled:()=>D(b(E,".sourcegraph"))||D(b(z,".sourcegraph"))},droid:{name:"droid",displayName:"Droid (Factory.ai)",description:"AI software engineer by Factory.ai",skillsDir:".factory/skills",globalSkillsDir:b(E,".factory/skills"),detectInstalled:()=>D(b(E,".factory"))||D(b(z,".factory"))}};wn=(e,t)=>{let o=[b(E,".vscode/extensions"),b(E,".vscode-server/extensions"),b(E,".vscode-oss/extensions")];for(let r of o)if(D(r))try{if(gl(r).some(s=>s.startsWith(`${e}.${t}-`)))return!0}catch{}return!1}});var Rt,Ao,fr,En,hr,ft,xr,yr,kr,br,vn,Dn,Pn,Bn,Ln,We,De=_(()=>{"use strict";Rt="@tech-leads-club/agent-skills",Ao="@tech-leads-club/skills-catalog",fr=".agent-skills",En="cache.json",hr=".skill-meta.json",ft=".agents",xr="skills",yr=".skill-lock.json",kr=".skill-lock.json.backup",br=".agent-skills",vn="audit.log",Dn=".cache",Pn="agent-skills",Bn="skills",Ln="registry.json",We={UPDATE_AVAILABLE:(e,t)=>`Update available: ${e} \u2192 ${t}`,TIP_INSTALL_UPDATE:"Tip: Install globally to update:",TIP_INSTALL_ACCESS:"Tip: Install globally for easier access:",UPDATE_COMMAND:`npm update -g ${Rt}`,INSTALL_COMMAND:`npm install -g ${Rt}`,DESCRIPTION:"Curated skills to power up your coding agents"}});import{appendFile as bl,mkdir as Sl,readFile as Cl}from"node:fs/promises";import{homedir as Sr}from"node:os";import{join as Mn}from"node:path";function Io(e=Sr()){return Mn(e,br,vn)}async function Cr(e,t=Sr()){try{let o=Io(t),r=Mn(t,br);await Sl(r,{recursive:!0});let i=JSON.stringify({...e,timestamp:new Date().toISOString()})+`
3
- `;await bl(o,i,"utf-8")}catch{}}async function _n(e,t=Sr()){try{let o=Io(t),s=(await Cl(o,"utf-8")).trim().split(`
4
- `).filter(Boolean).map(l=>{try{return JSON.parse(l)}catch{return null}}).filter(l=>l!==null).reverse();return e?s.slice(0,e):s}catch{return[]}}var Tr=_(()=>{"use strict";De()});import{execSync as Tl}from"node:child_process";import{existsSync as wl}from"node:fs";import{join as Al}from"node:path";function Il(){try{return Tl("npm root -g",{encoding:"utf-8"}).trim()}catch{return null}}function wr(){let e=Il();if(!e)return!1;let t=Al(e,Rt);return wl(t)}var Ar=_(()=>{"use strict";De()});var Mt,ht,Ir,Er,bm,_t=_(()=>{"use strict";Mt="uncategorized",ht=/^\(([a-z][a-z0-9-]*)\)$/,Ir="_category.json",Er={id:Mt,name:"Uncategorized",description:"Skills without a specific category",priority:999},bm=1440*60*1e3});var On=_(()=>{"use strict"});var Fn=_(()=>{"use strict"});var Nn=_(()=>{"use strict"});var Un=_(()=>{"use strict"});var $n=_(()=>{"use strict"});var Gn=_(()=>{"use strict"});var Hn=_(()=>{"use strict";On();Fn();Nn();Un();$n();Gn()});var Eo,vr=_(()=>{"use strict";Eo=["cursor","claude-code","github-copilot","windsurf","cline","aider","codex","gemini","antigravity","roo","kilocode","amazon-q","augment","tabnine","opencode","sourcegraph","droid","trae","kiro"]});function ao(e){return e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}var jn=_(()=>{"use strict";_t()});var Kn=_(()=>{"use strict";_t()});var Vn=_(()=>{"use strict";_t()});var Dr=_(()=>{"use strict"});import{z as de}from"zod";var El,vl,Wm,Xn=_(()=>{"use strict";_t();vr();Dr();El=de.enum(Eo),vl=de.object({name:de.string(),source:de.string(),contentHash:de.string().optional(),installedAt:de.string(),updatedAt:de.string(),agents:de.array(El).optional(),method:de.enum(["copy","symlink"]).optional(),global:de.boolean().optional(),version:de.string().optional()}),Wm=de.object({version:de.number(),skills:de.record(de.string(),vl)})});function Dl(e){if(!e.startsWith("---"))return e;let t=0;for(;t<e.length;){let o=e.indexOf(`
5
- `,t),r=o===-1?e.length:o,i=e[r-1]==="\r"?r-1:r,s=e.slice(t,i);if(t===0){if(s!=="---")return e}else if(s==="---")return e.slice(o===-1?e.length:o+1).trimStart();if(o===-1)return e;t=o+1}return e}function Yn(e){let o=Dl(e).split(`
6
- `),r=[],i=0;for(;i<o.length;){let s=o[i];if(s.startsWith("```")){let c=s.slice(3).trim(),u=[];for(i++;i<o.length&&!o[i].startsWith("```");)u.push(o[i]),i++;r.push({type:"code-block",language:c,lines:u}),i++;continue}if(s.trim()===""){r.push({type:"blank"}),i++;continue}if(/^(-{3,}|_{3,}|\*{3,})$/.test(s.trim())){r.push({type:"hr"}),i++;continue}let l=s.match(/^(#{1,3})\s+(.+)$/);if(l){r.push({type:"heading",level:l[1].length,text:l[2]}),i++;continue}let d=s.match(/^(\s*)([-*]|\d+\.)\s+(.+)$/);if(d){let c=Math.floor(d[1].length/2);r.push({type:"list-item",text:d[3],indent:c}),i++;continue}r.push({type:"paragraph",text:s}),i++}return r}var zn=_(()=>{"use strict"});var Wn=_(()=>{"use strict";Kn();Vn();Xn();zn();Dr()});var co=_(()=>{"use strict";_t();Hn();vr();jn();Wn()});var oi={};Lt(oi,{addSkillToLock:()=>Br,getAllLockedSkills:()=>Ul,getSkillFromLock:()=>Po,readSkillLock:()=>uo,removeSkillFromLock:()=>Do,writeSkillLock:()=>Pr});import{mkdir as Pl,readFile as qn,rename as Bl,unlink as Ll,writeFile as Jn}from"node:fs/promises";import{homedir as Qn}from"node:os";import{dirname as Rl,join as vo}from"node:path";import{z as ue}from"zod";function ei(e){if(e)return vo(Qn(),ft,yr);let t=Fe();return vo(t,ft,yr)}function Fl(e){if(e)return vo(Qn(),ft,kr);let t=Fe();return vo(t,ft,kr)}function ti(){return{version:Zn,skills:{}}}function Nl(e){try{let t=Ol.parse(e);return t.version===1?{version:Zn,skills:Object.fromEntries(Object.entries(t.skills).map(([o,r])=>[o,{...r,agents:r.agents||[],method:r.method||"copy",global:r.global??!1}]))}:t}catch{return ti()}}async function uo(e=!1){let t=ei(e);try{let o=await qn(t,"utf-8"),r=JSON.parse(o);return Nl(r)}catch{return ti()}}async function Pr(e,t=!1){let o=ei(t),r=Fl(t),i=`${o}.tmp`;try{try{let s=await qn(o,"utf-8");await Jn(r,s,"utf-8")}catch{}await Pl(Rl(o),{recursive:!0}),await Jn(i,JSON.stringify(e,null,2),"utf-8"),await Bl(i,o)}catch(s){try{await Ll(i)}catch{}throw s}}async function Br(e,t,o={}){let r=await uo(o.global),i=new Date().toISOString(),s=r.skills[e];r.skills[e]={name:e,source:o.source||"local",contentHash:o.contentHash??s?.contentHash,installedAt:s?.installedAt??i,updatedAt:i,agents:t,method:o.method||"copy",global:o.global??!1,version:o.version},await Pr(r,o.global)}async function Do(e,t=!1){let o=await uo(t);return e in o.skills?(delete o.skills[e],await Pr(o,t),!0):!1}async function Po(e,t=!1){return(await uo(t)).skills[e]??null}async function Ul(e=!1){return(await uo(e)).skills}var Zn,Ml,_l,Ol,Lr=_(()=>{"use strict";co();De();To();Zn=2,Ml=ue.enum(Eo),_l=ue.object({name:ue.string(),source:ue.string(),contentHash:ue.string().optional(),installedAt:ue.string(),updatedAt:ue.string(),agents:ue.array(Ml).optional(),method:ue.enum(["copy","symlink"]).optional(),global:ue.boolean().optional(),version:ue.string().optional()}),Ol=ue.object({version:ue.number(),skills:ue.record(ue.string(),_l)})});import Vl from"ky";import{existsSync as xt,mkdirSync as Lo,readFileSync as ii,rmSync as Rr,writeFileSync as Mr}from"node:fs";import{homedir as Xl}from"node:os";import{join as Ae}from"node:path";import Yl from"package-json";function si(){xt(we.cacheDir)||Lo(we.cacheDir,{recursive:!0}),xt(we.skillsCacheDir)||Lo(we.skillsCacheDir,{recursive:!0})}function Wl(e){return Date.now()-e<Ot.cacheTtlMs}function ri(){if(!xt(we.registryCacheFile))return null;try{let e=ii(we.registryCacheFile,"utf-8");return JSON.parse(e)}catch{return null}}function Jl(e){let t={fetchedAt:Date.now(),registry:e};Mr(we.registryCacheFile,JSON.stringify(t,null,2))}async function li(e,t){try{return await ni.get(e)}catch(o){if(t)try{return await ni.get(t)}catch{}throw o}}async function ai(){if(process.env.SKILLS_CDN_REF)return process.env.SKILLS_CDN_REF;if(Bo)return Bo;try{return Bo=(await Yl(Ao,{version:"latest"})).version,Bo}catch{return"latest"}}function ci(e){let t=`https://cdn.jsdelivr.net/npm/${Ao}@${e}`,o=`https://unpkg.com/${Ao}@${e}`;return{registry:`${t}/skills-registry.json`,fallbackRegistry:`${o}/skills-registry.json`,skillsBase:`${t}/skills`,fallbackSkillsBase:`${o}/skills`}}async function mo(e=!1){si();let t=await ai();if(!e){let o=ri(),r=o&&t!=="latest"&&o.registry.version!==t;if(o&&Wl(o.fetchedAt)&&!r)return o.registry}try{let o=ci(t),i=await(await li(o.registry,o.fallbackRegistry)).json();return Jl(i),i}catch(o){let r=ri();return r?r.registry:(console.error(`Failed to fetch registry: ${o instanceof Error?o.message:o}`),null)}}function ql(e){return zl.reduce((t,o)=>t.replace(o,""),e).trim()}function Ql(e,t){let o=Ae(e,".");return Ae(t,".").startsWith(o)}function lt(e){let t=ql(e);if(!t)throw new Error("Invalid skill name");return Ae(we.skillsCacheDir,t)}function _r(e){try{let t=lt(e);return xt(Ae(t,"SKILL.md"))}catch{return!1}}function Zl(e,t){try{let o=Ae(lt(e),hr);Mr(o,JSON.stringify(t,null,2))}catch{}}function di(e){try{let t=Ae(lt(e),hr);return xt(t)?JSON.parse(ii(t,"utf-8")):null}catch{return null}}async function Or(e){if(!_r(e))return!0;let t=await Nt(e);if(!t?.contentHash)return!1;let o=di(e);return o?.contentHash?o.contentHash!==t.contentHash:!0}function ui(e){return di(e)?.contentHash}async function Ro(e){let t=[],o=[];for(let r of e)await Or(r)?t.push(r):o.push(r);return{toUpdate:t,upToDate:o}}async function ea(e,t,o){let r=Ae(o,t);if(!Ql(o,r))return console.error(`Security: Skipping suspicious file path: ${t}`),!1;let i=Ae(r,"..");xt(i)||Lo(i,{recursive:!0});let s=ci(await ai()),l=`${s.skillsBase}/${e.path}/${t}`,d=`${s.fallbackSkillsBase}/${e.path}/${t}`,c=await li(l,d);if(!c.ok)throw new Error(`Failed to download ${t}: HTTP ${c.status}`);return Mr(r,await c.text()),!0}async function ta(e){let t=lt(e.name);si(),xt(t)||Lo(t,{recursive:!0});try{let o=[...e.files],r=0;for(let i=0;i<o.length;i+=Ot.maxConcurrentDownloads){let s=o.slice(i,i+Ot.maxConcurrentDownloads),l=await Promise.all(s.map(d=>ea(e,d,t)));r+=l.filter(Boolean).length}if(r<o.length)throw new Error(`Only ${r}/${o.length} files downloaded successfully`);return e.contentHash&&Zl(e.name,{contentHash:e.contentHash,downloadedAt:Date.now()}),t}catch(o){return console.error(`Failed to download skill ${e.name}: ${o instanceof Error?o.message:o}`),null}}async function Ft(){let e=await mo();return e?e.skills.map(t=>({name:t.name,description:t.description,path:_r(t.name)?lt(t.name):"",category:t.category})):[]}async function Nt(e){return(await mo())?.skills.find(o=>o.name===e)??null}async function oa(){return(await mo())?.deprecated??[]}async function Mo(){let e=await oa();return new Map(e.map(t=>[t.name,t]))}async function yt(e){if(_r(e))return lt(e);let t=await Nt(e);return t?ta(t):null}function mi(){try{Rr(we.cacheDir,{recursive:!0,force:!0})}catch{}}function ra(e){try{Rr(Ae(we.skillsCacheDir,e),{recursive:!0,force:!0})}catch{}}function pi(){try{Rr(we.registryCacheFile,{force:!0})}catch{}}async function po(e){return ra(e),yt(e)}function Fr(){return we.cacheDir}var Ot,we,zl,ni,Bo,Je=_(()=>{"use strict";De();Ot={cacheTtlMs:864e5,fetchTimeoutMs:15e3,maxRetries:3,retryBaseDelayMs:500,maxConcurrentDownloads:10},we={cacheDir:Ae(Xl(),Dn,Pn),get registryCacheFile(){return Ae(this.cacheDir,Ln)},get skillsCacheDir(){return Ae(this.cacheDir,Bn)}},zl=[/[/\\]/g,/\.\./g,/[<>:"|?*]/g];ni=Vl.create({timeout:Ot.fetchTimeoutMs,retry:{limit:Ot.maxRetries,methods:["get"],statusCodes:[408,429,500,502,503,504],backoffLimit:1e4,delay:e=>Ot.retryBaseDelayMs*Math.pow(2,e-1),jitter:!0,retryOnTimeout:!0}});Bo=null});import{cp as na,lstat as Nr,mkdir as yi,readdir as ia,readlink as ki,rm as $t,symlink as sa}from"node:fs/promises";import{homedir as la,platform as aa}from"node:os";import{join as ge,normalize as gi,relative as ca,resolve as fo,sep as da}from"node:path";var fi,Ur,ho,hi,ua,ma,go,pa,Ut,xi,ga,fa,ha,_o,$r,xa,xo,Gt=_(()=>{"use strict";De();lo();Tr();Ar();Lr();To();Je();fi=ge(ft,xr),Ur=e=>(e.replace(/[/\\]/g,"").replace(/[\0:*?"<>|]/g,"").replace(/^[.\s]+|[.\s]+$/g,"").replace(/\.{2,}/g,"").replace(/^\.+/,"")||"unnamed-skill").substring(0,255),ho=(e,t)=>{let o=gi(fo(e)),r=gi(fo(t));return r.startsWith(o+da)||r===o},hi=async(e,t)=>{try{await ua(t,e),await yi(ge(t,".."),{recursive:!0});let o=ca(ge(t,".."),e),r=aa()==="win32"?"junction":void 0;return await sa(o,t,r),!0}catch{return!1}},ua=async(e,t)=>{try{if((await Nr(e)).isSymbolicLink()){let r=await ki(e);if(fo(r)===fo(t))return;await $t(e)}else await $t(e,{recursive:!0})}catch(o){o?.code==="ELOOP"&&await $t(e,{force:!0}).catch(()=>{})}},ma=async(e,t)=>{try{if((await Nr(e)).isSymbolicLink()){let r=await ki(e),i=fo(ge(e,".."),r);return ho(t,i)}return!0}catch{return!0}},go=async(e,t)=>{await $t(t,{recursive:!0,force:!0}),await yi(ge(t,".."),{recursive:!0}),await na(e,t,{recursive:!0})},pa=(e,t)=>`${e}-${t?"global":"local"}`,Ut=(e,t,o={})=>({agent:e.config.displayName,skill:e.skill.name,path:e.skillTargetPath,method:t,success:!0,...o}),xi=(e,t,o)=>({agent:e.config.displayName,skill:e.skill.name,path:e.skillTargetPath,method:t,success:!1,error:o instanceof Error?o.message:String(o)}),ga={"symlink-global":async e=>await hi(e.skill.path,e.skillTargetPath)?Ut(e,"symlink"):(await go(e.skill.path,e.skillTargetPath),Ut(e,"copy",{symlinkFailed:!0})),"symlink-local":async e=>{let t=ge(e.projectRoot,xr,e.safeSkillName);return await go(e.skill.path,t),await hi(t,e.skillTargetPath)?Ut(e,"symlink",{usedGlobalSymlink:!1}):(await go(e.skill.path,e.skillTargetPath),Ut(e,"copy",{symlinkFailed:!0}))},"copy-global":async e=>(await go(e.skill.path,e.skillTargetPath),Ut(e,"copy")),"copy-local":async e=>(await go(e.skill.path,e.skillTargetPath),Ut(e,"copy"))},fa=(e,t,o,r)=>r||ho(e,t)||ho(o,t)?null:"Security: Invalid skill destination path",ha=async(e,t,o,r,i,s)=>{let l=Ne(t),d=Ur(e.name),c=ge(o,d),u={skill:e,config:l,safeSkillName:d,skillTargetPath:c,projectRoot:i},f=fa(o,c,i,s);if(f)return xi(u,r,f);try{let g=pa(r,s);return await ga[g](u)}catch(g){return xi(u,r,g)}},_o=async(e,t)=>{let o=Fe(),r=[];for(let i of t.agents){let s=Ne(i),l=t.global?s.globalSkillsDir:ge(o,s.skillsDir);for(let d of e){let c=await ha(d,i,l,t.method,o,t.global);r.push(c),c.success&&await Br(d.name,[i],{source:"local",contentHash:ui(d.name),method:t.method,global:t.global})}}return await Cr({action:"install",skillName:e.map(i=>i.name).join(", "),agents:t.agents.map(i=>Ne(i).displayName),success:r.filter(i=>i.success).length,failed:r.filter(i=>!i.success).length,details:r.map(i=>({skill:i.skill,agent:i.agent,success:i.success,error:i.error,path:i.path}))}),r},$r=async(e,t)=>{let o=Ne(e),r=t?o.globalSkillsDir:ge(Fe(),o.skillsDir);try{return(await ia(r,{withFileTypes:!0})).filter(s=>s.isDirectory()||s.isSymbolicLink()).map(s=>s.name)}catch{return[]}},xa=(e,t={})=>{let o=Ur(e),r=t.global?la():Fe(),i=ge(r,fi,o);if(!ho(ge(r,fi),i))throw new Error("Invalid skill name: potential path traversal detected");return i},xo=async(e,t,o={})=>{let r=Ur(e),i=Fe(),s=await Po(e,!0);if(s||(s=await Po(e,!1)),!s&&!o.force)return t.map(c=>({skill:e,agent:Ne(c).displayName,success:!1,error:"Skill not found in lockfile"}));let l=xa(e,o);await $t(l,{recursive:!0,force:!0}).catch(()=>{});let d=await Promise.all(t.map(async c=>{let u=Ne(c),f=ge(i,u.skillsDir,r),g=ge(u.globalSkillsDir,r),h=o.global===void 0?[f,g]:o.global?[g]:[f],m=!1,p;for(let T of h){let P=T.startsWith(u.globalSkillsDir)?u.globalSkillsDir:ge(i,u.skillsDir);if(!ho(P,T)){p="Security: Invalid removal path";continue}if(!await ma(T,P)){p="Security: Symlink points outside allowed directory";continue}try{await Nr(T),await $t(T,{recursive:!0,force:!0}),m=!0}catch(O){O.code!=="ENOENT"&&!p&&(p=O instanceof Error?O.message:String(O))}}return{skill:e,agent:u.displayName,success:m,error:m?void 0:p||"Skill not found"}}));return d.some(c=>c.success)&&(await Do(e,!0).catch(()=>{}),await Do(e,!1).catch(()=>{})),await Cr({action:"remove",skillName:e,agents:t.map(c=>Ne(c).displayName),success:d.filter(c=>c.success).length,failed:d.filter(c=>!c.success).length,forced:o.force,details:d.map(c=>({skill:c.skill,agent:c.agent,success:c.success,error:c.error}))}),d}});var Ps={};Lt(Ps,{runCliInstall:()=>wu});import _e from"chalk";async function Cu(e,t){let o=await Ft(),r=[];for(let i of e){let s=o.find(d=>d.name===i);if(!s){console.error(_e.red(`\u274C Skill "${i}" not found`));continue}let l=t?await po(i):await yt(i);l?r.push({...s,path:l}):console.error(_e.red(`\u274C Failed to download skill "${i}"`))}return r}function Tu(e){let t=e.filter(r=>r.success),o=e.filter(r=>!r.success);t.length>0&&(console.log(_e.green(`
7
- \u2705 Successfully installed ${t.length} skill(s):`)),t.forEach(r=>{console.log(_e.dim(` \u2022 ${r.skill} \u2192 ${r.agent} (${r.method})`))})),o.length>0&&(console.log(_e.red(`
8
- \u274C Failed to install ${o.length} skill(s):`)),o.forEach(r=>{console.log(_e.dim(` \u2022 ${r.skill} \u2192 ${r.agent}: ${r.error}`))}))}async function wu(e){(!e.skill||e.skill.length===0)&&(console.error(_e.red("\u274C --skill is required in CLI mode")),console.error(_e.dim("Usage: agent-skills install --skill <name1> [name2...] [--agent <agents...>] [--global] [--symlink]")),process.exit(1));let t=Array.isArray(e.skill)?e.skill:[e.skill];console.log(_e.blue(`\u23F3 Loading ${t.length} skill(s) from catalog...`));let o=await Cu(t,e.force||!1);o.length===0&&(console.error(_e.red("\u274C No skills were successfully downloaded")),process.exit(1));let r=e.agent||["cursor","claude-code","windsurf"],i=e.symlink?"symlink":"copy";console.log(_e.blue(`\u23F3 Installing ${o.length} skill(s) to ${r.length} agent(s)...`));let s={agents:r,skills:o.map(d=>d.name),method:i,global:e.global||!1},l=await _o(o,s);Tu(l),l.some(d=>!d.success)&&process.exit(1)}var Bs=_(()=>{"use strict";Gt();Je()});var Ls={};Lt(Ls,{runCliRemove:()=>Au});import Ve from"chalk";async function Au(e){(!e.skill||e.skill.length===0)&&(console.error(Ve.red("\u274C --skill is required in CLI mode")),console.error(Ve.dim("Usage: agent-skills remove --skill <name1> [name2...] [--agent <agents...>] [--global] [--force]")),process.exit(1));let t=Array.isArray(e.skill)?e.skill:[e.skill],o=e.agent||["cursor","claude-code","windsurf"];e.force&&console.log(Ve.yellow("\u26A0\uFE0F Force mode enabled - bypassing lockfile check")),console.log(Ve.blue(`\u23F3 Removing ${t.length} skill(s) from ${o.length} agent(s)...`));let r=0,i=0,s=!1;for(let l of t){let d=await xo(l,o,{global:e.global,force:e.force}),c=d.filter(f=>f.success),u=d.filter(f=>!f.success);c.length>0&&(console.log(Ve.green(`\u2705 ${l}: Removed from ${c.length} agent(s)`)),c.forEach(f=>console.log(Ve.dim(` \u2022 ${f.agent}`))),r+=c.length),u.length>0&&(console.log(Ve.red(`\u274C ${l}: Failed to remove from ${u.length} agent(s)`)),u.forEach(f=>console.log(Ve.dim(` \u2022 ${f.agent}: ${f.error}`))),i+=u.length,u.some(f=>f.error?.includes("lockfile"))&&(s=!0))}console.log(Ve.dim(`
9
- ${r} succeeded, ${i} failed`)),s&&!e.force&&console.log(Ve.yellow(`
10
- \u{1F4A1} Tip: Use --force to bypass lockfile check`)),i>0&&process.exit(1)}var Rs=_(()=>{"use strict";Gt()});var Ms={};Lt(Ms,{runCliUpdate:()=>Iu});import ce from"chalk";async function Iu(e){if(console.log(ce.blue("\u23F3 Fetching latest registry...")),await mo(!0),e.skill){if(!await Or(e.skill)){console.log(ce.green(`\u2705 ${e.skill} is already up to date`));return}console.log(ce.blue(`\u23F3 Updating ${e.skill}...`)),await po(e.skill)?console.log(ce.green(`\u2705 Updated ${e.skill}`)):(console.error(ce.red(`\u274C Failed to update ${e.skill}`)),process.exit(1))}else{let{readSkillLock:t}=await Promise.resolve().then(()=>(Lr(),oi)),o=await t(),r=Object.keys(o.skills);if(r.length===0){console.log(ce.yellow("No installed skills found. Run agent-skills install first."));return}let{toUpdate:i,upToDate:s}=await Ro(r);if(i.length===0){console.log(ce.green(`\u2705 All ${s.length} installed skills are up to date`));return}console.log(ce.blue(`\u23F3 Updating ${i.length} of ${r.length} skills...`));let l=0,d=0;for(let h of i)await po(h)?l++:(d++,console.error(ce.red(` \u274C Failed to update ${h}`)));console.log(ce.green(`\u2705 ${l} updated, ${s.length} already up to date${d>0?ce.red(`, ${d} failed`):""}`));let c=await Mo(),u=await Ft(),f=new Set(u.map(h=>h.name)),g=r.filter(h=>c.has(h)||!f.has(h));if(g.length>0){console.log(""),console.log(ce.yellow(`\u26A0 ${g.length} deprecated skill${g.length>1?"s":""} detected:`));let h={withEntry:(m,p)=>{console.log(ce.yellow(` \u203A ${m} \u2014 ${p.message}`)),p.alternatives?.length&&console.log(ce.dim(` Try: agent-skills install --skill ${p.alternatives.join(", ")}`))},noEntry:m=>{console.log(ce.yellow(` \u203A ${m} \u2014 no longer available in the registry`))}};g.forEach(m=>{let p=c.get(m);h[p?"withEntry":"noEntry"](m,p)}),console.log(ce.dim(" Run: agent-skills remove --skill <name> to clean up"))}}}var _s=_(()=>{"use strict";Je()});var Os={};Lt(Os,{runCliCache:()=>Eu});import Pt from"chalk";function Eu(e){e.clear?(mi(),console.log(Pt.green("\u2705 Cache cleared"))):e.clearRegistry?(pi(),console.log(Pt.green("\u2705 Registry cache cleared"))):e.path?console.log(Fr()):(console.log(Pt.bold("Cache management:")),console.log(` ${Pt.blue("--clear")} Clear all cached skills and registry`),console.log(` ${Pt.blue("--clear-registry")} Clear only the registry cache`),console.log(` ${Pt.blue("--path")} Show cache directory path`),console.log(),console.log(Pt.dim(`Cache location: ${Fr()}`)))}var Fs=_(()=>{"use strict";Je()});import{Box as pt,Text as ve}from"ink";import{Fragment as Du,jsx as gt,jsxs as Se}from"react/jsx-runtime";function Ns({entries:e,limit:t=10}){let o=e.slice(0,t);return o.length===0?gt(pt,{flexDirection:"column",paddingY:1,children:gt(ve,{dimColor:!0,children:"No audit log entries found"})}):Se(pt,{flexDirection:"column",paddingY:1,children:[Se(pt,{marginBottom:1,children:[gt(ve,{bold:!0,color:"cyan",children:"\u{1F4CB} Audit Log"}),Se(ve,{dimColor:!0,children:[" (showing ",o.length," most recent)"]})]}),o.map((r,i)=>{let s=r.timestamp?new Date(r.timestamp):new Date,l=r.timestamp?vu(s):"unknown time",d=r.action==="install"?"green":r.action==="remove"?"red":"yellow",c=r.failed===0?"\u2713":r.success>0?"\u26A0":"\u2717";return Se(pt,{flexDirection:"column",marginBottom:1,paddingLeft:2,children:[Se(pt,{children:[Se(ve,{color:d,bold:!0,children:[c," ",r.action.toUpperCase()]}),Se(ve,{dimColor:!0,children:[" \u2022 ",l]})]}),Se(pt,{paddingLeft:2,children:[gt(ve,{children:"Skills: "}),gt(ve,{color:"cyan",children:r.skillName})]}),Se(pt,{paddingLeft:2,children:[gt(ve,{children:"Agents: "}),gt(ve,{dimColor:!0,children:r.agents.join(", ")})]}),Se(pt,{paddingLeft:2,children:[Se(ve,{color:"green",children:["\u2713 ",r.success]}),r.failed>0&&Se(Du,{children:[gt(ve,{children:" \u2022 "}),Se(ve,{color:"red",children:["\u2717 ",r.failed]})]})]})]},i)})]})}function vu(e){let t=Math.floor((Date.now()-e.getTime())/1e3);return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:t<604800?`${Math.floor(t/86400)}d ago`:e.toLocaleDateString()}var Us=_(()=>{"use strict"});var $s={};Lt($s,{runCliAudit:()=>Lu});import{render as Pu}from"ink";import Bu from"react";async function Lu(e){if(e.path){console.log(Io());return}let t=e.limit?parseInt(e.limit,10):10,o=await _n(t);Pu(Bu.createElement(Ns,{entries:o,limit:t}))}var Gs=_(()=>{"use strict";Us();Tr()});import{Command as Ru}from"commander";import{render as oo}from"ink";import ro from"react";import{Box as gn,useApp as yu}from"ink";import{useEffect as ku,useState as bu}from"react";lo();import{useEffect as hl,useMemo as xl,useState as gr}from"react";function In(){let[e,t]=gr([]),[o,r]=gr([]),[i,s]=gr(!0),l=xl(()=>An(),[]);return hl(()=>{let c=setTimeout(()=>{let u=wo();r(u),t(u),s(!1)},800);return()=>clearTimeout(c)},[]),{allAgents:l,installedAgents:o,selectedAgents:e,setSelectedAgents:t,toggleAgent:c=>{t(u=>u.includes(c)?u.filter(f=>f!==c):[...u,c])},loading:i}}import{useEffect as nm,useState as im}from"react";De();import{useMemo as yl,useState as kl}from"react";function Rn(e,t){let[o,r]=kl(""),i=yl(()=>{if(!o.trim())return e;let s=o.toLowerCase().split(/\s+/).filter(l=>l.length>0);return e.filter(l=>{let d=t.keys.map(c=>{let u=l[c];return typeof u=="string"?u.toLowerCase():""}).join(" ");return s.every(c=>d.includes(c))})},[o,e,t.keys]);return{query:o,setQuery:r,filtered:i,hasFilter:o.trim().length>0}}Gt();import{useState as Fo}from"react";co();import{existsSync as Hr,readdirSync as Ci,readFileSync as wa}from"node:fs";import{join as Oo}from"node:path";import{existsSync as ya}from"node:fs";import{dirname as ka,join as bi}from"node:path";import{fileURLToPath as ba}from"node:url";var Sa=ba(import.meta.url),Ca=ka(Sa);function Gr(){return bi(Ta(),"packages","skills-catalog","skills")}function Si(){let e=Gr();return ya(e)?e:null}function Ta(){return bi(Ca,"..","..","..","..")}Je();var at={mode:null,localDir:null};function Aa(e){return ht.test(e)}function Ia(e){return e.match(ht)?.[1]??null}function Ea(e){let t=e.match(/^---\n([\s\S]*?)\n---/);if(!t)return{};let o=t[1],r=o.match(/^name:\s*(.+)$/m),i=o.match(/^description:\s*(.+)$/m);return{name:r?.[1]?.trim(),description:i?.[1]?.trim()}}function Ti(e,t){let o=Oo(e,"SKILL.md");if(!Hr(o))return null;let r=wa(o,"utf-8"),{name:i,description:s}=Ea(r),l=e.split("/").pop()??"";return{name:i??l,description:s??"No description",path:e,category:t}}function va(e,t){return Hr(e)?Ci(e,{withFileTypes:!0}).filter(o=>o.isDirectory()).map(o=>Ti(Oo(e,o.name),t)).filter(o=>o!==null):[]}function wi(e){return Hr(e)?Ci(e,{withFileTypes:!0}).filter(o=>o.isDirectory()).flatMap(o=>{if(Aa(o.name)){let i=Ia(o.name);return i?va(Oo(e,o.name),i):[]}let r=Ti(Oo(e,o.name),Mt);return r?[r]:[]}):[]}function Da(){if(at.mode)return at.mode;let e=Si();return e?(at.localDir=e,at.mode="local","local"):(at.mode="remote","remote")}function jr(){return Da()==="local"&&at.localDir!==null}function Pa(){return jr()?wi(at.localDir):[]}async function Ai(){return jr()?wi(at.localDir):Ft()}function Ba(e){return Pa().find(t=>t.name===e)}async function Ii(e){if(jr())return Ba(e)??null;let t=await Nt(e);if(!t)return null;let o=await yt(e);return o?{name:t.name,description:t.description,path:o,category:t.category}:null}function No(){let[e,t]=Fo({current:0,total:0,skill:""}),[o,r]=Fo([]),[i,s]=Fo(!1),[l,d]=Fo(null);return{install:async(u,f)=>{s(!0),d(null),t({current:0,total:u.length*f.agents.length,skill:"Downloading..."});let g=[];for(let h of u){let m=h.path?h:await Ii(h.name);m&&g.push(m)}t({current:0,total:g.length*f.agents.length,skill:"Installing..."});try{let h=await _o(g,f);return r(h),h}catch(h){return d(h instanceof Error?h.message:String(h)),[]}finally{s(!1)}},progress:e,results:o,installing:i,error:l}}import{useInput as La}from"ink";import{useCallback as Ra,useRef as Ma,useState as _a}from"react";var Uo=["up","up","down","down","left","right","left","right","b","a"];function Ei(){let[e,t]=_a(!1),o=Ma([]);La((i,s)=>{if(e)return;let l=null;if(s.upArrow?l="up":s.downArrow?l="down":s.leftArrow?l="left":s.rightArrow?l="right":i.toLowerCase()==="b"?l="b":i.toLowerCase()==="a"&&(l="a"),!l){o.current=[];return}o.current.push(l),o.current.length>Uo.length&&(o.current=o.current.slice(-Uo.length)),o.current.length===Uo.length&&o.current.every((d,c)=>d===Uo[c])&&(t(!0),o.current=[])});let r=Ra(()=>{t(!1),o.current=[]},[]);return{activated:e,reset:r}}Gt();import{useState as $o}from"react";function vi(){let[e,t]=$o({current:0,total:0,skill:""}),[o,r]=$o([]),[i,s]=$o(!1),[l,d]=$o(null);return{remove:async(f,g,h=!1)=>{s(!0),t({current:0,total:g.length,skill:f}),d(null);try{let m=await xo(f,g,{global:h});return r(p=>[...p,...m]),m}catch(m){return d(m instanceof Error?m.message:String(m)),[]}finally{s(!1)}},removeMultiple:async f=>{s(!0);let g=f.reduce((h,m)=>h+m.agents.length,0);t({current:0,total:g,skill:"Initializing..."}),r([]),d(null);try{let h=0;for(let m of f){t({current:h,total:g,skill:m.name});let p=await xo(m.name,m.agents,{});r(T=>[...T,...p]),h+=m.agents.length}}catch(h){d(h instanceof Error?h.message:String(h))}finally{s(!1)}},progress:e,results:o,removing:i,error:l}}Je();import{readFileSync as Oa}from"node:fs";import{join as Fa}from"node:path";import{useEffect as Na,useState as Go}from"react";function Di(e){let[t,o]=Go(null),[r,i]=Go(null),[s,l]=Go(!1),[d,c]=Go(null);return Na(()=>{if(!e){o(null),i(null),l(!1),c(null);return}let u=!0;return l(!0),c(null),(async()=>{try{let[g,h]=await Promise.all([Nt(e).catch(()=>null),yt(e).catch(()=>null)]);if(!u)return;g&&o(g);let m=h??lt(e);try{let p=Oa(Fa(m,"SKILL.md"),"utf-8");i(p)}catch{c("Failed to load skill content")}}catch(g){u&&c(g instanceof Error?g.message:String(g))}finally{u&&l(!1)}})(),()=>{u=!1}},[e]),{metadata:t,content:r,loading:s,error:d}}import{useEffect as Xa,useState as jo}from"react";co();import{existsSync as Pi,readdirSync as Ua,readFileSync as $a,writeFileSync as ag}from"node:fs";import{join as Ga}from"node:path";function Bi(){return Gr()}function Ha(){let e=Bi(),t=Ga(e,Ir);if(!Pi(t))return{};try{let o=$a(t,"utf-8");return JSON.parse(o)}catch{return{}}}function ja(e){let t=e.match(ht);return t?t[1]:null}function Ka(e){return ht.test(e)}function Va(){let e=Bi();if(!Pi(e))return[];let t=Ha(),o=Ua(e,{withFileTypes:!0}),r=[],i=0;for(let s of o){if(!s.isDirectory()||!Ka(s.name))continue;let l=ja(s.name);if(!l)continue;let d=t[s.name]??{};r.push({id:l,name:d.name??ao(l),description:d.description,priority:d.priority??i}),i++}return r.sort((s,l)=>s.name.localeCompare(l.name)),r}function Ho(e){let t=Va();if(t.length===0){let s=new Set(e.map(l=>l.category).filter(Boolean));t=Array.from(s).map((l,d)=>({id:l,name:ao(l),priority:d}))}let o=new Map;for(let s of t)o.set(s,[]);o.set(Er,[]);for(let s of e){let l=s.category??Mt,d=t.find(f=>f.id===l);!d&&l!==Mt&&(d={id:l,name:ao(l),priority:999},t.push(d),o.set(d,[]));let c=d??Er,u=o.get(c)??[];u.push(s),o.set(c,u)}for(let[s,l]of o)l.length===0&&o.delete(s);let r=new Map,i=Array.from(o.keys()).sort((s,l)=>s.name.localeCompare(l.name));for(let s of i){let l=o.get(s);l&&(l.sort((d,c)=>d.name.localeCompare(c.name)),r.set(s,l))}return r}function ct(){let[e,t]=jo([]),[o,r]=jo(!0),[i,s]=jo(null),[l,d]=jo(new Map);return Xa(()=>{let c=!0;return(async()=>{try{let f=await Ai();c&&(t(f),d(Ho(f)))}catch(f){c&&s(f instanceof Error?f.message:String(f))}finally{c&&r(!1)}})(),()=>{c=!1}},[]),{skills:e,loading:o,error:i,groupedSkills:l}}import{useState as Ya}from"react";function Li(e){let[t,o]=Ya(1);return{step:t,next:()=>o(l=>Math.min(l+1,e)),back:()=>o(l=>Math.max(l-1,1)),goTo:l=>o(l),isFirst:t===1,isLast:t===e,progress:t/e}}import{Box as bt,Text as Xo}from"ink";import mc from"ink-big-text";import Xr from"ink-gradient";import{useEffect as pc,useState as Mi}from"react";import{Box as Kr,Text as yo}from"ink";import{memo as za}from"react";var n={primary:"#3b82f6",primaryLight:"#60a5fa",primaryDark:"#1e3a8a",accent:"#06b6d4",accentLight:"#22d3ee",success:"#22c55e",warning:"#f59e0b",error:"#ef4444",text:"#f8fafc",textDim:"#94a3b8",textMuted:"#64748b",border:"#334155",bg:"#0f172a",bgLight:"#1e293b"};var a={bar:"\u2502",barEnd:"\u2514",radioActive:"\u25CF",radioInactive:"\u25CB",checkboxActive:"\u25FC",checkboxInactive:"\u25FB",diamond:"\u25C6",arrow:"\u203A",arrowRight:"\u2192",arrowUp:"\u2191",arrowDown:"\u2193",dot:"\xB7",bullet:"\u25B8",check:"\u2713",cross:"\u2717",star:"\u2605",sparkle:"\u2726",installed:"\u25CF",warning:"\u26A0",info:"\u2139"};import{jsx as Vo,jsxs as Ko}from"react/jsx-runtime";var dt=za(function({hints:t,status:o}){return Vo(Kr,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:Ko(Kr,{justifyContent:"space-between",width:"100%",children:[Vo(yo,{children:t.map((r,i)=>Ko(yo,{children:[i>0&&Ko(yo,{color:n.textDim,children:[" ",a.dot," "]}),Vo(yo,{color:r.color??n.accent,bold:!0,children:r.key}),Ko(yo,{color:n.textDim,children:[" ",r.label]})]},r.key))}),o&&Vo(Kr,{children:o})]})})});import{Box as kt,Text as Ue,useInput as Wa}from"ink";import{useMemo as Ja,useState as Ri}from"react";import{Fragment as qa,jsx as qe,jsxs as Qe}from"react/jsx-runtime";function Ze({items:e,onSelect:t,onCancel:o,initialIndex:r=0,itemLimit:i=10,hideFooter:s,footerRight:l}){let[d,c]=Ri(r),[u,f]=Ri(0);Wa((h,m)=>{m.upArrow&&(c(p=>Math.max(0,p-1)),d<=u&&f(p=>Math.max(0,p-1))),m.downArrow&&(c(p=>Math.min(e.length-1,p+1)),d>=u+i-1&&f(p=>Math.min(e.length-i,p+1))),m.return&&t(e[d].value),m.escape&&o&&o()});let g=Ja(()=>e.slice(u,u+i),[e,u,i]);return Qe(kt,{flexDirection:"column",children:[g.map((h,m)=>{let p=m+u===d;return Qe(kt,{backgroundColor:p?n.bgLight:void 0,paddingX:1,children:[qe(kt,{width:2,children:qe(Ue,{color:p?n.accent:n.textMuted,children:p?a.bullet:" "})}),Qe(Ue,{color:p?n.accent:n.text,bold:p,children:[p?a.radioActive:a.radioInactive," ",h.label]}),p&&h.hint&&Qe(Ue,{color:n.textDim,children:[" ",a.dot," ",h.hint]})]},`${h.label}-${m}`)}),e.length>i&&qe(kt,{marginTop:1,paddingX:1,children:Qe(Ue,{color:n.textDim,children:[a.arrowUp,a.arrowDown," ",u+1,"-",Math.min(u+i,e.length)," of ",e.length]})}),!s&&qe(kt,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:Qe(kt,{justifyContent:"space-between",width:"100%",children:[Qe(Ue,{children:[qe(Ue,{color:n.success,bold:!0,children:"enter"}),qe(Ue,{color:n.textDim,children:" select"}),o&&Qe(qa,{children:[Qe(Ue,{color:n.textDim,children:[" ",a.dot," "]}),qe(Ue,{color:n.warning,bold:!0,children:"esc"}),qe(Ue,{color:n.textDim,children:" back"})]})]}),l&&qe(kt,{children:l})]})})]})}import{Box as et,Text as Pe,useInput as Qa,useStdout as Za}from"ink";import{useCallback as ec,useEffect as tc,useRef as oc,useState as rc}from"react";import{jsx as me,jsxs as ko}from"react/jsx-runtime";var nc=100,tt=16,ic=50,sc=10,lc=30,ac=5,cc=["BANKRUPT. Your burn rate was too high.","DOWN ROUND. Valuation dropped to zero.","RUNWAY EXPIRED. Back to living with parents.","SERVER COSTS > REVENUE. You are cooked.","AUDIT FAILED. Too much tech debt."],dc=["ACQUIRED BY BIG TECH. Golden handcuffs on.","SERIES B SECURED. Keep burning cash!","IPO SUCCESSFUL. Time to buy a yacht.","PROFITABLE? No, but the vibes are great."],Ht=[["AGI_SOON","100x_DEV","LOVABLE","HYPE"],["DEEPSEEK","GEMINI","GPT","V0_DEV"],["TAB_SPAM","NO_READ","TRUST_ME","YOLO"],["SLOP","SPAGHETTI","ANY_TYPE","BUG"]];function uc(e){let t=[],r=Math.max(...Ht.flat().map(l=>l.length))+4,i=Ht[0].length*r,s=Math.floor((e-i)/2);for(let l=0;l<Ht.length;l++)for(let d=0;d<Ht[l].length;d++){let c=Ht[l][d];t.push({x:Math.max(0,s+d*r),y:1+l*2,label:c,width:c.length,alive:!0})}return t}function Vr({onExit:e}){let{stdout:t}=Za(),o=t?.columns??80,r=Math.max(60,Math.min(o-4,nc)),i=oc(""),[s,l]=rc(()=>({player:{x:Math.floor(r/2),y:tt-1},playerBullets:[],enemyBullets:[],invaders:uc(r),score:0,lives:5,gameOver:!1,won:!1,invaderDirection:1,tickCount:0,flash:!1,glitch:!1,rateLimited:0}));if((s.gameOver||s.won)&&!i.current){let g=s.won?dc:cc;i.current=g[Math.floor(Math.random()*g.length)]}Qa((g,h)=>{if(s.gameOver||s.won){(h.return||h.escape)&&e();return}if(h.escape){e();return}l(m=>{let p=m.player.x;h.leftArrow&&(p=Math.max(0,m.player.x-2)),h.rightArrow&&(p=Math.min(r-1,m.player.x+2));let T=m.playerBullets,P=m.rateLimited;return g===" "&&P===0&&(m.playerBullets.length>=2?(P=lc,T=[]):T=[...m.playerBullets,{x:p,y:m.player.y-1}]),{...m,player:{...m.player,x:p},playerBullets:T,rateLimited:P}})});let d=ec(()=>{l(g=>{if(g.gameOver||g.won)return g;let h=g.tickCount+1,m=g.score,p=g.lives,T=g.gameOver,P=!1,O=!1,U=g.rateLimited>0?g.rateLimited-1:0,k=g.invaders.filter(y=>y.alive),C=Ht.flat().length,A=k.length/C,S=Math.max(2,Math.floor(sc*A)+1),B=.02+.08*(1-A),F=g.playerBullets.map(y=>({...y,y:y.y-1})).filter(y=>y.y>=0),V=g.enemyBullets.map(y=>({...y,y:y.y+1})).filter(y=>y.y<tt),I=g.invaders.map(y=>({...y}));for(let y of F)if(y.y!==-1){for(let v of I)if(v.alive&&y.y===v.y&&y.x>=v.x&&y.x<v.x+v.width){v.alive=!1,y.y=-1,m+=100,P=!0;break}}if(F=F.filter(y=>y.y!==-1),V.some(y=>y.x===g.player.x&&y.y===g.player.y)&&(p-=1,P=!0,O=!0,V=[],p<=0&&(T=!0)),I.every(y=>!y.alive))return{...g,won:!0,score:m+p*1e3,invaders:I};if(k.length>0){let y=k.filter(v=>{let Q=g.player.x>=v.x-1&&g.player.x<=v.x+v.width+1;return Math.random()<(Q?B*ac:B)});if(y.length>0){let v=y[Math.floor(Math.random()*y.length)];V.push({x:v.x+Math.floor(v.width/2),y:v.y+1})}}let w=g.invaderDirection;if(h%S===0){let y=I.filter(Z=>Z.alive).map(Z=>Z.x),v=Math.min(...y);Math.max(...I.filter(Z=>Z.alive).map(Z=>Z.x+Z.width))>=r-2&&w===1&&(w=-1),v<=0&&w===-1&&(w=1),I.forEach(Z=>Z.alive&&(Z.x+=w))}return h%45===0&&(I.forEach(y=>y.alive&&(y.y+=1)),I.some(y=>y.alive&&y.y>=tt-1)&&(T=!0)),{...g,playerBullets:F,enemyBullets:V,invaders:I,score:m,lives:p,gameOver:T,invaderDirection:w,tickCount:h,flash:P,glitch:O,rateLimited:U}})},[r]);tc(()=>{let g=setInterval(d,ic);return()=>clearInterval(g)},[d]);let c=()=>{let g=Array.from({length:tt},()=>Array(r).fill(" "));s.invaders.forEach(p=>{if(p.alive)for(let T=0;T<p.width;T++)p.x+T<r&&p.y<tt&&(g[p.y][p.x+T]=s.glitch?"?":p.label[T])}),s.playerBullets.forEach(p=>{p.x<r&&p.y<tt&&(g[p.y][p.x]="$")}),s.enemyBullets.forEach(p=>{p.x<r&&p.y<tt&&(g[p.y][p.x]="*")});let{x:h,y:m}=s.player;return h<r&&m<tt&&(g[m][h]=s.rateLimited>0?"X":"^"),g.map(p=>p.join("")).join(`
11
- `)},u=s.rateLimited>0?n.error:n.accent,f=s.glitch?n.warning:s.flash?n.error:n.success;return me(et,{width:"100%",alignItems:"center",flexDirection:"column",children:ko(et,{width:r+4,flexDirection:"column",alignItems:"center",children:[ko(et,{width:r,flexDirection:"row",paddingX:1,children:[me(et,{width:"35%",children:me(Pe,{color:u,bold:!0,children:s.rateLimited>0?`LIMIT (${s.rateLimited})`:`$${s.score}k`})}),me(et,{width:"30%",justifyContent:"center",children:me(Pe,{color:n.warning,bold:!0,children:"VIBE INVADERS"})}),me(et,{width:"35%",justifyContent:"flex-end",children:ko(Pe,{color:n.success,bold:!0,children:["RUNWAY: ","$".repeat(s.lives)]})})]}),me(et,{borderStyle:"round",borderColor:s.rateLimited>0?n.error:n.border,flexDirection:"column",width:r+2,height:tt+2,children:me(Pe,{color:s.gameOver?n.error:f,children:c()})}),me(et,{marginTop:0,width:r+2,justifyContent:"center",borderStyle:"round",borderColor:n.accent,children:s.gameOver||s.won?ko(Pe,{color:s.won?n.success:n.error,bold:!0,children:[i.current," Val: $",s.score,"k"]}):ko(et,{gap:1,children:[me(Pe,{color:n.accent,children:"\u2190\u2192"}),me(Pe,{children:" move "}),me(Pe,{color:n.accent,children:"spc"}),me(Pe,{children:" shoot "}),me(Pe,{color:n.accent,children:"esc"}),me(Pe,{children:" quit"})]})})]})})}import{jsx as pe,jsxs as Yr}from"react/jsx-runtime";var gc=[{label:"Vibe Invaders",value:"invaders",hint:"Fight vibe-coding!"},{label:"Back",value:"back",hint:"Return to CLI"}],_i="\u2591".repeat(56);function zr({onExit:e}){let[t,o]=Mi("menu"),[r,i]=Mi(!0);pc(()=>{let l=setInterval(()=>i(d=>!d),600);return()=>clearInterval(l)},[]);let s=l=>{if(l==="back"){e();return}o(l)};return t==="invaders"?pe(Vr,{onExit:()=>o("menu")}):Yr(bt,{flexDirection:"column",alignItems:"center",children:[pe(bt,{marginBottom:0,children:pe(Xr,{name:"cristal",children:pe(Xo,{children:_i})})}),pe(bt,{marginBottom:0,children:pe(Xr,{name:"pastel",children:pe(mc,{text:"ARCADE",font:"chrome"})})}),pe(bt,{marginBottom:0,children:pe(Xr,{name:"cristal",children:pe(Xo,{children:_i})})}),pe(bt,{marginBottom:1,marginTop:1,children:Yr(Xo,{color:r?n.warning:n.bg,bold:!0,children:[a.sparkle," SECRET UNLOCKED ",a.sparkle]})}),pe(bt,{marginBottom:1,children:Yr(Xo,{color:n.textDim,children:[a.diamond," Choose your adventure ",a.diamond]})}),pe(bt,{width:50,children:pe(Ze,{items:gc,onSelect:s,onCancel:e,hideFooter:!0})}),pe(dt,{hints:[{key:"\u2191\u2193",label:"navigate"},{key:"\u23CE",label:"select"},{key:"esc",label:"back",color:n.warning}]})]})}import{Box as Ki,Text as zo,useInput as Uc}from"ink";import{Box as ot,Text as Ie}from"ink";import Hi from"ink-big-text";import Jr from"ink-gradient";import{useAtomValue as Oc}from"jotai";import{useMemo as Fc}from"react";Ar();import{atom as Bc}from"jotai";import{unwrap as Lc}from"jotai/utils";De();import{mkdir as fc,readFile as hc,writeFile as xc}from"node:fs/promises";import{homedir as yc}from"node:os";import{dirname as kc,join as bc}from"node:path";function Oi(){return bc(yc(),fr,En)}function Sc(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.lastUpdateCheck!="number"?null:{lastUpdateCheck:t.lastUpdateCheck,latestVersion:t.latestVersion??null}}async function Fi(){let e=Oi();try{let t=await hc(e,"utf-8"),o=JSON.parse(t);return Sc(o)}catch{return null}}async function Ni(e){let t=Oi(),o={lastUpdateCheck:Date.now(),latestVersion:e};await fc(kc(t),{recursive:!0}),await xc(t,JSON.stringify(o,null,2),"utf-8")}De();import vc from"package-json";import{createRequire as Cc}from"node:module";import{dirname as Tc,join as wc}from"node:path";import{fileURLToPath as Ac}from"node:url";var Ic=Ac(import.meta.url),Ec=Tc(Ic),Ui=Cc(import.meta.url),Yo;try{Yo=Ui("./package.json")}catch{Yo=Ui(wc(Ec,"../../package.json"))}var jt=Yo.version||"0.0.0",yf=Yo.description||"CLI to install and manage skills for AI coding agents";async function $i(e){try{if(Dc(e))return null;let t=await vc(Rt,{version:"latest"});return t.version!==e?t.version:null}catch{return null}}function Dc(e){return/-(alpha|beta|rc|snapshot|dev|canary|next)/i.test(e)}function Wr(){return jt}De();async function Rc(e){let t=await Fi(),o=t&&t.latestVersion!==e?t.latestVersion:null;try{let r=await Promise.race([$i(e),new Promise((i,s)=>setTimeout(()=>s(new Error("timeout")),3e3))]);return Ni(r??e).catch(()=>{}),r}catch{return o}}var Mc=async()=>{let e=Wr(),[t,o]=await Promise.all([Rc(e).catch(()=>null),Promise.resolve(wr()).catch(()=>!1)]);return{updateAvailable:t,currentVersion:e,isGlobal:o,isLoading:!1}},_c=Bc(Mc()),Gi=Lc(_c,e=>e??{updateAvailable:null,currentVersion:Wr(),isGlobal:!1,isLoading:!0});De();import{jsx as te,jsxs as rt}from"react/jsx-runtime";var ji=["#1e3a8a","#3b82f6","#0ea5e9","#06b6d4","#22d3ee"],Nc="\u2500",R=({notification:e})=>{let t=Oc(Gi),o=Fc(()=>{if(e)return e;let{updateAvailable:r,currentVersion:i,isGlobal:s,isLoading:l}=t;return l?null:r&&!s?rt(ot,{flexDirection:"column",alignItems:"center",children:[rt(Ie,{color:"yellow",children:[a.warning," ",We.UPDATE_AVAILABLE(i,r)]}),rt(Ie,{color:"blue",children:[a.info," ",We.TIP_INSTALL_UPDATE," ",te(Ie,{bold:!0,children:We.INSTALL_COMMAND})]})]}):r?rt(Ie,{color:"yellow",children:[a.warning," ",We.UPDATE_AVAILABLE(i,r)," (run"," ",te(Ie,{bold:!0,children:We.UPDATE_COMMAND}),")"]}):s?null:rt(Ie,{color:"blue",children:[a.info," ",We.TIP_INSTALL_ACCESS," ",te(Ie,{bold:!0,children:We.INSTALL_COMMAND})]})},[e,t]);return rt(ot,{flexDirection:"column",paddingBottom:1,children:[rt(ot,{flexDirection:"column",alignItems:"center",marginBottom:1,children:[te(ot,{marginBottom:-1,children:te(Jr,{colors:["#1e3a8a","#3b82f6"],children:te(Hi,{text:"TLC",font:"tiny"})})}),te(ot,{children:te(Jr,{colors:ji,children:te(Hi,{text:"AGENT SKILLS",font:"block"})})}),rt(ot,{marginTop:-1,alignItems:"center",children:[te(Ie,{color:"#334155",children:"\u2500\u2500\u2500\u2500\u2500\u2500 "}),rt(Ie,{color:"white",bold:!0,children:["VERSION ",jt]}),te(Ie,{color:"#334155",children:" \u2500\u2500\u2500\u2500\u2500\u2500"})]}),te(ot,{marginTop:1,children:te(Ie,{color:"#64748b",italic:!0,children:We.DESCRIPTION})}),o&&te(ot,{marginTop:1,children:o})]}),te(ot,{marginTop:o?0:1,justifyContent:"center",children:te(Jr,{colors:ji,children:te(Ie,{children:Nc.repeat(60)})})})]})};import{jsx as bo,jsxs as qr}from"react/jsx-runtime";function Vi({onSelect:e,onBack:t,onCredits:o}){let r=[{label:"Install new skills",value:"install",hint:"browse and select skills to install"},{label:"Update existing skills",value:"update",hint:"check for content changes"},{label:"Remove installed skills",value:"remove",hint:"uninstall skills from agents"}];Uc(s=>{s==="c"&&o&&o()});let i=qr(zo,{children:[bo(zo,{color:n.accent,bold:!0,children:"c"}),bo(zo,{color:n.textDim,children:" credits"})]});return qr(Ki,{flexDirection:"column",paddingX:1,children:[bo(R,{}),bo(Ki,{marginBottom:1,children:qr(zo,{bold:!0,color:n.primary,children:[a.diamond," What would you like to do?"]})}),bo(Ze,{items:r,onSelect:e,onCancel:t,footerRight:i})]})}import{Box as Yt,Text as Qr,useInput as Wc,useStdout as Jc}from"ink";import qc from"ink-spinner";import{useState as Qc}from"react";import{Box as Be,Text as Kt,useInput as Kc}from"ink";import{useEffect as Vc}from"react";import{useEffect as $c,useState as Gc}from"react";import{Fragment as Hc,jsx as jc}from"react/jsx-runtime";var Xi=({visible:e,duration:t=250,children:o})=>{let[r,i]=Gc(e?1:0);return $c(()=>{if(e&&r===1||!e&&r===0)return;let s=Date.now(),l=r,d=e?1:0,u=setInterval(()=>{let g=Date.now()-s,h=Math.min(g/t,1),m=l+(e?h:-h)*Math.abs(d-l),p=Math.max(0,Math.min(1,m));i(p),h>=1&&(clearInterval(u),i(d))},16);return()=>{clearInterval(u)}},[e,t]),!e&&r<=.05?null:jc(Hc,{children:o})};import{jsx as oe,jsxs as Wo}from"react/jsx-runtime";var Vt=({visible:e,onDismiss:t,shortcuts:o})=>{Kc(()=>{e&&t()},{isActive:e}),Vc(()=>{let u;return e&&(u=setTimeout(()=>{t()},8e3)),()=>{u&&clearTimeout(u)}},[e,t]);let r=Math.ceil(o.length/2),i=o.slice(0,r),s=o.slice(r),l=({label:u})=>oe(Be,{flexShrink:0,children:oe(Kt,{backgroundColor:n.bgLight,color:n.accent,bold:!0,children:` ${u} `})}),d=({entry:u})=>Wo(Be,{marginBottom:0,gap:1,children:[oe(Be,{width:10,justifyContent:"flex-end",flexShrink:0,children:oe(l,{label:u.key})}),oe(Kt,{color:n.textDim,children:u.description})]}),c="\u2500".repeat(48);return oe(Xi,{visible:e,duration:200,children:Wo(Be,{borderStyle:"round",borderColor:n.border,backgroundColor:n.bg,paddingX:2,paddingY:1,flexDirection:"column",width:56,children:[oe(Be,{justifyContent:"center",marginBottom:1,children:Wo(Kt,{color:n.accent,bold:!0,children:[a.sparkle," Keyboard Shortcuts"]})}),oe(Be,{justifyContent:"center",children:oe(Kt,{color:n.border,children:c})}),Wo(Be,{marginTop:1,gap:2,children:[oe(Be,{flexDirection:"column",gap:1,flexGrow:1,children:i.map(u=>oe(d,{entry:u},u.key))}),oe(Be,{flexDirection:"column",gap:1,flexGrow:1,children:s.map(u=>oe(d,{entry:u},u.key))})]}),oe(Be,{justifyContent:"center",marginTop:1,children:oe(Kt,{color:n.border,children:c})}),oe(Be,{marginTop:1,justifyContent:"center",children:oe(Kt,{color:n.textMuted,children:"press any key to dismiss"})})]})})};import{Box as St,Text as nt,useInput as Xc}from"ink";import{useEffect as Yc,useRef as zc,useState as Jo}from"react";import{jsx as Le,jsxs as Ct}from"react/jsx-runtime";function Xt({items:e,onSubmit:t,onCancel:o,onChange:r,initialSelected:i=[],limit:s=10}){let[l,d]=Jo(i),[c,u]=Jo(0),[f,g]=Jo(0),[h,m]=Jo(!1),p=zc(i);Yc(()=>{let k=p.current;(k.length!==i.length||k.some((A,S)=>A!==i[S]))&&(d(i),p.current=i)},[i]),Xc((k,C)=>{if(k==="?"){m(B=>!B);return}if(h){m(!1);return}if(C.return){t(l);return}if(C.escape&&o){o();return}let A=c,S=f;if(C.upArrow?A=c>0?c-1:e.length-1:C.downArrow&&(A=c<e.length-1?c+1:0),A<S?S=A:A>=S+s&&(S=A-s+1),C.upArrow&&c===0?S=Math.max(0,e.length-s):C.downArrow&&c===e.length-1&&(S=0),A!==c&&(u(A),g(S)),k===" "){let B=e[c];if(l.includes(B.value)){let F=l.filter(V=>V!==B.value);d(F),r?.(F)}else{let F=[...l,B.value];d(F),r?.(F)}}if(k==="a"&&C.ctrl)if(l.length===e.length)d([]),r?.([]);else{let B=e.map(F=>F.value);d(B),r?.(B)}});let T=e.slice(f,f+s),P=f>0,O=e.length>f+s,U=[{key:"\u2191/\u2193",description:"Navigate"},{key:"space",description:"Toggle selection"},{key:"enter",description:"Confirm"},{key:"ctrl+a",description:"Select all / none"},...o?[{key:"esc",description:"Cancel"}]:[]];return h?Le(St,{flexDirection:"column",flexGrow:1,alignItems:"center",justifyContent:"center",children:Le(Vt,{visible:h,onDismiss:()=>m(!1),shortcuts:U})}):Ct(St,{flexDirection:"column",children:[P&&Le(St,{justifyContent:"center",marginBottom:1,children:Ct(nt,{color:n.textDim,children:[a.arrowUp," ",a.arrowUp," ",a.arrowUp]})}),T.map((k,C)=>{let A=C+f,S=A===c,B=l.includes(k.value),F=S?a.bullet:" ",V=B?n.success:n.accent,I=B?a.checkboxActive:a.checkboxInactive,w=B?n.success:n.textMuted,y=S?n.primary:B?n.primaryLight:n.text;return Ct(St,{backgroundColor:S?n.bgLight:void 0,paddingX:1,children:[Le(St,{width:2,children:Le(nt,{color:V,children:F})}),Le(St,{width:2,children:Le(nt,{color:w,children:I})}),Le(nt,{color:y,bold:S,children:k.label}),k.hint&&Ct(nt,{color:B?n.success:n.textDim,children:[" ",a.dot," ",k.hint]})]},`${String(k.value)}-${A}`)}),O&&Le(St,{justifyContent:"center",marginTop:1,children:Ct(nt,{color:n.textDim,children:[a.arrowDown," ",a.arrowDown," ",a.arrowDown]})}),Le(dt,{hints:[{key:"space",label:"toggle"},{key:"enter",label:"confirm",color:n.success},...o?[{key:"esc",label:"back",color:n.warning}]:[],{key:"?",label:"help"}],status:l.length>0?Ct(nt,{children:[Ct(nt,{color:n.success,bold:!0,children:[a.checkboxActive," ",l.length]}),Le(nt,{color:n.textDim,children:" selected"})]}):void 0})]})}lo();import{Fragment as Yi,jsx as $e,jsxs as Tt}from"react/jsx-runtime";var Zc=28;function zt({onSelect:e,onBack:t}){let{stdout:o}=Jc(),r=o?.rows??40,i=Math.max(3,r-Zc),{allAgents:s,installedAgents:l,selectedAgents:d,setSelectedAgents:c,loading:u}=In(),f=[{key:"space",description:"Toggle selection"},{key:"enter",description:"Confirm"},{key:"ctrl+a",description:"Select all"},{key:"esc",description:"Go back"}],[g,h]=Qc(!1);Wc(p=>{p==="?"&&h(T=>!T)});let m=s.map(p=>{let T=Ne(p),P=l.includes(p);return{label:T.displayName,value:p,hint:P?`${a.check} detected`:void 0}});return u?Tt(Yt,{flexDirection:"column",paddingX:1,children:[$e(R,{}),$e(Yt,{marginTop:1,children:Tt(Qr,{color:n.accent,children:[$e(qc,{type:"dots"})," Scanning for installed agents..."]})})]}):Tt(Yt,{flexDirection:"column",paddingX:1,minHeight:20,children:[$e(R,{}),g?Tt(Yi,{children:[$e(Yt,{flexDirection:"column",flexGrow:1,alignItems:"center",justifyContent:"center",children:$e(Vt,{visible:g,onDismiss:()=>h(!1),shortcuts:f})}),$e(dt,{hints:[{key:"space",label:"toggle"},{key:"enter",label:"confirm",color:n.success},...t?[{key:"esc",label:"back",color:n.warning}]:[],{key:"?",label:"help"}]})]}):Tt(Yi,{children:[$e(Yt,{marginBottom:1,children:Tt(Qr,{bold:!0,color:n.primary,children:[a.diamond," Where do you want to install skills?"]})}),$e(Yt,{marginBottom:1,children:Tt(Qr,{color:n.textDim,children:[l.length," agents detected on this machine"]})}),$e(Xt,{items:m,initialSelected:d,onSubmit:e,onCancel:t,onChange:c,limit:i})]})]})}import{Box as ut,Text as H,useInput as sd,useStdout as ld}from"ink";import Zi from"ink-big-text";import or from"ink-gradient";import{existsSync as ad}from"node:fs";import{dirname as es,join as cd}from"node:path";import{fileURLToPath as dd}from"node:url";import{useCallback as ud,useEffect as tr,useMemo as md,useRef as ts,useState as Wt}from"react";import{execSync as ed,spawn as qo}from"node:child_process";import{platform as td}from"node:os";function od(e){try{return ed(`which ${e}`,{stdio:"ignore"}),!0}catch{return!1}}function rd(e){let t=[{cmd:"mpv",args:["--no-video","--no-terminal",e]},{cmd:"ffplay",args:["-nodisp","-autoexit","-loglevel","quiet",e]},{cmd:"paplay",args:[e]},{cmd:"aplay",args:[e]}];for(let{cmd:o,args:r}of t)if(od(o))return qo(o,r,{stdio:"ignore"});return qo("mpv",["--no-video","--no-terminal",e],{stdio:"ignore"})}function zi(e){try{let t=td(),o;return t==="darwin"?o=qo("afplay",[e],{stdio:"ignore"}):t==="win32"?o=qo("powershell",["-c",`(New-Object Media.SoundPlayer "${e}").PlaySync()`],{stdio:"ignore"}):o=rd(e),o.on("error",()=>{}),o}catch{return null}}function Qo(e){e&&!e.killed&&e.kill()}import Wi from"ky";var Ji="https://api.github.com/repos/tech-leads-club/agent-skills",nd=`${Ji}/contributors`,Zo=null,er=null;async function qi(){if(Zo)return Zo;try{return Zo=(await Wi.get(nd,{headers:{Accept:"application/vnd.github.v3+json"},timeout:1e4}).json()).filter(({login:t})=>!id(t)).map(({login:t,avatar_url:o,contributions:r})=>({login:t,avatarUrl:o,contributions:r})),Zo}catch{return[]}}async function Qi(){if(er!==null)return er;try{return er=(await Wi.get(Ji,{headers:{Accept:"application/vnd.github.v3+json"},timeout:1e4}).json()).stargazers_count,er}catch{return 0}}function id(e){return e.endsWith("[bot]")}import{jsx as N,jsxs as Re}from"react/jsx-runtime";var pd=220,on=52,Jt=["#1e3a8a","#3b82f6","#0ea5e9","#06b6d4","#22d3ee"],gd=14,tn=500,rs=60,Zr="\u2500".repeat(on-4),os=40,en=["#f59e0b","#ef4444","#ec4899","#a855f7"],fd={1:{badge:`${a.star}${a.star}${a.star}`,color:"#f59e0b"},2:{badge:`${a.star}${a.star}`,color:"#c0c0c0"},3:{badge:a.star,color:"#cd7f32"}};function hd(e,t){let o=[];o.push({type:"blank"}),o.push({type:"text",text:"A Tech Leads Club Production",color:"#94a3b8"}),o.push({type:"blank"}),o.push({type:"blank"}),o.push({type:"gradient",text:`${a.sparkle} C O N T R I B U T O R S ${a.sparkle}`,gradientColors:en}),o.push({type:"gradient",text:Zr,gradientColors:Jt}),o.push({type:"blank"});for(let i=0;i<e.length;i++){let s=e[i];o.push({type:"contributor",rank:i+1,login:s.login,contributions:s.contributions})}o.push({type:"blank"}),o.push({type:"blank"}),o.push({type:"gradient",text:`${a.star} S T A T S ${a.star}`,gradientColors:en}),o.push({type:"gradient",text:Zr,gradientColors:Jt}),o.push({type:"blank"}),t>0&&o.push({type:"text",text:`${a.star} GitHub Stars \xB7\xB7\xB7\xB7\xB7 ${t}`,color:"#f59e0b",bold:!0}),o.push({type:"text",text:`${a.diamond} Contributors \xB7\xB7\xB7\xB7\xB7 ${e.length}`,color:"#06b6d4"});let r=e.reduce((i,s)=>i+s.contributions,0);return o.push({type:"text",text:`${a.check} Contributions \xB7\xB7\xB7\xB7 ${r}`,color:"#22c55e"}),o.push({type:"blank"}),o.push({type:"blank"}),o.push({type:"gradient",text:`${a.sparkle} S P E C I A L T H A N K S ${a.sparkle}`,gradientColors:en}),o.push({type:"gradient",text:Zr,gradientColors:Jt}),o.push({type:"blank"}),o.push({type:"text",text:"To every contributor, stargazer,",color:"#94a3b8"}),o.push({type:"text",text:"and community member who makes",color:"#94a3b8"}),o.push({type:"text",text:"this project possible.",color:"#94a3b8"}),o.push({type:"blank"}),o.push({type:"text",text:"Built with \u2665 by the community",color:"#ef4444"}),o.push({type:"blank"}),o.push({type:"gradient",text:"github.com/tech-leads-club/agent-skills",gradientColors:Jt}),o.push({type:"blank"}),o.push({type:"blank"}),o.push({type:"blank"}),o}function xd(){try{let e=es(dd(import.meta.url));for(let t=0;t<5;t++){let o=cd(e,"assets","chiptune.mp3");if(ad(o))return o;e=es(e)}return null}catch{return null}}function yd({rank:e,login:t,contributions:o}){let r=fd[e],i=r?.color??"#e2e8f0",s=e.toString().padStart(2),l=`@${t}`,d=`${o}`,c=r?` ${r.badge}`:"",u=5+l.length+c.length+1+d.length,f=Math.max(2,on-4-u),g="\xB7".repeat(f);return Re(H,{children:[Re(H,{color:"#64748b",children:[s,". "]}),N(H,{color:i,bold:!!r,children:l}),N(H,{color:r?.color??"#94a3b8",children:c}),Re(H,{color:"#334155",children:[" ",g," "]}),N(H,{color:"#22c55e",bold:!0,children:d})]})}function kd({line:e}){switch(e.type){case"blank":return N(H,{children:" "});case"text":return N(H,{color:e.color,bold:e.bold,children:e.text});case"gradient":return N(or,{colors:[...e.gradientColors],children:N(H,{children:e.text})});case"contributor":return N(yd,{rank:e.rank,login:e.login,contributions:e.contributions})}}function bd({speed:e,paused:t}){if(t)return Re(H,{color:n.warning,bold:!0,children:[" ",a.bar,a.bar," PAUSED"]});let o=Math.round((tn-e)/(tn-rs)*4)+1,r="\u25AE".repeat(o)+"\u25AF".repeat(5-o);return Re(H,{color:n.textMuted,children:[" ",r]})}function rr({onExit:e}){let{stdout:t}=ld(),o=t?.rows??24,r=Math.max(6,o-gd-4),[i,s]=Wt([]),[l,d]=Wt(0),[c,u]=Wt(!0),[f,g]=Wt(0),[h,m]=Wt(pd),[p,T]=Wt(!1),P=ts(null),O=ts(null);tr(()=>{Promise.all([qi(),Qi()]).then(([w,y])=>{s(w),d(y),u(!1)})},[]),tr(()=>{let w=xd();return w&&(P.current=zi(w)),()=>{Qo(P.current)}},[]);let U=md(()=>hd(i,l),[i,l]),k=U.length+r,C=f>=k,A=ud(()=>{g(w=>w>=k?w:w+1)},[k]);if(tr(()=>{if(c||p||C){O.current&&clearInterval(O.current),O.current=null;return}return O.current=setInterval(A,h),()=>{O.current&&clearInterval(O.current)}},[c,p,C,h,A]),tr(()=>{if(!C)return;let w=setTimeout(()=>{Qo(P.current),e()},3e3);return()=>clearTimeout(w)},[C,e]),sd((w,y)=>{if(y.escape){Qo(P.current),e();return}if(w===" "){T(v=>!v);return}if(y.upArrow){m(v=>Math.max(rs,v-os));return}if(y.downArrow){m(v=>Math.min(tn,v+os));return}}),c)return N(ut,{flexDirection:"column",alignItems:"center",padding:2,children:N(H,{color:n.accent,children:"Loading contributors..."})});let S={type:"blank"},B=Array(r).fill(S),F=Array(r).fill(S),I=[...B,...U,...F].slice(f,f+r);return Re(ut,{flexDirection:"column",alignItems:"center",children:[N(ut,{marginBottom:-1,children:N(or,{colors:["#1e3a8a","#3b82f6"],children:N(Zi,{text:"TLC",font:"tiny"})})}),N(ut,{children:N(or,{colors:[...Jt],children:N(Zi,{text:"AGENT SKILLS",font:"block"})})}),N(ut,{children:N(or,{colors:[...Jt],children:N(H,{children:"\u2500".repeat(60)})})}),N(ut,{flexDirection:"column",alignItems:"center",height:r,width:on,children:I.map((w,y)=>N(ut,{justifyContent:"center",children:N(kd,{line:w})},`cl-${f}-${y}`))}),Re(ut,{marginTop:1,gap:2,children:[Re(H,{children:[N(H,{color:n.accent,bold:!0,children:"space"}),N(H,{color:n.textDim,children:" pause"})]}),N(H,{color:n.textMuted,children:a.dot}),Re(H,{children:[Re(H,{color:n.accent,bold:!0,children:[a.arrowUp,a.arrowDown]}),N(H,{color:n.textDim,children:" speed"})]}),N(bd,{speed:h,paused:p}),N(H,{color:n.textMuted,children:a.dot}),Re(H,{children:[N(H,{color:n.warning,bold:!0,children:"esc"}),N(H,{color:n.textDim,children:" back"})]})]})]})}import{Box as xe,Text as W,useInput as Sd}from"ink";import{useState as rn}from"react";import{jsx as $,jsxs as ye}from"react/jsx-runtime";function ns({onConfirm:e,onBack:t,initialMethod:o="copy",initialGlobal:r=!1}){let[i,s]=rn("method"),[l,d]=rn(o),[c,u]=rn(r);return i==="method"?ye(xe,{flexDirection:"column",paddingX:1,children:[$(R,{}),$(xe,{marginBottom:1,children:ye(W,{bold:!0,color:n.primary,children:[a.diamond," Choose installation method:"]})}),$(Ze,{items:[{label:"Copy",value:"copy",hint:"independent copies (recommended)"},{label:"Symlink",value:"symlink",hint:"shared source (may not work with all agents)"}],onSelect:f=>{d(f),s("scope")},onCancel:t})]}):i==="scope"?ye(xe,{flexDirection:"column",paddingX:1,children:[$(R,{}),$(xe,{marginBottom:1,children:ye(W,{bold:!0,color:n.primary,children:[a.diamond," Choose installation scope:"]})}),$(Ze,{items:[{label:"Local",value:!1,hint:"this project only"},{label:"Global",value:!0,hint:"user home directory"}],onSelect:f=>{u(f),s("confirm")},onCancel:()=>s("method")})]}):$(Cd,{method:l,isGlobal:c,onConfirm:()=>e({method:l,global:c}),onBack:()=>s("scope")})}function Cd({method:e,isGlobal:t,onConfirm:o,onBack:r}){return Sd((i,s)=>{(s.return||i==="y"||i==="Y")&&o(),(s.escape||i==="n"||i==="N")&&r()}),ye(xe,{flexDirection:"column",paddingX:1,children:[$(R,{}),ye(xe,{flexDirection:"column",borderStyle:"round",borderColor:n.accent,paddingX:2,paddingY:1,children:[$(xe,{marginBottom:1,children:ye(W,{bold:!0,color:n.accent,children:[a.diamond," Ready to install"]})}),ye(xe,{children:[$(xe,{width:10,children:$(W,{color:n.textDim,children:"Method"})}),$(W,{color:n.text,bold:!0,children:e==="copy"?"Copy":"Symlink"}),ye(W,{color:n.textMuted,children:[" ",a.dot," ",e==="copy"?"Recommended":"Developer mode"]})]}),ye(xe,{children:[$(xe,{width:10,children:$(W,{color:n.textDim,children:"Scope"})}),$(W,{color:n.text,bold:!0,children:t?"Global":"Local"}),ye(W,{color:n.textMuted,children:[" ",a.dot," ",t?"User home":"This project"]})]})]}),$(xe,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:$(xe,{justifyContent:"space-between",width:"100%",children:ye(W,{children:[$(W,{color:n.success,bold:!0,children:"Y"}),$(W,{color:n.textDim,children:" / "}),$(W,{color:n.success,bold:!0,children:"enter"}),$(W,{color:n.textDim,children:" confirm"}),ye(W,{color:n.textDim,children:[" ",a.dot," "]}),$(W,{color:n.warning,bold:!0,children:"N"}),$(W,{color:n.textDim,children:" / "}),$(W,{color:n.warning,bold:!0,children:"esc"}),$(W,{color:n.textDim,children:" back"})]})})})]})}import{Box as Et,Text as vt,useInput as cu}from"ink";import du from"ink-spinner";import{useAtom as As,useAtomValue as uu,useSetAtom as mu}from"jotai";import{useEffect as pu,useMemo as gu,useState as It}from"react";lo();Gt();import{atom as is}from"jotai";import{unwrap as Td}from"jotai/utils";var wd=async()=>{let e=wo(),t={};for(let o of e){let[r,i]=await Promise.all([$r(o,!1).catch(()=>[]),$r(o,!0).catch(()=>[])]);for(let s of new Set([...r,...i]))t[s]||(t[s]=[]),t[s].includes(o)||t[s].push(o)}return t},nn=is(0),Ad=is(async e=>(e(nn),wd())),Ge=Td(Ad,e=>e??{});import{atom as ss}from"jotai";var nr=ss([]),ls=ss([]);import{Box as He,Text as ie,useInput as Id}from"ink";import{jsx as se,jsxs as Me}from"react/jsx-runtime";function ir({results:e,onExit:t,title:o="Installation Complete",successLabel:r="succeeded"}){Id((m,p)=>{(p.return||p.escape)&&t()});let i=new Set(e.filter(m=>m.success).map(m=>m.skill)),s=new Set(e.filter(m=>!m.success).map(m=>m.skill)),l=i.size,d=s.size,c=l===0&&d>0,u=d>0,f=c?n.error:u?n.warning:n.success,g=c?`${a.cross} Installation Failed`:u?`${a.warning} Partially Installed`:`${a.check} ${o}`,h=c?n.error:u?n.warning:n.success;return Me(He,{flexDirection:"column",paddingX:1,children:[se(R,{}),Me(He,{flexDirection:"column",borderStyle:"round",borderColor:f,paddingX:2,paddingY:1,children:[se(He,{marginBottom:1,children:se(ie,{color:h,bold:!0,children:g})}),e.map((m,p)=>Me(He,{flexDirection:"column",children:[Me(He,{paddingX:1,children:[se(He,{width:2,children:se(ie,{color:m.success?n.success:n.error,children:m.success?a.check:a.cross})}),se(ie,{color:m.success?n.text:n.error,children:m.skill}),Me(ie,{color:n.textDim,children:[" ",a.arrow," ",m.agent]})]}),!m.success&&m.error&&se(He,{paddingLeft:4,children:se(ie,{color:n.error,dimColor:!0,children:m.error})})]},p)),(l>0||d>0)&&se(He,{marginTop:1,children:Me(ie,{color:n.textDim,children:[l>0&&Me(ie,{color:n.success,children:[l," ",r]}),l>0&&d>0&&Me(ie,{children:[" ",a.dot," "]}),d>0&&Me(ie,{color:n.error,children:[d," failed"]})]})}),se(He,{marginTop:1,children:Me(ie,{color:n.textDim,children:["View details: ",se(ie,{color:n.accent,children:"agent-skills audit"})]})})]}),se(He,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:Me(ie,{children:[se(ie,{color:n.success,bold:!0,children:"enter"}),se(ie,{color:n.textDim,children:" / "}),se(ie,{color:n.warning,bold:!0,children:"esc"}),se(ie,{color:n.textDim,children:" exit"})]})})]})}import{Box as X,Text as G,useInput as Pd}from"ink";import Bd from"ink-spinner";import{useAtomValue as as}from"jotai";import{useMemo as sn,useState as ln}from"react";Je();import{atom as Ed}from"jotai";import{unwrap as vd}from"jotai/utils";var Dd=Ed(async()=>Mo()),qt=vd(Dd,e=>e??new Map);import{jsx as M,jsxs as K}from"react/jsx-runtime";function sr({selectedAgents:e,onExit:t}){let[o,r]=ln(e||[]),{removeMultiple:i,progress:s,results:l}=vi(),d=as(Ge),c=as(qt),[u,f]=ln(e?"select":"agent-select"),[g,h]=ln([]),m=e||o,p=sn(()=>{let k={};return Object.entries(d).forEach(([C,A])=>{let S=A.filter(B=>m.includes(B));S.length>0&&(k[C]=S)}),k},[d,m]),T=sn(()=>Object.keys(p),[p]),P=sn(()=>T.map(k=>{let C=c instanceof Map&&c.has(k),A=`${p[k].length} agents: ${p[k].join(", ")}`,S=C?`${A} \u26A0 deprecated`:A;return{label:k,value:k,hint:S}}),[T,p,c]);if(Pd((k,C)=>{u==="done"&&(C.return||C.escape)&&t(),T.length===0&&C.escape&&t()}),u==="agent-select")return M(zt,{onSelect:k=>{r(k),f("select")},onBack:t});if(T.length===0)return K(X,{flexDirection:"column",paddingX:1,children:[M(R,{}),M(X,{borderStyle:"round",borderColor:n.warning,paddingX:2,paddingY:1,children:M(G,{color:n.warning,children:"No skills found to remove for the selected agents."})}),M(X,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:K(G,{children:[M(G,{color:n.warning,bold:!0,children:"esc"}),M(G,{color:n.textDim,children:" exit"})]})})]});let O=k=>{k.length!==0&&(h(k),f("confirm"))},U=async()=>{f("removing");let k=g.map(C=>({name:C,agents:p[C]||[]}));await i(k),f("done")};if(u==="select")return K(X,{flexDirection:"column",paddingX:1,children:[M(R,{}),M(X,{marginBottom:1,children:K(G,{bold:!0,color:n.error,children:[a.diamond," Select skills to remove:"]})}),M(Xt,{items:P,onSubmit:O,onCancel:t})]});if(u==="confirm")return K(X,{flexDirection:"column",paddingX:1,children:[M(R,{}),K(X,{flexDirection:"column",borderStyle:"round",borderColor:n.error,paddingX:2,paddingY:1,children:[M(X,{marginBottom:1,children:K(G,{color:n.error,bold:!0,children:[a.cross," Remove ",g.length," skill",g.length>1?"s":"","?"]})}),g.map(k=>K(X,{paddingX:1,children:[M(X,{width:2,children:M(G,{color:n.error,children:a.dot})}),M(G,{color:n.textDim,children:k})]},k))]}),M(X,{marginTop:1,children:M(Ze,{items:[{label:"Yes, remove them",value:"yes"},{label:"No, cancel",value:"no"}],onSelect:k=>{k==="yes"?U():f("select")}})})]});if(u==="removing")return K(X,{flexDirection:"column",paddingX:1,children:[M(R,{}),K(X,{marginTop:1,children:[K(G,{color:n.accent,children:[M(Bd,{type:"dots"})," "]}),M(G,{children:"Removing skills..."})]}),M(X,{marginTop:1,paddingX:2,children:K(G,{color:n.textDim,children:[a.arrow," ",s.skill," (",s.current,"/",s.total,")"]})})]});if(u==="done"){let k=l.filter(S=>S.success).length,C=l.filter(S=>!S.success).length,A=k===0;return K(X,{flexDirection:"column",paddingX:1,children:[M(R,{}),K(X,{flexDirection:"column",borderStyle:"round",borderColor:A?n.error:n.success,paddingX:2,paddingY:1,children:[M(X,{marginBottom:1,children:K(G,{color:A?n.error:n.success,bold:!0,children:[A?a.cross:a.check," ",A?"Removal Failed":"Removal Complete"]})}),l.map((S,B)=>K(X,{paddingX:1,children:[M(X,{width:2,children:M(G,{color:S.success?n.success:n.error,children:S.success?a.check:a.cross})}),M(G,{color:S.success?n.text:n.error,children:S.skill}),K(G,{color:n.textDim,children:[" ",a.arrow," ",S.agent]}),!S.success&&S.error&&K(G,{color:n.error,children:[" (",S.error,")"]})]},B)),(k>0||C>0)&&M(X,{marginTop:1,children:K(G,{color:n.textDim,children:[k>0&&K(G,{color:n.success,children:[k," succeeded"]}),k>0&&C>0&&K(G,{children:[" ",a.dot," "]}),C>0&&K(G,{color:n.error,children:[C," failed"]})]})})]}),M(X,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:K(G,{children:[M(G,{color:n.success,bold:!0,children:"enter"}),M(G,{color:n.textDim,children:" / "}),M(G,{color:n.warning,bold:!0,children:"esc"}),M(G,{color:n.textDim,children:" exit"})]})})]})}return null}import{Box as q,Text as Ee,useInput as Zd,useStdout as eu}from"ink";import{useAtomValue as un}from"jotai";import{useMemo as mn,useState as it}from"react";import{Box as ds,Text as Qt}from"ink";import{useMemo as Ld}from"react";function cs(e,t){return e>0?`(${e}/${t})`:`(${t})`}import{jsx as lr,jsxs as ar}from"react/jsx-runtime";var us=({name:e,totalCount:t,installedCount:o=0,isExpanded:r=!1,isFocused:i=!1})=>{let s=Ld(()=>cs(o,t),[o,t]),l=r?"\u25BE":"\u25B8";return ar(ds,{children:[lr(ds,{width:2,children:i?lr(Qt,{color:n.accent,children:a.bullet}):lr(Qt,{children:" "})}),ar(Qt,{color:i?n.accent:n.primaryLight,bold:!0,children:[l," "]}),lr(Qt,{color:i?n.accent:n.text,bold:!0,children:e}),ar(Qt,{color:o>0?n.success:n.textMuted,children:[" ",s]}),!r&&i&&ar(Qt,{color:n.textDim,children:[" ",a.dot," press space to expand"]})]})};import{Box as Lx,Text as Rx,useInput as Mx}from"ink";import{useState as Ox}from"react";import{jsx as Ux,jsxs as $x}from"react/jsx-runtime";import{Box as cr,Text as ms}from"ink";import Rd from"ink-text-input";import{jsx as Zt,jsxs as Md}from"react/jsx-runtime";var ps=({query:e,onChange:t,total:o,filtered:r,isLoading:i=!1,focus:s=!0})=>Md(cr,{borderStyle:"round",borderColor:s?n.accent:n.border,paddingX:1,children:[Zt(cr,{marginRight:1,children:Zt(ms,{children:"\u{1F50D}"})}),Zt(cr,{flexGrow:1,children:Zt(Rd,{value:e,onChange:t,placeholder:"Type to filter skills...",focus:s})}),Zt(cr,{marginLeft:1,children:Zt(ms,{color:n.textDim,children:i?"Loading...":`${r}/${o} skills`})})]});import{Box as wt,Text as dr}from"ink";import{Box as _d,Text as Od}from"ink";import{jsx as Ud,jsxs as Nd}from"react/jsx-runtime";var Fd={installed:{icon:a.check,label:"installed",color:n.success,bg:"#052e16"},update:{icon:a.arrowUp,label:"update",color:n.warning,bg:"#422006"},new:{icon:a.sparkle,label:"new",color:n.accent,bg:"#083344"},deprecated:{icon:a.warning,label:"deprecated",color:n.warning,bg:"#422006"}};function gs({status:e}){let t=Fd[e];return t?Ud(_d,{children:Nd(Od,{backgroundColor:t.bg,color:t.color,children:[" ",t.icon," ",t.label," "]})}):null}import{jsx as je,jsxs as fs}from"react/jsx-runtime";function hs({name:e,description:t,status:o,selected:r=!1,focused:i=!1,readOnly:s=!1}){let l=o==="installed",d=l?a.checkboxActive:r?a.checkboxActive:a.checkboxInactive,c=l?n.textMuted:r?n.success:n.textMuted,u=i?a.bullet:" ",f=l?n.textMuted:r?n.success:n.accent,g=l?n.textDim:i?n.primary:r?n.primaryLight:n.text,h=n.textMuted,m=i?n.bgLight:void 0;return fs(wt,{flexDirection:"column",backgroundColor:m,children:[fs(wt,{children:[je(wt,{width:2,flexShrink:0,children:je(dr,{color:f,children:u})}),!s&&je(wt,{width:2,flexShrink:0,children:je(dr,{color:c,children:d})}),je(wt,{flexGrow:1,children:je(dr,{bold:!0,color:g,children:e})}),o&&je(wt,{marginLeft:1,flexShrink:0,children:je(gs,{status:o})})]}),je(wt,{paddingLeft:s?2:4,children:je(dr,{color:h,wrap:"truncate",children:t})})]})}import Ke from"chalk";import{Box as At,Text as re,useInput as $d,useStdout as Gd}from"ink";import Hd from"ink-spinner";import ks,{useCallback as jd,useEffect as Kd,useMemo as Vd,useRef as cn,useState as Xd}from"react";var an={web:"#3b82f6",devops:"#10b981",data:"#8b5cf6",mobile:"#f59e0b",testing:"#ef4444",ai:"#06b6d4",security:"#ec4899",default:"#64748b"};function xs(e){return Object.prototype.hasOwnProperty.call(an,e)?an[e]:an.default}co();import{Fragment as qd,jsx as fe,jsxs as be}from"react/jsx-runtime";var Yd=6,zd=2,Wd=2,ke={h1:e=>Ke.hex(n.primary).bold(e),h2:e=>Ke.hex(n.primaryLight).bold(e),h3:e=>Ke.hex(n.accent).bold(e),text:e=>Ke.hex(n.textDim)(e),muted:e=>Ke.hex(n.textMuted)(e),code:e=>Ke.hex(n.accent)(e),border:e=>Ke.hex(n.border)(e),bold:e=>Ke.hex(n.text).bold(e),dim:e=>Ke.dim(e),indicator:e=>Ke.hex(n.textDim)(e)};function ys(e){return e.replace(/\*\*(.+?)\*\*/g,(t,o)=>ke.bold(o)).replace(/\*(.+?)\*/g,(t,o)=>ke.dim(o)).replace(/`(.+?)`/g,(t,o)=>ke.code(o))}function Jd(e){let t=[];for(let o of e)switch(o.type){case"heading":{let r=o.level===1?a.diamond:o.level===2?a.arrow:a.dot,i=o.level===1?ke.h1:o.level===2?ke.h2:ke.h3;o.level===1&&t.length>0&&t.push(""),t.push(i(`${r} ${o.text}`));break}case"paragraph":t.push(ke.text(ys(o.text)));break;case"list-item":{let r=" ".repeat(o.indent);t.push(`${r}${ke.muted(a.bullet)} ${ke.text(ys(o.text))}`);break}case"code-block":o.language&&t.push(ke.dim(` ${o.language}`));for(let r of o.lines)t.push(` ${ke.border(a.bar)} ${ke.code(r)}`);break;case"hr":t.push(ke.border("\u2500".repeat(30)));break;case"blank":t.push("");break}return t}var bs=ks.memo(({skill:e,metadata:t})=>{let o=xs(e.category??"default"),r=t?.author?` ${a.dot} @${t.author}`:"",i=t?.files?.length?` ${a.dot} ${t.files.length} file${t.files.length!==1?"s":""}`:"";return be(At,{flexDirection:"column",marginBottom:1,children:[be(re,{bold:!0,color:n.text,children:[a.sparkle," ",e.name]}),be(re,{children:[fe(re,{color:o,bold:!0,children:e.category}),be(re,{color:n.textDim,children:[r,i]})]}),fe(re,{color:n.textDim,wrap:"truncate",children:e.description})]})});bs.displayName="MetadataHeader";var dn=ks.memo(({skill:e,expanded:t=!1,onClose:o,onToggleExpand:r})=>{let{metadata:i,content:s,loading:l,error:d}=Di(e?.name??null),{stdout:c}=Gd(),[u,f]=Xd(0),g=c?.rows??24,h=Vd(()=>s?Jd(Yn(s)):[],[s]),m=Math.max(10,g-17),p=Math.max(3,m-Yd-zd),T=Math.max(1,p-Wd),P=Math.max(0,h.length-T),O=P>0,U=O?Math.round((u+T)/h.length*100):100,k=cn(P);k.current=P;let C=cn(o);C.current=o;let A=cn(r);A.current=r;let S=jd((I,w)=>{w.upArrow?f(y=>Math.max(0,y-1)):w.downArrow?f(y=>Math.min(k.current,y+1)):I==="f"?A.current?.():(w.escape||w.tab||w.leftArrow)&&C.current()},[]);if($d(S),Kd(()=>{f(0)},[e?.name]),!e)return null;let B=u>0,F=u+T<h.length,V=h.slice(u,u+T);return be(At,{flexDirection:"column",borderStyle:"round",borderColor:n.accent,paddingX:1,flexGrow:1,children:[be(At,{children:[be(re,{bold:!0,color:n.accent,children:[a.info," Skill Details"]}),fe(At,{flexGrow:1}),be(re,{color:n.textMuted,children:[O&&be(re,{color:n.textDim,children:[U,"% ",a.dot," "]}),fe(re,{color:n.accent,bold:!0,children:"\u2191\u2193"})," ","scroll ",a.dot," ",fe(re,{color:n.accent,bold:!0,children:"f"})," ",t?"compact":"expand"," ",a.dot," ",fe(re,{color:n.accent,bold:!0,children:"Esc"})," ","close"]})]}),fe(re,{color:n.border,wrap:"truncate",children:"\u2500".repeat(200)}),l?fe(At,{alignItems:"center",justifyContent:"center",flexGrow:1,children:be(re,{color:n.accent,children:[fe(Hd,{type:"dots"})," Loading\u2026"]})}):d?fe(At,{alignItems:"center",justifyContent:"center",flexGrow:1,children:be(re,{color:n.error,children:[a.cross," ",d]})}):be(qd,{children:[fe(bs,{skill:e,metadata:i}),be(At,{flexDirection:"column",height:p,overflowY:"hidden",children:[B&&fe(re,{color:n.textDim,children:` ${a.arrowUp} ${a.arrowUp} ${a.arrowUp}`}),fe(re,{children:V.join(`
12
- `)}),F&&fe(re,{color:n.textDim,children:` ${a.arrowDown} ${a.arrowDown} ${a.arrowDown}`})]})]})]})});dn.displayName="SkillDetailPanel";function Qd(){return{width:process.stdout.columns||80,height:process.stdout.rows||24}}function Ss(){let{width:e,height:t}=Qd();return e>=80&&t>=24}import{Fragment as iu,jsx as j,jsxs as le}from"react/jsx-runtime";var tu=5,ou=24,ru=.35,nu=e=>{let t=[{key:"/",description:"Filter skills"},{key:"\u2190/\u2192",description:"Collapse / expand"},{key:"tab/\u2192",description:"Skill details"},{key:"f",description:"Expand / compact panel"}],o={key:"esc",description:e?"Exit / close panel":"Back / close panel"};return e?[...t,o]:[...t,{key:"space",description:"Toggle / expand"},{key:"enter",description:"Install selected"},{key:"ctrl+a",description:"Select all"},o]},ur=({onInstall:e,onExit:t,overrideSkills:o,readOnly:r=!1})=>{let{skills:i,loading:s,error:l}=ct(),{stdout:d}=eu(),c=un(nr),u=un(Ge),f=un(qt),g=o||i,h=o?!1:s,{query:m,setQuery:p,filtered:T}=Rn(g,{keys:["name","description","category"]}),[P,O]=it(new Set),[U,k]=it("list"),[C,A]=it(0),[S,B]=it(0),[F,V]=it(!1),[I,w]=it(!1),[y,v]=it(null),[Q,Z]=it(!1),[So,Ye]=it(null),ee=Ss(),Oe=d?.rows??40,pr=d?.columns??120,ze=Math.max(tu,Oe-ou),Hs=Math.max(30,Math.round(pr*ru)),js=Math.max(10,Oe-17),hn=m.trim().length>0,xn=mn(()=>Ho(T),[T]);mn(()=>{m&&V(!0)},[m]);let no=x=>hn||So===x,yn=x=>{Ye(no(x)?null:x)},Ce=mn(()=>{let x=[];for(let[L,Te]of xn.entries()){let Bt=Te.filter(io=>{let Co=u[io.name]||[];return c.length>0?Co.some(Sn=>c.includes(Sn)):Co.length>0}).length;x.push({type:"header",category:L.name,categoryId:L.id,count:Te.length,installedCount:Bt}),no(L.name)&&Te.forEach(io=>x.push({type:"skill",skill:io}))}return x},[xn,So,hn,u,c]),Ks=()=>w(x=>!x),Vs=()=>{if(F){V(!1),p(""),k("list");return}t?.()},Xs=()=>{let x=T.map(L=>L.name);O(P.size===x.length?new Set:new Set(x))},Ys=x=>{(x.downArrow||x.return)&&Ce.length>0&&(k("list"),A(0))},zs=()=>{if(C===0&&F){k("search");return}let x=Math.max(0,C-1);A(x),x<S&&B(x)},Ws=()=>{let x=Math.min(Ce.length-1,C+1);A(x),x>=S+ze&&B(x-ze+1)},Js=()=>{let x=Ce[C];if(x.type==="header"){yn(x.category);return}if(x.type==="skill"&&!r){if((c.length>0?u[x.skill.name]?.some(Bt=>c.includes(Bt))??!1:(u[x.skill.name]?.length??0)>0)&&!o)return;let Te=new Set(P);Te.has(x.skill.name)?Te.delete(x.skill.name):Te.add(x.skill.name),O(Te)}},qs=()=>{let x=Ce[C];if(x.type==="header"){yn(x.category);return}if(r)return;let L=g.filter(Te=>P.has(Te.name));L.length>0&&e?.(L)},kn=x=>{let L=Ce[C];if(L.type==="skill"&&ee){v(L.skill),Z(!1);return}!x&&L.type==="header"&&!no(L.category)&&Ye(L.category)},Qs=()=>{let x=Ce[C];x.type==="header"&&no(x.category)&&Ye(null)},Zs=(x,L)=>x.length===1&&!L.ctrl&&!L.meta&&!L.upArrow&&!L.downArrow&&!L.leftArrow&&!L.rightArrow;Zd((x,L)=>{if(x==="?")return Ks();if(I)return w(!1);if(L.escape)return Vs();if(!F&&x==="/"){V(!0),k("search");return}if(x==="a"&&L.ctrl&&!r)return Xs();if(U==="search")return Ys(L);if(U==="list"){if(L.upArrow)return zs();if(L.downArrow)return Ws();if(x===" ")return Js();if(L.return)return qs();if(L.tab)return kn(!0);if(L.rightArrow)return kn(!1);if(L.leftArrow)return Qs();Zs(x,L)&&(V(!0),k("search"),p(x))}},{isActive:!y});let el=Ce.slice(S,S+ze),tl=S>0,ol=S+ze<Ce.length,rl=Ce.length<=ze?100:Math.round((S+ze)/Ce.length*100),nl=!y||!Q;if(h)return le(q,{flexDirection:"column",paddingX:1,children:[j(R,{}),j(q,{flexDirection:"column",alignItems:"center",justifyContent:"center",paddingY:4,children:j(Ee,{color:n.accent,children:"Loading skills..."})})]});if(l||!h&&g.length===0)return le(q,{flexDirection:"column",paddingX:1,minHeight:20,children:[j(R,{}),le(q,{flexDirection:"column",alignItems:"center",justifyContent:"center",flexGrow:1,children:[le(q,{flexDirection:"column",borderStyle:"round",borderColor:n.error,paddingX:3,paddingY:2,alignItems:"center",children:[le(Ee,{color:n.error,bold:!0,children:[a.cross," No Skills Available"]}),j(q,{marginTop:1,children:j(Ee,{color:n.textDim,children:"Check your internet connection and try again"})}),l&&j(q,{marginTop:1,children:j(Ee,{color:n.textMuted,dimColor:!0,children:l})})]}),j(q,{marginTop:2,children:le(Ee,{color:n.textDim,children:["Press"," ",j(Ee,{color:n.accent,bold:!0,children:"Esc"})," ","to exit"]})})]})]});let il=(x,L)=>{let Te=S+L,Bt=U==="list"&&Te===C;if(x.type==="header")return j(q,{marginTop:L===0?0:1,children:j(us,{name:x.category,categoryId:x.categoryId,totalCount:x.count,installedCount:x.installedCount,isExpanded:no(x.category),isFocused:Bt})},`cat-${x.category}`);let io=P.has(x.skill.name),Co=c.length>0?u[x.skill.name]?.some(cl=>c.includes(cl))??!1:(u[x.skill.name]?.length??0)>0,al=f instanceof Map&&f.has(x.skill.name)?"deprecated":Co?"installed":null;return j(hs,{name:x.skill.name,description:x.skill.description,status:al,selected:io,focused:Bt,readOnly:r},x.skill.name)},bn=x=>j(q,{justifyContent:"center",marginBottom:x==="up"?1:0,marginTop:x==="down"?1:0,children:le(Ee,{color:n.textDim,children:[x==="up"?a.arrowUp:a.arrowDown," ",x==="up"?a.arrowUp:a.arrowDown," ",x==="up"?a.arrowUp:a.arrowDown]})}),sl=()=>y?[{key:"\u2191/\u2193",label:"scroll"},{key:"f",label:Q?"compact":"expand"},{key:"Esc",label:"close",color:n.warning}]:r?[{key:"/",label:"filter"},{key:"tab",label:"detail"},{key:"esc",label:"exit",color:n.warning},{key:"?",label:"help"}]:[{key:"space",label:"toggle"},{key:"enter",label:"install",color:n.success},{key:"/",label:"filter"},{key:"tab",label:"detail"},{key:"esc",label:"exit",color:n.warning},{key:"?",label:"help"}],ll=()=>{if(!y)return le(iu,{children:[!r&&P.size>0&&le(Ee,{children:[le(Ee,{color:n.success,bold:!0,children:[a.checkboxActive," ",P.size]}),j(Ee,{color:n.textDim,children:" selected"})]}),Ce.length>ze&&le(Ee,{color:n.textDim,children:[!r&&P.size>0?` ${a.dot} `:"",rl,"%"]})]})};return le(q,{flexDirection:"column",paddingX:1,minHeight:20,children:[j(R,{}),I?j(q,{flexDirection:"column",flexGrow:1,alignItems:"center",justifyContent:"center",children:j(Vt,{visible:I,onDismiss:()=>w(!1),shortcuts:nu(r)})}):le(q,{flexDirection:"row",height:y?js:void 0,flexGrow:y?0:1,overflow:"hidden",children:[nl&&le(q,{flexDirection:"column",flexGrow:1,flexShrink:1,children:[F&&j(q,{marginBottom:1,children:j(ps,{query:m,onChange:x=>{p(x),A(0),B(0)},total:g.length,filtered:T.length,isLoading:h,focus:U==="search"})}),le(q,{flexDirection:"column",flexGrow:1,children:[tl&&bn("up"),el.map(il),ol&&bn("down"),Ce.length===0&&j(q,{paddingY:1,children:le(Ee,{color:n.textMuted,children:['No skills match "',m,'"']})})]})]},"skill-list"),y&&j(q,{flexDirection:"column",width:Q?void 0:Hs,flexGrow:Q?1:0,flexShrink:0,children:j(dn,{skill:y,expanded:Q,onClose:()=>{v(null),Z(!1)},onToggleExpand:()=>Z(x=>!x)})},"detail-panel")]}),j(dt,{hints:sl(),status:ll()})]})};import{Box as he,Text as ae,useInput as su}from"ink";import Cs from"ink-spinner";import{useAtomValue as Ts}from"jotai";import{useEffect as lu,useMemo as ws,useState as eo}from"react";Je();import{jsx as Y,jsxs as J}from"react/jsx-runtime";function mr({selectedAgents:e,onExit:t}){let[o,r]=eo(!1),[i,s]=eo(!1),[l,d]=eo(!1),[c,u]=eo(e||[]),[f,g]=eo(!e),[h,m]=eo([]),{install:p,progress:T,results:P,installing:O}=No(),U=Ts(Ge),k=Ts(qt),{skills:C,loading:A}=ct(),S=e||c,B=ws(()=>{if(A)return[];let I=new Set(Object.keys(U));return C.filter(w=>I.has(w.name)?(U[w.name]||[]).some(v=>S.includes(v)):!1)},[U,C,A,S]),F=ws(()=>{if(A||!(k instanceof Map)||k.size===0)return[];let I=new Set(Object.keys(U)),w=new Set(C.map(v=>v.name)),y=[];for(let v of I)k.has(v)?y.push({name:v,entry:k.get(v)}):w.has(v)||y.push({name:v});return y},[U,C,A,k]);if(lu(()=>{if(B.length===0){r(!1),s(!0);return}r(!0),(async()=>{let w=B.map(Q=>Q.name),{toUpdate:y}=await Ro(w),v=B.filter(Q=>y.includes(Q.name));m(v),r(!1),s(!0)})()},[B]),su((I,w)=>{w.escape&&!O&&!l&&!o&&i&&h.length===0&&t()}),f)return Y(zt,{onSelect:I=>{u(I),g(!1)},onBack:t});let V=async I=>{if(I.length===0)return;let w=new Set;I.forEach(y=>{(U[y.name]||[]).forEach(Q=>{S.includes(Q)&&w.add(Q)})}),await p(I,{agents:Array.from(w),method:"copy",global:!1,skills:I.map(y=>y.name),isUpdate:!0}),d(!0)};return l?Y(ir,{results:P,onExit:t,title:"Skills Updated Successfully",successLabel:"updated"}):O?J(he,{flexDirection:"column",paddingX:1,children:[Y(R,{}),J(he,{marginTop:1,children:[J(ae,{color:n.accent,children:[Y(Cs,{type:"dots"})," "]}),Y(ae,{children:"Updating skills..."})]}),Y(he,{marginTop:1,paddingX:2,children:J(ae,{color:n.textDim,children:[a.arrow," ",T.skill," (",T.current,"/",T.total,")"]})})]}):A||o?J(he,{flexDirection:"column",paddingX:1,children:[Y(R,{}),Y(he,{marginTop:1,children:J(ae,{color:n.accent,children:[Y(Cs,{type:"dots"})," ",o?"Checking for updates...":"Loading..."]})})]}):i&&h.length===0?J(he,{flexDirection:"column",paddingX:1,children:[Y(R,{}),Y(he,{borderStyle:"round",borderColor:n.success,paddingX:2,paddingY:1,children:J(ae,{color:n.success,children:[a.check," All installed skills are up to date!"]})}),F.length>0&&J(he,{flexDirection:"column",marginTop:1,borderStyle:"round",borderColor:n.warning,paddingX:2,paddingY:1,children:[Y(he,{marginBottom:1,children:J(ae,{color:n.warning,bold:!0,children:[a.warning," ",F.length," deprecated skill",F.length>1?"s":""," detected:"]})}),F.map(I=>J(he,{flexDirection:"column",paddingX:1,marginBottom:1,children:[J(ae,{color:n.warning,children:[a.arrow," ",I.name]}),I.entry?.message&&J(ae,{color:n.textDim,children:[" ",I.entry.message]}),!I.entry&&Y(ae,{color:n.textDim,children:" No longer available in the registry"}),I.entry?.alternatives&&I.entry.alternatives.length>0&&J(ae,{color:n.textDim,children:[" ","Try: agent-skills install --skill ",I.entry.alternatives.join(", ")]})]},I.name)),J(ae,{color:n.textMuted,children:["Run: agent-skills remove --skill ","<name>"," to clean up"]})]}),Y(he,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:J(ae,{children:[Y(ae,{color:n.warning,bold:!0,children:"esc"}),Y(ae,{color:n.textDim,children:" exit"})]})})]}):Y(au,{skills:h,installedSkills:U,selectedAgents:S,onUpdate:V,onExit:t})}function au({skills:e,installedSkills:t,selectedAgents:o,onUpdate:r,onExit:i}){let s=e.map(c=>{let f=(t[c.name]||[]).filter(g=>o.includes(g));return{label:c.name,value:c.name,hint:`${f.length} agent${f.length>1?"s":""}: ${f.join(", ")}`}}),l=e.map(c=>c.name),d=c=>{let u=e.filter(f=>c.includes(f.name));r(u)};return J(he,{flexDirection:"column",paddingX:1,children:[Y(R,{}),Y(he,{marginBottom:1,children:J(ae,{bold:!0,color:n.primary,children:[a.diamond," Select skills to update:"]})}),Y(he,{marginBottom:1,children:J(ae,{color:n.textDim,children:[e.length," installed skill",e.length>1?"s":""," found ",a.dot," all pre-selected"]})}),Y(Xt,{items:s,initialSelected:l,onSubmit:d,onCancel:i})]})}import{jsx as ne,jsxs as st}from"react/jsx-runtime";function Is({onExit:e}){let{step:t,next:o,back:r}=Li(5),[i,s]=As(nr),[l,d]=As(ls),c=mu(nn),u=uu(Ge),[f,g]=It("install"),[h,m]=It(!1),[p,T]=It(!1),[P,O]=It(!1),[U,k]=It({method:"copy",global:!1}),{skills:C}=ct(),{install:A,progress:S,results:B,installing:F}=No(),[V,I]=It(!1),[w,y]=It(!1),v=ee=>{ee.length!==0&&(s(ee),o())},Q=ee=>{if(g(ee),ee==="update"){T(!0);return}if(ee==="remove"){O(!0);return}o()},Z=ee=>{ee.length!==0&&(d(ee),o())},So=ee=>{k(ee),o()},Ye=gu(()=>{if(f==="install")return;let ee=new Set;return Object.entries(u).forEach(([Oe,pr])=>{pr.some(ze=>i.includes(ze))&&ee.add(Oe)}),C.filter(Oe=>ee.has(Oe.name))},[f,u,C,i]);return pu(()=>{(async()=>t===5&&!V&&!w&&(I(!0),await A(l,{agents:i,skills:l.map(Oe=>Oe.name),method:U.method,global:U.global}),y(!0),c(Oe=>Oe+1)))()},[t,V,w,A,l,i,c]),t===5?w?ne(ir,{results:B,onExit:e,title:"Installation Complete",successLabel:"installed"}):st(Et,{flexDirection:"column",paddingX:1,children:[ne(R,{}),st(Et,{marginTop:1,children:[st(vt,{color:n.accent,children:[ne(du,{type:"dots"})," "]}),st(vt,{children:["Installing ",l.length," skills to ",i.length," agents..."]})]}),F&&ne(Et,{marginTop:1,paddingX:2,children:st(vt,{color:n.textDim,children:[a.arrow," ",S.skill," (",S.current,"/",S.total,")"]})})]}):p?ne(mr,{selectedAgents:i,onExit:()=>T(!1)}):P?ne(sr,{selectedAgents:i,onExit:()=>O(!1)}):h?ne(rr,{onExit:()=>m(!1)}):st(Et,{flexDirection:"column",children:[t===1&&ne(zt,{onSelect:v,onBack:e}),t===2&&ne(Vi,{onSelect:Q,onBack:r,onCredits:()=>m(!0)}),t===3&&(f==="install"||Ye&&Ye.length>0)&&ne(ur,{onInstall:Z,onExit:r,overrideSkills:Ye}),t===3&&f==="update"&&Ye&&Ye.length===0&&ne(fu,{onBack:r}),t===4&&ne(ns,{onConfirm:So,onBack:r,initialMethod:"copy",initialGlobal:!1})]})}function fu({onBack:e}){return cu((t,o)=>{(o.escape||t==="b"||o.backspace)&&e()}),st(Et,{flexDirection:"column",paddingX:1,children:[ne(R,{}),ne(Et,{borderColor:n.success,borderStyle:"round",paddingX:2,paddingY:1,children:st(vt,{color:n.success,bold:!0,children:[a.check," All skills are up to date on selected agents"]})}),ne(Et,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:st(vt,{children:[ne(vt,{color:n.warning,bold:!0,children:"esc"}),ne(vt,{color:n.textDim,children:" back"})]})})]})}import{Box as Es,Text as pn}from"ink";import{useAtomValue as hu}from"jotai";import{useMemo as xu}from"react";import{jsx as to,jsxs as vs}from"react/jsx-runtime";function Ds({onExit:e}){let t=hu(Ge),{skills:o,loading:r}=ct(),i=xu(()=>{if(r)return[];let s=new Set(Object.keys(t));return o.filter(l=>s.has(l.name))},[t,o,r]);return r?vs(Es,{flexDirection:"column",padding:1,children:[to(R,{}),to(pn,{children:"Loading..."})]}):i.length===0?vs(Es,{flexDirection:"column",padding:1,children:[to(R,{}),to(pn,{color:n.warning,children:"No skills installed."}),to(pn,{color:n.textDim,children:"(Press any key to exit)"})]}):to(ur,{onExit:e,readOnly:!0,overrideSkills:i})}import{jsx as mt,jsxs as Su}from"react/jsx-runtime";var Dt=({command:e="install"})=>{let{exit:t}=yu(),[o,r]=bu(e==="arcade"),{activated:i,reset:s}=Ei();return ku(()=>{i&&!o&&(r(!0),s())},[i,o,s]),e==="credits"?mt(gn,{flexDirection:"column",padding:1,children:mt(rr,{onExit:t})}):o?mt(gn,{flexDirection:"column",padding:1,children:mt(zr,{onExit:()=>{e==="arcade"?t():r(!1)}})}):Su(gn,{flexDirection:"column",padding:1,children:[e==="list"&&mt(Ds,{onExit:t}),e==="remove"&&mt(sr,{onExit:t}),e==="update"&&mt(mr,{onExit:t}),(e==="install"||!e)&&mt(Is,{onExit:t})]})};var Xe=new Ru;Xe.name("agent-skills").description("CLI to install and manage skills for AI coding agents").version(jt);Xe.action(()=>{oo(ro.createElement(Dt,{command:"install"}))});Xe.command("install").description("Install skills (interactive by default)").option("-g, --global","Install globally to user home",!1).option("-s, --skill <names...>","Install one or more skills").option("-a, --agent <agents...>","Target specific agents").option("--symlink","Use symlink instead of copy",!1).option("-f, --force","Force re-download skills (bypass cache)",!1).action(async e=>{if(fn(e)){oo(ro.createElement(Dt,{command:"install"}));return}let{runCliInstall:t}=await Promise.resolve().then(()=>(Bs(),Ps));await t(e)});Xe.command("list").alias("ls").description("List available/installed agent skills").action(()=>{oo(ro.createElement(Dt,{command:"list"}))});Xe.command("remove").alias("rm").description("Remove installed skills").option("-g, --global","Remove from global installation",!1).option("-s, --skill <names...>","Remove one or more skills").option("-a, --agent <agents...>","Target specific agents").option("-f, --force","Force removal even if not in lockfile",!1).action(async e=>{if(fn(e)){oo(ro.createElement(Dt,{command:"remove"}));return}let{runCliRemove:t}=await Promise.resolve().then(()=>(Rs(),Ls));await t(e)});Xe.command("update").description("Update installed skills to the latest version").option("-s, --skill <name>","Update a specific skill").action(async e=>{if(fn(e)){oo(ro.createElement(Dt,{command:"update"}));return}let{runCliUpdate:t}=await Promise.resolve().then(()=>(_s(),Ms));await t(e)});Xe.command("cache").description("Manage the skills cache").option("--clear","Clear all cached skills and registry").option("--clear-registry","Clear only the registry cache").option("--path","Show cache directory path").action(async e=>{let{runCliCache:t}=await Promise.resolve().then(()=>(Fs(),Os));t(e)});Xe.command("credits").description("Show project contributors and credits").action(()=>{oo(ro.createElement(Dt,{command:"credits"}))});Xe.command("audit").description("View audit log of skill operations").option("-n, --limit <number>","Number of entries to show","10").option("--path","Show audit log file path").action(async e=>{let{runCliAudit:t}=await Promise.resolve().then(()=>(Gs(),$s));await t(e)});Xe.parse(process.argv);function fn(e){return Object.keys(e).filter(o=>o!=="parent").length===0}
2
+ var il=Object.defineProperty;var D=(e,t)=>()=>(e&&(t=e(e=0)),t);var eo=(e,t)=>{for(var o in t)il(e,o,{get:t[o],enumerable:!0})};import{homedir as ll,platform as al}from"node:os";var go,mr=D(()=>{"use strict";go=class{cwd(){return process.cwd()}homedir(){return ll()}platform(){return al()}getEnv(t){return process.env[t]}}});import{existsSync as cl,mkdirSync as dl,readFileSync as ml,readdirSync as ul,rmSync as fl,writeFileSync as gl}from"node:fs";import{appendFile as pl,cp as hl,lstat as xl,mkdir as yl,readFile as kl,readdir as Sl,readlink as bl,rename as Cl,rm as wl,symlink as Tl,writeFile as Al}from"node:fs/promises";var po,ur=D(()=>{"use strict";po=class{async readFile(t,o){return kl(t,o)}async writeFile(t,o,r){await Al(t,o,r)}writeFileSync(t,o,r){gl(t,o,r)}async appendFile(t,o,r){await pl(t,o,r)}async mkdir(t,o){await yl(t,o)}mkdirSync(t,o){dl(t,o)}async rm(t,o){await wl(t,o)}rmSync(t,o){fl(t,o)}async rename(t,o){await Cl(t,o)}async cp(t,o,r){await hl(t,o,r)}async symlink(t,o,r){await Tl(t,o,r)}async readlink(t){return bl(t)}async lstat(t){return xl(t)}async readdir(t,o){return Sl(t,{withFileTypes:!0})}existsSync(t){return cl(t)}readFileSync(t,o){return ml(t,o)}readdirSync(t,o){return ul(t,{withFileTypes:!0})}}});var ho,fr=D(()=>{"use strict";ho=class{async get(t){return fetch(t)}async getWithFallback(t,o){try{return await fetch(t)}catch(r){if(o)return fetch(o);throw r}}}});var xo,gr=D(()=>{"use strict";xo=class{error(t){console.error(t)}warn(t){console.warn(t)}info(t){console.info(t)}debug(t){console.debug(t)}}});var Il,yo,pr=D(()=>{"use strict";Il=async(e,t)=>{let r=(await import("package-json")).default;return r(e,t)},yo=class{resolvePackage;constructor(t=Il){this.resolvePackage=t}async getLatestVersion(t){return(await this.resolvePackage(t,{version:"latest"})).version}}});import{existsSync as Pl}from"node:fs";import{dirname as vl,join as Cn,parse as El,resolve as Dl}from"node:path";function Bl(e,t){let o=Dl(e),r=o,{root:s}=El(r);for(;;){if(t(Cn(r,...wn)))return r;if(r===s)return o;r=vl(r)}}var wn,ko,hr=D(()=>{"use strict";wn=["packages","skills-catalog","skills"];ko=class{constructor(t=process.cwd(),o=Pl){this.startDir=t;this.existsSyncFn=o}getWorkspaceRoot(){return Bl(this.startDir,this.existsSyncFn)}getSkillsCatalogPath(){return Cn(this.getWorkspaceRoot(),...wn)}getLocalSkillsDirectory(){let t=this.getSkillsCatalogPath();return this.existsSyncFn(t)?t:null}}});import{execSync as Ll}from"node:child_process";var So,xr=D(()=>{"use strict";So=class{exec(t,o){return Ll(t,{encoding:o?.encoding??"utf-8"})}}});function Tn(){return{fs:new po,http:new ho,shell:new So,env:new go,logger:new xo,packageResolver:new yo,paths:new ko}}var An=D(()=>{"use strict";mr();ur();fr();gr();pr();hr();xr();mr();ur();fr();gr();pr();hr();xr()});var vt,Et,yr,kr,In,bo,mt,Pn,Sr,br,Cr,vn,wr,Tr,Ar,En,Ir,Dn,Pr,_e=D(()=>{"use strict";vt="uncategorized",Et=/^\(([a-z][a-z0-9-]*)\)$/,yr="_category.json",kr={id:vt,name:"Uncategorized",description:"Skills without a specific category",priority:999},In="@tech-leads-club/agent-skills",bo="@tech-leads-club/skills-catalog",mt=".agents",Pn="skills",Sr=".skill-lock.json",br=".skill-lock.json.backup",Cr=".agent-skills",vn="audit.log",wr=".cache",Tr="agent-skills",Ar="skills",En="registry.json",Ir=".skill-meta.json",Dn=1440*60*1e3,Pr=10});var Bn=D(()=>{"use strict"});var Ln=D(()=>{"use strict"});var Rn=D(()=>{"use strict"});var Mn=D(()=>{"use strict"});var _n=D(()=>{"use strict"});var On=D(()=>{"use strict"});var Fn=D(()=>{"use strict"});var Nn=D(()=>{"use strict";Bn();Ln();Rn();Mn();_n();On();Fn()});import{dirname as Rl,join as Ml,parse as _l,resolve as Ol,sep as Fl}from"node:path";function Oe(e,t){let o=t??e.env.cwd(),r=Ol(o),{root:s}=_l(r),i=`packages${Fl}cli`;for(;r!==s;){if(Nl.some(l=>e.fs.existsSync(Ml(r,l)))&&!r.endsWith(i))return r;r=Rl(r)}return o}var Nl,to=D(()=>{"use strict";Nl=["package.json",".git"]});import{join as S}from"node:path";function Gn(){return Object.keys(oo).sort((e,t)=>oo[e].displayName.localeCompare(oo[t].displayName))}function Ie(e,t){let o=oo[t],r=$n(e);return{name:t,displayName:o.displayName,description:o.description,skillsDir:o.skillsDir,globalSkillsDir:o.globalSkillsDir(r.home),detectInstalled:()=>o.detectInstalled(r)}}function Co(e){let t=$n(e);return Object.entries(oo).filter(([,o])=>o.detectInstalled(t)).map(([o])=>o)}var oo,$n,Un,vr=D(()=>{"use strict";to();oo={cursor:{displayName:"Cursor",description:"AI-first code editor built on VS Code",skillsDir:".cursor/skills",globalSkillsDir:e=>S(e,".cursor/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".cursor"))||o.fs.existsSync(S(t,".cursor"))},"claude-code":{displayName:"Claude Code",description:"Anthropic's agentic coding tool",skillsDir:".claude/skills",globalSkillsDir:e=>S(e,".claude/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".claude"))||o.fs.existsSync(S(t,".claude"))},"github-copilot":{displayName:"GitHub Copilot",description:"AI pair programmer by GitHub/Microsoft",skillsDir:".github/skills",globalSkillsDir:e=>S(e,".copilot/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".copilot"))||o.fs.existsSync(S(t,".github"))},windsurf:{displayName:"Windsurf",description:"AI IDE with Cascade flow (Codeium)",skillsDir:".windsurf/skills",globalSkillsDir:e=>S(e,".codeium/windsurf/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".codeium/windsurf"))||o.fs.existsSync(S(t,".windsurf"))},cline:{displayName:"Cline",description:"Autonomous AI coding agent for VS Code",skillsDir:".cline/skills",globalSkillsDir:e=>S(e,".cline/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".cline"))||o.fs.existsSync(S(t,".cline"))||Un({home:e,ports:o},"saoudrizwan","claude-dev")},aider:{displayName:"Aider",description:"AI pair programming in terminal",skillsDir:".aider/skills",globalSkillsDir:e=>S(e,".aider/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".aider"))||o.fs.existsSync(S(t,".aider"))},codex:{displayName:"OpenAI Codex",description:"OpenAI's coding agent",skillsDir:".codex/skills",globalSkillsDir:e=>S(e,".codex/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".codex"))||o.fs.existsSync(S(t,".codex"))},gemini:{displayName:"Gemini CLI",description:"Google's AI coding assistant",skillsDir:".gemini/skills",globalSkillsDir:e=>S(e,".gemini/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".gemini"))||o.fs.existsSync(S(t,".gemini"))},antigravity:{displayName:"Antigravity",description:"Google's agentic coding (VS Code)",skillsDir:".agent/skills",globalSkillsDir:e=>S(e,".gemini/antigravity/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".gemini/antigravity"))||o.fs.existsSync(S(t,".agent"))},roo:{displayName:"Roo Code",description:"AI coding assistant for VS Code",skillsDir:".roo/skills",globalSkillsDir:e=>S(e,".roo/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".roo"))||o.fs.existsSync(S(t,".roo"))||Un({home:e,ports:o},"RooVetGit","roo-cline")},kilocode:{displayName:"Kilo Code",description:"AI coding agent with auto-launch",skillsDir:".kilocode/skills",globalSkillsDir:e=>S(e,".kilocode/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".kilocode"))||o.fs.existsSync(S(t,".kilocode"))},trae:{displayName:"TRAE",description:"AI IDE with SOLO mode and custom agents",skillsDir:".trae/skills",globalSkillsDir:e=>S(e,".trae/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".trae"))||o.fs.existsSync(S(t,".trae"))},kiro:{displayName:"Kiro",description:"AI Agent with workspace and global skill scopes",skillsDir:".kiro/skills",globalSkillsDir:e=>S(e,".kiro/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".kiro"))||o.fs.existsSync(S(t,".kiro"))},"amazon-q":{displayName:"Amazon Q",description:"AWS AI coding assistant",skillsDir:".amazonq/skills",globalSkillsDir:e=>S(e,".amazonq/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".amazonq"))||o.fs.existsSync(S(t,".amazonq"))},augment:{displayName:"Augment",description:"AI code assistant with context engine",skillsDir:".augment/skills",globalSkillsDir:e=>S(e,".augment/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".augment"))||o.fs.existsSync(S(t,".augment"))},tabnine:{displayName:"Tabnine",description:"AI code completions with privacy focus",skillsDir:".tabnine/skills",globalSkillsDir:e=>S(e,".tabnine/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".tabnine"))||o.fs.existsSync(S(t,".tabnine"))},opencode:{displayName:"OpenCode",description:"Open-source AI coding terminal",skillsDir:".opencode/skills",globalSkillsDir:e=>S(e,".config/opencode/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".config/opencode"))||o.fs.existsSync(S(t,".opencode"))||o.fs.existsSync(S(t,".config/opencode"))},sourcegraph:{displayName:"Sourcegraph Cody",description:"AI assistant with codebase context",skillsDir:".sourcegraph/skills",globalSkillsDir:e=>S(e,".sourcegraph/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".sourcegraph"))||o.fs.existsSync(S(t,".sourcegraph"))},droid:{displayName:"Droid (Factory.ai)",description:"AI software engineer by Factory.ai",skillsDir:".factory/skills",globalSkillsDir:e=>S(e,".factory/skills"),detectInstalled:({home:e,projectRoot:t,ports:o})=>o.fs.existsSync(S(e,".factory"))||o.fs.existsSync(S(t,".factory"))}},$n=e=>({home:e.env.homedir(),projectRoot:Oe(e),ports:e});Un=(e,t,o)=>{let r=[S(e.home,".vscode/extensions"),S(e.home,".vscode-server/extensions"),S(e.home,".vscode-oss/extensions")];for(let s of r)if(e.ports.fs.existsSync(s))try{if(e.ports.fs.readdirSync(s).some(l=>l.name.startsWith(`${t}.${o}-`)))return!0}catch{}return!1}});import{join as Hn}from"node:path";function jn(e,t){return t??e.env.homedir()}function wo(e,t){return Hn(jn(e,t),Cr,vn)}async function Er(e,t,o){try{let r=jn(e,o),s=wo(e,r),i=Hn(r,Cr),l=`${JSON.stringify({...t,timestamp:new Date().toISOString()})}
3
+ `;await e.fs.mkdir(i,{recursive:!0}),await e.fs.appendFile(s,l,"utf-8")}catch{}}async function Kn(e,t,o){try{let i=(await e.fs.readFile(wo(e,o),"utf-8")).trim().split(`
4
+ `).filter(Boolean).map(l=>{try{return JSON.parse(l)}catch{return null}}).filter(l=>l!==null).reverse();return t===void 0?i:t<=0?[]:i.slice(0,t)}catch{return[]}}var Dr=D(()=>{"use strict";_e()});import{join as xu,normalize as Vn,resolve as Xn,sep as Ul}from"node:path";function Dt(e){return e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function ut(e){return(e.replace(/[/\\]/g,"").replace(/[\0:*?"<>|]/g,"").replace(/^[.\s]+|[.\s]+$/g,"").replace(/\.{2,}/g,"").replace(/^\.+/,"")||"unnamed-skill").substring(0,255)}function Bt(e,t){let o=Vn(Xn(e)),r=Vn(Xn(t));return r.startsWith(o+Ul)||r===o}var Lt=D(()=>{"use strict";_e()});import{join as $l}from"node:path";function Yn(e){return e.paths.getSkillsCatalogPath()}function Gl(e){let t=e.match(Et);return t?t[1]:null}function Hl(e){return Et.test(e)}function jl(e){let t=Yn(e),o=$l(t,yr);if(!e.fs.existsSync(o))return{};try{let r=e.fs.readFileSync(o,"utf-8");return JSON.parse(r)}catch{return{}}}function Kl(e){let t=Yn(e);if(!e.fs.existsSync(t))return[];let o=jl(e),r=e.fs.readdirSync(t,{withFileTypes:!0}),s=[],i=0;for(let l of r){if(!l.isDirectory()||!Hl(l.name))continue;let c=Gl(l.name);if(!c)continue;let d=o[l.name]??{};s.push({id:c,name:d.name??Dt(c),description:d.description,priority:d.priority??i}),i++}return s.sort((l,c)=>l.name.localeCompare(c.name)),s}function To(e,t){let o=Kl(e);if(o.length===0){let l=new Set(t.map(c=>c.category).filter(Boolean));o=Array.from(l).map((c,d)=>({id:c,name:Dt(c),priority:d}))}let r=new Map;for(let l of o)r.set(l,[]);r.set(kr,[]);for(let l of t){let c=l.category??vt,d=o.find(g=>g.id===c);!d&&c!==vt&&(d={id:c,name:Dt(c),priority:999},o.push(d),r.set(d,[]));let m=d??kr,p=r.get(m)??[];p.push(l),r.set(m,p)}for(let[l,c]of r)c.length===0&&r.delete(l);let s=new Map,i=Array.from(r.keys()).sort((l,c)=>l.name.localeCompare(c.name));for(let l of i){let c=r.get(l);c&&(c.sort((d,m)=>d.name.localeCompare(m.name)),s.set(l,c))}return s}var Wn=D(()=>{"use strict";_e();Lt()});import{join as Vl}from"node:path";function Xl(e){try{return e.shell.exec("npm root -g",{encoding:"utf-8"}).trim()}catch{return null}}function Br(e){let t=Xl(e);if(!t)return!1;let o=Vl(t,In);return e.fs.existsSync(o)}var Lr=D(()=>{"use strict";_e()});var zn,Rr=D(()=>{"use strict";zn=["cursor","claude-code","github-copilot","windsurf","cline","aider","codex","gemini","antigravity","roo","kilocode","amazon-q","augment","tabnine","opencode","sourcegraph","droid","trae","kiro"]});import{dirname as Yl,join as Ao}from"node:path";import{z as de}from"zod";function Jn(e,t){if(t)return Ao(e.env.homedir(),mt,Sr);let o=Oe(e);return Ao(o,mt,Sr)}function Jl(e,t){if(t)return Ao(e.env.homedir(),mt,br);let o=Oe(e);return Ao(o,mt,br)}function Qn(){return{version:qn,skills:{}}}function Ql(e){try{let t=ql.parse(e);return t.version===1?{version:qn,skills:Object.fromEntries(Object.entries(t.skills).map(([o,r])=>[o,{...r,agents:r.agents||[],method:r.method||"copy",global:r.global??!1}]))}:t}catch{return Qn()}}async function ro(e,t=!1){let o=Jn(e,t);try{let r=await e.fs.readFile(o,"utf-8"),s=JSON.parse(r);return Ql(s)}catch{return Qn()}}async function Zn(e,t,o=!1){let r=Jn(e,o),s=Jl(e,o),i=`${r}.tmp`;try{try{let l=await e.fs.readFile(r,"utf-8");await e.fs.writeFile(s,l,"utf-8")}catch{}await e.fs.mkdir(Yl(r),{recursive:!0}),await e.fs.writeFile(i,JSON.stringify(t,null,2),"utf-8"),await e.fs.rename(i,r)}catch(l){try{await e.fs.rm(i,{force:!0})}catch{}throw l}}async function es(e,t,o,r={}){let s=await ro(e,r.global),i=new Date().toISOString(),l=s.skills[t],c=l?.agents||[],d=Array.from(new Set([...c,...o]));s.skills[t]={name:t,source:r.source||"local",contentHash:r.contentHash??l?.contentHash,installedAt:l?.installedAt??i,updatedAt:i,agents:d,method:r.method||"copy",global:r.global??!1,version:r.version},await Zn(e,s,r.global)}async function Mr(e,t,o,r=!1){let s=await ro(e,r),i=s.skills[t];if(!i)return!1;let l=i.agents||[],c=l.filter(d=>d!==o);return c.length===l.length?!1:(c.length===0?delete s.skills[t]:s.skills[t]={...i,agents:c,updatedAt:new Date().toISOString()},await Zn(e,s,r),!0)}async function Io(e,t,o=!1){return(await ro(e,o)).skills[t]??null}var qn,Wl,zl,ql,_r=D(()=>{"use strict";_e();Rr();to();qn=2,Wl=de.enum(zn),zl=de.object({name:de.string(),source:de.string(),contentHash:de.string().optional(),installedAt:de.string(),updatedAt:de.string(),agents:de.array(Wl).optional(),method:de.enum(["copy","symlink"]).optional(),global:de.boolean().optional(),version:de.string().optional()}),ql=de.object({version:de.number(),skills:de.record(de.string(),zl)})});import{join as Pe}from"node:path";function Or(e){return Pe(gt(e),En)}function Fr(e,t){try{return e.fs.existsSync(Pe(Ye(e,t),"SKILL.md"))}catch{return!1}}function os(e){let t=gt(e),o=Pe(t,Ar);e.fs.existsSync(t)||e.fs.mkdirSync(t,{recursive:!0}),e.fs.existsSync(o)||e.fs.mkdirSync(o,{recursive:!0})}function Zl(e){return Date.now()-e<Dn}function ts(e){let t=Or(e);if(!e.fs.existsSync(t))return null;try{let o=e.fs.readFileSync(t,"utf-8");return JSON.parse(o)}catch{return null}}function ea(e,t){let o=Or(e),r={fetchedAt:Date.now(),registry:t};e.fs.writeFileSync(o,JSON.stringify(r,null,2),"utf-8")}async function rs(e){let t=e.env.getEnv("SKILLS_CDN_REF");if(t)return t;if(Po)return Po;try{return Po=await e.packageResolver.getLatestVersion(bo),Po}catch{return"latest"}}function ns(e){let t=`https://cdn.jsdelivr.net/npm/${bo}@${e}`,o=`https://unpkg.com/${bo}@${e}`;return{registry:`${t}/skills-registry.json`,fallbackRegistry:`${o}/skills-registry.json`,skillsBase:`${t}/skills`,fallbackSkillsBase:`${o}/skills`}}function ta(e,t){let o=Pe(e,".");return Pe(t,".").startsWith(o)}function oa(e,t,o){try{let r=Pe(Ye(e,t),Ir);e.fs.writeFileSync(r,JSON.stringify(o,null,2),"utf-8")}catch{}}function ss(e,t){try{let o=Pe(Ye(e,t),Ir);return e.fs.existsSync(o)?JSON.parse(e.fs.readFileSync(o,"utf-8")):null}catch{return null}}async function ra(e,t,o,r){let s=Pe(r,o);if(!ta(r,s))return e.logger.error(`Security: Skipping suspicious file path: ${o}`),!1;let i=Pe(s,"..");e.fs.existsSync(i)||e.fs.mkdirSync(i,{recursive:!0});let l=await rs(e),c=ns(l),d=`${c.skillsBase}/${t.path}/${o}`,m=`${c.fallbackSkillsBase}/${t.path}/${o}`,p=await e.http.getWithFallback(d,m);if(!p.ok)throw new Error(`Failed to download ${o}: HTTP ${p.status}`);return e.fs.writeFileSync(s,await p.text(),"utf-8"),!0}async function no(e,t=!1){os(e);let o=await rs(e);if(!t){let r=ts(e),s=r&&o!=="latest"&&r.registry.version!==o;if(r&&Zl(r.fetchedAt)&&!s)return r.registry}try{let r=ns(o),i=await(await e.http.getWithFallback(r.registry,r.fallbackRegistry)).json();return ea(e,i),i}catch(r){let s=ts(e);return s?s.registry:(e.logger.error(`Failed to fetch registry: ${r instanceof Error?r.message:String(r)}`),null)}}async function na(e,t){os(e);let o=Ye(e,t.name);e.fs.existsSync(o)||e.fs.mkdirSync(o,{recursive:!0});try{let r=[...t.files],s=0;for(let i=0;i<r.length;i+=Pr){let l=r.slice(i,i+Pr),c=await Promise.all(l.map(d=>ra(e,t,d,o)));s+=c.filter(Boolean).length}if(s<r.length)throw new Error(`Only ${s}/${r.length} files downloaded successfully`);return t.contentHash&&oa(e,t.name,{contentHash:t.contentHash,downloadedAt:Date.now()}),o}catch(r){return e.logger.error(`Failed to download skill ${t.name}: ${r instanceof Error?r.message:String(r)}`),null}}async function Rt(e){let t=await no(e);return t?t.skills.map(o=>({name:o.name,description:o.description,path:Fr(e,o.name)?Ye(e,o.name):"",category:o.category})):[]}async function Mt(e,t){return(await no(e))?.skills.find(r=>r.name===t)??null}async function sa(e){return(await no(e))?.deprecated??[]}async function vo(e){let t=await sa(e);return new Map(t.map(o=>[o.name,o]))}async function Nr(e,t){if(!Fr(e,t))return!0;let o=await Mt(e,t);if(!o?.contentHash)return!1;let r=ss(e,t);return r?.contentHash?r.contentHash!==o.contentHash:!0}async function Eo(e,t){let o=[],r=[];for(let s of t)await Nr(e,s)?o.push(s):r.push(s);return{toUpdate:o,upToDate:r}}function ia(e,t){return Fr(e,t)}async function ft(e,t){if(ia(e,t))return Ye(e,t);let o=await Mt(e,t);return o?na(e,o):null}function is(e){try{e.fs.rmSync(gt(e),{recursive:!0,force:!0})}catch{}}function la(e,t){try{e.fs.rmSync(Ye(e,t),{recursive:!0,force:!0})}catch{}}function ls(e){try{e.fs.rmSync(Or(e),{force:!0})}catch{}}async function so(e,t){return la(e,t),ft(e,t)}function gt(e){return Pe(e.env.homedir(),wr,Tr)}function Ye(e,t){let o=ut(t);if(!o)throw new Error("Invalid skill name");return Pe(gt(e),Ar,o)}function as(e,t){return ss(e,t)?.contentHash}var Po,Do=D(()=>{"use strict";_e();Lt();Po=null});import{join as pe,relative as aa,resolve as cs}from"node:path";var Ur,ds,ca,io,da,_t,ms,ma,ua,fa,Bo,$r,ga,lo,us=D(()=>{"use strict";_e();Lt();vr();Dr();Lr();_r();to();Do();Ur=pe(mt,Pn),ds=async(e,t,o)=>{try{await ca(e,o,t),await e.fs.mkdir(pe(o,".."),{recursive:!0});let r=aa(pe(o,".."),t),s=e.env.platform()==="win32"?"junction":void 0;return await e.fs.symlink(r,o,s),!0}catch{return!1}},ca=async(e,t,o)=>{try{if((await e.fs.lstat(t)).isSymbolicLink()){let s=await e.fs.readlink(t);if(cs(s)===cs(o))return;await e.fs.rm(t)}else await e.fs.rm(t,{recursive:!0})}catch(r){r?.code==="ELOOP"&&await e.fs.rm(t,{force:!0}).catch(()=>{})}},io=async(e,t,o)=>{await e.fs.rm(o,{recursive:!0,force:!0}),await e.fs.mkdir(pe(o,".."),{recursive:!0}),await e.fs.cp(t,o,{recursive:!0})},da=(e,t)=>`${e}-${t?"global":"local"}`,_t=(e,t,o={})=>({agent:e.config.displayName,skill:e.skill.name,path:e.skillTargetPath,method:t,success:!0,...o}),ms=(e,t,o)=>({agent:e.config.displayName,skill:e.skill.name,path:e.skillTargetPath,method:t,success:!1,error:o instanceof Error?o.message:String(o)}),ma={"symlink-global":async(e,t)=>await ds(e,t.skill.path,t.skillTargetPath)?_t(t,"symlink"):(await io(e,t.skill.path,t.skillTargetPath),_t(t,"copy",{symlinkFailed:!0})),"symlink-local":async(e,t)=>{let o=pe(t.projectRoot,Ur,t.safeSkillName);return await io(e,t.skill.path,o),await ds(e,o,t.skillTargetPath)?_t(t,"symlink",{usedGlobalSymlink:!1}):(await io(e,t.skill.path,t.skillTargetPath),_t(t,"copy",{symlinkFailed:!0}))},"copy-global":async(e,t)=>(await io(e,t.skill.path,t.skillTargetPath),_t(t,"copy")),"copy-local":async(e,t)=>(await io(e,t.skill.path,t.skillTargetPath),_t(t,"copy"))},ua=(e,t,o,r)=>r||Bt(e,t)||Bt(o,t)?null:"Security: Invalid skill destination path",fa=async(e,t,o,r,s,i,l)=>{let c=Ie(e,o),d=ut(t.name),m=pe(r,d),p={skill:t,config:c,safeSkillName:d,skillTargetPath:m,projectRoot:i},g=ua(r,m,i,l);if(g)return ms(p,s,g);try{let u=da(s,l);return await ma[u](e,p)}catch(u){return ms(p,s,u)}},Bo=async(e,t,o)=>{let r=Oe(e),s=[];for(let i of o.agents){let l=Ie(e,i),c=o.global?l.globalSkillsDir:pe(r,l.skillsDir);for(let d of t){let m=await fa(e,d,i,c,o.method,r,o.global);s.push(m),m.success&&await es(e,d.name,[i],{source:"local",contentHash:as(e,d.name),method:o.method,global:o.global})}}return await Er(e,{action:"install",skillName:t.map(i=>i.name).join(", "),agents:o.agents.map(i=>Ie(e,i).displayName),success:s.filter(i=>i.success).length,failed:s.filter(i=>!i.success).length,details:s.map(i=>({skill:i.skill,agent:i.agent,success:i.success,error:i.error,path:i.path}))}),s},$r=async(e,t,o)=>{let r=Ie(e,t),s=o?r.globalSkillsDir:pe(Oe(e),r.skillsDir);try{return(await e.fs.readdir(s,{withFileTypes:!0})).filter(l=>l.isDirectory()||l.isSymbolicLink?.()).map(l=>l.name)}catch{return[]}},ga=(e,t,o={})=>{let r=ut(t),s=o.global?e.env.homedir():Oe(e),i=pe(s,Ur,r);if(!Bt(pe(s,Ur),i))throw new Error("Invalid skill name: potential path traversal detected");return i},lo=async(e,t,o,r={})=>{let s=ut(t),i=Oe(e),l=await Io(e,t,!0);if(l||(l=await Io(e,t,!1)),!l&&!r.force)return o.map(u=>({skill:t,agent:Ie(e,u).displayName,success:!1,error:"Skill not found in lockfile"}));let c=await Promise.all(o.map(async u=>{let f=Ie(e,u),h=pe(i,f.skillsDir,s),T=pe(f.globalSkillsDir,s),B=r.global===void 0?[h,T]:r.global?[T]:[h],F=!1,N=!1,k=!1,C;for(let A of B){let b=A.startsWith(f.globalSkillsDir),E=b?f.globalSkillsDir:pe(i,f.skillsDir);if(!Bt(E,A)){C="Security: Invalid removal path";continue}try{await e.fs.lstat(A),await e.fs.rm(A,{recursive:!0,force:!0}),F=!0,b?k=!0:N=!0}catch(R){R.code!=="ENOENT"&&!C&&(C=R instanceof Error?R.message:String(R))}}return{skill:t,agent:f.displayName,success:F,error:F?void 0:C||"Skill not found",removedLocal:N,removedGlobal:k}}));for(let u of c)if(u.success){let f=o.find(h=>Ie(e,h).displayName===u.agent);f&&(u.removedLocal&&await Mr(e,t,f,!1).catch(()=>{}),u.removedGlobal&&await Mr(e,t,f,!0).catch(()=>{}))}let m=((await Io(e,t,!1))?.agents?.length??0)>0,p=c.some(u=>u.removedLocal);if(!m&&p&&l?.method==="symlink"){let u=ga(e,t,{global:!1});await e.fs.rm(u,{recursive:!0,force:!0}).catch(()=>{})}let g=c.map(({skill:u,agent:f,success:h,error:T})=>({skill:u,agent:f,success:h,...T&&{error:T}}));return await Er(e,{action:"remove",skillName:t,agents:o.map(u=>Ie(e,u).displayName),success:g.filter(u=>u.success).length,failed:g.filter(u=>!u.success).length,forced:r.force,details:g.map(u=>({skill:u.skill,agent:u.agent,success:u.success,error:u.error}))}),g}});function pa(e){if(!e.startsWith("---"))return e;let t=0;for(;t<e.length;){let o=e.indexOf(`
5
+ `,t),r=o===-1?e.length:o,s=e[r-1]==="\r"?r-1:r,i=e.slice(t,s);if(t===0){if(i!=="---")return e}else if(i==="---")return e.slice(o===-1?e.length:o+1).trimStart();if(o===-1)return e;t=o+1}return e}function fs(e){let o=pa(e).split(`
6
+ `),r=[],s=0;for(;s<o.length;){let i=o[s];if(i.startsWith("```")){let d=i.slice(3).trim(),m=[];for(s++;s<o.length&&!o[s].startsWith("```");)m.push(o[s]),s++;r.push({type:"code-block",language:d,lines:m}),s++;continue}if(i.trim()===""){r.push({type:"blank"}),s++;continue}if(/^(-{3,}|_{3,}|\*{3,})$/.test(i.trim())){r.push({type:"hr"}),s++;continue}let l=i.match(/^(#{1,3})\s+(.+)$/);if(l){r.push({type:"heading",level:l[1].length,text:l[2]}),s++;continue}let c=i.match(/^(\s*)([-*]|\d+\.)\s+(.+)$/);if(c){let d=Math.floor(c[1].length/2);r.push({type:"list-item",text:c[3],indent:d}),s++;continue}r.push({type:"paragraph",text:i}),s++}return r}var gs=D(()=>{"use strict"});import{basename as ha,join as Lo}from"node:path";function xa(e){try{let t=e.paths.getWorkspaceRoot();if(t)return t}catch{}return"__default__"}function Ro(e){let t=xa(e),o=ps.get(t);return o||(o={mode:null,localDir:null},ps.set(t,o)),o}function ya(e){return e.paths.getLocalSkillsDirectory()}function ka(e){let t=Ro(e);if(t.mode)return t.mode;let o=ya(e);return o?(t.localDir=o,t.mode="local","local"):(t.mode="remote","remote")}function Gr(e){let t=Ro(e);return ka(e)==="local"&&t.localDir!==null}function Sa(e){return Et.test(e)}function ba(e){return e.match(Et)?.[1]??null}function Ca(e){let t=e.match(/^---\n([\s\S]*?)\n---/);if(!t)return{};let o=t[1],r=o.match(/^name:\s*(.+)$/m),s=o.match(/^description:\s*(.+)$/m);return{name:r?.[1]?.trim(),description:s?.[1]?.trim()}}function hs(e,t,o){let r=Lo(t,"SKILL.md");if(!e.fs.existsSync(r))return null;let s=e.fs.readFileSync(r,"utf-8"),{name:i,description:l}=Ca(s),c=ha(t);return{name:i??c,description:l??"No description",path:t,category:o}}function wa(e,t,o){return e.fs.existsSync(t)?e.fs.readdirSync(t,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>hs(e,Lo(t,r.name),o)).filter(r=>r!==null):[]}function xs(e,t){return e.fs.existsSync(t)?e.fs.readdirSync(t,{withFileTypes:!0}).filter(r=>r.isDirectory()).flatMap(r=>{if(Sa(r.name)){let i=ba(r.name);return i?wa(e,Lo(t,r.name),i):[]}let s=hs(e,Lo(t,r.name),vt);return s?[s]:[]}):[]}function Ta(e){let t=Ro(e);return Gr(e)?xs(e,t.localDir):[]}async function ys(e){let t=Ro(e);return Gr(e)?xs(e,t.localDir):Rt(e)}function Aa(e,t){return Ta(e).find(o=>o.name===t)}async function ks(e,t){if(Gr(e))return Aa(e,t)??null;let o=await Mt(e,t);if(!o)return null;let r=await ft(e,t);return r?{name:o.name,description:o.description,path:r,category:o.category}:null}var ps,Ss=D(()=>{"use strict";_e();Lt();Do();ps=new Map});var bs=D(()=>{"use strict";vr();Dr();Wn();Lr();us();_r();gs();to();Do();Ss()});var Y=D(()=>{"use strict";An();_e();Nn();bs();Rr();Lt()});var w,ee=D(()=>{"use strict";Y();w=Tn()});var Ii={};eo(Ii,{runCliInstall:()=>pm});import Re from"chalk";async function fm(e,t){let o=await Rt(w),r=[];for(let s of e){let i=o.find(c=>c.name===s);if(!i){console.error(Re.red(`\u274C Skill "${s}" not found`));continue}let l=t?await so(w,s):await ft(w,s);l?r.push({...i,path:l}):console.error(Re.red(`\u274C Failed to download skill "${s}"`))}return r}function gm(e){let t=e.filter(r=>r.success),o=e.filter(r=>!r.success);t.length>0&&(console.log(Re.green(`
7
+ \u2705 Successfully installed ${t.length} skill(s):`)),t.forEach(r=>{console.log(Re.dim(` \u2022 ${r.skill} \u2192 ${r.agent} (${r.method})`))})),o.length>0&&(console.log(Re.red(`
8
+ \u274C Failed to install ${o.length} skill(s):`)),o.forEach(r=>{console.log(Re.dim(` \u2022 ${r.skill} \u2192 ${r.agent}: ${r.error}`))}))}async function pm(e){(!e.skill||e.skill.length===0)&&(console.error(Re.red("\u274C --skill is required in CLI mode")),console.error(Re.dim("Usage: agent-skills install --skill <name1> [name2...] [--agent <agents...>] [--global] [--symlink]")),process.exit(1));let t=Array.isArray(e.skill)?e.skill:[e.skill];console.log(Re.blue(`\u23F3 Loading ${t.length} skill(s) from catalog...`));let o=await fm(t,e.force||!1);o.length===0&&(console.error(Re.red("\u274C No skills were successfully downloaded")),process.exit(1));let r=e.agent||["cursor","claude-code","windsurf"],s=e.symlink?"symlink":"copy";console.log(Re.blue(`\u23F3 Installing ${o.length} skill(s) to ${r.length} agent(s)...`));let i={agents:r,skills:o.map(c=>c.name),method:s,global:e.global||!1},l=await Bo(w,o,i);gm(l),l.some(c=>!c.success)&&process.exit(1)}var Pi=D(()=>{"use strict";Y();ee()});var vi={};eo(vi,{runCliRemove:()=>hm});import je from"chalk";async function hm(e){(!e.skill||e.skill.length===0)&&(console.error(je.red("\u274C --skill is required in CLI mode")),console.error(je.dim("Usage: agent-skills remove --skill <name1> [name2...] [--agent <agents...>] [--global] [--force]")),process.exit(1));let t=Array.isArray(e.skill)?e.skill:[e.skill],o=e.agent||["cursor","claude-code","windsurf"];e.force&&console.log(je.yellow("\u26A0\uFE0F Force mode enabled - bypassing lockfile check")),console.log(je.blue(`\u23F3 Removing ${t.length} skill(s) from ${o.length} agent(s)...`));let r=0,s=0,i=!1;for(let l of t){let c=await lo(w,l,o,{global:e.global,force:e.force}),d=c.filter(p=>p.success),m=c.filter(p=>!p.success);d.length>0&&(console.log(je.green(`\u2705 ${l}: Removed from ${d.length} agent(s)`)),d.forEach(p=>console.log(je.dim(` \u2022 ${p.agent}`))),r+=d.length),m.length>0&&(console.log(je.red(`\u274C ${l}: Failed to remove from ${m.length} agent(s)`)),m.forEach(p=>console.log(je.dim(` \u2022 ${p.agent}: ${p.error}`))),s+=m.length,m.some(p=>p.error?.includes("lockfile"))&&(i=!0))}console.log(je.dim(`
9
+ ${r} succeeded, ${s} failed`)),i&&!e.force&&console.log(je.yellow(`
10
+ \u{1F4A1} Tip: Use --force to bypass lockfile check`)),s>0&&process.exit(1)}var Ei=D(()=>{"use strict";Y();ee()});var Di={};eo(Di,{runCliUpdate:()=>xm});import ce from"chalk";async function xm(e){if(console.log(ce.blue("\u23F3 Fetching latest registry...")),await no(w,!0),e.skill){if(!await Nr(w,e.skill)){console.log(ce.green(`\u2705 ${e.skill} is already up to date`));return}console.log(ce.blue(`\u23F3 Updating ${e.skill}...`)),await so(w,e.skill)?console.log(ce.green(`\u2705 Updated ${e.skill}`)):(console.error(ce.red(`\u274C Failed to update ${e.skill}`)),process.exit(1))}else{let t=await ro(w),o=Object.keys(t.skills);if(o.length===0){console.log(ce.yellow("No installed skills found. Run agent-skills install first."));return}let{toUpdate:r,upToDate:s}=await Eo(w,o);if(r.length===0){console.log(ce.green(`\u2705 All ${s.length} installed skills are up to date`));return}console.log(ce.blue(`\u23F3 Updating ${r.length} of ${o.length} skills...`));let i=0,l=0;for(let g of r)await so(w,g)?i++:(l++,console.error(ce.red(` \u274C Failed to update ${g}`)));console.log(ce.green(`\u2705 ${i} updated, ${s.length} already up to date${l>0?ce.red(`, ${l} failed`):""}`));let c=await vo(w),d=await Rt(w),m=new Set(d.map(g=>g.name)),p=o.filter(g=>c.has(g)||!m.has(g));if(p.length>0){console.log(""),console.log(ce.yellow(`\u26A0 ${p.length} deprecated skill${p.length>1?"s":""} detected:`));let g={withEntry:(u,f)=>{console.log(ce.yellow(` \u203A ${u} \u2014 ${f.message}`)),f.alternatives?.length&&console.log(ce.dim(` Try: agent-skills install --skill ${f.alternatives.join(", ")}`))},noEntry:u=>{console.log(ce.yellow(` \u203A ${u} \u2014 no longer available in the registry`))}};p.forEach(u=>{let f=c.get(u);g[f?"withEntry":"noEntry"](u,f)}),console.log(ce.dim(" Run: agent-skills remove --skill <name> to clean up"))}}}var Bi=D(()=>{"use strict";Y();ee()});var Li={};eo(Li,{runCliCache:()=>ym});import It from"chalk";function ym(e){e.clear?(is(w),console.log(It.green("\u2705 Cache cleared"))):e.clearRegistry?(ls(w),console.log(It.green("\u2705 Registry cache cleared"))):e.path?console.log(gt(w)):(console.log(It.bold("Cache management:")),console.log(` ${It.blue("--clear")} Clear all cached skills and registry`),console.log(` ${It.blue("--clear-registry")} Clear only the registry cache`),console.log(` ${It.blue("--path")} Show cache directory path`),console.log(),console.log(It.dim(`Cache location: ${gt(w)}`)))}var Ri=D(()=>{"use strict";Y();ee()});import{Box as ct,Text as Ae}from"ink";import{Fragment as Sm,jsx as dt,jsxs as Se}from"react/jsx-runtime";function Mi({entries:e,limit:t=10}){let o=e.slice(0,t);return o.length===0?dt(ct,{flexDirection:"column",paddingY:1,children:dt(Ae,{dimColor:!0,children:"No audit log entries found"})}):Se(ct,{flexDirection:"column",paddingY:1,children:[Se(ct,{marginBottom:1,children:[dt(Ae,{bold:!0,color:"cyan",children:"\u{1F4CB} Audit Log"}),Se(Ae,{dimColor:!0,children:[" (showing ",o.length," most recent)"]})]}),o.map((r,s)=>{let i=r.timestamp?new Date(r.timestamp):new Date,l=r.timestamp?km(i):"unknown time",c=r.action==="install"?"green":r.action==="remove"?"red":"yellow",d=r.failed===0?"\u2713":r.success>0?"\u26A0":"\u2717";return Se(ct,{flexDirection:"column",marginBottom:1,paddingLeft:2,children:[Se(ct,{children:[Se(Ae,{color:c,bold:!0,children:[d," ",r.action.toUpperCase()]}),Se(Ae,{dimColor:!0,children:[" \u2022 ",l]})]}),Se(ct,{paddingLeft:2,children:[dt(Ae,{children:"Skills: "}),dt(Ae,{color:"cyan",children:r.skillName})]}),Se(ct,{paddingLeft:2,children:[dt(Ae,{children:"Agents: "}),dt(Ae,{dimColor:!0,children:r.agents.join(", ")})]}),Se(ct,{paddingLeft:2,children:[Se(Ae,{color:"green",children:["\u2713 ",r.success]}),r.failed>0&&Se(Sm,{children:[dt(Ae,{children:" \u2022 "}),Se(Ae,{color:"red",children:["\u2717 ",r.failed]})]})]})]},s)})]})}function km(e){let t=Math.floor((Date.now()-e.getTime())/1e3);return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:t<604800?`${Math.floor(t/86400)}d ago`:e.toLocaleDateString()}var _i=D(()=>{"use strict"});var Oi={};eo(Oi,{runCliAudit:()=>wm});import{render as bm}from"ink";import Cm from"react";async function wm(e){if(e.path){console.log(wo(w));return}let t=e.limit?parseInt(e.limit,10):10,o=await Kn(w,t);bm(Cm.createElement(Mi,{entries:o,limit:t}))}var Fi=D(()=>{"use strict";Y();_i();ee()});import{Command as Tm}from"commander";import{render as qt}from"ink";import Jt from"react";import{Box as gn,useApp as cm}from"ink";import{useEffect as dm,useState as mm}from"react";Y();ee();import{useEffect as Ia,useMemo as Pa,useState as Hr}from"react";function Cs(){let[e,t]=Hr([]),[o,r]=Hr([]),[s,i]=Hr(!0),l=Pa(()=>Gn(),[]);return Ia(()=>{let d=setTimeout(()=>{let m=Co(w);r(m),t(m),i(!1)},800);return()=>clearTimeout(d)},[]),{allAgents:l,installedAgents:o,selectedAgents:e,setSelectedAgents:t,toggleAgent:d=>{t(m=>m.includes(d)?m.filter(p=>p!==d):[...m,d])},loading:s}}import{useEffect as Nf,useState as Uf}from"react";var Mo="@tech-leads-club/agent-skills";var jr=".agent-skills",ws="cache.json";var We={UPDATE_AVAILABLE:(e,t)=>`Update available: ${e} \u2192 ${t}`,TIP_INSTALL_UPDATE:"Tip: Install globally to update:",TIP_INSTALL_ACCESS:"Tip: Install globally for easier access:",UPDATE_COMMAND:`npm update -g ${Mo}`,INSTALL_COMMAND:`npm install -g ${Mo}`,DESCRIPTION:"Curated skills to power up your coding agents"};import{useMemo as va,useState as Ea}from"react";function Ts(e,t){let[o,r]=Ea(""),s=va(()=>{if(!o.trim())return e;let i=o.toLowerCase().split(/\s+/).filter(l=>l.length>0);return e.filter(l=>{let c=t.keys.map(d=>{let m=l[d];return typeof m=="string"?m.toLowerCase():""}).join(" ");return i.every(d=>c.includes(d))})},[o,e,t.keys]);return{query:o,setQuery:r,filtered:s,hasFilter:o.trim().length>0}}Y();ee();import{useState as _o}from"react";function Oo(){let[e,t]=_o({current:0,total:0,skill:""}),[o,r]=_o([]),[s,i]=_o(!1),[l,c]=_o(null);return{install:async(m,p)=>{i(!0),c(null),t({current:0,total:m.length*p.agents.length,skill:"Downloading..."});let g=[];for(let u of m){let f=u.path?u:await ks(w,u.name);f&&g.push(f)}t({current:0,total:g.length*p.agents.length,skill:"Installing..."});try{let u=await Bo(w,g,p);return r(u),u}catch(u){return c(u instanceof Error?u.message:String(u)),[]}finally{i(!1)}},progress:e,results:o,installing:s,error:l}}import{useInput as Da}from"ink";import{useCallback as Ba,useRef as La,useState as Ra}from"react";var Fo=["up","up","down","down","left","right","left","right","b","a"];function As(){let[e,t]=Ra(!1),o=La([]);Da((s,i)=>{if(e)return;let l=null;if(i.upArrow?l="up":i.downArrow?l="down":i.leftArrow?l="left":i.rightArrow?l="right":s.toLowerCase()==="b"?l="b":s.toLowerCase()==="a"&&(l="a"),!l){o.current=[];return}o.current.push(l),o.current.length>Fo.length&&(o.current=o.current.slice(-Fo.length)),o.current.length===Fo.length&&o.current.every((c,d)=>c===Fo[d])&&(t(!0),o.current=[])});let r=Ba(()=>{t(!1),o.current=[]},[]);return{activated:e,reset:r}}Y();ee();import{useState as No}from"react";function Is(){let[e,t]=No({current:0,total:0,skill:""}),[o,r]=No([]),[s,i]=No(!1),[l,c]=No(null);return{remove:async(p,g,u=!1)=>{i(!0),t({current:0,total:g.length,skill:p}),c(null);try{let f=await lo(w,p,g,{global:u});return r(h=>[...h,...f]),f}catch(f){return c(f instanceof Error?f.message:String(f)),[]}finally{i(!1)}},removeMultiple:async p=>{i(!0);let g=p.reduce((u,f)=>u+f.agents.length,0);t({current:0,total:g,skill:"Initializing..."}),r([]),c(null);try{let u=0;for(let f of p){t({current:u,total:g,skill:f.name});let h=await lo(w,f.name,f.agents,{});r(T=>[...T,...h]),u+=f.agents.length}}catch(u){c(u instanceof Error?u.message:String(u))}finally{i(!1)}},progress:e,results:o,removing:s,error:l}}Y();ee();import{readFileSync as Ma}from"node:fs";import{join as _a}from"node:path";import{useEffect as Oa,useState as Uo}from"react";function Ps(e){let[t,o]=Uo(null),[r,s]=Uo(null),[i,l]=Uo(!1),[c,d]=Uo(null);return Oa(()=>{if(!e){o(null),s(null),l(!1),d(null);return}let m=!0;return l(!0),d(null),(async()=>{try{let[g,u]=await Promise.all([Mt(w,e).catch(()=>null),ft(w,e).catch(()=>null)]);if(!m)return;g&&o(g);let f=u??Ye(w,e);try{let h=Ma(_a(f,"SKILL.md"),"utf-8");s(h)}catch{d("Failed to load skill content")}}catch(g){m&&d(g instanceof Error?g.message:String(g))}finally{m&&l(!1)}})(),()=>{m=!1}},[e]),{metadata:t,content:r,loading:i,error:c}}Y();ee();import{useEffect as Fa,useState as $o}from"react";function st(){let[e,t]=$o([]),[o,r]=$o(!0),[s,i]=$o(null),[l,c]=$o(new Map);return Fa(()=>{let d=!0;return(async()=>{try{let p=await ys(w);d&&(t(p),c(To(w,p)))}catch(p){d&&i(p instanceof Error?p.message:String(p))}finally{d&&r(!1)}})(),()=>{d=!1}},[]),{skills:e,loading:o,error:s,groupedSkills:l}}import{useState as Na}from"react";function vs(e){let[t,o]=Na(1);return{step:t,next:()=>o(l=>Math.min(l+1,e)),back:()=>o(l=>Math.max(l-1,1)),goTo:l=>o(l),isFirst:t===1,isLast:t===e,progress:t/e}}import{Box as ht,Text as jo}from"ink";import rc from"ink-big-text";import Xr from"ink-gradient";import{useEffect as nc,useState as Ds}from"react";import{Box as Kr,Text as ao}from"ink";import{memo as Ua}from"react";var n={primary:"#3b82f6",primaryLight:"#60a5fa",primaryDark:"#1e3a8a",accent:"#06b6d4",accentLight:"#22d3ee",success:"#22c55e",warning:"#f59e0b",error:"#ef4444",text:"#f8fafc",textDim:"#94a3b8",textMuted:"#64748b",border:"#334155",bg:"#0f172a",bgLight:"#1e293b"};var a={bar:"\u2502",barEnd:"\u2514",radioActive:"\u25CF",radioInactive:"\u25CB",checkboxActive:"\u25FC",checkboxInactive:"\u25FB",diamond:"\u25C6",arrow:"\u203A",arrowRight:"\u2192",arrowUp:"\u2191",arrowDown:"\u2193",dot:"\xB7",bullet:"\u25B8",check:"\u2713",cross:"\u2717",star:"\u2605",sparkle:"\u2726",installed:"\u25CF",warning:"\u26A0",info:"\u2139"};import{jsx as Ho,jsxs as Go}from"react/jsx-runtime";var it=Ua(function({hints:t,status:o}){return Ho(Kr,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:Go(Kr,{justifyContent:"space-between",width:"100%",children:[Ho(ao,{children:t.map((r,s)=>Go(ao,{children:[s>0&&Go(ao,{color:n.textDim,children:[" ",a.dot," "]}),Ho(ao,{color:r.color??n.accent,bold:!0,children:r.key}),Go(ao,{color:n.textDim,children:[" ",r.label]})]},r.key))}),o&&Ho(Kr,{children:o})]})})});import{Box as pt,Text as Fe,useInput as $a}from"ink";import{useMemo as Ga,useState as Es}from"react";import{Fragment as Ha,jsx as ze,jsxs as qe}from"react/jsx-runtime";function Je({items:e,onSelect:t,onCancel:o,initialIndex:r=0,itemLimit:s=10,hideFooter:i,footerRight:l}){let[c,d]=Es(r),[m,p]=Es(0);$a((u,f)=>{f.upArrow&&(d(h=>Math.max(0,h-1)),c<=m&&p(h=>Math.max(0,h-1))),f.downArrow&&(d(h=>Math.min(e.length-1,h+1)),c>=m+s-1&&p(h=>Math.min(e.length-s,h+1))),f.return&&t(e[c].value),f.escape&&o&&o()});let g=Ga(()=>e.slice(m,m+s),[e,m,s]);return qe(pt,{flexDirection:"column",children:[g.map((u,f)=>{let h=f+m===c;return qe(pt,{backgroundColor:h?n.bgLight:void 0,paddingX:1,children:[ze(pt,{width:2,children:ze(Fe,{color:h?n.accent:n.textMuted,children:h?a.bullet:" "})}),qe(Fe,{color:h?n.accent:n.text,bold:h,children:[h?a.radioActive:a.radioInactive," ",u.label]}),h&&u.hint&&qe(Fe,{color:n.textDim,children:[" ",a.dot," ",u.hint]})]},`${u.label}-${f}`)}),e.length>s&&ze(pt,{marginTop:1,paddingX:1,children:qe(Fe,{color:n.textDim,children:[a.arrowUp,a.arrowDown," ",m+1,"-",Math.min(m+s,e.length)," of ",e.length]})}),!i&&ze(pt,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:qe(pt,{justifyContent:"space-between",width:"100%",children:[qe(Fe,{children:[ze(Fe,{color:n.success,bold:!0,children:"enter"}),ze(Fe,{color:n.textDim,children:" select"}),o&&qe(Ha,{children:[qe(Fe,{color:n.textDim,children:[" ",a.dot," "]}),ze(Fe,{color:n.warning,bold:!0,children:"esc"}),ze(Fe,{color:n.textDim,children:" back"})]})]}),l&&ze(pt,{children:l})]})})]})}import{Box as Qe,Text as ve,useInput as ja,useStdout as Ka}from"ink";import{useCallback as Va,useEffect as Xa,useRef as Ya,useState as Wa}from"react";import{jsx as me,jsxs as co}from"react/jsx-runtime";var za=100,Ze=16,qa=50,Ja=10,Qa=30,Za=5,ec=["BANKRUPT. Your burn rate was too high.","DOWN ROUND. Valuation dropped to zero.","RUNWAY EXPIRED. Back to living with parents.","SERVER COSTS > REVENUE. You are cooked.","AUDIT FAILED. Too much tech debt."],tc=["ACQUIRED BY BIG TECH. Golden handcuffs on.","SERIES B SECURED. Keep burning cash!","IPO SUCCESSFUL. Time to buy a yacht.","PROFITABLE? No, but the vibes are great."],Ot=[["AGI_SOON","100x_DEV","LOVABLE","HYPE"],["DEEPSEEK","GEMINI","GPT","V0_DEV"],["TAB_SPAM","NO_READ","TRUST_ME","YOLO"],["SLOP","SPAGHETTI","ANY_TYPE","BUG"]];function oc(e){let t=[],r=Math.max(...Ot.flat().map(l=>l.length))+4,s=Ot[0].length*r,i=Math.floor((e-s)/2);for(let l=0;l<Ot.length;l++)for(let c=0;c<Ot[l].length;c++){let d=Ot[l][c];t.push({x:Math.max(0,i+c*r),y:1+l*2,label:d,width:d.length,alive:!0})}return t}function Vr({onExit:e}){let{stdout:t}=Ka(),o=t?.columns??80,r=Math.max(60,Math.min(o-4,za)),s=Ya(""),[i,l]=Wa(()=>({player:{x:Math.floor(r/2),y:Ze-1},playerBullets:[],enemyBullets:[],invaders:oc(r),score:0,lives:5,gameOver:!1,won:!1,invaderDirection:1,tickCount:0,flash:!1,glitch:!1,rateLimited:0}));if((i.gameOver||i.won)&&!s.current){let g=i.won?tc:ec;s.current=g[Math.floor(Math.random()*g.length)]}ja((g,u)=>{if(i.gameOver||i.won){(u.return||u.escape)&&e();return}if(u.escape){e();return}l(f=>{let h=f.player.x;u.leftArrow&&(h=Math.max(0,f.player.x-2)),u.rightArrow&&(h=Math.min(r-1,f.player.x+2));let T=f.playerBullets,B=f.rateLimited;return g===" "&&B===0&&(f.playerBullets.length>=2?(B=Qa,T=[]):T=[...f.playerBullets,{x:h,y:f.player.y-1}]),{...f,player:{...f.player,x:h},playerBullets:T,rateLimited:B}})});let c=Va(()=>{l(g=>{if(g.gameOver||g.won)return g;let u=g.tickCount+1,f=g.score,h=g.lives,T=g.gameOver,B=!1,F=!1,N=g.rateLimited>0?g.rateLimited-1:0,k=g.invaders.filter(y=>y.alive),C=Ot.flat().length,A=k.length/C,b=Math.max(2,Math.floor(Ja*A)+1),E=.02+.08*(1-A),R=g.playerBullets.map(y=>({...y,y:y.y-1})).filter(y=>y.y>=0),K=g.enemyBullets.map(y=>({...y,y:y.y+1})).filter(y=>y.y<Ze),P=g.invaders.map(y=>({...y}));for(let y of R)if(y.y!==-1){for(let v of P)if(v.alive&&y.y===v.y&&y.x>=v.x&&y.x<v.x+v.width){v.alive=!1,y.y=-1,f+=100,B=!0;break}}if(R=R.filter(y=>y.y!==-1),K.some(y=>y.x===g.player.x&&y.y===g.player.y)&&(h-=1,B=!0,F=!0,K=[],h<=0&&(T=!0)),P.every(y=>!y.alive))return{...g,won:!0,score:f+h*1e3,invaders:P};if(k.length>0){let y=k.filter(v=>{let J=g.player.x>=v.x-1&&g.player.x<=v.x+v.width+1;return Math.random()<(J?E*Za:E)});if(y.length>0){let v=y[Math.floor(Math.random()*y.length)];K.push({x:v.x+Math.floor(v.width/2),y:v.y+1})}}let I=g.invaderDirection;if(u%b===0){let y=P.filter(Q=>Q.alive).map(Q=>Q.x),v=Math.min(...y);Math.max(...P.filter(Q=>Q.alive).map(Q=>Q.x+Q.width))>=r-2&&I===1&&(I=-1),v<=0&&I===-1&&(I=1),P.forEach(Q=>Q.alive&&(Q.x+=I))}return u%45===0&&(P.forEach(y=>y.alive&&(y.y+=1)),P.some(y=>y.alive&&y.y>=Ze-1)&&(T=!0)),{...g,playerBullets:R,enemyBullets:K,invaders:P,score:f,lives:h,gameOver:T,invaderDirection:I,tickCount:u,flash:B,glitch:F,rateLimited:N}})},[r]);Xa(()=>{let g=setInterval(c,qa);return()=>clearInterval(g)},[c]);let d=()=>{let g=Array.from({length:Ze},()=>Array(r).fill(" "));i.invaders.forEach(h=>{if(h.alive)for(let T=0;T<h.width;T++)h.x+T<r&&h.y<Ze&&(g[h.y][h.x+T]=i.glitch?"?":h.label[T])}),i.playerBullets.forEach(h=>{h.x<r&&h.y<Ze&&(g[h.y][h.x]="$")}),i.enemyBullets.forEach(h=>{h.x<r&&h.y<Ze&&(g[h.y][h.x]="*")});let{x:u,y:f}=i.player;return u<r&&f<Ze&&(g[f][u]=i.rateLimited>0?"X":"^"),g.map(h=>h.join("")).join(`
11
+ `)},m=i.rateLimited>0?n.error:n.accent,p=i.glitch?n.warning:i.flash?n.error:n.success;return me(Qe,{width:"100%",alignItems:"center",flexDirection:"column",children:co(Qe,{width:r+4,flexDirection:"column",alignItems:"center",children:[co(Qe,{width:r,flexDirection:"row",paddingX:1,children:[me(Qe,{width:"35%",children:me(ve,{color:m,bold:!0,children:i.rateLimited>0?`LIMIT (${i.rateLimited})`:`$${i.score}k`})}),me(Qe,{width:"30%",justifyContent:"center",children:me(ve,{color:n.warning,bold:!0,children:"VIBE INVADERS"})}),me(Qe,{width:"35%",justifyContent:"flex-end",children:co(ve,{color:n.success,bold:!0,children:["RUNWAY: ","$".repeat(i.lives)]})})]}),me(Qe,{borderStyle:"round",borderColor:i.rateLimited>0?n.error:n.border,flexDirection:"column",width:r+2,height:Ze+2,children:me(ve,{color:i.gameOver?n.error:p,children:d()})}),me(Qe,{marginTop:0,width:r+2,justifyContent:"center",borderStyle:"round",borderColor:n.accent,children:i.gameOver||i.won?co(ve,{color:i.won?n.success:n.error,bold:!0,children:[s.current," Val: $",i.score,"k"]}):co(Qe,{gap:1,children:[me(ve,{color:n.accent,children:"\u2190\u2192"}),me(ve,{children:" move "}),me(ve,{color:n.accent,children:"spc"}),me(ve,{children:" shoot "}),me(ve,{color:n.accent,children:"esc"}),me(ve,{children:" quit"})]})})]})})}import{jsx as ue,jsxs as Yr}from"react/jsx-runtime";var sc=[{label:"Vibe Invaders",value:"invaders",hint:"Fight vibe-coding!"},{label:"Back",value:"back",hint:"Return to CLI"}],Bs="\u2591".repeat(56);function Wr({onExit:e}){let[t,o]=Ds("menu"),[r,s]=Ds(!0);nc(()=>{let l=setInterval(()=>s(c=>!c),600);return()=>clearInterval(l)},[]);let i=l=>{if(l==="back"){e();return}o(l)};return t==="invaders"?ue(Vr,{onExit:()=>o("menu")}):Yr(ht,{flexDirection:"column",alignItems:"center",children:[ue(ht,{marginBottom:0,children:ue(Xr,{name:"cristal",children:ue(jo,{children:Bs})})}),ue(ht,{marginBottom:0,children:ue(Xr,{name:"pastel",children:ue(rc,{text:"ARCADE",font:"chrome"})})}),ue(ht,{marginBottom:0,children:ue(Xr,{name:"cristal",children:ue(jo,{children:Bs})})}),ue(ht,{marginBottom:1,marginTop:1,children:Yr(jo,{color:r?n.warning:n.bg,bold:!0,children:[a.sparkle," SECRET UNLOCKED ",a.sparkle]})}),ue(ht,{marginBottom:1,children:Yr(jo,{color:n.textDim,children:[a.diamond," Choose your adventure ",a.diamond]})}),ue(ht,{width:50,children:ue(Je,{items:sc,onSelect:i,onCancel:e,hideFooter:!0})}),ue(it,{hints:[{key:"\u2191\u2193",label:"navigate"},{key:"\u23CE",label:"select"},{key:"esc",label:"back",color:n.warning}]})]})}import{Box as $s,Text as Vo,useInput as Dc}from"ink";import{Box as et,Text as we}from"ink";import Ns from"ink-big-text";import qr from"ink-gradient";import{useAtomValue as Pc}from"jotai";import{useMemo as vc}from"react";Y();ee();import{atom as Cc}from"jotai";import{unwrap as wc}from"jotai/utils";import{mkdir as ic,readFile as lc,writeFile as ac}from"node:fs/promises";import{homedir as cc}from"node:os";import{dirname as dc,join as mc}from"node:path";function Ls(){return mc(cc(),jr,ws)}function uc(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.lastUpdateCheck!="number"?null:{lastUpdateCheck:t.lastUpdateCheck,latestVersion:t.latestVersion??null}}async function Rs(){let e=Ls();try{let t=await lc(e,"utf-8"),o=JSON.parse(t);return uc(o)}catch{return null}}async function Ms(e){let t=Ls(),o={lastUpdateCheck:Date.now(),latestVersion:e};await ic(dc(t),{recursive:!0}),await ac(t,JSON.stringify(o,null,2),"utf-8")}import kc from"package-json";import{createRequire as fc}from"node:module";import{dirname as gc,join as pc}from"node:path";import{fileURLToPath as hc}from"node:url";var xc=hc(import.meta.url),yc=gc(xc),_s=fc(import.meta.url),Ko;try{Ko=_s("./package.json")}catch{Ko=_s(pc(yc,"../../package.json"))}var Ft=Ko.version||"0.0.0",mp=Ko.description||"CLI to install and manage skills for AI coding agents";async function Os(e){try{if(Sc(e))return null;let t=await kc(Mo,{version:"latest"});return t.version!==e?t.version:null}catch{return null}}function Sc(e){return/-(alpha|beta|rc|snapshot|dev|canary|next)/i.test(e)}function zr(){return Ft}async function Tc(e){let t=await Rs(),o=t&&t.latestVersion!==e?t.latestVersion:null;try{let r=await Promise.race([Os(e),new Promise((s,i)=>setTimeout(()=>i(new Error("timeout")),3e3))]);return Ms(r??e).catch(()=>{}),r}catch{return o}}var Ac=async()=>{let e=zr(),[t,o]=await Promise.all([Tc(e).catch(()=>null),Promise.resolve(Br(w)).catch(()=>!1)]);return{updateAvailable:t,currentVersion:e,isGlobal:o,isLoading:!1}},Ic=Cc(Ac()),Fs=wc(Ic,e=>e??{updateAvailable:null,currentVersion:zr(),isGlobal:!1,isLoading:!0});import{jsx as te,jsxs as tt}from"react/jsx-runtime";var Us=["#1e3a8a","#3b82f6","#0ea5e9","#06b6d4","#22d3ee"],Ec="\u2500",M=({notification:e})=>{let t=Pc(Fs),o=vc(()=>{if(e)return e;let{updateAvailable:r,currentVersion:s,isGlobal:i,isLoading:l}=t;return l?null:r&&!i?tt(et,{flexDirection:"column",alignItems:"center",children:[tt(we,{color:"yellow",children:[a.warning," ",We.UPDATE_AVAILABLE(s,r)]}),tt(we,{color:"blue",children:[a.info," ",We.TIP_INSTALL_UPDATE," ",te(we,{bold:!0,children:We.INSTALL_COMMAND})]})]}):r?tt(we,{color:"yellow",children:[a.warning," ",We.UPDATE_AVAILABLE(s,r)," (run"," ",te(we,{bold:!0,children:We.UPDATE_COMMAND}),")"]}):i?null:tt(we,{color:"blue",children:[a.info," ",We.TIP_INSTALL_ACCESS," ",te(we,{bold:!0,children:We.INSTALL_COMMAND})]})},[e,t]);return tt(et,{flexDirection:"column",paddingBottom:1,children:[tt(et,{flexDirection:"column",alignItems:"center",marginBottom:1,children:[te(et,{marginBottom:-1,children:te(qr,{colors:["#1e3a8a","#3b82f6"],children:te(Ns,{text:"TLC",font:"tiny"})})}),te(et,{children:te(qr,{colors:Us,children:te(Ns,{text:"AGENT SKILLS",font:"block"})})}),tt(et,{marginTop:-1,alignItems:"center",children:[te(we,{color:"#334155",children:"\u2500\u2500\u2500\u2500\u2500\u2500 "}),tt(we,{color:"white",bold:!0,children:["VERSION ",Ft]}),te(we,{color:"#334155",children:" \u2500\u2500\u2500\u2500\u2500\u2500"})]}),te(et,{marginTop:1,children:te(we,{color:"#64748b",italic:!0,children:We.DESCRIPTION})}),o&&te(et,{marginTop:1,children:o})]}),te(et,{marginTop:o?0:1,justifyContent:"center",children:te(qr,{colors:Us,children:te(we,{children:Ec.repeat(60)})})})]})};import{jsx as mo,jsxs as Jr}from"react/jsx-runtime";function Gs({onSelect:e,onBack:t,onCredits:o}){let r=[{label:"Install new skills",value:"install",hint:"browse and select skills to install"},{label:"Update existing skills",value:"update",hint:"check for content changes"},{label:"Remove installed skills",value:"remove",hint:"uninstall skills from agents"}];Dc(i=>{i==="c"&&o&&o()});let s=Jr(Vo,{children:[mo(Vo,{color:n.accent,bold:!0,children:"c"}),mo(Vo,{color:n.textDim,children:" credits"})]});return Jr($s,{flexDirection:"column",paddingX:1,children:[mo(M,{}),mo($s,{marginBottom:1,children:Jr(Vo,{bold:!0,color:n.primary,children:[a.diamond," What would you like to do?"]})}),mo(Je,{items:r,onSelect:e,onCancel:t,footerRight:s})]})}Y();import{Box as Gt,Text as Qr,useInput as $c,useStdout as Gc}from"ink";import Hc from"ink-spinner";import{useState as jc}from"react";import{Box as Ee,Text as Nt,useInput as _c}from"ink";import{useEffect as Oc}from"react";import{useEffect as Bc,useState as Lc}from"react";import{Fragment as Rc,jsx as Mc}from"react/jsx-runtime";var Hs=({visible:e,duration:t=250,children:o})=>{let[r,s]=Lc(e?1:0);return Bc(()=>{if(e&&r===1||!e&&r===0)return;let i=Date.now(),l=r,c=e?1:0,m=setInterval(()=>{let g=Date.now()-i,u=Math.min(g/t,1),f=l+(e?u:-u)*Math.abs(c-l),h=Math.max(0,Math.min(1,f));s(h),u>=1&&(clearInterval(m),s(c))},16);return()=>{clearInterval(m)}},[e,t]),!e&&r<=.05?null:Mc(Rc,{children:o})};import{jsx as oe,jsxs as Xo}from"react/jsx-runtime";var Ut=({visible:e,onDismiss:t,shortcuts:o})=>{_c(()=>{e&&t()},{isActive:e}),Oc(()=>{let m;return e&&(m=setTimeout(()=>{t()},8e3)),()=>{m&&clearTimeout(m)}},[e,t]);let r=Math.ceil(o.length/2),s=o.slice(0,r),i=o.slice(r),l=({label:m})=>oe(Ee,{flexShrink:0,children:oe(Nt,{backgroundColor:n.bgLight,color:n.accent,bold:!0,children:` ${m} `})}),c=({entry:m})=>Xo(Ee,{marginBottom:0,gap:1,children:[oe(Ee,{width:10,justifyContent:"flex-end",flexShrink:0,children:oe(l,{label:m.key})}),oe(Nt,{color:n.textDim,children:m.description})]}),d="\u2500".repeat(48);return oe(Hs,{visible:e,duration:200,children:Xo(Ee,{borderStyle:"round",borderColor:n.border,backgroundColor:n.bg,paddingX:2,paddingY:1,flexDirection:"column",width:56,children:[oe(Ee,{justifyContent:"center",marginBottom:1,children:Xo(Nt,{color:n.accent,bold:!0,children:[a.sparkle," Keyboard Shortcuts"]})}),oe(Ee,{justifyContent:"center",children:oe(Nt,{color:n.border,children:d})}),Xo(Ee,{marginTop:1,gap:2,children:[oe(Ee,{flexDirection:"column",gap:1,flexGrow:1,children:s.map(m=>oe(c,{entry:m},m.key))}),oe(Ee,{flexDirection:"column",gap:1,flexGrow:1,children:i.map(m=>oe(c,{entry:m},m.key))})]}),oe(Ee,{justifyContent:"center",marginTop:1,children:oe(Nt,{color:n.border,children:d})}),oe(Ee,{marginTop:1,justifyContent:"center",children:oe(Nt,{color:n.textMuted,children:"press any key to dismiss"})})]})})};import{Box as xt,Text as ot,useInput as Fc}from"ink";import{useEffect as Nc,useRef as Uc,useState as Yo}from"react";import{jsx as De,jsxs as yt}from"react/jsx-runtime";function $t({items:e,onSubmit:t,onCancel:o,onChange:r,initialSelected:s=[],limit:i=10}){let[l,c]=Yo(s),[d,m]=Yo(0),[p,g]=Yo(0),[u,f]=Yo(!1),h=Uc(s);Nc(()=>{let k=h.current;(k.length!==s.length||k.some((A,b)=>A!==s[b]))&&(c(s),h.current=s)},[s]),Fc((k,C)=>{if(k==="?"){f(E=>!E);return}if(u){f(!1);return}if(C.return){t(l);return}if(C.escape&&o){o();return}let A=d,b=p;if(C.upArrow?A=d>0?d-1:e.length-1:C.downArrow&&(A=d<e.length-1?d+1:0),A<b?b=A:A>=b+i&&(b=A-i+1),C.upArrow&&d===0?b=Math.max(0,e.length-i):C.downArrow&&d===e.length-1&&(b=0),A!==d&&(m(A),g(b)),k===" "){let E=e[d];if(l.includes(E.value)){let R=l.filter(K=>K!==E.value);c(R),r?.(R)}else{let R=[...l,E.value];c(R),r?.(R)}}if(k==="a"&&C.ctrl)if(l.length===e.length)c([]),r?.([]);else{let E=e.map(R=>R.value);c(E),r?.(E)}});let T=e.slice(p,p+i),B=p>0,F=e.length>p+i,N=[{key:"\u2191/\u2193",description:"Navigate"},{key:"space",description:"Toggle selection"},{key:"enter",description:"Confirm"},{key:"ctrl+a",description:"Select all / none"},...o?[{key:"esc",description:"Cancel"}]:[]];return u?De(xt,{flexDirection:"column",flexGrow:1,alignItems:"center",justifyContent:"center",children:De(Ut,{visible:u,onDismiss:()=>f(!1),shortcuts:N})}):yt(xt,{flexDirection:"column",children:[B&&De(xt,{justifyContent:"center",marginBottom:1,children:yt(ot,{color:n.textDim,children:[a.arrowUp," ",a.arrowUp," ",a.arrowUp]})}),T.map((k,C)=>{let A=C+p,b=A===d,E=l.includes(k.value),R=b?a.bullet:" ",K=E?n.success:n.accent,P=E?a.checkboxActive:a.checkboxInactive,I=E?n.success:n.textMuted,y=b?n.primary:E?n.primaryLight:n.text;return yt(xt,{backgroundColor:b?n.bgLight:void 0,paddingX:1,children:[De(xt,{width:2,children:De(ot,{color:K,children:R})}),De(xt,{width:2,children:De(ot,{color:I,children:P})}),De(ot,{color:y,bold:b,children:k.label}),k.hint&&yt(ot,{color:E?n.success:n.textDim,children:[" ",a.dot," ",k.hint]})]},`${String(k.value)}-${A}`)}),F&&De(xt,{justifyContent:"center",marginTop:1,children:yt(ot,{color:n.textDim,children:[a.arrowDown," ",a.arrowDown," ",a.arrowDown]})}),De(it,{hints:[{key:"space",label:"toggle"},{key:"enter",label:"confirm",color:n.success},...o?[{key:"esc",label:"back",color:n.warning}]:[],{key:"?",label:"help"}],status:l.length>0?yt(ot,{children:[yt(ot,{color:n.success,bold:!0,children:[a.checkboxActive," ",l.length]}),De(ot,{color:n.textDim,children:" selected"})]}):void 0})]})}ee();import{Fragment as js,jsx as Ne,jsxs as kt}from"react/jsx-runtime";var Kc=28;function Ht({onSelect:e,onBack:t}){let{stdout:o}=Gc(),r=o?.rows??40,s=Math.max(3,r-Kc),{allAgents:i,installedAgents:l,selectedAgents:c,setSelectedAgents:d,loading:m}=Cs(),p=[{key:"space",description:"Toggle selection"},{key:"enter",description:"Confirm"},{key:"ctrl+a",description:"Select all"},{key:"esc",description:"Go back"}],[g,u]=jc(!1);$c(h=>{h==="?"&&u(T=>!T)});let f=i.map(h=>{let T=Ie(w,h),B=l.includes(h);return{label:T.displayName,value:h,hint:B?`${a.check} detected`:void 0}});return m?kt(Gt,{flexDirection:"column",paddingX:1,children:[Ne(M,{}),Ne(Gt,{marginTop:1,children:kt(Qr,{color:n.accent,children:[Ne(Hc,{type:"dots"})," Scanning for installed agents..."]})})]}):kt(Gt,{flexDirection:"column",paddingX:1,minHeight:20,children:[Ne(M,{}),g?kt(js,{children:[Ne(Gt,{flexDirection:"column",flexGrow:1,alignItems:"center",justifyContent:"center",children:Ne(Ut,{visible:g,onDismiss:()=>u(!1),shortcuts:p})}),Ne(it,{hints:[{key:"space",label:"toggle"},{key:"enter",label:"confirm",color:n.success},...t?[{key:"esc",label:"back",color:n.warning}]:[],{key:"?",label:"help"}]})]}):kt(js,{children:[Ne(Gt,{marginBottom:1,children:kt(Qr,{bold:!0,color:n.primary,children:[a.diamond," Where do you want to install skills?"]})}),Ne(Gt,{marginBottom:1,children:kt(Qr,{color:n.textDim,children:[l.length," agents detected on this machine"]})}),Ne($t,{items:f,initialSelected:c,onSubmit:e,onCancel:t,onChange:d,limit:s})]})]})}import{Box as lt,Text as G,useInput as Jc,useStdout as Qc}from"ink";import zs from"ink-big-text";import Zo from"ink-gradient";import{existsSync as Zc}from"node:fs";import{dirname as qs,join as ed}from"node:path";import{fileURLToPath as td}from"node:url";import{useCallback as od,useEffect as Qo,useMemo as rd,useRef as Js,useState as jt}from"react";import{execSync as Vc,spawn as Wo}from"node:child_process";import{platform as Xc}from"node:os";function Yc(e){try{return Vc(`which ${e}`,{stdio:"ignore"}),!0}catch{return!1}}function Wc(e){let t=[{cmd:"mpv",args:["--no-video","--no-terminal",e]},{cmd:"ffplay",args:["-nodisp","-autoexit","-loglevel","quiet",e]},{cmd:"paplay",args:[e]},{cmd:"aplay",args:[e]}];for(let{cmd:o,args:r}of t)if(Yc(o))return Wo(o,r,{stdio:"ignore"});return Wo("mpv",["--no-video","--no-terminal",e],{stdio:"ignore"})}function Ks(e){try{let t=Xc(),o;return t==="darwin"?o=Wo("afplay",[e],{stdio:"ignore"}):t==="win32"?o=Wo("powershell",["-c",`(New-Object Media.SoundPlayer "${e}").PlaySync()`],{stdio:"ignore"}):o=Wc(e),o.on("error",()=>{}),o}catch{return null}}function zo(e){e&&!e.killed&&e.kill()}import Vs from"ky";var Xs="https://api.github.com/repos/tech-leads-club/agent-skills",zc=`${Xs}/contributors`,qo=null,Jo=null;async function Ys(){if(qo)return qo;try{return qo=(await Vs.get(zc,{headers:{Accept:"application/vnd.github.v3+json"},timeout:1e4}).json()).filter(({login:t})=>!qc(t)).map(({login:t,avatar_url:o,contributions:r})=>({login:t,avatarUrl:o,contributions:r})),qo}catch{return[]}}async function Ws(){if(Jo!==null)return Jo;try{return Jo=(await Vs.get(Xs,{headers:{Accept:"application/vnd.github.v3+json"},timeout:1e4}).json()).stargazers_count,Jo}catch{return 0}}function qc(e){return e.endsWith("[bot]")}import{jsx as O,jsxs as Be}from"react/jsx-runtime";var nd=220,on=52,Kt=["#1e3a8a","#3b82f6","#0ea5e9","#06b6d4","#22d3ee"],sd=14,tn=500,Zs=60,Zr="\u2500".repeat(on-4),Qs=40,en=["#f59e0b","#ef4444","#ec4899","#a855f7"],id={1:{badge:`${a.star}${a.star}${a.star}`,color:"#f59e0b"},2:{badge:`${a.star}${a.star}`,color:"#c0c0c0"},3:{badge:a.star,color:"#cd7f32"}};function ld(e,t){let o=[];o.push({type:"blank"}),o.push({type:"text",text:"A Tech Leads Club Production",color:"#94a3b8"}),o.push({type:"blank"}),o.push({type:"blank"}),o.push({type:"gradient",text:`${a.sparkle} C O N T R I B U T O R S ${a.sparkle}`,gradientColors:en}),o.push({type:"gradient",text:Zr,gradientColors:Kt}),o.push({type:"blank"});for(let s=0;s<e.length;s++){let i=e[s];o.push({type:"contributor",rank:s+1,login:i.login,contributions:i.contributions})}o.push({type:"blank"}),o.push({type:"blank"}),o.push({type:"gradient",text:`${a.star} S T A T S ${a.star}`,gradientColors:en}),o.push({type:"gradient",text:Zr,gradientColors:Kt}),o.push({type:"blank"}),t>0&&o.push({type:"text",text:`${a.star} GitHub Stars \xB7\xB7\xB7\xB7\xB7 ${t}`,color:"#f59e0b",bold:!0}),o.push({type:"text",text:`${a.diamond} Contributors \xB7\xB7\xB7\xB7\xB7 ${e.length}`,color:"#06b6d4"});let r=e.reduce((s,i)=>s+i.contributions,0);return o.push({type:"text",text:`${a.check} Contributions \xB7\xB7\xB7\xB7 ${r}`,color:"#22c55e"}),o.push({type:"blank"}),o.push({type:"blank"}),o.push({type:"gradient",text:`${a.sparkle} S P E C I A L T H A N K S ${a.sparkle}`,gradientColors:en}),o.push({type:"gradient",text:Zr,gradientColors:Kt}),o.push({type:"blank"}),o.push({type:"text",text:"To every contributor, stargazer,",color:"#94a3b8"}),o.push({type:"text",text:"and community member who makes",color:"#94a3b8"}),o.push({type:"text",text:"this project possible.",color:"#94a3b8"}),o.push({type:"blank"}),o.push({type:"text",text:"Built with \u2665 by the community",color:"#ef4444"}),o.push({type:"blank"}),o.push({type:"gradient",text:"github.com/tech-leads-club/agent-skills",gradientColors:Kt}),o.push({type:"blank"}),o.push({type:"blank"}),o.push({type:"blank"}),o}function ad(){try{let e=qs(td(import.meta.url));for(let t=0;t<5;t++){let o=ed(e,"assets","chiptune.mp3");if(Zc(o))return o;e=qs(e)}return null}catch{return null}}function cd({rank:e,login:t,contributions:o}){let r=id[e],s=r?.color??"#e2e8f0",i=e.toString().padStart(2),l=`@${t}`,c=`${o}`,d=r?` ${r.badge}`:"",m=5+l.length+d.length+1+c.length,p=Math.max(2,on-4-m),g="\xB7".repeat(p);return Be(G,{children:[Be(G,{color:"#64748b",children:[i,". "]}),O(G,{color:s,bold:!!r,children:l}),O(G,{color:r?.color??"#94a3b8",children:d}),Be(G,{color:"#334155",children:[" ",g," "]}),O(G,{color:"#22c55e",bold:!0,children:c})]})}function dd({line:e}){switch(e.type){case"blank":return O(G,{children:" "});case"text":return O(G,{color:e.color,bold:e.bold,children:e.text});case"gradient":return O(Zo,{colors:[...e.gradientColors],children:O(G,{children:e.text})});case"contributor":return O(cd,{rank:e.rank,login:e.login,contributions:e.contributions})}}function md({speed:e,paused:t}){if(t)return Be(G,{color:n.warning,bold:!0,children:[" ",a.bar,a.bar," PAUSED"]});let o=Math.round((tn-e)/(tn-Zs)*4)+1,r="\u25AE".repeat(o)+"\u25AF".repeat(5-o);return Be(G,{color:n.textMuted,children:[" ",r]})}function er({onExit:e}){let{stdout:t}=Qc(),o=t?.rows??24,r=Math.max(6,o-sd-4),[s,i]=jt([]),[l,c]=jt(0),[d,m]=jt(!0),[p,g]=jt(0),[u,f]=jt(nd),[h,T]=jt(!1),B=Js(null),F=Js(null);Qo(()=>{Promise.all([Ys(),Ws()]).then(([I,y])=>{i(I),c(y),m(!1)})},[]),Qo(()=>{let I=ad();return I&&(B.current=Ks(I)),()=>{zo(B.current)}},[]);let N=rd(()=>ld(s,l),[s,l]),k=N.length+r,C=p>=k,A=od(()=>{g(I=>I>=k?I:I+1)},[k]);if(Qo(()=>{if(d||h||C){F.current&&clearInterval(F.current),F.current=null;return}return F.current=setInterval(A,u),()=>{F.current&&clearInterval(F.current)}},[d,h,C,u,A]),Qo(()=>{if(!C)return;let I=setTimeout(()=>{zo(B.current),e()},3e3);return()=>clearTimeout(I)},[C,e]),Jc((I,y)=>{if(y.escape){zo(B.current),e();return}if(I===" "){T(v=>!v);return}if(y.upArrow){f(v=>Math.max(Zs,v-Qs));return}if(y.downArrow){f(v=>Math.min(tn,v+Qs));return}}),d)return O(lt,{flexDirection:"column",alignItems:"center",padding:2,children:O(G,{color:n.accent,children:"Loading contributors..."})});let b={type:"blank"},E=Array(r).fill(b),R=Array(r).fill(b),P=[...E,...N,...R].slice(p,p+r);return Be(lt,{flexDirection:"column",alignItems:"center",children:[O(lt,{marginBottom:-1,children:O(Zo,{colors:["#1e3a8a","#3b82f6"],children:O(zs,{text:"TLC",font:"tiny"})})}),O(lt,{children:O(Zo,{colors:[...Kt],children:O(zs,{text:"AGENT SKILLS",font:"block"})})}),O(lt,{children:O(Zo,{colors:[...Kt],children:O(G,{children:"\u2500".repeat(60)})})}),O(lt,{flexDirection:"column",alignItems:"center",height:r,width:on,children:P.map((I,y)=>O(lt,{justifyContent:"center",children:O(dd,{line:I})},`cl-${p}-${y}`))}),Be(lt,{marginTop:1,gap:2,children:[Be(G,{children:[O(G,{color:n.accent,bold:!0,children:"space"}),O(G,{color:n.textDim,children:" pause"})]}),O(G,{color:n.textMuted,children:a.dot}),Be(G,{children:[Be(G,{color:n.accent,bold:!0,children:[a.arrowUp,a.arrowDown]}),O(G,{color:n.textDim,children:" speed"})]}),O(md,{speed:u,paused:h}),O(G,{color:n.textMuted,children:a.dot}),Be(G,{children:[O(G,{color:n.warning,bold:!0,children:"esc"}),O(G,{color:n.textDim,children:" back"})]})]})]})}import{Box as he,Text as W,useInput as ud}from"ink";import{useState as rn}from"react";import{jsx as U,jsxs as xe}from"react/jsx-runtime";function ei({onConfirm:e,onBack:t,initialMethod:o="copy",initialGlobal:r=!1}){let[s,i]=rn("method"),[l,c]=rn(o),[d,m]=rn(r);return s==="method"?xe(he,{flexDirection:"column",paddingX:1,children:[U(M,{}),U(he,{marginBottom:1,children:xe(W,{bold:!0,color:n.primary,children:[a.diamond," Choose installation method:"]})}),U(Je,{items:[{label:"Copy",value:"copy",hint:"independent copies (recommended)"},{label:"Symlink",value:"symlink",hint:"shared source (may not work with all agents)"}],onSelect:p=>{c(p),i("scope")},onCancel:t})]}):s==="scope"?xe(he,{flexDirection:"column",paddingX:1,children:[U(M,{}),U(he,{marginBottom:1,children:xe(W,{bold:!0,color:n.primary,children:[a.diamond," Choose installation scope:"]})}),U(Je,{items:[{label:"Local",value:!1,hint:"this project only"},{label:"Global",value:!0,hint:"user home directory"}],onSelect:p=>{m(p),i("confirm")},onCancel:()=>i("method")})]}):U(fd,{method:l,isGlobal:d,onConfirm:()=>e({method:l,global:d}),onBack:()=>i("scope")})}function fd({method:e,isGlobal:t,onConfirm:o,onBack:r}){return ud((s,i)=>{(i.return||s==="y"||s==="Y")&&o(),(i.escape||s==="n"||s==="N")&&r()}),xe(he,{flexDirection:"column",paddingX:1,children:[U(M,{}),xe(he,{flexDirection:"column",borderStyle:"round",borderColor:n.accent,paddingX:2,paddingY:1,children:[U(he,{marginBottom:1,children:xe(W,{bold:!0,color:n.accent,children:[a.diamond," Ready to install"]})}),xe(he,{children:[U(he,{width:10,children:U(W,{color:n.textDim,children:"Method"})}),U(W,{color:n.text,bold:!0,children:e==="copy"?"Copy":"Symlink"}),xe(W,{color:n.textMuted,children:[" ",a.dot," ",e==="copy"?"Recommended":"Developer mode"]})]}),xe(he,{children:[U(he,{width:10,children:U(W,{color:n.textDim,children:"Scope"})}),U(W,{color:n.text,bold:!0,children:t?"Global":"Local"}),xe(W,{color:n.textMuted,children:[" ",a.dot," ",t?"User home":"This project"]})]})]}),U(he,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:U(he,{justifyContent:"space-between",width:"100%",children:xe(W,{children:[U(W,{color:n.success,bold:!0,children:"Y"}),U(W,{color:n.textDim,children:" / "}),U(W,{color:n.success,bold:!0,children:"enter"}),U(W,{color:n.textDim,children:" confirm"}),xe(W,{color:n.textDim,children:[" ",a.dot," "]}),U(W,{color:n.warning,bold:!0,children:"N"}),U(W,{color:n.textDim,children:" / "}),U(W,{color:n.warning,bold:!0,children:"esc"}),U(W,{color:n.textDim,children:" back"})]})})})]})}import{Box as wt,Text as Tt,useInput as em}from"ink";import tm from"ink-spinner";import{useAtom as bi,useAtomValue as om,useSetAtom as rm}from"jotai";import{useEffect as nm,useMemo as sm,useState as Ct}from"react";Y();ee();import{atom as ti}from"jotai";import{unwrap as gd}from"jotai/utils";var pd=async()=>{let e=Co(w),t={};for(let o of e){let[r,s]=await Promise.all([$r(w,o,!1).catch(()=>[]),$r(w,o,!0).catch(()=>[])]);for(let i of new Set([...r,...s]))t[i]||(t[i]=[]),t[i].includes(o)||t[i].push(o)}return t},nn=ti(0),hd=ti(async e=>(e(nn),pd())),Ue=gd(hd,e=>e??{});import{atom as oi}from"jotai";var tr=oi([]),ri=oi([]);import{Box as $e,Text as se,useInput as xd}from"ink";import{jsx as ie,jsxs as Le}from"react/jsx-runtime";function or({results:e,onExit:t,title:o="Installation Complete",successLabel:r="succeeded"}){xd((f,h)=>{(h.return||h.escape)&&t()});let s=new Set(e.filter(f=>f.success).map(f=>f.skill)),i=new Set(e.filter(f=>!f.success).map(f=>f.skill)),l=s.size,c=i.size,d=l===0&&c>0,m=c>0,p=d?n.error:m?n.warning:n.success,g=d?`${a.cross} Installation Failed`:m?`${a.warning} Partially Installed`:`${a.check} ${o}`,u=d?n.error:m?n.warning:n.success;return Le($e,{flexDirection:"column",paddingX:1,children:[ie(M,{}),Le($e,{flexDirection:"column",borderStyle:"round",borderColor:p,paddingX:2,paddingY:1,children:[ie($e,{marginBottom:1,children:ie(se,{color:u,bold:!0,children:g})}),e.map((f,h)=>Le($e,{flexDirection:"column",children:[Le($e,{paddingX:1,children:[ie($e,{width:2,children:ie(se,{color:f.success?n.success:n.error,children:f.success?a.check:a.cross})}),ie(se,{color:f.success?n.text:n.error,children:f.skill}),Le(se,{color:n.textDim,children:[" ",a.arrow," ",f.agent]})]}),!f.success&&f.error&&ie($e,{paddingLeft:4,children:ie(se,{color:n.error,dimColor:!0,children:f.error})})]},h)),(l>0||c>0)&&ie($e,{marginTop:1,children:Le(se,{color:n.textDim,children:[l>0&&Le(se,{color:n.success,children:[l," ",r]}),l>0&&c>0&&Le(se,{children:[" ",a.dot," "]}),c>0&&Le(se,{color:n.error,children:[c," failed"]})]})}),ie($e,{marginTop:1,children:Le(se,{color:n.textDim,children:["View details: ",ie(se,{color:n.accent,children:"agent-skills audit"})]})})]}),ie($e,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:Le(se,{children:[ie(se,{color:n.success,bold:!0,children:"enter"}),ie(se,{color:n.textDim,children:" / "}),ie(se,{color:n.warning,bold:!0,children:"esc"}),ie(se,{color:n.textDim,children:" exit"})]})})]})}import{Box as V,Text as $,useInput as bd}from"ink";import Cd from"ink-spinner";import{useAtomValue as ni}from"jotai";import{useMemo as sn,useState as ln}from"react";Y();ee();import{atom as yd}from"jotai";import{unwrap as kd}from"jotai/utils";var Sd=yd(async()=>vo(w)),Vt=kd(Sd,e=>e??new Map);import{jsx as _,jsxs as j}from"react/jsx-runtime";function rr({selectedAgents:e,onExit:t}){let[o,r]=ln(e||[]),{removeMultiple:s,progress:i,results:l}=Is(),c=ni(Ue),d=ni(Vt),[m,p]=ln(e?"select":"agent-select"),[g,u]=ln([]),f=e||o,h=sn(()=>{let k={};return Object.entries(c).forEach(([C,A])=>{let b=A.filter(E=>f.includes(E));b.length>0&&(k[C]=b)}),k},[c,f]),T=sn(()=>Object.keys(h),[h]),B=sn(()=>T.map(k=>{let C=d instanceof Map&&d.has(k),A=`${h[k].length} agents: ${h[k].join(", ")}`,b=C?`${A} \u26A0 deprecated`:A;return{label:k,value:k,hint:b}}),[T,h,d]);if(bd((k,C)=>{m==="done"&&(C.return||C.escape)&&t(),T.length===0&&C.escape&&t()}),m==="agent-select")return _(Ht,{onSelect:k=>{r(k),p("select")},onBack:t});if(T.length===0)return j(V,{flexDirection:"column",paddingX:1,children:[_(M,{}),_(V,{borderStyle:"round",borderColor:n.warning,paddingX:2,paddingY:1,children:_($,{color:n.warning,children:"No skills found to remove for the selected agents."})}),_(V,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:j($,{children:[_($,{color:n.warning,bold:!0,children:"esc"}),_($,{color:n.textDim,children:" exit"})]})})]});let F=k=>{k.length!==0&&(u(k),p("confirm"))},N=async()=>{p("removing");let k=g.map(C=>({name:C,agents:h[C]||[]}));await s(k),p("done")};if(m==="select")return j(V,{flexDirection:"column",paddingX:1,children:[_(M,{}),_(V,{marginBottom:1,children:j($,{bold:!0,color:n.error,children:[a.diamond," Select skills to remove:"]})}),_($t,{items:B,onSubmit:F,onCancel:t})]});if(m==="confirm")return j(V,{flexDirection:"column",paddingX:1,children:[_(M,{}),j(V,{flexDirection:"column",borderStyle:"round",borderColor:n.error,paddingX:2,paddingY:1,children:[_(V,{marginBottom:1,children:j($,{color:n.error,bold:!0,children:[a.cross," Remove ",g.length," skill",g.length>1?"s":"","?"]})}),g.map(k=>j(V,{paddingX:1,children:[_(V,{width:2,children:_($,{color:n.error,children:a.dot})}),_($,{color:n.textDim,children:k})]},k))]}),_(V,{marginTop:1,children:_(Je,{items:[{label:"Yes, remove them",value:"yes"},{label:"No, cancel",value:"no"}],onSelect:k=>{k==="yes"?N():p("select")}})})]});if(m==="removing")return j(V,{flexDirection:"column",paddingX:1,children:[_(M,{}),j(V,{marginTop:1,children:[j($,{color:n.accent,children:[_(Cd,{type:"dots"})," "]}),_($,{children:"Removing skills..."})]}),_(V,{marginTop:1,paddingX:2,children:j($,{color:n.textDim,children:[a.arrow," ",i.skill," (",i.current,"/",i.total,")"]})})]});if(m==="done"){let k=l.filter(b=>b.success).length,C=l.filter(b=>!b.success).length,A=k===0;return j(V,{flexDirection:"column",paddingX:1,children:[_(M,{}),j(V,{flexDirection:"column",borderStyle:"round",borderColor:A?n.error:n.success,paddingX:2,paddingY:1,children:[_(V,{marginBottom:1,children:j($,{color:A?n.error:n.success,bold:!0,children:[A?a.cross:a.check," ",A?"Removal Failed":"Removal Complete"]})}),l.map((b,E)=>j(V,{paddingX:1,children:[_(V,{width:2,children:_($,{color:b.success?n.success:n.error,children:b.success?a.check:a.cross})}),_($,{color:b.success?n.text:n.error,children:b.skill}),j($,{color:n.textDim,children:[" ",a.arrow," ",b.agent]}),!b.success&&b.error&&j($,{color:n.error,children:[" (",b.error,")"]})]},E)),(k>0||C>0)&&_(V,{marginTop:1,children:j($,{color:n.textDim,children:[k>0&&j($,{color:n.success,children:[k," succeeded"]}),k>0&&C>0&&j($,{children:[" ",a.dot," "]}),C>0&&j($,{color:n.error,children:[C," failed"]})]})})]}),_(V,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:j($,{children:[_($,{color:n.success,bold:!0,children:"enter"}),_($,{color:n.textDim,children:" / "}),_($,{color:n.warning,bold:!0,children:"esc"}),_($,{color:n.textDim,children:" exit"})]})})]})}return null}Y();import{Box as q,Text as Te,useInput as Kd,useStdout as Vd}from"ink";import{useAtomValue as mn}from"jotai";import{useMemo as un,useState as rt}from"react";import{Box as ii,Text as Xt}from"ink";import{useMemo as wd}from"react";function si(e,t){return e>0?`(${e}/${t})`:`(${t})`}import{jsx as nr,jsxs as sr}from"react/jsx-runtime";var li=({name:e,totalCount:t,installedCount:o=0,isExpanded:r=!1,isFocused:s=!1})=>{let i=wd(()=>si(o,t),[o,t]),l=r?"\u25BE":"\u25B8";return sr(ii,{children:[nr(ii,{width:2,children:s?nr(Xt,{color:n.accent,children:a.bullet}):nr(Xt,{children:" "})}),sr(Xt,{color:s?n.accent:n.primaryLight,bold:!0,children:[l," "]}),nr(Xt,{color:s?n.accent:n.text,bold:!0,children:e}),sr(Xt,{color:o>0?n.success:n.textMuted,children:[" ",i]}),!r&&s&&sr(Xt,{color:n.textDim,children:[" ",a.dot," press space to expand"]})]})};import{Box as vx,Text as Ex,useInput as Dx}from"ink";import{useState as Lx}from"react";import{jsx as _x,jsxs as Ox}from"react/jsx-runtime";import{Box as ir,Text as ai}from"ink";import Td from"ink-text-input";import{jsx as Yt,jsxs as Ad}from"react/jsx-runtime";var ci=({query:e,onChange:t,total:o,filtered:r,isLoading:s=!1,focus:i=!0})=>Ad(ir,{borderStyle:"round",borderColor:i?n.accent:n.border,paddingX:1,children:[Yt(ir,{marginRight:1,children:Yt(ai,{children:"\u{1F50D}"})}),Yt(ir,{flexGrow:1,children:Yt(Td,{value:e,onChange:t,placeholder:"Type to filter skills...",focus:i})}),Yt(ir,{marginLeft:1,children:Yt(ai,{color:n.textDim,children:s?"Loading...":`${r}/${o} skills`})})]});import{Box as St,Text as lr}from"ink";import{Box as Id,Text as Pd}from"ink";import{jsx as Dd,jsxs as Ed}from"react/jsx-runtime";var vd={installed:{icon:a.check,label:"installed",color:n.success,bg:"#052e16"},update:{icon:a.arrowUp,label:"update",color:n.warning,bg:"#422006"},new:{icon:a.sparkle,label:"new",color:n.accent,bg:"#083344"},deprecated:{icon:a.warning,label:"deprecated",color:n.warning,bg:"#422006"}};function di({status:e}){let t=vd[e];return t?Dd(Id,{children:Ed(Pd,{backgroundColor:t.bg,color:t.color,children:[" ",t.icon," ",t.label," "]})}):null}import{jsx as Ge,jsxs as mi}from"react/jsx-runtime";function ui({name:e,description:t,status:o,selected:r=!1,focused:s=!1,readOnly:i=!1}){let l=o==="installed",c=l?a.checkboxActive:r?a.checkboxActive:a.checkboxInactive,d=l?n.textMuted:r?n.success:n.textMuted,m=s?a.bullet:" ",p=l?n.textMuted:r?n.success:n.accent,g=l?n.textDim:s?n.primary:r?n.primaryLight:n.text,u=n.textMuted,f=s?n.bgLight:void 0;return mi(St,{flexDirection:"column",backgroundColor:f,children:[mi(St,{children:[Ge(St,{width:2,flexShrink:0,children:Ge(lr,{color:p,children:m})}),!i&&Ge(St,{width:2,flexShrink:0,children:Ge(lr,{color:d,children:c})}),Ge(St,{flexGrow:1,children:Ge(lr,{bold:!0,color:g,children:e})}),o&&Ge(St,{marginLeft:1,flexShrink:0,children:Ge(di,{status:o})})]}),Ge(St,{paddingLeft:i?2:4,children:Ge(lr,{color:u,wrap:"truncate",children:t})})]})}import He from"chalk";import{Box as bt,Text as re,useInput as Bd,useStdout as Ld}from"ink";import Rd from"ink-spinner";import pi,{useCallback as Md,useEffect as _d,useMemo as Od,useRef as cn,useState as Fd}from"react";var an={web:"#3b82f6",devops:"#10b981",data:"#8b5cf6",mobile:"#f59e0b",testing:"#ef4444",ai:"#06b6d4",security:"#ec4899",default:"#64748b"};function fi(e){return Object.prototype.hasOwnProperty.call(an,e)?an[e]:an.default}Y();import{Fragment as Hd,jsx as fe,jsxs as ke}from"react/jsx-runtime";var Nd=6,Ud=2,$d=2,ye={h1:e=>He.hex(n.primary).bold(e),h2:e=>He.hex(n.primaryLight).bold(e),h3:e=>He.hex(n.accent).bold(e),text:e=>He.hex(n.textDim)(e),muted:e=>He.hex(n.textMuted)(e),code:e=>He.hex(n.accent)(e),border:e=>He.hex(n.border)(e),bold:e=>He.hex(n.text).bold(e),dim:e=>He.dim(e),indicator:e=>He.hex(n.textDim)(e)};function gi(e){return e.replace(/\*\*(.+?)\*\*/g,(t,o)=>ye.bold(o)).replace(/\*(.+?)\*/g,(t,o)=>ye.dim(o)).replace(/`(.+?)`/g,(t,o)=>ye.code(o))}function Gd(e){let t=[];for(let o of e)switch(o.type){case"heading":{let r=o.level===1?a.diamond:o.level===2?a.arrow:a.dot,s=o.level===1?ye.h1:o.level===2?ye.h2:ye.h3;o.level===1&&t.length>0&&t.push(""),t.push(s(`${r} ${o.text}`));break}case"paragraph":t.push(ye.text(gi(o.text)));break;case"list-item":{let r=" ".repeat(o.indent);t.push(`${r}${ye.muted(a.bullet)} ${ye.text(gi(o.text))}`);break}case"code-block":o.language&&t.push(ye.dim(` ${o.language}`));for(let r of o.lines)t.push(` ${ye.border(a.bar)} ${ye.code(r)}`);break;case"hr":t.push(ye.border("\u2500".repeat(30)));break;case"blank":t.push("");break}return t}var hi=pi.memo(({skill:e,metadata:t})=>{let o=fi(e.category??"default"),r=t?.author?` ${a.dot} @${t.author}`:"",s=t?.files?.length?` ${a.dot} ${t.files.length} file${t.files.length!==1?"s":""}`:"";return ke(bt,{flexDirection:"column",marginBottom:1,children:[ke(re,{bold:!0,color:n.text,children:[a.sparkle," ",e.name]}),ke(re,{children:[fe(re,{color:o,bold:!0,children:e.category}),ke(re,{color:n.textDim,children:[r,s]})]}),fe(re,{color:n.textDim,wrap:"truncate",children:e.description})]})});hi.displayName="MetadataHeader";var dn=pi.memo(({skill:e,expanded:t=!1,onClose:o,onToggleExpand:r})=>{let{metadata:s,content:i,loading:l,error:c}=Ps(e?.name??null),{stdout:d}=Ld(),[m,p]=Fd(0),g=d?.rows??24,u=Od(()=>i?Gd(fs(i)):[],[i]),f=Math.max(10,g-17),h=Math.max(3,f-Nd-Ud),T=Math.max(1,h-$d),B=Math.max(0,u.length-T),F=B>0,N=F?Math.round((m+T)/u.length*100):100,k=cn(B);k.current=B;let C=cn(o);C.current=o;let A=cn(r);A.current=r;let b=Md((P,I)=>{I.upArrow?p(y=>Math.max(0,y-1)):I.downArrow?p(y=>Math.min(k.current,y+1)):P==="f"?A.current?.():(I.escape||I.tab||I.leftArrow)&&C.current()},[]);if(Bd(b),_d(()=>{p(0)},[e?.name]),!e)return null;let E=m>0,R=m+T<u.length,K=u.slice(m,m+T);return ke(bt,{flexDirection:"column",borderStyle:"round",borderColor:n.accent,paddingX:1,flexGrow:1,children:[ke(bt,{children:[ke(re,{bold:!0,color:n.accent,children:[a.info," Skill Details"]}),fe(bt,{flexGrow:1}),ke(re,{color:n.textMuted,children:[F&&ke(re,{color:n.textDim,children:[N,"% ",a.dot," "]}),fe(re,{color:n.accent,bold:!0,children:"\u2191\u2193"})," ","scroll ",a.dot," ",fe(re,{color:n.accent,bold:!0,children:"f"})," ",t?"compact":"expand"," ",a.dot," ",fe(re,{color:n.accent,bold:!0,children:"Esc"})," ","close"]})]}),fe(re,{color:n.border,wrap:"truncate",children:"\u2500".repeat(200)}),l?fe(bt,{alignItems:"center",justifyContent:"center",flexGrow:1,children:ke(re,{color:n.accent,children:[fe(Rd,{type:"dots"})," Loading\u2026"]})}):c?fe(bt,{alignItems:"center",justifyContent:"center",flexGrow:1,children:ke(re,{color:n.error,children:[a.cross," ",c]})}):ke(Hd,{children:[fe(hi,{skill:e,metadata:s}),ke(bt,{flexDirection:"column",height:h,overflowY:"hidden",children:[E&&fe(re,{color:n.textDim,children:` ${a.arrowUp} ${a.arrowUp} ${a.arrowUp}`}),fe(re,{children:K.join(`
12
+ `)}),R&&fe(re,{color:n.textDim,children:` ${a.arrowDown} ${a.arrowDown} ${a.arrowDown}`})]})]})]})});dn.displayName="SkillDetailPanel";function jd(){return{width:process.stdout.columns||80,height:process.stdout.rows||24}}function xi(){let{width:e,height:t}=jd();return e>=80&&t>=24}ee();import{Fragment as qd,jsx as H,jsxs as le}from"react/jsx-runtime";var Xd=5,Yd=24,Wd=.35,zd=e=>{let t=[{key:"/",description:"Filter skills"},{key:"\u2190/\u2192",description:"Collapse / expand"},{key:"tab/\u2192",description:"Skill details"},{key:"f",description:"Expand / compact panel"}],o={key:"esc",description:e?"Exit / close panel":"Back / close panel"};return e?[...t,o]:[...t,{key:"space",description:"Toggle / expand"},{key:"enter",description:"Install selected"},{key:"ctrl+a",description:"Select all"},o]},ar=({onInstall:e,onExit:t,overrideSkills:o,readOnly:r=!1})=>{let{skills:s,loading:i,error:l}=st(),{stdout:c}=Vd(),d=mn(tr),m=mn(Ue),p=mn(Vt),g=o||s,u=o?!1:i,{query:f,setQuery:h,filtered:T}=Ts(g,{keys:["name","description","category"]}),[B,F]=rt(new Set),[N,k]=rt("list"),[C,A]=rt(0),[b,E]=rt(0),[R,K]=rt(!1),[P,I]=rt(!1),[y,v]=rt(null),[J,Q]=rt(!1),[uo,Ve]=rt(null),Z=xi(),Me=c?.rows??40,dr=c?.columns??120,Xe=Math.max(Xd,Me-Yd),Ni=Math.max(30,Math.round(dr*Wd)),Ui=Math.max(10,Me-17),hn=f.trim().length>0,xn=un(()=>To(w,T),[T]);un(()=>{f&&K(!0)},[f]);let Qt=x=>hn||uo===x,yn=x=>{Ve(Qt(x)?null:x)},be=un(()=>{let x=[];for(let[L,Ce]of xn.entries()){let Pt=Ce.filter(Zt=>{let fo=m[Zt.name]||[];return d.length>0?fo.some(bn=>d.includes(bn)):fo.length>0}).length;x.push({type:"header",category:L.name,categoryId:L.id,count:Ce.length,installedCount:Pt}),Qt(L.name)&&Ce.forEach(Zt=>x.push({type:"skill",skill:Zt}))}return x},[xn,uo,hn,m,d]),$i=()=>I(x=>!x),Gi=()=>{if(R){K(!1),h(""),k("list");return}t?.()},Hi=()=>{let x=T.map(L=>L.name);F(B.size===x.length?new Set:new Set(x))},ji=x=>{(x.downArrow||x.return)&&be.length>0&&(k("list"),A(0))},Ki=()=>{if(C===0&&R){k("search");return}let x=Math.max(0,C-1);A(x),x<b&&E(x)},Vi=()=>{let x=Math.min(be.length-1,C+1);A(x),x>=b+Xe&&E(x-Xe+1)},Xi=()=>{let x=be[C];if(x.type==="header"){yn(x.category);return}if(x.type==="skill"&&!r){if((d.length>0?m[x.skill.name]?.some(Pt=>d.includes(Pt))??!1:(m[x.skill.name]?.length??0)>0)&&!o)return;let Ce=new Set(B);Ce.has(x.skill.name)?Ce.delete(x.skill.name):Ce.add(x.skill.name),F(Ce)}},Yi=()=>{let x=be[C];if(x.type==="header"){yn(x.category);return}if(r)return;let L=g.filter(Ce=>B.has(Ce.name));L.length>0&&e?.(L)},kn=x=>{let L=be[C];if(L.type==="skill"&&Z){v(L.skill),Q(!1);return}!x&&L.type==="header"&&!Qt(L.category)&&Ve(L.category)},Wi=()=>{let x=be[C];x.type==="header"&&Qt(x.category)&&Ve(null)},zi=(x,L)=>x.length===1&&!L.ctrl&&!L.meta&&!L.upArrow&&!L.downArrow&&!L.leftArrow&&!L.rightArrow;Kd((x,L)=>{if(x==="?")return $i();if(P)return I(!1);if(L.escape)return Gi();if(!R&&x==="/"){K(!0),k("search");return}if(x==="a"&&L.ctrl&&!r)return Hi();if(N==="search")return ji(L);if(N==="list"){if(L.upArrow)return Ki();if(L.downArrow)return Vi();if(x===" ")return Xi();if(L.return)return Yi();if(L.tab)return kn(!0);if(L.rightArrow)return kn(!1);if(L.leftArrow)return Wi();zi(x,L)&&(K(!0),k("search"),h(x))}},{isActive:!y});let qi=be.slice(b,b+Xe),Ji=b>0,Qi=b+Xe<be.length,Zi=be.length<=Xe?100:Math.round((b+Xe)/be.length*100),el=!y||!J;if(u)return le(q,{flexDirection:"column",paddingX:1,children:[H(M,{}),H(q,{flexDirection:"column",alignItems:"center",justifyContent:"center",paddingY:4,children:H(Te,{color:n.accent,children:"Loading skills..."})})]});if(l||!u&&g.length===0)return le(q,{flexDirection:"column",paddingX:1,minHeight:20,children:[H(M,{}),le(q,{flexDirection:"column",alignItems:"center",justifyContent:"center",flexGrow:1,children:[le(q,{flexDirection:"column",borderStyle:"round",borderColor:n.error,paddingX:3,paddingY:2,alignItems:"center",children:[le(Te,{color:n.error,bold:!0,children:[a.cross," No Skills Available"]}),H(q,{marginTop:1,children:H(Te,{color:n.textDim,children:"Check your internet connection and try again"})}),l&&H(q,{marginTop:1,children:H(Te,{color:n.textMuted,dimColor:!0,children:l})})]}),H(q,{marginTop:2,children:le(Te,{color:n.textDim,children:["Press"," ",H(Te,{color:n.accent,bold:!0,children:"Esc"})," ","to exit"]})})]})]});let tl=(x,L)=>{let Ce=b+L,Pt=N==="list"&&Ce===C;if(x.type==="header")return H(q,{marginTop:L===0?0:1,children:H(li,{name:x.category,categoryId:x.categoryId,totalCount:x.count,installedCount:x.installedCount,isExpanded:Qt(x.category),isFocused:Pt})},`cat-${x.category}`);let Zt=B.has(x.skill.name),fo=d.length>0?m[x.skill.name]?.some(sl=>d.includes(sl))??!1:(m[x.skill.name]?.length??0)>0,nl=p instanceof Map&&p.has(x.skill.name)?"deprecated":fo?"installed":null;return H(ui,{name:x.skill.name,description:x.skill.description,status:nl,selected:Zt,focused:Pt,readOnly:r},x.skill.name)},Sn=x=>H(q,{justifyContent:"center",marginBottom:x==="up"?1:0,marginTop:x==="down"?1:0,children:le(Te,{color:n.textDim,children:[x==="up"?a.arrowUp:a.arrowDown," ",x==="up"?a.arrowUp:a.arrowDown," ",x==="up"?a.arrowUp:a.arrowDown]})}),ol=()=>y?[{key:"\u2191/\u2193",label:"scroll"},{key:"f",label:J?"compact":"expand"},{key:"Esc",label:"close",color:n.warning}]:r?[{key:"/",label:"filter"},{key:"tab",label:"detail"},{key:"esc",label:"exit",color:n.warning},{key:"?",label:"help"}]:[{key:"space",label:"toggle"},{key:"enter",label:"install",color:n.success},{key:"/",label:"filter"},{key:"tab",label:"detail"},{key:"esc",label:"exit",color:n.warning},{key:"?",label:"help"}],rl=()=>{if(!y)return le(qd,{children:[!r&&B.size>0&&le(Te,{children:[le(Te,{color:n.success,bold:!0,children:[a.checkboxActive," ",B.size]}),H(Te,{color:n.textDim,children:" selected"})]}),be.length>Xe&&le(Te,{color:n.textDim,children:[!r&&B.size>0?` ${a.dot} `:"",Zi,"%"]})]})};return le(q,{flexDirection:"column",paddingX:1,minHeight:20,children:[H(M,{}),P?H(q,{flexDirection:"column",flexGrow:1,alignItems:"center",justifyContent:"center",children:H(Ut,{visible:P,onDismiss:()=>I(!1),shortcuts:zd(r)})}):le(q,{flexDirection:"row",height:y?Ui:void 0,flexGrow:y?0:1,overflow:"hidden",children:[el&&le(q,{flexDirection:"column",flexGrow:1,flexShrink:1,children:[R&&H(q,{marginBottom:1,children:H(ci,{query:f,onChange:x=>{h(x),A(0),E(0)},total:g.length,filtered:T.length,isLoading:u,focus:N==="search"})}),le(q,{flexDirection:"column",flexGrow:1,children:[Ji&&Sn("up"),qi.map(tl),Qi&&Sn("down"),be.length===0&&H(q,{paddingY:1,children:le(Te,{color:n.textMuted,children:['No skills match "',f,'"']})})]})]},"skill-list"),y&&H(q,{flexDirection:"column",width:J?void 0:Ni,flexGrow:J?1:0,flexShrink:0,children:H(dn,{skill:y,expanded:J,onClose:()=>{v(null),Q(!1)},onToggleExpand:()=>Q(x=>!x)})},"detail-panel")]}),H(it,{hints:ol(),status:rl()})]})};Y();import{Box as ge,Text as ae,useInput as Jd}from"ink";import yi from"ink-spinner";import{useAtomValue as ki}from"jotai";import{useEffect as Qd,useMemo as Si,useState as Wt}from"react";ee();import{jsx as X,jsxs as z}from"react/jsx-runtime";function cr({selectedAgents:e,onExit:t}){let[o,r]=Wt(!1),[s,i]=Wt(!1),[l,c]=Wt(!1),[d,m]=Wt(e||[]),[p,g]=Wt(!e),[u,f]=Wt([]),{install:h,progress:T,results:B,installing:F}=Oo(),N=ki(Ue),k=ki(Vt),{skills:C,loading:A}=st(),b=e||d,E=Si(()=>{if(A)return[];let P=new Set(Object.keys(N));return C.filter(I=>P.has(I.name)?(N[I.name]||[]).some(v=>b.includes(v)):!1)},[N,C,A,b]),R=Si(()=>{if(A||!(k instanceof Map)||k.size===0)return[];let P=new Set(Object.keys(N)),I=new Set(C.map(v=>v.name)),y=[];for(let v of P)k.has(v)?y.push({name:v,entry:k.get(v)}):I.has(v)||y.push({name:v});return y},[N,C,A,k]);if(Qd(()=>{if(E.length===0){r(!1),i(!0);return}r(!0),(async()=>{let I=E.map(J=>J.name),{toUpdate:y}=await Eo(w,I),v=E.filter(J=>y.includes(J.name));f(v),r(!1),i(!0)})()},[E]),Jd((P,I)=>{I.escape&&!F&&!l&&!o&&s&&u.length===0&&t()}),p)return X(Ht,{onSelect:P=>{m(P),g(!1)},onBack:t});let K=async P=>{if(P.length===0)return;let I=new Set;P.forEach(y=>{(N[y.name]||[]).forEach(J=>{b.includes(J)&&I.add(J)})}),await h(P,{agents:Array.from(I),method:"copy",global:!1,skills:P.map(y=>y.name),isUpdate:!0}),c(!0)};return l?X(or,{results:B,onExit:t,title:"Skills Updated Successfully",successLabel:"updated"}):F?z(ge,{flexDirection:"column",paddingX:1,children:[X(M,{}),z(ge,{marginTop:1,children:[z(ae,{color:n.accent,children:[X(yi,{type:"dots"})," "]}),X(ae,{children:"Updating skills..."})]}),X(ge,{marginTop:1,paddingX:2,children:z(ae,{color:n.textDim,children:[a.arrow," ",T.skill," (",T.current,"/",T.total,")"]})})]}):A||o?z(ge,{flexDirection:"column",paddingX:1,children:[X(M,{}),X(ge,{marginTop:1,children:z(ae,{color:n.accent,children:[X(yi,{type:"dots"})," ",o?"Checking for updates...":"Loading..."]})})]}):s&&u.length===0?z(ge,{flexDirection:"column",paddingX:1,children:[X(M,{}),X(ge,{borderStyle:"round",borderColor:n.success,paddingX:2,paddingY:1,children:z(ae,{color:n.success,children:[a.check," All installed skills are up to date!"]})}),R.length>0&&z(ge,{flexDirection:"column",marginTop:1,borderStyle:"round",borderColor:n.warning,paddingX:2,paddingY:1,children:[X(ge,{marginBottom:1,children:z(ae,{color:n.warning,bold:!0,children:[a.warning," ",R.length," deprecated skill",R.length>1?"s":""," detected:"]})}),R.map(P=>z(ge,{flexDirection:"column",paddingX:1,marginBottom:1,children:[z(ae,{color:n.warning,children:[a.arrow," ",P.name]}),P.entry?.message&&z(ae,{color:n.textDim,children:[" ",P.entry.message]}),!P.entry&&X(ae,{color:n.textDim,children:" No longer available in the registry"}),P.entry?.alternatives&&P.entry.alternatives.length>0&&z(ae,{color:n.textDim,children:[" ","Try: agent-skills install --skill ",P.entry.alternatives.join(", ")]})]},P.name)),z(ae,{color:n.textMuted,children:["Run: agent-skills remove --skill ","<name>"," to clean up"]})]}),X(ge,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:z(ae,{children:[X(ae,{color:n.warning,bold:!0,children:"esc"}),X(ae,{color:n.textDim,children:" exit"})]})})]}):X(Zd,{skills:u,installedSkills:N,selectedAgents:b,onUpdate:K,onExit:t})}function Zd({skills:e,installedSkills:t,selectedAgents:o,onUpdate:r,onExit:s}){let i=e.map(d=>{let p=(t[d.name]||[]).filter(g=>o.includes(g));return{label:d.name,value:d.name,hint:`${p.length} agent${p.length>1?"s":""}: ${p.join(", ")}`}}),l=e.map(d=>d.name),c=d=>{let m=e.filter(p=>d.includes(p.name));r(m)};return z(ge,{flexDirection:"column",paddingX:1,children:[X(M,{}),X(ge,{marginBottom:1,children:z(ae,{bold:!0,color:n.primary,children:[a.diamond," Select skills to update:"]})}),X(ge,{marginBottom:1,children:z(ae,{color:n.textDim,children:[e.length," installed skill",e.length>1?"s":""," found ",a.dot," all pre-selected"]})}),X($t,{items:i,initialSelected:l,onSubmit:c,onCancel:s})]})}import{jsx as ne,jsxs as nt}from"react/jsx-runtime";function Ci({onExit:e}){let{step:t,next:o,back:r}=vs(5),[s,i]=bi(tr),[l,c]=bi(ri),d=rm(nn),m=om(Ue),[p,g]=Ct("install"),[u,f]=Ct(!1),[h,T]=Ct(!1),[B,F]=Ct(!1),[N,k]=Ct({method:"copy",global:!1}),{skills:C}=st(),{install:A,progress:b,results:E,installing:R}=Oo(),[K,P]=Ct(!1),[I,y]=Ct(!1),v=Z=>{Z.length!==0&&(i(Z),o())},J=Z=>{if(g(Z),Z==="update"){T(!0);return}if(Z==="remove"){F(!0);return}o()},Q=Z=>{Z.length!==0&&(c(Z),o())},uo=Z=>{k(Z),o()},Ve=sm(()=>{if(p==="install")return;let Z=new Set;return Object.entries(m).forEach(([Me,dr])=>{dr.some(Xe=>s.includes(Xe))&&Z.add(Me)}),C.filter(Me=>Z.has(Me.name))},[p,m,C,s]);return nm(()=>{(async()=>t===5&&!K&&!I&&(P(!0),await A(l,{agents:s,skills:l.map(Me=>Me.name),method:N.method,global:N.global}),y(!0),d(Me=>Me+1)))()},[t,K,I,A,l,s,d]),t===5?I?ne(or,{results:E,onExit:e,title:"Installation Complete",successLabel:"installed"}):nt(wt,{flexDirection:"column",paddingX:1,children:[ne(M,{}),nt(wt,{marginTop:1,children:[nt(Tt,{color:n.accent,children:[ne(tm,{type:"dots"})," "]}),nt(Tt,{children:["Installing ",l.length," skills to ",s.length," agents..."]})]}),R&&ne(wt,{marginTop:1,paddingX:2,children:nt(Tt,{color:n.textDim,children:[a.arrow," ",b.skill," (",b.current,"/",b.total,")"]})})]}):h?ne(cr,{selectedAgents:s,onExit:()=>T(!1)}):B?ne(rr,{selectedAgents:s,onExit:()=>F(!1)}):u?ne(er,{onExit:()=>f(!1)}):nt(wt,{flexDirection:"column",children:[t===1&&ne(Ht,{onSelect:v,onBack:e}),t===2&&ne(Gs,{onSelect:J,onBack:r,onCredits:()=>f(!0)}),t===3&&(p==="install"||Ve&&Ve.length>0)&&ne(ar,{onInstall:Q,onExit:r,overrideSkills:Ve}),t===3&&p==="update"&&Ve&&Ve.length===0&&ne(im,{onBack:r}),t===4&&ne(ei,{onConfirm:uo,onBack:r,initialMethod:"copy",initialGlobal:!1})]})}function im({onBack:e}){return em((t,o)=>{(o.escape||t==="b"||o.backspace)&&e()}),nt(wt,{flexDirection:"column",paddingX:1,children:[ne(M,{}),ne(wt,{borderColor:n.success,borderStyle:"round",paddingX:2,paddingY:1,children:nt(Tt,{color:n.success,bold:!0,children:[a.check," All skills are up to date on selected agents"]})}),ne(wt,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:nt(Tt,{children:[ne(Tt,{color:n.warning,bold:!0,children:"esc"}),ne(Tt,{color:n.textDim,children:" back"})]})})]})}import{Box as wi,Text as fn}from"ink";import{useAtomValue as lm}from"jotai";import{useMemo as am}from"react";import{jsx as zt,jsxs as Ti}from"react/jsx-runtime";function Ai({onExit:e}){let t=lm(Ue),{skills:o,loading:r}=st(),s=am(()=>{if(r)return[];let i=new Set(Object.keys(t));return o.filter(l=>i.has(l.name))},[t,o,r]);return r?Ti(wi,{flexDirection:"column",padding:1,children:[zt(M,{}),zt(fn,{children:"Loading..."})]}):s.length===0?Ti(wi,{flexDirection:"column",padding:1,children:[zt(M,{}),zt(fn,{color:n.warning,children:"No skills installed."}),zt(fn,{color:n.textDim,children:"(Press any key to exit)"})]}):zt(ar,{onExit:e,readOnly:!0,overrideSkills:s})}import{jsx as at,jsxs as um}from"react/jsx-runtime";var At=({command:e="install"})=>{let{exit:t}=cm(),[o,r]=mm(e==="arcade"),{activated:s,reset:i}=As();return dm(()=>{s&&!o&&(r(!0),i())},[s,o,i]),e==="credits"?at(gn,{flexDirection:"column",padding:1,children:at(er,{onExit:t})}):o?at(gn,{flexDirection:"column",padding:1,children:at(Wr,{onExit:()=>{e==="arcade"?t():r(!1)}})}):um(gn,{flexDirection:"column",padding:1,children:[e==="list"&&at(Ai,{onExit:t}),e==="remove"&&at(rr,{onExit:t}),e==="update"&&at(cr,{onExit:t}),(e==="install"||!e)&&at(Ci,{onExit:t})]})};var Ke=new Tm;Ke.name("agent-skills").description("CLI to install and manage skills for AI coding agents").version(Ft);Ke.action(()=>{qt(Jt.createElement(At,{command:"install"}))});Ke.command("install").description("Install skills (interactive by default)").option("-g, --global","Install globally to user home",!1).option("-s, --skill <names...>","Install one or more skills").option("-a, --agent <agents...>","Target specific agents").option("--symlink","Use symlink instead of copy",!1).option("-f, --force","Force re-download skills (bypass cache)",!1).action(async e=>{if(pn(e)){qt(Jt.createElement(At,{command:"install"}));return}let{runCliInstall:t}=await Promise.resolve().then(()=>(Pi(),Ii));await t(e)});Ke.command("list").alias("ls").description("List available/installed agent skills").action(()=>{qt(Jt.createElement(At,{command:"list"}))});Ke.command("remove").alias("rm").description("Remove installed skills").option("-g, --global","Remove from global installation",!1).option("-s, --skill <names...>","Remove one or more skills").option("-a, --agent <agents...>","Target specific agents").option("-f, --force","Force removal even if not in lockfile",!1).action(async e=>{if(pn(e)){qt(Jt.createElement(At,{command:"remove"}));return}let{runCliRemove:t}=await Promise.resolve().then(()=>(Ei(),vi));await t(e)});Ke.command("update").description("Update installed skills to the latest version").option("-s, --skill <name>","Update a specific skill").action(async e=>{if(pn(e)){qt(Jt.createElement(At,{command:"update"}));return}let{runCliUpdate:t}=await Promise.resolve().then(()=>(Bi(),Di));await t(e)});Ke.command("cache").description("Manage the skills cache").option("--clear","Clear all cached skills and registry").option("--clear-registry","Clear only the registry cache").option("--path","Show cache directory path").action(async e=>{let{runCliCache:t}=await Promise.resolve().then(()=>(Ri(),Li));t(e)});Ke.command("credits").description("Show project contributors and credits").action(()=>{qt(Jt.createElement(At,{command:"credits"}))});Ke.command("audit").description("View audit log of skill operations").option("-n, --limit <number>","Number of entries to show","10").option("--path","Show audit log file path").action(async e=>{let{runCliAudit:t}=await Promise.resolve().then(()=>(Fi(),Oi));await t(e)});Ke.parse(process.argv);function pn(e){return Object.keys(e).filter(o=>o!=="parent").length===0}
13
13
  //# sourceMappingURL=index.js.map