gobot-tools 1.0.0 → 1.1.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.
Files changed (3) hide show
  1. package/README.md +183 -43
  2. package/dist/index.js +61 -54
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  CLI marketplace for the **Autonomee** community. Browse, install, and configure integrations for your AI Telegram bot — all from the command line.
4
4
 
5
- Each tool is an interactive setup guide designed for [Claude Code](https://claude.ai/claude-code). Install a tool, open its prompt, and Claude walks you through the rest.
5
+ Each tool is an interactive setup guide designed for [Claude Code](https://claude.ai/claude-code). Install a tool, open its prompt, and Claude walks you through the rest — API keys, code changes, testing, and deployment.
6
6
 
7
7
  ## Quick Start
8
8
 
@@ -14,61 +14,193 @@ bun add -g gobot-tools
14
14
  npx gobot-tools list
15
15
  ```
16
16
 
17
- ### First-Time Setup
18
-
19
17
  ```bash
20
- # Point gobot-tools at your bot project
21
- gobot-tools init
18
+ gobot-tools init # Point at your bot project
19
+ gobot-tools list # Browse all tools
20
+ gobot-tools info oura-ring # Details before you install
21
+ gobot-tools install oura-ring # Download the setup guide
22
+ ```
23
+
24
+ After installing, open the tool's `prompt.md` in Claude Code and follow the guided setup.
22
25
 
23
- # Browse available tools
24
- gobot-tools list
26
+ ---
25
27
 
26
- # Get details on a specific tool
27
- gobot-tools info oura-ring
28
+ ## Integrations
28
29
 
29
- # Install a tool into your project
30
- gobot-tools install oura-ring
31
- ```
30
+ ### [Microsoft 365](packages/ms365) `gobot-tools install ms365`
32
31
 
33
- After installing, open the tool's `prompt.md` in Claude Code and follow the guided setup.
32
+ Connect your bot to Outlook Calendar, Email, and Microsoft To Do via the Microsoft Graph API. Ask your bot "What's on my schedule today?" or "Do I have any unread emails?" and get real answers from your actual account.
33
+
34
+ - Calendar reads/writes with natural language dates
35
+ - Unread email summaries
36
+ - Microsoft To Do task management
37
+ - Auto-inclusion in daily morning briefings
38
+ - **Setup time:** ~10 minutes
39
+ - **Requires:** `MS365_CLIENT_ID`, `MS365_TENANT_ID`, `MS365_REFRESH_TOKEN`
40
+
41
+ ### [Google Calendar & Sheets](packages/google-api) — `gobot-tools install google-api`
42
+
43
+ Connect your bot to Google Calendar and Google Sheets using lightweight Python CLI scripts and a TypeScript client. Bypasses flaky MCP servers with direct API calls that actually work.
44
+
45
+ - Calendar: list, create, delete, search events
46
+ - Sheets: read, write, append, create spreadsheets
47
+ - Drive: search spreadsheets by name
48
+ - Shared OAuth credentials — one auth flow covers everything
49
+ - **Setup time:** ~15 minutes
50
+ - **Requires:** `GOOGLE_SHEETS_CLIENT_ID`, `GOOGLE_SHEETS_CLIENT_SECRET`, `GOOGLE_SHEETS_REFRESH_TOKEN`
51
+
52
+ ### [Tempest Weather Station](packages/tempest-weather) — `gobot-tools install tempest-weather`
53
+
54
+ Connect your bot to a WeatherFlow Tempest personal weather station. Get live conditions from your own backyard instead of generic internet forecasts. Uses direct API calls to bypass Claude's web search for speed and accuracy.
55
+
56
+ - Live conditions: temperature, humidity, wind, pressure, rain, UV, lightning
57
+ - 5-day forecast
58
+ - Natural language triggers — "Is it cold outside?", "What's the weather?"
59
+ - Intentional Claude bypass for accurate local readings
60
+ - **Setup time:** ~5 minutes
61
+ - **Requires:** `TEMPEST_TOKEN`, `TEMPEST_STATION_ID`
62
+
63
+ ### [Fireflies.ai Meeting Transcripts](packages/fireflies) — `gobot-tools install fireflies`
64
+
65
+ Connect your bot to Fireflies.ai so meeting transcripts are automatically stored in memory. Summaries become searchable facts, action items become trackable goals, and you get a Telegram notification when it's done.
66
+
67
+ - Automatic meeting summary storage
68
+ - Action items saved as trackable goals
69
+ - Webhook-based — no polling, no manual steps
70
+ - Searchable via semantic memory — "What did we discuss in the Q1 meeting?"
71
+ - **Setup time:** ~10 minutes
72
+ - **Requires:** `FIREFLIES_API_KEY`, `FIREFLIES_WEBHOOK_SECRET`
73
+
74
+ ### [FlightAware Flight Tracking](packages/flightaware) — `gobot-tools install flightaware`
75
+
76
+ Real-time flight tracking via FlightAware AeroAPI. Look up any flight, set up active tracking with proactive Telegram notifications for gate changes, delays, and arrivals, and pull travel data into morning briefings.
77
+
78
+ - One-time flight lookups by flight number
79
+ - Active tracking with push notifications for status changes
80
+ - Morning briefing integration for upcoming travel
81
+ - Cost guardrails to stay within API limits
82
+ - **Setup time:** ~10 minutes
83
+ - **Requires:** `FLIGHTAWARE_API_KEY`
84
+
85
+ ---
86
+
87
+ ## Health
88
+
89
+ ### [Oura Ring + Health Agent](packages/oura-ring) — `gobot-tools install oura-ring`
90
+
91
+ Connect your bot to an Oura Ring and add a Health Agent to the board. Biometric data flows into morning briefings and smart check-ins, and a dedicated wellness advisor handles everything from sleep analysis to medication lookups.
92
+
93
+ - Sleep, readiness, activity, and stress scores in briefings
94
+ - Health Agent on the board — biometrics, medication info, symptom lookup
95
+ - Health-aware smart check-ins — tone adapts to how you slept
96
+ - Drug interactions, side effects, lab results interpretation
97
+ - **Setup time:** ~5 minutes
98
+ - **Requires:** `OURA_ACCESS_TOKEN`
34
99
 
35
- ## Available Tools
100
+ ### [Apple Watch + Health Agent](packages/apple-health) — `gobot-tools install apple-health`
36
101
 
37
- ### Integrations
102
+ Connect your iPhone and Apple Watch to your bot using the free Health Auto Export app. No Apple API token required — data is pushed directly from your phone. Works standalone or alongside Oura Ring.
38
103
 
39
- | Tool | Description |
40
- |------|-------------|
41
- | **ms365** | Outlook Calendar, Email, and To Do via Microsoft Graph API |
42
- | **google-api** | Google Calendar and Sheets via Python CLI + TypeScript client |
43
- | **tempest-weather** | WeatherFlow Tempest personal weather station live data + forecasts |
44
- | **fireflies** | Fireflies.ai meeting transcripts — auto-stores summaries and action items |
45
- | **flightaware** | FlightAware AeroAPI — flight tracking with proactive Telegram notifications |
104
+ - Sleep stages (Deep, REM, Core), efficiency, bedtime/wake time
105
+ - HRV, resting heart rate, SpO₂, wrist temperature, VO₂ Max
106
+ - Steps, active calories, exercise minutes, stand hours
107
+ - Computed readiness score (proxy for Oura's readiness, no subscription needed)
108
+ - If you don't wear your watch to bed, the Health Agent automatically uses Oura (or any other source) for sleep data
109
+ - **Setup time:** ~5 minutes
110
+ - **Requires:** `APPLE_HEALTH_WEBHOOK_SECRET`
46
111
 
47
- ### Health
112
+ ### [Garmin Connect + Health Agent](packages/garmin) — `gobot-tools install garmin`
48
113
 
49
- | Tool | Description |
50
- |------|-------------|
51
- | **oura-ring** | Oura Ring biometrics + Health Agent for sleep, readiness, medications, symptoms |
114
+ Connect your Garmin device to your bot for workout data, training insights, sleep tracking, and daily health metrics. Uses the community `garminconnect` library — no developer registration required.
52
115
 
53
- ### Messaging
116
+ - Body Battery, training readiness, VO₂ max, and training status
117
+ - All activity types: running, cycling, swimming, strength, hiking, and more
118
+ - Sleep stages, steps, resting heart rate, and stress data
119
+ - Works alongside Oura and Apple Watch — all three sources complement each other; the Health Agent pulls from whichever has data for any given metric
120
+ - **Setup time:** ~10 minutes
121
+ - **Requires:** `GARMIN_EMAIL`, `GARMIN_PASSWORD` (for initial setup only — tokens cached after first login)
54
122
 
55
- | Tool | Description |
56
- |------|-------------|
57
- | **teams** | Microsoft Teams as a second messaging platform with cross-platform sync |
58
- | **voice-interface** | Telegram voice notes + web push-to-talk with per-agent voice mapping |
123
+ ---
59
124
 
60
- ### Security
125
+ ## Messaging
61
126
 
62
- | Tool | Description |
63
- |------|-------------|
64
- | **security-audit** | 5-phase application security audit prompt — works on any codebase |
65
- | **vps-hardening** | 9-phase VPS hardening prompt — SSH, Fail2Ban, UFW, Cloudflare, auto-updates |
127
+ ### [Microsoft Teams](packages/teams) `gobot-tools install teams`
66
128
 
67
- ### Infrastructure
129
+ Add Teams as a second messaging platform with synchronized conversations. Messages from Telegram and Teams share the same history — Claude sees full context regardless of where you sent from.
68
130
 
69
- | Tool | Description |
70
- |------|-------------|
71
- | **supabase-to-convex** | Zero-downtime database migration with instant rollback at every phase |
131
+ - Synchronized cross-platform conversations
132
+ - Human-in-the-loop via Adaptive Cards
133
+ - Same hybrid routing (VPS + local Mac)
134
+ - No botbuilder SDK — direct Bot Framework REST API
135
+ - **Setup time:** ~30 minutes
136
+ - **Requires:** `TEAMS_APP_ID`, `TEAMS_APP_PASSWORD`, `TEAMS_ALLOWED_USER_ID`, `TEAMS_TENANT_ID`
137
+ - **Depends on:** `ms365`
138
+
139
+ ### [Voice Interface — Telegram + Web](packages/voice-interface) — `gobot-tools install voice-interface`
140
+
141
+ Add two voice interfaces: Telegram voice notes (send a voice message, get a voice reply) and a web-based push-to-talk interface with distinct voices for each board agent.
142
+
143
+ - Telegram: Gemini transcription → Anthropic processing → Speaktor TTS
144
+ - Web: Browser STT (free, on-device) → Claude Code CLI → OpenAI TTS (per-agent voice)
145
+ - 8 distinct agent voices with personality instructions
146
+ - Estimated cost: ~$3/month (Telegram) or ~$0.05/month (web only)
147
+ - **Setup time:** ~15 minutes
148
+ - **Requires:** `GEMINI_API_KEY`, `SPEAKTOR_API_KEY`, `OPENAI_API_KEY`, `VOICE_WEB_TOKEN`
149
+
150
+ ---
151
+
152
+ ## Security
153
+
154
+ ### [Security Sentinel](packages/security-sentinel) — `gobot-tools install security-sentinel`
155
+
156
+ Autonomous security scanning agent for your VPS and web infrastructure. Runs 80+ checks across authentication, TLS, headers, VPS hardening, API credentials, and dependencies. Generates compliance reports for SOC2, HIPAA, and PCI-DSS with optional AI-powered analysis via Ollama or Claude API.
157
+
158
+ - 4 scan modes: quick, standard, deep, compliance-only
159
+ - Scheduled scans with Telegram notifications
160
+ - AI analysis with local Ollama models or Claude API
161
+ - Full source code included — customize checks for your stack
162
+ - **Setup time:** ~20 minutes
163
+ - **Requires:** `VPS_URL`, `VPS_SSH_HOST`, `DOMAIN`, `TELEGRAM_BOT_TOKEN`, and more (see `gobot-tools info security-sentinel`)
164
+
165
+ ### [Application Security Audit](packages/security-audit) — `gobot-tools install security-audit`
166
+
167
+ A 5-phase audit prompt that reviews your application code for vulnerabilities. Paste it into Claude Code from your project root — it maps your attack surface, identifies issues ranked by severity, and helps you fix them one commit at a time.
168
+
169
+ - Injection: command injection, prompt injection, path traversal, SSRF
170
+ - Auth gaps: unauthenticated endpoints, missing webhook verification
171
+ - Secret leaks: API keys in URLs/logs, hardcoded credentials, secrets in git history
172
+ - Config: permissive CORS, missing rate limiting, verbose error messages
173
+ - **Setup time:** ~5 minutes (audit itself takes longer depending on codebase size)
174
+ - **Works on any codebase** — no env vars required
175
+
176
+ ### [VPS Hardening](packages/vps-hardening) — `gobot-tools install vps-hardening`
177
+
178
+ A 9-phase hardening prompt for your Linux VPS. Paste it into Claude Code while SSH'd into your server — it audits your current state, locks down SSH, sets up firewall rules, and verifies nothing broke.
179
+
180
+ - SSH hardening: disable root, key-only auth, AllowUsers, idle timeout
181
+ - Fail2Ban with 24-hour progressive bans for repeat offenders
182
+ - UFW firewall with Docker-aware iptables rules
183
+ - Cloudflare origin protection — locks ports 80/443 to Cloudflare IP ranges
184
+ - Automatic security updates
185
+ - **Setup time:** ~30 minutes
186
+ - **Works on any Linux VPS** — no env vars required
187
+
188
+ ---
189
+
190
+ ## Infrastructure
191
+
192
+ ### [Supabase to Convex Migration](packages/supabase-to-convex) — `gobot-tools install supabase-to-convex`
193
+
194
+ Migrate your bot's database from Supabase to Convex with zero downtime. Uses a backend adapter pattern so you can run both databases in parallel and roll back instantly at every phase.
195
+
196
+ - Schema translation: SQL → TypeScript, pgvector → Convex vector search
197
+ - Drop-in client adapter with identical function signatures
198
+ - Data migration script that preserves existing embeddings
199
+ - Dual-write verification phase before cutover
200
+ - **Setup time:** ~1 day active work + 2 days monitoring
201
+ - **Requires:** `CONVEX_URL`, `DB_BACKEND`
202
+
203
+ ---
72
204
 
73
205
  ## Commands
74
206
 
@@ -79,6 +211,7 @@ gobot-tools search <query> Search by name, category, or keyword
79
211
  gobot-tools info <tool> Show details, env vars, dependencies
80
212
  gobot-tools install <tool> Download tool into your project
81
213
  gobot-tools uninstall <tool> Remove an installed tool
214
+ gobot-tools update [tool] Update a tool, or all installed tools
82
215
  ```
83
216
 
84
217
  ## How It Works
@@ -89,15 +222,22 @@ gobot-tools uninstall <tool> Remove an installed tool
89
222
 
90
223
  Tools are standalone — install only what you need. Some tools list dependencies (e.g., `teams` depends on `ms365`), and the CLI will tell you if you need to install something first.
91
224
 
225
+ When a tool receives a bug fix or new feature, update it with:
226
+
227
+ ```bash
228
+ gobot-tools update security-sentinel # update one tool
229
+ gobot-tools update # update all installed tools
230
+ ```
231
+
92
232
  ## Using Without the CLI
93
233
 
94
234
  Every tool's `prompt.md` works on its own. If you don't want to use the CLI:
95
235
 
96
236
  1. Browse the [`packages/`](packages/) directory
97
- 2. Open any `prompt.md` file
237
+ 2. Open any tool's `prompt.md` file
98
238
  3. Copy it into a Claude Code session
99
- 4. Follow the instructions
239
+ 4. Follow the interactive setup
100
240
 
101
241
  ## About
102
242
 
103
- Built by [tk-47](https://github.com/tk-47) for the Autonomee community. These tools power [Claudebot](https://github.com/tk-47/go-telegram-bot) — an always-on AI Telegram agent with persistent memory, proactive check-ins, morning briefings, and a board of specialist agents.
243
+ Built by [tk-47](https://github.com/tk-47) for the Autonomee community. These tools power [Claudebot](https://github.com/tk-47/go-telegram-bot) — an always-on AI Telegram agent originally built by GodaGo with persistent memory, proactive check-ins, morning briefings, and a board of specialist agents.
package/dist/index.js CHANGED
@@ -1,73 +1,80 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as D$}from"node:module";var W$=Object.create;var{getPrototypeOf:f$,defineProperty:g,getOwnPropertyNames:y$}=Object;var E$=Object.prototype.hasOwnProperty;var N$=($,T,R)=>{R=$!=null?W$(f$($)):{};let z=T||!$||!$.__esModule?g(R,"default",{value:$,enumerable:!0}):R;for(let J of y$($))if(!E$.call(z,J))g(z,J,{get:()=>$[J],enumerable:!0});return z};var H=($,T)=>()=>(T||$((T={exports:{}}).exports,T),T.exports);var U=D$(import.meta.url);var K=H((V$)=>{class N extends Error{constructor($,T,R){super(R);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=T,this.exitCode=$,this.nestedError=void 0}}class l extends N{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}V$.CommanderError=N;V$.InvalidArgumentError=l});var W=H((C$)=>{var{InvalidArgumentError:w$}=K();class c{constructor($,T){switch(this.description=T||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,$[0]){case"<":this.required=!0,this._name=$.slice(1,-1);break;case"[":this.required=!1,this._name=$.slice(1,-1);break;default:this.required=!0,this._name=$;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue($,T){if(T===this.defaultValue||!Array.isArray(T))return[$];return T.concat($)}default($,T){return this.defaultValue=$,this.defaultValueDescription=T,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(T,R)=>{if(!this.argChoices.includes(T))throw new w$(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(T,R);return T},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function k$($){let T=$.name()+($.variadic===!0?"...":"");return $.required?"<"+T+">":"["+T+"]"}C$.Argument=c;C$.humanReadableArgName=k$});var D=H((v$)=>{var{humanReadableArgName:O$}=W();class m{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext($){this.helpWidth=this.helpWidth??$.helpWidth??80}visibleCommands($){let T=$.commands.filter((z)=>!z._hidden),R=$._getHelpCommand();if(R&&!R._hidden)T.push(R);if(this.sortSubcommands)T.sort((z,J)=>{return z.name().localeCompare(J.name())});return T}compareOptions($,T){let R=(z)=>{return z.short?z.short.replace(/^-/,""):z.long.replace(/^--/,"")};return R($).localeCompare(R(T))}visibleOptions($){let T=$.options.filter((z)=>!z.hidden),R=$._getHelpOption();if(R&&!R.hidden){let z=R.short&&$._findOption(R.short),J=R.long&&$._findOption(R.long);if(!z&&!J)T.push(R);else if(R.long&&!J)T.push($.createOption(R.long,R.description));else if(R.short&&!z)T.push($.createOption(R.short,R.description))}if(this.sortOptions)T.sort(this.compareOptions);return T}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let T=[];for(let R=$.parent;R;R=R.parent){let z=R.options.filter((J)=>!J.hidden);T.push(...z)}if(this.sortOptions)T.sort(this.compareOptions);return T}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((T)=>{T.description=T.description||$._argsDescription[T.name()]||""});if($.registeredArguments.find((T)=>T.description))return $.registeredArguments;return[]}subcommandTerm($){let T=$.registeredArguments.map((R)=>O$(R)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(T?" "+T:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,T){return T.visibleCommands($).reduce((R,z)=>{return Math.max(R,this.displayWidth(T.styleSubcommandTerm(T.subcommandTerm(z))))},0)}longestOptionTermLength($,T){return T.visibleOptions($).reduce((R,z)=>{return Math.max(R,this.displayWidth(T.styleOptionTerm(T.optionTerm(z))))},0)}longestGlobalOptionTermLength($,T){return T.visibleGlobalOptions($).reduce((R,z)=>{return Math.max(R,this.displayWidth(T.styleOptionTerm(T.optionTerm(z))))},0)}longestArgumentTermLength($,T){return T.visibleArguments($).reduce((R,z)=>{return Math.max(R,this.displayWidth(T.styleArgumentTerm(T.argumentTerm(z))))},0)}commandUsage($){let T=$._name;if($._aliases[0])T=T+"|"+$._aliases[0];let R="";for(let z=$.parent;z;z=z.parent)R=z.name()+" "+R;return R+T+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let T=[];if($.argChoices)T.push(`choices: ${$.argChoices.map((R)=>JSON.stringify(R)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")T.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)T.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)T.push(`env: ${$.envVar}`);if(T.length>0)return`${$.description} (${T.join(", ")})`;return $.description}argumentDescription($){let T=[];if($.argChoices)T.push(`choices: ${$.argChoices.map((R)=>JSON.stringify(R)).join(", ")}`);if($.defaultValue!==void 0)T.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(T.length>0){let R=`(${T.join(", ")})`;if($.description)return`${$.description} ${R}`;return R}return $.description}formatHelp($,T){let R=T.padWidth($,T),z=T.helpWidth??80;function J(Y,j){return T.formatItem(Y,R,j,T)}let G=[`${T.styleTitle("Usage:")} ${T.styleUsage(T.commandUsage($))}`,""],X=T.commandDescription($);if(X.length>0)G=G.concat([T.boxWrap(T.styleCommandDescription(X),z),""]);let Q=T.visibleArguments($).map((Y)=>{return J(T.styleArgumentTerm(T.argumentTerm(Y)),T.styleArgumentDescription(T.argumentDescription(Y)))});if(Q.length>0)G=G.concat([T.styleTitle("Arguments:"),...Q,""]);let q=T.visibleOptions($).map((Y)=>{return J(T.styleOptionTerm(T.optionTerm(Y)),T.styleOptionDescription(T.optionDescription(Y)))});if(q.length>0)G=G.concat([T.styleTitle("Options:"),...q,""]);if(T.showGlobalOptions){let Y=T.visibleGlobalOptions($).map((j)=>{return J(T.styleOptionTerm(T.optionTerm(j)),T.styleOptionDescription(T.optionDescription(j)))});if(Y.length>0)G=G.concat([T.styleTitle("Global Options:"),...Y,""])}let Z=T.visibleCommands($).map((Y)=>{return J(T.styleSubcommandTerm(T.subcommandTerm(Y)),T.styleSubcommandDescription(T.subcommandDescription(Y)))});if(Z.length>0)G=G.concat([T.styleTitle("Commands:"),...Z,""]);return G.join(`
3
- `)}displayWidth($){return d($).length}styleTitle($){return $}styleUsage($){return $.split(" ").map((T)=>{if(T==="[options]")return this.styleOptionText(T);if(T==="[command]")return this.styleSubcommandText(T);if(T[0]==="["||T[0]==="<")return this.styleArgumentText(T);return this.styleCommandText(T)}).join(" ")}styleCommandDescription($){return this.styleDescriptionText($)}styleOptionDescription($){return this.styleDescriptionText($)}styleSubcommandDescription($){return this.styleDescriptionText($)}styleArgumentDescription($){return this.styleDescriptionText($)}styleDescriptionText($){return $}styleOptionTerm($){return this.styleOptionText($)}styleSubcommandTerm($){return $.split(" ").map((T)=>{if(T==="[options]")return this.styleOptionText(T);if(T[0]==="["||T[0]==="<")return this.styleArgumentText(T);return this.styleSubcommandText(T)}).join(" ")}styleArgumentTerm($){return this.styleArgumentText($)}styleOptionText($){return $}styleArgumentText($){return $}styleSubcommandText($){return $}styleCommandText($){return $}padWidth($,T){return Math.max(T.longestOptionTermLength($,T),T.longestGlobalOptionTermLength($,T),T.longestSubcommandTermLength($,T),T.longestArgumentTermLength($,T))}preformatted($){return/\n[^\S\r\n]/.test($)}formatItem($,T,R,z){let G=" ".repeat(2);if(!R)return G+$;let X=$.padEnd(T+$.length-z.displayWidth($)),Q=2,Z=(this.helpWidth??80)-T-Q-2,Y;if(Z<this.minWidthToWrap||z.preformatted(R))Y=R;else Y=z.boxWrap(R,Z).replace(/\n/g,`
4
- `+" ".repeat(T+Q));return G+X+" ".repeat(Q)+Y.replace(/\n/g,`
5
- ${G}`)}boxWrap($,T){if(T<this.minWidthToWrap)return $;let R=$.split(/\r\n|\n/),z=/[\s]*[^\s]+/g,J=[];return R.forEach((G)=>{let X=G.match(z);if(X===null){J.push("");return}let Q=[X.shift()],q=this.displayWidth(Q[0]);X.forEach((Z)=>{let Y=this.displayWidth(Z);if(q+Y<=T){Q.push(Z),q+=Y;return}J.push(Q.join(""));let j=Z.trimStart();Q=[j],q=this.displayWidth(j)}),J.push(Q.join(""))}),J.join(`
6
- `)}}function d($){let T=/\x1b\[\d*(;\d*)*m/g;return $.replace(T,"")}v$.Help=m;v$.stripColor=d});var V=H((c$)=>{var{InvalidArgumentError:g$}=K();class s{constructor($,T){this.flags=$,this.description=T||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let R=l$($);if(this.short=R.shortFlag,this.long=R.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default($,T){return this.defaultValue=$,this.defaultValueDescription=T,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let T=$;if(typeof $==="string")T={[$]:!0};return this.implied=Object.assign(this.implied||{},T),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_concatValue($,T){if(T===this.defaultValue||!Array.isArray(T))return[$];return T.concat($)}choices($){return this.argChoices=$.slice(),this.parseArg=(T,R)=>{if(!this.argChoices.includes(T))throw new g$(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(T,R);return T},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return i(this.name().replace(/^no-/,""));return i(this.name())}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class o{constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((T)=>{if(T.negate)this.negativeOptions.set(T.attributeName(),T);else this.positiveOptions.set(T.attributeName(),T)}),this.negativeOptions.forEach((T,R)=>{if(this.positiveOptions.has(R))this.dualOptions.add(R)})}valueFromOption($,T){let R=T.attributeName();if(!this.dualOptions.has(R))return!0;let z=this.negativeOptions.get(R).presetArg,J=z!==void 0?z:!1;return T.negate===(J===$)}}function i($){return $.split("-").reduce((T,R)=>{return T+R[0].toUpperCase()+R.slice(1)})}function l$($){let T,R,z=/^-[^-]$/,J=/^--[^-]/,G=$.split(/[ |,]+/).concat("guard");if(z.test(G[0]))T=G.shift();if(J.test(G[0]))R=G.shift();if(!T&&z.test(G[0]))T=G.shift();if(!T&&J.test(G[0]))T=R,R=G.shift();if(G[0].startsWith("-")){let X=G[0],Q=`option creation failed due to '${X}' in option flags '${$}'`;if(/^-[^-][^-]/.test(X))throw Error(`${Q}
2
+ import{createRequire as A$}from"node:module";var E$=Object.create;var{getPrototypeOf:f$,defineProperty:g,getOwnPropertyNames:N$}=Object;var D$=Object.prototype.hasOwnProperty;var F$=($,T,z)=>{z=$!=null?E$(f$($)):{};let R=T||!$||!$.__esModule?g(z,"default",{value:$,enumerable:!0}):z;for(let J of N$($))if(!D$.call(R,J))g(R,J,{get:()=>$[J],enumerable:!0});return R};var K=($,T)=>()=>(T||$((T={exports:{}}).exports,T),T.exports);var L=A$(import.meta.url);var W=K((w$)=>{class N extends Error{constructor($,T,z){super(z);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=T,this.exitCode=$,this.nestedError=void 0}}class c extends N{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}w$.CommanderError=N;w$.InvalidArgumentError=c});var y=K((O$)=>{var{InvalidArgumentError:C$}=W();class m{constructor($,T){switch(this.description=T||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,$[0]){case"<":this.required=!0,this._name=$.slice(1,-1);break;case"[":this.required=!1,this._name=$.slice(1,-1);break;default:this.required=!0,this._name=$;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue($,T){if(T===this.defaultValue||!Array.isArray(T))return[$];return T.concat($)}default($,T){return this.defaultValue=$,this.defaultValueDescription=T,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(T,z)=>{if(!this.argChoices.includes(T))throw new C$(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(T,z);return T},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function x$($){let T=$.name()+($.variadic===!0?"...":"");return $.required?"<"+T+">":"["+T+"]"}O$.Argument=m;O$.humanReadableArgName=x$});var D=K((u$)=>{var{humanReadableArgName:l$}=y();class d{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext($){this.helpWidth=this.helpWidth??$.helpWidth??80}visibleCommands($){let T=$.commands.filter((R)=>!R._hidden),z=$._getHelpCommand();if(z&&!z._hidden)T.push(z);if(this.sortSubcommands)T.sort((R,J)=>{return R.name().localeCompare(J.name())});return T}compareOptions($,T){let z=(R)=>{return R.short?R.short.replace(/^-/,""):R.long.replace(/^--/,"")};return z($).localeCompare(z(T))}visibleOptions($){let T=$.options.filter((R)=>!R.hidden),z=$._getHelpOption();if(z&&!z.hidden){let R=z.short&&$._findOption(z.short),J=z.long&&$._findOption(z.long);if(!R&&!J)T.push(z);else if(z.long&&!J)T.push($.createOption(z.long,z.description));else if(z.short&&!R)T.push($.createOption(z.short,z.description))}if(this.sortOptions)T.sort(this.compareOptions);return T}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let T=[];for(let z=$.parent;z;z=z.parent){let R=z.options.filter((J)=>!J.hidden);T.push(...R)}if(this.sortOptions)T.sort(this.compareOptions);return T}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((T)=>{T.description=T.description||$._argsDescription[T.name()]||""});if($.registeredArguments.find((T)=>T.description))return $.registeredArguments;return[]}subcommandTerm($){let T=$.registeredArguments.map((z)=>l$(z)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(T?" "+T:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,T){return T.visibleCommands($).reduce((z,R)=>{return Math.max(z,this.displayWidth(T.styleSubcommandTerm(T.subcommandTerm(R))))},0)}longestOptionTermLength($,T){return T.visibleOptions($).reduce((z,R)=>{return Math.max(z,this.displayWidth(T.styleOptionTerm(T.optionTerm(R))))},0)}longestGlobalOptionTermLength($,T){return T.visibleGlobalOptions($).reduce((z,R)=>{return Math.max(z,this.displayWidth(T.styleOptionTerm(T.optionTerm(R))))},0)}longestArgumentTermLength($,T){return T.visibleArguments($).reduce((z,R)=>{return Math.max(z,this.displayWidth(T.styleArgumentTerm(T.argumentTerm(R))))},0)}commandUsage($){let T=$._name;if($._aliases[0])T=T+"|"+$._aliases[0];let z="";for(let R=$.parent;R;R=R.parent)z=R.name()+" "+z;return z+T+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let T=[];if($.argChoices)T.push(`choices: ${$.argChoices.map((z)=>JSON.stringify(z)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")T.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)T.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)T.push(`env: ${$.envVar}`);if(T.length>0)return`${$.description} (${T.join(", ")})`;return $.description}argumentDescription($){let T=[];if($.argChoices)T.push(`choices: ${$.argChoices.map((z)=>JSON.stringify(z)).join(", ")}`);if($.defaultValue!==void 0)T.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(T.length>0){let z=`(${T.join(", ")})`;if($.description)return`${$.description} ${z}`;return z}return $.description}formatHelp($,T){let z=T.padWidth($,T),R=T.helpWidth??80;function J(U,G){return T.formatItem(U,z,G,T)}let Q=[`${T.styleTitle("Usage:")} ${T.styleUsage(T.commandUsage($))}`,""],Z=T.commandDescription($);if(Z.length>0)Q=Q.concat([T.boxWrap(T.styleCommandDescription(Z),R),""]);let X=T.visibleArguments($).map((U)=>{return J(T.styleArgumentTerm(T.argumentTerm(U)),T.styleArgumentDescription(T.argumentDescription(U)))});if(X.length>0)Q=Q.concat([T.styleTitle("Arguments:"),...X,""]);let Y=T.visibleOptions($).map((U)=>{return J(T.styleOptionTerm(T.optionTerm(U)),T.styleOptionDescription(T.optionDescription(U)))});if(Y.length>0)Q=Q.concat([T.styleTitle("Options:"),...Y,""]);if(T.showGlobalOptions){let U=T.visibleGlobalOptions($).map((G)=>{return J(T.styleOptionTerm(T.optionTerm(G)),T.styleOptionDescription(T.optionDescription(G)))});if(U.length>0)Q=Q.concat([T.styleTitle("Global Options:"),...U,""])}let q=T.visibleCommands($).map((U)=>{return J(T.styleSubcommandTerm(T.subcommandTerm(U)),T.styleSubcommandDescription(T.subcommandDescription(U)))});if(q.length>0)Q=Q.concat([T.styleTitle("Commands:"),...q,""]);return Q.join(`
3
+ `)}displayWidth($){return s($).length}styleTitle($){return $}styleUsage($){return $.split(" ").map((T)=>{if(T==="[options]")return this.styleOptionText(T);if(T==="[command]")return this.styleSubcommandText(T);if(T[0]==="["||T[0]==="<")return this.styleArgumentText(T);return this.styleCommandText(T)}).join(" ")}styleCommandDescription($){return this.styleDescriptionText($)}styleOptionDescription($){return this.styleDescriptionText($)}styleSubcommandDescription($){return this.styleDescriptionText($)}styleArgumentDescription($){return this.styleDescriptionText($)}styleDescriptionText($){return $}styleOptionTerm($){return this.styleOptionText($)}styleSubcommandTerm($){return $.split(" ").map((T)=>{if(T==="[options]")return this.styleOptionText(T);if(T[0]==="["||T[0]==="<")return this.styleArgumentText(T);return this.styleSubcommandText(T)}).join(" ")}styleArgumentTerm($){return this.styleArgumentText($)}styleOptionText($){return $}styleArgumentText($){return $}styleSubcommandText($){return $}styleCommandText($){return $}padWidth($,T){return Math.max(T.longestOptionTermLength($,T),T.longestGlobalOptionTermLength($,T),T.longestSubcommandTermLength($,T),T.longestArgumentTermLength($,T))}preformatted($){return/\n[^\S\r\n]/.test($)}formatItem($,T,z,R){let Q=" ".repeat(2);if(!z)return Q+$;let Z=$.padEnd(T+$.length-R.displayWidth($)),X=2,q=(this.helpWidth??80)-T-X-2,U;if(q<this.minWidthToWrap||R.preformatted(z))U=z;else U=R.boxWrap(z,q).replace(/\n/g,`
4
+ `+" ".repeat(T+X));return Q+Z+" ".repeat(X)+U.replace(/\n/g,`
5
+ ${Q}`)}boxWrap($,T){if(T<this.minWidthToWrap)return $;let z=$.split(/\r\n|\n/),R=/[\s]*[^\s]+/g,J=[];return z.forEach((Q)=>{let Z=Q.match(R);if(Z===null){J.push("");return}let X=[Z.shift()],Y=this.displayWidth(X[0]);Z.forEach((q)=>{let U=this.displayWidth(q);if(Y+U<=T){X.push(q),Y+=U;return}J.push(X.join(""));let G=q.trimStart();X=[G],Y=this.displayWidth(G)}),J.push(X.join(""))}),J.join(`
6
+ `)}}function s($){let T=/\x1b\[\d*(;\d*)*m/g;return $.replace(T,"")}u$.Help=d;u$.stripColor=s});var F=K((s$)=>{var{InvalidArgumentError:m$}=W();class o{constructor($,T){this.flags=$,this.description=T||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let z=d$($);if(this.short=z.shortFlag,this.long=z.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default($,T){return this.defaultValue=$,this.defaultValueDescription=T,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let T=$;if(typeof $==="string")T={[$]:!0};return this.implied=Object.assign(this.implied||{},T),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_concatValue($,T){if(T===this.defaultValue||!Array.isArray(T))return[$];return T.concat($)}choices($){return this.argChoices=$.slice(),this.parseArg=(T,z)=>{if(!this.argChoices.includes(T))throw new m$(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(T,z);return T},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return i(this.name().replace(/^no-/,""));return i(this.name())}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class t{constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((T)=>{if(T.negate)this.negativeOptions.set(T.attributeName(),T);else this.positiveOptions.set(T.attributeName(),T)}),this.negativeOptions.forEach((T,z)=>{if(this.positiveOptions.has(z))this.dualOptions.add(z)})}valueFromOption($,T){let z=T.attributeName();if(!this.dualOptions.has(z))return!0;let R=this.negativeOptions.get(z).presetArg,J=R!==void 0?R:!1;return T.negate===(J===$)}}function i($){return $.split("-").reduce((T,z)=>{return T+z[0].toUpperCase()+z.slice(1)})}function d$($){let T,z,R=/^-[^-]$/,J=/^--[^-]/,Q=$.split(/[ |,]+/).concat("guard");if(R.test(Q[0]))T=Q.shift();if(J.test(Q[0]))z=Q.shift();if(!T&&R.test(Q[0]))T=Q.shift();if(!T&&J.test(Q[0]))T=z,z=Q.shift();if(Q[0].startsWith("-")){let Z=Q[0],X=`option creation failed due to '${Z}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Z))throw Error(`${X}
7
7
  - a short flag is a single dash and a single character
8
8
  - either use a single dash and a single character (for a short flag)
9
- - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(z.test(X))throw Error(`${Q}
10
- - too many short flags`);if(J.test(X))throw Error(`${Q}
11
- - too many long flags`);throw Error(`${Q}
12
- - unrecognised flag format`)}if(T===void 0&&R===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:T,longFlag:R}}c$.Option=s;c$.DualOptions=o});var t=H((o$)=>{function i$($,T){if(Math.abs($.length-T.length)>3)return Math.max($.length,T.length);let R=[];for(let z=0;z<=$.length;z++)R[z]=[z];for(let z=0;z<=T.length;z++)R[0][z]=z;for(let z=1;z<=T.length;z++)for(let J=1;J<=$.length;J++){let G=1;if($[J-1]===T[z-1])G=0;else G=1;if(R[J][z]=Math.min(R[J-1][z]+1,R[J][z-1]+1,R[J-1][z-1]+G),J>1&&z>1&&$[J-1]===T[z-2]&&$[J-2]===T[z-1])R[J][z]=Math.min(R[J][z],R[J-2][z-2]+1)}return R[$.length][T.length]}function s$($,T){if(!T||T.length===0)return"";T=Array.from(new Set(T));let R=$.startsWith("--");if(R)$=$.slice(2),T=T.map((X)=>X.slice(2));let z=[],J=3,G=0.4;if(T.forEach((X)=>{if(X.length<=1)return;let Q=i$($,X),q=Math.max($.length,X.length);if((q-Q)/q>G){if(Q<J)J=Q,z=[X];else if(Q===J)z.push(X)}}),z.sort((X,Q)=>X.localeCompare(Q)),R)z=z.map((X)=>`--${X}`);if(z.length>1)return`
13
- (Did you mean one of ${z.join(", ")}?)`;if(z.length===1)return`
14
- (Did you mean ${z[0]}?)`;return""}o$.suggestSimilar=s$});var a=H((TT)=>{var p$=U("node:events").EventEmitter,F=U("node:child_process"),B=U("node:path"),f=U("node:fs"),_=U("node:process"),{Argument:n$,humanReadableArgName:r$}=W(),{CommanderError:A}=K(),{Help:a$,stripColor:e$}=D(),{Option:p,DualOptions:$T}=V(),{suggestSimilar:n}=t();class k extends p${constructor($){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=$||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(T)=>_.stdout.write(T),writeErr:(T)=>_.stderr.write(T),outputError:(T,R)=>R(T),getOutHelpWidth:()=>_.stdout.isTTY?_.stdout.columns:void 0,getErrHelpWidth:()=>_.stderr.isTTY?_.stderr.columns:void 0,getOutHasColors:()=>w()??(_.stdout.isTTY&&_.stdout.hasColors?.()),getErrHasColors:()=>w()??(_.stderr.isTTY&&_.stderr.hasColors?.()),stripColor:(T)=>e$(T)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings($){return this._outputConfiguration=$._outputConfiguration,this._helpOption=$._helpOption,this._helpCommand=$._helpCommand,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let T=this;T;T=T.parent)$.push(T);return $}command($,T,R){let z=T,J=R;if(typeof z==="object"&&z!==null)J=z,z=null;J=J||{};let[,G,X]=$.match(/([^ ]+) *(.*)/),Q=this.createCommand(G);if(z)Q.description(z),Q._executableHandler=!0;if(J.isDefault)this._defaultCommandName=Q._name;if(Q._hidden=!!(J.noHelp||J.hidden),Q._executableFile=J.executableFile||null,X)Q.arguments(X);if(this._registerCommand(Q),Q.parent=this,Q.copyInheritedSettings(this),z)return this;return Q}createCommand($){return new k($)}createHelp(){return Object.assign(new a$,this.configureHelp())}configureHelp($){if($===void 0)return this._helpConfiguration;return this._helpConfiguration=$,this}configureOutput($){if($===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,$),this}showHelpAfterError($=!0){if(typeof $!=="string")$=!!$;return this._showHelpAfterError=$,this}showSuggestionAfterError($=!0){return this._showSuggestionAfterError=!!$,this}addCommand($,T){if(!$._name)throw Error(`Command passed to .addCommand() must have a name
15
- - specify the name in Command constructor or using .name()`);if(T=T||{},T.isDefault)this._defaultCommandName=$._name;if(T.noHelp||T.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,T){return new n$($,T)}argument($,T,R,z){let J=this.createArgument($,T);if(typeof R==="function")J.default(z).argParser(R);else J.default(R);return this.addArgument(J),this}arguments($){return $.trim().split(/ +/).forEach((T)=>{this.argument(T)}),this}addArgument($){let T=this.registeredArguments.slice(-1)[0];if(T&&T.variadic)throw Error(`only the last argument can be variadic '${T.name()}'`);if($.required&&$.defaultValue!==void 0&&$.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${$.name()}'`);return this.registeredArguments.push($),this}helpCommand($,T){if(typeof $==="boolean")return this._addImplicitHelpCommand=$,this;$=$??"help [command]";let[,R,z]=$.match(/([^ ]+) *(.*)/),J=T??"display help for command",G=this.createCommand(R);if(G.helpOption(!1),z)G.arguments(z);if(J)G.description(J);return this._addImplicitHelpCommand=!0,this._helpCommand=G,this}addHelpCommand($,T){if(typeof $!=="object")return this.helpCommand($,T),this;return this._addImplicitHelpCommand=!0,this._helpCommand=$,this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook($,T){let R=["preSubcommand","preAction","postAction"];if(!R.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
16
- Expecting one of '${R.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(T);else this._lifeCycleHooks[$]=[T];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(T)=>{if(T.code!=="commander.executeSubCommandAsync")throw T};return this}_exit($,T,R){if(this._exitCallback)this._exitCallback(new A($,T,R));_.exit($)}action($){let T=(R)=>{let z=this.registeredArguments.length,J=R.slice(0,z);if(this._storeOptionsAsProperties)J[z]=this;else J[z]=this.opts();return J.push(this),$.apply(this,J)};return this._actionHandler=T,this}createOption($,T){return new p($,T)}_callParseArg($,T,R,z){try{return $.parseArg(T,R)}catch(J){if(J.code==="commander.invalidArgument"){let G=`${z} ${J.message}`;this.error(G,{exitCode:J.exitCode,code:J.code})}throw J}}_registerOption($){let T=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(T){let R=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${R}'
17
- - already used by option '${T.flags}'`)}this.options.push($)}_registerCommand($){let T=(z)=>{return[z.name()].concat(z.aliases())},R=T($).find((z)=>this._findCommand(z));if(R){let z=T(this._findCommand(R)).join("|"),J=T($).join("|");throw Error(`cannot add command '${J}' as already have command '${z}'`)}this.commands.push($)}addOption($){this._registerOption($);let T=$.name(),R=$.attributeName();if($.negate){let J=$.long.replace(/^--no-/,"--");if(!this._findOption(J))this.setOptionValueWithSource(R,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(R,$.defaultValue,"default");let z=(J,G,X)=>{if(J==null&&$.presetArg!==void 0)J=$.presetArg;let Q=this.getOptionValue(R);if(J!==null&&$.parseArg)J=this._callParseArg($,J,Q,G);else if(J!==null&&$.variadic)J=$._concatValue(J,Q);if(J==null)if($.negate)J=!1;else if($.isBoolean()||$.optional)J=!0;else J="";this.setOptionValueWithSource(R,J,X)};if(this.on("option:"+T,(J)=>{let G=`error: option '${$.flags}' argument '${J}' is invalid.`;z(J,G,"cli")}),$.envVar)this.on("optionEnv:"+T,(J)=>{let G=`error: option '${$.flags}' value '${J}' from env '${$.envVar}' is invalid.`;z(J,G,"env")});return this}_optionEx($,T,R,z,J){if(typeof T==="object"&&T instanceof p)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let G=this.createOption(T,R);if(G.makeOptionMandatory(!!$.mandatory),typeof z==="function")G.default(J).argParser(z);else if(z instanceof RegExp){let X=z;z=(Q,q)=>{let Z=X.exec(Q);return Z?Z[0]:q},G.default(J).argParser(z)}else G.default(z);return this.addOption(G)}option($,T,R,z){return this._optionEx({},$,T,R,z)}requiredOption($,T,R,z){return this._optionEx({mandatory:!0},$,T,R,z)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){return this._passThroughOptions=!!$,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties($=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,T){return this.setOptionValueWithSource($,T,void 0)}setOptionValueWithSource($,T,R){if(this._storeOptionsAsProperties)this[$]=T;else this._optionValues[$]=T;return this._optionValueSources[$]=R,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let T;return this._getCommandAndAncestors().forEach((R)=>{if(R.getOptionValueSource($)!==void 0)T=R.getOptionValueSource($)}),T}_prepareUserArgs($,T){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(T=T||{},$===void 0&&T.from===void 0){if(_.versions?.electron)T.from="electron";let z=_.execArgv??[];if(z.includes("-e")||z.includes("--eval")||z.includes("-p")||z.includes("--print"))T.from="eval"}if($===void 0)$=_.argv;this.rawArgs=$.slice();let R;switch(T.from){case void 0:case"node":this._scriptPath=$[1],R=$.slice(2);break;case"electron":if(_.defaultApp)this._scriptPath=$[1],R=$.slice(2);else R=$.slice(1);break;case"user":R=$.slice(0);break;case"eval":R=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${T.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",R}parse($,T){this._prepareForParse();let R=this._prepareUserArgs($,T);return this._parseCommand([],R),this}async parseAsync($,T){this._prepareForParse();let R=this._prepareUserArgs($,T);return await this._parseCommand([],R),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
18
- - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable($,T,R){if(f.existsSync($))return;let z=T?`searched for local subcommand relative to directory '${T}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",J=`'${$}' does not exist
19
- - if '${R}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
9
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(R.test(Z))throw Error(`${X}
10
+ - too many short flags`);if(J.test(Z))throw Error(`${X}
11
+ - too many long flags`);throw Error(`${X}
12
+ - unrecognised flag format`)}if(T===void 0&&z===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:T,longFlag:z}}s$.Option=o;s$.DualOptions=t});var n=K((p$)=>{function t$($,T){if(Math.abs($.length-T.length)>3)return Math.max($.length,T.length);let z=[];for(let R=0;R<=$.length;R++)z[R]=[R];for(let R=0;R<=T.length;R++)z[0][R]=R;for(let R=1;R<=T.length;R++)for(let J=1;J<=$.length;J++){let Q=1;if($[J-1]===T[R-1])Q=0;else Q=1;if(z[J][R]=Math.min(z[J-1][R]+1,z[J][R-1]+1,z[J-1][R-1]+Q),J>1&&R>1&&$[J-1]===T[R-2]&&$[J-2]===T[R-1])z[J][R]=Math.min(z[J][R],z[J-2][R-2]+1)}return z[$.length][T.length]}function n$($,T){if(!T||T.length===0)return"";T=Array.from(new Set(T));let z=$.startsWith("--");if(z)$=$.slice(2),T=T.map((Z)=>Z.slice(2));let R=[],J=3,Q=0.4;if(T.forEach((Z)=>{if(Z.length<=1)return;let X=t$($,Z),Y=Math.max($.length,Z.length);if((Y-X)/Y>Q){if(X<J)J=X,R=[Z];else if(X===J)R.push(Z)}}),R.sort((Z,X)=>Z.localeCompare(X)),z)R=R.map((Z)=>`--${Z}`);if(R.length>1)return`
13
+ (Did you mean one of ${R.join(", ")}?)`;if(R.length===1)return`
14
+ (Did you mean ${R[0]}?)`;return""}p$.suggestSimilar=n$});var e=K((J0)=>{var a$=L("node:events").EventEmitter,A=L("node:child_process"),_=L("node:path"),V=L("node:fs"),B=L("node:process"),{Argument:e$,humanReadableArgName:$0}=y(),{CommanderError:w}=W(),{Help:T0,stripColor:z0}=D(),{Option:p,DualOptions:R0}=F(),{suggestSimilar:r}=n();class b extends a${constructor($){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=$||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(T)=>B.stdout.write(T),writeErr:(T)=>B.stderr.write(T),outputError:(T,z)=>z(T),getOutHelpWidth:()=>B.stdout.isTTY?B.stdout.columns:void 0,getErrHelpWidth:()=>B.stderr.isTTY?B.stderr.columns:void 0,getOutHasColors:()=>k()??(B.stdout.isTTY&&B.stdout.hasColors?.()),getErrHasColors:()=>k()??(B.stderr.isTTY&&B.stderr.hasColors?.()),stripColor:(T)=>z0(T)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings($){return this._outputConfiguration=$._outputConfiguration,this._helpOption=$._helpOption,this._helpCommand=$._helpCommand,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let T=this;T;T=T.parent)$.push(T);return $}command($,T,z){let R=T,J=z;if(typeof R==="object"&&R!==null)J=R,R=null;J=J||{};let[,Q,Z]=$.match(/([^ ]+) *(.*)/),X=this.createCommand(Q);if(R)X.description(R),X._executableHandler=!0;if(J.isDefault)this._defaultCommandName=X._name;if(X._hidden=!!(J.noHelp||J.hidden),X._executableFile=J.executableFile||null,Z)X.arguments(Z);if(this._registerCommand(X),X.parent=this,X.copyInheritedSettings(this),R)return this;return X}createCommand($){return new b($)}createHelp(){return Object.assign(new T0,this.configureHelp())}configureHelp($){if($===void 0)return this._helpConfiguration;return this._helpConfiguration=$,this}configureOutput($){if($===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,$),this}showHelpAfterError($=!0){if(typeof $!=="string")$=!!$;return this._showHelpAfterError=$,this}showSuggestionAfterError($=!0){return this._showSuggestionAfterError=!!$,this}addCommand($,T){if(!$._name)throw Error(`Command passed to .addCommand() must have a name
15
+ - specify the name in Command constructor or using .name()`);if(T=T||{},T.isDefault)this._defaultCommandName=$._name;if(T.noHelp||T.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,T){return new e$($,T)}argument($,T,z,R){let J=this.createArgument($,T);if(typeof z==="function")J.default(R).argParser(z);else J.default(z);return this.addArgument(J),this}arguments($){return $.trim().split(/ +/).forEach((T)=>{this.argument(T)}),this}addArgument($){let T=this.registeredArguments.slice(-1)[0];if(T&&T.variadic)throw Error(`only the last argument can be variadic '${T.name()}'`);if($.required&&$.defaultValue!==void 0&&$.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${$.name()}'`);return this.registeredArguments.push($),this}helpCommand($,T){if(typeof $==="boolean")return this._addImplicitHelpCommand=$,this;$=$??"help [command]";let[,z,R]=$.match(/([^ ]+) *(.*)/),J=T??"display help for command",Q=this.createCommand(z);if(Q.helpOption(!1),R)Q.arguments(R);if(J)Q.description(J);return this._addImplicitHelpCommand=!0,this._helpCommand=Q,this}addHelpCommand($,T){if(typeof $!=="object")return this.helpCommand($,T),this;return this._addImplicitHelpCommand=!0,this._helpCommand=$,this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook($,T){let z=["preSubcommand","preAction","postAction"];if(!z.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
16
+ Expecting one of '${z.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(T);else this._lifeCycleHooks[$]=[T];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(T)=>{if(T.code!=="commander.executeSubCommandAsync")throw T};return this}_exit($,T,z){if(this._exitCallback)this._exitCallback(new w($,T,z));B.exit($)}action($){let T=(z)=>{let R=this.registeredArguments.length,J=z.slice(0,R);if(this._storeOptionsAsProperties)J[R]=this;else J[R]=this.opts();return J.push(this),$.apply(this,J)};return this._actionHandler=T,this}createOption($,T){return new p($,T)}_callParseArg($,T,z,R){try{return $.parseArg(T,z)}catch(J){if(J.code==="commander.invalidArgument"){let Q=`${R} ${J.message}`;this.error(Q,{exitCode:J.exitCode,code:J.code})}throw J}}_registerOption($){let T=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(T){let z=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${z}'
17
+ - already used by option '${T.flags}'`)}this.options.push($)}_registerCommand($){let T=(R)=>{return[R.name()].concat(R.aliases())},z=T($).find((R)=>this._findCommand(R));if(z){let R=T(this._findCommand(z)).join("|"),J=T($).join("|");throw Error(`cannot add command '${J}' as already have command '${R}'`)}this.commands.push($)}addOption($){this._registerOption($);let T=$.name(),z=$.attributeName();if($.negate){let J=$.long.replace(/^--no-/,"--");if(!this._findOption(J))this.setOptionValueWithSource(z,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(z,$.defaultValue,"default");let R=(J,Q,Z)=>{if(J==null&&$.presetArg!==void 0)J=$.presetArg;let X=this.getOptionValue(z);if(J!==null&&$.parseArg)J=this._callParseArg($,J,X,Q);else if(J!==null&&$.variadic)J=$._concatValue(J,X);if(J==null)if($.negate)J=!1;else if($.isBoolean()||$.optional)J=!0;else J="";this.setOptionValueWithSource(z,J,Z)};if(this.on("option:"+T,(J)=>{let Q=`error: option '${$.flags}' argument '${J}' is invalid.`;R(J,Q,"cli")}),$.envVar)this.on("optionEnv:"+T,(J)=>{let Q=`error: option '${$.flags}' value '${J}' from env '${$.envVar}' is invalid.`;R(J,Q,"env")});return this}_optionEx($,T,z,R,J){if(typeof T==="object"&&T instanceof p)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let Q=this.createOption(T,z);if(Q.makeOptionMandatory(!!$.mandatory),typeof R==="function")Q.default(J).argParser(R);else if(R instanceof RegExp){let Z=R;R=(X,Y)=>{let q=Z.exec(X);return q?q[0]:Y},Q.default(J).argParser(R)}else Q.default(R);return this.addOption(Q)}option($,T,z,R){return this._optionEx({},$,T,z,R)}requiredOption($,T,z,R){return this._optionEx({mandatory:!0},$,T,z,R)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){return this._passThroughOptions=!!$,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties($=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,T){return this.setOptionValueWithSource($,T,void 0)}setOptionValueWithSource($,T,z){if(this._storeOptionsAsProperties)this[$]=T;else this._optionValues[$]=T;return this._optionValueSources[$]=z,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let T;return this._getCommandAndAncestors().forEach((z)=>{if(z.getOptionValueSource($)!==void 0)T=z.getOptionValueSource($)}),T}_prepareUserArgs($,T){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(T=T||{},$===void 0&&T.from===void 0){if(B.versions?.electron)T.from="electron";let R=B.execArgv??[];if(R.includes("-e")||R.includes("--eval")||R.includes("-p")||R.includes("--print"))T.from="eval"}if($===void 0)$=B.argv;this.rawArgs=$.slice();let z;switch(T.from){case void 0:case"node":this._scriptPath=$[1],z=$.slice(2);break;case"electron":if(B.defaultApp)this._scriptPath=$[1],z=$.slice(2);else z=$.slice(1);break;case"user":z=$.slice(0);break;case"eval":z=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${T.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",z}parse($,T){this._prepareForParse();let z=this._prepareUserArgs($,T);return this._parseCommand([],z),this}async parseAsync($,T){this._prepareForParse();let z=this._prepareUserArgs($,T);return await this._parseCommand([],z),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
18
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable($,T,z){if(V.existsSync($))return;let R=T?`searched for local subcommand relative to directory '${T}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",J=`'${$}' does not exist
19
+ - if '${z}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
20
20
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
21
- - ${z}`;throw Error(J)}_executeSubCommand($,T){T=T.slice();let R=!1,z=[".js",".ts",".tsx",".mjs",".cjs"];function J(Z,Y){let j=B.resolve(Z,Y);if(f.existsSync(j))return j;if(z.includes(B.extname(Y)))return;let u=z.find((P$)=>f.existsSync(`${j}${P$}`));if(u)return`${j}${u}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let G=$._executableFile||`${this._name}-${$._name}`,X=this._executableDir||"";if(this._scriptPath){let Z;try{Z=f.realpathSync(this._scriptPath)}catch{Z=this._scriptPath}X=B.resolve(B.dirname(Z),X)}if(X){let Z=J(X,G);if(!Z&&!$._executableFile&&this._scriptPath){let Y=B.basename(this._scriptPath,B.extname(this._scriptPath));if(Y!==this._name)Z=J(X,`${Y}-${$._name}`)}G=Z||G}R=z.includes(B.extname(G));let Q;if(_.platform!=="win32")if(R)T.unshift(G),T=r(_.execArgv).concat(T),Q=F.spawn(_.argv[0],T,{stdio:"inherit"});else Q=F.spawn(G,T,{stdio:"inherit"});else this._checkForMissingExecutable(G,X,$._name),T.unshift(G),T=r(_.execArgv).concat(T),Q=F.spawn(_.execPath,T,{stdio:"inherit"});if(!Q.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((Y)=>{_.on(Y,()=>{if(Q.killed===!1&&Q.exitCode===null)Q.kill(Y)})});let q=this._exitCallback;Q.on("close",(Z)=>{if(Z=Z??1,!q)_.exit(Z);else q(new A(Z,"commander.executeSubCommandAsync","(close)"))}),Q.on("error",(Z)=>{if(Z.code==="ENOENT")this._checkForMissingExecutable(G,X,$._name);else if(Z.code==="EACCES")throw Error(`'${G}' not executable`);if(!q)_.exit(1);else{let Y=new A(1,"commander.executeSubCommandAsync","(error)");Y.nestedError=Z,q(Y)}}),this.runningCommand=Q}_dispatchSubcommand($,T,R){let z=this._findCommand($);if(!z)this.help({error:!0});z._prepareForParse();let J;return J=this._chainOrCallSubCommandHook(J,z,"preSubcommand"),J=this._chainOrCall(J,()=>{if(z._executableHandler)this._executeSubCommand(z,T.concat(R));else return z._parseCommand(T,R)}),J}_dispatchHelpCommand($){if(!$)this.help();let T=this._findCommand($);if(T&&!T._executableHandler)T.help();return this._dispatchSubcommand($,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,T)=>{if($.required&&this.args[T]==null)this.missingArgument($.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let $=(R,z,J)=>{let G=z;if(z!==null&&R.parseArg){let X=`error: command-argument value '${z}' is invalid for argument '${R.name()}'.`;G=this._callParseArg(R,z,J,X)}return G};this._checkNumberOfArguments();let T=[];this.registeredArguments.forEach((R,z)=>{let J=R.defaultValue;if(R.variadic){if(z<this.args.length){if(J=this.args.slice(z),R.parseArg)J=J.reduce((G,X)=>{return $(R,X,G)},R.defaultValue)}else if(J===void 0)J=[]}else if(z<this.args.length){if(J=this.args[z],R.parseArg)J=$(R,J,R.defaultValue)}T[z]=J}),this.processedArgs=T}_chainOrCall($,T){if($&&$.then&&typeof $.then==="function")return $.then(()=>T());return T()}_chainOrCallHooks($,T){let R=$,z=[];if(this._getCommandAndAncestors().reverse().filter((J)=>J._lifeCycleHooks[T]!==void 0).forEach((J)=>{J._lifeCycleHooks[T].forEach((G)=>{z.push({hookedCommand:J,callback:G})})}),T==="postAction")z.reverse();return z.forEach((J)=>{R=this._chainOrCall(R,()=>{return J.callback(J.hookedCommand,this)})}),R}_chainOrCallSubCommandHook($,T,R){let z=$;if(this._lifeCycleHooks[R]!==void 0)this._lifeCycleHooks[R].forEach((J)=>{z=this._chainOrCall(z,()=>{return J(this,T)})});return z}_parseCommand($,T){let R=this.parseOptions(T);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(R.operands),T=R.unknown,this.args=$.concat(T),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),T);if(this._getHelpCommand()&&$[0]===this._getHelpCommand().name())return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(T),this._dispatchSubcommand(this._defaultCommandName,$,T);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(R.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let z=()=>{if(R.unknown.length>0)this.unknownOption(R.unknown[0])},J=`command:${this.name()}`;if(this._actionHandler){z(),this._processArguments();let G;if(G=this._chainOrCallHooks(G,"preAction"),G=this._chainOrCall(G,()=>this._actionHandler(this.processedArgs)),this.parent)G=this._chainOrCall(G,()=>{this.parent.emit(J,$,T)});return G=this._chainOrCallHooks(G,"postAction"),G}if(this.parent&&this.parent.listenerCount(J))z(),this._processArguments(),this.parent.emit(J,$,T);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,T);if(this.listenerCount("command:*"))this.emit("command:*",$,T);else if(this.commands.length)this.unknownCommand();else z(),this._processArguments()}else if(this.commands.length)z(),this.help({error:!0});else z(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((T)=>T._name===$||T._aliases.includes($))}_findOption($){return this.options.find((T)=>T.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((T)=>{if(T.mandatory&&$.getOptionValue(T.attributeName())===void 0)$.missingMandatoryOptionValue(T)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((R)=>{let z=R.attributeName();if(this.getOptionValue(z)===void 0)return!1;return this.getOptionValueSource(z)!=="default"});$.filter((R)=>R.conflictsWith.length>0).forEach((R)=>{let z=$.find((J)=>R.conflictsWith.includes(J.attributeName()));if(z)this._conflictingOption(R,z)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let T=[],R=[],z=T,J=$.slice();function G(Q){return Q.length>1&&Q[0]==="-"}let X=null;while(J.length){let Q=J.shift();if(Q==="--"){if(z===R)z.push(Q);z.push(...J);break}if(X&&!G(Q)){this.emit(`option:${X.name()}`,Q);continue}if(X=null,G(Q)){let q=this._findOption(Q);if(q){if(q.required){let Z=J.shift();if(Z===void 0)this.optionMissingArgument(q);this.emit(`option:${q.name()}`,Z)}else if(q.optional){let Z=null;if(J.length>0&&!G(J[0]))Z=J.shift();this.emit(`option:${q.name()}`,Z)}else this.emit(`option:${q.name()}`);X=q.variadic?q:null;continue}}if(Q.length>2&&Q[0]==="-"&&Q[1]!=="-"){let q=this._findOption(`-${Q[1]}`);if(q){if(q.required||q.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${q.name()}`,Q.slice(2));else this.emit(`option:${q.name()}`),J.unshift(`-${Q.slice(2)}`);continue}}if(/^--[^=]+=/.test(Q)){let q=Q.indexOf("="),Z=this._findOption(Q.slice(0,q));if(Z&&(Z.required||Z.optional)){this.emit(`option:${Z.name()}`,Q.slice(q+1));continue}}if(G(Q))z=R;if((this._enablePositionalOptions||this._passThroughOptions)&&T.length===0&&R.length===0){if(this._findCommand(Q)){if(T.push(Q),J.length>0)R.push(...J);break}else if(this._getHelpCommand()&&Q===this._getHelpCommand().name()){if(T.push(Q),J.length>0)T.push(...J);break}else if(this._defaultCommandName){if(R.push(Q),J.length>0)R.push(...J);break}}if(this._passThroughOptions){if(z.push(Q),J.length>0)z.push(...J);break}z.push(Q)}return{operands:T,unknown:R}}opts(){if(this._storeOptionsAsProperties){let $={},T=this.options.length;for(let R=0;R<T;R++){let z=this.options[R].attributeName();$[z]=z===this._versionOptionName?this._version:this[z]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,T)=>Object.assign($,T.opts()),{})}error($,T){if(this._outputConfiguration.outputError(`${$}
21
+ - ${R}`;throw Error(J)}_executeSubCommand($,T){T=T.slice();let z=!1,R=[".js",".ts",".tsx",".mjs",".cjs"];function J(q,U){let G=_.resolve(q,U);if(V.existsSync(G))return G;if(R.includes(_.extname(U)))return;let u=R.find((V$)=>V.existsSync(`${G}${V$}`));if(u)return`${G}${u}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Q=$._executableFile||`${this._name}-${$._name}`,Z=this._executableDir||"";if(this._scriptPath){let q;try{q=V.realpathSync(this._scriptPath)}catch{q=this._scriptPath}Z=_.resolve(_.dirname(q),Z)}if(Z){let q=J(Z,Q);if(!q&&!$._executableFile&&this._scriptPath){let U=_.basename(this._scriptPath,_.extname(this._scriptPath));if(U!==this._name)q=J(Z,`${U}-${$._name}`)}Q=q||Q}z=R.includes(_.extname(Q));let X;if(B.platform!=="win32")if(z)T.unshift(Q),T=a(B.execArgv).concat(T),X=A.spawn(B.argv[0],T,{stdio:"inherit"});else X=A.spawn(Q,T,{stdio:"inherit"});else this._checkForMissingExecutable(Q,Z,$._name),T.unshift(Q),T=a(B.execArgv).concat(T),X=A.spawn(B.execPath,T,{stdio:"inherit"});if(!X.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((U)=>{B.on(U,()=>{if(X.killed===!1&&X.exitCode===null)X.kill(U)})});let Y=this._exitCallback;X.on("close",(q)=>{if(q=q??1,!Y)B.exit(q);else Y(new w(q,"commander.executeSubCommandAsync","(close)"))}),X.on("error",(q)=>{if(q.code==="ENOENT")this._checkForMissingExecutable(Q,Z,$._name);else if(q.code==="EACCES")throw Error(`'${Q}' not executable`);if(!Y)B.exit(1);else{let U=new w(1,"commander.executeSubCommandAsync","(error)");U.nestedError=q,Y(U)}}),this.runningCommand=X}_dispatchSubcommand($,T,z){let R=this._findCommand($);if(!R)this.help({error:!0});R._prepareForParse();let J;return J=this._chainOrCallSubCommandHook(J,R,"preSubcommand"),J=this._chainOrCall(J,()=>{if(R._executableHandler)this._executeSubCommand(R,T.concat(z));else return R._parseCommand(T,z)}),J}_dispatchHelpCommand($){if(!$)this.help();let T=this._findCommand($);if(T&&!T._executableHandler)T.help();return this._dispatchSubcommand($,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,T)=>{if($.required&&this.args[T]==null)this.missingArgument($.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let $=(z,R,J)=>{let Q=R;if(R!==null&&z.parseArg){let Z=`error: command-argument value '${R}' is invalid for argument '${z.name()}'.`;Q=this._callParseArg(z,R,J,Z)}return Q};this._checkNumberOfArguments();let T=[];this.registeredArguments.forEach((z,R)=>{let J=z.defaultValue;if(z.variadic){if(R<this.args.length){if(J=this.args.slice(R),z.parseArg)J=J.reduce((Q,Z)=>{return $(z,Z,Q)},z.defaultValue)}else if(J===void 0)J=[]}else if(R<this.args.length){if(J=this.args[R],z.parseArg)J=$(z,J,z.defaultValue)}T[R]=J}),this.processedArgs=T}_chainOrCall($,T){if($&&$.then&&typeof $.then==="function")return $.then(()=>T());return T()}_chainOrCallHooks($,T){let z=$,R=[];if(this._getCommandAndAncestors().reverse().filter((J)=>J._lifeCycleHooks[T]!==void 0).forEach((J)=>{J._lifeCycleHooks[T].forEach((Q)=>{R.push({hookedCommand:J,callback:Q})})}),T==="postAction")R.reverse();return R.forEach((J)=>{z=this._chainOrCall(z,()=>{return J.callback(J.hookedCommand,this)})}),z}_chainOrCallSubCommandHook($,T,z){let R=$;if(this._lifeCycleHooks[z]!==void 0)this._lifeCycleHooks[z].forEach((J)=>{R=this._chainOrCall(R,()=>{return J(this,T)})});return R}_parseCommand($,T){let z=this.parseOptions(T);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(z.operands),T=z.unknown,this.args=$.concat(T),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),T);if(this._getHelpCommand()&&$[0]===this._getHelpCommand().name())return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(T),this._dispatchSubcommand(this._defaultCommandName,$,T);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(z.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let R=()=>{if(z.unknown.length>0)this.unknownOption(z.unknown[0])},J=`command:${this.name()}`;if(this._actionHandler){R(),this._processArguments();let Q;if(Q=this._chainOrCallHooks(Q,"preAction"),Q=this._chainOrCall(Q,()=>this._actionHandler(this.processedArgs)),this.parent)Q=this._chainOrCall(Q,()=>{this.parent.emit(J,$,T)});return Q=this._chainOrCallHooks(Q,"postAction"),Q}if(this.parent&&this.parent.listenerCount(J))R(),this._processArguments(),this.parent.emit(J,$,T);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,T);if(this.listenerCount("command:*"))this.emit("command:*",$,T);else if(this.commands.length)this.unknownCommand();else R(),this._processArguments()}else if(this.commands.length)R(),this.help({error:!0});else R(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((T)=>T._name===$||T._aliases.includes($))}_findOption($){return this.options.find((T)=>T.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((T)=>{if(T.mandatory&&$.getOptionValue(T.attributeName())===void 0)$.missingMandatoryOptionValue(T)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((z)=>{let R=z.attributeName();if(this.getOptionValue(R)===void 0)return!1;return this.getOptionValueSource(R)!=="default"});$.filter((z)=>z.conflictsWith.length>0).forEach((z)=>{let R=$.find((J)=>z.conflictsWith.includes(J.attributeName()));if(R)this._conflictingOption(z,R)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let T=[],z=[],R=T,J=$.slice();function Q(X){return X.length>1&&X[0]==="-"}let Z=null;while(J.length){let X=J.shift();if(X==="--"){if(R===z)R.push(X);R.push(...J);break}if(Z&&!Q(X)){this.emit(`option:${Z.name()}`,X);continue}if(Z=null,Q(X)){let Y=this._findOption(X);if(Y){if(Y.required){let q=J.shift();if(q===void 0)this.optionMissingArgument(Y);this.emit(`option:${Y.name()}`,q)}else if(Y.optional){let q=null;if(J.length>0&&!Q(J[0]))q=J.shift();this.emit(`option:${Y.name()}`,q)}else this.emit(`option:${Y.name()}`);Z=Y.variadic?Y:null;continue}}if(X.length>2&&X[0]==="-"&&X[1]!=="-"){let Y=this._findOption(`-${X[1]}`);if(Y){if(Y.required||Y.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${Y.name()}`,X.slice(2));else this.emit(`option:${Y.name()}`),J.unshift(`-${X.slice(2)}`);continue}}if(/^--[^=]+=/.test(X)){let Y=X.indexOf("="),q=this._findOption(X.slice(0,Y));if(q&&(q.required||q.optional)){this.emit(`option:${q.name()}`,X.slice(Y+1));continue}}if(Q(X))R=z;if((this._enablePositionalOptions||this._passThroughOptions)&&T.length===0&&z.length===0){if(this._findCommand(X)){if(T.push(X),J.length>0)z.push(...J);break}else if(this._getHelpCommand()&&X===this._getHelpCommand().name()){if(T.push(X),J.length>0)T.push(...J);break}else if(this._defaultCommandName){if(z.push(X),J.length>0)z.push(...J);break}}if(this._passThroughOptions){if(R.push(X),J.length>0)R.push(...J);break}R.push(X)}return{operands:T,unknown:z}}opts(){if(this._storeOptionsAsProperties){let $={},T=this.options.length;for(let z=0;z<T;z++){let R=this.options[z].attributeName();$[R]=R===this._versionOptionName?this._version:this[R]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,T)=>Object.assign($,T.opts()),{})}error($,T){if(this._outputConfiguration.outputError(`${$}
22
22
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
23
23
  `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
24
- `),this.outputHelp({error:!0});let R=T||{},z=R.exitCode||1,J=R.code||"commander.error";this._exit(z,J,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in _.env){let T=$.attributeName();if(this.getOptionValue(T)===void 0||["default","config","env"].includes(this.getOptionValueSource(T)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,_.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new $T(this.options),T=(R)=>{return this.getOptionValue(R)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(R))};this.options.filter((R)=>R.implied!==void 0&&T(R.attributeName())&&$.valueFromOption(this.getOptionValue(R.attributeName()),R)).forEach((R)=>{Object.keys(R.implied).filter((z)=>!T(z)).forEach((z)=>{this.setOptionValueWithSource(z,R.implied[z],"implied")})})}missingArgument($){let T=`error: missing required argument '${$}'`;this.error(T,{code:"commander.missingArgument"})}optionMissingArgument($){let T=`error: option '${$.flags}' argument missing`;this.error(T,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let T=`error: required option '${$.flags}' not specified`;this.error(T,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,T){let R=(G)=>{let X=G.attributeName(),Q=this.getOptionValue(X),q=this.options.find((Y)=>Y.negate&&X===Y.attributeName()),Z=this.options.find((Y)=>!Y.negate&&X===Y.attributeName());if(q&&(q.presetArg===void 0&&Q===!1||q.presetArg!==void 0&&Q===q.presetArg))return q;return Z||G},z=(G)=>{let X=R(G),Q=X.attributeName();if(this.getOptionValueSource(Q)==="env")return`environment variable '${X.envVar}'`;return`option '${X.flags}'`},J=`error: ${z($)} cannot be used with ${z(T)}`;this.error(J,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let T="";if($.startsWith("--")&&this._showSuggestionAfterError){let z=[],J=this;do{let G=J.createHelp().visibleOptions(J).filter((X)=>X.long).map((X)=>X.long);z=z.concat(G),J=J.parent}while(J&&!J._enablePositionalOptions);T=n($,z)}let R=`error: unknown option '${$}'${T}`;this.error(R,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let T=this.registeredArguments.length,R=T===1?"":"s",J=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${T} argument${R} but got ${$.length}.`;this.error(J,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],T="";if(this._showSuggestionAfterError){let z=[];this.createHelp().visibleCommands(this).forEach((J)=>{if(z.push(J.name()),J.alias())z.push(J.alias())}),T=n($,z)}let R=`error: unknown command '${$}'${T}`;this.error(R,{code:"commander.unknownCommand"})}version($,T,R){if($===void 0)return this._version;this._version=$,T=T||"-V, --version",R=R||"output the version number";let z=this.createOption(T,R);return this._versionOptionName=z.attributeName(),this._registerOption(z),this.on("option:"+z.name(),()=>{this._outputConfiguration.writeOut(`${$}
25
- `),this._exit(0,"commander.version",$)}),this}description($,T){if($===void 0&&T===void 0)return this._description;if(this._description=$,T)this._argsDescription=T;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let T=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)T=this.commands[this.commands.length-1];if($===T._name)throw Error("Command alias can't be the same as its name");let R=this.parent?._findCommand($);if(R){let z=[R.name()].concat(R.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${z}'`)}return T._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((T)=>this.alias(T)),this}usage($){if($===void 0){if(this._usage)return this._usage;let T=this.registeredArguments.map((R)=>{return r$(R)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?T:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}nameFromFilename($){return this._name=B.basename($,B.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let T=this.createHelp(),R=this._getOutputContext($);T.prepareContext({error:R.error,helpWidth:R.helpWidth,outputHasColors:R.hasColors});let z=T.formatHelp(this,T);if(R.hasColors)return z;return this._outputConfiguration.stripColor(z)}_getOutputContext($){$=$||{};let T=!!$.error,R,z,J;if(T)R=(X)=>this._outputConfiguration.writeErr(X),z=this._outputConfiguration.getErrHasColors(),J=this._outputConfiguration.getErrHelpWidth();else R=(X)=>this._outputConfiguration.writeOut(X),z=this._outputConfiguration.getOutHasColors(),J=this._outputConfiguration.getOutHelpWidth();return{error:T,write:(X)=>{if(!z)X=this._outputConfiguration.stripColor(X);return R(X)},hasColors:z,helpWidth:J}}outputHelp($){let T;if(typeof $==="function")T=$,$=void 0;let R=this._getOutputContext($),z={error:R.error,write:R.write,command:this};this._getCommandAndAncestors().reverse().forEach((G)=>G.emit("beforeAllHelp",z)),this.emit("beforeHelp",z);let J=this.helpInformation({error:R.error});if(T){if(J=T(J),typeof J!=="string"&&!Buffer.isBuffer(J))throw Error("outputHelp callback must return a string or a Buffer")}if(R.write(J),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",z),this._getCommandAndAncestors().forEach((G)=>G.emit("afterAllHelp",z))}helpOption($,T){if(typeof $==="boolean"){if($)this._helpOption=this._helpOption??void 0;else this._helpOption=null;return this}return $=$??"-h, --help",T=T??"display help for command",this._helpOption=this.createOption($,T),this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this}help($){this.outputHelp($);let T=Number(_.exitCode??0);if(T===0&&$&&typeof $!=="function"&&$.error)T=1;this._exit(T,"commander.help","(outputHelp)")}addHelpText($,T){let R=["beforeAll","before","after","afterAll"];if(!R.includes($))throw Error(`Unexpected value for position to addHelpText.
26
- Expecting one of '${R.join("', '")}'`);let z=`${$}Help`;return this.on(z,(J)=>{let G;if(typeof T==="function")G=T({error:J.error,command:J.command});else G=T;if(G)J.write(`${G}
27
- `)}),this}_outputHelpIfRequested($){let T=this._getHelpOption();if(T&&$.find((z)=>T.is(z)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function r($){return $.map((T)=>{if(!T.startsWith("--inspect"))return T;let R,z="127.0.0.1",J="9229",G;if((G=T.match(/^(--inspect(-brk)?)$/))!==null)R=G[1];else if((G=T.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(R=G[1],/^\d+$/.test(G[3]))J=G[3];else z=G[3];else if((G=T.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)R=G[1],z=G[3],J=G[4];if(R&&J!=="0")return`${R}=${z}:${parseInt(J)+1}`;return T})}function w(){if(_.env.NO_COLOR||_.env.FORCE_COLOR==="0"||_.env.FORCE_COLOR==="false")return!1;if(_.env.FORCE_COLOR||_.env.CLICOLOR_FORCE!==void 0)return!0;return}TT.Command=k;TT.useColor=w});var R$=H((QT)=>{var{Argument:e}=W(),{Command:C}=a(),{CommanderError:JT,InvalidArgumentError:$$}=K(),{Help:GT}=D(),{Option:T$}=V();QT.program=new C;QT.createCommand=($)=>new C($);QT.createOption=($,T)=>new T$($,T);QT.createArgument=($,T)=>new e($,T);QT.Command=C;QT.Option=T$;QT.Argument=e;QT.Help=GT;QT.CommanderError=JT;QT.InvalidArgumentError=$$;QT.InvalidOptionArgumentError=$$});var z$=N$(R$(),1),{program:mT,createCommand:dT,createArgument:iT,createOption:sT,CommanderError:oT,InvalidArgumentError:tT,InvalidOptionArgumentError:pT,Command:J$,Argument:nT,Option:rT,Help:aT}=z$.default;import{createInterface as WT}from"readline";import{existsSync as fT}from"fs";import{resolve as yT}from"path";import{existsSync as Q$,mkdirSync as HT,readFileSync as ST,writeFileSync as KT}from"fs";import{homedir as PT}from"os";import{join as X$}from"path";var y=X$(PT(),".gobot-tools"),b=X$(y,"config.json");function G$(){return{projectDir:"",installedTools:[]}}function S(){if(!Q$(b))return G$();try{return JSON.parse(ST(b,"utf-8"))}catch{return G$()}}function P($){if(!Q$(y))HT(y,{recursive:!0});KT(b,JSON.stringify($,null,2)+`
28
- `)}function E(){return S().projectDir!==""}function x(){return y}function O($){let T=WT({input:process.stdin,output:process.stdout});return new Promise((R)=>{T.question($,(z)=>{T.close(),R(z.trim())})})}async function Z$(){console.log(`
24
+ `),this.outputHelp({error:!0});let z=T||{},R=z.exitCode||1,J=z.code||"commander.error";this._exit(R,J,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in B.env){let T=$.attributeName();if(this.getOptionValue(T)===void 0||["default","config","env"].includes(this.getOptionValueSource(T)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,B.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new R0(this.options),T=(z)=>{return this.getOptionValue(z)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(z))};this.options.filter((z)=>z.implied!==void 0&&T(z.attributeName())&&$.valueFromOption(this.getOptionValue(z.attributeName()),z)).forEach((z)=>{Object.keys(z.implied).filter((R)=>!T(R)).forEach((R)=>{this.setOptionValueWithSource(R,z.implied[R],"implied")})})}missingArgument($){let T=`error: missing required argument '${$}'`;this.error(T,{code:"commander.missingArgument"})}optionMissingArgument($){let T=`error: option '${$.flags}' argument missing`;this.error(T,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let T=`error: required option '${$.flags}' not specified`;this.error(T,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,T){let z=(Q)=>{let Z=Q.attributeName(),X=this.getOptionValue(Z),Y=this.options.find((U)=>U.negate&&Z===U.attributeName()),q=this.options.find((U)=>!U.negate&&Z===U.attributeName());if(Y&&(Y.presetArg===void 0&&X===!1||Y.presetArg!==void 0&&X===Y.presetArg))return Y;return q||Q},R=(Q)=>{let Z=z(Q),X=Z.attributeName();if(this.getOptionValueSource(X)==="env")return`environment variable '${Z.envVar}'`;return`option '${Z.flags}'`},J=`error: ${R($)} cannot be used with ${R(T)}`;this.error(J,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let T="";if($.startsWith("--")&&this._showSuggestionAfterError){let R=[],J=this;do{let Q=J.createHelp().visibleOptions(J).filter((Z)=>Z.long).map((Z)=>Z.long);R=R.concat(Q),J=J.parent}while(J&&!J._enablePositionalOptions);T=r($,R)}let z=`error: unknown option '${$}'${T}`;this.error(z,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let T=this.registeredArguments.length,z=T===1?"":"s",J=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${T} argument${z} but got ${$.length}.`;this.error(J,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],T="";if(this._showSuggestionAfterError){let R=[];this.createHelp().visibleCommands(this).forEach((J)=>{if(R.push(J.name()),J.alias())R.push(J.alias())}),T=r($,R)}let z=`error: unknown command '${$}'${T}`;this.error(z,{code:"commander.unknownCommand"})}version($,T,z){if($===void 0)return this._version;this._version=$,T=T||"-V, --version",z=z||"output the version number";let R=this.createOption(T,z);return this._versionOptionName=R.attributeName(),this._registerOption(R),this.on("option:"+R.name(),()=>{this._outputConfiguration.writeOut(`${$}
25
+ `),this._exit(0,"commander.version",$)}),this}description($,T){if($===void 0&&T===void 0)return this._description;if(this._description=$,T)this._argsDescription=T;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let T=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)T=this.commands[this.commands.length-1];if($===T._name)throw Error("Command alias can't be the same as its name");let z=this.parent?._findCommand($);if(z){let R=[z.name()].concat(z.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${R}'`)}return T._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((T)=>this.alias(T)),this}usage($){if($===void 0){if(this._usage)return this._usage;let T=this.registeredArguments.map((z)=>{return $0(z)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?T:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}nameFromFilename($){return this._name=_.basename($,_.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let T=this.createHelp(),z=this._getOutputContext($);T.prepareContext({error:z.error,helpWidth:z.helpWidth,outputHasColors:z.hasColors});let R=T.formatHelp(this,T);if(z.hasColors)return R;return this._outputConfiguration.stripColor(R)}_getOutputContext($){$=$||{};let T=!!$.error,z,R,J;if(T)z=(Z)=>this._outputConfiguration.writeErr(Z),R=this._outputConfiguration.getErrHasColors(),J=this._outputConfiguration.getErrHelpWidth();else z=(Z)=>this._outputConfiguration.writeOut(Z),R=this._outputConfiguration.getOutHasColors(),J=this._outputConfiguration.getOutHelpWidth();return{error:T,write:(Z)=>{if(!R)Z=this._outputConfiguration.stripColor(Z);return z(Z)},hasColors:R,helpWidth:J}}outputHelp($){let T;if(typeof $==="function")T=$,$=void 0;let z=this._getOutputContext($),R={error:z.error,write:z.write,command:this};this._getCommandAndAncestors().reverse().forEach((Q)=>Q.emit("beforeAllHelp",R)),this.emit("beforeHelp",R);let J=this.helpInformation({error:z.error});if(T){if(J=T(J),typeof J!=="string"&&!Buffer.isBuffer(J))throw Error("outputHelp callback must return a string or a Buffer")}if(z.write(J),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",R),this._getCommandAndAncestors().forEach((Q)=>Q.emit("afterAllHelp",R))}helpOption($,T){if(typeof $==="boolean"){if($)this._helpOption=this._helpOption??void 0;else this._helpOption=null;return this}return $=$??"-h, --help",T=T??"display help for command",this._helpOption=this.createOption($,T),this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this}help($){this.outputHelp($);let T=Number(B.exitCode??0);if(T===0&&$&&typeof $!=="function"&&$.error)T=1;this._exit(T,"commander.help","(outputHelp)")}addHelpText($,T){let z=["beforeAll","before","after","afterAll"];if(!z.includes($))throw Error(`Unexpected value for position to addHelpText.
26
+ Expecting one of '${z.join("', '")}'`);let R=`${$}Help`;return this.on(R,(J)=>{let Q;if(typeof T==="function")Q=T({error:J.error,command:J.command});else Q=T;if(Q)J.write(`${Q}
27
+ `)}),this}_outputHelpIfRequested($){let T=this._getHelpOption();if(T&&$.find((R)=>T.is(R)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function a($){return $.map((T)=>{if(!T.startsWith("--inspect"))return T;let z,R="127.0.0.1",J="9229",Q;if((Q=T.match(/^(--inspect(-brk)?)$/))!==null)z=Q[1];else if((Q=T.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(z=Q[1],/^\d+$/.test(Q[3]))J=Q[3];else R=Q[3];else if((Q=T.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)z=Q[1],R=Q[3],J=Q[4];if(z&&J!=="0")return`${z}=${R}:${parseInt(J)+1}`;return T})}function k(){if(B.env.NO_COLOR||B.env.FORCE_COLOR==="0"||B.env.FORCE_COLOR==="false")return!1;if(B.env.FORCE_COLOR||B.env.CLICOLOR_FORCE!==void 0)return!0;return}J0.Command=b;J0.useColor=k});var R$=K((Y0)=>{var{Argument:$$}=y(),{Command:C}=e(),{CommanderError:Z0,InvalidArgumentError:T$}=W(),{Help:q0}=D(),{Option:z$}=F();Y0.program=new C;Y0.createCommand=($)=>new C($);Y0.createOption=($,T)=>new z$($,T);Y0.createArgument=($,T)=>new $$($,T);Y0.Command=C;Y0.Option=z$;Y0.Argument=$$;Y0.Help=q0;Y0.CommanderError=Z0;Y0.InvalidArgumentError=T$;Y0.InvalidOptionArgumentError=T$});var J$=F$(R$(),1),{program:i0,createCommand:o0,createArgument:t0,createOption:n0,CommanderError:p0,InvalidArgumentError:r0,InvalidOptionArgumentError:a0,Command:Q$,Argument:e0,Option:$T,Help:TT}=J$.default;import{createInterface as E0}from"readline";import{existsSync as f0}from"fs";import{resolve as N0}from"path";import{existsSync as Z$,mkdirSync as W0,readFileSync as S0,writeFileSync as y0}from"fs";import{homedir as V0}from"os";import{join as q$}from"path";var E=q$(V0(),".gobot-tools"),x=q$(E,"config.json");function X$(){return{projectDir:"",installedTools:[],installedVersions:{}}}function I(){if(!Z$(x))return X$();try{let $=JSON.parse(S0(x,"utf-8"));return{installedVersions:{},...$}}catch{return X$()}}function S($){if(!Z$(E))W0(E,{recursive:!0});y0(x,JSON.stringify($,null,2)+`
28
+ `)}function P(){return I().projectDir!==""}function O(){return E}function v($){let T=E0({input:process.stdin,output:process.stdout});return new Promise((z)=>{T.question($,(R)=>{T.close(),z(R.trim())})})}async function Y$(){console.log(`
29
29
  gobot-tools init
30
30
  `),console.log(` This sets up gobot-tools for your project.
31
- `);let $=S();if($.projectDir){if(console.log(` Current project directory: ${$.projectDir}`),(await O(" Change it? (y/N) ")).toLowerCase()!=="y"){console.log(` Keeping existing configuration.
32
- `);return}}let T=await O(" Where is your bot project? (absolute path) "),R=yT(T);if(!fT(R))if(console.log(`
33
- Directory not found: ${R}`),(await O(" Create it? (y/N) ")).toLowerCase()==="y"){let{mkdirSync:J}=U("fs");J(R,{recursive:!0}),console.log(` Created ${R}`)}else{console.log(` Aborted.
34
- `);return}$.projectDir=R,P($),console.log(`
35
- Project directory set to: ${R}`),console.log(" Config saved to: ~/.gobot-tools/config.json"),console.log(`
31
+ `);let $=I();if($.projectDir){if(console.log(` Current project directory: ${$.projectDir}`),(await v(" Change it? (y/N) ")).toLowerCase()!=="y"){console.log(` Keeping existing configuration.
32
+ `);return}}let T=await v(" Where is your bot project? (absolute path) "),z=N0(T);if(!f0(z))if(console.log(`
33
+ Directory not found: ${z}`),(await v(" Create it? (y/N) ")).toLowerCase()==="y"){let{mkdirSync:J}=L("fs");J(z,{recursive:!0}),console.log(` Created ${z}`)}else{console.log(` Aborted.
34
+ `);return}$.projectDir=z,S($),console.log(`
35
+ Project directory set to: ${z}`),console.log(" Config saved to: ~/.gobot-tools/config.json"),console.log(`
36
36
  Next: run "gobot-tools list" to see available tools.
37
- `)}import{existsSync as v,readFileSync as q$}from"fs";import{join as Y$}from"path";var __dirname="/Users/studio/Projects/gobot-tools/cli/src/lib",ET="https://raw.githubusercontent.com/tk-47/gobot-tools/main/registry.json",NT=900000;function _$(){return Y$(x(),"registry-cache.json")}async function DT(){let $=await fetch(ET);if(!$.ok)throw Error(`Failed to fetch registry: ${$.status}`);return(await $.json()).tools}function VT(){let $=_$();if(!v($))return null;try{return JSON.parse(q$($,"utf-8"))}catch{return null}}function FT($){let{mkdirSync:T,writeFileSync:R}=U("fs"),z=x();if(!v(z))T(z,{recursive:!0});let J={fetchedAt:Date.now(),tools:$};R(_$(),JSON.stringify(J,null,2))}async function M(){let $=VT();if($&&Date.now()-$.fetchedAt<NT)return $.tools;try{let T=await DT();return FT(T),T}catch{if($)return $.tools;let T=Y$(__dirname,"../../../registry.json");if(v(T))return JSON.parse(q$(T,"utf-8")).tools;throw Error("Could not load tool registry. Check your internet connection.")}}function j$($,T){let R=T.toLowerCase();return $.filter((z)=>z.name.includes(R)||z.displayName.toLowerCase().includes(R)||z.description.toLowerCase().includes(R)||z.category.includes(R)||z.tags.some((J)=>J.includes(R)))}import{existsSync as I$,mkdirSync as AT,writeFileSync as wT}from"fs";import{join as h}from"path";var kT="https://raw.githubusercontent.com/tk-47/gobot-tools/main/packages";async function B$($){let T=S();if(!T.projectDir)throw Error('No project directory configured. Run "gobot-tools init" first.');let R=h(T.projectDir,".gobot-tools",$.name);if(!I$(R))AT(R,{recursive:!0});for(let z of $.files){let J=`${kT}/${$.name}/${z}`,G=await fetch(J);if(!G.ok)throw Error(`Failed to download ${z}: ${G.status}`);let X=await G.text(),Q=h(R,z);wT(Q,X)}if(!T.installedTools.includes($.name))T.installedTools.push($.name),P(T)}function U$($){let T=S();if(!T.projectDir)throw Error('No project directory configured. Run "gobot-tools init" first.');let R=h(T.projectDir,".gobot-tools",$);if(I$(R)){let{rmSync:z}=U("fs");z(R,{recursive:!0})}T.installedTools=T.installedTools.filter((z)=>z!==$),P(T)}function I($){return S().installedTools.includes($)}async function M$(){let $=await M();console.log(`
37
+ `)}import{existsSync as h,readFileSync as U$}from"fs";import{join as B$}from"path";var __dirname="/Users/studio/Projects/gobot-tools/cli/src/lib",D0="https://raw.githubusercontent.com/tk-47/gobot-tools/main/registry.json",F0=900000;function G$(){return B$(O(),"registry-cache.json")}async function A0(){let $=await fetch(D0);if(!$.ok)throw Error(`Failed to fetch registry: ${$.status}`);return(await $.json()).tools}function w0(){let $=G$();if(!h($))return null;try{return JSON.parse(U$($,"utf-8"))}catch{return null}}function k0($){let{mkdirSync:T,writeFileSync:z}=L("fs"),R=O();if(!h(R))T(R,{recursive:!0});let J={fetchedAt:Date.now(),tools:$};z(G$(),JSON.stringify(J,null,2))}async function M(){let $=w0();if($&&Date.now()-$.fetchedAt<F0)return $.tools;try{let T=await A0();return k0(T),T}catch{if($)return $.tools;let T=B$(__dirname,"../../../registry.json");if(h(T))return JSON.parse(U$(T,"utf-8")).tools;throw Error("Could not load tool registry. Check your internet connection.")}}function j$($,T){let z=T.toLowerCase();return $.filter((R)=>R.name.includes(z)||R.displayName.toLowerCase().includes(z)||R.description.toLowerCase().includes(z)||R.category.includes(z)||R.tags.some((J)=>J.includes(z)))}import{existsSync as _$,mkdirSync as M$,writeFileSync as b0}from"fs";import{dirname as C0,join as l}from"path";var x0="https://raw.githubusercontent.com/tk-47/gobot-tools/main/packages";async function f($){let T=I();if(!T.projectDir)throw Error('No project directory configured. Run "gobot-tools init" first.');let z=l(T.projectDir,".gobot-tools",$.name);if(!_$(z))M$(z,{recursive:!0});for(let R of $.files){let J=`${x0}/${$.name}/${R}`,Q=await fetch(J);if(!Q.ok)throw Error(`Failed to download ${R}: ${Q.status}`);let Z=await Q.text(),X=l(z,R);M$(C0(X),{recursive:!0}),b0(X,Z)}if(!T.installedTools.includes($.name))T.installedTools.push($.name);T.installedVersions[$.name]=$.version,S(T)}function H$($){let T=I();if(!T.projectDir)throw Error('No project directory configured. Run "gobot-tools init" first.');let z=l(T.projectDir,".gobot-tools",$);if(_$(z)){let{rmSync:R}=L("fs");R(z,{recursive:!0})}T.installedTools=T.installedTools.filter((R)=>R!==$),delete T.installedVersions[$],S(T)}function j($){return I().installedTools.includes($)}function L$($){return I().installedVersions[$]}async function I$(){let $=await M();console.log(`
38
38
  gobot-tools marketplace (${$.length} tools)
39
- `);let T=new Map;for(let R of $){let z=R.category;if(!T.has(z))T.set(z,[]);T.get(z).push(R)}for(let[R,z]of T){let J=R.charAt(0).toUpperCase()+R.slice(1);console.log(` ${J}`),console.log(` ${"─".repeat(50)}`);for(let G of z){let X=I(G.name)?" [installed]":"",Q=G.name.padEnd(22);console.log(` ${Q} ${G.displayName}${X}`),console.log(` ${"".padEnd(22)} ${CT(G.description.slice(0,70))}`)}console.log()}console.log(` Run "gobot-tools info <tool>" for details, or "gobot-tools install <tool>" to install.
40
- `)}function CT($){return`\x1B[2m${$}\x1B[0m`}async function L$($){let T=await M(),R=j$(T,$);if(R.length===0){console.log(`
39
+ `);let T=new Map;for(let z of $){let R=z.category;if(!T.has(R))T.set(R,[]);T.get(R).push(z)}for(let[z,R]of T){let J=z.charAt(0).toUpperCase()+z.slice(1);console.log(` ${J}`),console.log(` ${"─".repeat(50)}`);for(let Q of R){let Z=j(Q.name)?" [installed]":"",X=Q.name.padEnd(22);console.log(` ${X} ${Q.displayName}${Z}`),console.log(` ${"".padEnd(22)} ${O0(Q.description.slice(0,70))}`)}console.log()}console.log(` Run "gobot-tools info <tool>" for details, or "gobot-tools install <tool>" to install.
40
+ `)}function O0($){return`\x1B[2m${$}\x1B[0m`}async function K$($){let T=await M(),z=j$(T,$);if(z.length===0){console.log(`
41
41
  No tools found matching "${$}".
42
42
  `);return}console.log(`
43
- ${R.length} result(s) for "${$}":
44
- `);for(let z of R){let J=I(z.name)?" [installed]":"";console.log(` ${z.name} — ${z.displayName}${J}`),console.log(` ${z.description}`),console.log(` Category: ${z.category} Tags: ${z.tags.join(", ")}`),console.log()}}async function H$($){let R=(await M()).find((J)=>J.name===$);if(!R){console.log(`
43
+ ${z.length} result(s) for "${$}":
44
+ `);for(let R of z){let J=j(R.name)?" [installed]":"";console.log(` ${R.name} — ${R.displayName}${J}`),console.log(` ${R.description}`),console.log(` Category: ${R.category} Tags: ${R.tags.join(", ")}`),console.log()}}async function P$($){let z=(await M()).find((J)=>J.name===$);if(!z){console.log(`
45
45
  Tool "${$}" not found.`),console.log(` Run "gobot-tools list" to see available tools.
46
- `);return}let z=I(R.name);if(console.log(`
47
- ${R.displayName} (${R.name})`),console.log(` ${"─".repeat(50)}`),console.log(` ${R.description}
48
- `),console.log(` Version: ${R.version}`),console.log(` Author: ${R.author}`),console.log(` Category: ${R.category}`),console.log(` Tags: ${R.tags.join(", ")}`),console.log(` Status: ${z?"Installed":"Not installed"}`),R.dependencies.length>0)console.log(` Dependencies: ${R.dependencies.join(", ")}`);if(R.envVars.length>0){console.log(`
49
- Environment variables needed:`);for(let J of R.envVars)console.log(` - ${J}`)}console.log(`
50
- Files:`);for(let J of R.files)console.log(` - ${J}`);if(console.log(`
51
- After install: ${R.postInstall}
52
- `),!z)console.log(` Run "gobot-tools install ${R.name}" to install.
53
- `)}async function S$($){if(!E()){console.log(`
46
+ `);return}let R=j(z.name);if(console.log(`
47
+ ${z.displayName} (${z.name})`),console.log(` ${"─".repeat(50)}`),console.log(` ${z.description}
48
+ `),console.log(` Version: ${z.version}`),console.log(` Author: ${z.author}`),console.log(` Category: ${z.category}`),console.log(` Tags: ${z.tags.join(", ")}`),console.log(` Status: ${R?"Installed":"Not installed"}`),z.dependencies.length>0)console.log(` Dependencies: ${z.dependencies.join(", ")}`);if(z.envVars.length>0){console.log(`
49
+ Environment variables needed:`);for(let J of z.envVars)console.log(` - ${J}`)}console.log(`
50
+ Files:`);for(let J of z.files)console.log(` - ${J}`);if(console.log(`
51
+ After install: ${z.postInstall}
52
+ `),!R)console.log(` Run "gobot-tools install ${z.name}" to install.
53
+ `)}async function W$($){if(!P()){console.log(`
54
54
  Not initialized. Run "gobot-tools init" first to set your project directory.
55
- `);return}let R=(await M()).find((z)=>z.name===$);if(!R){console.log(`
55
+ `);return}let z=(await M()).find((R)=>R.name===$);if(!z){console.log(`
56
56
  Tool "${$}" not found.`),console.log(` Run "gobot-tools list" to see available tools.
57
- `);return}if(I(R.name)){console.log(`
58
- "${R.displayName}" is already installed.
59
- `);return}for(let z of R.dependencies)if(!I(z)){console.log(`
60
- Dependency "${z}" is not installed. Install it first:
61
- `),console.log(` gobot-tools install ${z}
57
+ `);return}if(j(z.name)){console.log(`
58
+ "${z.displayName}" is already installed.
59
+ `);return}for(let R of z.dependencies)if(!j(R)){console.log(`
60
+ Dependency "${R}" is not installed. Install it first:
61
+ `),console.log(` gobot-tools install ${R}
62
62
  `);return}console.log(`
63
- Installing ${R.displayName}...`);try{if(await B$(R),console.log(` Installed to: <project>/.gobot-tools/${R.name}/
64
- `),R.envVars.length>0){console.log(" Add these to your .env:");for(let z of R.envVars)console.log(` ${z}=your-value-here`);console.log()}console.log(` Next step: ${R.postInstall}
65
- `)}catch(z){console.log(`
66
- Install failed: ${z.message}
67
- `)}}async function K$($){if(!E()){console.log(`
63
+ Installing ${z.displayName}...`);try{if(await f(z),console.log(` Installed to: <project>/.gobot-tools/${z.name}/
64
+ `),z.envVars.length>0){console.log(" Add these to your .env:");for(let R of z.envVars)console.log(` ${R}=your-value-here`);console.log()}console.log(` Next step: ${z.postInstall}
65
+ `)}catch(R){console.log(`
66
+ Install failed: ${R.message}
67
+ `)}}async function S$($){if(!P()){console.log(`
68
68
  Not initialized. Run "gobot-tools init" first.
69
- `);return}if(!I($)){console.log(`
69
+ `);return}if(!j($)){console.log(`
70
70
  "${$}" is not installed.
71
- `);return}U$($),console.log(`
71
+ `);return}H$($),console.log(`
72
72
  Uninstalled "${$}".
73
- `)}var L=new J$;L.name("gobot-tools").description("CLI marketplace for Autonomee community bot tools").version("1.0.0");L.command("init").description("Set up gobot-tools for your project").action(Z$);L.command("list").description("Browse all available tools").action(M$);L.command("search <query>").description("Search tools by name, category, or keyword").action(L$);L.command("info <tool>").description("Show details about a specific tool").action(H$);L.command("install <tool>").description("Install a tool into your project").action(S$);L.command("uninstall <tool>").description("Remove an installed tool").action(K$);L.parse();
73
+ `)}async function y$($){if(!P()){console.log(`
74
+ Not initialized. Run "gobot-tools init" first to set your project directory.
75
+ `);return}let T=await M(),z=$?T.filter((Q)=>Q.name===$):T.filter((Q)=>j(Q.name));if($&&z.length===0){console.log(`
76
+ Tool "${$}" not found.`),console.log(` Run "gobot-tools list" to see available tools.
77
+ `);return}if(z.length===0){console.log(`
78
+ No tools installed yet. Run "gobot-tools install <tool>" first.
79
+ `);return}let R=0,J=0;for(let Q of z){let Z=L$(Q.name);if(Z===Q.version){console.log(` ${Q.displayName}: already up to date (${Q.version})`),J++;continue}let X=Z??"unknown";console.log(`
80
+ Updating ${Q.displayName}: ${X} → ${Q.version}...`);try{await f(Q),console.log(" Updated."),R++}catch(Y){console.log(` Update failed: ${Y.message}`)}}if(console.log(),R>0)console.log(` ${R} tool(s) updated.`);if(J>0&&R===0)console.log(" All tools are up to date.");console.log()}var H=new Q$;H.name("gobot-tools").description("CLI marketplace for Autonomee community bot tools").version("1.1.1");H.command("init").description("Set up gobot-tools for your project").action(Y$);H.command("list").description("Browse all available tools").action(I$);H.command("search <query>").description("Search tools by name, category, or keyword").action(K$);H.command("info <tool>").description("Show details about a specific tool").action(P$);H.command("install <tool>").description("Install a tool into your project").action(W$);H.command("uninstall <tool>").description("Remove an installed tool").action(S$);H.command("update [tool]").description("Update an installed tool, or all installed tools if no name given").action(y$);H.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gobot-tools",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "CLI marketplace for Autonomee community bot tools — browse, install, and configure integrations for your AI Telegram bot",
5
5
  "type": "module",
6
6
  "bin": {