@gustavobrunodev/ai-tools 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tech Leads Club
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ **Note on Dual Licensing:**
26
+ While the software source code in this repository is licensed under the MIT License as stated above, the content of the agent skills (the `SKILL.md` files) created by the repository maintainers is licensed under the Creative Commons Attribution 4.0 International License (CC-BY-4.0) unless otherwise specified in individual skill files. Please see the README.md for more details on attribution and licensing boundaries.
package/README.md ADDED
@@ -0,0 +1,257 @@
1
+ <p align="center">
2
+ <img src=".github/assets/logo.png" alt="gustavobrunodev" width="400" />
3
+ </p>
4
+
5
+ <p align="center">
6
+ <img src="https://img.shields.io/npm/v/@gustavobrunodev/ai-tools?style=flat-square&color=blue" alt="npm version" />
7
+ <img src="https://img.shields.io/npm/dt/@gustavobrunodev/ai-tools?style=flat-square&color=blue" alt="total downloads" />
8
+ <img src="https://img.shields.io/npm/dm/@gustavobrunodev/ai-tools?style=flat-square&color=blue" alt="monthly downloads" />
9
+ <img src="https://img.shields.io/github/license/gustavobrunodev/ai-tools?style=flat-square" alt="license" />
10
+ <img src="https://img.shields.io/github/actions/workflow/status/gustavobrunodev/ai-tools/release.yml?style=flat-square" alt="build status" />
11
+ </p>
12
+
13
+ <p align="center">
14
+ <img src="https://img.shields.io/badge/node-%3E%3D22-brightgreen?style=flat-square&logo=node.js" alt="node version" />
15
+ <img src="https://img.shields.io/badge/TypeScript-100%25-blue?style=flat-square&logo=typescript" alt="typescript" />
16
+ <img src="https://img.shields.io/badge/Nx%20Cloud-Enabled-blue?style=flat-square&logo=nx" alt="nx cloud" />
17
+ <img src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square" alt="semantic-release" />
18
+ </p>
19
+
20
+ <p align="center">
21
+ <img src="https://img.shields.io/github/stars/gustavobrunodev/ai-tools?style=flat-square&color=yellow" alt="github stars" />
22
+ <img src="https://img.shields.io/github/contributors/gustavobrunodev/ai-tools?style=flat-square&color=orange" alt="contributors" />
23
+ <img src="https://img.shields.io/github/last-commit/gustavobrunodev/ai-tools?style=flat-square" alt="last commit" />
24
+ <img src="https://img.shields.io/badge/AI-Powered%20Skills-purple?style=flat-square&logo=openai" alt="ai powered" />
25
+ </p>
26
+
27
+ <h1 align="center">🧠 AI Tools</h1>
28
+
29
+ <p align="center">
30
+ <strong>The secure, validated skill registry for professional AI coding agents</strong>
31
+ </p>
32
+
33
+ <p align="center">
34
+ In an ecosystem where <a href="https://github.com/snyk/agent-scan/blob/main/.github/reports/skills-report.pdf">over 13% of marketplace skills contain critical vulnerabilities</a>,
35
+ <b>Agent Skills</b> stands apart as a hardened library of <b>verified</b>, <b>tested</b>, and <b>safe</b> capabilities.
36
+ Extend <b>Antigravity</b>, <b>Claude Code</b>, <b>Cursor</b>, and more with absolute confidence.
37
+ </p>
38
+
39
+ <p align="center">
40
+ <a href="https://gustavobrunodev.github.io/ai-tools/" target="_blank">https://gustavobrunodev.github.io/ai-tools/</a>
41
+ </p>
42
+
43
+ ## 📖 Table of Contents
44
+
45
+ - [✨ What are Skills?](#-what-are-skills)
46
+ - [🛡️ Security & Trust](#️-security--trust)
47
+ - [🤖 Supported Agents](#-supported-agents)
48
+ - [🌟 Featured Skills](#-featured-skills)
49
+ - [🚀 Quick Start](#-quick-start)
50
+ - [⚡ How It Works](#-how-it-works)
51
+ - [🤝 Contributing](#-contributing)
52
+ - [🛡️ Content & Authorship](#️-content--authorship)
53
+ - [📄 License and Attribution](#-license-and-attribution)
54
+
55
+ ## ✨ What are Skills?
56
+
57
+ Skills are packaged instructions and resources that extend AI agent capabilities. Think of them as **plugins for your AI assistant** — they teach your agent new workflows, patterns, and specialized knowledge.
58
+
59
+ ```
60
+ packages/skills-catalog/skills/
61
+ (category-name)/
62
+ skill/
63
+ SKILL.md ← Main instructions
64
+ templates/ ← File templates
65
+ references/ ← On-demand documentation
66
+ ```
67
+
68
+ ## 🛡️ Security & Trust
69
+
70
+ Your environment's safety is our top priority. Unlike open marketplaces where **13.4% of skills contain critical issues**, `ai-tools` is a managed, hardened library: 100% open source (no binaries), static analysis in CI/CD, immutable integrity via lockfiles and content hashing, and human-curated prompts. The CLI uses defense-in-depth (sanitization, path isolation, symlink guards, atomic lockfile, audit trail); every skill is scanned with [mcp-scan](https://github.com/invariantlabs-ai/mcp-scan) before publishing.
71
+
72
+ → **Full threat model, implementation details, and vulnerability reporting:** [SECURITY.md](SECURITY.md)
73
+
74
+ ## 🤖 Supported Agents
75
+
76
+ Install skills to any of these AI coding agents:
77
+
78
+ <div align="center">
79
+ <br />
80
+
81
+ | Tier 1 (Popular) | Tier 2 (Rising) | Tier 3 (Enterprise) |
82
+ | :-------------------------------------------------------: | :--------------------------------------------------------------------: | :-----------------------------------------------------: |
83
+ | **[Claude Code](https://claude.ai/code)** | **[Aider](https://aider.chat)** | **[Amazon Q](https://aws.amazon.com/q/developer/)** |
84
+ | **[Cline](https://github.com/cline/cline)** | **[Antigravity](https://idx.google.com)** | **[Augment](https://www.augmentcode.com)** |
85
+ | **[Cursor](https://cursor.com)** | **[Gemini CLI](https://ai.google.dev/gemini-api/docs/code-execution)** | **[Droid (Factory.ai)](https://www.factory.ai)** |
86
+ | **[GitHub Copilot](https://github.com/features/copilot)** | **[Kilo Code](https://kilocode.ai)** | **[OpenCode](https://github.com/opencode-ai/opencode)** |
87
+ | **[Windsurf](https://codeium.com/windsurf)** | **[Kiro](https://kiro.dev/)** | **[Sourcegraph Cody](https://sourcegraph.com/cody)** |
88
+ | | **[OpenAI Codex](https://openai.com/index/introducing-codex/)** | **[Tabnine](https://www.tabnine.com)** |
89
+ | | **[Roo Code](https://roo.dev)** | |
90
+ | | **[TRAE](https://docs.trae.ai)** | |
91
+
92
+ </div>
93
+
94
+ <p align="center">
95
+ <sub>Missing your favorite agent? <a href="https://github.com/gustavobrunodev/ai-tools/issues/new"><strong>Open an issue</strong></a> and we'll add support!</sub>
96
+ </p>
97
+
98
+ ## 🌟 Featured Skills
99
+
100
+ A glimpse of what's available in our growing catalog:
101
+
102
+ | Skill | Category | Description |
103
+ | -------------------------------------------------------------------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
104
+ | **[tlc-spec-driven](<packages/skills-catalog/skills/(development)/tlc-spec-driven>)** | Development | Project and feature planning with 4 phases: Specify → Design → Tasks → Implement. Creates atomic tasks with verification criteria and maintains persistent memory across sessions. |
105
+ | **[aws-advisor](<packages/skills-catalog/skills/(cloud)/aws-advisor>)** | Cloud | Expert AWS Cloud Advisor for architecture design, security review, and implementation guidance. Leverages AWS MCP tools for documentation-backed answers. |
106
+ | **[playwright-skill](<packages/skills-catalog/skills/(web-automation)/playwright-skill>)** | Automation | Complete browser automation with Playwright. Test pages, fill forms, take screenshots, validate UX, and automate any browser task. |
107
+ | **[figma](<packages/skills-catalog/skills/(design)/figma>)** | Design | Fetch design context from Figma and translate nodes into production code. Design-to-code implementation with MCP integration. |
108
+ | **[security-best-practices](<packages/skills-catalog/skills/(security)/security-best-practices>)** | Security | Language and framework-specific security reviews. Detect vulnerabilities, generate reports, and suggest secure-by-default fixes. |
109
+
110
+ <p align="center">
111
+ <a href="#-quick-start"><strong>→ Browse all skills</strong></a>
112
+ </p>
113
+
114
+ ## 🚀 Quick Start
115
+
116
+ ### Install Skills in Your Project
117
+
118
+ ```bash
119
+ npx @gustavobrunodev/ai-tools
120
+ ```
121
+
122
+ This launches an interactive wizard:
123
+
124
+ 1. **Choose Action** — "Install skills" or "Update installed skills"
125
+ 2. **Browse & Select** — Filter by category or search
126
+ 3. **Choose agents** — Pick target agents (Cursor, Claude Code, etc.)
127
+ 4. **Installation method** — Copy (recommended) or Symlink
128
+ 5. **Scope** — Global (user home) or Local (project only)
129
+
130
+ Each step shows a **← Back** option to return and revise your choices.
131
+
132
+ ### CLI Options
133
+
134
+ > **Note**: You can use either `npx @gustavobrunodev/ai-tools` or install globally and use `ai-tools` directly.
135
+
136
+ ```bash
137
+ # Interactive mode (default)
138
+ npx @gustavobrunodev/ai-tools
139
+ # or: ai-tools (if installed globally)
140
+
141
+ # List available skills
142
+ ai-tools skills list
143
+ ai-tools skills ls # Alias
144
+
145
+ # Install one skill
146
+ ai-tools skills install -s tlc-spec-driven
147
+
148
+ # Install multiple skills at once
149
+ ai-tools skills install -s aws-advisor coding-guidelines docs-writer
150
+
151
+ # Install to specific agents
152
+ ai-tools skills install -s my-skill -a cursor claude-code
153
+
154
+ # Install multiple skills to multiple agents
155
+ ai-tools skills install -s aws-advisor nx-workspace -a cursor windsurf cline
156
+
157
+ # Install globally (to ~/.gemini, ~/.claude, etc.)
158
+ ai-tools skills install -s my-skill -g
159
+
160
+ # Use symlink instead of copy
161
+ ai-tools skills install -s my-skill --symlink
162
+
163
+ # Force re-download (bypass cache)
164
+ ai-tools skills install -s my-skill --force
165
+
166
+ # Update a specific skill
167
+ ai-tools skills update -s my-skill
168
+
169
+ # Update all installed skills
170
+ ai-tools skills update
171
+
172
+ # Remove one skill
173
+ ai-tools skills remove -s my-skill
174
+
175
+ # Remove multiple skills at once
176
+ ai-tools skills remove -s skill1 skill2 skill3
177
+ ai-tools skills rm -s my-skill # Alias
178
+
179
+ # Remove from specific agents
180
+ ai-tools skills remove -s my-skill -a cursor windsurf
181
+
182
+ # Force removal (bypass lockfile check)
183
+ ai-tools skills remove -s my-skill --force
184
+
185
+ # Manage cache
186
+ ai-tools skills cache --clear # Clear all cache
187
+ ai-tools skills cache --clear-registry # Clear only registry
188
+ ai-tools skills cache --path # Show cache location
189
+
190
+ # View audit log
191
+ ai-tools skills audit # Show recent operations
192
+ ai-tools skills audit -n 20 # Show last 20 entries
193
+ ai-tools skills audit --path # Show audit log location
194
+
195
+ # Show contributors and credits
196
+ ai-tools skills credits
197
+
198
+ # Show help
199
+ ai-tools --help
200
+ ```
201
+
202
+ ### Global Installation (Optional)
203
+
204
+ ```bash
205
+ npm install -g @gustavobrunodev/ai-tools
206
+ ai-tools # Use 'ai-tools' instead of 'npx @gustavobrunodev/ai-tools'
207
+ ```
208
+
209
+ ## ⚡ How It Works
210
+
211
+ The CLI fetches skills **on-demand** from our CDN:
212
+
213
+ 1. **Browse** — The CLI fetches the skills catalog (~45KB)
214
+ 2. **Select** — You choose the skills you need
215
+ 3. **Download** — Selected skills are downloaded and cached locally
216
+ 4. **Install** — Skills are installed to your agent's configuration
217
+
218
+ ### Caching
219
+
220
+ Downloaded skills are cached in `~/.cache/ai-tools/` for offline use.
221
+
222
+ ```bash
223
+ # Clear the cache
224
+ rm -rf ~/.cache/ai-tools
225
+ ```
226
+
227
+ ## 🤝 Contributing
228
+
229
+ We welcome contributions! Please see our [CONTRIBUTING.md](CONTRIBUTING.md) file for detailed guidelines on how to set up your local environment, create new skills, contribute to the marketplace, and follow our release processes.
230
+
231
+ ## 🛡️ Content & Authorship
232
+
233
+ This repository is a collection of curated skills intended to benefit the community. We deeply respect the intellectual property and wishes of all creators.
234
+
235
+ If you are the author of any content included here and would like it **removed** or **updated**, please [open an issue](https://github.com/gustavobrunodev/ai-tools/issues/new) or contact the maintainers.
236
+
237
+ ## 📄 License and Attribution
238
+
239
+ - **Software Engine:** The application source code (CLI, scripts, tools) is licensed under the **[MIT License](LICENSE)**.
240
+ - **gustavobrunodev Skills:** Unless otherwise stated, all skill files (`SKILL.md`) authored by the repository maintainers are licensed under the **[Creative Commons Attribution 4.0 International License (CC-BY-4.0)](https://creativecommons.org/licenses/by/4.0/)**.
241
+ - **Third-Party Skills:** Some skills included in this catalog are created by the community or original authors. These skills retain their original licenses and copyrights. Please check the individual `SKILL.md` files for specific licensing and author attribution.
242
+
243
+ _If you use our skills catalog, you **must** provide attribution to gustavobrunodev, regardless of how it is used._
244
+
245
+ ## ⭐ Star History
246
+
247
+ <p align="center">
248
+ <a href="https://star-history.com/#gustavobrunodev/ai-tools&Date">
249
+ <img src="https://api.star-history.com/svg?repos=gustavobrunodev/ai-tools&type=Date" alt="Star History Chart" />
250
+ </a>
251
+ </p>
252
+
253
+ ---
254
+
255
+ <p align="center">
256
+ <sub>Built with ❤️ by the gustavobrunodev community</sub>
257
+ </p>
Binary file
package/index.js ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ var Js=Object.defineProperty;var q=(e,t)=>()=>(e&&(t=e(e=0)),t);var Bt=(e,t)=>{for(var o in t)Js(e,o,{get:t[o],enumerable:!0})};import{existsSync as yn}from"node:fs";import{dirname as Qs,join as kn,parse as Zs,resolve as el}from"node:path";function Oe(e=process.cwd()){let t=el(e),o=Zs(t).root;for(;t!==o;){if((yn(kn(t,"package.json"))||yn(kn(t,".git")))&&!t.endsWith("packages/cli"))return t;t=Qs(t)}return e}var bo=q(()=>{"use strict"});import{existsSync as E,readdirSync as tl}from"node:fs";import{homedir as ol}from"node:os";import{join as b}from"node:path";function So(){return Object.entries(no).filter(([,e])=>e.detectInstalled()).map(([e])=>e)}function Ne(e){return no[e]}function Sn(){return Object.keys(no).sort((e,t)=>no[e].displayName.localeCompare(no[t].displayName))}var D,Y,no,bn,io=q(()=>{"use strict";bo();D=ol(),Y=Oe(),no={cursor:{name:"cursor",displayName:"Cursor",description:"AI-first code editor built on VS Code",skillsDir:".cursor/skills",globalSkillsDir:b(D,".cursor/skills"),detectInstalled:()=>E(b(D,".cursor"))||E(b(Y,".cursor"))},"claude-code":{name:"claude-code",displayName:"Claude Code",description:"Anthropic's agentic coding tool",skillsDir:".claude/skills",globalSkillsDir:b(D,".claude/skills"),detectInstalled:()=>E(b(D,".claude"))||E(b(Y,".claude"))},"github-copilot":{name:"github-copilot",displayName:"GitHub Copilot",description:"AI pair programmer by GitHub/Microsoft",skillsDir:".github/skills",globalSkillsDir:b(D,".copilot/skills"),detectInstalled:()=>E(b(D,".copilot"))||E(b(Y,".github"))},windsurf:{name:"windsurf",displayName:"Windsurf",description:"AI IDE with Cascade flow (Codeium)",skillsDir:".windsurf/skills",globalSkillsDir:b(D,".codeium/windsurf/skills"),detectInstalled:()=>E(b(D,".codeium/windsurf"))||E(b(Y,".windsurf"))},cline:{name:"cline",displayName:"Cline",description:"Autonomous AI coding agent for VS Code",skillsDir:".cline/skills",globalSkillsDir:b(D,".cline/skills"),detectInstalled:()=>E(b(D,".cline"))||E(b(Y,".cline"))||bn("saoudrizwan","claude-dev")},aider:{name:"aider",displayName:"Aider",description:"AI pair programming in terminal",skillsDir:".aider/skills",globalSkillsDir:b(D,".aider/skills"),detectInstalled:()=>E(b(D,".aider"))||E(b(Y,".aider"))},codex:{name:"codex",displayName:"OpenAI Codex",description:"OpenAI's coding agent",skillsDir:".codex/skills",globalSkillsDir:b(D,".codex/skills"),detectInstalled:()=>E(b(D,".codex"))||E(b(Y,".codex"))},gemini:{name:"gemini",displayName:"Gemini CLI",description:"Google's AI coding assistant",skillsDir:".gemini/skills",globalSkillsDir:b(D,".gemini/skills"),detectInstalled:()=>E(b(D,".gemini"))||E(b(Y,".gemini"))},antigravity:{name:"antigravity",displayName:"Antigravity",description:"Google's agentic coding (VS Code)",skillsDir:".agent/skills",globalSkillsDir:b(D,".gemini/antigravity/skills"),detectInstalled:()=>E(b(D,".gemini/antigravity"))||E(b(Y,".agent"))},roo:{name:"roo",displayName:"Roo Code",description:"AI coding assistant for VS Code",skillsDir:".roo/skills",globalSkillsDir:b(D,".roo/skills"),detectInstalled:()=>E(b(D,".roo"))||E(b(Y,".roo"))||bn("RooVetGit","roo-cline")},kilocode:{name:"kilocode",displayName:"Kilo Code",description:"AI coding agent with auto-launch",skillsDir:".kilocode/skills",globalSkillsDir:b(D,".kilocode/skills"),detectInstalled:()=>E(b(D,".kilocode"))||E(b(Y,".kilocode"))},trae:{name:"trae",displayName:"TRAE",description:"AI IDE with SOLO mode and custom agents",skillsDir:".trae/skills",globalSkillsDir:b(D,".trae/skills"),detectInstalled:()=>E(b(D,".trae"))||E(b(Y,".trae"))},kiro:{name:"kiro",displayName:"Kiro",description:"AI Agent with workspace and global skill scopes",skillsDir:".kiro/skills",globalSkillsDir:b(D,".kiro/skills"),detectInstalled:()=>E(b(D,".kiro"))||E(b(Y,".kiro"))},"amazon-q":{name:"amazon-q",displayName:"Amazon Q",description:"AWS AI coding assistant",skillsDir:".amazonq/skills",globalSkillsDir:b(D,".amazonq/skills"),detectInstalled:()=>E(b(D,".amazonq"))||E(b(Y,".amazonq"))},augment:{name:"augment",displayName:"Augment",description:"AI code assistant with context engine",skillsDir:".augment/skills",globalSkillsDir:b(D,".augment/skills"),detectInstalled:()=>E(b(D,".augment"))||E(b(Y,".augment"))},tabnine:{name:"tabnine",displayName:"Tabnine",description:"AI code completions with privacy focus",skillsDir:".tabnine/skills",globalSkillsDir:b(D,".tabnine/skills"),detectInstalled:()=>E(b(D,".tabnine"))||E(b(Y,".tabnine"))},opencode:{name:"opencode",displayName:"OpenCode",description:"Open-source AI coding terminal",skillsDir:".opencode/skills",globalSkillsDir:b(D,".config/opencode/skills"),detectInstalled:()=>E(b(D,".config/opencode"))||E(b(Y,".opencode"))||E(b(Y,".config/opencode"))},sourcegraph:{name:"sourcegraph",displayName:"Sourcegraph Cody",description:"AI assistant with codebase context",skillsDir:".sourcegraph/skills",globalSkillsDir:b(D,".sourcegraph/skills"),detectInstalled:()=>E(b(D,".sourcegraph"))||E(b(Y,".sourcegraph"))},droid:{name:"droid",displayName:"Droid (Factory.ai)",description:"AI software engineer by Factory.ai",skillsDir:".factory/skills",globalSkillsDir:b(D,".factory/skills"),detectInstalled:()=>E(b(D,".factory"))||E(b(Y,".factory"))}};bn=(e,t)=>{let o=[b(D,".vscode/extensions"),b(D,".vscode-server/extensions"),b(D,".vscode-oss/extensions")];for(let r of o)if(E(r))try{if(tl(r).some(s=>s.startsWith(`${e}.${t}-`)))return!0}catch{}return!1}});var Lt,To,mr,wn,pr,ft,fr,gr,hr,xr,Cn,An,In,Dn,vn,Ye,ve=q(()=>{"use strict";Lt="@gustavobrunodev/ai-tools",To="@gustavobrunodev/skills-catalog",mr=".ai-tools",wn="cache.json",pr=".skill-meta.json",ft=".agents",fr="skills",gr=".skill-lock.json",hr=".skill-lock.json.backup",xr=".ai-tools",Cn="audit.log",An=".cache",In="ai-tools",Dn="skills",vn="registry.json",Ye={UPDATE_AVAILABLE:(e,t)=>`Update available: ${e} \u2192 ${t}`,TIP_INSTALL_UPDATE:"Tip: Install globally to update:",TIP_INSTALL_ACCESS:"Tip: Install globally for easier access:",UPDATE_COMMAND:`npm update -g ${Lt}`,INSTALL_COMMAND:`npm install -g ${Lt}`,DESCRIPTION:"Curated skills to power up your coding agents"}});import{appendFile as ll,mkdir as al,readFile as cl}from"node:fs/promises";import{homedir as yr}from"node:os";import{join as Bn}from"node:path";function wo(e=yr()){return Bn(e,xr,Cn)}async function kr(e,t=yr()){try{let o=wo(t),r=Bn(t,xr);await al(r,{recursive:!0});let i=JSON.stringify({...e,timestamp:new Date().toISOString()})+`
3
+ `;await ll(o,i,"utf-8")}catch{}}async function Ln(e,t=yr()){try{let o=wo(t),s=(await cl(o,"utf-8")).trim().split(`
4
+ `).filter(Boolean).map(l=>{try{return JSON.parse(l)}catch{return null}}).filter(l=>l!==null).reverse();return e?s.slice(0,e):s}catch{return[]}}var br=q(()=>{"use strict";ve()});import{execSync as dl}from"node:child_process";import{existsSync as ul}from"node:fs";import{join as ml}from"node:path";function pl(){try{return dl("npm root -g",{encoding:"utf-8"}).trim()}catch{return null}}function Sr(){let e=pl();if(!e)return!1;let t=ml(e,Lt);return ul(t)}var Tr=q(()=>{"use strict";ve()});var Pt,Rt,wr,Cr,Pn=q(()=>{"use strict";Pt="uncategorized",Rt=/^\(([a-z][a-z0-9-]*)\)$/,wr="_category.json",Cr={id:Pt,name:"Uncategorized",description:"Skills without a specific category",priority:999}});var Rn,Mn=q(()=>{"use strict";Rn=["cursor","claude-code","github-copilot","windsurf","cline","aider","codex","gemini","antigravity","roo","kilocode","amazon-q","augment","tabnine","opencode","sourcegraph","droid","trae","kiro"]});function so(e){return e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}var _n=q(()=>{"use strict"});var Co=q(()=>{"use strict";Pn();Mn();_n()});var Hn={};Bt(Hn,{addSkillToLock:()=>Ir,getAllLockedSkills:()=>wl,getSkillFromLock:()=>Do,readSkillLock:()=>lo,removeSkillFromLock:()=>Io,writeSkillLock:()=>Ar});import{mkdir as fl,readFile as Nn,rename as gl,unlink as hl,writeFile as On}from"node:fs/promises";import{homedir as Fn}from"node:os";import{dirname as xl,join as Ao}from"node:path";import{z as de}from"zod";function Un(e){if(e)return Ao(Fn(),ft,gr);let t=Oe();return Ao(t,ft,gr)}function Sl(e){if(e)return Ao(Fn(),ft,hr);let t=Oe();return Ao(t,ft,hr)}function Gn(){return{version:$n,skills:{}}}function Tl(e){try{let t=bl.parse(e);return t.version===1?{version:$n,skills:Object.fromEntries(Object.entries(t.skills).map(([o,r])=>[o,{...r,agents:r.agents||[],method:r.method||"copy",global:r.global??!1}]))}:t}catch{return Gn()}}async function lo(e=!1){let t=Un(e);try{let o=await Nn(t,"utf-8"),r=JSON.parse(o);return Tl(r)}catch{return Gn()}}async function Ar(e,t=!1){let o=Un(t),r=Sl(t),i=`${o}.tmp`;try{try{let s=await Nn(o,"utf-8");await On(r,s,"utf-8")}catch{}await fl(xl(o),{recursive:!0}),await On(i,JSON.stringify(e,null,2),"utf-8"),await gl(i,o)}catch(s){try{await hl(i)}catch{}throw s}}async function Ir(e,t,o={}){let r=await lo(o.global),i=new Date().toISOString(),s=r.skills[e];r.skills[e]={name:e,source:o.source||"local",contentHash:o.contentHash??s?.contentHash,installedAt:s?.installedAt??i,updatedAt:i,agents:t,method:o.method||"copy",global:o.global??!1,version:o.version},await Ar(r,o.global)}async function Io(e,t=!1){let o=await lo(t);return e in o.skills?(delete o.skills[e],await Ar(o,t),!0):!1}async function Do(e,t=!1){return(await lo(t)).skills[e]??null}async function wl(e=!1){return(await lo(e)).skills}var $n,yl,kl,bl,Dr=q(()=>{"use strict";Co();ve();bo();$n=2,yl=de.enum(Rn),kl=de.object({name:de.string(),source:de.string(),contentHash:de.string().optional(),installedAt:de.string(),updatedAt:de.string(),agents:de.array(yl).optional(),method:de.enum(["copy","symlink"]).optional(),global:de.boolean().optional(),version:de.string().optional()}),bl=de.object({version:de.number(),skills:de.record(de.string(),kl)})});import El from"ky";import{existsSync as gt,mkdirSync as Eo,readFileSync as Kn,rmSync as vr,writeFileSync as Er}from"node:fs";import{homedir as Bl}from"node:os";import{join as Ce}from"node:path";import Ll from"package-json";function Xn(){gt(we.cacheDir)||Eo(we.cacheDir,{recursive:!0}),gt(we.skillsCacheDir)||Eo(we.skillsCacheDir,{recursive:!0})}function Rl(e){return Date.now()-e<Mt.cacheTtlMs}function jn(){if(!gt(we.registryCacheFile))return null;try{let e=Kn(we.registryCacheFile,"utf-8");return JSON.parse(e)}catch{return null}}function Ml(e){let t={fetchedAt:Date.now(),registry:e};Er(we.registryCacheFile,JSON.stringify(t,null,2))}async function Yn(e,t){try{return await Vn.get(e)}catch(o){if(t)try{return await Vn.get(t)}catch{}throw o}}async function Wn(){if(process.env.SKILLS_CDN_REF)return process.env.SKILLS_CDN_REF;if(vo)return vo;try{return vo=(await Ll(To,{version:"latest"})).version,vo}catch{return"latest"}}function zn(e){let t=`https://cdn.jsdelivr.net/npm/${To}@${e}`,o=`https://unpkg.com/${To}@${e}`;return{registry:`${t}/skills-registry.json`,fallbackRegistry:`${o}/skills-registry.json`,skillsBase:`${t}/skills`,fallbackSkillsBase:`${o}/skills`}}async function ao(e=!1){Xn();let t=await Wn();if(!e){let o=jn(),r=o&&t!=="latest"&&o.registry.version!==t;if(o&&Rl(o.fetchedAt)&&!r)return o.registry}try{let o=zn(t),i=await(await Yn(o.registry,o.fallbackRegistry)).json();return Ml(i),i}catch(o){let r=jn();return r?r.registry:(console.error(`Failed to fetch registry: ${o instanceof Error?o.message:o}`),null)}}function _l(e){return Pl.reduce((t,o)=>t.replace(o,""),e).trim()}function Ol(e,t){let o=Ce(e,".");return Ce(t,".").startsWith(o)}function it(e){let t=_l(e);if(!t)throw new Error("Invalid skill name");return Ce(we.skillsCacheDir,t)}function Br(e){try{let t=it(e);return gt(Ce(t,"SKILL.md"))}catch{return!1}}function Nl(e,t){try{let o=Ce(it(e),pr);Er(o,JSON.stringify(t,null,2))}catch{}}function qn(e){try{let t=Ce(it(e),pr);return gt(t)?JSON.parse(Kn(t,"utf-8")):null}catch{return null}}async function Lr(e){if(!Br(e))return!0;let t=await Ot(e);if(!t?.contentHash)return!1;let o=qn(e);return o?.contentHash?o.contentHash!==t.contentHash:!0}function Jn(e){return qn(e)?.contentHash}async function Bo(e){let t=[],o=[];for(let r of e)await Lr(r)?t.push(r):o.push(r);return{toUpdate:t,upToDate:o}}async function Fl(e,t,o){let r=Ce(o,t);if(!Ol(o,r))return console.error(`Security: Skipping suspicious file path: ${t}`),!1;let i=Ce(r,"..");gt(i)||Eo(i,{recursive:!0});let s=zn(await Wn()),l=`${s.skillsBase}/${e.path}/${t}`,d=`${s.fallbackSkillsBase}/${e.path}/${t}`,c=await Yn(l,d);if(!c.ok)throw new Error(`Failed to download ${t}: HTTP ${c.status}`);return Er(r,await c.text()),!0}async function $l(e){let t=it(e.name);Xn(),gt(t)||Eo(t,{recursive:!0});try{let o=[...e.files],r=0;for(let i=0;i<o.length;i+=Mt.maxConcurrentDownloads){let s=o.slice(i,i+Mt.maxConcurrentDownloads),l=await Promise.all(s.map(d=>Fl(e,d,t)));r+=l.filter(Boolean).length}if(r<o.length)throw new Error(`Only ${r}/${o.length} files downloaded successfully`);return e.contentHash&&Nl(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 _t(){let e=await ao();return e?e.skills.map(t=>({name:t.name,description:t.description,path:Br(t.name)?it(t.name):"",category:t.category})):[]}async function Ot(e){return(await ao())?.skills.find(o=>o.name===e)??null}async function Ul(){return(await ao())?.deprecated??[]}async function Lo(){let e=await Ul();return new Map(e.map(t=>[t.name,t]))}async function ht(e){if(Br(e))return it(e);let t=await Ot(e);return t?$l(t):null}function Qn(){try{vr(we.cacheDir,{recursive:!0,force:!0})}catch{}}function Gl(e){try{vr(Ce(we.skillsCacheDir,e),{recursive:!0,force:!0})}catch{}}function Zn(){try{vr(we.registryCacheFile,{force:!0})}catch{}}async function co(e){return Gl(e),ht(e)}function Pr(){return we.cacheDir}var Mt,we,Pl,Vn,vo,We=q(()=>{"use strict";ve();Mt={cacheTtlMs:864e5,fetchTimeoutMs:15e3,maxRetries:3,retryBaseDelayMs:500,maxConcurrentDownloads:10},we={cacheDir:Ce(Bl(),An,In),get registryCacheFile(){return Ce(this.cacheDir,vn)},get skillsCacheDir(){return Ce(this.cacheDir,Dn)}},Pl=[/[/\\]/g,/\.\./g,/[<>:"|?*]/g];Vn=El.create({timeout:Mt.fetchTimeoutMs,retry:{limit:Mt.maxRetries,methods:["get"],statusCodes:[408,429,500,502,503,504],backoffLimit:1e4,delay:e=>Mt.retryBaseDelayMs*Math.pow(2,e-1),jitter:!0,retryOnTimeout:!0}});vo=null});import{cp as Hl,lstat as Rr,mkdir as ni,readdir as jl,readlink as ii,rm as Ft,symlink as Vl}from"node:fs/promises";import{homedir as Kl,platform as Xl}from"node:os";import{join as pe,normalize as ei,relative as Yl,resolve as mo,sep as Wl}from"node:path";var ti,Mr,po,oi,zl,ql,uo,Jl,Nt,ri,Ql,Zl,ea,Po,_r,ta,fo,$t=q(()=>{"use strict";ve();io();br();Tr();Dr();bo();We();ti=pe(ft,fr),Mr=e=>(e.replace(/[/\\]/g,"").replace(/[\0:*?"<>|]/g,"").replace(/^[.\s]+|[.\s]+$/g,"").replace(/\.{2,}/g,"").replace(/^\.+/,"")||"unnamed-skill").substring(0,255),po=(e,t)=>{let o=ei(mo(e)),r=ei(mo(t));return r.startsWith(o+Wl)||r===o},oi=async(e,t)=>{try{await zl(t,e),await ni(pe(t,".."),{recursive:!0});let o=Yl(pe(t,".."),e),r=Xl()==="win32"?"junction":void 0;return await Vl(o,t,r),!0}catch{return!1}},zl=async(e,t)=>{try{if((await Rr(e)).isSymbolicLink()){let r=await ii(e);if(mo(r)===mo(t))return;await Ft(e)}else await Ft(e,{recursive:!0})}catch(o){o?.code==="ELOOP"&&await Ft(e,{force:!0}).catch(()=>{})}},ql=async(e,t)=>{try{if((await Rr(e)).isSymbolicLink()){let r=await ii(e),i=mo(pe(e,".."),r);return po(t,i)}return!0}catch{return!0}},uo=async(e,t)=>{await Ft(t,{recursive:!0,force:!0}),await ni(pe(t,".."),{recursive:!0}),await Hl(e,t,{recursive:!0})},Jl=(e,t)=>`${e}-${t?"global":"local"}`,Nt=(e,t,o={})=>({agent:e.config.displayName,skill:e.skill.name,path:e.skillTargetPath,method:t,success:!0,...o}),ri=(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)}),Ql={"symlink-global":async e=>await oi(e.skill.path,e.skillTargetPath)?Nt(e,"symlink"):(await uo(e.skill.path,e.skillTargetPath),Nt(e,"copy",{symlinkFailed:!0})),"symlink-local":async e=>{let t=pe(e.projectRoot,fr,e.safeSkillName);return await uo(e.skill.path,t),await oi(t,e.skillTargetPath)?Nt(e,"symlink",{usedGlobalSymlink:!1}):(await uo(e.skill.path,e.skillTargetPath),Nt(e,"copy",{symlinkFailed:!0}))},"copy-global":async e=>(await uo(e.skill.path,e.skillTargetPath),Nt(e,"copy")),"copy-local":async e=>(await uo(e.skill.path,e.skillTargetPath),Nt(e,"copy"))},Zl=(e,t,o,r)=>r||po(e,t)||po(o,t)?null:"Security: Invalid skill destination path",ea=async(e,t,o,r,i,s)=>{let l=Ne(t),d=Mr(e.name),c=pe(o,d),u={skill:e,config:l,safeSkillName:d,skillTargetPath:c,projectRoot:i},g=Zl(o,c,i,s);if(g)return ri(u,r,g);try{let f=Jl(r,s);return await Ql[f](u)}catch(f){return ri(u,r,f)}},Po=async(e,t)=>{let o=Oe(),r=[];for(let i of t.agents){let s=Ne(i),l=t.global?s.globalSkillsDir:pe(o,s.skillsDir);for(let d of e){let c=await ea(d,i,l,t.method,o,t.global);r.push(c),c.success&&await Ir(d.name,[i],{source:"local",contentHash:Jn(d.name),method:t.method,global:t.global})}}return await kr({action:"install",skillName:e.map(i=>i.name).join(", "),agents:t.agents.map(i=>Ne(i).displayName),success:r.filter(i=>i.success).length,failed:r.filter(i=>!i.success).length,details:r.map(i=>({skill:i.skill,agent:i.agent,success:i.success,error:i.error,path:i.path}))}),r},_r=async(e,t)=>{let o=Ne(e),r=t?o.globalSkillsDir:pe(Oe(),o.skillsDir);try{return(await jl(r,{withFileTypes:!0})).filter(s=>s.isDirectory()||s.isSymbolicLink()).map(s=>s.name)}catch{return[]}},ta=(e,t={})=>{let o=Mr(e),r=t.global?Kl():Oe(),i=pe(r,ti,o);if(!po(pe(r,ti),i))throw new Error("Invalid skill name: potential path traversal detected");return i},fo=async(e,t,o={})=>{let r=Mr(e),i=Oe(),s=await Do(e,!0);if(s||(s=await Do(e,!1)),!s&&!o.force)return t.map(c=>({skill:e,agent:Ne(c).displayName,success:!1,error:"Skill not found in lockfile"}));let l=ta(e,o);await Ft(l,{recursive:!0,force:!0}).catch(()=>{});let d=await Promise.all(t.map(async c=>{let u=Ne(c),g=pe(i,u.skillsDir,r),f=pe(u.globalSkillsDir,r),h=o.global===void 0?[g,f]:o.global?[f]:[g],m=!1,p;for(let w of h){let B=w.startsWith(u.globalSkillsDir)?u.globalSkillsDir:pe(i,u.skillsDir);if(!po(B,w)){p="Security: Invalid removal path";continue}if(!await ql(w,B)){p="Security: Symlink points outside allowed directory";continue}try{await Rr(w),await Ft(w,{recursive:!0,force:!0}),m=!0}catch(_){_.code!=="ENOENT"&&!p&&(p=_ instanceof Error?_.message:String(_))}}return{skill:e,agent:u.displayName,success:m,error:m?void 0:p||"Skill not found"}}));return d.some(c=>c.success)&&(await Io(e,!0).catch(()=>{}),await Io(e,!1).catch(()=>{})),await kr({action:"remove",skillName:e,agents:t.map(c=>Ne(c).displayName),success:d.filter(c=>c.success).length,failed:d.filter(c=>!c.success).length,forced:o.force,details:d.map(c=>({skill:c.skill,agent:c.agent,success:c.success,error:c.error}))}),d}});var xs={};Bt(xs,{runCliInstall:()=>cu});import Me from"chalk";async function lu(e,t){let o=await _t(),r=[];for(let i of e){let s=o.find(d=>d.name===i);if(!s){console.error(Me.red(`\u274C Skill "${i}" not found`));continue}let l=t?await co(i):await ht(i);l?r.push({...s,path:l}):console.error(Me.red(`\u274C Failed to download skill "${i}"`))}return r}function au(e){let t=e.filter(r=>r.success),o=e.filter(r=>!r.success);t.length>0&&(console.log(Me.green(`
5
+ \u2705 Successfully installed ${t.length} skill(s):`)),t.forEach(r=>{console.log(Me.dim(` \u2022 ${r.skill} \u2192 ${r.agent} (${r.method})`))})),o.length>0&&(console.log(Me.red(`
6
+ \u274C Failed to install ${o.length} skill(s):`)),o.forEach(r=>{console.log(Me.dim(` \u2022 ${r.skill} \u2192 ${r.agent}: ${r.error}`))}))}async function cu(e){(!e.skill||e.skill.length===0)&&(console.error(Me.red("\u274C --skill is required in CLI mode")),console.error(Me.dim("Usage: ai-tools skills install --skill <name1> [name2...] [--agent <agents...>] [--global] [--symlink]")),process.exit(1));let t=Array.isArray(e.skill)?e.skill:[e.skill];console.log(Me.blue(`\u23F3 Loading ${t.length} skill(s) from catalog...`));let o=await lu(t,e.force||!1);o.length===0&&(console.error(Me.red("\u274C No skills were successfully downloaded")),process.exit(1));let r=e.agent||["cursor","claude-code","windsurf"],i=e.symlink?"symlink":"copy";console.log(Me.blue(`\u23F3 Installing ${o.length} skill(s) to ${r.length} agent(s)...`));let s={agents:r,skills:o.map(d=>d.name),method:i,global:e.global||!1},l=await Po(o,s);au(l),l.some(d=>!d.success)&&process.exit(1)}var ys=q(()=>{"use strict";$t();We()});var ks={};Bt(ks,{runCliRemove:()=>du});import Ve from"chalk";async function du(e){(!e.skill||e.skill.length===0)&&(console.error(Ve.red("\u274C --skill is required in CLI mode")),console.error(Ve.dim("Usage: ai-tools skills remove --skill <name1> [name2...] [--agent <agents...>] [--global] [--force]")),process.exit(1));let t=Array.isArray(e.skill)?e.skill:[e.skill],o=e.agent||["cursor","claude-code","windsurf"];e.force&&console.log(Ve.yellow("\u26A0\uFE0F Force mode enabled - bypassing lockfile check")),console.log(Ve.blue(`\u23F3 Removing ${t.length} skill(s) from ${o.length} agent(s)...`));let r=0,i=0,s=!1;for(let l of t){let d=await fo(l,o,{global:e.global,force:e.force}),c=d.filter(g=>g.success),u=d.filter(g=>!g.success);c.length>0&&(console.log(Ve.green(`\u2705 ${l}: Removed from ${c.length} agent(s)`)),c.forEach(g=>console.log(Ve.dim(` \u2022 ${g.agent}`))),r+=c.length),u.length>0&&(console.log(Ve.red(`\u274C ${l}: Failed to remove from ${u.length} agent(s)`)),u.forEach(g=>console.log(Ve.dim(` \u2022 ${g.agent}: ${g.error}`))),i+=u.length,u.some(g=>g.error?.includes("lockfile"))&&(s=!0))}console.log(Ve.dim(`
7
+ ${r} succeeded, ${i} failed`)),s&&!e.force&&console.log(Ve.yellow(`
8
+ \u{1F4A1} Tip: Use --force to bypass lockfile check`)),i>0&&process.exit(1)}var bs=q(()=>{"use strict";$t()});var Ss={};Bt(Ss,{runCliUpdate:()=>uu});import ce from"chalk";async function uu(e){if(console.log(ce.blue("\u23F3 Fetching latest registry...")),await ao(!0),e.skill){if(!await Lr(e.skill)){console.log(ce.green(`\u2705 ${e.skill} is already up to date`));return}console.log(ce.blue(`\u23F3 Updating ${e.skill}...`)),await co(e.skill)?console.log(ce.green(`\u2705 Updated ${e.skill}`)):(console.error(ce.red(`\u274C Failed to update ${e.skill}`)),process.exit(1))}else{let{readSkillLock:t}=await Promise.resolve().then(()=>(Dr(),Hn)),o=await t(),r=Object.keys(o.skills);if(r.length===0){console.log(ce.yellow("No installed skills found. Run ai-tools skills install first."));return}let{toUpdate:i,upToDate:s}=await Bo(r);if(i.length===0){console.log(ce.green(`\u2705 All ${s.length} installed skills are up to date`));return}console.log(ce.blue(`\u23F3 Updating ${i.length} of ${r.length} skills...`));let l=0,d=0;for(let h of i)await co(h)?l++:(d++,console.error(ce.red(` \u274C Failed to update ${h}`)));console.log(ce.green(`\u2705 ${l} updated, ${s.length} already up to date${d>0?ce.red(`, ${d} failed`):""}`));let c=await Lo(),u=await _t(),g=new Set(u.map(h=>h.name)),f=r.filter(h=>c.has(h)||!g.has(h));if(f.length>0){console.log(""),console.log(ce.yellow(`\u26A0 ${f.length} deprecated skill${f.length>1?"s":""} detected:`));let h={withEntry:(m,p)=>{console.log(ce.yellow(` \u203A ${m} \u2014 ${p.message}`)),p.alternatives?.length&&console.log(ce.dim(` Try: ai-tools skills install --skill ${p.alternatives.join(", ")}`))},noEntry:m=>{console.log(ce.yellow(` \u203A ${m} \u2014 no longer available in the registry`))}};f.forEach(m=>{let p=c.get(m);h[p?"withEntry":"noEntry"](m,p)}),console.log(ce.dim(" Run: ai-tools skills remove --skill <name> to clean up"))}}}var Ts=q(()=>{"use strict";We()});var ws={};Bt(ws,{runCliCache:()=>mu});import vt from"chalk";function mu(e){e.clear?(Qn(),console.log(vt.green("\u2705 Cache cleared"))):e.clearRegistry?(Zn(),console.log(vt.green("\u2705 Registry cache cleared"))):e.path?console.log(Pr()):(console.log(vt.bold("Cache management:")),console.log(` ${vt.blue("--clear")} Clear all cached skills and registry`),console.log(` ${vt.blue("--clear-registry")} Clear only the registry cache`),console.log(` ${vt.blue("--path")} Show cache directory path`),console.log(),console.log(vt.dim(`Cache location: ${Pr()}`)))}var Cs=q(()=>{"use strict";We()});import{Box as ut,Text as De}from"ink";import{Fragment as fu,jsx as mt,jsxs as be}from"react/jsx-runtime";function As({entries:e,limit:t=10}){let o=e.slice(0,t);return o.length===0?mt(ut,{flexDirection:"column",paddingY:1,children:mt(De,{dimColor:!0,children:"No audit log entries found"})}):be(ut,{flexDirection:"column",paddingY:1,children:[be(ut,{marginBottom:1,children:[mt(De,{bold:!0,color:"cyan",children:"\u{1F4CB} Audit Log"}),be(De,{dimColor:!0,children:[" (showing ",o.length," most recent)"]})]}),o.map((r,i)=>{let s=r.timestamp?new Date(r.timestamp):new Date,l=r.timestamp?pu(s):"unknown time",d=r.action==="install"?"green":r.action==="remove"?"red":"yellow",c=r.failed===0?"\u2713":r.success>0?"\u26A0":"\u2717";return be(ut,{flexDirection:"column",marginBottom:1,paddingLeft:2,children:[be(ut,{children:[be(De,{color:d,bold:!0,children:[c," ",r.action.toUpperCase()]}),be(De,{dimColor:!0,children:[" \u2022 ",l]})]}),be(ut,{paddingLeft:2,children:[mt(De,{children:"Skills: "}),mt(De,{color:"cyan",children:r.skillName})]}),be(ut,{paddingLeft:2,children:[mt(De,{children:"Agents: "}),mt(De,{dimColor:!0,children:r.agents.join(", ")})]}),be(ut,{paddingLeft:2,children:[be(De,{color:"green",children:["\u2713 ",r.success]}),r.failed>0&&be(fu,{children:[mt(De,{children:" \u2022 "}),be(De,{color:"red",children:["\u2717 ",r.failed]})]})]})]},i)})]})}function pu(e){let t=Math.floor((Date.now()-e.getTime())/1e3);return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:t<604800?`${Math.floor(t/86400)}d ago`:e.toLocaleDateString()}var Is=q(()=>{"use strict"});var Ds={};Bt(Ds,{runCliAudit:()=>xu});import{render as gu}from"ink";import hu from"react";async function xu(e){if(e.path){console.log(wo());return}let t=e.limit?parseInt(e.limit,10):10,o=await Ln(t);gu(hu.createElement(As,{entries:o,limit:t}))}var vs=q(()=>{"use strict";Is();br()});import{Command as yu}from"commander";import{render as eo}from"ink";import to from"react";import{Box as cn,useApp as ru}from"ink";import{useEffect as nu,useState as iu}from"react";io();import{useEffect as rl,useMemo as nl,useState as ur}from"react";function Tn(){let[e,t]=ur([]),[o,r]=ur([]),[i,s]=ur(!0),l=nl(()=>Sn(),[]);return rl(()=>{let c=setTimeout(()=>{let u=So();r(u),t(u),s(!1)},800);return()=>clearTimeout(c)},[]),{allAgents:l,installedAgents:o,selectedAgents:e,setSelectedAgents:t,toggleAgent:c=>{t(u=>u.includes(c)?u.filter(g=>g!==c):[...u,c])},loading:i}}import{useEffect as ju,useState as Vu}from"react";ve();import{useMemo as il,useState as sl}from"react";function En(e,t){let[o,r]=sl(""),i=il(()=>{if(!o.trim())return e;let s=o.toLowerCase().split(/\s+/).filter(l=>l.length>0);return e.filter(l=>{let d=t.keys.map(c=>{let u=l[c];return typeof u=="string"?u.toLowerCase():""}).join(" ");return s.every(c=>d.includes(c))})},[o,e,t.keys]);return{query:o,setQuery:r,filtered:i,hasFilter:o.trim().length>0}}$t();import{useState as Mo}from"react";Co();import{existsSync as Nr,readdirSync as ai,readFileSync as aa}from"node:fs";import{join as Ro}from"node:path";import{existsSync as oa}from"node:fs";import{dirname as ra,join as si}from"node:path";import{fileURLToPath as na}from"node:url";var ia=na(import.meta.url),sa=ra(ia);function Or(){return si(la(),"packages","skills-catalog","skills")}function li(){let e=Or();return oa(e)?e:null}function la(){return si(sa,"..","..","..","..")}We();var st={mode:null,localDir:null};function ca(e){return Rt.test(e)}function da(e){return e.match(Rt)?.[1]??null}function ua(e){let t=e.match(/^---\n([\s\S]*?)\n---/);if(!t)return{};let o=t[1],r=o.match(/^name:\s*(.+)$/m),i=o.match(/^description:\s*(.+)$/m);return{name:r?.[1]?.trim(),description:i?.[1]?.trim()}}function ci(e,t){let o=Ro(e,"SKILL.md");if(!Nr(o))return null;let r=aa(o,"utf-8"),{name:i,description:s}=ua(r),l=e.split("/").pop()??"";return{name:i??l,description:s??"No description",path:e,category:t}}function ma(e,t){return Nr(e)?ai(e,{withFileTypes:!0}).filter(o=>o.isDirectory()).map(o=>ci(Ro(e,o.name),t)).filter(o=>o!==null):[]}function di(e){return Nr(e)?ai(e,{withFileTypes:!0}).filter(o=>o.isDirectory()).flatMap(o=>{if(ca(o.name)){let i=da(o.name);return i?ma(Ro(e,o.name),i):[]}let r=ci(Ro(e,o.name),Pt);return r?[r]:[]}):[]}function pa(){if(st.mode)return st.mode;let e=li();return e?(st.localDir=e,st.mode="local","local"):(st.mode="remote","remote")}function Fr(){return pa()==="local"&&st.localDir!==null}function fa(){return Fr()?di(st.localDir):[]}async function ui(){return Fr()?di(st.localDir):_t()}function ga(e){return fa().find(t=>t.name===e)}async function mi(e){if(Fr())return ga(e)??null;let t=await Ot(e);if(!t)return null;let o=await ht(e);return o?{name:t.name,description:t.description,path:o,category:t.category}:null}function _o(){let[e,t]=Mo({current:0,total:0,skill:""}),[o,r]=Mo([]),[i,s]=Mo(!1),[l,d]=Mo(null);return{install:async(u,g)=>{s(!0),d(null),t({current:0,total:u.length*g.agents.length,skill:"Downloading..."});let f=[];for(let h of u){let m=h.path?h:await mi(h.name);m&&f.push(m)}t({current:0,total:f.length*g.agents.length,skill:"Installing..."});try{let h=await Po(f,g);return r(h),h}catch(h){return d(h instanceof Error?h.message:String(h)),[]}finally{s(!1)}},progress:e,results:o,installing:i,error:l}}import{useInput as ha}from"ink";import{useCallback as xa,useRef as ya,useState as ka}from"react";var Oo=["up","up","down","down","left","right","left","right","b","a"];function pi(){let[e,t]=ka(!1),o=ya([]);ha((i,s)=>{if(e)return;let l=null;if(s.upArrow?l="up":s.downArrow?l="down":s.leftArrow?l="left":s.rightArrow?l="right":i.toLowerCase()==="b"?l="b":i.toLowerCase()==="a"&&(l="a"),!l){o.current=[];return}o.current.push(l),o.current.length>Oo.length&&(o.current=o.current.slice(-Oo.length)),o.current.length===Oo.length&&o.current.every((d,c)=>d===Oo[c])&&(t(!0),o.current=[])});let r=xa(()=>{t(!1),o.current=[]},[]);return{activated:e,reset:r}}$t();import{useState as No}from"react";function fi(){let[e,t]=No({current:0,total:0,skill:""}),[o,r]=No([]),[i,s]=No(!1),[l,d]=No(null);return{remove:async(g,f,h=!1)=>{s(!0),t({current:0,total:f.length,skill:g}),d(null);try{let m=await fo(g,f,{global:h});return r(p=>[...p,...m]),m}catch(m){return d(m instanceof Error?m.message:String(m)),[]}finally{s(!1)}},removeMultiple:async g=>{s(!0);let f=g.reduce((h,m)=>h+m.agents.length,0);t({current:0,total:f,skill:"Initializing..."}),r([]),d(null);try{let h=0;for(let m of g){t({current:h,total:f,skill:m.name});let p=await fo(m.name,m.agents,{});r(w=>[...w,...p]),h+=m.agents.length}}catch(h){d(h instanceof Error?h.message:String(h))}finally{s(!1)}},progress:e,results:o,removing:i,error:l}}We();import{readFileSync as ba}from"node:fs";import{join as Sa}from"node:path";import{useEffect as Ta,useState as Fo}from"react";function gi(e){let[t,o]=Fo(null),[r,i]=Fo(null),[s,l]=Fo(!1),[d,c]=Fo(null);return Ta(()=>{if(!e){o(null),i(null),l(!1),c(null);return}let u=!0;return l(!0),c(null),(async()=>{try{let[f,h]=await Promise.all([Ot(e).catch(()=>null),ht(e).catch(()=>null)]);if(!u)return;f&&o(f);let m=h??it(e);try{let p=ba(Sa(m,"SKILL.md"),"utf-8");i(p)}catch{c("Failed to load skill content")}}catch(f){u&&c(f instanceof Error?f.message:String(f))}finally{u&&l(!1)}})(),()=>{u=!1}},[e]),{metadata:t,content:r,loading:s,error:d}}import{useEffect as Ba,useState as Uo}from"react";Co();import{existsSync as hi,readdirSync as wa,readFileSync as Ca,writeFileSync as dp}from"node:fs";import{join as Aa}from"node:path";function xi(){return Or()}function Ia(){let e=xi(),t=Aa(e,wr);if(!hi(t))return{};try{let o=Ca(t,"utf-8");return JSON.parse(o)}catch{return{}}}function Da(e){let t=e.match(Rt);return t?t[1]:null}function va(e){return Rt.test(e)}function Ea(){let e=xi();if(!hi(e))return[];let t=Ia(),o=wa(e,{withFileTypes:!0}),r=[],i=0;for(let s of o){if(!s.isDirectory()||!va(s.name))continue;let l=Da(s.name);if(!l)continue;let d=t[s.name]??{};r.push({id:l,name:d.name??so(l),description:d.description,priority:d.priority??i}),i++}return r.sort((s,l)=>s.name.localeCompare(l.name)),r}function $o(e){let t=Ea();if(t.length===0){let s=new Set(e.map(l=>l.category).filter(Boolean));t=Array.from(s).map((l,d)=>({id:l,name:so(l),priority:d}))}let o=new Map;for(let s of t)o.set(s,[]);o.set(Cr,[]);for(let s of e){let l=s.category??Pt,d=t.find(g=>g.id===l);!d&&l!==Pt&&(d={id:l,name:so(l),priority:999},t.push(d),o.set(d,[]));let c=d??Cr,u=o.get(c)??[];u.push(s),o.set(c,u)}for(let[s,l]of o)l.length===0&&o.delete(s);let r=new Map,i=Array.from(o.keys()).sort((s,l)=>s.name.localeCompare(l.name));for(let s of i){let l=o.get(s);l&&(l.sort((d,c)=>d.name.localeCompare(c.name)),r.set(s,l))}return r}function lt(){let[e,t]=Uo([]),[o,r]=Uo(!0),[i,s]=Uo(null),[l,d]=Uo(new Map);return Ba(()=>{let c=!0;return(async()=>{try{let g=await ui();c&&(t(g),d($o(g)))}catch(g){c&&s(g instanceof Error?g.message:String(g))}finally{c&&r(!1)}})(),()=>{c=!1}},[]),{skills:e,loading:o,error:i,groupedSkills:l}}import{useState as La}from"react";function yi(e){let[t,o]=La(1);return{step:t,next:()=>o(l=>Math.min(l+1,e)),back:()=>o(l=>Math.max(l-1,1)),goTo:l=>o(l),isFirst:t===1,isLast:t===e,progress:t/e}}import{Box as yt,Text as jo}from"ink";import qa from"ink-big-text";import Gr from"ink-gradient";import{useEffect as Ja,useState as bi}from"react";import{Box as $r,Text as go}from"ink";import{memo as Pa}from"react";var n={primary:"#3b82f6",primaryLight:"#60a5fa",primaryDark:"#1e3a8a",accent:"#06b6d4",accentLight:"#22d3ee",success:"#22c55e",warning:"#f59e0b",error:"#ef4444",text:"#f8fafc",textDim:"#94a3b8",textMuted:"#64748b",border:"#334155",bg:"#0f172a",bgLight:"#1e293b"};var a={bar:"\u2502",barEnd:"\u2514",radioActive:"\u25CF",radioInactive:"\u25CB",checkboxActive:"\u25FC",checkboxInactive:"\u25FB",diamond:"\u25C6",arrow:"\u203A",arrowRight:"\u2192",arrowUp:"\u2191",arrowDown:"\u2193",dot:"\xB7",bullet:"\u25B8",check:"\u2713",cross:"\u2717",star:"\u2605",sparkle:"\u2726",installed:"\u25CF",warning:"\u26A0",info:"\u2139"};import{jsx as Ho,jsxs as Go}from"react/jsx-runtime";var at=Pa(function({hints:t,status:o}){return Ho($r,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:Go($r,{justifyContent:"space-between",width:"100%",children:[Ho(go,{children:t.map((r,i)=>Go(go,{children:[i>0&&Go(go,{color:n.textDim,children:[" ",a.dot," "]}),Ho(go,{color:r.color??n.accent,bold:!0,children:r.key}),Go(go,{color:n.textDim,children:[" ",r.label]})]},r.key))}),o&&Ho($r,{children:o})]})})});import{Box as xt,Text as Fe,useInput as Ra}from"ink";import{useMemo as Ma,useState as ki}from"react";import{Fragment as _a,jsx as ze,jsxs as qe}from"react/jsx-runtime";function Je({items:e,onSelect:t,onCancel:o,initialIndex:r=0,itemLimit:i=10,hideFooter:s,footerRight:l}){let[d,c]=ki(r),[u,g]=ki(0);Ra((h,m)=>{m.upArrow&&(c(p=>Math.max(0,p-1)),d<=u&&g(p=>Math.max(0,p-1))),m.downArrow&&(c(p=>Math.min(e.length-1,p+1)),d>=u+i-1&&g(p=>Math.min(e.length-i,p+1))),m.return&&t(e[d].value),m.escape&&o&&o()});let f=Ma(()=>e.slice(u,u+i),[e,u,i]);return qe(xt,{flexDirection:"column",children:[f.map((h,m)=>{let p=m+u===d;return qe(xt,{backgroundColor:p?n.bgLight:void 0,paddingX:1,children:[ze(xt,{width:2,children:ze(Fe,{color:p?n.accent:n.textMuted,children:p?a.bullet:" "})}),qe(Fe,{color:p?n.accent:n.text,bold:p,children:[p?a.radioActive:a.radioInactive," ",h.label]}),p&&h.hint&&qe(Fe,{color:n.textDim,children:[" ",a.dot," ",h.hint]})]},`${h.label}-${m}`)}),e.length>i&&ze(xt,{marginTop:1,paddingX:1,children:qe(Fe,{color:n.textDim,children:[a.arrowUp,a.arrowDown," ",u+1,"-",Math.min(u+i,e.length)," of ",e.length]})}),!s&&ze(xt,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:qe(xt,{justifyContent:"space-between",width:"100%",children:[qe(Fe,{children:[ze(Fe,{color:n.success,bold:!0,children:"enter"}),ze(Fe,{color:n.textDim,children:" select"}),o&&qe(_a,{children:[qe(Fe,{color:n.textDim,children:[" ",a.dot," "]}),ze(Fe,{color:n.warning,bold:!0,children:"esc"}),ze(Fe,{color:n.textDim,children:" back"})]})]}),l&&ze(xt,{children:l})]})})]})}import{Box as Qe,Text as Ee,useInput as Oa,useStdout as Na}from"ink";import{useCallback as Fa,useEffect as $a,useRef as Ua,useState as Ga}from"react";import{jsx as ue,jsxs as ho}from"react/jsx-runtime";var Ha=100,Ze=16,ja=50,Va=10,Ka=30,Xa=5,Ya=["BANKRUPT. Your burn rate was too high.","DOWN ROUND. Valuation dropped to zero.","RUNWAY EXPIRED. Back to living with parents.","SERVER COSTS > REVENUE. You are cooked.","AUDIT FAILED. Too much tech debt."],Wa=["ACQUIRED BY BIG TECH. Golden handcuffs on.","SERIES B SECURED. Keep burning cash!","IPO SUCCESSFUL. Time to buy a yacht.","PROFITABLE? No, but the vibes are great."],Ut=[["AGI_SOON","100x_DEV","LOVABLE","HYPE"],["DEEPSEEK","GEMINI","GPT","V0_DEV"],["TAB_SPAM","NO_READ","TRUST_ME","YOLO"],["SLOP","SPAGHETTI","ANY_TYPE","BUG"]];function za(e){let t=[],r=Math.max(...Ut.flat().map(l=>l.length))+4,i=Ut[0].length*r,s=Math.floor((e-i)/2);for(let l=0;l<Ut.length;l++)for(let d=0;d<Ut[l].length;d++){let c=Ut[l][d];t.push({x:Math.max(0,s+d*r),y:1+l*2,label:c,width:c.length,alive:!0})}return t}function Ur({onExit:e}){let{stdout:t}=Na(),o=t?.columns??80,r=Math.max(60,Math.min(o-4,Ha)),i=Ua(""),[s,l]=Ga(()=>({player:{x:Math.floor(r/2),y:Ze-1},playerBullets:[],enemyBullets:[],invaders:za(r),score:0,lives:5,gameOver:!1,won:!1,invaderDirection:1,tickCount:0,flash:!1,glitch:!1,rateLimited:0}));if((s.gameOver||s.won)&&!i.current){let f=s.won?Wa:Ya;i.current=f[Math.floor(Math.random()*f.length)]}Oa((f,h)=>{if(s.gameOver||s.won){(h.return||h.escape)&&e();return}if(h.escape){e();return}l(m=>{let p=m.player.x;h.leftArrow&&(p=Math.max(0,m.player.x-2)),h.rightArrow&&(p=Math.min(r-1,m.player.x+2));let w=m.playerBullets,B=m.rateLimited;return f===" "&&B===0&&(m.playerBullets.length>=2?(B=Ka,w=[]):w=[...m.playerBullets,{x:p,y:m.player.y-1}]),{...m,player:{...m.player,x:p},playerBullets:w,rateLimited:B}})});let d=Fa(()=>{l(f=>{if(f.gameOver||f.won)return f;let h=f.tickCount+1,m=f.score,p=f.lives,w=f.gameOver,B=!1,_=!1,F=f.rateLimited>0?f.rateLimited-1:0,k=f.invaders.filter(y=>y.alive),T=Ut.flat().length,A=k.length/T,S=Math.max(2,Math.floor(Va*A)+1),L=.02+.08*(1-A),O=f.playerBullets.map(y=>({...y,y:y.y-1})).filter(y=>y.y>=0),V=f.enemyBullets.map(y=>({...y,y:y.y+1})).filter(y=>y.y<Ze),I=f.invaders.map(y=>({...y}));for(let y of O)if(y.y!==-1){for(let v of I)if(v.alive&&y.y===v.y&&y.x>=v.x&&y.x<v.x+v.width){v.alive=!1,y.y=-1,m+=100,B=!0;break}}if(O=O.filter(y=>y.y!==-1),V.some(y=>y.x===f.player.x&&y.y===f.player.y)&&(p-=1,B=!0,_=!0,V=[],p<=0&&(w=!0)),I.every(y=>!y.alive))return{...f,won:!0,score:m+p*1e3,invaders:I};if(k.length>0){let y=k.filter(v=>{let Q=f.player.x>=v.x-1&&f.player.x<=v.x+v.width+1;return Math.random()<(Q?L*Xa:L)});if(y.length>0){let v=y[Math.floor(Math.random()*y.length)];V.push({x:v.x+Math.floor(v.width/2),y:v.y+1})}}let C=f.invaderDirection;if(h%S===0){let y=I.filter(Z=>Z.alive).map(Z=>Z.x),v=Math.min(...y);Math.max(...I.filter(Z=>Z.alive).map(Z=>Z.x+Z.width))>=r-2&&C===1&&(C=-1),v<=0&&C===-1&&(C=1),I.forEach(Z=>Z.alive&&(Z.x+=C))}return h%45===0&&(I.forEach(y=>y.alive&&(y.y+=1)),I.some(y=>y.alive&&y.y>=Ze-1)&&(w=!0)),{...f,playerBullets:O,enemyBullets:V,invaders:I,score:m,lives:p,gameOver:w,invaderDirection:C,tickCount:h,flash:B,glitch:_,rateLimited:F}})},[r]);$a(()=>{let f=setInterval(d,ja);return()=>clearInterval(f)},[d]);let c=()=>{let f=Array.from({length:Ze},()=>Array(r).fill(" "));s.invaders.forEach(p=>{if(p.alive)for(let w=0;w<p.width;w++)p.x+w<r&&p.y<Ze&&(f[p.y][p.x+w]=s.glitch?"?":p.label[w])}),s.playerBullets.forEach(p=>{p.x<r&&p.y<Ze&&(f[p.y][p.x]="$")}),s.enemyBullets.forEach(p=>{p.x<r&&p.y<Ze&&(f[p.y][p.x]="*")});let{x:h,y:m}=s.player;return h<r&&m<Ze&&(f[m][h]=s.rateLimited>0?"X":"^"),f.map(p=>p.join("")).join(`
9
+ `)},u=s.rateLimited>0?n.error:n.accent,g=s.glitch?n.warning:s.flash?n.error:n.success;return ue(Qe,{width:"100%",alignItems:"center",flexDirection:"column",children:ho(Qe,{width:r+4,flexDirection:"column",alignItems:"center",children:[ho(Qe,{width:r,flexDirection:"row",paddingX:1,children:[ue(Qe,{width:"35%",children:ue(Ee,{color:u,bold:!0,children:s.rateLimited>0?`LIMIT (${s.rateLimited})`:`$${s.score}k`})}),ue(Qe,{width:"30%",justifyContent:"center",children:ue(Ee,{color:n.warning,bold:!0,children:"VIBE INVADERS"})}),ue(Qe,{width:"35%",justifyContent:"flex-end",children:ho(Ee,{color:n.success,bold:!0,children:["RUNWAY: ","$".repeat(s.lives)]})})]}),ue(Qe,{borderStyle:"round",borderColor:s.rateLimited>0?n.error:n.border,flexDirection:"column",width:r+2,height:Ze+2,children:ue(Ee,{color:s.gameOver?n.error:g,children:c()})}),ue(Qe,{marginTop:0,width:r+2,justifyContent:"center",borderStyle:"round",borderColor:n.accent,children:s.gameOver||s.won?ho(Ee,{color:s.won?n.success:n.error,bold:!0,children:[i.current," Val: $",s.score,"k"]}):ho(Qe,{gap:1,children:[ue(Ee,{color:n.accent,children:"\u2190\u2192"}),ue(Ee,{children:" move "}),ue(Ee,{color:n.accent,children:"spc"}),ue(Ee,{children:" shoot "}),ue(Ee,{color:n.accent,children:"esc"}),ue(Ee,{children:" quit"})]})})]})})}import{jsx as me,jsxs as Hr}from"react/jsx-runtime";var Qa=[{label:"Vibe Invaders",value:"invaders",hint:"Fight vibe-coding!"},{label:"Back",value:"back",hint:"Return to CLI"}],Si="\u2591".repeat(56);function jr({onExit:e}){let[t,o]=bi("menu"),[r,i]=bi(!0);Ja(()=>{let l=setInterval(()=>i(d=>!d),600);return()=>clearInterval(l)},[]);let s=l=>{if(l==="back"){e();return}o(l)};return t==="invaders"?me(Ur,{onExit:()=>o("menu")}):Hr(yt,{flexDirection:"column",alignItems:"center",children:[me(yt,{marginBottom:0,children:me(Gr,{name:"cristal",children:me(jo,{children:Si})})}),me(yt,{marginBottom:0,children:me(Gr,{name:"pastel",children:me(qa,{text:"ARCADE",font:"chrome"})})}),me(yt,{marginBottom:0,children:me(Gr,{name:"cristal",children:me(jo,{children:Si})})}),me(yt,{marginBottom:1,marginTop:1,children:Hr(jo,{color:r?n.warning:n.bg,bold:!0,children:[a.sparkle," SECRET UNLOCKED ",a.sparkle]})}),me(yt,{marginBottom:1,children:Hr(jo,{color:n.textDim,children:[a.diamond," Choose your adventure ",a.diamond]})}),me(yt,{width:50,children:me(Je,{items:Qa,onSelect:s,onCancel:e,hideFooter:!0})}),me(at,{hints:[{key:"\u2191\u2193",label:"navigate"},{key:"\u23CE",label:"select"},{key:"esc",label:"back",color:n.warning}]})]})}import{Box as Bi,Text as Ko,useInput as wc}from"ink";import{Box as et,Text as Ae}from"ink";import vi from"ink-big-text";import Kr from"ink-gradient";import{useAtomValue as bc}from"jotai";import{useMemo as Sc}from"react";Tr();import{atom as gc}from"jotai";import{unwrap as hc}from"jotai/utils";ve();import{mkdir as Za,readFile as ec,writeFile as tc}from"node:fs/promises";import{homedir as oc}from"node:os";import{dirname as rc,join as nc}from"node:path";function Ti(){return nc(oc(),mr,wn)}function ic(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.lastUpdateCheck!="number"?null:{lastUpdateCheck:t.lastUpdateCheck,latestVersion:t.latestVersion??null}}async function wi(){let e=Ti();try{let t=await ec(e,"utf-8"),o=JSON.parse(t);return ic(o)}catch{return null}}async function Ci(e){let t=Ti(),o={lastUpdateCheck:Date.now(),latestVersion:e};await Za(rc(t),{recursive:!0}),await tc(t,JSON.stringify(o,null,2),"utf-8")}ve();import mc from"package-json";import{createRequire as sc}from"node:module";import{dirname as lc,join as ac}from"node:path";import{fileURLToPath as cc}from"node:url";var dc=cc(import.meta.url),uc=lc(dc),Ai=sc(import.meta.url),Vo;try{Vo=Ai("./package.json")}catch{Vo=Ai(ac(uc,"../../package.json"))}var Gt=Vo.version||"0.0.0",bf=Vo.description||"CLI to install and manage skills for AI coding agents";async function Ii(e){try{if(pc(e))return null;let t=await mc(Lt,{version:"latest"});return t.version!==e?t.version:null}catch{return null}}function pc(e){return/-(alpha|beta|rc|snapshot|dev|canary|next)/i.test(e)}function Vr(){return Gt}ve();async function xc(e){let t=await wi(),o=t&&t.latestVersion!==e?t.latestVersion:null;try{let r=await Promise.race([Ii(e),new Promise((i,s)=>setTimeout(()=>s(new Error("timeout")),3e3))]);return Ci(r??e).catch(()=>{}),r}catch{return o}}var yc=async()=>{let e=Vr(),[t,o]=await Promise.all([xc(e).catch(()=>null),Promise.resolve(Sr()).catch(()=>!1)]);return{updateAvailable:t,currentVersion:e,isGlobal:o,isLoading:!1}},kc=gc(yc()),Di=hc(kc,e=>e??{updateAvailable:null,currentVersion:Vr(),isGlobal:!1,isLoading:!0});ve();import{jsx as te,jsxs as tt}from"react/jsx-runtime";var Ei=["#1e3a8a","#3b82f6","#0ea5e9","#06b6d4","#22d3ee"],Tc="\u2500",R=({notification:e})=>{let t=bc(Di),o=Sc(()=>{if(e)return e;let{updateAvailable:r,currentVersion:i,isGlobal:s,isLoading:l}=t;return l?null:r&&!s?tt(et,{flexDirection:"column",alignItems:"center",children:[tt(Ae,{color:"yellow",children:[a.warning," ",Ye.UPDATE_AVAILABLE(i,r)]}),tt(Ae,{color:"blue",children:[a.info," ",Ye.TIP_INSTALL_UPDATE," ",te(Ae,{bold:!0,children:Ye.INSTALL_COMMAND})]})]}):r?tt(Ae,{color:"yellow",children:[a.warning," ",Ye.UPDATE_AVAILABLE(i,r)," (run"," ",te(Ae,{bold:!0,children:Ye.UPDATE_COMMAND}),")"]}):s?null:tt(Ae,{color:"blue",children:[a.info," ",Ye.TIP_INSTALL_ACCESS," ",te(Ae,{bold:!0,children:Ye.INSTALL_COMMAND})]})},[e,t]);return tt(et,{flexDirection:"column",paddingBottom:1,children:[tt(et,{flexDirection:"column",alignItems:"center",marginBottom:1,children:[te(et,{marginBottom:-1,children:te(Kr,{colors:["#1e3a8a","#3b82f6"],children:te(vi,{text:"TLC",font:"tiny"})})}),te(et,{children:te(Kr,{colors:Ei,children:te(vi,{text:"AGENT SKILLS",font:"block"})})}),tt(et,{marginTop:-1,alignItems:"center",children:[te(Ae,{color:"#334155",children:"\u2500\u2500\u2500\u2500\u2500\u2500 "}),tt(Ae,{color:"white",bold:!0,children:["VERSION ",Gt]}),te(Ae,{color:"#334155",children:" \u2500\u2500\u2500\u2500\u2500\u2500"})]}),te(et,{marginTop:1,children:te(Ae,{color:"#64748b",italic:!0,children:Ye.DESCRIPTION})}),o&&te(et,{marginTop:1,children:o})]}),te(et,{marginTop:o?0:1,justifyContent:"center",children:te(Kr,{colors:Ei,children:te(Ae,{children:Tc.repeat(60)})})})]})};import{jsx as xo,jsxs as Xr}from"react/jsx-runtime";function Li({onSelect:e,onBack:t,onCredits:o}){let r=[{label:"Install new skills",value:"install",hint:"browse and select skills to install"},{label:"Update existing skills",value:"update",hint:"check for content changes"},{label:"Remove installed skills",value:"remove",hint:"uninstall skills from agents"}];wc(s=>{s==="c"&&o&&o()});let i=Xr(Ko,{children:[xo(Ko,{color:n.accent,bold:!0,children:"c"}),xo(Ko,{color:n.textDim,children:" credits"})]});return Xr(Bi,{flexDirection:"column",paddingX:1,children:[xo(R,{}),xo(Bi,{marginBottom:1,children:Xr(Ko,{bold:!0,color:n.primary,children:[a.diamond," What would you like to do?"]})}),xo(Je,{items:r,onSelect:e,onCancel:t,footerRight:i})]})}import{Box as Kt,Text as Yr,useInput as Rc,useStdout as Mc}from"ink";import _c from"ink-spinner";import{useState as Oc}from"react";import{Box as Be,Text as Ht,useInput as vc}from"ink";import{useEffect as Ec}from"react";import{useEffect as Cc,useState as Ac}from"react";import{Fragment as Ic,jsx as Dc}from"react/jsx-runtime";var Pi=({visible:e,duration:t=250,children:o})=>{let[r,i]=Ac(e?1:0);return Cc(()=>{if(e&&r===1||!e&&r===0)return;let s=Date.now(),l=r,d=e?1:0,u=setInterval(()=>{let f=Date.now()-s,h=Math.min(f/t,1),m=l+(e?h:-h)*Math.abs(d-l),p=Math.max(0,Math.min(1,m));i(p),h>=1&&(clearInterval(u),i(d))},16);return()=>{clearInterval(u)}},[e,t]),!e&&r<=.05?null:Dc(Ic,{children:o})};import{jsx as oe,jsxs as Xo}from"react/jsx-runtime";var jt=({visible:e,onDismiss:t,shortcuts:o})=>{vc(()=>{e&&t()},{isActive:e}),Ec(()=>{let u;return e&&(u=setTimeout(()=>{t()},8e3)),()=>{u&&clearTimeout(u)}},[e,t]);let r=Math.ceil(o.length/2),i=o.slice(0,r),s=o.slice(r),l=({label:u})=>oe(Be,{flexShrink:0,children:oe(Ht,{backgroundColor:n.bgLight,color:n.accent,bold:!0,children:` ${u} `})}),d=({entry:u})=>Xo(Be,{marginBottom:0,gap:1,children:[oe(Be,{width:10,justifyContent:"flex-end",flexShrink:0,children:oe(l,{label:u.key})}),oe(Ht,{color:n.textDim,children:u.description})]}),c="\u2500".repeat(48);return oe(Pi,{visible:e,duration:200,children:Xo(Be,{borderStyle:"round",borderColor:n.border,backgroundColor:n.bg,paddingX:2,paddingY:1,flexDirection:"column",width:56,children:[oe(Be,{justifyContent:"center",marginBottom:1,children:Xo(Ht,{color:n.accent,bold:!0,children:[a.sparkle," Keyboard Shortcuts"]})}),oe(Be,{justifyContent:"center",children:oe(Ht,{color:n.border,children:c})}),Xo(Be,{marginTop:1,gap:2,children:[oe(Be,{flexDirection:"column",gap:1,flexGrow:1,children:i.map(u=>oe(d,{entry:u},u.key))}),oe(Be,{flexDirection:"column",gap:1,flexGrow:1,children:s.map(u=>oe(d,{entry:u},u.key))})]}),oe(Be,{justifyContent:"center",marginTop:1,children:oe(Ht,{color:n.border,children:c})}),oe(Be,{marginTop:1,justifyContent:"center",children:oe(Ht,{color:n.textMuted,children:"press any key to dismiss"})})]})})};import{Box as kt,Text as ot,useInput as Bc}from"ink";import{useEffect as Lc,useRef as Pc,useState as Yo}from"react";import{jsx as Le,jsxs as bt}from"react/jsx-runtime";function Vt({items:e,onSubmit:t,onCancel:o,onChange:r,initialSelected:i=[],limit:s=10}){let[l,d]=Yo(i),[c,u]=Yo(0),[g,f]=Yo(0),[h,m]=Yo(!1),p=Pc(i);Lc(()=>{let k=p.current;(k.length!==i.length||k.some((A,S)=>A!==i[S]))&&(d(i),p.current=i)},[i]),Bc((k,T)=>{if(k==="?"){m(L=>!L);return}if(h){m(!1);return}if(T.return){t(l);return}if(T.escape&&o){o();return}let A=c,S=g;if(T.upArrow?A=c>0?c-1:e.length-1:T.downArrow&&(A=c<e.length-1?c+1:0),A<S?S=A:A>=S+s&&(S=A-s+1),T.upArrow&&c===0?S=Math.max(0,e.length-s):T.downArrow&&c===e.length-1&&(S=0),A!==c&&(u(A),f(S)),k===" "){let L=e[c];if(l.includes(L.value)){let O=l.filter(V=>V!==L.value);d(O),r?.(O)}else{let O=[...l,L.value];d(O),r?.(O)}}if(k==="a"&&T.ctrl)if(l.length===e.length)d([]),r?.([]);else{let L=e.map(O=>O.value);d(L),r?.(L)}});let w=e.slice(g,g+s),B=g>0,_=e.length>g+s,F=[{key:"\u2191/\u2193",description:"Navigate"},{key:"space",description:"Toggle selection"},{key:"enter",description:"Confirm"},{key:"ctrl+a",description:"Select all / none"},...o?[{key:"esc",description:"Cancel"}]:[]];return h?Le(kt,{flexDirection:"column",flexGrow:1,alignItems:"center",justifyContent:"center",children:Le(jt,{visible:h,onDismiss:()=>m(!1),shortcuts:F})}):bt(kt,{flexDirection:"column",children:[B&&Le(kt,{justifyContent:"center",marginBottom:1,children:bt(ot,{color:n.textDim,children:[a.arrowUp," ",a.arrowUp," ",a.arrowUp]})}),w.map((k,T)=>{let A=T+g,S=A===c,L=l.includes(k.value),O=S?a.bullet:" ",V=L?n.success:n.accent,I=L?a.checkboxActive:a.checkboxInactive,C=L?n.success:n.textMuted,y=S?n.primary:L?n.primaryLight:n.text;return bt(kt,{backgroundColor:S?n.bgLight:void 0,paddingX:1,children:[Le(kt,{width:2,children:Le(ot,{color:V,children:O})}),Le(kt,{width:2,children:Le(ot,{color:C,children:I})}),Le(ot,{color:y,bold:S,children:k.label}),k.hint&&bt(ot,{color:L?n.success:n.textDim,children:[" ",a.dot," ",k.hint]})]},`${String(k.value)}-${A}`)}),_&&Le(kt,{justifyContent:"center",marginTop:1,children:bt(ot,{color:n.textDim,children:[a.arrowDown," ",a.arrowDown," ",a.arrowDown]})}),Le(at,{hints:[{key:"space",label:"toggle"},{key:"enter",label:"confirm",color:n.success},...o?[{key:"esc",label:"back",color:n.warning}]:[],{key:"?",label:"help"}],status:l.length>0?bt(ot,{children:[bt(ot,{color:n.success,bold:!0,children:[a.checkboxActive," ",l.length]}),Le(ot,{color:n.textDim,children:" selected"})]}):void 0})]})}io();import{Fragment as Ri,jsx as $e,jsxs as St}from"react/jsx-runtime";var Nc=28;function Xt({onSelect:e,onBack:t}){let{stdout:o}=Mc(),r=o?.rows??40,i=Math.max(3,r-Nc),{allAgents:s,installedAgents:l,selectedAgents:d,setSelectedAgents:c,loading:u}=Tn(),g=[{key:"space",description:"Toggle selection"},{key:"enter",description:"Confirm"},{key:"ctrl+a",description:"Select all"},{key:"esc",description:"Go back"}],[f,h]=Oc(!1);Rc(p=>{p==="?"&&h(w=>!w)});let m=s.map(p=>{let w=Ne(p),B=l.includes(p);return{label:w.displayName,value:p,hint:B?`${a.check} detected`:void 0}});return u?St(Kt,{flexDirection:"column",paddingX:1,children:[$e(R,{}),$e(Kt,{marginTop:1,children:St(Yr,{color:n.accent,children:[$e(_c,{type:"dots"})," Scanning for installed agents..."]})})]}):St(Kt,{flexDirection:"column",paddingX:1,minHeight:20,children:[$e(R,{}),f?St(Ri,{children:[$e(Kt,{flexDirection:"column",flexGrow:1,alignItems:"center",justifyContent:"center",children:$e(jt,{visible:f,onDismiss:()=>h(!1),shortcuts:g})}),$e(at,{hints:[{key:"space",label:"toggle"},{key:"enter",label:"confirm",color:n.success},...t?[{key:"esc",label:"back",color:n.warning}]:[],{key:"?",label:"help"}]})]}):St(Ri,{children:[$e(Kt,{marginBottom:1,children:St(Yr,{bold:!0,color:n.primary,children:[a.diamond," Where do you want to install skills?"]})}),$e(Kt,{marginBottom:1,children:St(Yr,{color:n.textDim,children:[l.length," agents detected on this machine"]})}),$e(Vt,{items:m,initialSelected:d,onSubmit:e,onCancel:t,onChange:c,limit:i})]})]})}import{Box as ct,Text as G,useInput as Vc,useStdout as Kc}from"ink";import $i from"ink-big-text";import Zo from"ink-gradient";import{existsSync as Xc}from"node:fs";import{dirname as Ui,join as Yc}from"node:path";import{fileURLToPath as Wc}from"node:url";import{useCallback as zc,useEffect as Qo,useMemo as qc,useRef as Gi,useState as Yt}from"react";import{execSync as Fc,spawn as Wo}from"node:child_process";import{platform as $c}from"node:os";function Uc(e){try{return Fc(`which ${e}`,{stdio:"ignore"}),!0}catch{return!1}}function Gc(e){let t=[{cmd:"mpv",args:["--no-video","--no-terminal",e]},{cmd:"ffplay",args:["-nodisp","-autoexit","-loglevel","quiet",e]},{cmd:"paplay",args:[e]},{cmd:"aplay",args:[e]}];for(let{cmd:o,args:r}of t)if(Uc(o))return Wo(o,r,{stdio:"ignore"});return Wo("mpv",["--no-video","--no-terminal",e],{stdio:"ignore"})}function Mi(e){try{let t=$c(),o;return t==="darwin"?o=Wo("afplay",[e],{stdio:"ignore"}):t==="win32"?o=Wo("powershell",["-c",`(New-Object Media.SoundPlayer "${e}").PlaySync()`],{stdio:"ignore"}):o=Gc(e),o.on("error",()=>{}),o}catch{return null}}function zo(e){e&&!e.killed&&e.kill()}import _i from"ky";var Oi="https://api.github.com/repos/gustavobrunodev/ai-tools",Hc=`${Oi}/contributors`,qo=null,Jo=null;async function Ni(){if(qo)return qo;try{return qo=(await _i.get(Hc,{headers:{Accept:"application/vnd.github.v3+json"},timeout:1e4}).json()).filter(({login:t})=>!jc(t)).map(({login:t,avatar_url:o,contributions:r})=>({login:t,avatarUrl:o,contributions:r})),qo}catch{return[]}}async function Fi(){if(Jo!==null)return Jo;try{return Jo=(await _i.get(Oi,{headers:{Accept:"application/vnd.github.v3+json"},timeout:1e4}).json()).stargazers_count,Jo}catch{return 0}}function jc(e){return e.endsWith("[bot]")}import{jsx as N,jsxs as Pe}from"react/jsx-runtime";var Jc=220,Jr=52,Wt=["#1e3a8a","#3b82f6","#0ea5e9","#06b6d4","#22d3ee"],Qc=14,qr=500,ji=60,Wr="\u2500".repeat(Jr-4),Hi=40,zr=["#f59e0b","#ef4444","#ec4899","#a855f7"],Zc={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 ed(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:zr}),o.push({type:"gradient",text:Wr,gradientColors:Wt}),o.push({type:"blank"});for(let i=0;i<e.length;i++){let s=e[i];o.push({type:"contributor",rank:i+1,login:s.login,contributions:s.contributions})}o.push({type:"blank"}),o.push({type:"blank"}),o.push({type:"gradient",text:`${a.star} S T A T S ${a.star}`,gradientColors:zr}),o.push({type:"gradient",text:Wr,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 r=e.reduce((i,s)=>i+s.contributions,0);return o.push({type:"text",text:`${a.check} Contributions \xB7\xB7\xB7\xB7 ${r}`,color:"#22c55e"}),o.push({type:"blank"}),o.push({type:"blank"}),o.push({type:"gradient",text:`${a.sparkle} S P E C I A L T H A N K S ${a.sparkle}`,gradientColors:zr}),o.push({type:"gradient",text:Wr,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/gustavobrunodev/ai-tools",gradientColors:Wt}),o.push({type:"blank"}),o.push({type:"blank"}),o.push({type:"blank"}),o}function td(){try{let e=Ui(Wc(import.meta.url));for(let t=0;t<5;t++){let o=Yc(e,"assets","chiptune.mp3");if(Xc(o))return o;e=Ui(e)}return null}catch{return null}}function od({rank:e,login:t,contributions:o}){let r=Zc[e],i=r?.color??"#e2e8f0",s=e.toString().padStart(2),l=`@${t}`,d=`${o}`,c=r?` ${r.badge}`:"",u=5+l.length+c.length+1+d.length,g=Math.max(2,Jr-4-u),f="\xB7".repeat(g);return Pe(G,{children:[Pe(G,{color:"#64748b",children:[s,". "]}),N(G,{color:i,bold:!!r,children:l}),N(G,{color:r?.color??"#94a3b8",children:c}),Pe(G,{color:"#334155",children:[" ",f," "]}),N(G,{color:"#22c55e",bold:!0,children:d})]})}function rd({line:e}){switch(e.type){case"blank":return N(G,{children:" "});case"text":return N(G,{color:e.color,bold:e.bold,children:e.text});case"gradient":return N(Zo,{colors:[...e.gradientColors],children:N(G,{children:e.text})});case"contributor":return N(od,{rank:e.rank,login:e.login,contributions:e.contributions})}}function nd({speed:e,paused:t}){if(t)return Pe(G,{color:n.warning,bold:!0,children:[" ",a.bar,a.bar," PAUSED"]});let o=Math.round((qr-e)/(qr-ji)*4)+1,r="\u25AE".repeat(o)+"\u25AF".repeat(5-o);return Pe(G,{color:n.textMuted,children:[" ",r]})}function er({onExit:e}){let{stdout:t}=Kc(),o=t?.rows??24,r=Math.max(6,o-Qc-4),[i,s]=Yt([]),[l,d]=Yt(0),[c,u]=Yt(!0),[g,f]=Yt(0),[h,m]=Yt(Jc),[p,w]=Yt(!1),B=Gi(null),_=Gi(null);Qo(()=>{Promise.all([Ni(),Fi()]).then(([C,y])=>{s(C),d(y),u(!1)})},[]),Qo(()=>{let C=td();return C&&(B.current=Mi(C)),()=>{zo(B.current)}},[]);let F=qc(()=>ed(i,l),[i,l]),k=F.length+r,T=g>=k,A=zc(()=>{f(C=>C>=k?C:C+1)},[k]);if(Qo(()=>{if(c||p||T){_.current&&clearInterval(_.current),_.current=null;return}return _.current=setInterval(A,h),()=>{_.current&&clearInterval(_.current)}},[c,p,T,h,A]),Qo(()=>{if(!T)return;let C=setTimeout(()=>{zo(B.current),e()},3e3);return()=>clearTimeout(C)},[T,e]),Vc((C,y)=>{if(y.escape){zo(B.current),e();return}if(C===" "){w(v=>!v);return}if(y.upArrow){m(v=>Math.max(ji,v-Hi));return}if(y.downArrow){m(v=>Math.min(qr,v+Hi));return}}),c)return N(ct,{flexDirection:"column",alignItems:"center",padding:2,children:N(G,{color:n.accent,children:"Loading contributors..."})});let S={type:"blank"},L=Array(r).fill(S),O=Array(r).fill(S),I=[...L,...F,...O].slice(g,g+r);return Pe(ct,{flexDirection:"column",alignItems:"center",children:[N(ct,{marginBottom:-1,children:N(Zo,{colors:["#1e3a8a","#3b82f6"],children:N($i,{text:"TLC",font:"tiny"})})}),N(ct,{children:N(Zo,{colors:[...Wt],children:N($i,{text:"AGENT SKILLS",font:"block"})})}),N(ct,{children:N(Zo,{colors:[...Wt],children:N(G,{children:"\u2500".repeat(60)})})}),N(ct,{flexDirection:"column",alignItems:"center",height:r,width:Jr,children:I.map((C,y)=>N(ct,{justifyContent:"center",children:N(rd,{line:C})},`cl-${g}-${y}`))}),Pe(ct,{marginTop:1,gap:2,children:[Pe(G,{children:[N(G,{color:n.accent,bold:!0,children:"space"}),N(G,{color:n.textDim,children:" pause"})]}),N(G,{color:n.textMuted,children:a.dot}),Pe(G,{children:[Pe(G,{color:n.accent,bold:!0,children:[a.arrowUp,a.arrowDown]}),N(G,{color:n.textDim,children:" speed"})]}),N(nd,{speed:h,paused:p}),N(G,{color:n.textMuted,children:a.dot}),Pe(G,{children:[N(G,{color:n.warning,bold:!0,children:"esc"}),N(G,{color:n.textDim,children:" back"})]})]})]})}import{Box as he,Text as W,useInput as id}from"ink";import{useState as Qr}from"react";import{jsx as $,jsxs as xe}from"react/jsx-runtime";function Vi({onConfirm:e,onBack:t,initialMethod:o="copy",initialGlobal:r=!1}){let[i,s]=Qr("method"),[l,d]=Qr(o),[c,u]=Qr(r);return i==="method"?xe(he,{flexDirection:"column",paddingX:1,children:[$(R,{}),$(he,{marginBottom:1,children:xe(W,{bold:!0,color:n.primary,children:[a.diamond," Choose installation method:"]})}),$(Je,{items:[{label:"Copy",value:"copy",hint:"independent copies (recommended)"},{label:"Symlink",value:"symlink",hint:"shared source (may not work with all agents)"}],onSelect:g=>{d(g),s("scope")},onCancel:t})]}):i==="scope"?xe(he,{flexDirection:"column",paddingX:1,children:[$(R,{}),$(he,{marginBottom:1,children:xe(W,{bold:!0,color:n.primary,children:[a.diamond," Choose installation scope:"]})}),$(Je,{items:[{label:"Local",value:!1,hint:"this project only"},{label:"Global",value:!0,hint:"user home directory"}],onSelect:g=>{u(g),s("confirm")},onCancel:()=>s("method")})]}):$(sd,{method:l,isGlobal:c,onConfirm:()=>e({method:l,global:c}),onBack:()=>s("scope")})}function sd({method:e,isGlobal:t,onConfirm:o,onBack:r}){return id((i,s)=>{(s.return||i==="y"||i==="Y")&&o(),(s.escape||i==="n"||i==="N")&&r()}),xe(he,{flexDirection:"column",paddingX:1,children:[$(R,{}),xe(he,{flexDirection:"column",borderStyle:"round",borderColor:n.accent,paddingX:2,paddingY:1,children:[$(he,{marginBottom:1,children:xe(W,{bold:!0,color:n.accent,children:[a.diamond," Ready to install"]})}),xe(he,{children:[$(he,{width:10,children:$(W,{color:n.textDim,children:"Method"})}),$(W,{color:n.text,bold:!0,children:e==="copy"?"Copy":"Symlink"}),xe(W,{color:n.textMuted,children:[" ",a.dot," ",e==="copy"?"Recommended":"Developer mode"]})]}),xe(he,{children:[$(he,{width:10,children:$(W,{color:n.textDim,children:"Scope"})}),$(W,{color:n.text,bold:!0,children:t?"Global":"Local"}),xe(W,{color:n.textMuted,children:[" ",a.dot," ",t?"User home":"This project"]})]})]}),$(he,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:$(he,{justifyContent:"space-between",width:"100%",children:xe(W,{children:[$(W,{color:n.success,bold:!0,children:"Y"}),$(W,{color:n.textDim,children:" / "}),$(W,{color:n.success,bold:!0,children:"enter"}),$(W,{color:n.textDim,children:" confirm"}),xe(W,{color:n.textDim,children:[" ",a.dot," "]}),$(W,{color:n.warning,bold:!0,children:"N"}),$(W,{color:n.textDim,children:" / "}),$(W,{color:n.warning,bold:!0,children:"esc"}),$(W,{color:n.textDim,children:" back"})]})})})]})}import{Box as At,Text as It,useInput as Wd}from"ink";import zd from"ink-spinner";import{useAtom as ms,useAtomValue as qd,useSetAtom as Jd}from"jotai";import{useEffect as Qd,useMemo as Zd,useState as Ct}from"react";io();$t();import{atom as Ki}from"jotai";import{unwrap as ld}from"jotai/utils";var ad=async()=>{let e=So(),t={};for(let o of e){let[r,i]=await Promise.all([_r(o,!1).catch(()=>[]),_r(o,!0).catch(()=>[])]);for(let s of new Set([...r,...i]))t[s]||(t[s]=[]),t[s].includes(o)||t[s].push(o)}return t},Zr=Ki(0),cd=Ki(async e=>(e(Zr),ad())),Ue=ld(cd,e=>e??{});import{atom as Xi}from"jotai";var tr=Xi([]),Yi=Xi([]);import{Box as Ge,Text as ie,useInput as dd}from"ink";import{jsx as se,jsxs as Re}from"react/jsx-runtime";function or({results:e,onExit:t,title:o="Installation Complete",successLabel:r="succeeded"}){dd((m,p)=>{(p.return||p.escape)&&t()});let i=new Set(e.filter(m=>m.success).map(m=>m.skill)),s=new Set(e.filter(m=>!m.success).map(m=>m.skill)),l=i.size,d=s.size,c=l===0&&d>0,u=d>0,g=c?n.error:u?n.warning:n.success,f=c?`${a.cross} Installation Failed`:u?`${a.warning} Partially Installed`:`${a.check} ${o}`,h=c?n.error:u?n.warning:n.success;return Re(Ge,{flexDirection:"column",paddingX:1,children:[se(R,{}),Re(Ge,{flexDirection:"column",borderStyle:"round",borderColor:g,paddingX:2,paddingY:1,children:[se(Ge,{marginBottom:1,children:se(ie,{color:h,bold:!0,children:f})}),e.map((m,p)=>Re(Ge,{flexDirection:"column",children:[Re(Ge,{paddingX:1,children:[se(Ge,{width:2,children:se(ie,{color:m.success?n.success:n.error,children:m.success?a.check:a.cross})}),se(ie,{color:m.success?n.text:n.error,children:m.skill}),Re(ie,{color:n.textDim,children:[" ",a.arrow," ",m.agent]})]}),!m.success&&m.error&&se(Ge,{paddingLeft:4,children:se(ie,{color:n.error,dimColor:!0,children:m.error})})]},p)),(l>0||d>0)&&se(Ge,{marginTop:1,children:Re(ie,{color:n.textDim,children:[l>0&&Re(ie,{color:n.success,children:[l," ",r]}),l>0&&d>0&&Re(ie,{children:[" ",a.dot," "]}),d>0&&Re(ie,{color:n.error,children:[d," failed"]})]})}),se(Ge,{marginTop:1,children:Re(ie,{color:n.textDim,children:["View details: ",se(ie,{color:n.accent,children:"ai-tools skills audit"})]})})]}),se(Ge,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:Re(ie,{children:[se(ie,{color:n.success,bold:!0,children:"enter"}),se(ie,{color:n.textDim,children:" / "}),se(ie,{color:n.warning,bold:!0,children:"esc"}),se(ie,{color:n.textDim,children:" exit"})]})})]})}import{Box as K,Text as U,useInput as fd}from"ink";import gd from"ink-spinner";import{useAtomValue as Wi}from"jotai";import{useMemo as en,useState as tn}from"react";We();import{atom as ud}from"jotai";import{unwrap as md}from"jotai/utils";var pd=ud(async()=>Lo()),zt=md(pd,e=>e??new Map);import{jsx as M,jsxs as j}from"react/jsx-runtime";function rr({selectedAgents:e,onExit:t}){let[o,r]=tn(e||[]),{removeMultiple:i,progress:s,results:l}=fi(),d=Wi(Ue),c=Wi(zt),[u,g]=tn(e?"select":"agent-select"),[f,h]=tn([]),m=e||o,p=en(()=>{let k={};return Object.entries(d).forEach(([T,A])=>{let S=A.filter(L=>m.includes(L));S.length>0&&(k[T]=S)}),k},[d,m]),w=en(()=>Object.keys(p),[p]),B=en(()=>w.map(k=>{let T=c instanceof Map&&c.has(k),A=`${p[k].length} agents: ${p[k].join(", ")}`,S=T?`${A} \u26A0 deprecated`:A;return{label:k,value:k,hint:S}}),[w,p,c]);if(fd((k,T)=>{u==="done"&&(T.return||T.escape)&&t(),w.length===0&&T.escape&&t()}),u==="agent-select")return M(Xt,{onSelect:k=>{r(k),g("select")},onBack:t});if(w.length===0)return j(K,{flexDirection:"column",paddingX:1,children:[M(R,{}),M(K,{borderStyle:"round",borderColor:n.warning,paddingX:2,paddingY:1,children:M(U,{color:n.warning,children:"No skills found to remove for the selected agents."})}),M(K,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:j(U,{children:[M(U,{color:n.warning,bold:!0,children:"esc"}),M(U,{color:n.textDim,children:" exit"})]})})]});let _=k=>{k.length!==0&&(h(k),g("confirm"))},F=async()=>{g("removing");let k=f.map(T=>({name:T,agents:p[T]||[]}));await i(k),g("done")};if(u==="select")return j(K,{flexDirection:"column",paddingX:1,children:[M(R,{}),M(K,{marginBottom:1,children:j(U,{bold:!0,color:n.error,children:[a.diamond," Select skills to remove:"]})}),M(Vt,{items:B,onSubmit:_,onCancel:t})]});if(u==="confirm")return j(K,{flexDirection:"column",paddingX:1,children:[M(R,{}),j(K,{flexDirection:"column",borderStyle:"round",borderColor:n.error,paddingX:2,paddingY:1,children:[M(K,{marginBottom:1,children:j(U,{color:n.error,bold:!0,children:[a.cross," Remove ",f.length," skill",f.length>1?"s":"","?"]})}),f.map(k=>j(K,{paddingX:1,children:[M(K,{width:2,children:M(U,{color:n.error,children:a.dot})}),M(U,{color:n.textDim,children:k})]},k))]}),M(K,{marginTop:1,children:M(Je,{items:[{label:"Yes, remove them",value:"yes"},{label:"No, cancel",value:"no"}],onSelect:k=>{k==="yes"?F():g("select")}})})]});if(u==="removing")return j(K,{flexDirection:"column",paddingX:1,children:[M(R,{}),j(K,{marginTop:1,children:[j(U,{color:n.accent,children:[M(gd,{type:"dots"})," "]}),M(U,{children:"Removing skills..."})]}),M(K,{marginTop:1,paddingX:2,children:j(U,{color:n.textDim,children:[a.arrow," ",s.skill," (",s.current,"/",s.total,")"]})})]});if(u==="done"){let k=l.filter(S=>S.success).length,T=l.filter(S=>!S.success).length,A=k===0;return j(K,{flexDirection:"column",paddingX:1,children:[M(R,{}),j(K,{flexDirection:"column",borderStyle:"round",borderColor:A?n.error:n.success,paddingX:2,paddingY:1,children:[M(K,{marginBottom:1,children:j(U,{color:A?n.error:n.success,bold:!0,children:[A?a.cross:a.check," ",A?"Removal Failed":"Removal Complete"]})}),l.map((S,L)=>j(K,{paddingX:1,children:[M(K,{width:2,children:M(U,{color:S.success?n.success:n.error,children:S.success?a.check:a.cross})}),M(U,{color:S.success?n.text:n.error,children:S.skill}),j(U,{color:n.textDim,children:[" ",a.arrow," ",S.agent]}),!S.success&&S.error&&j(U,{color:n.error,children:[" (",S.error,")"]})]},L)),(k>0||T>0)&&M(K,{marginTop:1,children:j(U,{color:n.textDim,children:[k>0&&j(U,{color:n.success,children:[k," succeeded"]}),k>0&&T>0&&j(U,{children:[" ",a.dot," "]}),T>0&&j(U,{color:n.error,children:[T," failed"]})]})})]}),M(K,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:j(U,{children:[M(U,{color:n.success,bold:!0,children:"enter"}),M(U,{color:n.textDim,children:" / "}),M(U,{color:n.warning,bold:!0,children:"esc"}),M(U,{color:n.textDim,children:" exit"})]})})]})}return null}import{Box as J,Text as Ie,useInput as Fd,useStdout as $d}from"ink";import{useAtomValue as sn}from"jotai";import{useMemo as ln,useState as rt}from"react";import{Box as qi,Text as qt}from"ink";import{useMemo as hd}from"react";function zi(e,t){return e>0?`(${e}/${t})`:`(${t})`}import{jsx as nr,jsxs as ir}from"react/jsx-runtime";var Ji=({name:e,totalCount:t,installedCount:o=0,isExpanded:r=!1,isFocused:i=!1})=>{let s=hd(()=>zi(o,t),[o,t]),l=r?"\u25BE":"\u25B8";return ir(qi,{children:[nr(qi,{width:2,children:i?nr(qt,{color:n.accent,children:a.bullet}):nr(qt,{children:" "})}),ir(qt,{color:i?n.accent:n.primaryLight,bold:!0,children:[l," "]}),nr(qt,{color:i?n.accent:n.text,bold:!0,children:e}),ir(qt,{color:o>0?n.success:n.textMuted,children:[" ",s]}),!r&&i&&ir(qt,{color:n.textDim,children:[" ",a.dot," press space to expand"]})]})};import{Box as Mh,Text as _h,useInput as Oh}from"ink";import{useState as Fh}from"react";import{jsx as Gh,jsxs as Hh}from"react/jsx-runtime";import{Box as sr,Text as Qi}from"ink";import xd from"ink-text-input";import{jsx as Jt,jsxs as yd}from"react/jsx-runtime";var Zi=({query:e,onChange:t,total:o,filtered:r,isLoading:i=!1,focus:s=!0})=>yd(sr,{borderStyle:"round",borderColor:s?n.accent:n.border,paddingX:1,children:[Jt(sr,{marginRight:1,children:Jt(Qi,{children:"\u{1F50D}"})}),Jt(sr,{flexGrow:1,children:Jt(xd,{value:e,onChange:t,placeholder:"Type to filter skills...",focus:s})}),Jt(sr,{marginLeft:1,children:Jt(Qi,{color:n.textDim,children:i?"Loading...":`${r}/${o} skills`})})]});import{Box as Tt,Text as lr}from"ink";import{Box as kd,Text as bd}from"ink";import{jsx as wd,jsxs as Td}from"react/jsx-runtime";var Sd={installed:{icon:a.check,label:"installed",color:n.success,bg:"#052e16"},update:{icon:a.arrowUp,label:"update",color:n.warning,bg:"#422006"},new:{icon:a.sparkle,label:"new",color:n.accent,bg:"#083344"},deprecated:{icon:a.warning,label:"deprecated",color:n.warning,bg:"#422006"}};function es({status:e}){let t=Sd[e];return t?wd(kd,{children:Td(bd,{backgroundColor:t.bg,color:t.color,children:[" ",t.icon," ",t.label," "]})}):null}import{jsx as He,jsxs as ts}from"react/jsx-runtime";function os({name:e,description:t,status:o,selected:r=!1,focused:i=!1,readOnly:s=!1}){let l=o==="installed",d=l?a.checkboxActive:r?a.checkboxActive:a.checkboxInactive,c=l?n.textMuted:r?n.success:n.textMuted,u=i?a.bullet:" ",g=l?n.textMuted:r?n.success:n.accent,f=l?n.textDim:i?n.primary:r?n.primaryLight:n.text,h=n.textMuted,m=i?n.bgLight:void 0;return ts(Tt,{flexDirection:"column",backgroundColor:m,children:[ts(Tt,{children:[He(Tt,{width:2,flexShrink:0,children:He(lr,{color:g,children:u})}),!s&&He(Tt,{width:2,flexShrink:0,children:He(lr,{color:c,children:d})}),He(Tt,{flexGrow:1,children:He(lr,{bold:!0,color:f,children:e})}),o&&He(Tt,{marginLeft:1,flexShrink:0,children:He(es,{status:o})})]}),He(Tt,{paddingLeft:s?2:4,children:He(lr,{color:h,wrap:"truncate",children:t})})]})}import je from"chalk";import{Box as wt,Text as re,useInput as Ad,useStdout as Id}from"ink";import Dd from"ink-spinner";import ss,{useCallback as vd,useEffect as Ed,useMemo as Bd,useRef as rn,useState as Ld}from"react";var on={web:"#3b82f6",devops:"#10b981",data:"#8b5cf6",mobile:"#f59e0b",testing:"#ef4444",ai:"#06b6d4",security:"#ec4899",default:"#64748b"};function rs(e){return Object.prototype.hasOwnProperty.call(on,e)?on[e]:on.default}function Cd(e){if(!e.startsWith("---"))return e;let t=e.indexOf("---",3);return t===-1?e:e.slice(t+3).trimStart()}function ns(e){let o=Cd(e).split(`
10
+ `),r=[],i=0;for(;i<o.length;){let s=o[i];if(s.startsWith("```")){let c=s.slice(3).trim(),u=[];for(i++;i<o.length&&!o[i].startsWith("```");)u.push(o[i]),i++;r.push({type:"code-block",language:c,lines:u}),i++;continue}if(s.trim()===""){r.push({type:"blank"}),i++;continue}if(/^(-{3,}|_{3,}|\*{3,})$/.test(s.trim())){r.push({type:"hr"}),i++;continue}let l=s.match(/^(#{1,3})\s+(.+)$/);if(l){r.push({type:"heading",level:l[1].length,text:l[2]}),i++;continue}let d=s.match(/^(\s*)([-*]|\d+\.)\s+(.+)$/);if(d){let c=Math.floor(d[1].length/2);r.push({type:"list-item",text:d[3],indent:c}),i++;continue}r.push({type:"paragraph",text:s}),i++}return r}import{Fragment as Od,jsx as fe,jsxs as ke}from"react/jsx-runtime";var Pd=6,Rd=2,Md=2,ye={h1:e=>je.hex(n.primary).bold(e),h2:e=>je.hex(n.primaryLight).bold(e),h3:e=>je.hex(n.accent).bold(e),text:e=>je.hex(n.textDim)(e),muted:e=>je.hex(n.textMuted)(e),code:e=>je.hex(n.accent)(e),border:e=>je.hex(n.border)(e),bold:e=>je.hex(n.text).bold(e),dim:e=>je.dim(e),indicator:e=>je.hex(n.textDim)(e)};function is(e){return e.replace(/\*\*(.+?)\*\*/g,(t,o)=>ye.bold(o)).replace(/\*(.+?)\*/g,(t,o)=>ye.dim(o)).replace(/`(.+?)`/g,(t,o)=>ye.code(o))}function _d(e){let t=[];for(let o of e)switch(o.type){case"heading":{let r=o.level===1?a.diamond:o.level===2?a.arrow:a.dot,i=o.level===1?ye.h1:o.level===2?ye.h2:ye.h3;o.level===1&&t.length>0&&t.push(""),t.push(i(`${r} ${o.text}`));break}case"paragraph":t.push(ye.text(is(o.text)));break;case"list-item":{let r=" ".repeat(o.indent);t.push(`${r}${ye.muted(a.bullet)} ${ye.text(is(o.text))}`);break}case"code-block":o.language&&t.push(ye.dim(` ${o.language}`));for(let r of o.lines)t.push(` ${ye.border(a.bar)} ${ye.code(r)}`);break;case"hr":t.push(ye.border("\u2500".repeat(30)));break;case"blank":t.push("");break}return t}var ls=ss.memo(({skill:e,metadata:t})=>{let o=rs(e.category??"default"),r=t?.author?` ${a.dot} @${t.author}`:"",i=t?.files?.length?` ${a.dot} ${t.files.length} file${t.files.length!==1?"s":""}`:"";return ke(wt,{flexDirection:"column",marginBottom:1,children:[ke(re,{bold:!0,color:n.text,children:[a.sparkle," ",e.name]}),ke(re,{children:[fe(re,{color:o,bold:!0,children:e.category}),ke(re,{color:n.textDim,children:[r,i]})]}),fe(re,{color:n.textDim,wrap:"truncate",children:e.description})]})});ls.displayName="MetadataHeader";var nn=ss.memo(({skill:e,expanded:t=!1,onClose:o,onToggleExpand:r})=>{let{metadata:i,content:s,loading:l,error:d}=gi(e?.name??null),{stdout:c}=Id(),[u,g]=Ld(0),f=c?.rows??24,h=Bd(()=>s?_d(ns(s)):[],[s]),m=Math.max(10,f-17),p=Math.max(3,m-Pd-Rd),w=Math.max(1,p-Md),B=Math.max(0,h.length-w),_=B>0,F=_?Math.round((u+w)/h.length*100):100,k=rn(B);k.current=B;let T=rn(o);T.current=o;let A=rn(r);A.current=r;let S=vd((I,C)=>{C.upArrow?g(y=>Math.max(0,y-1)):C.downArrow?g(y=>Math.min(k.current,y+1)):I==="f"?A.current?.():(C.escape||C.tab||C.leftArrow)&&T.current()},[]);if(Ad(S),Ed(()=>{g(0)},[e?.name]),!e)return null;let L=u>0,O=u+w<h.length,V=h.slice(u,u+w);return ke(wt,{flexDirection:"column",borderStyle:"round",borderColor:n.accent,paddingX:1,flexGrow:1,children:[ke(wt,{children:[ke(re,{bold:!0,color:n.accent,children:[a.info," Skill Details"]}),fe(wt,{flexGrow:1}),ke(re,{color:n.textMuted,children:[_&&ke(re,{color:n.textDim,children:[F,"% ",a.dot," "]}),fe(re,{color:n.accent,bold:!0,children:"\u2191\u2193"})," ","scroll ",a.dot," ",fe(re,{color:n.accent,bold:!0,children:"f"})," ",t?"compact":"expand"," ",a.dot," ",fe(re,{color:n.accent,bold:!0,children:"Esc"})," ","close"]})]}),fe(re,{color:n.border,wrap:"truncate",children:"\u2500".repeat(200)}),l?fe(wt,{alignItems:"center",justifyContent:"center",flexGrow:1,children:ke(re,{color:n.accent,children:[fe(Dd,{type:"dots"})," Loading\u2026"]})}):d?fe(wt,{alignItems:"center",justifyContent:"center",flexGrow:1,children:ke(re,{color:n.error,children:[a.cross," ",d]})}):ke(Od,{children:[fe(ls,{skill:e,metadata:i}),ke(wt,{flexDirection:"column",height:p,overflowY:"hidden",children:[L&&fe(re,{color:n.textDim,children:` ${a.arrowUp} ${a.arrowUp} ${a.arrowUp}`}),fe(re,{children:V.join(`
11
+ `)}),O&&fe(re,{color:n.textDim,children:` ${a.arrowDown} ${a.arrowDown} ${a.arrowDown}`})]})]})]})});nn.displayName="SkillDetailPanel";function Nd(){return{width:process.stdout.columns||80,height:process.stdout.rows||24}}function as(){let{width:e,height:t}=Nd();return e>=80&&t>=24}import{Fragment as Vd,jsx as H,jsxs as le}from"react/jsx-runtime";var Ud=5,Gd=24,Hd=.35,jd=e=>{let t=[{key:"/",description:"Filter skills"},{key:"\u2190/\u2192",description:"Collapse / expand"},{key:"tab/\u2192",description:"Skill details"},{key:"f",description:"Expand / compact panel"}],o={key:"esc",description:e?"Exit / close panel":"Back / close panel"};return e?[...t,o]:[...t,{key:"space",description:"Toggle / expand"},{key:"enter",description:"Install selected"},{key:"ctrl+a",description:"Select all"},o]},ar=({onInstall:e,onExit:t,overrideSkills:o,readOnly:r=!1})=>{let{skills:i,loading:s,error:l}=lt(),{stdout:d}=$d(),c=sn(tr),u=sn(Ue),g=sn(zt),f=o||i,h=o?!1:s,{query:m,setQuery:p,filtered:w}=En(f,{keys:["name","description","category"]}),[B,_]=rt(new Set),[F,k]=rt("list"),[T,A]=rt(0),[S,L]=rt(0),[O,V]=rt(!1),[I,C]=rt(!1),[y,v]=rt(null),[Q,Z]=rt(!1),[yo,Ke]=rt(null),ee=as(),_e=d?.rows??40,dr=d?.columns??120,Xe=Math.max(Ud,_e-Gd),Es=Math.max(30,Math.round(dr*Hd)),Bs=Math.max(10,_e-17),mn=m.trim().length>0,pn=ln(()=>$o(w),[w]);ln(()=>{m&&V(!0)},[m]);let oo=x=>mn||yo===x,fn=x=>{Ke(oo(x)?null:x)},Se=ln(()=>{let x=[];for(let[P,Te]of pn.entries()){let Et=Te.filter(ro=>{let ko=u[ro.name]||[];return c.length>0?ko.some(xn=>c.includes(xn)):ko.length>0}).length;x.push({type:"header",category:P.name,categoryId:P.id,count:Te.length,installedCount:Et}),oo(P.name)&&Te.forEach(ro=>x.push({type:"skill",skill:ro}))}return x},[pn,yo,mn,u,c]),Ls=()=>C(x=>!x),Ps=()=>{if(O){V(!1),p(""),k("list");return}t?.()},Rs=()=>{let x=w.map(P=>P.name);_(B.size===x.length?new Set:new Set(x))},Ms=x=>{(x.downArrow||x.return)&&Se.length>0&&(k("list"),A(0))},_s=()=>{if(T===0&&O){k("search");return}let x=Math.max(0,T-1);A(x),x<S&&L(x)},Os=()=>{let x=Math.min(Se.length-1,T+1);A(x),x>=S+Xe&&L(x-Xe+1)},Ns=()=>{let x=Se[T];if(x.type==="header"){fn(x.category);return}if(x.type==="skill"&&!r){if((c.length>0?u[x.skill.name]?.some(Et=>c.includes(Et))??!1:(u[x.skill.name]?.length??0)>0)&&!o)return;let Te=new Set(B);Te.has(x.skill.name)?Te.delete(x.skill.name):Te.add(x.skill.name),_(Te)}},Fs=()=>{let x=Se[T];if(x.type==="header"){fn(x.category);return}if(r)return;let P=f.filter(Te=>B.has(Te.name));P.length>0&&e?.(P)},gn=x=>{let P=Se[T];if(P.type==="skill"&&ee){v(P.skill),Z(!1);return}!x&&P.type==="header"&&!oo(P.category)&&Ke(P.category)},$s=()=>{let x=Se[T];x.type==="header"&&oo(x.category)&&Ke(null)},Us=(x,P)=>x.length===1&&!P.ctrl&&!P.meta&&!P.upArrow&&!P.downArrow&&!P.leftArrow&&!P.rightArrow;Fd((x,P)=>{if(x==="?")return Ls();if(I)return C(!1);if(P.escape)return Ps();if(!O&&x==="/"){V(!0),k("search");return}if(x==="a"&&P.ctrl&&!r)return Rs();if(F==="search")return Ms(P);if(F==="list"){if(P.upArrow)return _s();if(P.downArrow)return Os();if(x===" ")return Ns();if(P.return)return Fs();if(P.tab)return gn(!0);if(P.rightArrow)return gn(!1);if(P.leftArrow)return $s();Us(x,P)&&(V(!0),k("search"),p(x))}},{isActive:!y});let Gs=Se.slice(S,S+Xe),Hs=S>0,js=S+Xe<Se.length,Vs=Se.length<=Xe?100:Math.round((S+Xe)/Se.length*100),Ks=!y||!Q;if(h)return le(J,{flexDirection:"column",paddingX:1,children:[H(R,{}),H(J,{flexDirection:"column",alignItems:"center",justifyContent:"center",paddingY:4,children:H(Ie,{color:n.accent,children:"Loading skills..."})})]});if(l||!h&&f.length===0)return le(J,{flexDirection:"column",paddingX:1,minHeight:20,children:[H(R,{}),le(J,{flexDirection:"column",alignItems:"center",justifyContent:"center",flexGrow:1,children:[le(J,{flexDirection:"column",borderStyle:"round",borderColor:n.error,paddingX:3,paddingY:2,alignItems:"center",children:[le(Ie,{color:n.error,bold:!0,children:[a.cross," No Skills Available"]}),H(J,{marginTop:1,children:H(Ie,{color:n.textDim,children:"Check your internet connection and try again"})}),l&&H(J,{marginTop:1,children:H(Ie,{color:n.textMuted,dimColor:!0,children:l})})]}),H(J,{marginTop:2,children:le(Ie,{color:n.textDim,children:["Press"," ",H(Ie,{color:n.accent,bold:!0,children:"Esc"})," ","to exit"]})})]})]});let Xs=(x,P)=>{let Te=S+P,Et=F==="list"&&Te===T;if(x.type==="header")return H(J,{marginTop:P===0?0:1,children:H(Ji,{name:x.category,categoryId:x.categoryId,totalCount:x.count,installedCount:x.installedCount,isExpanded:oo(x.category),isFocused:Et})},`cat-${x.category}`);let ro=B.has(x.skill.name),ko=c.length>0?u[x.skill.name]?.some(qs=>c.includes(qs))??!1:(u[x.skill.name]?.length??0)>0,zs=g instanceof Map&&g.has(x.skill.name)?"deprecated":ko?"installed":null;return H(os,{name:x.skill.name,description:x.skill.description,status:zs,selected:ro,focused:Et,readOnly:r},x.skill.name)},hn=x=>H(J,{justifyContent:"center",marginBottom:x==="up"?1:0,marginTop:x==="down"?1:0,children:le(Ie,{color:n.textDim,children:[x==="up"?a.arrowUp:a.arrowDown," ",x==="up"?a.arrowUp:a.arrowDown," ",x==="up"?a.arrowUp:a.arrowDown]})}),Ys=()=>y?[{key:"\u2191/\u2193",label:"scroll"},{key:"f",label:Q?"compact":"expand"},{key:"Esc",label:"close",color:n.warning}]:r?[{key:"/",label:"filter"},{key:"tab",label:"detail"},{key:"esc",label:"exit",color:n.warning},{key:"?",label:"help"}]:[{key:"space",label:"toggle"},{key:"enter",label:"install",color:n.success},{key:"/",label:"filter"},{key:"tab",label:"detail"},{key:"esc",label:"exit",color:n.warning},{key:"?",label:"help"}],Ws=()=>{if(!y)return le(Vd,{children:[!r&&B.size>0&&le(Ie,{children:[le(Ie,{color:n.success,bold:!0,children:[a.checkboxActive," ",B.size]}),H(Ie,{color:n.textDim,children:" selected"})]}),Se.length>Xe&&le(Ie,{color:n.textDim,children:[!r&&B.size>0?` ${a.dot} `:"",Vs,"%"]})]})};return le(J,{flexDirection:"column",paddingX:1,minHeight:20,children:[H(R,{}),I?H(J,{flexDirection:"column",flexGrow:1,alignItems:"center",justifyContent:"center",children:H(jt,{visible:I,onDismiss:()=>C(!1),shortcuts:jd(r)})}):le(J,{flexDirection:"row",height:y?Bs:void 0,flexGrow:y?0:1,overflow:"hidden",children:[Ks&&le(J,{flexDirection:"column",flexGrow:1,flexShrink:1,children:[O&&H(J,{marginBottom:1,children:H(Zi,{query:m,onChange:x=>{p(x),A(0),L(0)},total:f.length,filtered:w.length,isLoading:h,focus:F==="search"})}),le(J,{flexDirection:"column",flexGrow:1,children:[Hs&&hn("up"),Gs.map(Xs),js&&hn("down"),Se.length===0&&H(J,{paddingY:1,children:le(Ie,{color:n.textMuted,children:['No skills match "',m,'"']})})]})]},"skill-list"),y&&H(J,{flexDirection:"column",width:Q?void 0:Es,flexGrow:Q?1:0,flexShrink:0,children:H(nn,{skill:y,expanded:Q,onClose:()=>{v(null),Z(!1)},onToggleExpand:()=>Z(x=>!x)})},"detail-panel")]}),H(at,{hints:Ys(),status:Ws()})]})};import{Box as ge,Text as ae,useInput as Kd}from"ink";import cs from"ink-spinner";import{useAtomValue as ds}from"jotai";import{useEffect as Xd,useMemo as us,useState as Qt}from"react";We();import{jsx as X,jsxs as z}from"react/jsx-runtime";function cr({selectedAgents:e,onExit:t}){let[o,r]=Qt(!1),[i,s]=Qt(!1),[l,d]=Qt(!1),[c,u]=Qt(e||[]),[g,f]=Qt(!e),[h,m]=Qt([]),{install:p,progress:w,results:B,installing:_}=_o(),F=ds(Ue),k=ds(zt),{skills:T,loading:A}=lt(),S=e||c,L=us(()=>{if(A)return[];let I=new Set(Object.keys(F));return T.filter(C=>I.has(C.name)?(F[C.name]||[]).some(v=>S.includes(v)):!1)},[F,T,A,S]),O=us(()=>{if(A||!(k instanceof Map)||k.size===0)return[];let I=new Set(Object.keys(F)),C=new Set(T.map(v=>v.name)),y=[];for(let v of I)k.has(v)?y.push({name:v,entry:k.get(v)}):C.has(v)||y.push({name:v});return y},[F,T,A,k]);if(Xd(()=>{if(L.length===0){r(!1),s(!0);return}r(!0),(async()=>{let C=L.map(Q=>Q.name),{toUpdate:y}=await Bo(C),v=L.filter(Q=>y.includes(Q.name));m(v),r(!1),s(!0)})()},[L]),Kd((I,C)=>{C.escape&&!_&&!l&&!o&&i&&h.length===0&&t()}),g)return X(Xt,{onSelect:I=>{u(I),f(!1)},onBack:t});let V=async I=>{if(I.length===0)return;let C=new Set;I.forEach(y=>{(F[y.name]||[]).forEach(Q=>{S.includes(Q)&&C.add(Q)})}),await p(I,{agents:Array.from(C),method:"copy",global:!1,skills:I.map(y=>y.name),isUpdate:!0}),d(!0)};return l?X(or,{results:B,onExit:t,title:"Skills Updated Successfully",successLabel:"updated"}):_?z(ge,{flexDirection:"column",paddingX:1,children:[X(R,{}),z(ge,{marginTop:1,children:[z(ae,{color:n.accent,children:[X(cs,{type:"dots"})," "]}),X(ae,{children:"Updating skills..."})]}),X(ge,{marginTop:1,paddingX:2,children:z(ae,{color:n.textDim,children:[a.arrow," ",w.skill," (",w.current,"/",w.total,")"]})})]}):A||o?z(ge,{flexDirection:"column",paddingX:1,children:[X(R,{}),X(ge,{marginTop:1,children:z(ae,{color:n.accent,children:[X(cs,{type:"dots"})," ",o?"Checking for updates...":"Loading..."]})})]}):i&&h.length===0?z(ge,{flexDirection:"column",paddingX:1,children:[X(R,{}),X(ge,{borderStyle:"round",borderColor:n.success,paddingX:2,paddingY:1,children:z(ae,{color:n.success,children:[a.check," All installed skills are up to date!"]})}),O.length>0&&z(ge,{flexDirection:"column",marginTop:1,borderStyle:"round",borderColor:n.warning,paddingX:2,paddingY:1,children:[X(ge,{marginBottom:1,children:z(ae,{color:n.warning,bold:!0,children:[a.warning," ",O.length," deprecated skill",O.length>1?"s":""," detected:"]})}),O.map(I=>z(ge,{flexDirection:"column",paddingX:1,marginBottom:1,children:[z(ae,{color:n.warning,children:[a.arrow," ",I.name]}),I.entry?.message&&z(ae,{color:n.textDim,children:[" ",I.entry.message]}),!I.entry&&X(ae,{color:n.textDim,children:" No longer available in the registry"}),I.entry?.alternatives&&I.entry.alternatives.length>0&&z(ae,{color:n.textDim,children:[" ","Try: ai-tools skills install --skill ",I.entry.alternatives.join(", ")]})]},I.name)),z(ae,{color:n.textMuted,children:["Run: ai-tools skills remove --skill ","<name>"," to clean up"]})]}),X(ge,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:z(ae,{children:[X(ae,{color:n.warning,bold:!0,children:"esc"}),X(ae,{color:n.textDim,children:" exit"})]})})]}):X(Yd,{skills:h,installedSkills:F,selectedAgents:S,onUpdate:V,onExit:t})}function Yd({skills:e,installedSkills:t,selectedAgents:o,onUpdate:r,onExit:i}){let s=e.map(c=>{let g=(t[c.name]||[]).filter(f=>o.includes(f));return{label:c.name,value:c.name,hint:`${g.length} agent${g.length>1?"s":""}: ${g.join(", ")}`}}),l=e.map(c=>c.name),d=c=>{let u=e.filter(g=>c.includes(g.name));r(u)};return z(ge,{flexDirection:"column",paddingX:1,children:[X(R,{}),X(ge,{marginBottom:1,children:z(ae,{bold:!0,color:n.primary,children:[a.diamond," Select skills to update:"]})}),X(ge,{marginBottom:1,children:z(ae,{color:n.textDim,children:[e.length," installed skill",e.length>1?"s":""," found ",a.dot," all pre-selected"]})}),X(Vt,{items:s,initialSelected:l,onSubmit:d,onCancel:i})]})}import{jsx as ne,jsxs as nt}from"react/jsx-runtime";function ps({onExit:e}){let{step:t,next:o,back:r}=yi(5),[i,s]=ms(tr),[l,d]=ms(Yi),c=Jd(Zr),u=qd(Ue),[g,f]=Ct("install"),[h,m]=Ct(!1),[p,w]=Ct(!1),[B,_]=Ct(!1),[F,k]=Ct({method:"copy",global:!1}),{skills:T}=lt(),{install:A,progress:S,results:L,installing:O}=_o(),[V,I]=Ct(!1),[C,y]=Ct(!1),v=ee=>{ee.length!==0&&(s(ee),o())},Q=ee=>{if(f(ee),ee==="update"){w(!0);return}if(ee==="remove"){_(!0);return}o()},Z=ee=>{ee.length!==0&&(d(ee),o())},yo=ee=>{k(ee),o()},Ke=Zd(()=>{if(g==="install")return;let ee=new Set;return Object.entries(u).forEach(([_e,dr])=>{dr.some(Xe=>i.includes(Xe))&&ee.add(_e)}),T.filter(_e=>ee.has(_e.name))},[g,u,T,i]);return Qd(()=>{(async()=>t===5&&!V&&!C&&(I(!0),await A(l,{agents:i,skills:l.map(_e=>_e.name),method:F.method,global:F.global}),y(!0),c(_e=>_e+1)))()},[t,V,C,A,l,i,c]),t===5?C?ne(or,{results:L,onExit:e,title:"Installation Complete",successLabel:"installed"}):nt(At,{flexDirection:"column",paddingX:1,children:[ne(R,{}),nt(At,{marginTop:1,children:[nt(It,{color:n.accent,children:[ne(zd,{type:"dots"})," "]}),nt(It,{children:["Installing ",l.length," skills to ",i.length," agents..."]})]}),O&&ne(At,{marginTop:1,paddingX:2,children:nt(It,{color:n.textDim,children:[a.arrow," ",S.skill," (",S.current,"/",S.total,")"]})})]}):p?ne(cr,{selectedAgents:i,onExit:()=>w(!1)}):B?ne(rr,{selectedAgents:i,onExit:()=>_(!1)}):h?ne(er,{onExit:()=>m(!1)}):nt(At,{flexDirection:"column",children:[t===1&&ne(Xt,{onSelect:v,onBack:e}),t===2&&ne(Li,{onSelect:Q,onBack:r,onCredits:()=>m(!0)}),t===3&&(g==="install"||Ke&&Ke.length>0)&&ne(ar,{onInstall:Z,onExit:r,overrideSkills:Ke}),t===3&&g==="update"&&Ke&&Ke.length===0&&ne(eu,{onBack:r}),t===4&&ne(Vi,{onConfirm:yo,onBack:r,initialMethod:"copy",initialGlobal:!1})]})}function eu({onBack:e}){return Wd((t,o)=>{(o.escape||t==="b"||o.backspace)&&e()}),nt(At,{flexDirection:"column",paddingX:1,children:[ne(R,{}),ne(At,{borderColor:n.success,borderStyle:"round",paddingX:2,paddingY:1,children:nt(It,{color:n.success,bold:!0,children:[a.check," All skills are up to date on selected agents"]})}),ne(At,{marginTop:1,borderStyle:"round",borderColor:n.border,paddingX:1,children:nt(It,{children:[ne(It,{color:n.warning,bold:!0,children:"esc"}),ne(It,{color:n.textDim,children:" back"})]})})]})}import{Box as fs,Text as an}from"ink";import{useAtomValue as tu}from"jotai";import{useMemo as ou}from"react";import{jsx as Zt,jsxs as gs}from"react/jsx-runtime";function hs({onExit:e}){let t=tu(Ue),{skills:o,loading:r}=lt(),i=ou(()=>{if(r)return[];let s=new Set(Object.keys(t));return o.filter(l=>s.has(l.name))},[t,o,r]);return r?gs(fs,{flexDirection:"column",padding:1,children:[Zt(R,{}),Zt(an,{children:"Loading..."})]}):i.length===0?gs(fs,{flexDirection:"column",padding:1,children:[Zt(R,{}),Zt(an,{color:n.warning,children:"No skills installed."}),Zt(an,{color:n.textDim,children:"(Press any key to exit)"})]}):Zt(ar,{onExit:e,readOnly:!0,overrideSkills:i})}import{jsx as dt,jsxs as su}from"react/jsx-runtime";var Dt=({command:e="install"})=>{let{exit:t}=ru(),[o,r]=iu(e==="arcade"),{activated:i,reset:s}=pi();return nu(()=>{i&&!o&&(r(!0),s())},[i,o,s]),e==="credits"?dt(cn,{flexDirection:"column",padding:1,children:dt(er,{onExit:t})}):o?dt(cn,{flexDirection:"column",padding:1,children:dt(jr,{onExit:()=>{e==="arcade"?t():r(!1)}})}):su(cn,{flexDirection:"column",padding:1,children:[e==="list"&&dt(hs,{onExit:t}),e==="remove"&&dt(rr,{onExit:t}),e==="update"&&dt(cr,{onExit:t}),(e==="install"||!e)&&dt(ps,{onExit:t})]})};var dn=new yu;dn.name("ai-tools").description("CLI to install and manage AI tools (Skills, MCPs, Agents) for AI coding agents").version(Gt);var pt=dn.command("skills").description("Manage AI coding agent skills");pt.action(()=>{eo(to.createElement(Dt,{command:"install"}))});pt.command("install").description("Install skills (interactive by default)").option("-g, --global","Install globally to user home",!1).option("-s, --skill <names...>","Install one or more skills").option("-a, --agent <agents...>","Target specific agents").option("--symlink","Use symlink instead of copy",!1).option("-f, --force","Force re-download skills (bypass cache)",!1).action(async e=>{if(un(e)){eo(to.createElement(Dt,{command:"install"}));return}let{runCliInstall:t}=await Promise.resolve().then(()=>(ys(),xs));await t(e)});pt.command("list").alias("ls").description("List available/installed agent skills").action(()=>{eo(to.createElement(Dt,{command:"list"}))});pt.command("remove").alias("rm").description("Remove installed skills").option("-g, --global","Remove from global installation",!1).option("-s, --skill <names...>","Remove one or more skills").option("-a, --agent <agents...>","Target specific agents").option("-f, --force","Force removal even if not in lockfile",!1).action(async e=>{if(un(e)){eo(to.createElement(Dt,{command:"remove"}));return}let{runCliRemove:t}=await Promise.resolve().then(()=>(bs(),ks));await t(e)});pt.command("update").description("Update installed skills to the latest version").option("-s, --skill <name>","Update a specific skill").action(async e=>{if(un(e)){eo(to.createElement(Dt,{command:"update"}));return}let{runCliUpdate:t}=await Promise.resolve().then(()=>(Ts(),Ss));await t(e)});pt.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(()=>(Cs(),ws));t(e)});pt.command("credits").description("Show project contributors and credits").action(()=>{eo(to.createElement(Dt,{command:"credits"}))});pt.command("audit").description("View audit log of skill operations").option("-n, --limit <number>","Number of entries to show","10").option("--path","Show audit log file path").action(async e=>{let{runCliAudit:t}=await Promise.resolve().then(()=>(vs(),Ds));await t(e)});dn.parse(process.argv);function un(e){return Object.keys(e).filter(o=>o!=="parent").length===0}
12
+ //# sourceMappingURL=index.js.map