@tech-leads-club/agent-skills 0.13.0 → 0.14.0-beta.0

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
@@ -59,7 +59,7 @@ Skills are packaged instructions and resources that extend AI agent capabilities
59
59
  ```
60
60
  packages/skills-catalog/skills/
61
61
  (category-name)/
62
- spec-driven-dev/
62
+ skill/
63
63
  SKILL.md ← Main instructions
64
64
  templates/ ← File templates
65
65
  references/ ← On-demand documentation
@@ -69,38 +69,21 @@ packages/skills-catalog/skills/
69
69
 
70
70
  Install skills to any of these AI coding agents:
71
71
 
72
- **Tier 1 — Most Popular**
72
+ <div align="center">
73
+ <br />
73
74
 
74
- <p align="center">
75
- <a href="https://cursor.com"><img src="https://img.shields.io/badge/Cursor-000000?style=for-the-badge&logo=cursor&logoColor=white" alt="Cursor" /></a>
76
- <a href="https://claude.ai/code"><img src="https://img.shields.io/badge/Claude_Code-191919?style=for-the-badge&logo=anthropic&logoColor=white" alt="Claude Code" /></a>
77
- <a href="https://github.com/features/copilot"><img src="https://img.shields.io/badge/GitHub_Copilot-000000?style=for-the-badge&logo=github&logoColor=white" alt="GitHub Copilot" /></a>
78
- <a href="https://codeium.com/windsurf"><img src="https://img.shields.io/badge/Windsurf-0066FF?style=for-the-badge&logo=codeium&logoColor=white" alt="Windsurf" /></a>
79
- <a href="https://github.com/cline/cline"><img src="https://img.shields.io/badge/Cline-4A154B?style=for-the-badge&logo=visual-studio-code&logoColor=white" alt="Cline" /></a>
80
- </p>
75
+ | Tier 1 (Popular) | Tier 2 (Rising) | Tier 3 (Enterprise) |
76
+ | :-------------------------------------------------------: | :--------------------------------------------------------------------: | :-----------------------------------------------------: |
77
+ | **[Claude Code](https://claude.ai/code)** | **[Aider](https://aider.chat)** | **[Amazon Q](https://aws.amazon.com/q/developer/)** |
78
+ | **[Cline](https://github.com/cline/cline)** | **[Antigravity](https://idx.google.com)** | **[Augment](https://www.augmentcode.com)** |
79
+ | **[Cursor](https://cursor.com)** | **[Gemini CLI](https://ai.google.dev/gemini-api/docs/code-execution)** | **[Droid (Factory.ai)](https://www.factory.ai)** |
80
+ | **[GitHub Copilot](https://github.com/features/copilot)** | **[Kilo Code](https://kilocode.ai)** | **[OpenCode](https://github.com/opencode-ai/opencode)** |
81
+ | **[Windsurf](https://codeium.com/windsurf)** | **[Kiro](https://kiro.dev/)** | **[Sourcegraph Cody](https://sourcegraph.com/cody)** |
82
+ | | **[OpenAI Codex](https://openai.com/index/introducing-codex/)** | **[Tabnine](https://www.tabnine.com)** |
83
+ | | **[Roo Code](https://roo.dev)** | |
84
+ | | **[TRAE](https://docs.trae.ai)** | |
81
85
 
82
- **Tier 2 — Rising Stars**
83
-
84
- <p align="center">
85
- <a href="https://aider.chat"><img src="https://img.shields.io/badge/Aider-FF6B6B?style=for-the-badge&logo=terminal&logoColor=white" alt="Aider" /></a>
86
- <a href="https://openai.com/index/introducing-codex/"><img src="https://img.shields.io/badge/OpenAI_Codex-412991?style=for-the-badge&logo=openai&logoColor=white" alt="OpenAI Codex" /></a>
87
- <a href="https://ai.google.dev/gemini-api/docs/code-execution"><img src="https://img.shields.io/badge/Gemini_CLI-4285F4?style=for-the-badge&logo=google&logoColor=white" alt="Gemini CLI" /></a>
88
- <a href="https://idx.google.com"><img src="https://img.shields.io/badge/Antigravity-4285F4?style=for-the-badge&logo=google&logoColor=white" alt="Antigravity" /></a>
89
- <a href="https://roo.dev"><img src="https://img.shields.io/badge/Roo_Code-FF4081?style=for-the-badge&logo=visual-studio-code&logoColor=white" alt="Roo Code" /></a>
90
- <a href="https://kilocode.ai"><img src="https://img.shields.io/badge/Kilo_Code-00D4AA?style=for-the-badge&logo=visual-studio-code&logoColor=white" alt="Kilo Code" /></a>
91
- <a href="https://docs.trae.ai"><img src="https://img.shields.io/badge/TRAE-8B5CF6?style=for-the-badge&logo=visual-studio-code&logoColor=white" alt="TRAE" /></a>
92
- </p>
93
-
94
- **Tier 3 — Enterprise & Specialized**
95
-
96
- <p align="center">
97
- <a href="https://aws.amazon.com/q/developer/"><img src="https://img.shields.io/badge/Amazon_Q-FF9900?style=for-the-badge&logo=amazon-aws&logoColor=white" alt="Amazon Q" /></a>
98
- <a href="https://www.augmentcode.com"><img src="https://img.shields.io/badge/Augment-6366F1?style=for-the-badge&logo=visual-studio-code&logoColor=white" alt="Augment" /></a>
99
- <a href="https://www.tabnine.com"><img src="https://img.shields.io/badge/Tabnine-5B5BD6?style=for-the-badge&logo=tabnine&logoColor=white" alt="Tabnine" /></a>
100
- <a href="https://github.com/opencode-ai/opencode"><img src="https://img.shields.io/badge/OpenCode-1A1A1A?style=for-the-badge&logo=terminal&logoColor=white" alt="OpenCode" /></a>
101
- <a href="https://sourcegraph.com/cody"><img src="https://img.shields.io/badge/Sourcegraph_Cody-FF5733?style=for-the-badge&logo=sourcegraph&logoColor=white" alt="Sourcegraph Cody" /></a>
102
- <a href="https://www.factory.ai"><img src="https://img.shields.io/badge/Droid_(Factory.ai)-121212?style=for-the-badge&logo=robot&logoColor=white" alt="Droid (Factory.ai)" /></a>
103
- </p>
86
+ </div>
104
87
 
105
88
  <p align="center">
106
89
  <sub>Missing your favorite agent? <a href="https://github.com/tech-leads-club/agent-skills/issues/new"><strong>Open an issue</strong></a> and we'll add support!</sub>
@@ -144,44 +127,59 @@ Each step shows a **← Back** option to return and revise your choices.
144
127
 
145
128
  ### CLI Options
146
129
 
130
+ > **Note**: You can use either `npx @tech-leads-club/agent-skills` or install globally and use `agent-skills` directly.
131
+
147
132
  ```bash
148
133
  # Interactive mode (default)
149
134
  npx @tech-leads-club/agent-skills
135
+ # or: agent-skills (if installed globally)
150
136
 
151
137
  # List available skills
152
- npx @tech-leads-club/agent-skills list
138
+ agent-skills list
139
+ agent-skills ls # Alias
153
140
 
154
141
  # Install a specific skill
155
- npx @tech-leads-club/agent-skills install -s tlc-spec-driven
142
+ agent-skills install -s tlc-spec-driven
156
143
 
157
144
  # Install to specific agents
158
- npx @tech-leads-club/agent-skills install -a cursor claude-code
145
+ agent-skills install -s my-skill -a cursor claude-code
159
146
 
160
147
  # Install globally (to ~/.gemini, ~/.claude, etc.)
161
- npx @tech-leads-club/agent-skills install -g
148
+ agent-skills install -s my-skill -g
149
+
150
+ # Use symlink instead of copy
151
+ agent-skills install -s my-skill --symlink
162
152
 
163
153
  # Force re-download (bypass cache)
164
- npx @tech-leads-club/agent-skills install -s my-skill --force
154
+ agent-skills install -s my-skill --force
165
155
 
166
156
  # Update a specific skill
167
- npx @tech-leads-club/agent-skills update -s my-skill
157
+ agent-skills update -s my-skill
158
+
159
+ # Update all installed skills
160
+ agent-skills update
161
+
162
+ # Remove a specific skill
163
+ agent-skills remove -s my-skill
164
+ agent-skills rm -s my-skill # Alias
168
165
 
169
- # Remove skills
170
- npx @tech-leads-club/agent-skills remove
166
+ # Remove from specific agents
167
+ agent-skills remove -s my-skill -a cursor windsurf
171
168
 
172
169
  # Manage cache
173
- npx @tech-leads-club/agent-skills cache --clear # Clear all cache
174
- npx @tech-leads-club/agent-skills cache --path # Show cache location
170
+ agent-skills cache --clear # Clear all cache
171
+ agent-skills cache --clear-registry # Clear only registry
172
+ agent-skills cache --path # Show cache location
175
173
 
176
174
  # Show help
177
- npx @tech-leads-club/agent-skills --help
175
+ agent-skills --help
178
176
  ```
179
177
 
180
178
  ### Global Installation (Optional)
181
179
 
182
180
  ```bash
183
181
  npm install -g @tech-leads-club/agent-skills
