@tech-leads-club/agent-skills 1.2.0 → 1.2.1

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