@tech-leads-club/agent-skills 1.4.6 → 1.4.7

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