184
- tlc-skills # Use 'tlc-skills' instead of 'npx @tech-leads-club/agent-skills'
182
+ agent-skills # Use 'agent-skills' instead of 'npx @tech-leads-club/agent-skills'
185
183
  ```
186
184
 
187
185
  ## ⚡ How It Works
Binary file
package/index.js CHANGED
@@ -1,22 +1,9 @@
1
1
  #!/usr/bin/env node
2
- var an=Object.defineProperty;var cn=(t,e)=>()=>(t&&(e=t(t=0)),e);var un=(t,e)=>{for(var n in e)an(t,n,{get:e[n],enumerable:!0})};var fe={};un(fe,{addSkillToLock:()=>Mt,getAllLockedSkills:()=>Rn,getSkillFromLock:()=>Dn,readSkillLock:()=>ot,removeSkillFromLock:()=>Ft,writeSkillLock:()=>Lt});import{mkdir as wn,readFile as An,writeFile as In}from"node:fs/promises";import{homedir as Cn}from"node:os";import{dirname as Tn,join as $n}from"node:path";function pe(){return $n(Cn(),vn,xn)}function de(){return{version:Pn,skills:{}}}async function ot(){let t=pe();try{let e=await An(t,"utf-8"),n=JSON.parse(e);return typeof n.version!="number"||!n.skills?de():n}catch{return de()}}async function Lt(t){let e=pe();await wn(Tn(e),{recursive:!0}),await In(e,JSON.stringify(t,null,2),"utf-8")}async function Mt(t,e="local",n){let l=await ot(),o=new Date().toISOString(),r=l.skills[t];l.skills[t]={name:t,source:e,contentHash:n??r?.contentHash,installedAt:r?.installedAt??o,updatedAt:o},await Lt(l)}async function Ft(t){let e=await ot();return t in e.skills?(delete e.skills[t],await Lt(e),!0):!1}async function Dn(t){return(await ot()).skills[t]??null}async function Rn(){return(await ot()).skills}var vn,xn,Pn,Ut=cn(()=>{"use strict";vn=".agents",xn=".skill-lock.json",Pn=1});import{Command as lo}from"commander";import w from"picocolors";var dt={name:"@tech-leads-club/agent-skills",version:"0.13.0",description:"CLI to install and manage skills for AI coding agents",author:"Tech Leads Club",license:"MIT",repository:{type:"git",url:"git+https://github.com/tech-leads-club/agent-skills.git"},type:"module",bin:{"tlc-skills":"./index.js"},engines:{node:">=22"},publishConfig:{access:"public"},scripts:{build:"nx build",dev:"tsx src/index.ts",test:"cross-env NODE_OPTIONS='--experimental-vm-modules' jest",typecheck:"tsc --noEmit"},keywords:["ai","agents","skills","cli"],dependencies:{"@clack/core":"^0.5.0",commander:"^14.0.2",figlet:"^1.10.0","gradient-string":"^3.0.0",ky:"^1.14.3",ora:"^9.3.0","package-json":"^10.0.1",picocolors:"^1.1.1"},devDependencies:{"@tech-leads-club/core":"0.0.1","@types/figlet":"^1.7.0","@types/node":"^22",tsx:"^4.21.0",typescript:"^5.9.3"}};import{cp as Hn,lstat as Wn,mkdir as zn,readdir as Vn,readlink as Yn,rm as J,symlink as Kn}from"node:fs/promises";import{homedir as Jn,platform as qn}from"node:os";import{join as x,normalize as $e,relative as Xn,resolve as yt,sep as Zn}from"node:path";import{existsSync as d}from"node:fs";import{homedir as mn}from"node:os";import{join as u}from"node:path";import{existsSync as ce}from"node:fs";import{dirname as dn,join as ue,parse as pn,resolve as fn}from"node:path";function M(t=process.cwd()){let e=fn(t),n=pn(e).root;for(;e!==n;){if((ce(ue(e,"package.json"))||ce(ue(e,".git")))&&!e.endsWith("packages/cli"))return e;e=dn(e)}return t}var p=mn(),A=M(),lt={cursor:{name:"cursor",displayName:"Cursor",description:"AI-first code editor built on VS Code",skillsDir:".cursor/skills",globalSkillsDir:u(p,".cursor/skills"),detectInstalled:()=>d(u(p,".cursor"))||d(u(A,".cursor"))},"claude-code":{name:"claude-code",displayName:"Claude Code",description:"Anthropic's agentic coding tool",skillsDir:".claude/skills",globalSkillsDir:u(p,".claude/skills"),detectInstalled:()=>d(u(p,".claude"))||d(u(A,".claude"))},"github-copilot":{name:"github-copilot",displayName:"GitHub Copilot",description:"AI pair programmer by GitHub/Microsoft",skillsDir:".github/skills",globalSkillsDir:u(p,".copilot/skills"),detectInstalled:()=>d(u(p,".copilot"))||d(u(A,".github"))},windsurf:{name:"windsurf",displayName:"Windsurf",description:"AI IDE with Cascade flow (Codeium)",skillsDir:".windsurf/skills",globalSkillsDir:u(p,".codeium/windsurf/skills"),detectInstalled:()=>d(u(p,".codeium/windsurf"))||d(u(A,".windsurf"))},cline:{name:"cline",displayName:"Cline",description:"Autonomous AI coding agent for VS Code",skillsDir:".cline/skills",globalSkillsDir:u(p,".cline/skills"),detectInstalled:()=>d(u(p,".cline"))||d(u(A,".cline"))},aider:{name:"aider",displayName:"Aider",description:"AI pair programming in terminal",skillsDir:".aider/skills",globalSkillsDir:u(p,".aider/skills"),detectInstalled:()=>d(u(p,".aider"))||d(u(A,".aider"))},codex:{name:"codex",displayName:"OpenAI Codex",description:"OpenAI's coding agent",skillsDir:".codex/skills",globalSkillsDir:u(p,".codex/skills"),detectInstalled:()=>d(u(p,".codex"))||d(u(A,".codex"))},gemini:{name:"gemini",displayName:"Gemini CLI",description:"Google's AI coding assistant",skillsDir:".gemini/skills",globalSkillsDir:u(p,".gemini/skills"),detectInstalled:()=>d(u(p,".gemini"))||d(u(A,".gemini"))},antigravity:{name:"antigravity",displayName:"Antigravity",description:"Google's agentic coding (VS Code)",skillsDir:".agent/skills",globalSkillsDir:u(p,".gemini/antigravity/global_skills"),detectInstalled:()=>d(u(p,".gemini/antigravity"))||d(u(A,".agent"))},roo:{name:"roo",displayName:"Roo Code",description:"AI coding assistant for VS Code",skillsDir:".roo/skills",globalSkillsDir:u(p,".roo/skills"),detectInstalled:()=>d(u(p,".roo"))||d(u(A,".roo"))},kilocode:{name:"kilocode",displayName:"Kilo Code",description:"AI coding agent with auto-launch",skillsDir:".kilocode/skills",globalSkillsDir:u(p,".kilocode/skills"),detectInstalled:()=>d(u(p,".kilocode"))||d(u(A,".kilocode"))},trae:{name:"trae",displayName:"TRAE",description:"AI IDE with SOLO mode and custom agents",skillsDir:".trae/skills",globalSkillsDir:u(p,".trae/skills"),detectInstalled:()=>d(u(p,".trae"))||d(u(A,".trae"))},"amazon-q":{name:"amazon-q",displayName:"Amazon Q",description:"AWS AI coding assistant",skillsDir:".amazonq/skills",globalSkillsDir:u(p,".amazonq/skills"),detectInstalled:()=>d(u(p,".amazonq"))||d(u(A,".amazonq"))},augment:{name:"augment",displayName:"Augment",description:"AI code assistant with context engine",skillsDir:".augment/skills",globalSkillsDir:u(p,".augment/skills"),detectInstalled:()=>d(u(p,".augment"))||d(u(A,".augment"))},tabnine:{name:"tabnine",displayName:"Tabnine",description:"AI code completions with privacy focus",skillsDir:".tabnine/skills",globalSkillsDir:u(p,".tabnine/skills"),detectInstalled:()=>d(u(p,".tabnine"))||d(u(A,".tabnine"))},opencode:{name:"opencode",displayName:"OpenCode",description:"Open-source AI coding terminal",skillsDir:".opencode/skills",globalSkillsDir:u(p,".config/opencode/skills"),detectInstalled:()=>d(u(p,".config/opencode"))||d(u(A,".opencode"))||d(u(A,".config/opencode"))},sourcegraph:{name:"sourcegraph",displayName:"Sourcegraph Cody",description:"AI assistant with codebase context",skillsDir:".sourcegraph/skills",globalSkillsDir:u(p,".sourcegraph/skills"),detectInstalled:()=>d(u(p,".sourcegraph"))||d(u(A,".sourcegraph"))},droid:{name:"droid",displayName:"Droid (Factory.ai)",description:"AI software engineer by Factory.ai",skillsDir:".factory/skills",globalSkillsDir:u(p,".factory/skills"),detectInstalled:()=>d(u(p,".factory"))||d(u(A,".factory"))}};function ge(){return Object.entries(lt).filter(([,t])=>t.detectInstalled()).map(([t])=>t)}function E(t){return lt[t]}function z(){return Object.keys(lt).sort((t,e)=>lt[t].displayName.localeCompare(lt[e].displayName))}import{execSync as yn}from"node:child_process";import{existsSync as kn}from"node:fs";import{join as hn}from"node:path";var Sn="@tech-leads-club/agent-skills";function bn(){try{return yn("npm root -g",{encoding:"utf-8"}).trim()}catch{return null}}function Nt(){let t=bn();if(!t)return!1;let e=hn(t,Sn);return kn(e)}Ut();import En from"ky";import{existsSync as U,mkdirSync as pt,readFileSync as ke,rmSync as he,writeFileSync as Gt}from"node:fs";import{homedir as On}from"node:os";import{join as C}from"node:path";var Se=".skill-meta.json",F={cliVersion:dt.version,cacheTtlMs:1440*60*1e3,fetchTimeoutMs:15e3,maxRetries:3,retryBaseDelayMs:500,maxConcurrentDownloads:10},v={cacheDir:C(On(),".cache","tlc-skills"),get registryCacheFile(){return C(this.cacheDir,"registry.json")},get skillsCacheDir(){return C(this.cacheDir,"skills")}},ft={get cdnRef(){return process.env.SKILLS_CDN_REF??`v${F.cliVersion}`},get cdnBase(){return`https://cdn.jsdelivr.net/gh/tech-leads-club/agent-skills@${this.cdnRef}`},get fallbackCdnBase(){return`https://raw.githubusercontent.com/tech-leads-club/agent-skills/${this.cdnRef}`},get registry(){return`${this.cdnBase}/packages/skills-catalog/skills-registry.json`},get fallbackRegistry(){return`${this.fallbackCdnBase}/packages/skills-catalog/skills-registry.json`},get skillsBase(){return`${this.cdnBase}/packages/skills-catalog/skills`},get fallbackSkillsBase(){return`${this.fallbackCdnBase}/packages/skills-catalog/skills`}},_n=[/[/\\]/g,/\.\./g,/[<>:"|?*]/g];function be(){U(v.cacheDir)||pt(v.cacheDir,{recursive:!0}),U(v.skillsCacheDir)||pt(v.skillsCacheDir,{recursive:!0})}function Nn(t){return Date.now()-t<F.cacheTtlMs}function me(){if(!U(v.registryCacheFile))return null;try{let t=ke(v.registryCacheFile,"utf-8");return JSON.parse(t)}catch{return null}}function Ln(t){let e={fetchedAt:Date.now(),registry:t};Gt(v.registryCacheFile,JSON.stringify(e,null,2))}var ye=En.create({timeout:F.fetchTimeoutMs,retry:{limit:F.maxRetries,methods:["get"],statusCodes:[408,429,500,502,503,504],backoffLimit:1e4,delay:t=>F.retryBaseDelayMs*Math.pow(2,t-1),jitter:!0,retryOnTimeout:!0}});async function we(t,e){try{return await ye.get(t)}catch(n){if(e)try{return await ye.get(e)}catch{}throw n}}async function V(t=!1){if(be(),!t){let e=me();if(e&&Nn(e.fetchedAt))return e.registry}try{let n=await(await we(ft.registry,ft.fallbackRegistry)).json();return Ln(n),n}catch(e){let n=me();return n?n.registry:(console.error(`Failed to fetch registry: ${e instanceof Error?e.message:e}`),null)}}function Mn(t){return _n.reduce((e,n)=>e.replace(n,""),t).trim()}function Fn(t,e){let n=C(t,".");return C(e,".").startsWith(n)}function Y(t){let e=Mn(t);if(!e)throw new Error("Invalid skill name");return C(v.skillsCacheDir,e)}function Bt(t){try{let e=Y(t);return U(C(e,"SKILL.md"))}catch{return!1}}function Un(t,e){try{let n=C(Y(t),Se);Gt(n,JSON.stringify(e,null,2))}catch{}}function Ae(t){try{let e=C(Y(t),Se);return U(e)?JSON.parse(ke(e,"utf-8")):null}catch{return null}}async function jt(t){if(!Bt(t))return!0;let e=await Ht(t);if(!e?.contentHash)return!1;let n=Ae(t);return n?.contentHash?n.contentHash!==e.contentHash:!0}function Ie(t){return Ae(t)?.contentHash}async function mt(t){let e=[],n=[];for(let l of t)await jt(l)?e.push(l):n.push(l);return{toUpdate:e,upToDate:n}}async function Gn(t,e,n){let l=C(n,e);if(!Fn(n,l))return console.error(`Security: Skipping suspicious file path: ${e}`),!1;let o=C(l,"..");U(o)||pt(o,{recursive:!0});let r=`${ft.skillsBase}/${t.path}/${e}`,s=`${ft.fallbackSkillsBase}/${t.path}/${e}`,i=await we(r,s);if(!i.ok)throw new Error(`Failed to download ${e}: HTTP ${i.status}`);return Gt(l,await i.text()),!0}async function Bn(t){let e=Y(t.name);be(),U(e)||pt(e,{recursive:!0});try{let n=[...t.files],l=0;for(let o=0;o<n.length;o+=F.maxConcurrentDownloads){let r=n.slice(o,o+F.maxConcurrentDownloads),s=await Promise.all(r.map(i=>Gn(t,i,e)));l+=s.filter(Boolean).length}if(l<n.length)throw new Error(`Only ${l}/${n.length} files downloaded successfully`);return t.contentHash&&Un(t.name,{contentHash:t.contentHash,downloadedAt:Date.now()}),e}catch(n){return console.error(`Failed to download skill ${t.name}: ${n instanceof Error?n.message:n}`),null}}async function Ce(){let t=await V();return t?t.skills.map(e=>({name:e.name,description:e.description,path:Bt(e.name)?Y(e.name):"",category:e.category})):[]}async function Ht(t){return(await V())?.skills.find(n=>n.name===t)??null}async function Wt(t){if(Bt(t))return Y(t);let e=await Ht(t);return e?Bn(e):null}function Te(){try{he(v.cacheDir,{recursive:!0,force:!0})}catch{}}function jn(t){try{he(C(v.skillsCacheDir,t),{recursive:!0,force:!0})}catch{}}async function st(t){return jn(t),Wt(t)}function zt(){return v.cacheDir}var Vt=x(".agents","skills"),Kt=t=>(t.replace(/[/\\]/g,"").replace(/[\0:]/g,"").replace(/^[.\s]+|[.\s]+$/g,"").replace(/^\.+/,"")||"unnamed-skill").substring(0,255),Yt=(t,e)=>{let n=$e(yt(t)),l=$e(yt(e));return l.startsWith(n+Zn)||l===n},ve=async(t,e)=>{try{await Qn(e,t),await zn(x(e,".."),{recursive:!0});let n=Xn(x(e,".."),t),l=qn()==="win32"?"junction":void 0;return await Kn(n,e,l),!0}catch{return!1}},Qn=async(t,e)=>{try{if((await Wn(t)).isSymbolicLink()){let l=await Yn(t);if(yt(l)===yt(e))return;await J(t)}else await J(t,{recursive:!0})}catch(n){n?.code==="ELOOP"&&await J(t,{force:!0}).catch(()=>{})}},rt=async(t,e)=>{await J(e,{recursive:!0,force:!0}),await Hn(t,e,{recursive:!0})},tl=(t,e)=>`${t}-${e?"global":"local"}`,K=(t,e,n={})=>({agent:t.config.displayName,skill:t.skill.name,path:t.skillTargetPath,method:e,success:!0,...n}),xe=(t,e,n)=>({agent:t.config.displayName,skill:t.skill.name,path:t.skillTargetPath,method:e,success:!1,error:n instanceof Error?n.message:String(n)}),el={"symlink-global":async t=>await ve(t.skill.path,t.skillTargetPath)?K(t,"symlink"):(await rt(t.skill.path,t.skillTargetPath),K(t,"copy",{symlinkFailed:!0})),"symlink-local":async t=>{let e=x(t.projectRoot,Vt,t.safeSkillName);return await rt(t.skill.path,e),await ve(e,t.skillTargetPath)?K(t,"symlink",{usedGlobalSymlink:!1}):(await rt(t.skill.path,t.skillTargetPath),K(t,"copy",{symlinkFailed:!0}))},"copy-global":async t=>(await rt(t.skill.path,t.skillTargetPath),K(t,"copy")),"copy-local":async t=>(await rt(t.skill.path,t.skillTargetPath),K(t,"copy"))},nl=(t,e,n,l)=>l||Yt(t,e)||Yt(n,e)?null:"Security: Invalid skill destination path",ll=async(t,e,n,l,o,r)=>{let s=E(e),i=Kt(t.name),a=x(n,i),k={skill:t,config:s,safeSkillName:i,skillTargetPath:a,projectRoot:o},g=nl(n,a,o,r);if(g)return xe(k,l,g);try{let h=tl(l,r);return await el[h](k)}catch(h){return xe(k,l,h)}},kt=async(t,e)=>{let n=M(),l=[];for(let o of e.agents){let r=E(o),s=e.global?r.globalSkillsDir:x(n,r.skillsDir);for(let i of t){let a=await ll(i,o,s,e.method,n,e.global);l.push(a),a.success&&await Mt(i.name,"local",Ie(i.name))}}return l},q=async(t,e)=>{let n=E(t),l=e?n.globalSkillsDir:x(M(),n.skillsDir);try{return(await Vn(l,{withFileTypes:!0})).filter(r=>r.isDirectory()||r.isSymbolicLink()).map(r=>r.name)}catch{return[]}};var ol=(t,e={})=>{let n=Kt(t),l=e.global?Jn():M(),o=x(l,Vt,n);if(!Yt(x(l,Vt),o))throw new Error("Invalid skill name: potential path traversal detected");return o},ht=async(t,e,n={})=>{let l=Kt(t),o=M();await J(ol(t,n),{recursive:!0,force:!0}).catch(()=>{});let r=await Promise.all(e.map(async s=>{let i=E(s),a=n.global?i.globalSkillsDir:x(o,i.skillsDir),k=x(a,l);try{return await J(k,{recursive:!0,force:!0}),{agent:i.displayName,success:!0}}catch(g){return{agent:i.displayName,success:!1,error:g instanceof Error?g.message:String(g)}}}));return await Ft(t),r};import b from"picocolors";import{existsSync as St,readdirSync as sl,readFileSync as rl,writeFileSync as Vo}from"node:fs";import{dirname as il,join as Xt}from"node:path";import{fileURLToPath as al}from"node:url";var X="uncategorized",Z=/^\(([a-z][a-z0-9-]*)\)$/,Jt="_category.json",qt={id:X,name:"Uncategorized",description:"Skills without a specific category",priority:999};function it(t){return t.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}var cl=al(import.meta.url),Pe=il(cl);function De(){let t=Xt(Pe,"..","..","skills-catalog","skills");if(St(t))return t;let e=Xt(Pe,"..","..","..","packages","skills-catalog","skills");return St(e)?e:t}function ul(){let t=De(),e=Xt(t,Jt);if(!St(e))return{};try{let n=rl(e,"utf-8");return JSON.parse(n)}catch{return{}}}function gl(t){let e=t.match(Z);return e?e[1]:null}function dl(t){return Z.test(t)}function pl(){let t=De();if(!St(t))return[];let e=ul(),n=sl(t,{withFileTypes:!0}),l=[],o=0;for(let r of n){if(!r.isDirectory()||!dl(r.name))continue;let s=gl(r.name);if(!s)continue;let i=e[r.name]??{};l.push({id:s,name:i.name??it(s),description:i.description,priority:i.priority??o}),o++}return l.sort((r,s)=>r.name.localeCompare(s.name)),l}function bt(t){let e=pl();if(e.length===0){let r=new Set(t.map(s=>s.category).filter(Boolean));e=Array.from(r).map((s,i)=>({id:s,name:it(s),priority:i}))}let n=new Map;for(let r of e)n.set(r,[]);n.set(qt,[]);for(let r of t){let s=r.category??X,i=e.find(g=>g.id===s);!i&&s!==X&&(i={id:s,name:it(s),priority:999},e.push(i),n.set(i,[]));let a=i??qt,k=n.get(a)??[];k.push(r),n.set(a,k)}for(let[r,s]of n)s.length===0&&n.delete(r);let l=new Map,o=Array.from(n.keys()).sort((r,s)=>r.name.localeCompare(s.name));for(let r of o){let s=n.get(r);s&&(s.sort((i,a)=>i.name.localeCompare(a.name)),l.set(r,s))}return l}import{existsSync as wt,readdirSync as Ee,readFileSync as fl}from"node:fs";import{dirname as ml,join as Q}from"node:path";import{fileURLToPath as yl}from"node:url";var kl=yl(import.meta.url),Re=ml(kl),_={mode:null,localDir:null},hl=[Q(Re,"..","..","skills-catalog","skills"),Q(Re,"..","..","..","packages","skills-catalog","skills")];function Sl(){return hl.find(t=>wt(t))??null}function bl(t){return Z.test(t)}function wl(t){return t.match(Z)?.[1]??null}function Al(t){let e=t.match(/^---\n([\s\S]*?)\n---/);if(!e)return{};let n=e[1],l=n.match(/^name:\s*(.+)$/m),o=n.match(/^description:\s*(.+)$/m);return{name:l?.[1]?.trim(),description:o?.[1]?.trim()}}function Oe(t,e){let n=Q(t,"SKILL.md");if(!wt(n))return null;let l=fl(n,"utf-8"),{name:o,description:r}=Al(l),s=t.split("/").pop()??"";return{name:o??s,description:r??"No description",path:t,category:e}}function Il(t,e){return wt(t)?Ee(t,{withFileTypes:!0}).filter(n=>n.isDirectory()).map(n=>Oe(Q(t,n.name),e)).filter(n=>n!==null):[]}function _e(t){return wt(t)?Ee(t,{withFileTypes:!0}).filter(n=>n.isDirectory()).flatMap(n=>{if(bl(n.name)){let o=wl(n.name);return o?Il(Q(t,n.name),o):[]}let l=Oe(Q(t,n.name),X);return l?[l]:[]}):[]}function Cl(){if(_.mode)return _.mode;let t=Sl();return t?(_.localDir=t,_.mode="local","local"):(_.mode="remote","remote")}function Zt(){return Cl()==="local"&&_.localDir!==null}function Tl(){return Zt()?_e(_.localDir):[]}async function N(){return Zt()?_e(_.localDir):Ce()}function $l(t){return Tl().find(e=>e.name===t)}async function Ne(t){return(await N()).find(n=>n.name===t)}async function Qt(t){return Zt()?$l(t)?.path??null:Wt(t)}function At(t,e){return t.length<=e?t:t.slice(0,e-3)+"..."}import{ConfirmPrompt as xl,MultiSelectPrompt as Ue,SelectPrompt as Pl}from"@clack/core";import c from"picocolors";import vl from"gradient-string";import at from"picocolors";var Le=vl([{color:"#1e3a8a",pos:0},{color:"#3b82f6",pos:.3},{color:"#0ea5e9",pos:.5},{color:"#06b6d4",pos:.7},{color:"#22d3ee",pos:1}]),f="\u2502",It="\u2514",Me="\u25CF",Fe="\u25CB",te="\u25FC",ee="\u25FB",G=at.blue("\u25C6");function y(t=""){console.log(t?`${at.blue(f)} ${t}`:at.blue(f))}function T(t=""){console.log(`${at.blue(It)} ${t}`)}function P(){T(at.gray("Cancelled"))}var Ct={MARGIN_X:2,MARGIN_Y:1,PAGE_HISTORY:5,HEADER_HEIGHT:2,FOOTER_HEIGHT:2,MIN_PAGE_SIZE:5,MAX_PAGE_SIZE:20,DEFAULT_WIDTH:80,DEFAULT_HEIGHT:20};function ne(){return process.stdout.columns||Ct.DEFAULT_WIDTH}function Dl(){return process.stdout.rows||Ct.DEFAULT_HEIGHT}function Tt(t,e){return t.length<=e?t:t.slice(0,Math.max(0,e-3))+"..."}function I(t){return typeof t=="symbol"}function le(t){return`${c.blue(f)}
3
- ${G} ${c.white(c.bold(t))}
4
- `}function oe(t,e){let n=e?"esc = back, ":"";return c.dim(c.gray(`(${t.join(", ")}, ${n}enter confirm)`))}function Ge(t,e){return t&&e?"selected-active":t?"selected":e?"active":"inactive"}function Be(t,e,n){e>0&&e<n&&(t.cursor=e)}function je(t){return t.cursor??0}function se(t,e,n,l,o,r){let{startIndex:s,endIndex:i,hasScrollUp:a,hasScrollDown:k}=El(n,e.length,l),h=e.slice(s,i).map((S,D)=>{let O=s+D,R=o(S,O,O===n);return`${c.blue(f)} ${R}`});return(a||s>0)&&h.unshift(`${c.blue(f)} ${c.gray("\u2191 ...")}`),(k||i<e.length)&&h.push(`${c.blue(f)} ${c.gray("\u2193 ...")}`),`${t}${h.join(`
5
- `)}
6
- ${c.blue(f)}
7
- ${c.blue(It)} ${r}`}async function $t(t,e,n,l=!0){let r=await new Pl({options:e,initialValue:n,render(){let s=le(t),i={submit:()=>`${s}${c.blue(f)} ${c.blue(this.options.find(a=>a.value===this.value)?.label)}
8
- ${c.blue(f)}`,cancel:()=>`${s}${c.blue(f)} ${c.strikethrough(c.gray("back"))}
9
- ${c.blue(f)}`,default:()=>{let a=re(),k=ne()-10;return se(s,this.options,this.cursor,a,(g,h,S)=>{let D=S?c.blue(Me):c.gray(Fe),O=Tt(g.label,k),R=S?c.blue(O):c.white(O),W=S&&g.hint?c.dim(c.gray(` - ${g.hint}`)):"";return`${D} ${R}${W}`},oe(["\u2191\u2193 navigate"],l))}};return(i[this.state]??i.default)()}}).prompt();return typeof r=="symbol"&&l?Symbol.for("back"):r}async function ct(t,e,n=[],l=!0,o=0){let r=new Ue({options:e,initialValues:n,render(){let a=le(t),k={submit:()=>{let g=this.options.filter(h=>this.value.includes(h.value)).map(h=>c.blue(String(h.value))).join(c.gray(", "));return`${a}${c.blue(f)} ${g}
10
- ${c.blue(f)}`},cancel:()=>`${a}${c.blue(f)} ${c.strikethrough(c.gray("back"))}
11
- ${c.blue(f)}`,default:()=>{let g=re(),h=ne()-10;return se(a,this.options,this.cursor,g,(S,D,O)=>{let R=Ge(this.value.includes(S.value),O),W=R==="selected"||R==="selected-active",L=R==="active"||R==="selected-active",Ot=W?c.blue(te):c.gray(ee),nt=Tt(S.label,h),_t=L?c.blue(nt):c.white(nt),gt=L&&S.hint?c.dim(c.gray(` (${S.hint})`)):"";return`${Ot} ${_t}${gt}`},oe(["\u2191\u2193 navigate","space select"],l))}};return(k[this.state]??k.default)()}});Be(r,o,e.length);let s=await r.prompt(),i=je(r);return typeof s=="symbol"&&l?{value:Symbol.for("back"),cursor:i}:{value:s,cursor:i}}async function ut(t,e=!1){return new xl({active:"Yes",inactive:"No",initialValue:e,render(){let l=le(t),o={submit:()=>`${l}${c.blue(f)} ${c.blue(this.value?"Yes":"No")}
12
- ${c.blue(f)}`,cancel:()=>`${l}${c.blue(f)} ${c.strikethrough(c.gray("cancelled"))}
13
- ${c.blue(f)}`,default:()=>{let r=this.value?`${c.blue("\u25CF Yes")} ${c.dim(c.gray("/"))} ${c.gray("\u25CB")} ${c.white("No")}`:`${c.gray("\u25CB")} ${c.white("Yes")} ${c.dim(c.gray("/"))} ${c.blue("\u25CF No")}`;return`${l}${c.blue(f)} ${r}
14
- ${c.blue(f)}
15
- ${c.blue(It)} ${c.dim(c.gray("(\u2190\u2192 to change, enter to confirm)"))}`}};return(o[this.state]??o.default)()}}).prompt()}function Rl(t){let e=[];for(let[n,l]of Object.entries(t))if(l.length!==0){e.push({value:`__header_${n}`,label:n,isHeader:!0});for(let o of l)e.push({...o,group:n})}return e}function re(){let t=Dl(),n=Math.max(Ct.MIN_PAGE_SIZE,t-8);return Math.min(Ct.MAX_PAGE_SIZE,n)}function El(t,e,n){let l=t>Math.floor(n/2),o=e>n&&t<e-Math.floor(n/2),r=n-(l?1:0)-(o?1:0),s=Math.max(0,t-Math.floor(r/2));s+r>e&&(s=Math.max(0,e-r));let i=Math.min(s+r,e);return{startIndex:s,endIndex:i,hasScrollUp:l,hasScrollDown:o}}async function He(t,e,n=[],l=!0,o=0){let r=Rl(e),s=new Ue({options:r,initialValues:n,render(){let k=`${G} ${c.white(c.bold(t))}
16
- `,g={submit:()=>{let h=this.options.filter(S=>this.value.includes(S.value)&&!S.isHeader).map(S=>c.blue(String(S.value))).join(c.gray(", "));return`${k}${c.blue(f)} ${h}
17
- ${c.blue(f)}`},cancel:()=>`${k}${c.blue(f)} ${c.strikethrough(c.gray("back"))}
18
- ${c.blue(f)}`,default:()=>{let h=re(),S=ne()-10;return se(k,this.options,this.cursor,h,(D,O,R)=>{let W=D;if(W.isHeader)return c.blue(c.bold(Tt(W.label,S)));let L=Ge(this.value.includes(D.value),R),Ot=L==="selected"||L==="selected-active",nt=L==="active"||L==="selected-active",_t=Ot?c.blue(te):c.gray(ee),gt=Tt(D.label,S),sn=nt?c.blue(gt):c.white(gt),rn=nt&&D.hint?c.dim(c.gray(` (${D.hint})`)):"";return` ${_t} ${sn}${rn}`},oe(["\u2191\u2193 navigate","space select"],l))}};return(g[this.state]??g.default)()}});Be(s,o,r.length);let i=await s.prompt(),a=je(s);return typeof i=="symbol"?l?{value:Symbol.for("back"),cursor:a}:{value:i,cursor:a}:(i=i.filter(k=>!String(k).startsWith("__header_")),{value:i,cursor:a})}import Ol from"figlet";import tt from"picocolors";function _l(){let t=Ol.textSync("Tech Leads Club",{font:"Larry 3D",horizontalLayout:"default"});return`${Le.multiline(t)}
19
- ${tt.white(tt.bold("Tech Leads Club"))} ${tt.blue("\u203A")} ${tt.bold(tt.blue("Agent Skills"))}
20
- ${tt.white("Curated skills to power up your AI coding agents")}
21
- `}function et(){console.clear(),console.log(_l())}import Nl from"ora";import ae from"picocolors";var ie=null,Ll=`${ae.blue(f)} `;function Ml(t){return ie?.stop(),ie=Nl({text:ae.blue(t),color:"blue",prefixText:Ll}).start(),ie}async function B(t,e){let n=Ml(t);try{let l=await e();return n.stop(),l}catch(l){throw n.fail(ae.red("Failed")),l}}import{createRequire as Fl}from"node:module";import Ul from"package-json";var Gl="@tech-leads-club/agent-skills";async function We(t){try{let e=await Ul(Gl);return e.version!==t?e.version:null}catch{return null}}function ze(){try{let t=Fl(import.meta.url);try{return t("./package.json").version||"0.0.0"}catch{return t("../package.json").version||"0.0.0"}}catch{return"0.0.0"}}import m from"picocolors";function Ve(t){y(),y(m.blue(m.bold("\u{1F4CB} Installation Summary"))),y(),y(`${m.blue(f)} ${m.white(m.bold("Skills:"))} ${m.gray(t.skills.join(", "))}`),y(`${m.blue(f)} ${m.white(m.bold("Agents:"))} ${m.gray(t.agents.join(", "))}`),y(`${m.blue(f)} ${m.white(m.bold("Method:"))} ${m.cyan(t.method)}`),y()}function vt(t,e=!1){let n=t.filter(a=>a.success&&!a.error),l=t.filter(a=>a.success&&a.error==="Already exists"),o=t.filter(a=>!a.success);console.log();for(let a of n)console.log(`${G} ${m.white(m.bold(a.skill))} ${m.gray("\u2192")} ${m.white(a.agent)}`);for(let a of l)console.log(`${m.gray(G)} ${a.skill} \u2192 ${a.agent} ${m.gray("(exists)")}`);for(let a of o)console.log(`${m.red("\u2717")} ${a.skill} \u2192 ${a.agent}: ${a.error}`);let r=new Set(t.map(a=>a.agent)).size,s=new Set(n.map(a=>a.skill)).size,i=e?"updated":"installed";console.log(),T(`${m.blue("\u2713")} ${m.white(m.bold(`${s} skill(s)`))} ${m.white(`${i} to`)} ${m.white(m.bold(`${r} agent(s)`))}`)}function xt(t,e){let n=e.filter(o=>o.success),l=e.filter(o=>!o.success);n.length>0&&console.log(`${G} ${m.white(m.bold(t))} ${m.gray("removed from")} ${n.map(o=>o.agent).join(", ")}`);for(let o of l)console.log(`${m.red("\u2717")} ${t} \u2192 ${o.agent}: ${o.error}`);n.length>0&&l.length===0&&T(`${m.blue("\u2713")} ${m.white("Skill removed successfully")}`)}import Bl from"picocolors";function Dt(t,e=[]){return t.map(n=>{let l=E(n),o=e.includes(n);return{value:n,label:o?`${l.displayName} ${Bl.green("\u25CF detected")}`:l.displayName,hint:At(l.description,50)}})}async function Pt(t,e){let n=new Set;for(let l of t)(await q(l,e)).forEach(r=>n.add(r));return n}async function Rt(t){let[e,n]=await Promise.all([Pt(t,!0),Pt(t,!1)]);return new Set([...e,...n])}async function jl(t){let e=[],n=[],l=[],o=new Set,r=new Set;for(let s of t){let[i,a]=await Promise.all([q(s,!0),q(s,!1)]);a.length>0&&(n.push(s),a.forEach(k=>o.add(k))),i.length>0&&(l.push(s),i.forEach(k=>r.add(k)))}return n.length>0&&e.push({skills:Array.from(o),agents:n,global:!1}),l.length>0&&e.push({skills:Array.from(r),agents:l,global:!0}),e}async function Ye(t){let e=await V(!0),n=await jl(t);if(n.length===0||!e)return{configs:[],upToDate:[],toUpdate:[]};let l=new Set(e.skills.map(g=>g.name)),o=n.map(g=>({...g,skills:g.skills.filter(h=>l.has(h))})).filter(g=>g.skills.length>0);if(o.length===0)return{configs:[],upToDate:[],toUpdate:[]};let r=[...new Set(o.flatMap(g=>g.skills))],{toUpdate:s,upToDate:i}=await mt(r);if(s.length===0)return{configs:[],upToDate:i,toUpdate:[]};let a=new Set(s);return{configs:o.map(g=>({...g,skills:g.skills.filter(h=>a.has(h))})).filter(g=>g.skills.length>0),upToDate:i,toUpdate:s}}async function Ke(t,e){let n=new Set(e.map(o=>o.name)),l=new Map;for(let o of t){let[r,s]=await Promise.all([q(o,!0),q(o,!1)]),i=new Set([...r,...s]);for(let a of i)n.has(a)&&(l.has(a)||l.set(a,[]),l.get(a).push(o))}return l}var j={AGENTS:1,SKILLS:2,CONFIG:3},Je=Object.keys(j).length;async function qe(){et(),await Xl();let t=await B("Loading skills catalog...",N);if(t.length===0)return T(b.red("No skills available. Check your internet connection.")),null;let e=ge(),n=z(),l=e.length>0?e:n,o=await Rt(l);if(o.size>0){let i=await Hl(o,l);if(i!==void 0)return i}let r=new Set(t.map(i=>i.name)),s=new Set([...o].filter(i=>r.has(i)));return Vl({allSkills:t,allAgents:n,installedAgents:e,installedSkills:s,preselectedSkills:[]})}async function Hl(t,e){let n=await Wl();if(n===null)return null;if(n==="install")return;y(b.blue("\u23F3 Checking for updates..."));let{configs:l,toUpdate:o,upToDate:r}=await Ye(e);if(l.length===0)return r.length>0?T(b.green(`\u2705 All ${r.length} installed skills are already up to date`)):T(b.yellow("No agents found with installed skills.")),null;zl(o,r);let s=await ut("Proceed with update?",!0);return I(s)||!s?(P(),null):l}async function Wl(){let e=await $t("What would you like to do?",[{value:"install",label:"Install skills",hint:"browse and select skills to install"},{value:"update",label:"Update installed skills",hint:"check for content changes"}],"install",!1);return I(e)?(P(),null):e}function zl(t,e){y(b.cyan(`${t.length} skill${t.length===1?"":"s"} with updates available:`)),t.forEach(n=>y(b.white(` \u2191 ${n}`))),e.length>0&&y(b.gray(` ${e.length} skill${e.length===1?"":"s"} already up to date`)),y()}async function Vl(t){let{allSkills:e,allAgents:n,installedAgents:l,installedSkills:o,preselectedSkills:r}=t,s={skills:r,agents:l.length>0?l:["cursor","claude-code"],method:"copy",global:!1},i=j.AGENTS;for(;i<=Je;){let a=await Yl({step:i,state:s,allSkills:e,allAgents:n,installedAgents:l,installedSkills:o,preselectedSkills:r});if(a==="cancelled")return null;if(a==="back"){i--,i===j.CONFIG-1&&(s.method="copy");continue}if(a==="restart"){i=j.AGENTS;continue}if(typeof a=="object")return a;i++}return null}async function Yl(t){let e=b.gray(`[${t.step}/${Je}]`),n=t.step>1;return{[j.AGENTS]:()=>Kl(t,e),[j.SKILLS]:()=>Jl(t,e,n),[j.CONFIG]:()=>ql(t,e,n)}[t.step]()}async function Kl(t,e){let n=await Ze({allAgents:t.allAgents,installedAgents:t.installedAgents,currentAgents:t.state.agents,stepIndicator:e,allowBack:!1});return n===null?"cancelled":(t.state.agents=n,"next")}async function Jl(t,e,n){let l=await Ke(t.state.agents,t.allSkills),o=await Xe({allSkills:t.allSkills,selectedAgents:t.state.agents,installedSkillsMap:l,stepIndicator:e,initialValues:t.preselectedSkills,allowBack:n});return o===Symbol.for("back")?"back":o===null?"cancelled":(t.state.skills=o,"next")}async function ql(t,e,n){let l=await Qe({state:t.state,stepIndicator:e,allowBack:n});return l===Symbol.for("back")?"back":l===null?"cancelled":l===!1?"restart":l}async function Xl(){let t=ze(),e=await We(t);if(e){console.log(`${b.yellow("\u26A0")} ${b.yellow("Update available:")} ${b.gray(t)} \u2192 ${b.green(e)}`),console.log(` ${b.gray("Run: npm update -g @tech-leads-club/agent-skills")}`),console.log();return}Nt()||(console.log(`${b.yellow("\u{1F4A1}")} ${b.yellow("Tip: Install globally for easier access:")}`),console.log(` ${b.yellow("npm i -g @tech-leads-club/agent-skills")}`),console.log())}async function Xe({allSkills:t,selectedAgents:e,installedSkillsMap:n,stepIndicator:l,initialCursor:o=0,initialValues:r=[],allowBack:s=!1}){let i=bt(t),a=Zl(i,e,n),k=await He(`${l} Select skills to install`,a,r,s,o),{value:g,cursor:h}=k;if(g===Symbol.for("back"))return Symbol.for("back");if(I(g))return P(),null;let S=g;return S.length===0?(y(b.yellow("\u26A0 Please select at least one skill")),Xe({allSkills:t,selectedAgents:e,installedSkillsMap:n,stepIndicator:l,initialCursor:h,allowBack:s})):S}function Zl(t,e,n){let l={};for(let[o,r]of t.entries())l[o.name]=r.map(s=>{let i=n.get(s.name)||[],a=Ql(i,e);return{value:s.name,label:a?`${s.name} ${a}`:s.name,hint:At(s.description,150)}});return l}function Ql(t,e){if(t.length===0)return"";let n=t.map(l=>E(l).displayName);if(t.length===e.length)return b.green("\u2713 installed");{let l=n.join(", ");return b.green(`\u2713 ${l}`)}}async function Ze({allAgents:t,installedAgents:e,currentAgents:n,stepIndicator:l,allowBack:o,initialCursor:r=0}){let s=Dt(t,e),i=await ct(`${l} Where to install?`,s,n,o,r),{value:a,cursor:k}=i;if(a===Symbol.for("back"))return Symbol.for("back");if(I(a))return P(),null;let g=a;return g.length===0?(y(b.yellow("\u26A0 Please select at least one agent")),Ze({allAgents:t,installedAgents:e,currentAgents:[],stepIndicator:l,allowBack:o,initialCursor:k})):g}var to=[{value:"copy",label:"Copy",hint:"independent copies (recommended)"},{value:"symlink",label:"Symlink",hint:"shared source (may not work with all agents)"}],eo=[{value:"local",label:"Local",hint:"this project only"},{value:"global",label:"Global",hint:"user home directory"}];async function Qe({state:t,stepIndicator:e,allowBack:n}){let l=await $t(`${e} Installation method`,to,t.method,n);if(l===Symbol.for("back"))return Symbol.for("back");if(I(l))return P(),null;t.method=l,Ve(t);let o=await no(t.global);if(o===Symbol.for("back"))return Qe({state:t,stepIndicator:e,allowBack:n});if(o===null)return null;t.global=o==="global";let r=await ut(b.white("Proceed with installation?"),!0);return I(r)?(P(),null):r?(y(),{agents:t.agents,skills:t.skills,method:t.method,global:t.global}):!1}async function no(t){let e=await $t("Installation scope",eo,t?"global":"local",!0);return e===Symbol.for("back")?Symbol.for("back"):I(e)?null:e}import $ from"picocolors";async function tn(){et();let t=await B("Loading skills catalog...",N);if(t.length===0){y($.yellow("No skills found. Check your internet connection."));return}y($.bold(`${t.length} skills available:`)),y();let e=z(),n=await Rt(e),l=bt(t);for(let[o,r]of l){y(`${$.cyan("\u25B8")} ${$.bold($.cyan(o.name))}`);for(let s of r){let i=n.has(s.name)?` ${$.green("\u25CF installed")}`:"";y(` ${$.blue("\u25C6")} ${$.bold(s.name)}${i}`),console.log(`${$.blue(f)} ${$.dim($.gray(s.description))}`)}y()}T($.gray('Run "npx @tech-leads-club/agent-skills" to install'))}import Et from"picocolors";async function en(t){et();let e=z(),n=await Pt(e,t);if(n.size===0){y(Et.yellow("No skills installed")),T();return}let l=Array.from(n),o=await nn(l);if(o===null)return;let r=await ln(e,e);if(r===null||I(r))return;let s=await ut(`Remove ${o.length} skill(s) from ${r.length} agent(s)?`,!1);if(I(s)||!s){P();return}y();for(let i of o){let a=await ht(i,r,{global:t});xt(i,a)}}async function nn(t){let n=(await ct(`Which skills do you want to remove? ${Et.gray(`(${t.length} installed)`)}`,t.map(o=>({value:o,label:o})),[],!1)).value;if(I(n))return P(),null;let l=n;return l.length===0?(y(Et.yellow("\u26A0 Please select at least one skill")),nn(t)):l}async function ln(t,e,n=0){let l=await ct("Remove from which agents?",Dt(t).map(i=>({...i,hint:void 0})),e,!0,n),{value:o,cursor:r}=l;if(o===Symbol.for("back"))return Symbol.for("back");if(I(o))return P(),null;let s=o;return s.length===0?(y(Et.yellow("\u26A0 Please select at least one agent")),ln(t,[],r)):s}var H=new lo;H.name("tlc-skills").description("Install TLC Agent Skills to your AI coding agents").version(dt.version);function oo(t){return Array.isArray(t)}async function on(t,e,n){let l=[];for(let o of t){let r=e.find(s=>s.name===o);if(r){let s=n?await st(o):await Qt(o);s&&l.push({...r,path:s})}}return l}H.command("install",{isDefault:!0}).description("Interactive skill installation (default)").option("-g, --global","Install globally to user home",!1).option("-s, --skill <name>","Install a specific skill").option("-a, --agent <agents...>","Target specific agents").option("--symlink","Use symlink instead of copy (may not work with all agents)",!1).option("-f, --force","Force re-download skills (bypass cache)",!1).action(async t=>{if(t.skill||t.agent)await so(t);else{let e=await qe();if(!e)return;let n=await N();if(oo(e)){let l=[];for(let o of e){let r=o.global?"global":"local";y();let s=await B(`Downloading ${o.skills.length} skills (${r})...`,()=>on(o.skills,n,!0)),i={skills:o.skills,agents:o.agents,method:"copy",global:o.global,forceUpdate:!0,isUpdate:!0},a=await kt(s,i);l.push(...a)}vt(l,!0)}else{y();let l=await B(`Downloading ${e.skills.length} skills...`,()=>on(e.skills,n,t.force)),o=await kt(l,e);vt(o,e.isUpdate)}}});H.command("list").alias("ls").description("List available skills").action(async()=>{await tn()});H.command("remove").alias("rm").description("Remove installed skills").option("-g, --global","Remove from global installation",!1).option("-s, --skill <name>","Remove a specific skill").option("-a, --agent <agents...>","Target specific agents").action(async t=>{if(t.skill){let e=t.agent||["antigravity","claude-code","cursor"],n=await ht(t.skill,e,{global:t.global});xt(t.skill,n)}else await en(t.global)});H.command("update").description("Update installed skills to the latest version").option("-s, --skill <name>","Update a specific skill").action(async t=>{if(console.log(w.blue("\u23F3 Fetching latest registry...")),await V(!0),t.skill){if(!await jt(t.skill)){console.log(w.green(`\u2705 ${t.skill} is already up to date`));return}console.log(w.blue(`\u23F3 Updating ${t.skill}...`)),await st(t.skill)?console.log(w.green(`\u2705 Updated ${t.skill}`)):(console.error(w.red(`\u274C Failed to update ${t.skill}`)),process.exit(1))}else{let{readSkillLock:e}=await Promise.resolve().then(()=>(Ut(),fe)),n=await e(),l=Object.keys(n.skills);if(l.length===0){console.log(w.yellow("No installed skills found. Run tlc-skills install first."));return}let{toUpdate:o,upToDate:r}=await mt(l);if(o.length===0){console.log(w.green(`\u2705 All ${r.length} installed skills are up to date`));return}console.log(w.blue(`\u23F3 Updating ${o.length} of ${l.length} skills...`));let s=0,i=0;for(let a of o)await st(a)?s++:(i++,console.error(w.red(` \u274C Failed to update ${a}`)));console.log(w.green(`\u2705 ${s} updated, ${r.length} already up to date${i>0?w.red(`, ${i} failed`):""}`))}});H.command("cache").description("Manage the skills cache").option("--clear","Clear all cached skills and registry").option("--path","Show cache directory path").action(t=>{t.clear?(Te(),console.log(w.green("\u2705 Cache cleared"))):t.path?console.log(zt()):(console.log(w.bold("Cache management:")),console.log(` ${w.blue("--clear")} Clear all cached skills and registry`),console.log(` ${w.blue("--path")} Show cache directory path`),console.log(),console.log(w.dim(`Cache location: ${zt()}`)))});async function so(t){console.log(w.blue("\u23F3 Loading skills catalog..."));let e=await N(),n=e;if(t.skill){let s=await Ne(t.skill);s||(console.error(w.red(`Skill "${t.skill}" not found.`)),console.log("Available skills:",e.map(a=>a.name).join(", ")),process.exit(1)),console.log(w.blue(`\u23F3 ${t.force?"Re-downloading":"Downloading"} ${t.skill}...`));let i=t.force?await st(t.skill):await Qt(t.skill);i||(console.error(w.red(`Failed to download skill "${t.skill}".`)),process.exit(1)),n=[{...s,path:i}]}let l=t.agent||["antigravity","claude-code","cursor"],o=t.symlink?"symlink":"copy",r=await kt(n,{agents:l,skills:n.map(s=>s.name),method:o,global:t.global});vt(r)}H.parse();
2
+ #!/usr/bin/env node
3
+ var ul=Object.defineProperty;var Ie=(e,t)=>()=>(e&&(t=e(e=0)),t);var Rt=(e,t)=>{for(var o in t)ul(e,o,{get:t[o],enumerable:!0})};import{execSync as ml}from"node:child_process";import{existsSync as pl}from"node:fs";import{join as fl}from"node:path";function xl(){try{return ml("npm root -g",{encoding:"utf-8"}).trim()}catch{return null}}function Ro(){let e=xl();if(!e)return!1;let t=fl(e,gl);return pl(t)}var gl,Mo=Ie(()=>{"use strict";gl="@tech-leads-club/agent-skills"});import{existsSync as Pr}from"node:fs";import{dirname as Ul,join as Rr,parse as Gl,resolve as Hl}from"node:path";function Je(e=process.cwd()){let t=Hl(e),o=Gl(t).root;for(;t!==o;){if((Pr(Rr(t,"package.json"))||Pr(Rr(t,".git")))&&!t.endsWith("packages/cli"))return t;t=Ul(t)}return e}var No=Ie(()=>{"use strict"});import{existsSync as T}from"node:fs";import{homedir as Xl}from"node:os";import{join as h}from"node:path";function Zt(){return Object.entries(Ot).filter(([,e])=>e.detectInstalled()).map(([e])=>e)}function Qe(e){return Ot[e]}function Mr(){return Object.keys(Ot).sort((e,t)=>Ot[e].displayName.localeCompare(Ot[t].displayName))}var C,V,Ot,Ft=Ie(()=>{"use strict";No();C=Xl(),V=Je(),Ot={cursor:{name:"cursor",displayName:"Cursor",description:"AI-first code editor built on VS Code",skillsDir:".cursor/skills",globalSkillsDir:h(C,".cursor/skills"),detectInstalled:()=>T(h(C,".cursor"))||T(h(V,".cursor"))},"claude-code":{name:"claude-code",displayName:"Claude Code",description:"Anthropic's agentic coding tool",skillsDir:".claude/skills",globalSkillsDir:h(C,".claude/skills"),detectInstalled:()=>T(h(C,".claude"))||T(h(V,".claude"))},"github-copilot":{name:"github-copilot",displayName:"GitHub Copilot",description:"AI pair programmer by GitHub/Microsoft",skillsDir:".github/skills",globalSkillsDir:h(C,".copilot/skills"),detectInstalled:()=>T(h(C,".copilot"))||T(h(V,".github"))},windsurf:{name:"windsurf",displayName:"Windsurf",description:"AI IDE with Cascade flow (Codeium)",skillsDir:".windsurf/skills",globalSkillsDir:h(C,".codeium/windsurf/skills"),detectInstalled:()=>T(h(C,".codeium/windsurf"))||T(h(V,".windsurf"))},cline:{name:"cline",displayName:"Cline",description:"Autonomous AI coding agent for VS Code",skillsDir:".cline/skills",globalSkillsDir:h(C,".cline/skills"),detectInstalled:()=>T(h(C,".cline"))||T(h(V,".cline"))},aider:{name:"aider",displayName:"Aider",description:"AI pair programming in terminal",skillsDir:".aider/skills",globalSkillsDir:h(C,".aider/skills"),detectInstalled:()=>T(h(C,".aider"))||T(h(V,".aider"))},codex:{name:"codex",displayName:"OpenAI Codex",description:"OpenAI's coding agent",skillsDir:".codex/skills",globalSkillsDir:h(C,".codex/skills"),detectInstalled:()=>T(h(C,".codex"))||T(h(V,".codex"))},gemini:{name:"gemini",displayName:"Gemini CLI",description:"Google's AI coding assistant",skillsDir:".gemini/skills",globalSkillsDir:h(C,".gemini/skills"),detectInstalled:()=>T(h(C,".gemini"))||T(h(V,".gemini"))},antigravity:{name:"antigravity",displayName:"Antigravity",description:"Google's agentic coding (VS Code)",skillsDir:".agent/skills",globalSkillsDir:h(C,".gemini/antigravity/global_skills"),detectInstalled:()=>T(h(C,".gemini/antigravity"))||T(h(V,".agent"))},roo:{name:"roo",displayName:"Roo Code",description:"AI coding assistant for VS Code",skillsDir:".roo/skills",globalSkillsDir:h(C,".roo/skills"),detectInstalled:()=>T(h(C,".roo"))||T(h(V,".roo"))},kilocode:{name:"kilocode",displayName:"Kilo Code",description:"AI coding agent with auto-launch",skillsDir:".kilocode/skills",globalSkillsDir:h(C,".kilocode/skills"),detectInstalled:()=>T(h(C,".kilocode"))||T(h(V,".kilocode"))},trae:{name:"trae",displayName:"TRAE",description:"AI IDE with SOLO mode and custom agents",skillsDir:".trae/skills",globalSkillsDir:h(C,".trae/skills"),detectInstalled:()=>T(h(C,".trae"))||T(h(V,".trae"))},kiro:{name:"kiro",displayName:"Kiro",description:"AI Agent with workspace and global skill scopes",skillsDir:".kiro/skills",globalSkillsDir:h(C,".kiro/skills"),detectInstalled:()=>T(h(C,".kiro"))||T(h(V,".kiro"))},"amazon-q":{name:"amazon-q",displayName:"Amazon Q",description:"AWS AI coding assistant",skillsDir:".amazonq/skills",globalSkillsDir:h(C,".amazonq/skills"),detectInstalled:()=>T(h(C,".amazonq"))||T(h(V,".amazonq"))},augment:{name:"augment",displayName:"Augment",description:"AI code assistant with context engine",skillsDir:".augment/skills",globalSkillsDir:h(C,".augment/skills"),detectInstalled:()=>T(h(C,".augment"))||T(h(V,".augment"))},tabnine:{name:"tabnine",displayName:"Tabnine",description:"AI code completions with privacy focus",skillsDir:".tabnine/skills",globalSkillsDir:h(C,".tabnine/skills"),detectInstalled:()=>T(h(C,".tabnine"))||T(h(V,".tabnine"))},opencode:{name:"opencode",displayName:"OpenCode",description:"Open-source AI coding terminal",skillsDir:".opencode/skills",globalSkillsDir:h(C,".config/opencode/skills"),detectInstalled:()=>T(h(C,".config/opencode"))||T(h(V,".opencode"))||T(h(V,".config/opencode"))},sourcegraph:{name:"sourcegraph",displayName:"Sourcegraph Cody",description:"AI assistant with codebase context",skillsDir:".sourcegraph/skills",globalSkillsDir:h(C,".sourcegraph/skills"),detectInstalled:()=>T(h(C,".sourcegraph"))||T(h(V,".sourcegraph"))},droid:{name:"droid",displayName:"Droid (Factory.ai)",description:"AI software engineer by Factory.ai",skillsDir:".factory/skills",globalSkillsDir:h(C,".factory/skills"),detectInstalled:()=>T(h(C,".factory"))||T(h(V,".factory"))}}});var Ur={};Rt(Ur,{addSkillToLock:()=>Xo,getAllLockedSkills:()=>si,getSkillFromLock:()=>ii,readSkillLock:()=>$t,removeSkillFromLock:()=>jo,writeSkillLock:()=>Ho});import{mkdir as Jl,readFile as Ql,writeFile as Zl}from"node:fs/promises";import{homedir as ei}from"node:os";import{dirname as ti,join as oi}from"node:path";function _r(){return oi(ei(),ri,ni)}function Nr(){return{version:li,skills:{}}}async function $t(){let e=_r();try{let t=await Ql(e,"utf-8"),o=JSON.parse(t);return typeof o.version!="number"||!o.skills?Nr():o}catch{return Nr()}}async function Ho(e){let t=_r();await Jl(ti(t),{recursive:!0}),await Zl(t,JSON.stringify(e,null,2),"utf-8")}async function Xo(e,t="local",o){let n=await $t(),l=new Date().toISOString(),i=n.skills[e];n.skills[e]={name:e,source:t,contentHash:o??i?.contentHash,installedAt:i?.installedAt??l,updatedAt:l},await Ho(n)}async function jo(e){let t=await $t();return e in t.skills?(delete t.skills[e],await Ho(t),!0):!1}async function ii(e){return(await $t()).skills[e]??null}async function si(){return(await $t()).skills}var ri,ni,li,Vo=Ie(()=>{"use strict";ri=".agents",ni=".skill-lock.json",li=1});import ai from"ky";import{existsSync as tt,mkdirSync as eo,readFileSync as Xr,rmSync as Ko,writeFileSync as zo}from"node:fs";import{homedir as ci}from"node:os";import{join as he}from"node:path";import{createRequire as di}from"node:module";function Vr(){tt(xe.cacheDir)||eo(xe.cacheDir,{recursive:!0}),tt(xe.skillsCacheDir)||eo(xe.skillsCacheDir,{recursive:!0})}function fi(e){return Date.now()-e<et.cacheTtlMs}function Gr(){if(!tt(xe.registryCacheFile))return null;try{let e=Xr(xe.registryCacheFile,"utf-8");return JSON.parse(e)}catch{return null}}function gi(e){let t={fetchedAt:Date.now(),registry:e};zo(xe.registryCacheFile,JSON.stringify(t,null,2))}async function Kr(e,t){try{return await Hr.get(e)}catch(o){if(t)try{return await Hr.get(t)}catch{}throw o}}async function oo(e=!1){if(Vr(),!e){let t=Gr();if(t&&fi(t.fetchedAt))return t.registry}try{let o=await(await Kr(to.registry,to.fallbackRegistry)).json();return gi(o),o}catch(t){let o=Gr();return o?o.registry:(console.error(`Failed to fetch registry: ${t instanceof Error?t.message:t}`),null)}}function xi(e){return pi.reduce((t,o)=>t.replace(o,""),e).trim()}function hi(e,t){let o=he(e,".");return he(t,".").startsWith(o)}function Xe(e){let t=xi(e);if(!t)throw new Error("Invalid skill name");return he(xe.skillsCacheDir,t)}function Yo(e){try{let t=Xe(e);return tt(he(t,"SKILL.md"))}catch{return!1}}function yi(e,t){try{let o=he(Xe(e),jr);zo(o,JSON.stringify(t,null,2))}catch{}}function zr(e){try{let t=he(Xe(e),jr);return tt(t)?JSON.parse(Xr(t,"utf-8")):null}catch{return null}}async function Wo(e){if(!Yo(e))return!0;let t=await Nt(e);if(!t?.contentHash)return!1;let o=zr(e);return o?.contentHash?o.contentHash!==t.contentHash:!0}function Yr(e){return zr(e)?.contentHash}async function Wr(e){let t=[],o=[];for(let n of e)await Wo(n)?t.push(n):o.push(n);return{toUpdate:t,upToDate:o}}async function ki(e,t,o){let n=he(o,t);if(!hi(o,n))return console.error(`Security: Skipping suspicious file path: ${t}`),!1;let l=he(n,"..");tt(l)||eo(l,{recursive:!0});let i=`${to.skillsBase}/${e.path}/${t}`,s=`${to.fallbackSkillsBase}/${e.path}/${t}`,c=await Kr(i,s);if(!c.ok)throw new Error(`Failed to download ${t}: HTTP ${c.status}`);return zo(n,await c.text()),!0}async function bi(e){let t=Xe(e.name);Vr(),tt(t)||eo(t,{recursive:!0});try{let o=[...e.files],n=0;for(let l=0;l<o.length;l+=et.maxConcurrentDownloads){let i=o.slice(l,l+et.maxConcurrentDownloads),s=await Promise.all(i.map(c=>ki(e,c,t)));n+=s.filter(Boolean).length}if(n<o.length)throw new Error(`Only ${n}/${o.length} files downloaded successfully`);return e.contentHash&&yi(e.name,{contentHash:e.contentHash,downloadedAt:Date.now()}),t}catch(o){return console.error(`Failed to download skill ${e.name}: ${o instanceof Error?o.message:o}`),null}}async function ro(){let e=await oo();return e?e.skills.map(t=>({name:t.name,description:t.description,path:Yo(t.name)?Xe(t.name):"",category:t.category})):[]}async function Nt(e){return(await oo())?.skills.find(o=>o.name===e)??null}async function ht(e){if(Yo(e))return Xe(e);let t=await Nt(e);return t?bi(t):null}function qr(){try{Ko(xe.cacheDir,{recursive:!0,force:!0})}catch{}}function Si(e){try{Ko(he(xe.skillsCacheDir,e),{recursive:!0,force:!0})}catch{}}function Jr(){try{Ko(xe.registryCacheFile,{force:!0})}catch{}}async function _t(e){return Si(e),ht(e)}function qo(){return xe.cacheDir}var ui,mi,jr,et,xe,to,pi,Hr,ot=Ie(()=>{"use strict";ui=di(import.meta.url),mi=ui("../../package.json"),jr=".skill-meta.json",et={cliVersion:mi.version,cacheTtlMs:1440*60*1e3,fetchTimeoutMs:15e3,maxRetries:3,retryBaseDelayMs:500,maxConcurrentDownloads:10},xe={cacheDir:he(ci(),".cache","tlc-skills"),get registryCacheFile(){return he(this.cacheDir,"registry.json")},get skillsCacheDir(){return he(this.cacheDir,"skills")}},to={get cdnRef(){return process.env.SKILLS_CDN_REF??`v${et.cliVersion}`},get cdnBase(){return`https://cdn.jsdelivr.net/gh/tech-leads-club/agent-skills@${this.cdnRef}`},get fallbackCdnBase(){return`https://raw.githubusercontent.com/tech-leads-club/agent-skills/${this.cdnRef}`},get registry(){return`${this.cdnBase}/packages/skills-catalog/skills-registry.json`},get fallbackRegistry(){return`${this.fallbackCdnBase}/packages/skills-catalog/skills-registry.json`},get skillsBase(){return`${this.cdnBase}/packages/skills-catalog/skills`},get fallbackSkillsBase(){return`${this.fallbackCdnBase}/packages/skills-catalog/skills`}},pi=[/[/\\]/g,/\.\./g,/[<>:"|?*]/g];Hr=ai.create({timeout:et.fetchTimeoutMs,retry:{limit:et.maxRetries,methods:["get"],statusCodes:[408,429,500,502,503,504],backoffLimit:1e4,delay:e=>et.retryBaseDelayMs*Math.pow(2,e-1),jitter:!0,retryOnTimeout:!0}})});import{cp as Ti,lstat as Ci,mkdir as wi,readdir as Ii,readlink as Di,rm as kt,symlink as vi}from"node:fs/promises";import{homedir as Bi,platform as Ai}from"node:os";import{join as Te,normalize as Qr,relative as Ei,resolve as no,sep as Pi}from"node:path";var Jo,Zo,Qo,Zr,Ri,Ut,Mi,yt,en,Li,Oi,Fi,lo,er,$i,Gt,bt=Ie(()=>{"use strict";Ft();Mo();Vo();No();ot();Jo=Te(".agents","skills"),Zo=e=>(e.replace(/[/\\]/g,"").replace(/[\0:]/g,"").replace(/^[.\s]+|[.\s]+$/g,"").replace(/^\.+/,"")||"unnamed-skill").substring(0,255),Qo=(e,t)=>{let o=Qr(no(e)),n=Qr(no(t));return n.startsWith(o+Pi)||n===o},Zr=async(e,t)=>{try{await Ri(t,e),await wi(Te(t,".."),{recursive:!0});let o=Ei(Te(t,".."),e),n=Ai()==="win32"?"junction":void 0;return await vi(o,t,n),!0}catch{return!1}},Ri=async(e,t)=>{try{if((await Ci(e)).isSymbolicLink()){let n=await Di(e);if(no(n)===no(t))return;await kt(e)}else await kt(e,{recursive:!0})}catch(o){o?.code==="ELOOP"&&await kt(e,{force:!0}).catch(()=>{})}},Ut=async(e,t)=>{await kt(t,{recursive:!0,force:!0}),await Ti(e,t,{recursive:!0})},Mi=(e,t)=>`${e}-${t?"global":"local"}`,yt=(e,t,o={})=>({agent:e.config.displayName,skill:e.skill.name,path:e.skillTargetPath,method:t,success:!0,...o}),en=(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)}),Li={"symlink-global":async e=>await Zr(e.skill.path,e.skillTargetPath)?yt(e,"symlink"):(await Ut(e.skill.path,e.skillTargetPath),yt(e,"copy",{symlinkFailed:!0})),"symlink-local":async e=>{let t=Te(e.projectRoot,Jo,e.safeSkillName);return await Ut(e.skill.path,t),await Zr(t,e.skillTargetPath)?yt(e,"symlink",{usedGlobalSymlink:!1}):(await Ut(e.skill.path,e.skillTargetPath),yt(e,"copy",{symlinkFailed:!0}))},"copy-global":async e=>(await Ut(e.skill.path,e.skillTargetPath),yt(e,"copy")),"copy-local":async e=>(await Ut(e.skill.path,e.skillTargetPath),yt(e,"copy"))},Oi=(e,t,o,n)=>n||Qo(e,t)||Qo(o,t)?null:"Security: Invalid skill destination path",Fi=async(e,t,o,n,l,i)=>{let s=Qe(t),c=Zo(e.name),m=Te(o,c),d={skill:e,config:s,safeSkillName:c,skillTargetPath:m,projectRoot:l},u=Oi(o,m,l,i);if(u)return en(d,n,u);try{let p=Mi(n,i);return await Li[p](d)}catch(p){return en(d,n,p)}},lo=async(e,t)=>{let o=Je(),n=[];for(let l of t.agents){let i=Qe(l),s=t.global?i.globalSkillsDir:Te(o,i.skillsDir);for(let c of e){let m=await Fi(c,l,s,t.method,o,t.global);n.push(m),m.success&&await Xo(c.name,"local",Yr(c.name))}}return n},er=async(e,t)=>{let o=Qe(e),n=t?o.globalSkillsDir:Te(Je(),o.skillsDir);try{return(await Ii(n,{withFileTypes:!0})).filter(i=>i.isDirectory()||i.isSymbolicLink()).map(i=>i.name)}catch{return[]}},$i=(e,t={})=>{let o=Zo(e),n=t.global?Bi():Je(),l=Te(n,Jo,o);if(!Qo(Te(n,Jo),l))throw new Error("Invalid skill name: potential path traversal detected");return l},Gt=async(e,t,o={})=>{let n=Zo(e),l=Je();await kt($i(e,o),{recursive:!0,force:!0}).catch(()=>{});let i=await Promise.all(t.map(async s=>{let c=Qe(s),m=o.global?c.globalSkillsDir:Te(l,c.skillsDir),d=Te(m,n);try{return await kt(d,{recursive:!0,force:!0}),{agent:c.displayName,success:!0}}catch(u){return{agent:c.displayName,success:!1,error:u instanceof Error?u.message:String(u)}}}));return await jo(e),i}});var Yn={};Rt(Yn,{runCliInstall:()=>Ka});import Ye from"chalk";async function ja(e,t){let o=await ro(),n=[];for(let l of e){let i=o.find(c=>c.name===l);if(!i){console.error(Ye.red(`\u274C Skill "${l}" not found`));continue}let s=t?await _t(l):await ht(l);s?n.push({...i,path:s}):console.error(Ye.red(`\u274C Failed to download skill "${l}"`))}return n}function Va(e){let t=e.filter(n=>n.success),o=e.filter(n=>!n.success);t.length>0&&(console.log(Ye.green(`
4
+ \u2705 Successfully installed ${t.length} skill(s):`)),t.forEach(n=>{console.log(Ye.dim(` \u2022 ${n.skill} \u2192 ${n.agent} (${n.method})`))})),o.length>0&&(console.log(Ye.red(`
5
+ \u274C Failed to install ${o.length} skill(s):`)),o.forEach(n=>{console.log(Ye.dim(` \u2022 ${n.skill} \u2192 ${n.agent}: ${n.error}`))}))}async function Ka(e){e.skill||(console.error(Ye.red("\u274C --skill is required in CLI mode")),process.exit(1)),console.log(Ye.blue("\u23F3 Loading skills catalog..."));let t=await ja([e.skill],e.force||!1);t.length===0&&process.exit(1);let o=e.agent||["cursor","claude-code","windsurf"],n=e.symlink?"symlink":"copy",l={agents:o,skills:t.map(s=>s.name),method:n,global:e.global||!1},i=await lo(t,l);Va(i)}var Wn=Ie(()=>{"use strict";bt();ot()});var qn={};Rt(qn,{runCliRemove:()=>za});import Vt from"chalk";async function za(e){e.skill||(console.error(Vt.red("\u274C --skill is required in CLI mode")),process.exit(1));let t=e.agent||["cursor","claude-code","windsurf"];console.log(Vt.blue(`\u23F3 Removing ${e.skill}...`));let o=await Gt(e.skill,t,{global:e.global}),n=o.filter(i=>i.success),l=o.filter(i=>!i.success);n.length>0&&console.log(Vt.green(`\u2705 Removed ${e.skill} from ${n.length} agent(s)`)),l.length>0&&(console.log(Vt.red(`\u274C Failed to remove from ${l.length} agent(s):`)),l.forEach(i=>console.log(Vt.dim(` \u2022 ${i.agent}: ${i.error}`))))}var Jn=Ie(()=>{"use strict";bt()});var Qn={};Rt(Qn,{runCliUpdate:()=>Ya});import we from"chalk";async function Ya(e){if(console.log(we.blue("\u23F3 Fetching latest registry...")),await oo(!0),e.skill){if(!await Wo(e.skill)){console.log(we.green(`\u2705 ${e.skill} is already up to date`));return}console.log(we.blue(`\u23F3 Updating ${e.skill}...`)),await _t(e.skill)?console.log(we.green(`\u2705 Updated ${e.skill}`)):(console.error(we.red(`\u274C Failed to update ${e.skill}`)),process.exit(1))}else{let{readSkillLock:t}=await Promise.resolve().then(()=>(Vo(),Ur)),o=await t(),n=Object.keys(o.skills);if(n.length===0){console.log(we.yellow("No installed skills found. Run agent-skills install first."));return}let{toUpdate:l,upToDate:i}=await Wr(n);if(l.length===0){console.log(we.green(`\u2705 All ${i.length} installed skills are up to date`));return}console.log(we.blue(`\u23F3 Updating ${l.length} of ${n.length} skills...`));let s=0,c=0;for(let m of l)await _t(m)?s++:(c++,console.error(we.red(` \u274C Failed to update ${m}`)));console.log(we.green(`\u2705 ${s} updated, ${i.length} already up to date${c>0?we.red(`, ${c} failed`):""}`))}}var Zn=Ie(()=>{"use strict";ot()});var el={};Rt(el,{runCliCache:()=>Wa});import ct from"chalk";function Wa(e){e.clear?(qr(),console.log(ct.green("\u2705 Cache cleared"))):e.clearRegistry?(Jr(),console.log(ct.green("\u2705 Registry cache cleared"))):e.path?console.log(qo()):(console.log(ct.bold("Cache management:")),console.log(` ${ct.blue("--clear")} Clear all cached skills and registry`),console.log(` ${ct.blue("--clear-registry")} Clear only the registry cache`),console.log(` ${ct.blue("--path")} Show cache directory path`),console.log(),console.log(ct.dim(`Cache location: ${qo()}`)))}var tl=Ie(()=>{"use strict";ot()});import{Command as qa}from"commander";import{render as dt}from"ink";import ut from"react";import{Box as hr,useApp as Ua}from"ink";import{useEffect as Ga,useState as Ha}from"react";import{Box as Br,Text as Yt,useInput as El}from"ink";import{Box as He,Text as Me}from"ink";import Ir from"ink-big-text";import Lo from"ink-gradient";import{useMemo as Sl}from"react";import{createRequire as Tl}from"module";Mo();import{useEffect as bl,useState as zt}from"react";import{createRequire as hl}from"node:module";import yl from"package-json";var kl="@tech-leads-club/agent-skills";async function Tr(e){try{let t=await yl(kl,{version:"latest"});return t.version!==e?t.version:null}catch{return null}}function Cr(){try{let e=hl(import.meta.url);try{return e("../../package.json").version||"0.0.0"}catch{try{return e("../package.json").version||"0.0.0"}catch{return e("./package.json").version||"0.0.0"}}}catch{return"0.0.0"}}function wr(){let[e,t]=zt(null),[o]=zt(Cr()),[n,l]=zt(!1),[i,s]=zt(!0);return bl(()=>{let c=!0;return(async()=>{try{let d=new Promise(x=>{setTimeout(()=>x(),100)}),u=Tr(o).then(x=>{c&&t(x)}).catch(()=>{c&&t(null)}),p=Promise.resolve().then(()=>{if(c)try{l(Ro())}catch{l(!1)}});await Promise.race([Promise.all([u,p]),d])}finally{c&&s(!1)}})(),()=>{c=!1}},[o]),{updateAvailable:e,currentVersion:o,isGlobal:n,loading:i}}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 oe,jsxs as mt}from"react/jsx-runtime";var Cl=Tl(import.meta.url),wl=Cl("../../package.json"),Il="Curated skills to power up your coding agents",Dr=["#1e3a8a","#3b82f6","#0ea5e9","#06b6d4","#22d3ee"],Dl="\u2500",B=({notification:e})=>{let{updateAvailable:t,currentVersion:o,isGlobal:n,loading:l}=wr(),i=Sl(()=>e||(l?null:t?mt(Me,{color:"yellow",children:[a.warning," Update available: ",o," \u2192 ",t," (run"," ",oe(Me,{bold:!0,children:"npm update -g @tech-leads-club/agent-skills"}),")"]}):n?null:mt(Me,{color:"blue",children:[a.info," Tip: Install globally for easier access:"," ",oe(Me,{bold:!0,children:"npm install -g @tech-leads-club/agent-skills"})]})),[e,l,t,o,n]);return mt(He,{flexDirection:"column",paddingBottom:1,children:[mt(He,{flexDirection:"column",alignItems:"center",marginBottom:1,children:[oe(He,{marginBottom:-1,children:oe(Lo,{colors:["#1e3a8a","#3b82f6"],children:oe(Ir,{text:"TLC",font:"tiny"})})}),oe(He,{children:oe(Lo,{colors:Dr,children:oe(Ir,{text:"AGENT SKILLS",font:"block"})})}),mt(He,{marginTop:-1,alignItems:"center",children:[oe(Me,{color:"#334155",children:"\u2500\u2500\u2500\u2500\u2500\u2500 "}),mt(Me,{color:"white",bold:!0,children:["VERSION ",wl.version]}),oe(Me,{color:"#334155",children:" \u2500\u2500\u2500\u2500\u2500\u2500"})]}),oe(He,{marginTop:1,children:oe(Me,{color:"#64748b",italic:!0,children:Il})}),i&&oe(He,{marginTop:1,children:i})]}),oe(He,{marginTop:i?0:1,justifyContent:"center",children:oe(Lo,{colors:Dr,children:oe(Me,{children:Dl.repeat(60)})})})]})};import{Box as We,Text as De,useInput as vl}from"ink";import{useMemo as Bl,useState as vr}from"react";var r={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"};import{Fragment as Al,jsx as Le,jsxs as Oe}from"react/jsx-runtime";function Fe({items:e,onSelect:t,onCancel:o,initialIndex:n=0,itemLimit:l=10,hideFooter:i,footerRight:s}){let[c,m]=vr(n),[d,u]=vr(0);vl((x,g)=>{g.upArrow&&(m(f=>Math.max(0,f-1)),c<=d&&u(f=>Math.max(0,f-1))),g.downArrow&&(m(f=>Math.min(e.length-1,f+1)),c>=d+l-1&&u(f=>Math.min(e.length-l,f+1))),g.return&&t(e[c].value),g.escape&&o&&o()});let p=Bl(()=>e.slice(d,d+l),[e,d,l]);return Oe(We,{flexDirection:"column",children:[p.map((x,g)=>{let f=g+d===c;return Oe(We,{backgroundColor:f?r.bgLight:void 0,paddingX:1,children:[Le(We,{width:2,children:Le(De,{color:f?r.accent:r.textMuted,children:f?a.bullet:" "})}),Oe(De,{color:f?r.accent:r.text,bold:f,children:[f?a.radioActive:a.radioInactive," ",x.label]}),f&&x.hint&&Oe(De,{color:r.textDim,children:[" ",a.dot," ",x.hint]})]},`${x.label}-${g}`)}),e.length>l&&Le(We,{marginTop:1,paddingX:1,children:Oe(De,{color:r.textDim,children:[a.arrowUp,a.arrowDown," ",d+1,"-",Math.min(d+l,e.length)," of"," ",e.length]})}),!i&&Le(We,{marginTop:1,borderStyle:"round",borderColor:r.border,paddingX:1,children:Oe(We,{justifyContent:"space-between",width:"100%",children:[Oe(De,{children:[Le(De,{color:r.success,bold:!0,children:"enter"}),Le(De,{color:r.textDim,children:" select"}),o&&Oe(Al,{children:[Oe(De,{color:r.textDim,children:[" ",a.dot," "]}),Le(De,{color:r.warning,bold:!0,children:"esc"}),Le(De,{color:r.textDim,children:" back"})]})]}),s&&Le(We,{children:s})]})})]})}import{jsx as Mt,jsxs as Oo}from"react/jsx-runtime";function Ar({onSelect:e,onBack:t,onCredits:o}){let n=[{label:"Install new skills",value:"install",hint:"browse and select skills to install"},{label:"Update existing skills",value:"update",hint:"check for content changes"}];El(i=>{i==="c"&&o&&o()});let l=Oo(Yt,{children:[Mt(Yt,{color:r.accent,bold:!0,children:"c"}),Mt(Yt,{color:r.textDim,children:" credits"})]});return Oo(Br,{flexDirection:"column",paddingX:1,children:[Mt(B,{}),Mt(Br,{marginBottom:1,children:Oo(Yt,{bold:!0,color:r.primary,children:[a.diamond," What would you like to do?"]})}),Mt(Fe,{items:n,onSelect:e,onCancel:t,footerRight:l})]})}import{Box as xt,Text as Uo,useInput as Kl}from"ink";import zl from"ink-spinner";import{useState as Yl}from"react";import{Box as Fo,Text as Lt}from"ink";import{memo as Pl}from"react";import{jsx as qt,jsxs as Wt}from"react/jsx-runtime";var ve=Pl(function({hints:t,status:o}){return qt(Fo,{marginTop:1,borderStyle:"round",borderColor:r.border,paddingX:1,children:Wt(Fo,{justifyContent:"space-between",width:"100%",children:[qt(Lt,{children:t.map((n,l)=>Wt(Lt,{children:[l>0&&Wt(Lt,{color:r.textDim,children:[" ",a.dot," "]}),qt(Lt,{color:n.color??r.accent,bold:!0,children:n.key}),Wt(Lt,{color:r.textDim,children:[" ",n.label]})]},n.key))}),o&&qt(Fo,{children:o})]})})});import{Box as Se,Text as pt,useInput as Fl}from"ink";import{useEffect as $l}from"react";import{useEffect as Rl,useState as Ml}from"react";import{Fragment as Ll,jsx as Ol}from"react/jsx-runtime";var Er=({visible:e,duration:t=250,children:o})=>{let[n,l]=Ml(e?1:0);return Rl(()=>{if(e&&n===1||!e&&n===0)return;let i=Date.now(),s=n,c=e?1:0,d=setInterval(()=>{let p=Date.now()-i,x=Math.min(p/t,1),g=s+(e?x:-x)*Math.abs(c-s),f=Math.max(0,Math.min(1,g));l(f),x>=1&&(clearInterval(d),l(c))},16);return()=>{clearInterval(d)}},[e,t]),!e&&n<=.05?null:Ol(Ll,{children:o})};import{jsx as Q,jsxs as Jt}from"react/jsx-runtime";var Qt=({visible:e,onDismiss:t,shortcuts:o})=>{Fl(()=>{e&&t()},{isActive:e}),$l(()=>{let d;return e&&(d=setTimeout(()=>{t()},8e3)),()=>{d&&clearTimeout(d)}},[e,t]);let n=Math.ceil(o.length/2),l=o.slice(0,n),i=o.slice(n),s=({label:d})=>Q(Se,{flexShrink:0,children:Q(pt,{backgroundColor:r.bgLight,color:r.accent,bold:!0,children:` ${d} `})}),c=({entry:d})=>Jt(Se,{marginBottom:0,gap:1,children:[Q(Se,{width:10,justifyContent:"flex-end",flexShrink:0,children:Q(s,{label:d.key})}),Q(pt,{color:r.textDim,children:d.description})]}),m="\u2500".repeat(48);return Q(Er,{visible:e,duration:200,children:Jt(Se,{borderStyle:"round",borderColor:r.border,backgroundColor:r.bg,paddingX:2,paddingY:1,flexDirection:"column",width:56,children:[Q(Se,{justifyContent:"center",marginBottom:1,children:Jt(pt,{color:r.accent,bold:!0,children:[a.sparkle," Keyboard Shortcuts"]})}),Q(Se,{justifyContent:"center",children:Q(pt,{color:r.border,children:m})}),Jt(Se,{marginTop:1,gap:2,children:[Q(Se,{flexDirection:"column",gap:1,flexGrow:1,children:l.map(d=>Q(c,{entry:d},d.key))}),Q(Se,{flexDirection:"column",gap:1,flexGrow:1,children:i.map(d=>Q(c,{entry:d},d.key))})]}),Q(Se,{justifyContent:"center",marginTop:1,children:Q(pt,{color:r.border,children:m})}),Q(Se,{marginTop:1,justifyContent:"center",children:Q(pt,{color:r.textMuted,children:"press any key to dismiss"})})]})})};import{Box as ft,Text as $e,useInput as Nl}from"ink";import{useEffect as _l,useState as $o}from"react";import{jsx as Ne,jsxs as qe}from"react/jsx-runtime";function gt({items:e,onSubmit:t,onCancel:o,initialSelected:n=[],limit:l=10}){let[i,s]=$o(n),[c,m]=$o(0),[d,u]=$o(0);_l(()=>{s(n)},[n]),Nl((f,k)=>{if(k.return){t(i);return}if(k.escape&&o){o();return}let S=c,w=d;if(k.upArrow?S=c>0?c-1:e.length-1:k.downArrow&&(S=c<e.length-1?c+1:0),S<w?w=S:S>=w+l&&(w=S-l+1),k.upArrow&&c===0?w=Math.max(0,e.length-l):k.downArrow&&c===e.length-1&&(w=0),S!==c&&(m(S),u(w)),f===" "){let y=e[c];i.includes(y.value)?s(i.filter(I=>I!==y.value)):s([...i,y.value])}f==="a"&&k.ctrl&&(i.length===e.length?s([]):s(e.map(y=>y.value)))});let p=e.slice(d,d+l),x=d>0,g=e.length>d+l;return qe(ft,{flexDirection:"column",children:[x&&Ne(ft,{justifyContent:"center",marginBottom:1,children:qe($e,{color:r.textDim,children:[a.arrowUp," ",a.arrowUp," ",a.arrowUp]})}),p.map((f,k)=>{let S=k+d,w=S===c,y=i.includes(f.value),I=w?a.bullet:" ",W=y?r.success:r.accent,R=y?a.checkboxActive:a.checkboxInactive,ne=y?r.success:r.textMuted,ye=w?r.primary:y?r.primaryLight:r.text;return qe(ft,{backgroundColor:w?r.bgLight:void 0,paddingX:1,children:[Ne(ft,{width:2,children:Ne($e,{color:W,children:I})}),Ne(ft,{width:2,children:Ne($e,{color:ne,children:R})}),Ne($e,{color:ye,bold:w,children:f.label}),f.hint&&qe($e,{color:y?r.success:r.textDim,children:[" ",a.dot," ",f.hint]})]},`${String(f.value)}-${S}`)}),g&&Ne(ft,{justifyContent:"center",marginTop:1,children:qe($e,{color:r.textDim,children:[a.arrowDown," ",a.arrowDown," ",a.arrowDown]})}),Ne(ve,{hints:[{key:"space",label:"toggle"},{key:"enter",label:"confirm",color:r.success},...o?[{key:"esc",label:"back",color:r.warning}]:[],{key:"?",label:"help"}],status:i.length>0?qe($e,{children:[qe($e,{color:r.success,bold:!0,children:[a.checkboxActive," ",i.length]}),Ne($e,{color:r.textDim,children:" selected"})]}):void 0})]})}Ft();import{useEffect as jl,useMemo as Vl,useState as _o}from"react";function Lr(){let[e,t]=_o([]),[o,n]=_o([]),[l,i]=_o(!0),s=Vl(()=>Mr(),[]);return jl(()=>{let m=setTimeout(()=>{let d=Zt();n(d),t(d),i(!1)},800);return()=>clearTimeout(m)},[]),{allAgents:s,installedAgents:o,selectedAgents:e,setSelectedAgents:t,toggleAgent:m=>{t(d=>d.includes(m)?d.filter(u=>u!==m):[...d,m])},loading:l}}Ft();import{Fragment as Or,jsx as Be,jsxs as Ze}from"react/jsx-runtime";function Fr({onSelect:e,onBack:t}){let{allAgents:o,installedAgents:n,selectedAgents:l,loading:i}=Lr(),s=[{key:"space",description:"Toggle selection"},{key:"enter",description:"Confirm"},{key:"ctrl+a",description:"Select all"},{key:"esc",description:"Go back"}],[c,m]=Yl(!1);Kl(u=>{u==="?"&&m(p=>!p)});let d=o.map(u=>{let p=Qe(u),x=n.includes(u);return{label:p.displayName,value:u,hint:x?`${a.check} detected`:void 0}});return i?Ze(xt,{flexDirection:"column",paddingX:1,children:[Be(B,{}),Be(xt,{marginTop:1,children:Ze(Uo,{color:r.accent,children:[Be(zl,{type:"dots"})," Scanning for installed agents..."]})})]}):Ze(xt,{flexDirection:"column",paddingX:1,minHeight:20,children:[Be(B,{}),c?Ze(Or,{children:[Be(xt,{flexDirection:"column",flexGrow:1,alignItems:"center",justifyContent:"center",children:Be(Qt,{visible:c,onDismiss:()=>m(!1),shortcuts:s})}),Be(ve,{hints:[{key:"space",label:"toggle"},{key:"enter",label:"confirm",color:r.success},...t?[{key:"esc",label:"back",color:r.warning}]:[],{key:"?",label:"help"}]})]}):Ze(Or,{children:[Be(xt,{marginBottom:1,children:Ze(Uo,{bold:!0,color:r.primary,children:[a.diamond," Where do you want to install skills?"]})}),Be(xt,{marginBottom:1,children:Ze(Uo,{color:r.textDim,children:[n.length," agents detected on this machine"]})}),Be(gt,{items:d,initialSelected:l,onSubmit:e,onCancel:t,limit:16})]})]})}import{Box as ue,Text as K,useInput as Wl}from"ink";import{useState as Go}from"react";import{jsx as L,jsxs as me}from"react/jsx-runtime";function $r({onConfirm:e,onBack:t,initialMethod:o="copy",initialGlobal:n=!1}){let[l,i]=Go("method"),[s,c]=Go(o),[m,d]=Go(n);return l==="method"?me(ue,{flexDirection:"column",paddingX:1,children:[L(B,{}),L(ue,{marginBottom:1,children:me(K,{bold:!0,color:r.primary,children:[a.diamond," Choose installation method:"]})}),L(Fe,{items:[{label:"Copy",value:"copy",hint:"independent copies (recommended)"},{label:"Symlink",value:"symlink",hint:"shared source (may not work with all agents)"}],onSelect:u=>{c(u),i("scope")},onCancel:t})]}):l==="scope"?me(ue,{flexDirection:"column",paddingX:1,children:[L(B,{}),L(ue,{marginBottom:1,children:me(K,{bold:!0,color:r.primary,children:[a.diamond," Choose installation scope:"]})}),L(Fe,{items:[{label:"Local",value:!1,hint:"this project only"},{label:"Global",value:!0,hint:"user home directory"}],onSelect:u=>{d(u),i("confirm")},onCancel:()=>i("method")})]}):L(ql,{method:s,isGlobal:m,onConfirm:()=>e({method:s,global:m}),onBack:()=>i("scope")})}function ql({method:e,isGlobal:t,onConfirm:o,onBack:n}){return Wl((l,i)=>{(i.return||l==="y"||l==="Y")&&o(),(i.escape||l==="n"||l==="N")&&n()}),me(ue,{flexDirection:"column",paddingX:1,children:[L(B,{}),me(ue,{flexDirection:"column",borderStyle:"round",borderColor:r.accent,paddingX:2,paddingY:1,children:[L(ue,{marginBottom:1,children:me(K,{bold:!0,color:r.accent,children:[a.diamond," Ready to install"]})}),me(ue,{children:[L(ue,{width:10,children:L(K,{color:r.textDim,children:"Method"})}),L(K,{color:r.text,bold:!0,children:e==="copy"?"Copy":"Symlink"}),me(K,{color:r.textMuted,children:[" ",a.dot," ",e==="copy"?"Recommended":"Developer mode"]})]}),me(ue,{children:[L(ue,{width:10,children:L(K,{color:r.textDim,children:"Scope"})}),L(K,{color:r.text,bold:!0,children:t?"Global":"Local"}),me(K,{color:r.textMuted,children:[" ",a.dot," ",t?"User home":"This project"]})]})]}),L(ue,{marginTop:1,borderStyle:"round",borderColor:r.border,paddingX:1,children:L(ue,{justifyContent:"space-between",width:"100%",children:me(K,{children:[L(K,{color:r.success,bold:!0,children:"Y"}),L(K,{color:r.textDim,children:" / "}),L(K,{color:r.success,bold:!0,children:"enter"}),L(K,{color:r.textDim,children:" confirm"}),me(K,{color:r.textDim,children:[" ",a.dot," "]}),L(K,{color:r.warning,bold:!0,children:"N"}),L(K,{color:r.textDim,children:" / "}),L(K,{color:r.warning,bold:!0,children:"esc"}),L(K,{color:r.textDim,children:" back"})]})})})]})}import{Box as ae,Text as q,useInput as ga}from"ink";import xa from"ink-spinner";import{useEffect as ha,useMemo as ya,useState as it}from"react";Ft();bt();import{useEffect as Ni,useState as tn}from"react";function Ae(){let[e,t]=tn({}),[o,n]=tn(!0);return Ni(()=>{let l=!0;return(async()=>{try{let s=Zt(),c={};for(let m of s)try{let[d,u]=await Promise.all([er(m,!1),er(m,!0)]),p=new Set([...d,...u]);for(let x of p)c[x]||(c[x]=[]),c[x].includes(m)||c[x].push(m)}catch(d){console.error(`Failed to check installed skills for ${m}:`,d)}l&&(t(c),n(!1))}catch(s){console.error("Failed to detect installed agents:",s),l&&n(!1)}})(),()=>{l=!1}},[]),{installedSkills:e,loading:o}}bt();import{useState as io}from"react";function so(){let[e,t]=io({current:0,total:0,skill:""}),[o,n]=io([]),[l,i]=io(!1),[s,c]=io(null);return{install:async(d,u)=>{i(!0),t({current:0,total:d.length*u.agents.length,skill:"Initializing..."}),c(null);try{let p=await lo(d,u);return n(p),p}catch(p){return c(p instanceof Error?p.message:String(p)),[]}finally{i(!1)}},progress:e,results:o,installing:l,error:s}}import{useEffect as cs,useState as uo}from"react";import{existsSync as rr,readdirSync as _i,readFileSync as Ui,writeFileSync as fu}from"node:fs";import{dirname as Gi,join as on}from"node:path";import{fileURLToPath as Hi}from"node:url";var St="uncategorized",Tt=/^\(([a-z][a-z0-9-]*)\)$/,tr="_category.json",or={id:St,name:"Uncategorized",description:"Skills without a specific category",priority:999};function Ht(e){return e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}var Xi=Hi(import.meta.url),ji=Gi(Xi);function rn(){let e=on(ji,"..","..","..","..","packages","skills-catalog","skills");return rr(e),e}function Vi(){let e=rn(),t=on(e,tr);if(!rr(t))return{};try{let o=Ui(t,"utf-8");return JSON.parse(o)}catch{return{}}}function Ki(e){let t=e.match(Tt);return t?t[1]:null}function zi(e){return Tt.test(e)}function Yi(){let e=rn();if(!rr(e))return[];let t=Vi(),o=_i(e,{withFileTypes:!0}),n=[],l=0;for(let i of o){if(!i.isDirectory()||!zi(i.name))continue;let s=Ki(i.name);if(!s)continue;let c=t[i.name]??{};n.push({id:s,name:c.name??Ht(s),description:c.description,priority:c.priority??l}),l++}return n.sort((i,s)=>i.name.localeCompare(s.name)),n}function ao(e){let t=Yi();if(t.length===0){let i=new Set(e.map(s=>s.category).filter(Boolean));t=Array.from(i).map((s,c)=>({id:s,name:Ht(s),priority:c}))}let o=new Map;for(let i of t)o.set(i,[]);o.set(or,[]);for(let i of e){let s=i.category??St,c=t.find(u=>u.id===s);!c&&s!==St&&(c={id:s,name:Ht(s),priority:999},t.push(c),o.set(c,[]));let m=c??or,d=o.get(m)??[];d.push(i),o.set(m,d)}for(let[i,s]of o)s.length===0&&o.delete(i);let n=new Map,l=Array.from(o.keys()).sort((i,s)=>i.name.localeCompare(s.name));for(let i of l){let s=o.get(i);s&&(s.sort((c,m)=>c.name.localeCompare(m.name)),n.set(i,s))}return n}import{existsSync as co,readdirSync as nn,readFileSync as Wi}from"node:fs";import{dirname as qi,join as Xt}from"node:path";import{fileURLToPath as Ji}from"node:url";ot();var Qi=Ji(import.meta.url),Zi=qi(Qi),rt={mode:null,localDir:null},es=[Xt(Zi,"..","..","..","..","packages","skills-catalog","skills")];function ts(){return es.find(e=>co(e))??null}function os(e){return Tt.test(e)}function rs(e){return e.match(Tt)?.[1]??null}function ns(e){let t=e.match(/^---\n([\s\S]*?)\n---/);if(!t)return{};let o=t[1],n=o.match(/^name:\s*(.+)$/m),l=o.match(/^description:\s*(.+)$/m);return{name:n?.[1]?.trim(),description:l?.[1]?.trim()}}function ln(e,t){let o=Xt(e,"SKILL.md");if(!co(o))return null;let n=Wi(o,"utf-8"),{name:l,description:i}=ns(n),s=e.split("/").pop()??"";return{name:l??s,description:i??"No description",path:e,category:t}}function ls(e,t){return co(e)?nn(e,{withFileTypes:!0}).filter(o=>o.isDirectory()).map(o=>ln(Xt(e,o.name),t)).filter(o=>o!==null):[]}function is(e){return co(e)?nn(e,{withFileTypes:!0}).filter(o=>o.isDirectory()).flatMap(o=>{if(os(o.name)){let l=rs(o.name);return l?ls(Xt(e,o.name),l):[]}let n=ln(Xt(e,o.name),St);return n?[n]:[]}):[]}function ss(){if(rt.mode)return rt.mode;let e=ts();return e?(rt.localDir=e,rt.mode="local","local"):(rt.mode="remote","remote")}function as(){return ss()==="local"&&rt.localDir!==null}async function sn(){return as()?is(rt.localDir):ro()}function je(){let[e,t]=uo([]),[o,n]=uo(!0),[l,i]=uo(null),[s,c]=uo(new Map);return cs(()=>{let m=!0;return(async()=>{try{let u=await sn();m&&(t(u),c(ao(u)))}catch(u){m&&i(u instanceof Error?u.message:String(u))}finally{m&&n(!1)}})(),()=>{m=!1}},[]),{skills:e,loading:o,error:l,groupedSkills:s}}import{useState as ds}from"react";function an(e){let[t,o]=ds(1);return{step:t,next:()=>o(s=>Math.min(s+1,e)),back:()=>o(s=>Math.max(s-1,1)),goTo:s=>o(s),isFirst:t===1,isLast:t===e,progress:t/e}}import{Box as Ve,Text as $,useInput as hs,useStdout as ys}from"ink";import fn from"ink-big-text";import ho from"ink-gradient";import{useCallback as ks,useEffect as xo,useMemo as bs,useRef as gn,useState as Ct}from"react";import{fileURLToPath as Ss}from"node:url";import{dirname as xn,join as Ts}from"node:path";import{existsSync as Cs}from"node:fs";import cn from"ky";var dn="https://api.github.com/repos/tech-leads-club/agent-skills",us=`${dn}/contributors`,ms=new Set(["tech-leads-club-release-bot[bot]"]),mo=null,po=null;async function un(){if(mo)return mo;try{return mo=(await cn.get(us,{headers:{Accept:"application/vnd.github.v3+json"},timeout:1e4}).json()).filter(({login:t})=>!ms.has(t)).map(({login:t,avatar_url:o,contributions:n})=>({login:t,avatarUrl:o,contributions:n})),mo}catch{return[]}}async function mn(){if(po!==null)return po;try{return po=(await cn.get(dn,{headers:{Accept:"application/vnd.github.v3+json"},timeout:1e4}).json()).stargazers_count,po}catch{return 0}}import{spawn as fo,execSync as ps}from"node:child_process";import{platform as fs}from"node:os";function gs(e){try{return ps(`which ${e}`,{stdio:"ignore"}),!0}catch{return!1}}function xs(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:n}of t)if(gs(o))return fo(o,n,{stdio:"ignore"});return fo("mpv",["--no-video","--no-terminal",e],{stdio:"ignore"})}function pn(e){try{let t=fs(),o;return t==="darwin"?o=fo("afplay",[e],{stdio:"ignore"}):t==="win32"?o=fo("powershell",["-c",`(New-Object Media.SoundPlayer "${e}").PlaySync()`],{stdio:"ignore"}):o=xs(e),o.on("error",()=>{}),o}catch{return null}}function go(e){e&&!e.killed&&e.kill()}import{jsx as A,jsxs as Ce}from"react/jsx-runtime";var ws=220,hn=40,yn=60,ir=500,sr=52,wt=["#1e3a8a","#3b82f6","#0ea5e9","#06b6d4","#22d3ee"],nr=["#f59e0b","#ef4444","#ec4899","#a855f7"],lr="\u2500".repeat(sr-4),Is=10,Ds={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 vs(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:nr}),o.push({type:"gradient",text:lr,gradientColors:wt}),o.push({type:"blank"});for(let l=0;l<e.length;l++){let i=e[l];o.push({type:"contributor",rank:l+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:nr}),o.push({type:"gradient",text:lr,gradientColors:wt}),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 n=e.reduce((l,i)=>l+i.contributions,0);return o.push({type:"text",text:`${a.check} Contributions \xB7\xB7\xB7\xB7 ${n}`,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:nr}),o.push({type:"gradient",text:lr,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 Bs(){try{let e=xn(Ss(import.meta.url));for(let t=0;t<5;t++){let o=Ts(e,"assets","chiptune.mp3");if(Cs(o))return o;e=xn(e)}return null}catch{return null}}function As({rank:e,login:t,contributions:o}){let n=Ds[e],l=n?.color??"#e2e8f0",i=e.toString().padStart(2),s=`@${t}`,c=`${o}`,m=n?` ${n.badge}`:"",d=5+s.length+m.length+1+c.length,u=Math.max(2,sr-4-d),p="\xB7".repeat(u);return Ce($,{children:[Ce($,{color:"#64748b",children:[i,". "]}),A($,{color:l,bold:!!n,children:s}),A($,{color:n?.color??"#94a3b8",children:m}),Ce($,{color:"#334155",children:[" ",p," "]}),A($,{color:"#22c55e",bold:!0,children:c})]})}function Es({line:e}){switch(e.type){case"blank":return A($,{children:" "});case"text":return A($,{color:e.color,bold:e.bold,children:e.text});case"gradient":return A(ho,{colors:[...e.gradientColors],children:A($,{children:e.text})});case"contributor":return A(As,{rank:e.rank,login:e.login,contributions:e.contributions})}}function Ps({speed:e,paused:t}){if(t)return Ce($,{color:r.warning,bold:!0,children:[" ",a.bar,a.bar," PAUSED"]});let o=Math.round((ir-e)/(ir-yn)*4)+1,n="\u25AE".repeat(o)+"\u25AF".repeat(5-o);return Ce($,{color:r.textMuted,children:[" ",n]})}function jt({onExit:e}){let{stdout:t}=ys(),o=t?.rows??24,n=Math.max(6,o-Is-4),[l,i]=Ct([]),[s,c]=Ct(0),[m,d]=Ct(!0),[u,p]=Ct(0),[x,g]=Ct(ws),[f,k]=Ct(!1),S=gn(null),w=gn(null);xo(()=>{Promise.all([un(),mn()]).then(([P,j])=>{i(P),c(j),d(!1)})},[]),xo(()=>{let P=Bs();return P&&(S.current=pn(P)),()=>{go(S.current)}},[]);let y=bs(()=>vs(l,s),[l,s]),I=y.length+n,W=u>=I,R=ks(()=>{p(P=>P>=I?P:P+1)},[I]);if(xo(()=>{if(m||f||W){w.current&&clearInterval(w.current),w.current=null;return}return w.current=setInterval(R,x),()=>{w.current&&clearInterval(w.current)}},[m,f,W,x,R]),xo(()=>{if(!W)return;let P=setTimeout(()=>{go(S.current),e()},3e3);return()=>clearTimeout(P)},[W,e]),hs((P,j)=>{if(j.escape){go(S.current),e();return}if(P===" "){k(M=>!M);return}if(j.upArrow){g(M=>Math.max(yn,M-hn));return}if(j.downArrow){g(M=>Math.min(ir,M+hn));return}}),m)return A(Ve,{flexDirection:"column",alignItems:"center",padding:2,children:A($,{color:r.accent,children:"Loading contributors..."})});let ne={type:"blank"},ye=Array(n).fill(ne),le=Array(n).fill(ne),ke=[...ye,...y,...le].slice(u,u+n);return Ce(Ve,{flexDirection:"column",alignItems:"center",children:[A(Ve,{marginBottom:-1,children:A(ho,{colors:["#1e3a8a","#3b82f6"],children:A(fn,{text:"TLC",font:"tiny"})})}),A(Ve,{children:A(ho,{colors:[...wt],children:A(fn,{text:"AGENT SKILLS",font:"block"})})}),A(Ve,{children:A(ho,{colors:[...wt],children:A($,{children:"\u2500".repeat(60)})})}),A(Ve,{flexDirection:"column",alignItems:"center",height:n,width:sr,children:ke.map((P,j)=>A(Ve,{justifyContent:"center",children:A(Es,{line:P})},`cl-${u}-${j}`))}),Ce(Ve,{marginTop:1,gap:2,children:[Ce($,{children:[A($,{color:r.accent,bold:!0,children:"space"}),A($,{color:r.textDim,children:" pause"})]}),A($,{color:r.textMuted,children:a.dot}),Ce($,{children:[Ce($,{color:r.accent,bold:!0,children:[a.arrowUp,a.arrowDown]}),A($,{color:r.textDim,children:" speed"})]}),A(Ps,{speed:x,paused:f}),A($,{color:r.textMuted,children:a.dot}),Ce($,{children:[A($,{color:r.warning,bold:!0,children:"esc"}),A($,{color:r.textDim,children:" back"})]})]})]})}import{Box as z,Text as ge,useInput as ca,useStdout as da}from"ink";import{useMemo as ur,useState as _e}from"react";import{Box as bn,Text as It}from"ink";import{useMemo as Rs}from"react";function kn(e,t){return e>0?`(${e}/${t})`:`(${t})`}import{jsx as yo,jsxs as ko}from"react/jsx-runtime";var Sn=({name:e,totalCount:t,installedCount:o=0,isExpanded:n=!1,isFocused:l=!1})=>{let i=Rs(()=>kn(o,t),[o,t]),s=n?"\u25BE":"\u25B8";return ko(bn,{children:[yo(bn,{width:2,children:l?yo(It,{color:r.accent,children:a.bullet}):yo(It,{children:" "})}),ko(It,{color:l?r.accent:r.primaryLight,bold:!0,children:[s," "]}),yo(It,{color:l?r.accent:r.text,bold:!0,children:e}),ko(It,{color:o>0?r.success:r.textMuted,children:[" ",i]}),!n&&l&&ko(It,{color:r.textDim,children:[" ",a.dot," press space to expand"]})]})};import{Box as rm,Text as nm,useInput as lm}from"ink";import{useState as sm}from"react";import{jsx as dm,jsxs as um}from"react/jsx-runtime";import{Box as bo,Text as Tn}from"ink";import Ms from"ink-text-input";import{jsx as Dt,jsxs as Ls}from"react/jsx-runtime";var Cn=({query:e,onChange:t,total:o,filtered:n,isLoading:l=!1,focus:i=!0})=>Ls(bo,{borderStyle:"round",borderColor:i?r.accent:r.border,paddingX:1,children:[Dt(bo,{marginRight:1,children:Dt(Tn,{children:"\u{1F50D}"})}),Dt(bo,{flexGrow:1,children:Dt(Ms,{value:e,onChange:t,placeholder:"Type to filter skills...",focus:i})}),Dt(bo,{marginLeft:1,children:Dt(Tn,{color:r.textDim,children:l?"Loading...":`${n}/${o} skills`})})]});import{Box as nt,Text as So}from"ink";import{Box as Os,Text as Fs}from"ink";import{jsx as _s,jsxs as Ns}from"react/jsx-runtime";var $s={installed:{icon:a.check,label:"installed",color:r.success,bg:"#052e16"},update:{icon:a.arrowUp,label:"update",color:r.warning,bg:"#422006"},new:{icon:a.sparkle,label:"new",color:r.accent,bg:"#083344"}};function wn({status:e}){let t=$s[e];return t?_s(Os,{children:Ns(Fs,{backgroundColor:t.bg,color:t.color,children:[" ",t.icon," ",t.label," "]})}):null}import{jsx as Ee,jsxs as In}from"react/jsx-runtime";function Dn({name:e,description:t,status:o,selected:n=!1,focused:l=!1,readOnly:i=!1}){let s=n?a.checkboxActive:a.checkboxInactive,c=n?r.success:r.textMuted,m=l?a.bullet:" ",d=n?r.success:r.accent,u=l?r.primary:n?r.primaryLight:r.text,p=l?r.textDim:r.textMuted,x=l?r.bgLight:void 0;return In(nt,{flexDirection:"column",backgroundColor:x,children:[In(nt,{children:[Ee(nt,{width:2,flexShrink:0,children:Ee(So,{color:d,children:m})}),!i&&Ee(nt,{width:2,flexShrink:0,children:Ee(So,{color:c,children:s})}),Ee(nt,{flexGrow:1,children:Ee(So,{bold:!0,color:u,children:e})}),o&&Ee(nt,{marginLeft:1,flexShrink:0,children:Ee(wn,{status:o})})]}),Ee(nt,{paddingLeft:i?2:4,children:Ee(So,{color:p,wrap:"truncate",children:t})})]})}import{Box as lt,Text as Z,useInput as js,useStdout as Vs}from"ink";import Pn,{useCallback as Ks,useEffect as zs,useMemo as Ys,useRef as cr,useState as Ws}from"react";import Pe from"chalk";import qs from"ink-spinner";ot();import{useEffect as Us,useState as To}from"react";import{readFileSync as Gs}from"node:fs";import{join as Hs}from"node:path";function vn(e){let[t,o]=To(null),[n,l]=To(null),[i,s]=To(!1),[c,m]=To(null);return Us(()=>{if(!e){o(null),l(null),s(!1),m(null);return}let d=!0;return s(!0),m(null),(async()=>{try{let[p,x]=await Promise.all([Nt(e).catch(()=>null),ht(e).catch(()=>null)]);if(!d)return;p&&o(p);let g=x??Xe(e);try{let f=Gs(Hs(g,"SKILL.md"),"utf-8");l(f)}catch{m("Failed to load skill content")}}catch(p){d&&m(p instanceof Error?p.message:String(p))}finally{d&&s(!1)}})(),()=>{d=!1}},[e]),{metadata:t,content:n,loading:i,error:c}}var ar={web:"#3b82f6",devops:"#10b981",data:"#8b5cf6",mobile:"#f59e0b",testing:"#ef4444",ai:"#06b6d4",security:"#ec4899",default:"#64748b"};function Bn(e){return Object.prototype.hasOwnProperty.call(ar,e)?ar[e]:ar.default}function Xs(e){if(!e.startsWith("---"))return e;let t=e.indexOf("---",3);return t===-1?e:e.slice(t+3).trimStart()}function An(e){let o=Xs(e).split(`
6
+ `),n=[],l=0;for(;l<o.length;){let i=o[l];if(i.startsWith("```")){let m=i.slice(3).trim(),d=[];for(l++;l<o.length&&!o[l].startsWith("```");)d.push(o[l]),l++;n.push({type:"code-block",language:m,lines:d}),l++;continue}if(i.trim()===""){n.push({type:"blank"}),l++;continue}if(/^(-{3,}|_{3,}|\*{3,})$/.test(i.trim())){n.push({type:"hr"}),l++;continue}let s=i.match(/^(#{1,3})\s+(.+)$/);if(s){n.push({type:"heading",level:s[1].length,text:s[2]}),l++;continue}let c=i.match(/^(\s*)([-*]|\d+\.)\s+(.+)$/);if(c){let m=Math.floor(c[1].length/2);n.push({type:"list-item",text:c[3],indent:m}),l++;continue}n.push({type:"paragraph",text:i}),l++}return n}import{Fragment as ta,jsx as se,jsxs as fe}from"react/jsx-runtime";var Js=6,Qs=2,Zs=2,pe={h1:e=>Pe.hex(r.primary).bold(e),h2:e=>Pe.hex(r.primaryLight).bold(e),h3:e=>Pe.hex(r.accent).bold(e),text:e=>Pe.hex(r.textDim)(e),muted:e=>Pe.hex(r.textMuted)(e),code:e=>Pe.hex(r.accent)(e),border:e=>Pe.hex(r.border)(e),bold:e=>Pe.hex(r.text).bold(e),dim:e=>Pe.dim(e),indicator:e=>Pe.hex(r.textDim)(e)};function En(e){return e.replace(/\*\*(.+?)\*\*/g,(t,o)=>pe.bold(o)).replace(/\*(.+?)\*/g,(t,o)=>pe.dim(o)).replace(/`(.+?)`/g,(t,o)=>pe.code(o))}function ea(e){let t=[];for(let o of e)switch(o.type){case"heading":{let n=o.level===1?a.diamond:o.level===2?a.arrow:a.dot,l=o.level===1?pe.h1:o.level===2?pe.h2:pe.h3;o.level===1&&t.length>0&&t.push(""),t.push(l(`${n} ${o.text}`));break}case"paragraph":t.push(pe.text(En(o.text)));break;case"list-item":{let n=" ".repeat(o.indent);t.push(`${n}${pe.muted(a.bullet)} ${pe.text(En(o.text))}`);break}case"code-block":o.language&&t.push(pe.dim(` ${o.language}`));for(let n of o.lines)t.push(` ${pe.border(a.bar)} ${pe.code(n)}`);break;case"hr":t.push(pe.border("\u2500".repeat(30)));break;case"blank":t.push("");break}return t}var Rn=Pn.memo(({skill:e,metadata:t})=>{let o=Bn(e.category??"default"),n=t?.author?` ${a.dot} @${t.author}`:"",l=t?.files?.length?` ${a.dot} ${t.files.length} file${t.files.length!==1?"s":""}`:"";return fe(lt,{flexDirection:"column",marginBottom:1,children:[fe(Z,{bold:!0,color:r.text,children:[a.sparkle," ",e.name]}),fe(Z,{children:[se(Z,{color:o,bold:!0,children:e.category}),fe(Z,{color:r.textDim,children:[n,l]})]}),se(Z,{color:r.textDim,wrap:"truncate",children:e.description})]})});Rn.displayName="MetadataHeader";var dr=Pn.memo(({skill:e,expanded:t=!1,onClose:o,onToggleExpand:n})=>{let{metadata:l,content:i,loading:s,error:c}=vn(e?.name??null),{stdout:m}=Vs(),[d,u]=Ws(0),p=m?.rows??24,x=Ys(()=>i?ea(An(i)):[],[i]),g=Math.max(10,p-17),f=Math.max(3,g-Js-Qs),k=Math.max(1,f-Zs),S=Math.max(0,x.length-k),w=S>0,y=w?Math.round((d+k)/x.length*100):100,I=cr(S);I.current=S;let W=cr(o);W.current=o;let R=cr(n);R.current=n;let ne=Ks((ke,P)=>{P.upArrow?u(j=>Math.max(0,j-1)):P.downArrow?u(j=>Math.min(I.current,j+1)):ke==="f"?R.current?.():(P.escape||P.tab||P.leftArrow)&&W.current()},[]);if(js(ne),zs(()=>{u(0)},[e?.name]),!e)return null;let ye=d>0,le=d+k<x.length,Ue=x.slice(d,d+k);return fe(lt,{flexDirection:"column",borderStyle:"round",borderColor:r.accent,paddingX:1,flexGrow:1,children:[fe(lt,{children:[fe(Z,{bold:!0,color:r.accent,children:[a.info," Skill Details"]}),se(lt,{flexGrow:1}),fe(Z,{color:r.textMuted,children:[w&&fe(Z,{color:r.textDim,children:[y,"% ",a.dot," "]}),se(Z,{color:r.accent,bold:!0,children:"\u2191\u2193"})," scroll ",a.dot," ",se(Z,{color:r.accent,bold:!0,children:"f"})," ",t?"compact":"expand"," ",a.dot," ",se(Z,{color:r.accent,bold:!0,children:"Esc"})," close"]})]}),se(Z,{color:r.border,wrap:"truncate",children:"\u2500".repeat(200)}),s?se(lt,{alignItems:"center",justifyContent:"center",flexGrow:1,children:fe(Z,{color:r.accent,children:[se(qs,{type:"dots"})," Loading\u2026"]})}):c?se(lt,{alignItems:"center",justifyContent:"center",flexGrow:1,children:fe(Z,{color:r.error,children:[a.cross," ",c]})}):fe(ta,{children:[se(Rn,{skill:e,metadata:l}),fe(lt,{flexDirection:"column",height:f,overflowY:"hidden",children:[ye&&se(Z,{color:r.textDim,children:` ${a.arrowUp} ${a.arrowUp} ${a.arrowUp}`}),se(Z,{children:Ue.join(`
7
+ `)}),le&&se(Z,{color:r.textDim,children:` ${a.arrowDown} ${a.arrowDown} ${a.arrowDown}`})]})]})]})});dr.displayName="SkillDetailPanel";import{useEffect as pp,useState as fp}from"react";import{useMemo as oa,useState as ra}from"react";function Mn(e,t){let[o,n]=ra(""),l=oa(()=>{if(!o.trim())return e;let i=o.toLowerCase().split(/\s+/).filter(s=>s.length>0);return e.filter(s=>{let c=t.keys.map(m=>{let d=s[m];return typeof d=="string"?d.toLowerCase():""}).join(" ");return i.every(m=>c.includes(m))})},[o,e,t.keys]);return{query:o,setQuery:n,filtered:l,hasFilter:o.trim().length>0}}bt();import{useState as Co}from"react";function Ln(){let[e,t]=Co({current:0,total:0,skill:""}),[o,n]=Co([]),[l,i]=Co(!1),[s,c]=Co(null);return{remove:async(u,p,x=!1)=>{i(!0),t({current:0,total:p.length,skill:u}),c(null);try{let g=await Gt(u,p,{global:x});return n(f=>[...f,...g]),g}catch(g){return c(g instanceof Error?g.message:String(g)),[]}finally{i(!1)}},removeMultiple:async(u,p=!1)=>{i(!0);let x=u.reduce((g,f)=>g+f.agents.length,0);t({current:0,total:x,skill:"Initializing..."}),n([]),c(null);try{let g=0;for(let f of u){t({current:g,total:x,skill:f.name});let k=await Gt(f.name,f.agents,{global:p});n(S=>[...S,...k]),g+=f.agents.length}}catch(g){c(g instanceof Error?g.message:String(g))}finally{i(!1)}},progress:e,results:o,removing:l,error:s}}import{useInput as na}from"ink";import{useCallback as la,useRef as ia,useState as sa}from"react";var wo=["up","up","down","down","left","right","left","right","b","a"];function On(){let[e,t]=sa(!1),o=ia([]);na((l,i)=>{if(e)return;let s=null;if(i.upArrow?s="up":i.downArrow?s="down":i.leftArrow?s="left":i.rightArrow?s="right":l.toLowerCase()==="b"?s="b":l.toLowerCase()==="a"&&(s="a"),!s){o.current=[];return}o.current.push(s),o.current.length>wo.length&&(o.current=o.current.slice(-wo.length)),o.current.length===wo.length&&o.current.every((c,m)=>c===wo[m])&&(t(!0),o.current=[])});let n=la(()=>{t(!1),o.current=[]},[]);return{activated:e,reset:n}}function aa(){return{width:process.stdout.columns||80,height:process.stdout.rows||24}}function Fn(){let{width:e,height:t}=aa();return e>=80&&t>=24}import{Fragment as fa,jsx as O,jsxs as ee}from"react/jsx-runtime";var ua=5,ma=24,pa=.35,Io=({onInstall:e,onExit:t,overrideSkills:o,readOnly:n=!1})=>{let{skills:l,loading:i,error:s}=je(),{stdout:c}=da(),m=o||l,d=o?!1:i,{installedSkills:u}=Ae(),{query:p,setQuery:x,filtered:g}=Mn(m,{keys:["name","description","category"]}),[f,k]=_e(new Set),[S,w]=_e("list"),[y,I]=_e(0),[W,R]=_e(!1),[ne,ye]=_e(!1),[le,Ue]=_e(null),[ke,P]=_e(!1),j=Fn(),M=n?[{key:"/",description:"Filter skills"},{key:"\u2190/\u2192",description:"Collapse / expand"},{key:"tab/\u2192",description:"Skill details"},{key:"f",description:"Expand / compact panel"},{key:"esc",description:"Exit / close panel"}]:[{key:"/",description:"Filter skills"},{key:"space",description:"Toggle / expand"},{key:"enter",description:"Install selected"},{key:"ctrl+a",description:"Select all"},{key:"\u2190/\u2192",description:"Collapse / expand"},{key:"tab/\u2192",description:"Skill details"},{key:"f",description:"Expand / compact panel"},{key:"esc",description:"Back / close panel"}],ce=c?.rows??40,de=c?.columns??120,be=Math.max(ua,ce-ma),ol=Math.max(30,Math.round(de*pa)),rl=Math.max(10,ce-17),kr=ur(()=>ao(g),[g]),[Ge,Eo]=_e(0),[br,Kt]=_e(null),Sr=p.trim().length>0;ur(()=>{p&&R(!0)},[p]);let At=v=>Sr?!0:br===v,Po=v=>{At(v)?Kt(null):Kt(v)},ie=ur(()=>{let v=[];for(let[_,b]of kr.entries()){let te=b.filter(Et=>{let Pt=u[Et.name];return Pt&&Pt.length>0}).length;v.push({type:"header",category:_.name,categoryId:_.id,count:b.length,installedCount:te}),At(_.name)&&b.forEach(Et=>{v.push({type:"skill",skill:Et})})}return v},[kr,br,Sr,u]);ca((v,_)=>{if(v==="?"){ye(b=>!b);return}if(ne){ye(!1);return}if(_.escape){W?(R(!1),x(""),w("list")):t&&t();return}if(!W&&v==="/"){R(!0),w("search");return}if(v==="a"&&_.ctrl&&!n){let b=g.map(te=>te.name);f.size===b.length?k(new Set):k(new Set(b));return}if(S==="search"){(_.downArrow||_.return)&&ie.length>0&&(w("list"),I(0));return}if(S==="list")if(_.upArrow)if(y===0&&W)w("search");else{let b=Math.max(0,y-1);I(b),b<Ge&&Eo(b)}else if(_.downArrow){let b=Math.min(ie.length-1,y+1);I(b),b>=Ge+be&&Eo(b-be+1)}else if(v===" "){let b=ie[y];if(b.type==="skill"&&!n){let te=new Set(f);te.has(b.skill.name)?te.delete(b.skill.name):te.add(b.skill.name),k(te)}else b.type==="header"&&Po(b.category)}else if(_.return)if(n){let b=ie[y];b.type==="header"&&Po(b.category)}else{let b=m.filter(te=>f.has(te.name));if(b.length>0)e?.(b);else{let te=ie[y];te.type==="header"&&Po(te.category)}}else if(_.tab){let b=ie[y];b.type==="skill"&&j&&(Ue(b.skill),P(!1))}else if(_.rightArrow){let b=ie[y];b.type==="header"&&!At(b.category)?Kt(b.category):b.type==="skill"&&j&&(Ue(b.skill),P(!1))}else if(_.leftArrow){let b=ie[y];b.type==="header"&&At(b.category)&&Kt(null)}else v.length===1&&!_.ctrl&&!_.meta&&!_.upArrow&&!_.downArrow&&!_.leftArrow&&!_.rightArrow&&(R(!0),w("search"),x(v))},{isActive:!le});let nl=ie.slice(Ge,Ge+be);if(d)return ee(z,{flexDirection:"column",paddingX:1,children:[O(B,{}),O(z,{flexDirection:"column",alignItems:"center",justifyContent:"center",paddingY:4,children:O(ge,{color:r.accent,children:"Loading skills..."})})]});if(s||!d&&m.length===0)return ee(z,{flexDirection:"column",paddingX:1,minHeight:20,children:[O(B,{}),ee(z,{flexDirection:"column",alignItems:"center",justifyContent:"center",flexGrow:1,children:[ee(z,{flexDirection:"column",borderStyle:"round",borderColor:r.error,paddingX:3,paddingY:2,alignItems:"center",children:[ee(ge,{color:r.error,bold:!0,children:[a.cross," No Skills Available"]}),O(z,{marginTop:1,children:O(ge,{color:r.textDim,children:"Check your internet connection and try again"})}),s&&O(z,{marginTop:1,children:O(ge,{color:r.textMuted,dimColor:!0,children:s})})]}),O(z,{marginTop:2,children:ee(ge,{color:r.textDim,children:["Press ",O(ge,{color:r.accent,bold:!0,children:"Esc"})," to exit"]})})]})]});let ll=Ge>0,il=Ge+be<ie.length,sl=ie.length<=be?100:Math.round((Ge+be)/ie.length*100),al=!le||!ke,cl=ee(z,{flexDirection:"column",flexGrow:1,flexShrink:1,children:[W&&O(z,{marginBottom:1,children:O(Cn,{query:p,onChange:v=>{x(v),I(0),Eo(0)},total:m.length,filtered:g.length,isLoading:d,focus:S==="search"})}),ee(z,{flexDirection:"column",flexGrow:1,children:[ll&&O(z,{justifyContent:"center",marginBottom:1,children:ee(ge,{color:r.textDim,children:[a.arrowUp," ",a.arrowUp," ",a.arrowUp]})}),nl.map((v,_)=>{let b=Ge+_,te=S==="list"&&b===y;if(v.type==="header")return O(z,{marginTop:_===0?0:1,children:O(Sn,{name:v.category,categoryId:v.categoryId,totalCount:v.count,installedCount:v.installedCount,isExpanded:At(v.category),isFocused:te})},`cat-${v.category}`);if(v.type==="skill"){let Et=f.has(v.skill.name),Pt=u[v.skill.name],dl=Pt&&Pt.length>0?"installed":null;return O(Dn,{name:v.skill.name,description:v.skill.description,status:dl,selected:Et,focused:te,readOnly:n},v.skill.name)}return null}),il&&O(z,{justifyContent:"center",marginTop:1,children:ee(ge,{color:r.textDim,children:[a.arrowDown," ",a.arrowDown," ",a.arrowDown]})}),ie.length===0&&O(z,{paddingY:1,children:ee(ge,{color:r.textMuted,children:['No skills match "',p,'"']})})]})]},"skill-list");return ee(z,{flexDirection:"column",paddingX:1,minHeight:20,children:[O(B,{}),ne?O(z,{flexDirection:"column",flexGrow:1,alignItems:"center",justifyContent:"center",children:O(Qt,{visible:ne,onDismiss:()=>ye(!1),shortcuts:M})}):ee(z,{flexDirection:"row",height:le?rl:void 0,flexGrow:le?0:1,overflow:"hidden",children:[al&&cl,le&&O(z,{flexDirection:"column",width:ke?void 0:ol,flexGrow:ke?1:0,flexShrink:0,children:O(dr,{skill:le,expanded:ke,onClose:()=>{Ue(null),P(!1)},onToggleExpand:()=>P(v=>!v)})},"detail-panel")]}),O(ve,{hints:le?[{key:"\u2191/\u2193",label:"scroll"},{key:"f",label:ke?"compact":"expand"},{key:"Esc",label:"close",color:r.warning}]:n?[{key:"/",label:"filter"},{key:"tab",label:"detail"},{key:"esc",label:"exit",color:r.warning},{key:"?",label:"help"}]:[{key:"space",label:"toggle"},{key:"enter",label:"install",color:r.success},{key:"/",label:"filter"},{key:"tab",label:"detail"},{key:"esc",label:"exit",color:r.warning},{key:"?",label:"help"}],status:le?void 0:ee(fa,{children:[!n&&f.size>0&&ee(ge,{children:[ee(ge,{color:r.success,bold:!0,children:[a.checkboxActive," ",f.size]}),O(ge,{color:r.textDim,children:" selected"})]}),ie.length>be&&ee(ge,{color:r.textDim,children:[!n&&f.size>0?` ${a.dot} `:"",sl,"%"]})]})})]})};import{jsx as U,jsxs as Y}from"react/jsx-runtime";function $n({onExit:e}){let{step:t,next:o,back:n}=an(5),[l,i]=it([]),[s,c]=it("install"),[m,d]=it(!1),[u,p]=it([]),[x,g]=it({method:"copy",global:!1}),{installedSkills:f}=Ae(),{skills:k}=je(),{install:S,progress:w,results:y,installing:I}=so(),[W,R]=it(!1),[ne,ye]=it(!1),le=M=>{M.length!==0&&(i(M),o())},Ue=M=>{c(M),o()},ke=M=>{M.length!==0&&(p(M),o())},P=M=>{g(M),o()},j=ya(()=>{if(s==="install")return;let M=new Set;return Object.entries(f).forEach(([ce,de])=>{de.some(be=>l.includes(be))&&M.add(ce)}),k.filter(ce=>M.has(ce.name))},[s,f,k,l]);if(ha(()=>{(async()=>t===5&&!W&&!ne&&(R(!0),await S(u,{agents:l,skills:u.map(ce=>ce.name),method:x.method,global:x.global}),ye(!0)))()},[t,W,ne,S,u,l]),t===5){if(ne){let M=y.filter(de=>de.success).length,ce=y.filter(de=>!de.success).length;return Y(ae,{flexDirection:"column",paddingX:1,children:[U(B,{}),Y(ae,{flexDirection:"column",borderStyle:"round",borderColor:r.success,paddingX:2,paddingY:1,children:[U(ae,{marginBottom:1,children:Y(q,{color:r.success,bold:!0,children:[a.check," Installation Complete"]})}),y.map((de,be)=>Y(ae,{paddingX:1,children:[U(ae,{width:2,children:U(q,{color:de.success?r.success:r.error,children:de.success?a.check:a.cross})}),U(q,{color:de.success?r.text:r.error,children:de.skill}),Y(q,{color:r.textDim,children:[" ",a.arrow," ",de.agent]})]},be)),(M>0||ce>0)&&U(ae,{marginTop:1,children:Y(q,{color:r.textDim,children:[M>0&&Y(q,{color:r.success,children:[M," succeeded"]}),M>0&&ce>0&&Y(q,{children:[" ",a.dot," "]}),ce>0&&Y(q,{color:r.error,children:[ce," failed"]})]})})]}),U(ae,{marginTop:1,borderStyle:"round",borderColor:r.border,paddingX:1,children:Y(q,{children:[U(q,{color:r.warning,bold:!0,children:"ctrl+c"}),U(q,{color:r.textDim,children:" exit"})]})})]})}return Y(ae,{flexDirection:"column",paddingX:1,children:[U(B,{}),Y(ae,{marginTop:1,children:[Y(q,{color:r.accent,children:[U(xa,{type:"dots"})," "]}),Y(q,{children:["Installing ",u.length," skills to ",l.length," agents..."]})]}),I&&U(ae,{marginTop:1,paddingX:2,children:Y(q,{color:r.textDim,children:[a.arrow," ",w.skill," (",w.current,"/",w.total,")"]})})]})}return m?U(jt,{onExit:()=>d(!1)}):Y(ae,{flexDirection:"column",children:[t===1&&U(Fr,{onSelect:le,onBack:e}),t===2&&U(Ar,{onSelect:Ue,onBack:n,onCredits:()=>d(!0)}),t===3&&(s==="install"||j&&j.length>0)&&U(Io,{onInstall:ke,onExit:n,overrideSkills:j}),t===3&&s==="update"&&j&&j.length===0&&U(ka,{onBack:n}),t===4&&U($r,{onConfirm:P,onBack:n,initialMethod:"copy",initialGlobal:!1})]})}function ka({onBack:e}){return ga((t,o)=>{(o.escape||t==="b"||o.backspace)&&e()}),Y(ae,{flexDirection:"column",paddingX:1,children:[U(B,{}),U(ae,{borderColor:r.success,borderStyle:"round",paddingX:2,paddingY:1,children:Y(q,{color:r.success,bold:!0,children:[a.check," All skills are up to date on selected agents"]})}),U(ae,{marginTop:1,borderStyle:"round",borderColor:r.border,paddingX:1,children:Y(q,{children:[U(q,{color:r.warning,bold:!0,children:"esc"}),U(q,{color:r.textDim,children:" back"})]})})]})}import{Box as Nn,Text as mr}from"ink";import{useMemo as ba}from"react";import{jsx as vt,jsxs as _n}from"react/jsx-runtime";function Un({onExit:e}){let{installedSkills:t,loading:o}=Ae(),{skills:n,loading:l}=je(),i=ba(()=>{if(o||l)return[];let s=new Set(Object.keys(t));return n.filter(c=>s.has(c.name))},[t,n,o,l]);return o||l?_n(Nn,{flexDirection:"column",padding:1,children:[vt(B,{}),vt(mr,{children:"Loading..."})]}):i.length===0?_n(Nn,{flexDirection:"column",padding:1,children:[vt(B,{}),vt(mr,{color:r.warning,children:"No skills installed."}),vt(mr,{color:r.textDim,children:"(Press any key to exit)"})]}):vt(Io,{onExit:e,readOnly:!0,overrideSkills:i})}import{Box as G,Text as F,useInput as Sa}from"ink";import Gn from"ink-spinner";import{useState as Hn}from"react";import{jsx as D,jsxs as N}from"react/jsx-runtime";function Xn({onExit:e}){let{installedSkills:t,loading:o}=Ae(),{removeMultiple:n,progress:l,results:i}=Ln(),[s,c]=Hn("select"),[m,d]=Hn([]);if(Sa((g,f)=>{s==="done"&&(f.return||f.escape)&&e()}),o)return N(G,{flexDirection:"column",paddingX:1,children:[D(B,{}),D(G,{marginTop:1,children:N(F,{color:r.accent,children:[D(Gn,{type:"dots"})," Loading installed skills..."]})})]});let u=Object.keys(t);if(u.length===0)return N(G,{flexDirection:"column",paddingX:1,children:[D(B,{}),D(G,{borderStyle:"round",borderColor:r.warning,paddingX:2,paddingY:1,children:D(F,{color:r.warning,children:"No skills found to remove."})}),D(G,{marginTop:1,borderStyle:"round",borderColor:r.border,paddingX:1,children:N(F,{children:[D(F,{color:r.warning,bold:!0,children:"esc"}),D(F,{color:r.textDim,children:" exit"})]})})]});let p=g=>{g.length!==0&&(d(g),c("confirm"))},x=async()=>{c("removing");let g=m.map(f=>({name:f,agents:t[f]||[]}));await n(g),c("done")};if(s==="select"){let g=u.map(f=>({label:f,value:f,hint:`${t[f].length} agents: ${t[f].join(", ")}`}));return N(G,{flexDirection:"column",paddingX:1,children:[D(B,{}),D(G,{marginBottom:1,children:N(F,{bold:!0,color:r.error,children:[a.diamond," Select skills to remove:"]})}),D(gt,{items:g,onSubmit:p,onCancel:e})]})}if(s==="confirm")return N(G,{flexDirection:"column",paddingX:1,children:[D(B,{}),N(G,{flexDirection:"column",borderStyle:"round",borderColor:r.error,paddingX:2,paddingY:1,children:[D(G,{marginBottom:1,children:N(F,{color:r.error,bold:!0,children:[a.cross," Remove ",m.length," skill",m.length>1?"s":"","?"]})}),m.map(g=>N(G,{paddingX:1,children:[D(G,{width:2,children:D(F,{color:r.error,children:a.dot})}),D(F,{color:r.textDim,children:g})]},g))]}),D(G,{marginTop:1,children:D(Fe,{items:[{label:"Yes, remove them",value:"yes"},{label:"No, cancel",value:"no"}],onSelect:g=>{g==="yes"?x():c("select")}})})]});if(s==="removing")return N(G,{flexDirection:"column",paddingX:1,children:[D(B,{}),N(G,{marginTop:1,children:[N(F,{color:r.accent,children:[D(Gn,{type:"dots"})," "]}),D(F,{children:"Removing skills..."})]}),D(G,{marginTop:1,paddingX:2,children:N(F,{color:r.textDim,children:[a.arrow," ",l.skill," (",l.current,"/",l.total,")"]})})]});if(s==="done"){let g=i.filter(k=>k.success).length,f=i.filter(k=>!k.success).length;return N(G,{flexDirection:"column",paddingX:1,children:[D(B,{}),N(G,{flexDirection:"column",borderStyle:"round",borderColor:r.success,paddingX:2,paddingY:1,children:[D(G,{marginBottom:1,children:N(F,{color:r.success,bold:!0,children:[a.check," Removal Complete"]})}),i.map((k,S)=>N(G,{paddingX:1,children:[D(G,{width:2,children:D(F,{color:k.success?r.success:r.error,children:k.success?a.check:a.cross})}),D(F,{color:k.success?r.text:r.error,children:k.success?"Removed":k.error}),N(F,{color:r.textDim,children:[" ",a.arrow," ",k.agent]})]},S)),(g>0||f>0)&&D(G,{marginTop:1,children:N(F,{color:r.textDim,children:[g>0&&N(F,{color:r.success,children:[g," succeeded"]}),g>0&&f>0&&N(F,{children:[" ",a.dot," "]}),f>0&&N(F,{color:r.error,children:[f," failed"]})]})})]}),D(G,{marginTop:1,borderStyle:"round",borderColor:r.border,paddingX:1,children:N(F,{children:[D(F,{color:r.success,bold:!0,children:"enter"}),D(F,{color:r.textDim,children:" / "}),D(F,{color:r.warning,bold:!0,children:"esc"}),D(F,{color:r.textDim,children:" exit"})]})})]})}return null}import{Box as J,Text as H,useInput as Ta}from"ink";import jn from"ink-spinner";import{useMemo as Ca,useState as wa}from"react";import{jsx as E,jsxs as X}from"react/jsx-runtime";function Vn({onExit:e}){let{installedSkills:t,loading:o}=Ae(),{skills:n,loading:l}=je(),{install:i,progress:s,results:c,installing:m}=so(),[d,u]=wa(!1),p=Ca(()=>{if(o||l)return[];let g=new Set(Object.keys(t));return n.filter(f=>g.has(f.name))},[t,n,o,l]),x=async g=>{if(g.length===0)return;let f=new Set;g.forEach(k=>{(t[k.name]||[]).forEach(w=>f.add(w))}),await i(g,{agents:Array.from(f),method:"copy",global:!1,skills:g.map(k=>k.name),isUpdate:!0}),u(!0)};return d?E(Da,{results:c,onExit:e}):m?X(J,{flexDirection:"column",paddingX:1,children:[E(B,{}),X(J,{marginTop:1,children:[X(H,{color:r.accent,children:[E(jn,{type:"dots"})," "]}),E(H,{children:"Updating skills..."})]}),E(J,{marginTop:1,paddingX:2,children:X(H,{color:r.textDim,children:[a.arrow," ",s.skill," (",s.current,"/",s.total,")"]})})]}):o||l?X(J,{flexDirection:"column",paddingX:1,children:[E(B,{}),E(J,{marginTop:1,children:X(H,{color:r.accent,children:[E(jn,{type:"dots"})," Loading..."]})})]}):p.length===0?X(J,{flexDirection:"column",paddingX:1,children:[E(B,{}),E(J,{borderStyle:"round",borderColor:r.warning,paddingX:2,paddingY:1,children:E(H,{color:r.warning,children:"No installed skills to update."})}),E(J,{marginTop:1,borderStyle:"round",borderColor:r.border,paddingX:1,children:X(H,{children:[E(H,{color:r.warning,bold:!0,children:"esc"}),E(H,{color:r.textDim,children:" exit"})]})})]}):E(Ia,{skills:p,installedSkills:t,onUpdate:x,onExit:e})}function Ia({skills:e,installedSkills:t,onUpdate:o,onExit:n}){let l=e.map(c=>{let m=t[c.name]||[];return{label:c.name,value:c.name,hint:`${m.length} agent${m.length>1?"s":""}: ${m.join(", ")}`}}),i=e.map(c=>c.name),s=c=>{let m=e.filter(d=>c.includes(d.name));o(m)};return X(J,{flexDirection:"column",paddingX:1,children:[E(B,{}),E(J,{marginBottom:1,children:X(H,{bold:!0,color:r.primary,children:[a.diamond," Select skills to update:"]})}),E(J,{marginBottom:1,children:X(H,{color:r.textDim,children:[e.length," installed skill",e.length>1?"s":""," found ",a.dot," all pre-selected"]})}),E(gt,{items:l,initialSelected:i,onSubmit:s,onCancel:n})]})}function Da({results:e,onExit:t}){Ta((l,i)=>{(i.return||i.escape)&&t()});let o=e.filter(l=>l.success).length,n=e.filter(l=>!l.success).length;return X(J,{flexDirection:"column",paddingX:1,children:[E(B,{}),X(J,{flexDirection:"column",borderStyle:"round",borderColor:r.success,paddingX:2,paddingY:1,children:[E(J,{marginBottom:1,children:X(H,{color:r.success,bold:!0,children:[a.check," Update Complete"]})}),e.map((l,i)=>X(J,{paddingX:1,children:[E(J,{width:2,children:E(H,{color:l.success?r.success:r.error,children:l.success?a.check:a.cross})}),E(H,{color:l.success?r.text:r.error,children:l.skill}),X(H,{color:r.textDim,children:[" ",a.arrow," ",l.agent]})]},i)),(o>0||n>0)&&E(J,{marginTop:1,children:X(H,{color:r.textDim,children:[o>0&&X(H,{color:r.success,children:[o," succeeded"]}),o>0&&n>0&&X(H,{children:[" ",a.dot," "]}),n>0&&X(H,{color:r.error,children:[n," failed"]})]})})]}),E(J,{marginTop:1,borderStyle:"round",borderColor:r.border,paddingX:1,children:X(H,{children:[E(H,{color:r.success,bold:!0,children:"enter"}),E(H,{color:r.textDim,children:" / "}),E(H,{color:r.warning,bold:!0,children:"esc"}),E(H,{color:r.textDim,children:" exit"})]})})]})}import{Box as at,Text as Ao}from"ink";import $a from"ink-big-text";import fr from"ink-gradient";import{useEffect as Na,useState as Kn}from"react";import{Box as Do,Text as Bt,useInput as va,useStdout as Ba}from"ink";import{useCallback as Aa,useEffect as Ea,useRef as Pa,useState as Ra}from"react";import{jsx as Bo,jsxs as st}from"react/jsx-runtime";var vo=[["vibes","no_types","yolo","ship_it","LGTM"],["GPT_paste","0_tests","works4me","skip_QA","trust_AI"],["no_docs","no_review","rm -rf","TODO","prompt_go"]],Ma=100,La=8,Oa=40;function Fa(e){let t=[],o=Math.floor((e-vo[0].length*8)/2);for(let n=0;n<vo.length;n++)for(let l=0;l<vo[n].length;l++)t.push({x:Math.max(1,o+l*8),y:2+n*2,label:vo[n][l],alive:!0});return t}function pr({onExit:e}){let{stdout:t}=Ba(),o=Math.min(t?.columns??60,60),n=20,[l,i]=Ra(()=>({player:{x:Math.floor(o/2),y:n-1},bullets:[],invaders:Fa(o),score:0,lives:3,gameOver:!1,won:!1,invaderDirection:1,tickCount:0,flash:null})),s=Pa(l);s.current=l,va((d,u)=>{if(l.gameOver||l.won){(u.return||u.escape)&&e();return}if(u.escape){e();return}i(p=>u.leftArrow?{...p,player:{...p.player,x:Math.max(1,p.player.x-2)}}:u.rightArrow?{...p,player:{...p.player,x:Math.min(o-2,p.player.x+2)}}:d===" "&&p.bullets.length<3?{...p,bullets:[...p.bullets,{x:p.player.x,y:p.player.y-1}]}:p)});let c=Aa(()=>{i(d=>{if(d.gameOver||d.won)return d;let u=d.tickCount+1,p=d.bullets.map(y=>({...y,y:y.y-1})).filter(y=>y.y>=0),x=[...d.invaders],g=d.score,f=d.lives,k=null;for(let y of p)for(let I of x)I.alive&&Math.abs(y.x-I.x)<I.label.length&&y.y===I.y&&(I.alive=!1,y.y=-1,g+=10,k={x:I.x,y:I.y});p=p.filter(y=>y.y>=0);let S=d.invaderDirection;if(u%La===0){let y=x.filter(R=>R.alive),I=Math.min(...y.map(R=>R.x));Math.max(...y.map(R=>R.x+R.label.length))>=o-1&&S===1&&(S=-1),I<=1&&S===-1&&(S=1),x=x.map(R=>R.alive?{...R,x:R.x+S*2}:R)}return u%Oa===0&&(x=x.map(I=>I.alive?{...I,y:I.y+1}:I),x.some(I=>I.alive&&I.y>=n-1))?{...d,gameOver:!0,invaders:x,score:g,tickCount:u,flash:k}:x.every(y=>!y.alive)?{...d,won:!0,bullets:p,invaders:x,score:g,tickCount:u,flash:k}:{...d,bullets:p,invaders:x,score:g,lives:f,invaderDirection:S,tickCount:u,flash:k}})},[o,n]);Ea(()=>{let d=setInterval(c,Ma);return()=>clearInterval(d)},[c]);let m=()=>{let d=Array.from({length:n},()=>Array(o).fill(" "));for(let u of l.invaders)if(u.alive)for(let p=0;p<u.label.length;p++){let x=u.x+p;x>=0&&x<o&&u.y>=0&&u.y<n&&(d[u.y][x]=u.label[p])}for(let u of l.bullets)u.y>=0&&u.y<n&&u.x>=0&&u.x<o&&(d[u.y][u.x]="|");return l.player.y<n&&l.player.x<o&&(d[l.player.y][l.player.x]="\u25B2"),d.map(u=>u.join("")).join(`
8
+ `)};return st(Do,{flexDirection:"column",alignItems:"center",children:[st(Do,{justifyContent:"space-between",width:o,paddingX:1,children:[st(Bt,{color:r.accent,bold:!0,children:["SCORE: ",l.score]}),Bo(Bt,{color:r.warning,bold:!0,children:"VIBE INVADERS"}),st(Bt,{color:r.error,bold:!0,children:["LIVES: ","\u2665".repeat(l.lives)]})]}),Bo(Do,{borderStyle:"round",borderColor:r.border,width:o+2,flexDirection:"column",children:Bo(Bt,{color:l.flash?r.warning:r.success,children:m()})}),st(Do,{marginTop:1,children:[l.gameOver&&st(Bt,{color:r.error,bold:!0,children:["VIBE CHECK FAILED! The codebase is chaos. Score: ",l.score," \u2014 Press enter or esc"]}),l.won&&st(Bt,{color:r.success,bold:!0,children:["VIBES PURGED! Clean code restored! Score: ",l.score," \u2014 Press enter or esc"]}),!l.gameOver&&!l.won&&Bo(ve,{hints:[{key:"\u2190 \u2192",label:"move"},{key:"space",label:"shoot"},{key:"esc",label:"quit",color:r.warning}]})]})]})}import{jsx as re,jsxs as gr}from"react/jsx-runtime";var _a=[{label:"Vibe Invaders",value:"invaders",hint:"Fight vibe-coding!"},{label:"Back",value:"back",hint:"Return to CLI"}],zn="\u2591".repeat(56);function xr({onExit:e}){let[t,o]=Kn("menu"),[n,l]=Kn(!0);Na(()=>{let s=setInterval(()=>l(c=>!c),600);return()=>clearInterval(s)},[]);let i=s=>{if(s==="back"){e();return}o(s)};return t==="invaders"?re(pr,{onExit:()=>o("menu")}):gr(at,{flexDirection:"column",alignItems:"center",children:[re(at,{marginBottom:0,children:re(fr,{name:"cristal",children:re(Ao,{children:zn})})}),re(at,{marginBottom:0,children:re(fr,{name:"pastel",children:re($a,{text:"ARCADE",font:"chrome"})})}),re(at,{marginBottom:0,children:re(fr,{name:"cristal",children:re(Ao,{children:zn})})}),re(at,{marginBottom:1,marginTop:1,children:gr(Ao,{color:n?r.warning:r.bg,bold:!0,children:[a.sparkle," SECRET UNLOCKED ",a.sparkle]})}),re(at,{marginBottom:1,children:gr(Ao,{color:r.textDim,children:[a.diamond," Choose your adventure ",a.diamond]})}),re(at,{width:50,children:re(Fe,{items:_a,onSelect:i,onCancel:e,hideFooter:!0})}),re(ve,{hints:[{key:"\u2191\u2193",label:"navigate"},{key:"\u23CE",label:"select"},{key:"esc",label:"back",color:r.warning}]})]})}import{jsx as Ke,jsxs as Xa}from"react/jsx-runtime";var ze=({command:e="install"})=>{let{exit:t}=Ua(),[o,n]=Ha(e==="arcade"),{activated:l,reset:i}=On();return Ga(()=>{l&&!o&&(n(!0),i())},[l,o,i]),e==="credits"?Ke(hr,{flexDirection:"column",padding:1,children:Ke(jt,{onExit:t})}):o?Ke(hr,{flexDirection:"column",padding:1,children:Ke(xr,{onExit:()=>{e==="arcade"?t():n(!1)}})}):Xa(hr,{flexDirection:"column",padding:1,children:[e==="list"&&Ke(Un,{onExit:t}),e==="remove"&&Ke(Xn,{onExit:t}),e==="update"&&Ke(Vn,{onExit:t}),(e==="install"||!e)&&Ke($n,{onExit:t})]})};import{createRequire as Ja}from"node:module";var Qa=Ja(import.meta.url),Za=Qa("../package.json"),Re=new qa;Re.name("agent-skills").description("CLI to install and manage skills for AI coding agents").version(Za.version);function yr(e){return Object.keys(e).filter(o=>o!=="parent").length===0}Re.action(()=>{dt(ut.createElement(ze,{command:"install"}))});Re.command("install").description("Install skills (interactive by default)").option("-g, --global","Install globally to user home",!1).option("-s, --skill <name>","Install a specific skill").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(yr(e)){dt(ut.createElement(ze,{command:"install"}));return}let{runCliInstall:t}=await Promise.resolve().then(()=>(Wn(),Yn));await t(e)});Re.command("list").alias("ls").description("List available/installed agent skills").action(()=>{dt(ut.createElement(ze,{command:"list"}))});Re.command("remove").alias("rm").description("Remove installed skills").option("-g, --global","Remove from global installation",!1).option("-s, --skill <name>","Remove a specific skill").option("-a, --agent <agents...>","Target specific agents").action(async e=>{if(yr(e)){dt(ut.createElement(ze,{command:"remove"}));return}let{runCliRemove:t}=await Promise.resolve().then(()=>(Jn(),qn));await t(e)});Re.command("update").description("Update installed skills to the latest version").option("-s, --skill <name>","Update a specific skill").action(async e=>{if(yr(e)){dt(ut.createElement(ze,{command:"update"}));return}let{runCliUpdate:t}=await Promise.resolve().then(()=>(Zn(),Qn));await t(e)});Re.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(()=>(tl(),el));t(e)});Re.command("credits").description("Show project contributors and credits").action(()=>{dt(ut.createElement(ze,{command:"credits"}))});Re.command("arcade").action(()=>{dt(ut.createElement(ze,{command:"arcade"}))});Re.parse(process.argv);
22
9
  //# sourceMappingURL=index.js.map