give-skill 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -35
- package/dist/index.js +68 -68
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ npx give-skill https://github.com/expo/skills
|
|
|
69
69
|
# Install to specific agent
|
|
70
70
|
npx give-skill expo/skills -a copilot
|
|
71
71
|
|
|
72
|
-
# Install globally (available
|
|
72
|
+
# Install globally (available across all projects)
|
|
73
73
|
npx give-skill expo/skills --global
|
|
74
74
|
|
|
75
75
|
# List available skills first
|
|
@@ -84,10 +84,13 @@ npx give-skill expo/skills --list
|
|
|
84
84
|
# List all installed skills
|
|
85
85
|
npx give-skill list
|
|
86
86
|
|
|
87
|
-
# Check status of all installed skills
|
|
87
|
+
# Check status of all installed skills (compact view)
|
|
88
88
|
npx give-skill status
|
|
89
89
|
|
|
90
|
-
# Check status
|
|
90
|
+
# Check status with detailed information
|
|
91
|
+
npx give-skill status --verbose
|
|
92
|
+
|
|
93
|
+
# Check status of specific skills (automatically shows details)
|
|
91
94
|
npx give-skill status pr-reviewer test-generator
|
|
92
95
|
|
|
93
96
|
# Update all skills with available updates (interactive selection)
|
|
@@ -102,12 +105,6 @@ npx give-skill update -y
|
|
|
102
105
|
# Remove specific skills
|
|
103
106
|
npx give-skill remove pr-reviewer
|
|
104
107
|
|
|
105
|
-
# Remove from specific agent only
|
|
106
|
-
npx give-skill remove pr-reviewer -a claude-code
|
|
107
|
-
|
|
108
|
-
# Remove global installation only
|
|
109
|
-
npx give-skill remove pr-reviewer --global
|
|
110
|
-
|
|
111
108
|
# Remove without confirmation (auto-selects all)
|
|
112
109
|
npx give-skill remove -y
|
|
113
110
|
|
|
@@ -148,8 +145,8 @@ Options:
|
|
|
148
145
|
|
|
149
146
|
Commands:
|
|
150
147
|
update [skills...] Update installed skills to their latest versions
|
|
151
|
-
status [skills...] Check status of installed skills (
|
|
152
|
-
remove [skills...] Remove installed skills (
|
|
148
|
+
status [skills...] Check status of installed skills (compact view, use -v for details)
|
|
149
|
+
remove [skills...] Remove installed skills (use -y to skip confirmation)
|
|
153
150
|
list List all installed skills
|
|
154
151
|
clean Remove orphaned skill entries from state
|
|
155
152
|
```
|
|
@@ -291,43 +288,25 @@ If a folder matches an agent's skill directory, the CLI will find it.
|
|
|
291
288
|
|
|
292
289
|
## State Management
|
|
293
290
|
|
|
294
|
-
`give-skill`
|
|
291
|
+
`give-skill` tracks installed skills for version control and updates:
|
|
295
292
|
|
|
296
|
-
- **
|
|
297
|
-
- **
|
|
298
|
-
- **Batch operations**: Update all skills without re-specifying sources
|
|
299
|
-
- **Branch tracking**: Remember which branch was used for installation
|
|
300
|
-
|
|
301
|
-
**Important**: State tracking only works for skills installed via `give-skill`. Manually installed skills are not tracked.
|
|
302
|
-
|
|
303
|
-
The state file contains:
|
|
293
|
+
- **Local**: `skills.lock` in project directory (commit to git for team consistency)
|
|
294
|
+
- **Global**: `~/.give-skill/state.json` for machine-wide installations
|
|
304
295
|
|
|
305
296
|
```json
|
|
306
297
|
{
|
|
307
|
-
"
|
|
298
|
+
"version": "1.0.0",
|
|
308
299
|
"skills": {
|
|
309
300
|
"pr-reviewer": {
|
|
310
|
-
"source": "https://github.com/expo/skills.git",
|
|
311
301
|
"url": "https://github.com/expo/skills.git",
|
|
312
302
|
"branch": "main",
|
|
313
|
-
"commit": "abc123..."
|
|
314
|
-
"subpath": "skills/.curated",
|
|
315
|
-
"installedAt": "2025-01-15T10:00:00Z",
|
|
316
|
-
"installations": [
|
|
317
|
-
{
|
|
318
|
-
"agent": "claude-code",
|
|
319
|
-
"type": "global",
|
|
320
|
-
"path": "~/.claude/skills/pr-reviewer"
|
|
321
|
-
}
|
|
322
|
-
]
|
|
303
|
+
"commit": "abc123..."
|
|
323
304
|
}
|
|
324
305
|
}
|
|
325
306
|
}
|
|
326
307
|
```
|
|
327
308
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
If you manually delete skill folders, run `npx give-skill clean` to remove orphaned entries.
|
|
309
|
+
Commit `skills.lock` to ensure consistent skill versions across your team. New contributors can run `give-skill update` to synchronize.
|
|
331
310
|
|
|
332
311
|
## Troubleshooting
|
|
333
312
|
|
package/dist/index.js
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as
|
|
3
|
-
`)}displayWidth(l){return
|
|
4
|
-
`+" ".repeat(s
|
|
5
|
-
${
|
|
6
|
-
`)}}function
|
|
2
|
+
import{createRequire as xt}from"node:module";var zt=Object.create;var{getPrototypeOf:Mt,defineProperty:Is,getOwnPropertyNames:Qt}=Object;var Zt=Object.prototype.hasOwnProperty;var v=(l,s,t)=>{t=l!=null?zt(Mt(l)):{};let n=s||!l||!l.__esModule?Is(t,"default",{value:l,enumerable:!0}):t;for(let e of Qt(l))if(!Zt.call(n,e))Is(n,e,{get:()=>l[e],enumerable:!0});return n};var u=(l,s)=>()=>(s||l((s={exports:{}}).exports,s),s.exports);var cl=xt(import.meta.url);var ol=u((Ht)=>{class Ql extends Error{constructor(l,s,t){super(t);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=s,this.exitCode=l,this.nestedError=void 0}}class ws extends Ql{constructor(l){super(1,"commander.invalidArgument",l);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}Ht.CommanderError=Ql;Ht.InvalidArgumentError=ws});var $l=u((At)=>{var{InvalidArgumentError:Kt}=ol();class Ls{constructor(l,s){switch(this.description=s||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,l[0]){case"<":this.required=!0,this._name=l.slice(1,-1);break;case"[":this.required=!1,this._name=l.slice(1,-1);break;default:this.required=!0,this._name=l;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue(l,s){if(s===this.defaultValue||!Array.isArray(s))return[l];return s.push(l),s}default(l,s){return this.defaultValue=l,this.defaultValueDescription=s,this}argParser(l){return this.parseArg=l,this}choices(l){return this.argChoices=l.slice(),this.parseArg=(s,t)=>{if(!this.argChoices.includes(s))throw new Kt(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(s,t);return s},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function Wt(l){let s=l.name()+(l.variadic===!0?"...":"");return l.required?"<"+s+">":"["+s+"]"}At.Argument=Ls;At.humanReadableArgName=Wt});var Zl=u((Ot)=>{var{humanReadableArgName:ut}=$l();class Rs{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(l){this.helpWidth=this.helpWidth??l.helpWidth??80}visibleCommands(l){let s=l.commands.filter((n)=>!n._hidden),t=l._getHelpCommand();if(t&&!t._hidden)s.push(t);if(this.sortSubcommands)s.sort((n,e)=>{return n.name().localeCompare(e.name())});return s}compareOptions(l,s){let t=(n)=>{return n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"")};return t(l).localeCompare(t(s))}visibleOptions(l){let s=l.options.filter((n)=>!n.hidden),t=l._getHelpOption();if(t&&!t.hidden){let n=t.short&&l._findOption(t.short),e=t.long&&l._findOption(t.long);if(!n&&!e)s.push(t);else if(t.long&&!e)s.push(l.createOption(t.long,t.description));else if(t.short&&!n)s.push(l.createOption(t.short,t.description))}if(this.sortOptions)s.sort(this.compareOptions);return s}visibleGlobalOptions(l){if(!this.showGlobalOptions)return[];let s=[];for(let t=l.parent;t;t=t.parent){let n=t.options.filter((e)=>!e.hidden);s.push(...n)}if(this.sortOptions)s.sort(this.compareOptions);return s}visibleArguments(l){if(l._argsDescription)l.registeredArguments.forEach((s)=>{s.description=s.description||l._argsDescription[s.name()]||""});if(l.registeredArguments.find((s)=>s.description))return l.registeredArguments;return[]}subcommandTerm(l){let s=l.registeredArguments.map((t)=>ut(t)).join(" ");return l._name+(l._aliases[0]?"|"+l._aliases[0]:"")+(l.options.length?" [options]":"")+(s?" "+s:"")}optionTerm(l){return l.flags}argumentTerm(l){return l.name()}longestSubcommandTermLength(l,s){return s.visibleCommands(l).reduce((t,n)=>{return Math.max(t,this.displayWidth(s.styleSubcommandTerm(s.subcommandTerm(n))))},0)}longestOptionTermLength(l,s){return s.visibleOptions(l).reduce((t,n)=>{return Math.max(t,this.displayWidth(s.styleOptionTerm(s.optionTerm(n))))},0)}longestGlobalOptionTermLength(l,s){return s.visibleGlobalOptions(l).reduce((t,n)=>{return Math.max(t,this.displayWidth(s.styleOptionTerm(s.optionTerm(n))))},0)}longestArgumentTermLength(l,s){return s.visibleArguments(l).reduce((t,n)=>{return Math.max(t,this.displayWidth(s.styleArgumentTerm(s.argumentTerm(n))))},0)}commandUsage(l){let s=l._name;if(l._aliases[0])s=s+"|"+l._aliases[0];let t="";for(let n=l.parent;n;n=n.parent)t=n.name()+" "+t;return t+s+" "+l.usage()}commandDescription(l){return l.description()}subcommandDescription(l){return l.summary()||l.description()}optionDescription(l){let s=[];if(l.argChoices)s.push(`choices: ${l.argChoices.map((t)=>JSON.stringify(t)).join(", ")}`);if(l.defaultValue!==void 0){if(l.required||l.optional||l.isBoolean()&&typeof l.defaultValue==="boolean")s.push(`default: ${l.defaultValueDescription||JSON.stringify(l.defaultValue)}`)}if(l.presetArg!==void 0&&l.optional)s.push(`preset: ${JSON.stringify(l.presetArg)}`);if(l.envVar!==void 0)s.push(`env: ${l.envVar}`);if(s.length>0){let t=`(${s.join(", ")})`;if(l.description)return`${l.description} ${t}`;return t}return l.description}argumentDescription(l){let s=[];if(l.argChoices)s.push(`choices: ${l.argChoices.map((t)=>JSON.stringify(t)).join(", ")}`);if(l.defaultValue!==void 0)s.push(`default: ${l.defaultValueDescription||JSON.stringify(l.defaultValue)}`);if(s.length>0){let t=`(${s.join(", ")})`;if(l.description)return`${l.description} ${t}`;return t}return l.description}formatItemList(l,s,t){if(s.length===0)return[];return[t.styleTitle(l),...s,""]}groupItems(l,s,t){let n=new Map;return l.forEach((e)=>{let r=t(e);if(!n.has(r))n.set(r,[])}),s.forEach((e)=>{let r=t(e);if(!n.has(r))n.set(r,[]);n.get(r).push(e)}),n}formatHelp(l,s){let t=s.padWidth(l,s),n=s.helpWidth??80;function e(k,S){return s.formatItem(k,t,S,s)}let r=[`${s.styleTitle("Usage:")} ${s.styleUsage(s.commandUsage(l))}`,""],i=s.commandDescription(l);if(i.length>0)r=r.concat([s.boxWrap(s.styleCommandDescription(i),n),""]);let f=s.visibleArguments(l).map((k)=>{return e(s.styleArgumentTerm(s.argumentTerm(k)),s.styleArgumentDescription(s.argumentDescription(k)))});if(r=r.concat(this.formatItemList("Arguments:",f,s)),this.groupItems(l.options,s.visibleOptions(l),(k)=>k.helpGroupHeading??"Options:").forEach((k,S)=>{let c=k.map(($)=>{return e(s.styleOptionTerm(s.optionTerm($)),s.styleOptionDescription(s.optionDescription($)))});r=r.concat(this.formatItemList(S,c,s))}),s.showGlobalOptions){let k=s.visibleGlobalOptions(l).map((S)=>{return e(s.styleOptionTerm(s.optionTerm(S)),s.styleOptionDescription(s.optionDescription(S)))});r=r.concat(this.formatItemList("Global Options:",k,s))}return this.groupItems(l.commands,s.visibleCommands(l),(k)=>k.helpGroup()||"Commands:").forEach((k,S)=>{let c=k.map(($)=>{return e(s.styleSubcommandTerm(s.subcommandTerm($)),s.styleSubcommandDescription(s.subcommandDescription($)))});r=r.concat(this.formatItemList(S,c,s))}),r.join(`
|
|
3
|
+
`)}displayWidth(l){return Ts(l).length}styleTitle(l){return l}styleUsage(l){return l.split(" ").map((s)=>{if(s==="[options]")return this.styleOptionText(s);if(s==="[command]")return this.styleSubcommandText(s);if(s[0]==="["||s[0]==="<")return this.styleArgumentText(s);return this.styleCommandText(s)}).join(" ")}styleCommandDescription(l){return this.styleDescriptionText(l)}styleOptionDescription(l){return this.styleDescriptionText(l)}styleSubcommandDescription(l){return this.styleDescriptionText(l)}styleArgumentDescription(l){return this.styleDescriptionText(l)}styleDescriptionText(l){return l}styleOptionTerm(l){return this.styleOptionText(l)}styleSubcommandTerm(l){return l.split(" ").map((s)=>{if(s==="[options]")return this.styleOptionText(s);if(s[0]==="["||s[0]==="<")return this.styleArgumentText(s);return this.styleSubcommandText(s)}).join(" ")}styleArgumentTerm(l){return this.styleArgumentText(l)}styleOptionText(l){return l}styleArgumentText(l){return l}styleSubcommandText(l){return l}styleCommandText(l){return l}padWidth(l,s){return Math.max(s.longestOptionTermLength(l,s),s.longestGlobalOptionTermLength(l,s),s.longestSubcommandTermLength(l,s),s.longestArgumentTermLength(l,s))}preformatted(l){return/\n[^\S\r\n]/.test(l)}formatItem(l,s,t,n){let r=" ".repeat(2);if(!t)return r+l;let i=l.padEnd(s+l.length-n.displayWidth(l)),f=2,a=(this.helpWidth??80)-s-f-2,k;if(a<this.minWidthToWrap||n.preformatted(t))k=t;else k=n.boxWrap(t,a).replace(/\n/g,`
|
|
4
|
+
`+" ".repeat(s+f));return r+i+" ".repeat(f)+k.replace(/\n/g,`
|
|
5
|
+
${r}`)}boxWrap(l,s){if(s<this.minWidthToWrap)return l;let t=l.split(/\r\n|\n/),n=/[\s]*[^\s]+/g,e=[];return t.forEach((r)=>{let i=r.match(n);if(i===null){e.push("");return}let f=[i.shift()],o=this.displayWidth(f[0]);i.forEach((a)=>{let k=this.displayWidth(a);if(o+k<=s){f.push(a),o+=k;return}e.push(f.join(""));let S=a.trimStart();f=[S],o=this.displayWidth(S)}),e.push(f.join(""))}),e.join(`
|
|
6
|
+
`)}}function Ts(l){let s=/\x1b\[\d*(;\d*)*m/g;return l.replace(s,"")}Ot.Help=Rs;Ot.stripColor=Ts});var xl=u((li)=>{var{InvalidArgumentError:pt}=ol();class hs{constructor(l,s){this.flags=l,this.description=s||"",this.required=l.includes("<"),this.optional=l.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(l),this.mandatory=!1;let t=Dt(l);if(this.short=t.shortFlag,this.long=t.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,this.helpGroupHeading=void 0}default(l,s){return this.defaultValue=l,this.defaultValueDescription=s,this}preset(l){return this.presetArg=l,this}conflicts(l){return this.conflictsWith=this.conflictsWith.concat(l),this}implies(l){let s=l;if(typeof l==="string")s={[l]:!0};return this.implied=Object.assign(this.implied||{},s),this}env(l){return this.envVar=l,this}argParser(l){return this.parseArg=l,this}makeOptionMandatory(l=!0){return this.mandatory=!!l,this}hideHelp(l=!0){return this.hidden=!!l,this}_collectValue(l,s){if(s===this.defaultValue||!Array.isArray(s))return[l];return s.push(l),s}choices(l){return this.argChoices=l.slice(),this.parseArg=(s,t)=>{if(!this.argChoices.includes(s))throw new pt(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(s,t);return s},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return Ps(this.name().replace(/^no-/,""));return Ps(this.name())}helpGroup(l){return this.helpGroupHeading=l,this}is(l){return this.short===l||this.long===l}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class Us{constructor(l){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,l.forEach((s)=>{if(s.negate)this.negativeOptions.set(s.attributeName(),s);else this.positiveOptions.set(s.attributeName(),s)}),this.negativeOptions.forEach((s,t)=>{if(this.positiveOptions.has(t))this.dualOptions.add(t)})}valueFromOption(l,s){let t=s.attributeName();if(!this.dualOptions.has(t))return!0;let n=this.negativeOptions.get(t).presetArg,e=n!==void 0?n:!1;return s.negate===(e===l)}}function Ps(l){return l.split("-").reduce((s,t)=>{return s+t[0].toUpperCase()+t.slice(1)})}function Dt(l){let s,t,n=/^-[^-]$/,e=/^--[^-]/,r=l.split(/[ |,]+/).concat("guard");if(n.test(r[0]))s=r.shift();if(e.test(r[0]))t=r.shift();if(!s&&n.test(r[0]))s=r.shift();if(!s&&e.test(r[0]))s=t,t=r.shift();if(r[0].startsWith("-")){let i=r[0],f=`option creation failed due to '${i}' in option flags '${l}'`;if(/^-[^-][^-]/.test(i))throw Error(`${f}
|
|
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(
|
|
10
|
-
- too many short flags`);if(
|
|
11
|
-
- too many long flags`);throw Error(`${
|
|
12
|
-
- unrecognised flag format`)}if(s===void 0&&
|
|
13
|
-
(Did you mean one of ${
|
|
14
|
-
(Did you mean ${
|
|
15
|
-
- specify the name in Command constructor or using .name()`);if(s=s||{},s.isDefault)this._defaultCommandName=l._name;if(s.noHelp||s.hidden)l._hidden=!0;return this._registerCommand(l),l.parent=this,l._checkForBrokenPassThrough(),this}createArgument(l,s){return new
|
|
16
|
-
Expecting one of '${
|
|
17
|
-
- already used by option '${s.flags}'`)}this._initOptionGroup(l),this.options.push(l)}_registerCommand(l){let s=(
|
|
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(l,s,
|
|
19
|
-
- if '${
|
|
9
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(n.test(i))throw Error(`${f}
|
|
10
|
+
- too many short flags`);if(e.test(i))throw Error(`${f}
|
|
11
|
+
- too many long flags`);throw Error(`${f}
|
|
12
|
+
- unrecognised flag format`)}if(s===void 0&&t===void 0)throw Error(`option creation failed due to no flags found in '${l}'.`);return{shortFlag:s,longFlag:t}}li.Option=hs;li.DualOptions=Us});var Ns=u((ei)=>{function ii(l,s){if(Math.abs(l.length-s.length)>3)return Math.max(l.length,s.length);let t=[];for(let n=0;n<=l.length;n++)t[n]=[n];for(let n=0;n<=s.length;n++)t[0][n]=n;for(let n=1;n<=s.length;n++)for(let e=1;e<=l.length;e++){let r=1;if(l[e-1]===s[n-1])r=0;else r=1;if(t[e][n]=Math.min(t[e-1][n]+1,t[e][n-1]+1,t[e-1][n-1]+r),e>1&&n>1&&l[e-1]===s[n-2]&&l[e-2]===s[n-1])t[e][n]=Math.min(t[e][n],t[e-2][n-2]+1)}return t[l.length][s.length]}function ni(l,s){if(!s||s.length===0)return"";s=Array.from(new Set(s));let t=l.startsWith("--");if(t)l=l.slice(2),s=s.map((i)=>i.slice(2));let n=[],e=3,r=0.4;if(s.forEach((i)=>{if(i.length<=1)return;let f=ii(l,i),o=Math.max(l.length,i.length);if((o-f)/o>r){if(f<e)e=f,n=[i];else if(f===e)n.push(i)}}),n.sort((i,f)=>i.localeCompare(f)),t)n=n.map((i)=>`--${i}`);if(n.length>1)return`
|
|
13
|
+
(Did you mean one of ${n.join(", ")}?)`;if(n.length===1)return`
|
|
14
|
+
(Did you mean ${n[0]}?)`;return""}ei.suggestSimilar=ni});var js=u((yi)=>{var fi=cl("node:events").EventEmitter,Hl=cl("node:child_process"),O=cl("node:path"),bl=cl("node:fs"),L=cl("node:process"),{Argument:ai,humanReadableArgName:ci}=$l(),{CommanderError:Cl}=ol(),{Help:oi,stripColor:ki}=Zl(),{Option:Bs,DualOptions:Si}=xl(),{suggestSimilar:_s}=Ns();class Kl extends fi{constructor(l){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=l||"",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:(s)=>L.stdout.write(s),writeErr:(s)=>L.stderr.write(s),outputError:(s,t)=>t(s),getOutHelpWidth:()=>L.stdout.isTTY?L.stdout.columns:void 0,getErrHelpWidth:()=>L.stderr.isTTY?L.stderr.columns:void 0,getOutHasColors:()=>El()??(L.stdout.isTTY&&L.stdout.hasColors?.()),getErrHasColors:()=>El()??(L.stderr.isTTY&&L.stderr.hasColors?.()),stripColor:(s)=>ki(s)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(l){return this._outputConfiguration=l._outputConfiguration,this._helpOption=l._helpOption,this._helpCommand=l._helpCommand,this._helpConfiguration=l._helpConfiguration,this._exitCallback=l._exitCallback,this._storeOptionsAsProperties=l._storeOptionsAsProperties,this._combineFlagAndOptionalValue=l._combineFlagAndOptionalValue,this._allowExcessArguments=l._allowExcessArguments,this._enablePositionalOptions=l._enablePositionalOptions,this._showHelpAfterError=l._showHelpAfterError,this._showSuggestionAfterError=l._showSuggestionAfterError,this}_getCommandAndAncestors(){let l=[];for(let s=this;s;s=s.parent)l.push(s);return l}command(l,s,t){let n=s,e=t;if(typeof n==="object"&&n!==null)e=n,n=null;e=e||{};let[,r,i]=l.match(/([^ ]+) *(.*)/),f=this.createCommand(r);if(n)f.description(n),f._executableHandler=!0;if(e.isDefault)this._defaultCommandName=f._name;if(f._hidden=!!(e.noHelp||e.hidden),f._executableFile=e.executableFile||null,i)f.arguments(i);if(this._registerCommand(f),f.parent=this,f.copyInheritedSettings(this),n)return this;return f}createCommand(l){return new Kl(l)}createHelp(){return Object.assign(new oi,this.configureHelp())}configureHelp(l){if(l===void 0)return this._helpConfiguration;return this._helpConfiguration=l,this}configureOutput(l){if(l===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...l},this}showHelpAfterError(l=!0){if(typeof l!=="string")l=!!l;return this._showHelpAfterError=l,this}showSuggestionAfterError(l=!0){return this._showSuggestionAfterError=!!l,this}addCommand(l,s){if(!l._name)throw Error(`Command passed to .addCommand() must have a name
|
|
15
|
+
- specify the name in Command constructor or using .name()`);if(s=s||{},s.isDefault)this._defaultCommandName=l._name;if(s.noHelp||s.hidden)l._hidden=!0;return this._registerCommand(l),l.parent=this,l._checkForBrokenPassThrough(),this}createArgument(l,s){return new ai(l,s)}argument(l,s,t,n){let e=this.createArgument(l,s);if(typeof t==="function")e.default(n).argParser(t);else e.default(t);return this.addArgument(e),this}arguments(l){return l.trim().split(/ +/).forEach((s)=>{this.argument(s)}),this}addArgument(l){let s=this.registeredArguments.slice(-1)[0];if(s?.variadic)throw Error(`only the last argument can be variadic '${s.name()}'`);if(l.required&&l.defaultValue!==void 0&&l.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${l.name()}'`);return this.registeredArguments.push(l),this}helpCommand(l,s){if(typeof l==="boolean"){if(this._addImplicitHelpCommand=l,l&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let t=l??"help [command]",[,n,e]=t.match(/([^ ]+) *(.*)/),r=s??"display help for command",i=this.createCommand(n);if(i.helpOption(!1),e)i.arguments(e);if(r)i.description(r);if(this._addImplicitHelpCommand=!0,this._helpCommand=i,l||s)this._initCommandGroup(i);return this}addHelpCommand(l,s){if(typeof l!=="object")return this.helpCommand(l,s),this;return this._addImplicitHelpCommand=!0,this._helpCommand=l,this._initCommandGroup(l),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(l,s){let t=["preSubcommand","preAction","postAction"];if(!t.includes(l))throw Error(`Unexpected value for event passed to hook : '${l}'.
|
|
16
|
+
Expecting one of '${t.join("', '")}'`);if(this._lifeCycleHooks[l])this._lifeCycleHooks[l].push(s);else this._lifeCycleHooks[l]=[s];return this}exitOverride(l){if(l)this._exitCallback=l;else this._exitCallback=(s)=>{if(s.code!=="commander.executeSubCommandAsync")throw s};return this}_exit(l,s,t){if(this._exitCallback)this._exitCallback(new Cl(l,s,t));L.exit(l)}action(l){let s=(t)=>{let n=this.registeredArguments.length,e=t.slice(0,n);if(this._storeOptionsAsProperties)e[n]=this;else e[n]=this.opts();return e.push(this),l.apply(this,e)};return this._actionHandler=s,this}createOption(l,s){return new Bs(l,s)}_callParseArg(l,s,t,n){try{return l.parseArg(s,t)}catch(e){if(e.code==="commander.invalidArgument"){let r=`${n} ${e.message}`;this.error(r,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(l){let s=l.short&&this._findOption(l.short)||l.long&&this._findOption(l.long);if(s){let t=l.long&&this._findOption(l.long)?l.long:l.short;throw Error(`Cannot add option '${l.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${t}'
|
|
17
|
+
- already used by option '${s.flags}'`)}this._initOptionGroup(l),this.options.push(l)}_registerCommand(l){let s=(n)=>{return[n.name()].concat(n.aliases())},t=s(l).find((n)=>this._findCommand(n));if(t){let n=s(this._findCommand(t)).join("|"),e=s(l).join("|");throw Error(`cannot add command '${e}' as already have command '${n}'`)}this._initCommandGroup(l),this.commands.push(l)}addOption(l){this._registerOption(l);let s=l.name(),t=l.attributeName();if(l.negate){let e=l.long.replace(/^--no-/,"--");if(!this._findOption(e))this.setOptionValueWithSource(t,l.defaultValue===void 0?!0:l.defaultValue,"default")}else if(l.defaultValue!==void 0)this.setOptionValueWithSource(t,l.defaultValue,"default");let n=(e,r,i)=>{if(e==null&&l.presetArg!==void 0)e=l.presetArg;let f=this.getOptionValue(t);if(e!==null&&l.parseArg)e=this._callParseArg(l,e,f,r);else if(e!==null&&l.variadic)e=l._collectValue(e,f);if(e==null)if(l.negate)e=!1;else if(l.isBoolean()||l.optional)e=!0;else e="";this.setOptionValueWithSource(t,e,i)};if(this.on("option:"+s,(e)=>{let r=`error: option '${l.flags}' argument '${e}' is invalid.`;n(e,r,"cli")}),l.envVar)this.on("optionEnv:"+s,(e)=>{let r=`error: option '${l.flags}' value '${e}' from env '${l.envVar}' is invalid.`;n(e,r,"env")});return this}_optionEx(l,s,t,n,e){if(typeof s==="object"&&s instanceof Bs)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let r=this.createOption(s,t);if(r.makeOptionMandatory(!!l.mandatory),typeof n==="function")r.default(e).argParser(n);else if(n instanceof RegExp){let i=n;n=(f,o)=>{let a=i.exec(f);return a?a[0]:o},r.default(e).argParser(n)}else r.default(n);return this.addOption(r)}option(l,s,t,n){return this._optionEx({},l,s,t,n)}requiredOption(l,s,t,n){return this._optionEx({mandatory:!0},l,s,t,n)}combineFlagAndOptionalValue(l=!0){return this._combineFlagAndOptionalValue=!!l,this}allowUnknownOption(l=!0){return this._allowUnknownOption=!!l,this}allowExcessArguments(l=!0){return this._allowExcessArguments=!!l,this}enablePositionalOptions(l=!0){return this._enablePositionalOptions=!!l,this}passThroughOptions(l=!0){return this._passThroughOptions=!!l,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(l=!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=!!l,this}getOptionValue(l){if(this._storeOptionsAsProperties)return this[l];return this._optionValues[l]}setOptionValue(l,s){return this.setOptionValueWithSource(l,s,void 0)}setOptionValueWithSource(l,s,t){if(this._storeOptionsAsProperties)this[l]=s;else this._optionValues[l]=s;return this._optionValueSources[l]=t,this}getOptionValueSource(l){return this._optionValueSources[l]}getOptionValueSourceWithGlobals(l){let s;return this._getCommandAndAncestors().forEach((t)=>{if(t.getOptionValueSource(l)!==void 0)s=t.getOptionValueSource(l)}),s}_prepareUserArgs(l,s){if(l!==void 0&&!Array.isArray(l))throw Error("first parameter to parse must be array or undefined");if(s=s||{},l===void 0&&s.from===void 0){if(L.versions?.electron)s.from="electron";let n=L.execArgv??[];if(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))s.from="eval"}if(l===void 0)l=L.argv;this.rawArgs=l.slice();let t;switch(s.from){case void 0:case"node":this._scriptPath=l[1],t=l.slice(2);break;case"electron":if(L.defaultApp)this._scriptPath=l[1],t=l.slice(2);else t=l.slice(1);break;case"user":t=l.slice(0);break;case"eval":t=l.slice(1);break;default:throw Error(`unexpected parse option { from: '${s.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",t}parse(l,s){this._prepareForParse();let t=this._prepareUserArgs(l,s);return this._parseCommand([],t),this}async parseAsync(l,s){this._prepareForParse();let t=this._prepareUserArgs(l,s);return await this._parseCommand([],t),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(l,s,t){if(bl.existsSync(l))return;let n=s?`searched for local subcommand relative to directory '${s}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",e=`'${l}' does not exist
|
|
19
|
+
- if '${t}' 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
|
-
- ${
|
|
21
|
+
- ${n}`;throw Error(e)}_executeSubCommand(l,s){s=s.slice();let t=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function e(a,k){let S=O.resolve(a,k);if(bl.existsSync(S))return S;if(n.includes(O.extname(k)))return;let c=n.find(($)=>bl.existsSync(`${S}${$}`));if(c)return`${S}${c}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=l._executableFile||`${this._name}-${l._name}`,i=this._executableDir||"";if(this._scriptPath){let a;try{a=bl.realpathSync(this._scriptPath)}catch{a=this._scriptPath}i=O.resolve(O.dirname(a),i)}if(i){let a=e(i,r);if(!a&&!l._executableFile&&this._scriptPath){let k=O.basename(this._scriptPath,O.extname(this._scriptPath));if(k!==this._name)a=e(i,`${k}-${l._name}`)}r=a||r}t=n.includes(O.extname(r));let f;if(L.platform!=="win32")if(t)s.unshift(r),s=qs(L.execArgv).concat(s),f=Hl.spawn(L.argv[0],s,{stdio:"inherit"});else f=Hl.spawn(r,s,{stdio:"inherit"});else this._checkForMissingExecutable(r,i,l._name),s.unshift(r),s=qs(L.execArgv).concat(s),f=Hl.spawn(L.execPath,s,{stdio:"inherit"});if(!f.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((k)=>{L.on(k,()=>{if(f.killed===!1&&f.exitCode===null)f.kill(k)})});let o=this._exitCallback;f.on("close",(a)=>{if(a=a??1,!o)L.exit(a);else o(new Cl(a,"commander.executeSubCommandAsync","(close)"))}),f.on("error",(a)=>{if(a.code==="ENOENT")this._checkForMissingExecutable(r,i,l._name);else if(a.code==="EACCES")throw Error(`'${r}' not executable`);if(!o)L.exit(1);else{let k=new Cl(1,"commander.executeSubCommandAsync","(error)");k.nestedError=a,o(k)}}),this.runningCommand=f}_dispatchSubcommand(l,s,t){let n=this._findCommand(l);if(!n)this.help({error:!0});n._prepareForParse();let e;return e=this._chainOrCallSubCommandHook(e,n,"preSubcommand"),e=this._chainOrCall(e,()=>{if(n._executableHandler)this._executeSubCommand(n,s.concat(t));else return n._parseCommand(s,t)}),e}_dispatchHelpCommand(l){if(!l)this.help();let s=this._findCommand(l);if(s&&!s._executableHandler)s.help();return this._dispatchSubcommand(l,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((l,s)=>{if(l.required&&this.args[s]==null)this.missingArgument(l.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 l=(t,n,e)=>{let r=n;if(n!==null&&t.parseArg){let i=`error: command-argument value '${n}' is invalid for argument '${t.name()}'.`;r=this._callParseArg(t,n,e,i)}return r};this._checkNumberOfArguments();let s=[];this.registeredArguments.forEach((t,n)=>{let e=t.defaultValue;if(t.variadic){if(n<this.args.length){if(e=this.args.slice(n),t.parseArg)e=e.reduce((r,i)=>{return l(t,i,r)},t.defaultValue)}else if(e===void 0)e=[]}else if(n<this.args.length){if(e=this.args[n],t.parseArg)e=l(t,e,t.defaultValue)}s[n]=e}),this.processedArgs=s}_chainOrCall(l,s){if(l?.then&&typeof l.then==="function")return l.then(()=>s());return s()}_chainOrCallHooks(l,s){let t=l,n=[];if(this._getCommandAndAncestors().reverse().filter((e)=>e._lifeCycleHooks[s]!==void 0).forEach((e)=>{e._lifeCycleHooks[s].forEach((r)=>{n.push({hookedCommand:e,callback:r})})}),s==="postAction")n.reverse();return n.forEach((e)=>{t=this._chainOrCall(t,()=>{return e.callback(e.hookedCommand,this)})}),t}_chainOrCallSubCommandHook(l,s,t){let n=l;if(this._lifeCycleHooks[t]!==void 0)this._lifeCycleHooks[t].forEach((e)=>{n=this._chainOrCall(n,()=>{return e(this,s)})});return n}_parseCommand(l,s){let t=this.parseOptions(s);if(this._parseOptionsEnv(),this._parseOptionsImplied(),l=l.concat(t.operands),s=t.unknown,this.args=l.concat(s),l&&this._findCommand(l[0]))return this._dispatchSubcommand(l[0],l.slice(1),s);if(this._getHelpCommand()&&l[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(l[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(s),this._dispatchSubcommand(this._defaultCommandName,l,s);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(t.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{if(t.unknown.length>0)this.unknownOption(t.unknown[0])},e=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let r;if(r=this._chainOrCallHooks(r,"preAction"),r=this._chainOrCall(r,()=>this._actionHandler(this.processedArgs)),this.parent)r=this._chainOrCall(r,()=>{this.parent.emit(e,l,s)});return r=this._chainOrCallHooks(r,"postAction"),r}if(this.parent?.listenerCount(e))n(),this._processArguments(),this.parent.emit(e,l,s);else if(l.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",l,s);if(this.listenerCount("command:*"))this.emit("command:*",l,s);else if(this.commands.length)this.unknownCommand();else n(),this._processArguments()}else if(this.commands.length)n(),this.help({error:!0});else n(),this._processArguments()}_findCommand(l){if(!l)return;return this.commands.find((s)=>s._name===l||s._aliases.includes(l))}_findOption(l){return this.options.find((s)=>s.is(l))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((l)=>{l.options.forEach((s)=>{if(s.mandatory&&l.getOptionValue(s.attributeName())===void 0)l.missingMandatoryOptionValue(s)})})}_checkForConflictingLocalOptions(){let l=this.options.filter((t)=>{let n=t.attributeName();if(this.getOptionValue(n)===void 0)return!1;return this.getOptionValueSource(n)!=="default"});l.filter((t)=>t.conflictsWith.length>0).forEach((t)=>{let n=l.find((e)=>t.conflictsWith.includes(e.attributeName()));if(n)this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((l)=>{l._checkForConflictingLocalOptions()})}parseOptions(l){let s=[],t=[],n=s;function e(a){return a.length>1&&a[0]==="-"}let r=(a)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(a))return!1;return!this._getCommandAndAncestors().some((k)=>k.options.map((S)=>S.short).some((S)=>/^-\d$/.test(S)))},i=null,f=null,o=0;while(o<l.length||f){let a=f??l[o++];if(f=null,a==="--"){if(n===t)n.push(a);n.push(...l.slice(o));break}if(i&&(!e(a)||r(a))){this.emit(`option:${i.name()}`,a);continue}if(i=null,e(a)){let k=this._findOption(a);if(k){if(k.required){let S=l[o++];if(S===void 0)this.optionMissingArgument(k);this.emit(`option:${k.name()}`,S)}else if(k.optional){let S=null;if(o<l.length&&(!e(l[o])||r(l[o])))S=l[o++];this.emit(`option:${k.name()}`,S)}else this.emit(`option:${k.name()}`);i=k.variadic?k:null;continue}}if(a.length>2&&a[0]==="-"&&a[1]!=="-"){let k=this._findOption(`-${a[1]}`);if(k){if(k.required||k.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${k.name()}`,a.slice(2));else this.emit(`option:${k.name()}`),f=`-${a.slice(2)}`;continue}}if(/^--[^=]+=/.test(a)){let k=a.indexOf("="),S=this._findOption(a.slice(0,k));if(S&&(S.required||S.optional)){this.emit(`option:${S.name()}`,a.slice(k+1));continue}}if(n===s&&e(a)&&!(this.commands.length===0&&r(a)))n=t;if((this._enablePositionalOptions||this._passThroughOptions)&&s.length===0&&t.length===0){if(this._findCommand(a)){s.push(a),t.push(...l.slice(o));break}else if(this._getHelpCommand()&&a===this._getHelpCommand().name()){s.push(a,...l.slice(o));break}else if(this._defaultCommandName){t.push(a,...l.slice(o));break}}if(this._passThroughOptions){n.push(a,...l.slice(o));break}n.push(a)}return{operands:s,unknown:t}}opts(){if(this._storeOptionsAsProperties){let l={},s=this.options.length;for(let t=0;t<s;t++){let n=this.options[t].attributeName();l[n]=n===this._versionOptionName?this._version:this[n]}return l}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((l,s)=>Object.assign(l,s.opts()),{})}error(l,s){if(this._outputConfiguration.outputError(`${l}
|
|
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
|
|
25
|
-
`),this._exit(0,"commander.version",l)}),this}description(l,s){if(l===void 0&&s===void 0)return this._description;if(this._description=l,s)this._argsDescription=s;return this}summary(l){if(l===void 0)return this._summary;return this._summary=l,this}alias(l){if(l===void 0)return this._aliases[0];let s=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)s=this.commands[this.commands.length-1];if(l===s._name)throw Error("Command alias can't be the same as its name");let
|
|
26
|
-
Expecting one of '${
|
|
27
|
-
`)}),this}_outputHelpIfRequested(l){let s=this._getHelpOption();if(s&&l.find((y)=>s.is(y)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function Bs(l){return l.map((s)=>{if(!s.startsWith("--inspect"))return s;let f,y="127.0.0.1",i="9229",S;if((S=s.match(/^(--inspect(-brk)?)$/))!==null)f=S[1];else if((S=s.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(f=S[1],/^\d+$/.test(S[3]))i=S[3];else y=S[3];else if((S=s.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)f=S[1],y=S[3],i=S[4];if(f&&i!=="0")return`${f}=${y}:${parseInt(i)+1}`;return s})}function Kl(){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}Dt.Command=Wl;Dt.useColor=Kl});var Ps=a((yf)=>{var{Argument:qs}=cl(),{Command:El}=_s(),{CommanderError:tf,InvalidArgumentError:rs}=Sl(),{Help:ff}=Zl(),{Option:Js}=jl();yf.program=new El;yf.createCommand=(l)=>new El(l);yf.createOption=(l,s)=>new Js(l,s);yf.createArgument=(l,s)=>new qs(l,s);yf.Command=El;yf.Option=Js;yf.Argument=qs;yf.Help=ff;yf.CommanderError=tf;yf.InvalidArgumentError=rs;yf.InvalidOptionArgumentError=rs});var Cl=a((ci,Gs)=>{var xl={to(l,s){if(!s)return`\x1B[${l+1}G`;return`\x1B[${s+1};${l+1}H`},move(l,s){let f="";if(l<0)f+=`\x1B[${-l}D`;else if(l>0)f+=`\x1B[${l}C`;if(s<0)f+=`\x1B[${-s}A`;else if(s>0)f+=`\x1B[${s}B`;return f},up:(l=1)=>`\x1B[${l}A`,down:(l=1)=>`\x1B[${l}B`,forward:(l=1)=>`\x1B[${l}C`,backward:(l=1)=>`\x1B[${l}D`,nextLine:(l=1)=>"\x1B[E".repeat(l),prevLine:(l=1)=>"\x1B[F".repeat(l),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Rf={up:(l=1)=>"\x1B[S".repeat(l),down:(l=1)=>"\x1B[T".repeat(l)},Tf={screen:"\x1B[2J",up:(l=1)=>"\x1B[1J".repeat(l),down:(l=1)=>"\x1B[J".repeat(l),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(l){let s="";for(let f=0;f<l;f++)s+=this.line+(f<l-1?xl.up():"");if(l)s+=xl.left;return s}};Gs.exports={cursor:xl,scroll:Rf,erase:Tf,beep:"\x07"}});var sl=a((bi,Nl)=>{var Il=process||{},Xs=Il.argv||[],nl=Il.env||{},Bf=!(!!nl.NO_COLOR||Xs.includes("--no-color"))&&(!!nl.FORCE_COLOR||Xs.includes("--color")||Il.platform==="win32"||(Il.stdout||{}).isTTY&&nl.TERM!=="dumb"||!!nl.CI),_f=(l,s,f=l)=>(y)=>{let i=""+y,S=i.indexOf(s,l.length);return~S?l+qf(i,s,f,S)+s:l+i+s},qf=(l,s,f,y)=>{let i="",S=0;do i+=l.substring(S,y)+f,S=y+s.length,y=l.indexOf(s,S);while(~y);return i+l.substring(S)},zs=(l=Bf)=>{let s=l?_f:()=>String;return{isColorSupported:l,reset:s("\x1B[0m","\x1B[0m"),bold:s("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:s("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:s("\x1B[3m","\x1B[23m"),underline:s("\x1B[4m","\x1B[24m"),inverse:s("\x1B[7m","\x1B[27m"),hidden:s("\x1B[8m","\x1B[28m"),strikethrough:s("\x1B[9m","\x1B[29m"),black:s("\x1B[30m","\x1B[39m"),red:s("\x1B[31m","\x1B[39m"),green:s("\x1B[32m","\x1B[39m"),yellow:s("\x1B[33m","\x1B[39m"),blue:s("\x1B[34m","\x1B[39m"),magenta:s("\x1B[35m","\x1B[39m"),cyan:s("\x1B[36m","\x1B[39m"),white:s("\x1B[37m","\x1B[39m"),gray:s("\x1B[90m","\x1B[39m"),bgBlack:s("\x1B[40m","\x1B[49m"),bgRed:s("\x1B[41m","\x1B[49m"),bgGreen:s("\x1B[42m","\x1B[49m"),bgYellow:s("\x1B[43m","\x1B[49m"),bgBlue:s("\x1B[44m","\x1B[49m"),bgMagenta:s("\x1B[45m","\x1B[49m"),bgCyan:s("\x1B[46m","\x1B[49m"),bgWhite:s("\x1B[47m","\x1B[49m"),blackBright:s("\x1B[90m","\x1B[39m"),redBright:s("\x1B[91m","\x1B[39m"),greenBright:s("\x1B[92m","\x1B[39m"),yellowBright:s("\x1B[93m","\x1B[39m"),blueBright:s("\x1B[94m","\x1B[39m"),magentaBright:s("\x1B[95m","\x1B[39m"),cyanBright:s("\x1B[96m","\x1B[39m"),whiteBright:s("\x1B[97m","\x1B[39m"),bgBlackBright:s("\x1B[100m","\x1B[49m"),bgRedBright:s("\x1B[101m","\x1B[49m"),bgGreenBright:s("\x1B[102m","\x1B[49m"),bgYellowBright:s("\x1B[103m","\x1B[49m"),bgBlueBright:s("\x1B[104m","\x1B[49m"),bgMagentaBright:s("\x1B[105m","\x1B[49m"),bgCyanBright:s("\x1B[106m","\x1B[49m"),bgWhiteBright:s("\x1B[107m","\x1B[49m")}};Nl.exports=zs();Nl.exports.createColors=zs});var Ys=d(Ps(),1),{program:e,createCommand:py,createArgument:Dy,createOption:li,CommanderError:si,InvalidArgumentError:ti,InvalidOptionArgumentError:fi,Command:yi,Argument:ii,Option:Si,Help:$i}=Ys.default;var H=d(Cl(),1);import{stdin as Cs,stdout as Ns}from"node:process";import*as p from"node:readline";import Qs from"node:readline";import{Writable as rf}from"node:stream";function Jf({onlyFirst:l=!1}={}){let s=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(s,l?void 0:"g")}var Pf=Jf();function Vs(l){if(typeof l!="string")throw TypeError(`Expected a \`string\`, got \`${typeof l}\``);return l.replace(Pf,"")}function As(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var hs={exports:{}};(function(l){var s={};l.exports=s,s.eastAsianWidth=function(y){var i=y.charCodeAt(0),S=y.length==2?y.charCodeAt(1):0,t=i;return 55296<=i&&i<=56319&&56320<=S&&S<=57343&&(i&=1023,S&=1023,t=i<<10|S,t+=65536),t==12288||65281<=t&&t<=65376||65504<=t&&t<=65510?"F":t==8361||65377<=t&&t<=65470||65474<=t&&t<=65479||65482<=t&&t<=65487||65490<=t&&t<=65495||65498<=t&&t<=65500||65512<=t&&t<=65518?"H":4352<=t&&t<=4447||4515<=t&&t<=4519||4602<=t&&t<=4607||9001<=t&&t<=9002||11904<=t&&t<=11929||11931<=t&&t<=12019||12032<=t&&t<=12245||12272<=t&&t<=12283||12289<=t&&t<=12350||12353<=t&&t<=12438||12441<=t&&t<=12543||12549<=t&&t<=12589||12593<=t&&t<=12686||12688<=t&&t<=12730||12736<=t&&t<=12771||12784<=t&&t<=12830||12832<=t&&t<=12871||12880<=t&&t<=13054||13056<=t&&t<=19903||19968<=t&&t<=42124||42128<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||55216<=t&&t<=55238||55243<=t&&t<=55291||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65106||65108<=t&&t<=65126||65128<=t&&t<=65131||110592<=t&&t<=110593||127488<=t&&t<=127490||127504<=t&&t<=127546||127552<=t&&t<=127560||127568<=t&&t<=127569||131072<=t&&t<=194367||177984<=t&&t<=196605||196608<=t&&t<=262141?"W":32<=t&&t<=126||162<=t&&t<=163||165<=t&&t<=166||t==172||t==175||10214<=t&&t<=10221||10629<=t&&t<=10630?"Na":t==161||t==164||167<=t&&t<=168||t==170||173<=t&&t<=174||176<=t&&t<=180||182<=t&&t<=186||188<=t&&t<=191||t==198||t==208||215<=t&&t<=216||222<=t&&t<=225||t==230||232<=t&&t<=234||236<=t&&t<=237||t==240||242<=t&&t<=243||247<=t&&t<=250||t==252||t==254||t==257||t==273||t==275||t==283||294<=t&&t<=295||t==299||305<=t&&t<=307||t==312||319<=t&&t<=322||t==324||328<=t&&t<=331||t==333||338<=t&&t<=339||358<=t&&t<=359||t==363||t==462||t==464||t==466||t==468||t==470||t==472||t==474||t==476||t==593||t==609||t==708||t==711||713<=t&&t<=715||t==717||t==720||728<=t&&t<=731||t==733||t==735||768<=t&&t<=879||913<=t&&t<=929||931<=t&&t<=937||945<=t&&t<=961||963<=t&&t<=969||t==1025||1040<=t&&t<=1103||t==1105||t==8208||8211<=t&&t<=8214||8216<=t&&t<=8217||8220<=t&&t<=8221||8224<=t&&t<=8226||8228<=t&&t<=8231||t==8240||8242<=t&&t<=8243||t==8245||t==8251||t==8254||t==8308||t==8319||8321<=t&&t<=8324||t==8364||t==8451||t==8453||t==8457||t==8467||t==8470||8481<=t&&t<=8482||t==8486||t==8491||8531<=t&&t<=8532||8539<=t&&t<=8542||8544<=t&&t<=8555||8560<=t&&t<=8569||t==8585||8592<=t&&t<=8601||8632<=t&&t<=8633||t==8658||t==8660||t==8679||t==8704||8706<=t&&t<=8707||8711<=t&&t<=8712||t==8715||t==8719||t==8721||t==8725||t==8730||8733<=t&&t<=8736||t==8739||t==8741||8743<=t&&t<=8748||t==8750||8756<=t&&t<=8759||8764<=t&&t<=8765||t==8776||t==8780||t==8786||8800<=t&&t<=8801||8804<=t&&t<=8807||8810<=t&&t<=8811||8814<=t&&t<=8815||8834<=t&&t<=8835||8838<=t&&t<=8839||t==8853||t==8857||t==8869||t==8895||t==8978||9312<=t&&t<=9449||9451<=t&&t<=9547||9552<=t&&t<=9587||9600<=t&&t<=9615||9618<=t&&t<=9621||9632<=t&&t<=9633||9635<=t&&t<=9641||9650<=t&&t<=9651||9654<=t&&t<=9655||9660<=t&&t<=9661||9664<=t&&t<=9665||9670<=t&&t<=9672||t==9675||9678<=t&&t<=9681||9698<=t&&t<=9701||t==9711||9733<=t&&t<=9734||t==9737||9742<=t&&t<=9743||9748<=t&&t<=9749||t==9756||t==9758||t==9792||t==9794||9824<=t&&t<=9825||9827<=t&&t<=9829||9831<=t&&t<=9834||9836<=t&&t<=9837||t==9839||9886<=t&&t<=9887||9918<=t&&t<=9919||9924<=t&&t<=9933||9935<=t&&t<=9953||t==9955||9960<=t&&t<=9983||t==10045||t==10071||10102<=t&&t<=10111||11093<=t&&t<=11097||12872<=t&&t<=12879||57344<=t&&t<=63743||65024<=t&&t<=65039||t==65533||127232<=t&&t<=127242||127248<=t&&t<=127277||127280<=t&&t<=127337||127344<=t&&t<=127386||917760<=t&&t<=917999||983040<=t&&t<=1048573||1048576<=t&&t<=1114109?"A":"N"},s.characterLength=function(y){var i=this.eastAsianWidth(y);return i=="F"||i=="W"||i=="A"?2:1};function f(y){return y.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}s.length=function(y){for(var i=f(y),S=0,t=0;t<i.length;t++)S=S+this.characterLength(i[t]);return S},s.slice=function(y,i,S){textLen=s.length(y),i=i||0,S=S||1,i<0&&(i=textLen+i),S<0&&(S=textLen+S);for(var t="",$=0,c=f(y),k=0;k<c.length;k++){var b=c[k],U=s.length(b);if($>=i-(U==2?1:0))if($+U<=S)t+=b;else break;$+=U}return t}})(hs);var Yf=hs.exports,Gf=As(Yf),Xf=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},zf=As(Xf);function $l(l,s={}){if(typeof l!="string"||l.length===0||(s={ambiguousIsNarrow:!0,...s},l=Vs(l),l.length===0))return 0;l=l.replace(zf()," ");let f=s.ambiguousIsNarrow?1:2,y=0;for(let i of l){let S=i.codePointAt(0);if(S<=31||S>=127&&S<=159||S>=768&&S<=879)continue;switch(Gf.eastAsianWidth(i)){case"F":case"W":y+=2;break;case"A":y+=f;break;default:y+=1}}return y}var Vl=10,Zs=(l=0)=>(s)=>`\x1B[${s+l}m`,js=(l=0)=>(s)=>`\x1B[${38+l};5;${s}m`,Ms=(l=0)=>(s,f,y)=>`\x1B[${38+l};2;${s};${f};${y}m`,G={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(G.modifier);var Qf=Object.keys(G.color),Zf=Object.keys(G.bgColor);[...Qf,...Zf];function jf(){let l=new Map;for(let[s,f]of Object.entries(G)){for(let[y,i]of Object.entries(f))G[y]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},f[y]=G[y],l.set(i[0],i[1]);Object.defineProperty(G,s,{value:f,enumerable:!1})}return Object.defineProperty(G,"codes",{value:l,enumerable:!1}),G.color.close="\x1B[39m",G.bgColor.close="\x1B[49m",G.color.ansi=Zs(),G.color.ansi256=js(),G.color.ansi16m=Ms(),G.bgColor.ansi=Zs(Vl),G.bgColor.ansi256=js(Vl),G.bgColor.ansi16m=Ms(Vl),Object.defineProperties(G,{rgbToAnsi256:{value:(s,f,y)=>s===f&&f===y?s<8?16:s>248?231:Math.round((s-8)/247*24)+232:16+36*Math.round(s/255*5)+6*Math.round(f/255*5)+Math.round(y/255*5),enumerable:!1},hexToRgb:{value:(s)=>{let f=/[a-f\d]{6}|[a-f\d]{3}/i.exec(s.toString(16));if(!f)return[0,0,0];let[y]=f;y.length===3&&(y=[...y].map((S)=>S+S).join(""));let i=Number.parseInt(y,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:(s)=>G.rgbToAnsi256(...G.hexToRgb(s)),enumerable:!1},ansi256ToAnsi:{value:(s)=>{if(s<8)return 30+s;if(s<16)return 90+(s-8);let f,y,i;if(s>=232)f=((s-232)*10+8)/255,y=f,i=f;else{s-=16;let $=s%36;f=Math.floor(s/36)/5,y=Math.floor($/6)/5,i=$%6/5}let S=Math.max(f,y,i)*2;if(S===0)return 30;let t=30+(Math.round(i)<<2|Math.round(y)<<1|Math.round(f));return S===2&&(t+=60),t},enumerable:!1},rgbToAnsi:{value:(s,f,y)=>G.ansi256ToAnsi(G.rgbToAnsi256(s,f,y)),enumerable:!1},hexToAnsi:{value:(s)=>G.ansi256ToAnsi(G.hexToAnsi256(s)),enumerable:!1}}),G}var Mf=jf(),Ul=new Set(["\x1B",""]),Hf=39,Ol="\x07",Os="[",Kf="]",Fs="m",Fl=`${Kf}8;;`,Hs=(l)=>`${Ul.values().next().value}${Os}${l}${Fs}`,Ks=(l)=>`${Ul.values().next().value}${Fl}${l}${Ol}`,Wf=(l)=>l.split(" ").map((s)=>$l(s)),Al=(l,s,f)=>{let y=[...s],i=!1,S=!1,t=$l(Vs(l[l.length-1]));for(let[$,c]of y.entries()){let k=$l(c);if(t+k<=f?l[l.length-1]+=c:(l.push(c),t=0),Ul.has(c)&&(i=!0,S=y.slice($+1).join("").startsWith(Fl)),i){S?c===Ol&&(i=!1,S=!1):c===Fs&&(i=!1);continue}t+=k,t===f&&$<y.length-1&&(l.push(""),t=0)}!t&&l[l.length-1].length>0&&l.length>1&&(l[l.length-2]+=l.pop())},Ef=(l)=>{let s=l.split(" "),f=s.length;for(;f>0&&!($l(s[f-1])>0);)f--;return f===s.length?l:s.slice(0,f).join(" ")+s.slice(f).join("")},xf=(l,s,f={})=>{if(f.trim!==!1&&l.trim()==="")return"";let y="",i,S,t=Wf(l),$=[""];for(let[k,b]of l.split(" ").entries()){f.trim!==!1&&($[$.length-1]=$[$.length-1].trimStart());let U=$l($[$.length-1]);if(k!==0&&(U>=s&&(f.wordWrap===!1||f.trim===!1)&&($.push(""),U=0),(U>0||f.trim===!1)&&($[$.length-1]+=" ",U++)),f.hard&&t[k]>s){let w=s-U,n=1+Math.floor((t[k]-w-1)/s);Math.floor((t[k]-1)/s)<n&&$.push(""),Al($,b,s);continue}if(U+t[k]>s&&U>0&&t[k]>0){if(f.wordWrap===!1&&U<s){Al($,b,s);continue}$.push("")}if(U+t[k]>s&&f.wordWrap===!1){Al($,b,s);continue}$[$.length-1]+=b}f.trim!==!1&&($=$.map((k)=>Ef(k)));let c=[...$.join(`
|
|
28
|
-
`)];for(let[k
|
|
29
|
-
`?(
|
|
30
|
-
`&&(
|
|
24
|
+
`),this.outputHelp({error:!0});let t=s||{},n=t.exitCode||1,e=t.code||"commander.error";this._exit(n,e,l)}_parseOptionsEnv(){this.options.forEach((l)=>{if(l.envVar&&l.envVar in L.env){let s=l.attributeName();if(this.getOptionValue(s)===void 0||["default","config","env"].includes(this.getOptionValueSource(s)))if(l.required||l.optional)this.emit(`optionEnv:${l.name()}`,L.env[l.envVar]);else this.emit(`optionEnv:${l.name()}`)}})}_parseOptionsImplied(){let l=new Si(this.options),s=(t)=>{return this.getOptionValue(t)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(t))};this.options.filter((t)=>t.implied!==void 0&&s(t.attributeName())&&l.valueFromOption(this.getOptionValue(t.attributeName()),t)).forEach((t)=>{Object.keys(t.implied).filter((n)=>!s(n)).forEach((n)=>{this.setOptionValueWithSource(n,t.implied[n],"implied")})})}missingArgument(l){let s=`error: missing required argument '${l}'`;this.error(s,{code:"commander.missingArgument"})}optionMissingArgument(l){let s=`error: option '${l.flags}' argument missing`;this.error(s,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(l){let s=`error: required option '${l.flags}' not specified`;this.error(s,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(l,s){let t=(r)=>{let i=r.attributeName(),f=this.getOptionValue(i),o=this.options.find((k)=>k.negate&&i===k.attributeName()),a=this.options.find((k)=>!k.negate&&i===k.attributeName());if(o&&(o.presetArg===void 0&&f===!1||o.presetArg!==void 0&&f===o.presetArg))return o;return a||r},n=(r)=>{let i=t(r),f=i.attributeName();if(this.getOptionValueSource(f)==="env")return`environment variable '${i.envVar}'`;return`option '${i.flags}'`},e=`error: ${n(l)} cannot be used with ${n(s)}`;this.error(e,{code:"commander.conflictingOption"})}unknownOption(l){if(this._allowUnknownOption)return;let s="";if(l.startsWith("--")&&this._showSuggestionAfterError){let n=[],e=this;do{let r=e.createHelp().visibleOptions(e).filter((i)=>i.long).map((i)=>i.long);n=n.concat(r),e=e.parent}while(e&&!e._enablePositionalOptions);s=_s(l,n)}let t=`error: unknown option '${l}'${s}`;this.error(t,{code:"commander.unknownOption"})}_excessArguments(l){if(this._allowExcessArguments)return;let s=this.registeredArguments.length,t=s===1?"":"s",e=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${s} argument${t} but got ${l.length}.`;this.error(e,{code:"commander.excessArguments"})}unknownCommand(){let l=this.args[0],s="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach((e)=>{if(n.push(e.name()),e.alias())n.push(e.alias())}),s=_s(l,n)}let t=`error: unknown command '${l}'${s}`;this.error(t,{code:"commander.unknownCommand"})}version(l,s,t){if(l===void 0)return this._version;this._version=l,s=s||"-V, --version",t=t||"output the version number";let n=this.createOption(s,t);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${l}
|
|
25
|
+
`),this._exit(0,"commander.version",l)}),this}description(l,s){if(l===void 0&&s===void 0)return this._description;if(this._description=l,s)this._argsDescription=s;return this}summary(l){if(l===void 0)return this._summary;return this._summary=l,this}alias(l){if(l===void 0)return this._aliases[0];let s=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)s=this.commands[this.commands.length-1];if(l===s._name)throw Error("Command alias can't be the same as its name");let t=this.parent?._findCommand(l);if(t){let n=[t.name()].concat(t.aliases()).join("|");throw Error(`cannot add alias '${l}' to command '${this.name()}' as already have command '${n}'`)}return s._aliases.push(l),this}aliases(l){if(l===void 0)return this._aliases;return l.forEach((s)=>this.alias(s)),this}usage(l){if(l===void 0){if(this._usage)return this._usage;let s=this.registeredArguments.map((t)=>{return ci(t)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?s:[]).join(" ")}return this._usage=l,this}name(l){if(l===void 0)return this._name;return this._name=l,this}helpGroup(l){if(l===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=l,this}commandsGroup(l){if(l===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=l,this}optionsGroup(l){if(l===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=l,this}_initOptionGroup(l){if(this._defaultOptionGroup&&!l.helpGroupHeading)l.helpGroup(this._defaultOptionGroup)}_initCommandGroup(l){if(this._defaultCommandGroup&&!l.helpGroup())l.helpGroup(this._defaultCommandGroup)}nameFromFilename(l){return this._name=O.basename(l,O.extname(l)),this}executableDir(l){if(l===void 0)return this._executableDir;return this._executableDir=l,this}helpInformation(l){let s=this.createHelp(),t=this._getOutputContext(l);s.prepareContext({error:t.error,helpWidth:t.helpWidth,outputHasColors:t.hasColors});let n=s.formatHelp(this,s);if(t.hasColors)return n;return this._outputConfiguration.stripColor(n)}_getOutputContext(l){l=l||{};let s=!!l.error,t,n,e;if(s)t=(i)=>this._outputConfiguration.writeErr(i),n=this._outputConfiguration.getErrHasColors(),e=this._outputConfiguration.getErrHelpWidth();else t=(i)=>this._outputConfiguration.writeOut(i),n=this._outputConfiguration.getOutHasColors(),e=this._outputConfiguration.getOutHelpWidth();return{error:s,write:(i)=>{if(!n)i=this._outputConfiguration.stripColor(i);return t(i)},hasColors:n,helpWidth:e}}outputHelp(l){let s;if(typeof l==="function")s=l,l=void 0;let t=this._getOutputContext(l),n={error:t.error,write:t.write,command:this};this._getCommandAndAncestors().reverse().forEach((r)=>r.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let e=this.helpInformation({error:t.error});if(s){if(e=s(e),typeof e!=="string"&&!Buffer.isBuffer(e))throw Error("outputHelp callback must return a string or a Buffer")}if(t.write(e),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",n),this._getCommandAndAncestors().forEach((r)=>r.emit("afterAllHelp",n))}helpOption(l,s){if(typeof l==="boolean"){if(l){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(l??"-h, --help",s??"display help for command"),l||s)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(l){return this._helpOption=l,this._initOptionGroup(l),this}help(l){this.outputHelp(l);let s=Number(L.exitCode??0);if(s===0&&l&&typeof l!=="function"&&l.error)s=1;this._exit(s,"commander.help","(outputHelp)")}addHelpText(l,s){let t=["beforeAll","before","after","afterAll"];if(!t.includes(l))throw Error(`Unexpected value for position to addHelpText.
|
|
26
|
+
Expecting one of '${t.join("', '")}'`);let n=`${l}Help`;return this.on(n,(e)=>{let r;if(typeof s==="function")r=s({error:e.error,command:e.command});else r=s;if(r)e.write(`${r}
|
|
27
|
+
`)}),this}_outputHelpIfRequested(l){let s=this._getHelpOption();if(s&&l.find((n)=>s.is(n)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function qs(l){return l.map((s)=>{if(!s.startsWith("--inspect"))return s;let t,n="127.0.0.1",e="9229",r;if((r=s.match(/^(--inspect(-brk)?)$/))!==null)t=r[1];else if((r=s.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(t=r[1],/^\d+$/.test(r[3]))e=r[3];else n=r[3];else if((r=s.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)t=r[1],n=r[3],e=r[4];if(t&&e!=="0")return`${t}=${n}:${parseInt(e)+1}`;return s})}function El(){if(L.env.NO_COLOR||L.env.FORCE_COLOR==="0"||L.env.FORCE_COLOR==="false")return!1;if(L.env.FORCE_COLOR||L.env.CLICOLOR_FORCE!==void 0)return!0;return}yi.Command=Kl;yi.useColor=El});var Gs=u((wi)=>{var{Argument:Js}=$l(),{Command:Wl}=js(),{CommanderError:bi,InvalidArgumentError:ms}=ol(),{Help:Ii}=Zl(),{Option:Ys}=xl();wi.program=new Wl;wi.createCommand=(l)=>new Wl(l);wi.createOption=(l,s)=>new Ys(l,s);wi.createArgument=(l,s)=>new Js(l,s);wi.Command=Wl;wi.Option=Ys;wi.Argument=Js;wi.Help=Ii;wi.CommanderError=bi;wi.InvalidArgumentError=ms;wi.InvalidOptionArgumentError=ms});var Vl=u((_e,zs)=>{var Al={to(l,s){if(!s)return`\x1B[${l+1}G`;return`\x1B[${s+1};${l+1}H`},move(l,s){let t="";if(l<0)t+=`\x1B[${-l}D`;else if(l>0)t+=`\x1B[${l}C`;if(s<0)t+=`\x1B[${-s}A`;else if(s>0)t+=`\x1B[${s}B`;return t},up:(l=1)=>`\x1B[${l}A`,down:(l=1)=>`\x1B[${l}B`,forward:(l=1)=>`\x1B[${l}C`,backward:(l=1)=>`\x1B[${l}D`,nextLine:(l=1)=>"\x1B[E".repeat(l),prevLine:(l=1)=>"\x1B[F".repeat(l),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Ji={up:(l=1)=>"\x1B[S".repeat(l),down:(l=1)=>"\x1B[T".repeat(l)},mi={screen:"\x1B[2J",up:(l=1)=>"\x1B[1J".repeat(l),down:(l=1)=>"\x1B[J".repeat(l),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(l){let s="";for(let t=0;t<l;t++)s+=this.line+(t<l-1?Al.up():"");if(l)s+=Al.left;return s}};zs.exports={cursor:Al,scroll:Ji,erase:mi,beep:"\x07"}});var il=u((qe,vl)=>{var wl=process||{},Ms=wl.argv||[],Il=wl.env||{},Yi=!(!!Il.NO_COLOR||Ms.includes("--no-color"))&&(!!Il.FORCE_COLOR||Ms.includes("--color")||wl.platform==="win32"||(wl.stdout||{}).isTTY&&Il.TERM!=="dumb"||!!Il.CI),Gi=(l,s,t=l)=>(n)=>{let e=""+n,r=e.indexOf(s,l.length);return~r?l+Xi(e,s,t,r)+s:l+e+s},Xi=(l,s,t,n)=>{let e="",r=0;do e+=l.substring(r,n)+t,r=n+s.length,n=l.indexOf(s,r);while(~n);return e+l.substring(r)},Qs=(l=Yi)=>{let s=l?Gi:()=>String;return{isColorSupported:l,reset:s("\x1B[0m","\x1B[0m"),bold:s("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:s("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:s("\x1B[3m","\x1B[23m"),underline:s("\x1B[4m","\x1B[24m"),inverse:s("\x1B[7m","\x1B[27m"),hidden:s("\x1B[8m","\x1B[28m"),strikethrough:s("\x1B[9m","\x1B[29m"),black:s("\x1B[30m","\x1B[39m"),red:s("\x1B[31m","\x1B[39m"),green:s("\x1B[32m","\x1B[39m"),yellow:s("\x1B[33m","\x1B[39m"),blue:s("\x1B[34m","\x1B[39m"),magenta:s("\x1B[35m","\x1B[39m"),cyan:s("\x1B[36m","\x1B[39m"),white:s("\x1B[37m","\x1B[39m"),gray:s("\x1B[90m","\x1B[39m"),bgBlack:s("\x1B[40m","\x1B[49m"),bgRed:s("\x1B[41m","\x1B[49m"),bgGreen:s("\x1B[42m","\x1B[49m"),bgYellow:s("\x1B[43m","\x1B[49m"),bgBlue:s("\x1B[44m","\x1B[49m"),bgMagenta:s("\x1B[45m","\x1B[49m"),bgCyan:s("\x1B[46m","\x1B[49m"),bgWhite:s("\x1B[47m","\x1B[49m"),blackBright:s("\x1B[90m","\x1B[39m"),redBright:s("\x1B[91m","\x1B[39m"),greenBright:s("\x1B[92m","\x1B[39m"),yellowBright:s("\x1B[93m","\x1B[39m"),blueBright:s("\x1B[94m","\x1B[39m"),magentaBright:s("\x1B[95m","\x1B[39m"),cyanBright:s("\x1B[96m","\x1B[39m"),whiteBright:s("\x1B[97m","\x1B[39m"),bgBlackBright:s("\x1B[100m","\x1B[49m"),bgRedBright:s("\x1B[101m","\x1B[49m"),bgGreenBright:s("\x1B[102m","\x1B[49m"),bgYellowBright:s("\x1B[103m","\x1B[49m"),bgBlueBright:s("\x1B[104m","\x1B[49m"),bgMagentaBright:s("\x1B[105m","\x1B[49m"),bgCyanBright:s("\x1B[106m","\x1B[49m"),bgWhiteBright:s("\x1B[107m","\x1B[49m")}};vl.exports=Qs();vl.exports.createColors=Qs});var Xs=v(Gs(),1),{program:D,createCommand:be,createArgument:Ie,createOption:we,CommanderError:Le,InvalidArgumentError:Re,InvalidOptionArgumentError:Te,Command:Pe,Argument:he,Option:Ue,Help:Ne}=Xs.default;var Y=v(Vl(),1);import{stdin as vs,stdout as us}from"node:process";import*as ll from"node:readline";import Zs from"node:readline";import{Writable as zi}from"node:stream";function Mi({onlyFirst:l=!1}={}){let s=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(s,l?void 0:"g")}var Qi=Mi();function Os(l){if(typeof l!="string")throw TypeError(`Expected a \`string\`, got \`${typeof l}\``);return l.replace(Qi,"")}function Fs(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var ds={exports:{}};(function(l){var s={};l.exports=s,s.eastAsianWidth=function(n){var e=n.charCodeAt(0),r=n.length==2?n.charCodeAt(1):0,i=e;return 55296<=e&&e<=56319&&56320<=r&&r<=57343&&(e&=1023,r&=1023,i=e<<10|r,i+=65536),i==12288||65281<=i&&i<=65376||65504<=i&&i<=65510?"F":i==8361||65377<=i&&i<=65470||65474<=i&&i<=65479||65482<=i&&i<=65487||65490<=i&&i<=65495||65498<=i&&i<=65500||65512<=i&&i<=65518?"H":4352<=i&&i<=4447||4515<=i&&i<=4519||4602<=i&&i<=4607||9001<=i&&i<=9002||11904<=i&&i<=11929||11931<=i&&i<=12019||12032<=i&&i<=12245||12272<=i&&i<=12283||12289<=i&&i<=12350||12353<=i&&i<=12438||12441<=i&&i<=12543||12549<=i&&i<=12589||12593<=i&&i<=12686||12688<=i&&i<=12730||12736<=i&&i<=12771||12784<=i&&i<=12830||12832<=i&&i<=12871||12880<=i&&i<=13054||13056<=i&&i<=19903||19968<=i&&i<=42124||42128<=i&&i<=42182||43360<=i&&i<=43388||44032<=i&&i<=55203||55216<=i&&i<=55238||55243<=i&&i<=55291||63744<=i&&i<=64255||65040<=i&&i<=65049||65072<=i&&i<=65106||65108<=i&&i<=65126||65128<=i&&i<=65131||110592<=i&&i<=110593||127488<=i&&i<=127490||127504<=i&&i<=127546||127552<=i&&i<=127560||127568<=i&&i<=127569||131072<=i&&i<=194367||177984<=i&&i<=196605||196608<=i&&i<=262141?"W":32<=i&&i<=126||162<=i&&i<=163||165<=i&&i<=166||i==172||i==175||10214<=i&&i<=10221||10629<=i&&i<=10630?"Na":i==161||i==164||167<=i&&i<=168||i==170||173<=i&&i<=174||176<=i&&i<=180||182<=i&&i<=186||188<=i&&i<=191||i==198||i==208||215<=i&&i<=216||222<=i&&i<=225||i==230||232<=i&&i<=234||236<=i&&i<=237||i==240||242<=i&&i<=243||247<=i&&i<=250||i==252||i==254||i==257||i==273||i==275||i==283||294<=i&&i<=295||i==299||305<=i&&i<=307||i==312||319<=i&&i<=322||i==324||328<=i&&i<=331||i==333||338<=i&&i<=339||358<=i&&i<=359||i==363||i==462||i==464||i==466||i==468||i==470||i==472||i==474||i==476||i==593||i==609||i==708||i==711||713<=i&&i<=715||i==717||i==720||728<=i&&i<=731||i==733||i==735||768<=i&&i<=879||913<=i&&i<=929||931<=i&&i<=937||945<=i&&i<=961||963<=i&&i<=969||i==1025||1040<=i&&i<=1103||i==1105||i==8208||8211<=i&&i<=8214||8216<=i&&i<=8217||8220<=i&&i<=8221||8224<=i&&i<=8226||8228<=i&&i<=8231||i==8240||8242<=i&&i<=8243||i==8245||i==8251||i==8254||i==8308||i==8319||8321<=i&&i<=8324||i==8364||i==8451||i==8453||i==8457||i==8467||i==8470||8481<=i&&i<=8482||i==8486||i==8491||8531<=i&&i<=8532||8539<=i&&i<=8542||8544<=i&&i<=8555||8560<=i&&i<=8569||i==8585||8592<=i&&i<=8601||8632<=i&&i<=8633||i==8658||i==8660||i==8679||i==8704||8706<=i&&i<=8707||8711<=i&&i<=8712||i==8715||i==8719||i==8721||i==8725||i==8730||8733<=i&&i<=8736||i==8739||i==8741||8743<=i&&i<=8748||i==8750||8756<=i&&i<=8759||8764<=i&&i<=8765||i==8776||i==8780||i==8786||8800<=i&&i<=8801||8804<=i&&i<=8807||8810<=i&&i<=8811||8814<=i&&i<=8815||8834<=i&&i<=8835||8838<=i&&i<=8839||i==8853||i==8857||i==8869||i==8895||i==8978||9312<=i&&i<=9449||9451<=i&&i<=9547||9552<=i&&i<=9587||9600<=i&&i<=9615||9618<=i&&i<=9621||9632<=i&&i<=9633||9635<=i&&i<=9641||9650<=i&&i<=9651||9654<=i&&i<=9655||9660<=i&&i<=9661||9664<=i&&i<=9665||9670<=i&&i<=9672||i==9675||9678<=i&&i<=9681||9698<=i&&i<=9701||i==9711||9733<=i&&i<=9734||i==9737||9742<=i&&i<=9743||9748<=i&&i<=9749||i==9756||i==9758||i==9792||i==9794||9824<=i&&i<=9825||9827<=i&&i<=9829||9831<=i&&i<=9834||9836<=i&&i<=9837||i==9839||9886<=i&&i<=9887||9918<=i&&i<=9919||9924<=i&&i<=9933||9935<=i&&i<=9953||i==9955||9960<=i&&i<=9983||i==10045||i==10071||10102<=i&&i<=10111||11093<=i&&i<=11097||12872<=i&&i<=12879||57344<=i&&i<=63743||65024<=i&&i<=65039||i==65533||127232<=i&&i<=127242||127248<=i&&i<=127277||127280<=i&&i<=127337||127344<=i&&i<=127386||917760<=i&&i<=917999||983040<=i&&i<=1048573||1048576<=i&&i<=1114109?"A":"N"},s.characterLength=function(n){var e=this.eastAsianWidth(n);return e=="F"||e=="W"||e=="A"?2:1};function t(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}s.length=function(n){for(var e=t(n),r=0,i=0;i<e.length;i++)r=r+this.characterLength(e[i]);return r},s.slice=function(n,e,r){textLen=s.length(n),e=e||0,r=r||1,e<0&&(e=textLen+e),r<0&&(r=textLen+r);for(var i="",f=0,o=t(n),a=0;a<o.length;a++){var k=o[a],S=s.length(k);if(f>=e-(S==2?1:0))if(f+S<=r)i+=k;else break;f+=S}return i}})(ds);var Zi=ds.exports,xi=Fs(Zi),Hi=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},Ci=Fs(Hi);function kl(l,s={}){if(typeof l!="string"||l.length===0||(s={ambiguousIsNarrow:!0,...s},l=Os(l),l.length===0))return 0;l=l.replace(Ci()," ");let t=s.ambiguousIsNarrow?1:2,n=0;for(let e of l){let r=e.codePointAt(0);if(r<=31||r>=127&&r<=159||r>=768&&r<=879)continue;switch(xi.eastAsianWidth(e)){case"F":case"W":n+=2;break;case"A":n+=t;break;default:n+=1}}return n}var ul=10,xs=(l=0)=>(s)=>`\x1B[${s+l}m`,Hs=(l=0)=>(s)=>`\x1B[${38+l};5;${s}m`,Cs=(l=0)=>(s,t,n)=>`\x1B[${38+l};2;${s};${t};${n}m`,_={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(_.modifier);var Ei=Object.keys(_.color),Ki=Object.keys(_.bgColor);[...Ei,...Ki];function Wi(){let l=new Map;for(let[s,t]of Object.entries(_)){for(let[n,e]of Object.entries(t))_[n]={open:`\x1B[${e[0]}m`,close:`\x1B[${e[1]}m`},t[n]=_[n],l.set(e[0],e[1]);Object.defineProperty(_,s,{value:t,enumerable:!1})}return Object.defineProperty(_,"codes",{value:l,enumerable:!1}),_.color.close="\x1B[39m",_.bgColor.close="\x1B[49m",_.color.ansi=xs(),_.color.ansi256=Hs(),_.color.ansi16m=Cs(),_.bgColor.ansi=xs(ul),_.bgColor.ansi256=Hs(ul),_.bgColor.ansi16m=Cs(ul),Object.defineProperties(_,{rgbToAnsi256:{value:(s,t,n)=>s===t&&t===n?s<8?16:s>248?231:Math.round((s-8)/247*24)+232:16+36*Math.round(s/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:(s)=>{let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(s.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map((r)=>r+r).join(""));let e=Number.parseInt(n,16);return[e>>16&255,e>>8&255,e&255]},enumerable:!1},hexToAnsi256:{value:(s)=>_.rgbToAnsi256(..._.hexToRgb(s)),enumerable:!1},ansi256ToAnsi:{value:(s)=>{if(s<8)return 30+s;if(s<16)return 90+(s-8);let t,n,e;if(s>=232)t=((s-232)*10+8)/255,n=t,e=t;else{s-=16;let f=s%36;t=Math.floor(s/36)/5,n=Math.floor(f/6)/5,e=f%6/5}let r=Math.max(t,n,e)*2;if(r===0)return 30;let i=30+(Math.round(e)<<2|Math.round(n)<<1|Math.round(t));return r===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(s,t,n)=>_.ansi256ToAnsi(_.rgbToAnsi256(s,t,n)),enumerable:!1},hexToAnsi:{value:(s)=>_.ansi256ToAnsi(_.hexToAnsi256(s)),enumerable:!1}}),_}var Ai=Wi(),Tl=new Set(["\x1B",""]),Vi=39,dl="\x07",ps="[",vi="]",Ds="m",pl=`${vi}8;;`,Es=(l)=>`${Tl.values().next().value}${ps}${l}${Ds}`,Ks=(l)=>`${Tl.values().next().value}${pl}${l}${dl}`,ui=(l)=>l.split(" ").map((s)=>kl(s)),Ol=(l,s,t)=>{let n=[...s],e=!1,r=!1,i=kl(Os(l[l.length-1]));for(let[f,o]of n.entries()){let a=kl(o);if(i+a<=t?l[l.length-1]+=o:(l.push(o),i=0),Tl.has(o)&&(e=!0,r=n.slice(f+1).join("").startsWith(pl)),e){r?o===dl&&(e=!1,r=!1):o===Ds&&(e=!1);continue}i+=a,i===t&&f<n.length-1&&(l.push(""),i=0)}!i&&l[l.length-1].length>0&&l.length>1&&(l[l.length-2]+=l.pop())},Oi=(l)=>{let s=l.split(" "),t=s.length;for(;t>0&&!(kl(s[t-1])>0);)t--;return t===s.length?l:s.slice(0,t).join(" ")+s.slice(t).join("")},Fi=(l,s,t={})=>{if(t.trim!==!1&&l.trim()==="")return"";let n="",e,r,i=ui(l),f=[""];for(let[a,k]of l.split(" ").entries()){t.trim!==!1&&(f[f.length-1]=f[f.length-1].trimStart());let S=kl(f[f.length-1]);if(a!==0&&(S>=s&&(t.wordWrap===!1||t.trim===!1)&&(f.push(""),S=0),(S>0||t.trim===!1)&&(f[f.length-1]+=" ",S++)),t.hard&&i[a]>s){let c=s-S,$=1+Math.floor((i[a]-c-1)/s);Math.floor((i[a]-1)/s)<$&&f.push(""),Ol(f,k,s);continue}if(S+i[a]>s&&S>0&&i[a]>0){if(t.wordWrap===!1&&S<s){Ol(f,k,s);continue}f.push("")}if(S+i[a]>s&&t.wordWrap===!1){Ol(f,k,s);continue}f[f.length-1]+=k}t.trim!==!1&&(f=f.map((a)=>Oi(a)));let o=[...f.join(`
|
|
28
|
+
`)];for(let[a,k]of o.entries()){if(n+=k,Tl.has(k)){let{groups:c}=new RegExp(`(?:\\${ps}(?<code>\\d+)m|\\${pl}(?<uri>.*)${dl})`).exec(o.slice(a).join(""))||{groups:{}};if(c.code!==void 0){let $=Number.parseFloat(c.code);e=$===Vi?void 0:$}else c.uri!==void 0&&(r=c.uri.length===0?void 0:c.uri)}let S=Ai.codes.get(Number(e));o[a+1]===`
|
|
29
|
+
`?(r&&(n+=Ks("")),e&&S&&(n+=Es(S))):k===`
|
|
30
|
+
`&&(e&&S&&(n+=Es(e)),r&&(n+=Ks(r)))}return n};function Ws(l,s,t){return String(l).normalize().replace(/\r\n/g,`
|
|
31
31
|
`).split(`
|
|
32
|
-
`).map((
|
|
33
|
-
`)}var
|
|
34
|
-
`),
|
|
35
|
-
`),
|
|
36
|
-
`),
|
|
37
|
-
`).length-1;this.output.write(
|
|
38
|
-
`);this.output.write(
|
|
39
|
-
`).slice(
|
|
40
|
-
`)),this._prevFrame=l;return}this.output.write(
|
|
41
|
-
${
|
|
42
|
-
`,
|
|
43
|
-
${g.default.gray(
|
|
44
|
-
${g.default.cyan(
|
|
45
|
-
`}}}).prompt()},
|
|
46
|
-
${
|
|
47
|
-
`;switch(this.state){case"submit":return`${
|
|
48
|
-
${g.default.gray(
|
|
49
|
-
${g.default.cyan(
|
|
50
|
-
${g.default.cyan(
|
|
51
|
-
`}}}).prompt()};var
|
|
52
|
-
${g.default.reset(g.default.dim(`Press ${g.default.gray(g.default.bgWhite(g.default.inverse(" space ")))} to select, ${g.default.gray(g.default.bgWhite(g.default.inverse(" enter ")))} to submit`))}`},render(){let
|
|
53
|
-
${
|
|
54
|
-
`,
|
|
55
|
-
${g.default.gray(
|
|
56
|
-
`).map((
|
|
57
|
-
`);return`${
|
|
58
|
-
${g.default.yellow(
|
|
59
|
-
${
|
|
60
|
-
`}default:return`${
|
|
61
|
-
${g.default.cyan(
|
|
62
|
-
${g.default.cyan(
|
|
63
|
-
`}}}).prompt()};var
|
|
32
|
+
`).map((n)=>Fi(n,s,t)).join(`
|
|
33
|
+
`)}var di=["up","down","left","right","space","enter","cancel"],Rl={actions:new Set(di),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};function Dl(l,s){if(typeof l=="string")return Rl.aliases.get(l)===s;for(let t of l)if(t!==void 0&&Dl(t,s))return!0;return!1}function pi(l,s){if(l===s)return;let t=l.split(`
|
|
34
|
+
`),n=s.split(`
|
|
35
|
+
`),e=[];for(let r=0;r<Math.max(t.length,n.length);r++)t[r]!==n[r]&&e.push(r);return e}var Di=globalThis.process.platform.startsWith("win"),Fl=Symbol("clack:cancel");function G(l){return l===Fl}function Ll(l,s){let t=l;t.isTTY&&t.setRawMode(s)}function lt({input:l=vs,output:s=us,overwrite:t=!0,hideCursor:n=!0}={}){let e=ll.createInterface({input:l,output:s,prompt:"",tabSize:1});ll.emitKeypressEvents(l,e),l.isTTY&&l.setRawMode(!0);let r=(i,{name:f,sequence:o})=>{let a=String(i);if(Dl([a,f,o],"cancel")){n&&s.write(Y.cursor.show),process.exit(0);return}if(!t)return;ll.moveCursor(s,f==="return"?0:-1,f==="return"?-1:0,()=>{ll.clearLine(s,1,()=>{l.once("keypress",r)})})};return n&&s.write(Y.cursor.hide),l.once("keypress",r),()=>{l.off("keypress",r),n&&s.write(Y.cursor.show),l.isTTY&&!Di&&l.setRawMode(!1),e.terminal=!1,e.close()}}var ln=Object.defineProperty,sn=(l,s,t)=>(s in l)?ln(l,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[s]=t,H=(l,s,t)=>(sn(l,typeof s!="symbol"?s+"":s,t),t);class Pl{constructor(l,s=!0){H(this,"input"),H(this,"output"),H(this,"_abortSignal"),H(this,"rl"),H(this,"opts"),H(this,"_render"),H(this,"_track",!1),H(this,"_prevFrame",""),H(this,"_subscribers",new Map),H(this,"_cursor",0),H(this,"state","initial"),H(this,"error",""),H(this,"value");let{input:t=vs,output:n=us,render:e,signal:r,...i}=l;this.opts=i,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=e.bind(this),this._track=s,this._abortSignal=r,this.input=t,this.output=n}unsubscribe(){this._subscribers.clear()}setSubscriber(l,s){let t=this._subscribers.get(l)??[];t.push(s),this._subscribers.set(l,t)}on(l,s){this.setSubscriber(l,{cb:s})}once(l,s){this.setSubscriber(l,{cb:s,once:!0})}emit(l,...s){let t=this._subscribers.get(l)??[],n=[];for(let e of t)e.cb(...s),e.once&&n.push(()=>t.splice(t.indexOf(e),1));for(let e of n)e()}prompt(){return new Promise((l,s)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),l(Fl);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let t=new zi;t._write=(n,e,r)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),r()},this.input.pipe(t),this.rl=Zs.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),Zs.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),Ll(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(Y.cursor.show),this.output.off("resize",this.render),Ll(this.input,!1),l(this.value)}),this.once("cancel",()=>{this.output.write(Y.cursor.show),this.output.off("resize",this.render),Ll(this.input,!1),l(Fl)})})}onKeypress(l,s){if(this.state==="error"&&(this.state="active"),s?.name&&(!this._track&&Rl.aliases.has(s.name)&&this.emit("cursor",Rl.aliases.get(s.name)),Rl.actions.has(s.name)&&this.emit("cursor",s.name)),l&&(l.toLowerCase()==="y"||l.toLowerCase()==="n")&&this.emit("confirm",l.toLowerCase()==="y"),l==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),l&&this.emit("key",l.toLowerCase()),s?.name==="return"){if(this.opts.validate){let t=this.opts.validate(this.value);t&&(this.error=t instanceof Error?t.message:t,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}Dl([l,s?.name,s?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
36
|
+
`),Ll(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let l=Ws(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
37
|
+
`).length-1;this.output.write(Y.cursor.move(-999,l*-1))}render(){let l=Ws(this._render(this)??"",process.stdout.columns,{hard:!0});if(l!==this._prevFrame){if(this.state==="initial")this.output.write(Y.cursor.hide);else{let s=pi(this._prevFrame,l);if(this.restoreCursor(),s&&s?.length===1){let t=s[0];this.output.write(Y.cursor.move(0,t)),this.output.write(Y.erase.lines(1));let n=l.split(`
|
|
38
|
+
`);this.output.write(n[t]),this._prevFrame=l,this.output.write(Y.cursor.move(0,n.length-t-1));return}if(s&&s?.length>1){let t=s[0];this.output.write(Y.cursor.move(0,t)),this.output.write(Y.erase.down());let n=l.split(`
|
|
39
|
+
`).slice(t);this.output.write(n.join(`
|
|
40
|
+
`)),this._prevFrame=l;return}this.output.write(Y.erase.down())}this.output.write(l),this.state==="initial"&&(this.state="active"),this._prevFrame=l}}}class ls extends Pl{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(l){super(l,!1),this.value=!!l.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(s)=>{this.output.write(Y.cursor.move(0,-1)),this.value=s,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var tn;tn=new WeakMap;var nn=Object.defineProperty,en=(l,s,t)=>(s in l)?nn(l,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[s]=t,As=(l,s,t)=>(en(l,typeof s!="symbol"?s+"":s,t),t),st=class extends Pl{constructor(l){super(l,!1),As(this,"options"),As(this,"cursor",0),this.options=l.options,this.value=[...l.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:s})=>s===l.cursorAt),0),this.on("key",(s)=>{s==="a"&&this.toggleAll()}),this.on("cursor",(s)=>{switch(s){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let l=this.value.length===this.options.length;this.value=l?[]:this.options.map((s)=>s.value)}toggleValue(){let l=this.value.includes(this._value);this.value=l?this.value.filter((s)=>s!==this._value):[...this.value,this._value]}};var rn=Object.defineProperty,fn=(l,s,t)=>(s in l)?rn(l,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[s]=t,Vs=(l,s,t)=>(fn(l,typeof s!="symbol"?s+"":s,t),t);class ss extends Pl{constructor(l){super(l,!1),Vs(this,"options"),Vs(this,"cursor",0),this.options=l.options,this.cursor=this.options.findIndex(({value:s})=>s===l.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(s)=>{switch(s){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}var g=v(il(),1),hl=v(Vl(),1);import K from"node:process";function an(){return K.platform!=="win32"?K.env.TERM!=="linux":!!K.env.CI||!!K.env.WT_SESSION||!!K.env.TERMINUS_SUBLIME||K.env.ConEmuTask==="{cmd::Cmder}"||K.env.TERM_PROGRAM==="Terminus-Sublime"||K.env.TERM_PROGRAM==="vscode"||K.env.TERM==="xterm-256color"||K.env.TERM==="alacritty"||K.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var ts=an(),q=(l,s)=>ts?l:s,cn=q("◆","*"),it=q("■","x"),nt=q("▲","x"),rs=q("◇","o"),on=q("┌","T"),U=q("│","|"),el=q("└","—"),is=q("●",">"),ns=q("○"," "),kn=q("◻","[•]"),tt=q("◼","[+]"),Sn=q("◻","[ ]"),Ce=q("▪","•"),Ee=q("─","-"),Ke=q("╮","+"),We=q("├","+"),Ae=q("╯","+"),yn=q("●","•"),gn=q("◆","*"),$n=q("▲","!"),bn=q("■","x"),fs=(l)=>{switch(l){case"initial":case"active":return g.default.cyan(cn);case"cancel":return g.default.red(it);case"error":return g.default.yellow(nt);case"submit":return g.default.green(rs)}},es=(l)=>{let{cursor:s,options:t,style:n}=l,e=l.maxItems??Number.POSITIVE_INFINITY,r=Math.max(process.stdout.rows-4,0),i=Math.min(r,Math.max(e,5)),f=0;s>=f+i-3?f=Math.max(Math.min(s-i+3,t.length-i),0):s<f+2&&(f=Math.max(s-2,0));let o=i<t.length&&f>0,a=i<t.length&&f+i<t.length;return t.slice(f,f+i).map((k,S,c)=>{let $=S===0&&o,I=S===c.length-1&&a;return $||I?g.default.dim("..."):n(k,S+f===s)})};var rl=(l)=>{let s=l.active??"Yes",t=l.inactive??"No";return new ls({active:s,inactive:t,initialValue:l.initialValue??!0,render(){let n=`${g.default.gray(U)}
|
|
41
|
+
${fs(this.state)} ${l.message}
|
|
42
|
+
`,e=this.value?s:t;switch(this.state){case"submit":return`${n}${g.default.gray(U)} ${g.default.dim(e)}`;case"cancel":return`${n}${g.default.gray(U)} ${g.default.strikethrough(g.default.dim(e))}
|
|
43
|
+
${g.default.gray(U)}`;default:return`${n}${g.default.cyan(U)} ${this.value?`${g.default.green(is)} ${s}`:`${g.default.dim(ns)} ${g.default.dim(s)}`} ${g.default.dim("/")} ${this.value?`${g.default.dim(ns)} ${g.default.dim(t)}`:`${g.default.green(is)} ${t}`}
|
|
44
|
+
${g.default.cyan(el)}
|
|
45
|
+
`}}}).prompt()},et=(l)=>{let s=(t,n)=>{let e=t.label??String(t.value);switch(n){case"selected":return`${g.default.dim(e)}`;case"active":return`${g.default.green(is)} ${e} ${t.hint?g.default.dim(`(${t.hint})`):""}`;case"cancelled":return`${g.default.strikethrough(g.default.dim(e))}`;default:return`${g.default.dim(ns)} ${g.default.dim(e)}`}};return new ss({options:l.options,initialValue:l.initialValue,render(){let t=`${g.default.gray(U)}
|
|
46
|
+
${fs(this.state)} ${l.message}
|
|
47
|
+
`;switch(this.state){case"submit":return`${t}${g.default.gray(U)} ${s(this.options[this.cursor],"selected")}`;case"cancel":return`${t}${g.default.gray(U)} ${s(this.options[this.cursor],"cancelled")}
|
|
48
|
+
${g.default.gray(U)}`;default:return`${t}${g.default.cyan(U)} ${es({cursor:this.cursor,options:this.options,maxItems:l.maxItems,style:(n,e)=>s(n,e?"active":"inactive")}).join(`
|
|
49
|
+
${g.default.cyan(U)} `)}
|
|
50
|
+
${g.default.cyan(el)}
|
|
51
|
+
`}}}).prompt()};var F=(l)=>{let s=(t,n)=>{let e=t.label??String(t.value);return n==="active"?`${g.default.cyan(kn)} ${e} ${t.hint?g.default.dim(`(${t.hint})`):""}`:n==="selected"?`${g.default.green(tt)} ${g.default.dim(e)} ${t.hint?g.default.dim(`(${t.hint})`):""}`:n==="cancelled"?`${g.default.strikethrough(g.default.dim(e))}`:n==="active-selected"?`${g.default.green(tt)} ${e} ${t.hint?g.default.dim(`(${t.hint})`):""}`:n==="submitted"?`${g.default.dim(e)}`:`${g.default.dim(Sn)} ${g.default.dim(e)}`};return new st({options:l.options,initialValues:l.initialValues,required:l.required??!0,cursorAt:l.cursorAt,validate(t){if(this.required&&t.length===0)return`Please select at least one option.
|
|
52
|
+
${g.default.reset(g.default.dim(`Press ${g.default.gray(g.default.bgWhite(g.default.inverse(" space ")))} to select, ${g.default.gray(g.default.bgWhite(g.default.inverse(" enter ")))} to submit`))}`},render(){let t=`${g.default.gray(U)}
|
|
53
|
+
${fs(this.state)} ${l.message}
|
|
54
|
+
`,n=(e,r)=>{let i=this.value.includes(e.value);return r&&i?s(e,"active-selected"):i?s(e,"selected"):s(e,r?"active":"inactive")};switch(this.state){case"submit":return`${t}${g.default.gray(U)} ${this.options.filter(({value:e})=>this.value.includes(e)).map((e)=>s(e,"submitted")).join(g.default.dim(", "))||g.default.dim("none")}`;case"cancel":{let e=this.options.filter(({value:r})=>this.value.includes(r)).map((r)=>s(r,"cancelled")).join(g.default.dim(", "));return`${t}${g.default.gray(U)} ${e.trim()?`${e}
|
|
55
|
+
${g.default.gray(U)}`:""}`}case"error":{let e=this.error.split(`
|
|
56
|
+
`).map((r,i)=>i===0?`${g.default.yellow(el)} ${g.default.yellow(r)}`:` ${r}`).join(`
|
|
57
|
+
`);return`${t+g.default.yellow(U)} ${es({options:this.options,cursor:this.cursor,maxItems:l.maxItems,style:n}).join(`
|
|
58
|
+
${g.default.yellow(U)} `)}
|
|
59
|
+
${e}
|
|
60
|
+
`}default:return`${t}${g.default.cyan(U)} ${es({options:this.options,cursor:this.cursor,maxItems:l.maxItems,style:n}).join(`
|
|
61
|
+
${g.default.cyan(U)} `)}
|
|
62
|
+
${g.default.cyan(el)}
|
|
63
|
+
`}}}).prompt()};var C=(l="")=>{process.stdout.write(`${g.default.gray(el)} ${g.default.red(l)}
|
|
64
64
|
|
|
65
|
-
`)},
|
|
66
|
-
`)},
|
|
67
|
-
${g.default.gray(
|
|
65
|
+
`)},nl=(l="")=>{process.stdout.write(`${g.default.gray(on)} ${l}
|
|
66
|
+
`)},J=(l="")=>{process.stdout.write(`${g.default.gray(U)}
|
|
67
|
+
${g.default.gray(el)} ${l}
|
|
68
68
|
|
|
69
|
-
`)},
|
|
70
|
-
`);
|
|
69
|
+
`)},y={message:(l="",{symbol:s=g.default.gray(U)}={})=>{let t=[`${g.default.gray(U)}`];if(l){let[n,...e]=l.split(`
|
|
70
|
+
`);t.push(`${s} ${n}`,...e.map((r)=>`${g.default.gray(U)} ${r}`))}process.stdout.write(`${t.join(`
|
|
71
71
|
`)}
|
|
72
|
-
`)},info:(l)=>{
|
|
73
|
-
`);let
|
|
74
|
-
`);process.stdout.write(
|
|
75
|
-
`);let
|
|
76
|
-
`):process.stdout.write(`${
|
|
77
|
-
`),
|
|
78
|
-
`)){let t=S.indexOf(":");if(t===-1)continue;let $=S.slice(0,t).trim(),c=S.slice(t+1).trim();if(c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'"))i[$]=c.slice(1,-1);else if($==="metadata")try{let k={},b=c.replace(/^\{|\}$/g,"").trim();if(b){for(let U of b.split(",")){let[w,n]=U.split("=").map((L)=>L.trim());if(w&&n)k[w]=n.replace(/^['"]|['"]$/g,"")}i[$]=JSON.stringify(k)}}catch{i[$]=c}else i[$]=c}return{data:i,content:y}}async function ts(l){try{let s=m(l,"SKILL.md");return(await ky(s)).isFile()}catch{return!1}}async function ss(l){try{let s=await $y(l,"utf-8"),{data:f}=gy(s);if(!f.name||!f.description)return null;return{name:f.name,description:f.description,path:by(l),metadata:f.metadata?JSON.parse(f.metadata):void 0}}catch{return null}}async function st(l,s=0,f=5){let y=[];if(s>f)return y;try{if(await ts(l))y.push(l);let i=await lt(l,{withFileTypes:!0});for(let S of i)if(S.isDirectory()&&!ny.includes(S.name)){let t=await st(m(l,S.name),s+1,f);y.push(...t)}}catch{}return y}async function rl(l,s){let f=[],y=new Set,i=s?m(l,s):l;if(await ts(i)){let t=await ss(m(i,"SKILL.md"));if(t)return f.push(t),f}let S=wy(i);for(let t of S)try{let $=await lt(t,{withFileTypes:!0});for(let c of $)if(c.isDirectory()){let k=m(t,c.name);if(await ts(k)){let b=await ss(m(k,"SKILL.md"));if(b&&!y.has(b.name))f.push(b),y.add(b.name)}}}catch{}if(f.length===0){let t=await st(i);for(let $ of t){let c=await ss(m($,"SKILL.md"));if(c&&!y.has(c.name))f.push(c),y.add(c.name)}}return f}function u(l){return l.name||cy(l.path)}import{mkdir as tt,cp as Uy,access as Ly,readdir as Ry}from"fs/promises";import{join as F,basename as Ty}from"path";async function Jl(l,s,f={}){let y=z[s],i=l.name||Ty(l.path),S=f.cwd||process.cwd(),t=f.global?y.globalSkillsDir:F(S,y.skillsDir),$=F(t,i);try{return await tt($,{recursive:!0}),await ft(l.path,$),{success:!0,path:$,originalPath:f.global?$:F(y.skillsDir,i)}}catch(c){return{success:!1,path:$,originalPath:f.global?$:F(y.skillsDir,i),error:c instanceof Error?c.message:"Unknown error"}}}var By=new Set(["README.md","metadata.json"]),_y=(l)=>{if(By.has(l))return!0;if(l.startsWith("_"))return!0;return!1};async function ft(l,s){await tt(s,{recursive:!0});let f=await Ry(l,{withFileTypes:!0});for(let y of f){if(_y(y.name))continue;let i=F(l,y.name),S=F(s,y.name);if(y.isDirectory())await ft(i,S);else await Uy(i,S)}}async function yt(l,s,f={}){let y=z[s],i=f.global?y.globalSkillsDir:F(f.cwd||process.cwd(),y.skillsDir),S=F(i,l);try{return await Ly(S),!0}catch{return!1}}function it(l,s,f={}){let y=z[s],i=f.global?y.globalSkillsDir:F(f.cwd||process.cwd(),y.skillsDir);return F(i,l)}import{homedir as qy}from"os";import{join as ys}from"path";import{existsSync as is,readFileSync as ry,writeFileSync as St,mkdirSync as Jy}from"fs";var fs=ys(qy(),".give-skill"),Pl=ys(fs,"state.json");function $t(){if(!is(fs))Jy(fs,{recursive:!0})}function kl(){if($t(),!is(Pl)){let l={lastUpdate:new Date().toISOString(),skills:{}};return St(Pl,JSON.stringify(l,null,2)),l}try{let l=ry(Pl,"utf-8");return JSON.parse(l)}catch{return{lastUpdate:new Date().toISOString(),skills:{}}}}function Yl(l){$t(),l.lastUpdate=new Date().toISOString(),St(Pl,JSON.stringify(l,null,2))}function kt(l,s,f,y,i,S){let t=kl(),$=l.toLowerCase(),c=!1,k;if(!t.skills[$])t.skills[$]={source:s,url:s,subpath:f,branch:y,commit:i,installedAt:new Date().toISOString(),installations:[]};else{if(t.skills[$].branch!==y)k=t.skills[$].branch,t.skills[$].branch=y,t.skills[$].commit=i,c=!0;if(t.skills[$].url=s,t.skills[$].source=s,f)t.skills[$].subpath=f}let b=t.skills[$].installations.findIndex((U)=>U.agent===S.agent&&U.path===S.path);if(b>=0)t.skills[$].installations[b]=S;else t.skills[$].installations.push(S);return Yl(t),{updated:c,previousBranch:k}}function Gl(l,s,f){let y=kl(),i=l.toLowerCase();if(!y.skills[i])return;if(y.skills[i].installations=y.skills[i].installations.filter((S)=>!(S.agent===s&&S.path===f)),y.skills[i].installations.length===0)delete y.skills[i];Yl(y)}function ct(l,s){let f=kl(),y=l.toLowerCase();if(f.skills[y])f.skills[y].commit=s,Yl(f)}function yl(){return kl()}async function bt(){let l=kl(),s=[];for(let[f,y]of Object.entries(l.skills)){let i=[];for(let S of y.installations)try{let t=S.type==="global"?S.path:ys(process.cwd(),S.path);if(is(t))i.push(S)}catch{}if(i.length===0)s.push(f);else if(i.length!==y.installations.length)y.installations=i}for(let f of s)delete l.skills[f];if(s.length>0)Yl(l)}async function nt(l,s){let f={tempDir:null,spinner:D()};try{f.spinner.start("Parsing source...");let y=es(l),i=y.branch??"main";f.spinner.stop(`Source: ${_.default.cyan(y.url)}${y.subpath?` (${y.subpath})`:""}${y.branch?` @ ${_.default.cyan(y.branch)}`:""}`),f.spinner.start("Cloning repository..."),f.tempDir=await Bl(y.url,y.branch),f.spinner.stop("Repository cloned");let S=await _l(f.tempDir);f.spinner.start("Discovering skills...");let t=await rl(f.tempDir,y.subpath);if(t.length===0)return f.spinner.stop(_.default.red("No skills found")),j(_.default.red("No valid skills found. Skills require a SKILL.md with name and description.")),{success:!1,installed:0,failed:0,results:[]};if(f.spinner.stop(`Found ${_.default.green(t.length)} skill${t.length>1?"s":""}`),s.list){console.log(),I.step(_.default.bold("Available Skills"));for(let w of t)I.message(` ${_.default.cyan(u(w))}`),I.message(` ${_.default.dim(w.description)}`);return console.log(),j("Use --skill <name> to install specific skills"),{success:!0,installed:0,failed:0,results:[]}}let $=await Py(t,s);if(!$)return{success:!1,installed:0,failed:0,results:[]};let c=await Yy(s,f);if(!c)return{success:!1,installed:0,failed:0,results:[]};let k=await Gy(s);if(k===null)return{success:!1,installed:0,failed:0,results:[]};if(!await Xy(s,$,c,k))return{success:!1,installed:0,failed:0,results:[]};f.spinner.start("Installing skills...");let U=await zy($,c,k,y,S,i);return f.spinner.stop("Installation complete"),U}finally{if(f.tempDir)await ql(f.tempDir)}}async function Py(l,s){let f;if(s.skill&&s.skill.length>0){if(f=l.filter((y)=>s.skill.some((i)=>y.name.toLowerCase()===i.toLowerCase()||u(y).toLowerCase()===i.toLowerCase())),f.length===0){I.error(`No matching skills found for: ${s.skill.join(", ")}`),I.info("Available skills:");for(let y of l)I.message(` - ${u(y)}`);return null}I.info(`Selected ${f.length} skill${f.length!==1?"s":""}: ${f.map((y)=>_.default.cyan(u(y))).join(", ")}`)}else if(l.length===1){f=l;let y=l[0];I.info(`Skill: ${_.default.cyan(u(y))}`),I.message(_.default.dim(y.description))}else if(s.yes)f=l,I.info(`Installing all ${l.length} skills`);else{let y=l.map((S)=>({value:S,label:u(S),hint:S.description.length>60?S.description.slice(0,57)+"...":S.description})),i=await o({message:"Select skills to install",options:y,required:!0});if(K(i))return V("Installation cancelled"),null;f=i}return f}async function Yy(l,s){if(l.agent&&l.agent.length>0){let y=Object.keys(z),i=l.agent.filter((S)=>!y.includes(S));if(i.length>0)return I.error(`Invalid agents: ${i.join(", ")}`),I.info(`Valid agents: ${y.join(", ")}`),null;return l.agent}s.spinner.start("Detecting installed agents...");let f=await Ds();if(s.spinner.stop(`Detected ${f.length} agent${f.length!==1?"s":""}`),f.length===0)if(l.yes){let y=Object.keys(z);return I.info("Installing to all agents (none detected)"),y}else{I.warn("No coding agents detected. You can still install skills.");let y=Object.entries(z).map(([S,t])=>({value:S,label:t.displayName})),i=await o({message:"Select agents to install skills to",options:y,required:!0});if(K(i))return V("Installation cancelled"),null;return i}else if(f.length===1||l.yes){if(f.length===1){let y=f[0];I.info(`Installing to: ${_.default.cyan(z[y].displayName)}`)}else I.info(`Installing to: ${f.map((y)=>_.default.cyan(z[y].displayName)).join(", ")}`);return f}else{let y=f.map((S)=>({value:S,label:z[S].displayName,hint:z[S].skillsDir})),i=await o({message:"Select agents to install skills to",options:y,required:!0,initialValues:f});if(K(i))return V("Installation cancelled"),null;return i}}async function Gy(l){let s=l.global??!1;if(l.global===void 0&&!l.yes){let f=await ds({message:"Installation scope",options:[{value:!1,label:"Project",hint:"Install in current directory (committed with your project)"},{value:!0,label:"Global",hint:"Install in home directory (available across all projects)"}]});if(K(f))return V("Installation cancelled"),null;s=f}return s}async function Xy(l,s,f,y){console.log(),I.step(_.default.bold("Installation Summary"));for(let i of s){I.message(` ${_.default.cyan(u(i))}`);for(let S of f){let t=it(i.name,S,{global:y}),c=await yt(i.name,S,{global:y})?_.default.yellow(" (will overwrite)"):"";I.message(` ${_.default.dim("→")} ${z[S].displayName}: ${_.default.dim(t)}${c}`)}}if(console.log(),!l.yes){let i=await fl({message:"Proceed with installation?"});if(K(i)||!i)return V("Installation cancelled"),!1}return!0}async function zy(l,s,f,y,i,S){let t=l.flatMap((w)=>s.map((n)=>Jl(w,n,{global:f}))),$=await Promise.all(t),c=$.map((w,n)=>{let L=Math.floor(n/s.length),J=n%s.length,T=l[L],X=s[J];return{skill:u(T),agent:z[X].displayName,...w}}),k=new Map;for(let[w,n]of $.entries())if(n.success){let L=Math.floor(w/s.length),J=w%s.length,T=l[L],X=s[J],O=kt(T.name,y.url,y.subpath,S,i,{agent:X,type:f?"global":"project",path:n.originalPath});if(O.updated&&O.previousBranch){let A=k.get(T.name);k.set(T.name,{previous:A?.previous??O.previousBranch,current:A?.current??S})}}console.log();let b=c.filter((w)=>w.success),U=c.filter((w)=>!w.success);if(k.size>0){console.log();for(let[w,{previous:n,current:L}]of k)I.warn(_.default.yellow(` ${_.default.cyan(w)}: ${_.default.dim(n)} → ${_.default.green(L)}`))}if(b.length>0){console.log(),I.success(_.default.green(`Successfully installed ${b.length} skill${b.length!==1?"s":""}`));for(let w of b)I.message(` ${_.default.green("✓")} ${w.skill} → ${w.agent}`),I.message(` ${_.default.dim(w.path)}`)}if(U.length>0){console.log(),I.error(_.default.red(`Failed to install ${U.length} skill${U.length!==1?"s":""}`));for(let w of U)I.message(` ${_.default.red("✗")} ${w.skill} → ${w.agent}`),I.message(` ${_.default.dim(w.error)}`)}return console.log(),j(_.default.green("Done!")),{success:U.length===0,installed:b.length,failed:U.length,results:c}}var R=d(sl(),1);import{existsSync as wt}from"fs";import{join as Qy,resolve as Zy}from"path";function gt(l){return l.type==="global"?l.path:Zy(process.cwd(),l.path)}async function It(l,s){let f=s.installations.map((i)=>{let S=gt(i);return{agent:z[i.agent].displayName,path:S,exists:wt(S)}});if(f.filter((i)=>i.exists).length===0)return{skillName:l,currentCommit:s.commit,latestCommit:s.commit,status:"orphaned",installations:f};try{let i=await ps(s.url,s.branch),S=i===s.commit;return{skillName:l,currentCommit:s.commit,latestCommit:i,status:S?"latest":"update-available",installations:f}}catch(i){return{skillName:l,currentCommit:s.commit,latestCommit:s.commit,status:"error",installations:f,error:i instanceof Error?i.message:"Unknown error"}}}async function Ss(l){let s=yl(),f=[],y=Object.entries(s.skills).map(([t,$])=>({skillName:t,state:$})),i;if(l&&l.length>0){let t=new Set(l.map(($)=>$.toLowerCase()));i=y.filter(({skillName:$})=>t.has($.toLowerCase()))}else i=y;if(i.length===0)return[];let S=D();if(i.length===1){let{skillName:t,state:$}=i[0];S.start(`Checking ${R.default.cyan(t)}...`);let c=await It(t,$);S.stop(c.status==="latest"?R.default.green("Up to date"):R.default.yellow("Update available")),f.push(c)}else{S.start(`Checking ${i.length} skill${i.length>1?"s":""}...`);for(let{skillName:t,state:$}of i){let c=await It(t,$);f.push(c)}S.stop("Check complete")}return f}async function Ut(l,s={}){let f=yl(),y=[],i=Object.entries(f.skills).map(([n,L])=>({skillName:n,state:L})),S;if(l&&l.length>0){let n=new Set(l.map((L)=>L.toLowerCase()));S=i.filter(({skillName:L})=>n.has(L.toLowerCase()))}else S=i;if(S.length===0)return I.warn("No skills found to update"),[];let t=await Ss(l),$=t.filter((n)=>n.status==="update-available");if($.length===0){let n=t.filter((L)=>L.status==="orphaned");if(n.length>0){I.warn(`${n.length} skill${n.length>1?"s":""} have no valid installations`);for(let L of n)I.message(` ${R.default.yellow("○")} ${R.default.cyan(L.skillName)} - all installations removed`)}return I.success(R.default.green("All skills are up to date")),[]}console.log(),I.step(R.default.bold("Updates Available"));let c=$.map((n)=>({value:n.skillName,label:n.skillName,hint:`${n.currentCommit.slice(0,7)} → ${n.latestCommit.slice(0,7)}`})),k;if(s.yes)k=$.map((n)=>n.skillName);else{let n=await o({message:"Select skills to update",options:c,required:!0,initialValues:$.map((L)=>L.skillName)});if(K(n))return V("Update cancelled"),[];k=n}console.log(),I.step(R.default.bold("Will Update"));for(let n of k){let L=$.find((J)=>J.skillName===n);if(L)I.message(` ${R.default.cyan(L.skillName)}`),I.message(` ${R.default.dim("Current:")} ${R.default.yellow(L.currentCommit.slice(0,7))} ${R.default.dim("→")} ${R.default.green(L.latestCommit.slice(0,7))}`)}if(console.log(),!s.yes){let n=await fl({message:"Proceed with update?"});if(K(n)||!n)return V("Update cancelled"),[]}let b=D();b.start(`Updating ${k.length} skill${k.length>1?"s":""}...`);for(let{skillName:n,state:L}of S){let J=t.find((A)=>A.skillName===n);if(!J||J.status!=="update-available"){if(J?.status==="latest")y.push({skillName:n,success:!0,updated:0,failed:0});else y.push({skillName:n,success:!1,updated:0,failed:0});continue}if(!k.includes(n))continue;let T=null,X=0,O=0;try{T=await Bl(L.url);let A=await _l(T),M=L.subpath?Qy(T,L.subpath):T,C=(await rl(M)).find((E)=>E.name.toLowerCase()===n.toLowerCase());if(!C)throw Error("Skill not found in repository");for(let E of L.installations){let zl=gt(E);if(!wt(zl)){Gl(n,E.agent,E.path);continue}if((await Jl(C,E.agent,{global:E.type==="global"})).success)X++;else O++}ct(n,A),y.push({skillName:n,success:O===0,updated:X,failed:O})}catch(A){y.push({skillName:n,success:!1,updated:X,failed:O+1,error:A instanceof Error?A.message:"Unknown error"})}finally{if(T)await ql(T)}}b.stop("Update complete"),console.log();let U=y.filter((n)=>n.success&&n.updated>0),w=y.filter((n)=>!n.success||n.failed>0);if(U.length>0){I.success(R.default.green(`Updated ${U.length} skill${U.length!==1?"s":""}`));for(let n of U)I.message(` ${R.default.green("✓")} ${R.default.cyan(n.skillName)} (${n.updated} installation${n.updated!==1?"s":""})`)}if(w.length>0){console.log(),I.error(R.default.red(`Failed to update ${w.length} skill${w.length!==1?"s":""}`));for(let n of w)if(I.message(` ${R.default.red("✗")} ${R.default.cyan(n.skillName)}`),n.error)I.message(` ${R.default.dim(n.error)}`)}if(console.log(),U.length>0)j(R.default.green("Done!"));else j(R.default.yellow("No skills were updated"));return y}async function Lt(l){if(l.length===0){I.warn("No skills tracked. Install skills with:"),console.log(),I.message(` ${R.default.cyan("npx give-skill <repo>")}`),console.log();return}console.log(),I.step(R.default.bold("Skills Status"));for(let s of l){let f={latest:R.default.green("✓"),"update-available":R.default.yellow("↓"),error:R.default.red("✗"),orphaned:R.default.dim("○")}[s.status],y={latest:R.default.green("latest"),"update-available":R.default.yellow("update available"),error:R.default.red("error"),orphaned:R.default.dim("orphaned")}[s.status];if(I.message(`${f} ${R.default.cyan(s.skillName)}`),I.message(` Status: ${y}`),s.status==="update-available")I.message(` ${R.default.dim("Commit:")} ${R.default.yellow(s.currentCommit.slice(0,7))} ${R.default.dim("→")} ${R.default.green(s.latestCommit.slice(0,7))}`);else if(s.status==="latest")I.message(` ${R.default.dim("Commit:")} ${s.currentCommit.slice(0,7)}`);if(s.error)I.message(` ${R.default.red(s.error)}`);let i=s.installations.filter((t)=>t.exists);if(i.length>0){I.message(` ${R.default.dim("Installed in:")}`);for(let t of i)I.message(` ${R.default.dim("•")} ${t.agent}: ${R.default.dim(t.path)}`)}let S=s.installations.filter((t)=>!t.exists);if(S.length>0){I.message(` ${R.default.yellow("Missing installations:")}`);for(let t of S)I.message(` ${R.default.dim("•")} ${t.agent}: ${R.default.dim(t.path)}`)}console.log()}}async function Rt(){let l=D();l.start("Checking for orphaned entries..."),await bt(),l.stop(R.default.green("Cleaned up orphaned entries"))}var Y=d(sl(),1);import{existsSync as Xl,rmSync as jy}from"fs";import{resolve as My}from"path";function $s(l){return l.type==="global"?l.path:My(process.cwd(),l.path)}async function Hy(l){try{if(Xl(l))jy(l,{recursive:!0,force:!0});return{success:!0}}catch(s){return{success:!1,error:s instanceof Error?s.message:"Unknown error"}}}async function Tt(l=[],s={}){let f=yl(),y=[];if(Object.keys(f.skills).length===0)return I.warn("No skills tracked. Install skills with:"),console.log(),I.message(` ${Y.default.cyan("npx give-skill <repo>")}`),console.log(),[];let i=Object.entries(f.skills).map(([w,n])=>({skillName:w,state:n})),S;if(l.length>0){let w=new Set(l.map((n)=>n.toLowerCase()));S=i.filter(({skillName:n})=>w.has(n.toLowerCase()))}else{let n=i.map(({skillName:L,state:J})=>{let T=J.installations.map((X)=>({installation:X,resolvedPath:$s(X)})).filter(({resolvedPath:X})=>Xl(X));return{value:L,label:L,hint:T.length>0?`${T.length} installation${T.length!==1?"s":""}`:"no valid installations"}}).filter((L)=>L.hint!=="no valid installations");if(n.length===0)return I.warn("No valid installations found"),[];if(s.yes)S=i.filter(({skillName:L})=>n.some((J)=>J.value===L));else{let L=await o({message:"Select skills to remove",options:n,required:!0,initialValues:n.map((T)=>T.value)});if(K(L))return V("Remove cancelled"),[];let J=L;S=i.filter(({skillName:T})=>J.includes(T))}}if(S.length===0){if(l.length>0){I.error(`No matching skills found for: ${l.join(", ")}`),I.info("Tracked skills:");for(let w of i)I.message(` - ${Y.default.cyan(w.skillName)}`)}return[]}console.log(),I.step(Y.default.bold("Skills to Remove"));let t=[];for(let{skillName:w,state:n}of S){let L=n.installations;if(s.agent&&s.agent.length>0){let T=new Set(s.agent);L=L.filter((X)=>T.has(X.agent))}if(s.global!==void 0){let T=s.global?"global":"project";L=L.filter((X)=>X.type===T)}let J=L.map((T)=>({installation:T,resolvedPath:$s(T)})).filter(({resolvedPath:T})=>Xl(T));if(J.length>0){t.push({skillName:w,installations:J}),I.message(` ${Y.default.cyan(w)}`);for(let{resolvedPath:T}of J)I.message(` ${Y.default.dim("→")} ${T}`)}}if(t.length===0)return I.warn("No installations match the specified criteria"),[];let $=l.length===0,c;if(s.yes||$)c=t.map(({skillName:w})=>w);else{let w=t.map(({skillName:L,installations:J})=>({value:L,label:L,hint:`${J.length} installation${J.length!==1?"s":""}`})),n=await o({message:"Select skills to remove",options:w,required:!0,initialValues:t.map(({skillName:L})=>L)});if(K(n))return V("Remove cancelled"),[];c=n}console.log(),I.step(Y.default.bold("Will Remove"));for(let w of c){let n=t.find((L)=>L.skillName===w);if(n){I.message(` ${Y.default.cyan(n.skillName)}`);for(let{resolvedPath:L}of n.installations)I.message(` ${Y.default.dim("→")} ${L}`)}}if(console.log(),!s.yes){let w=await fl({message:"Remove these skills?"});if(K(w)||!w)return V("Remove cancelled"),[]}let k=D();k.start(`Removing ${c.length} skill${c.length>1?"s":""}...`);for(let{skillName:w,installations:n}of t){if(!c.includes(w))continue;let L={skillName:w,success:!0,removed:0,failed:0,installations:[]};for(let{installation:J,resolvedPath:T}of n){let X=await Hy(T);if(L.installations.push({agent:z[J.agent].displayName,path:T,removed:X.success,error:X.error}),X.success)L.removed++,Gl(w,J.agent,J.path);else L.failed++,L.success=!1}y.push(L)}k.stop("Remove complete"),console.log();let b=y.filter((w)=>w.success&&w.removed>0),U=y.filter((w)=>!w.success||w.failed>0);if(b.length>0){I.success(Y.default.green(`Removed ${b.length} skill${b.length!==1?"s":""}`));for(let w of b)I.message(` ${Y.default.green("✓")} ${Y.default.cyan(w.skillName)}`),I.message(` ${Y.default.dim(`${w.removed} installation${w.removed!==1?"s":""} removed`)}`)}if(U.length>0){console.log(),I.error(Y.default.red(`Failed to remove ${U.length} skill${U.length!==1?"s":""}`));for(let w of U){I.message(` ${Y.default.red("✗")} ${Y.default.cyan(w.skillName)}`);for(let n of w.installations.filter((L)=>!L.removed))if(n.error)I.message(` ${Y.default.dim(n.error)}`)}}return console.log(),j(Y.default.green("Done!")),y}async function Bt(){let l=yl();if(Object.keys(l.skills).length===0){I.warn("No skills tracked. Install skills with:"),console.log(),I.message(` ${Y.default.cyan("npx give-skill <repo>")}`),console.log();return}console.log(),I.step(Y.default.bold("Installed Skills"));for(let[s,f]of Object.entries(l.skills)){I.message(`${Y.default.cyan(s)}`);let y=f.installations.map((i)=>({installation:i,resolvedPath:$s(i)})).filter(({resolvedPath:i})=>Xl(i));if(y.length>0){I.message(` ${Y.default.dim("Installed in:")}`);for(let{installation:i,resolvedPath:S}of y){let t=i.type==="global"?"global":"project";I.message(` ${Y.default.dim("•")} ${z[i.agent].displayName} ${Y.default.dim(`(${t})`)}: ${Y.default.dim(S)}`)}}console.log()}}var _t={name:"give-skill",version:"1.1.0",description:"Universal skill installer for AI coding agents - Claude, Cursor, Copilot, and more",type:"module",bin:{"give-skill":"./dist/index.js"},files:["dist","README.md"],scripts:{build:"bun build src/index.ts --outdir dist --target node --minify",dev:"bun src/index.ts",prepublishOnly:"bun run build"},keywords:["cli","skills","claude","cursor","copilot","github-copilot","ai-agents","agent-skills","coding-assistant"],repository:{type:"git",url:"git+https://github.com/compilecafe/give-skill.git"},homepage:"https://github.com/compilecafe/give-skill#readme",bugs:{url:"https://github.com/compilecafe/give-skill/issues"},author:"Compile Café",license:"MIT",dependencies:{"@clack/prompts":"^0.11.0",commander:"^14.0.2",picocolors:"^1.1.1"},devDependencies:{"@types/bun":"latest"},module:"src/index.ts"};var Wy=_t.version;e.name("give-skill").description("Install skills onto coding agents (Claude Code, Cursor, Copilot, Gemini, Windsurf, Trae, Factory, Letta, OpenCode, Codex, Antigravity, Amp, Kilo, Roo, Goose)").version(Wy).argument("<source>","Git repo URL, GitHub shorthand (owner/repo), or direct path to skill").option("-g, --global","Install skill globally (user-level) instead of project-level").option("-a, --agent <agents...>","Specify agents to install to (windsurf, gemini, claude-code, cursor, copilot, etc.)").option("-s, --skill <skills...>","Specify skill names to install (skip selection prompt)").option("-l, --list","List available skills in the repository without installing").option("-y, --yes","Skip confirmation prompts").action(async(l,s)=>{await Ey(l,s)});e.command("update [skills...]").description("Update installed skills to their latest versions").option("-y, --yes","Skip confirmation prompts").action(async(l,s)=>{await xy(l,s)});e.command("status [skills...]").description("Check status of installed skills (updates available, orphaned, etc.)").action(async(l)=>{await Cy(l)});e.command("remove [skills...]").description("Remove installed skills").option("-g, --global","Remove from global location only").option("-a, --agent <agents...>","Remove from specific agents only").option("-y, --yes","Skip confirmation prompts").action(async(l,s)=>{await Ny(l,s)});e.command("list").description("List all installed skills").action(async()=>{await Vy()});e.command("clean").description("Remove orphaned skill entries from state").action(async()=>{await Ay()});e.parse();async function Ey(l,s){console.log(),ll(Z.default.bgCyan(Z.default.black(" give-skill ")));try{let f=await nt(l,s);if(!f.success&&f.installed===0&&f.failed===0)process.exit(1);if(f.failed>0)process.exit(1)}catch(f){I.error(f instanceof Error?f.message:"Unknown error occurred"),j(Z.default.red("Installation failed")),process.exit(1)}}async function xy(l,s){console.log(),ll(Z.default.bgCyan(Z.default.black(" give-skill ")));try{await Ut(l.length>0?l:void 0,s)}catch(f){I.error(f instanceof Error?f.message:"Unknown error occurred"),j(Z.default.red("Update failed")),process.exit(1)}}async function Cy(l){console.log(),ll(Z.default.bgCyan(Z.default.black(" give-skill ")));try{let s=await Ss(l.length>0?l:void 0);await Lt(s),j("Done!")}catch(s){I.error(s instanceof Error?s.message:"Unknown error occurred"),j(Z.default.red("Status check failed")),process.exit(1)}}async function Ny(l,s){console.log(),ll(Z.default.bgCyan(Z.default.black(" give-skill ")));try{await Tt(l,s)}catch(f){I.error(f instanceof Error?f.message:"Unknown error occurred"),j(Z.default.red("Remove failed")),process.exit(1)}}async function Vy(){console.log(),ll(Z.default.bgCyan(Z.default.black(" give-skill ")));try{await Bt(),j("Done!")}catch(l){I.error(l instanceof Error?l.message:"Unknown error occurred"),j(Z.default.red("List failed")),process.exit(1)}}async function Ay(){console.log(),ll(Z.default.bgCyan(Z.default.black(" give-skill ")));try{await Rt(),console.log(),j(Z.default.green("Done!"))}catch(l){I.error(l instanceof Error?l.message:"Unknown error occurred"),j(Z.default.red("Clean failed")),process.exit(1)}}
|
|
72
|
+
`)},info:(l)=>{y.message(l,{symbol:g.default.blue(yn)})},success:(l)=>{y.message(l,{symbol:g.default.green(gn)})},step:(l)=>{y.message(l,{symbol:g.default.green(rs)})},warn:(l)=>{y.message(l,{symbol:g.default.yellow($n)})},warning:(l)=>{y.warn(l)},error:(l)=>{y.message(l,{symbol:g.default.red(bn)})}},Ve=`${g.default.gray(U)} `;var sl=({indicator:l="dots"}={})=>{let s=ts?["◒","◐","◓","◑"]:["•","o","O","0"],t=ts?80:120,n=process.env.CI==="true",e,r,i=!1,f="",o,a=performance.now(),k=(m)=>{let Z=m>1?"Something went wrong":"Canceled";i&&Q(Z,m)},S=()=>k(2),c=()=>k(1),$=()=>{process.on("uncaughtExceptionMonitor",S),process.on("unhandledRejection",S),process.on("SIGINT",c),process.on("SIGTERM",c),process.on("exit",k)},I=()=>{process.removeListener("uncaughtExceptionMonitor",S),process.removeListener("unhandledRejection",S),process.removeListener("SIGINT",c),process.removeListener("SIGTERM",c),process.removeListener("exit",k)},h=()=>{if(o===void 0)return;n&&process.stdout.write(`
|
|
73
|
+
`);let m=o.split(`
|
|
74
|
+
`);process.stdout.write(hl.cursor.move(-999,m.length-1)),process.stdout.write(hl.erase.down(m.length))},B=(m)=>m.replace(/\.+$/,""),z=(m)=>{let Z=(performance.now()-m)/1000,x=Math.floor(Z/60),M=Math.floor(Z%60);return x>0?`[${x}m ${M}s]`:`[${M}s]`},W=(m="")=>{i=!0,e=lt(),f=B(m),a=performance.now(),process.stdout.write(`${g.default.gray(U)}
|
|
75
|
+
`);let Z=0,x=0;$(),r=setInterval(()=>{if(n&&f===o)return;h(),o=f;let M=g.default.magenta(s[Z]);if(n)process.stdout.write(`${M} ${f}...`);else if(l==="timer")process.stdout.write(`${M} ${f} ${z(a)}`);else{let Ml=".".repeat(Math.floor(x)).slice(0,3);process.stdout.write(`${M} ${f}${Ml}`)}Z=Z+1<s.length?Z+1:0,x=x<s.length?x+0.125:0},t)},Q=(m="",Z=0)=>{i=!1,clearInterval(r),h();let x=Z===0?g.default.green(rs):Z===1?g.default.red(it):g.default.red(nt);f=B(m??f),l==="timer"?process.stdout.write(`${x} ${f} ${z(a)}
|
|
76
|
+
`):process.stdout.write(`${x} ${f}
|
|
77
|
+
`),I(),e()};return{start:W,stop:Q,message:(m="")=>{f=B(m??f)}}};var j=v(il(),1);var R=v(il(),1);import{join as In}from"path";import{rmSync as wn}from"fs";import{tmpdir as Ln}from"os";import{spawn as as}from"child_process";function rt(l){let s=l.match(/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)(?:\/(.+))?$/);if(s){let[,i,f,o,a]=s;return{type:"github",url:`https://github.com/${i}/${f}.git`,branch:o,subpath:a}}let t=l.match(/github\.com\/([^/]+)\/([^/]+)/);if(t){let[,i,f]=t,o=f.replace(/\.git$/,"");return{type:"github",url:`https://github.com/${i}/${o}.git`}}let n=l.match(/gitlab\.com\/([^/]+)\/([^/]+)\/-\/tree\/([^/]+)(?:\/(.+))?$/);if(n){let[,i,f,o,a]=n;return{type:"gitlab",url:`https://gitlab.com/${i}/${f}.git`,branch:o,subpath:a}}let e=l.match(/gitlab\.com\/([^/]+)\/([^/]+)/);if(e){let[,i,f]=e,o=f.replace(/\.git$/,"");return{type:"gitlab",url:`https://gitlab.com/${i}/${o}.git`}}let r=l.match(/^([^/]+)\/([^/]+)(?:\/(.+))?$/);if(r&&!l.includes(":")){let[,i,f,o]=r;return{type:"github",url:`https://github.com/${i}/${f}.git`,subpath:o}}return{type:"git",url:l}}async function Ul(l,s){let t=In(Ln(),`give-skill-${Date.now()}`),n=["clone","--depth","1"];if(s)n.push("--branch",s);return n.push(l,t),await new Promise((e,r)=>{let i=as("git",n,{stdio:"pipe"});i.on("close",(f)=>{if(f===0)e();else r(Error(`Failed to clone repository: ${l}`))}),i.on("error",r)}),t}async function ft(l,s="main"){return await new Promise((n,e)=>{let r="",i=as("git",["ls-remote",l,`refs/heads/${s}`],{stdio:"pipe"});i.stdout?.on("data",(f)=>{r+=f.toString()}),i.on("close",(f)=>{if(f===0&&r.trim())n(r.trim().split(/\s+/)[0]??"");else e(Error(`Failed to get latest commit from ${l}`))}),i.on("error",e)})}async function Nl(l){return await new Promise((t,n)=>{let e="",r=as("git",["rev-parse","HEAD"],{cwd:l,stdio:"pipe"});r.stdout?.on("data",(i)=>{e+=i.toString()}),r.on("close",(i)=>{if(i===0&&e.trim())t(e.trim());else n(Error("Failed to get commit hash"))}),r.on("error",n)})}async function Bl(l){wn(l,{recursive:!0,force:!0})}import{readdir as ct,readFile as Tn,stat as Pn}from"fs/promises";import{join as d,basename as hn,dirname as Un}from"path";import{homedir as Rn}from"os";import{join as T}from"path";import{existsSync as X}from"fs";var P=Rn(),N={opencode:{name:"opencode",displayName:"OpenCode",skillsDir:".opencode/skill",globalSkillsDir:T(P,".config/opencode/skill"),detectInstalled:async()=>{return X(T(P,".config/opencode"))}},"claude-code":{name:"claude-code",displayName:"Claude Code",skillsDir:".claude/skills",globalSkillsDir:T(P,".claude/skills"),detectInstalled:async()=>{return X(T(P,".claude"))}},codex:{name:"codex",displayName:"Codex",skillsDir:".codex/skills",globalSkillsDir:T(P,".codex/skills"),detectInstalled:async()=>{return X(T(P,".codex"))}},cursor:{name:"cursor",displayName:"Cursor",skillsDir:".cursor/skills",globalSkillsDir:T(P,".cursor/skills"),detectInstalled:async()=>{return X(T(P,".cursor"))}},amp:{name:"amp",displayName:"Amp",skillsDir:".agents/skills",globalSkillsDir:T(P,".config/agents/skills"),detectInstalled:async()=>{return X(T(P,".config/amp"))}},kilo:{name:"kilo",displayName:"Kilo Code",skillsDir:".kilocode/skills",globalSkillsDir:T(P,".kilocode/skills"),detectInstalled:async()=>{return X(T(P,".kilocode"))}},roo:{name:"roo",displayName:"Roo Code",skillsDir:".roo/skills",globalSkillsDir:T(P,".roo/skills"),detectInstalled:async()=>{return X(T(P,".roo"))}},goose:{name:"goose",displayName:"Goose",skillsDir:".goose/skills",globalSkillsDir:T(P,".config/goose/skills"),detectInstalled:async()=>{return X(T(P,".config/goose"))}},antigravity:{name:"antigravity",displayName:"Antigravity",skillsDir:".agent/skills",globalSkillsDir:T(P,".gemini/antigravity/skills"),detectInstalled:async()=>{return X(T(P,".gemini/antigravity"))}},copilot:{name:"copilot",displayName:"GitHub Copilot",skillsDir:".github/skills",globalSkillsDir:T(P,".copilot/skills"),detectInstalled:async()=>{return X(T(P,".copilot"))}},gemini:{name:"gemini",displayName:"Gemini CLI",skillsDir:".gemini/skills",globalSkillsDir:T(P,".gemini/skills"),detectInstalled:async()=>{return X(T(P,".gemini"))}},windsurf:{name:"windsurf",displayName:"Windsurf",skillsDir:".windsurf/skills",globalSkillsDir:T(P,".codeium/windsurf/skills"),detectInstalled:async()=>{return X(T(P,".codeium/windsurf"))}},trae:{name:"trae",displayName:"Trae",skillsDir:".trae/skills",globalSkillsDir:T(P,".trae/skills"),detectInstalled:async()=>{return X(T(P,".trae"))}},factory:{name:"factory",displayName:"Factory Droid",skillsDir:".factory/skills",globalSkillsDir:T(P,".factory/skills"),detectInstalled:async()=>{return X(T(P,".factory"))}},letta:{name:"letta",displayName:"Letta",skillsDir:".skills",globalSkillsDir:T(P,".letta/skills"),detectInstalled:async()=>{return X(T(P,".letta"))}}};async function at(){let l=[];for(let[s,t]of Object.entries(N))if(await t.detectInstalled())l.push(s);return l}var Nn=["node_modules",".git","dist","build","__pycache__"],Bn=["skills","skills/.curated","skills/.experimental","skills/.system"];function _n(l){let s=[l];for(let n of Bn)s.push(d(l,n));let t=new Set;for(let n of Object.values(N))t.add(d(l,n.skillsDir));return s.push(...t),s}function qn(l){let s=l.match(/^---\n([\s\S]+?)\n---\n([\s\S]*)$/);if(!s)return{data:{},content:l};let t=s[1],n=s[2],e={};for(let r of t.split(`
|
|
78
|
+
`)){let i=r.indexOf(":");if(i===-1)continue;let f=r.slice(0,i).trim(),o=r.slice(i+1).trim();if(o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'"))e[f]=o.slice(1,-1);else if(f==="metadata")try{let a={},k=o.replace(/^\{|\}$/g,"").trim();if(k){for(let S of k.split(",")){let[c,$]=S.split("=").map((I)=>I.trim());if(c&&$)a[c]=$.replace(/^['"]|['"]$/g,"")}e[f]=JSON.stringify(a)}}catch{e[f]=o}else e[f]=o}return{data:e,content:n}}async function os(l){try{let s=d(l,"SKILL.md");return(await Pn(s)).isFile()}catch{return!1}}async function cs(l){try{let s=await Tn(l,"utf-8"),{data:t}=qn(s);if(!t.name||!t.description)return null;return{name:t.name,description:t.description,path:Un(l),metadata:t.metadata?JSON.parse(t.metadata):void 0}}catch{return null}}async function ot(l,s=0,t=5){let n=[];if(s>t)return n;try{if(await os(l))n.push(l);let e=await ct(l,{withFileTypes:!0});for(let r of e)if(r.isDirectory()&&!Nn.includes(r.name)){let i=await ot(d(l,r.name),s+1,t);n.push(...i)}}catch{}return n}async function _l(l,s){let t=[],n=new Set,e=s?d(l,s):l;if(await os(e)){let i=await cs(d(e,"SKILL.md"));if(i)return t.push(i),t}let r=_n(e);for(let i of r)try{let f=await ct(i,{withFileTypes:!0});for(let o of f)if(o.isDirectory()){let a=d(i,o.name);if(await os(a)){let k=await cs(d(a,"SKILL.md"));if(k&&!n.has(k.name))t.push(k),n.add(k.name)}}}catch{}if(t.length===0){let i=await ot(e);for(let f of i){let o=await cs(d(f,"SKILL.md"));if(o&&!n.has(o.name))t.push(o),n.add(o.name)}}return t}function p(l){return l.name||hn(l.path)}import{mkdir as kt,cp as jn,access as Jn,readdir as mn}from"fs/promises";import{join as A,basename as Yn}from"path";async function ql(l,s,t={}){let n=N[s],e=l.name||Yn(l.path),r=t.cwd||process.cwd(),i=t.global?n.globalSkillsDir:A(r,n.skillsDir),f=A(i,e);try{return await kt(f,{recursive:!0}),await St(l.path,f),{success:!0,path:f,originalPath:t.global?f:A(n.skillsDir,e)}}catch(o){return{success:!1,path:f,originalPath:t.global?f:A(n.skillsDir,e),error:o instanceof Error?o.message:"Unknown error"}}}var Gn=new Set(["README.md","metadata.json"]),Xn=(l)=>{if(Gn.has(l))return!0;if(l.startsWith("_"))return!0;return!1};async function St(l,s){await kt(s,{recursive:!0});let t=await mn(l,{withFileTypes:!0});for(let n of t){if(Xn(n.name))continue;let e=A(l,n.name),r=A(s,n.name);if(n.isDirectory())await St(e,r);else await jn(e,r)}}async function yt(l,s,t={}){let n=N[s],e=t.global?n.globalSkillsDir:A(t.cwd||process.cwd(),n.skillsDir),r=A(e,l);try{return await Jn(r),!0}catch{return!1}}function gt(l,s,t={}){let n=N[s],e=t.global?n.globalSkillsDir:A(t.cwd||process.cwd(),n.skillsDir);return A(e,l)}import{homedir as Zn}from"os";import{join as fl,resolve as xn}from"path";import{existsSync as al,readFileSync as bt,writeFileSync as ys,mkdirSync as Hn,rmSync as Cn,readdirSync as $t}from"fs";import{existsSync as zn,readdirSync as Mn}from"fs";import{resolve as Qn}from"path";var ks=v(il(),1);function V(l){if(!zn(l))return!1;try{let s=Mn(l);if(s.length===0)return!1;return s.includes("SKILL.md")}catch{return!1}}function tl(l){return l.type==="global"?l.path:Qn(process.cwd(),l.path)}function yl(){y.warn("No skills tracked. Install skills with:"),y.message(` ${ks.default.cyan("give-skill <repo>")} # Install in current directory`),y.message(` ${ks.default.cyan("give-skill <repo> --global")} # Install globally`)}var E=(l,s,t)=>{return l===1?s:t??`${s}s`};var It="1.0.0",En="skills.lock",Ss=fl(Zn(),".give-skill"),jl=fl(Ss,"state.json");function wt(){if(!al(Ss))Hn(Ss,{recursive:!0})}function gl(){if(wt(),!al(jl)){let l={lastUpdate:new Date().toISOString(),skills:{}};return ys(jl,JSON.stringify(l,null,2)),l}try{let l=bt(jl,"utf-8");return JSON.parse(l)}catch{return{lastUpdate:new Date().toISOString(),skills:{}}}}function Jl(l){wt(),l.lastUpdate=new Date().toISOString(),ys(jl,JSON.stringify(l,null,2))}function Lt(l,s,t,n,e,r){let i=gl(),f=l.toLowerCase(),o=!1,a;if(!i.skills[f])i.skills[f]={url:s,subpath:t,branch:n,commit:e,installations:[]};else{if(i.skills[f].branch!==n)a=i.skills[f].branch,i.skills[f].branch=n,i.skills[f].commit=e,o=!0;if(i.skills[f].url=s,t)i.skills[f].subpath=t}let k=i.skills[f].installations.findIndex((S)=>S.agent===r.agent&&S.path===r.path);if(k>=0)i.skills[f].installations[k]=r;else i.skills[f].installations.push(r);return Jl(i),{updated:o,previousBranch:a}}function ml(l,s,t){let n=gl(),e=l.toLowerCase();if(!n.skills[e])return;if(n.skills[e].installations=n.skills[e].installations.filter((r)=>!(r.agent===s&&r.path===t)),n.skills[e].installations.length===0)delete n.skills[e];Jl(n)}function Rt(l,s){let t=gl(),n=l.toLowerCase();if(t.skills[n])t.skills[n].commit=s,Jl(t)}function Yl(){return gl()}async function Tt(){let l=gl(),s=[];for(let[t,n]of Object.entries(l.skills)){let e=[];for(let r of n.installations)try{let i=r.type==="global"?r.path:fl(process.cwd(),r.path);if(V(i))e.push(r)}catch{}if(e.length===0)s.push(t);else if(e.length!==n.installations.length)n.installations=e}for(let t of s)delete l.skills[t];if(s.length>0)Jl(l)}function gs(l){let s=l||process.cwd();return xn(s,En)}function Gl(l){let s=gs(l);if(!al(s))return null;try{let t=bt(s,"utf-8"),n=JSON.parse(t);if(!n.version||!n.skills)return null;return n}catch{return null}}function $s(l,s){let t=gs(s);l.version=It,ys(t,JSON.stringify(l,null,2))}function Pt(l,s,t,n,e,r){let i=Gl(r);if(!i)i={version:It,skills:{}};let f=l.toLowerCase(),o=!1,a;if(!i.skills[f])i.skills[f]={url:s,subpath:t,branch:n,commit:e};else{if(i.skills[f].branch!==n)a=i.skills[f].branch,i.skills[f].branch=n,i.skills[f].commit=e,o=!0;if(i.skills[f].url=s,i.skills[f].commit=e,t)i.skills[f].subpath=t}return $s(i,r),{updated:o,previousBranch:a}}function ht(l,s){let t=Gl(s);if(!t)return;let n=l.toLowerCase();if(delete t.skills[n],Object.keys(t.skills).length>0)$s(t,s);else{let e=gs(s);if(al(e))try{Cn(e,{force:!0})}catch{}}}function Ut(l,s,t){let n=Gl(t);if(!n||!n.skills[l.toLowerCase()])return;let e=n.skills[l.toLowerCase()];if(e)e.commit=s,$s(n,t)}function Xl(l){return Gl(l)}function zl(l,s){let t=[],n=s||process.cwd();for(let[e,r]of Object.entries(N)){let i=fl(n,r.skillsDir);if(al(i))try{let a=$t(i,{withFileTypes:!0}).find((k)=>k.isDirectory()&&k.name.toLowerCase()===l.toLowerCase());if(a)t.push({agent:e,type:"project",path:fl(r.skillsDir,a.name)})}catch{}let f=r.globalSkillsDir;if(al(f))try{let a=$t(f,{withFileTypes:!0}).find((k)=>k.isDirectory()&&k.name.toLowerCase()===l.toLowerCase());if(a)t.push({agent:e,type:"global",path:fl(f,a.name)})}catch{}}return t}async function Nt(l,s){let t={tempDir:null,spinner:sl()};try{t.spinner.start("Parsing source...");let n=rt(l),e=n.branch??"main";t.spinner.stop(`Source: ${R.default.cyan(n.url)}${n.subpath?` (${n.subpath})`:""}${n.branch?` @ ${R.default.cyan(n.branch)}`:""}`),t.spinner.start("Cloning repository..."),t.tempDir=await Ul(n.url,n.branch),t.spinner.stop("Repository cloned");let r=await Nl(t.tempDir);t.spinner.start("Discovering skills...");let i=await _l(t.tempDir,n.subpath);if(i.length===0)return t.spinner.stop(R.default.red("No skills found")),J(R.default.red("No valid skills found. Skills require a SKILL.md with name and description.")),{success:!1,installed:0,failed:0,results:[]};if(t.spinner.stop(`Found ${R.default.green(i.length)} skill${i.length>1?"s":""}`),s.list){y.step(R.default.bold("Available Skills"));for(let c of i)y.message(` ${R.default.cyan(p(c))}`),y.message(` ${R.default.dim(c.description)}`);return J("Use --skill <name> to install specific skills"),{success:!0,installed:0,failed:0,results:[]}}let f=await Kn(i,s);if(!f)return{success:!1,installed:0,failed:0,results:[]};let o=await Wn(s,t);if(!o)return{success:!1,installed:0,failed:0,results:[]};let a=await An(s);if(a===null)return{success:!1,installed:0,failed:0,results:[]};if(!await Vn(s,f,o,a))return{success:!1,installed:0,failed:0,results:[]};t.spinner.start("Installing skills...");let S=await vn(f,o,a,n,r,e);return t.spinner.stop("Installation complete"),S}finally{if(t.tempDir)await Bl(t.tempDir)}}async function Kn(l,s){let t;if(s.skill&&s.skill.length>0){if(t=l.filter((n)=>s.skill.some((e)=>n.name.toLowerCase()===e.toLowerCase()||p(n).toLowerCase()===e.toLowerCase())),t.length===0){y.error(`No matching skills found for: ${s.skill.join(", ")}`),y.info("Available skills:");for(let n of l)y.message(` - ${p(n)}`);return null}y.info(`Selected ${t.length} skill${t.length!==1?"s":""}: ${t.map((n)=>R.default.cyan(p(n))).join(", ")}`)}else if(l.length===1){t=l;let n=l[0];y.info(`Skill: ${R.default.cyan(p(n))}`),y.message(R.default.dim(n.description))}else if(s.yes)t=l,y.info(`Installing all ${l.length} skills`);else{let n=l.map((r)=>({value:r,label:p(r),hint:r.description.length>60?r.description.slice(0,57)+"...":r.description})),e=await F({message:"Select skills to install",options:n,required:!0});if(G(e))return C("Installation cancelled"),null;t=e}return t}async function Wn(l,s){if(l.agent&&l.agent.length>0){let n=Object.keys(N),e=l.agent.filter((r)=>!n.includes(r));if(e.length>0)return y.error(`Invalid agents: ${e.join(", ")}`),y.info(`Valid agents: ${n.join(", ")}`),null;return l.agent}s.spinner.start("Detecting installed agents...");let t=await at();if(s.spinner.stop(`Detected ${t.length} agent${t.length!==1?"s":""}`),t.length===0)if(l.yes){let n=Object.keys(N);return y.info("Installing to all agents (none detected)"),n}else{y.warn("No coding agents detected. You can still install skills.");let n=Object.entries(N).map(([r,i])=>({value:r,label:i.displayName})),e=await F({message:"Select agents to install skills to",options:n,required:!0});if(G(e))return C("Installation cancelled"),null;return e}else if(t.length===1||l.yes){if(t.length===1){let n=t[0];y.info(`Installing to: ${R.default.cyan(N[n].displayName)}`)}else y.info(`Installing to: ${t.map((n)=>R.default.cyan(N[n].displayName)).join(", ")}`);return t}else{let n=t.map((r)=>({value:r,label:N[r].displayName,hint:N[r].skillsDir})),e=await F({message:"Select agents to install skills to",options:n,required:!0,initialValues:t});if(G(e))return C("Installation cancelled"),null;return e}}async function An(l){let s=l.global??!1;if(l.global===void 0&&!l.yes){let t=await et({message:"Installation scope",options:[{value:!1,label:"Project",hint:"Install in current directory (committed with your project)"},{value:!0,label:"Global",hint:"Install in home directory (available across all projects)"}]});if(G(t))return C("Installation cancelled"),null;s=t}return s}async function Vn(l,s,t,n){y.step(R.default.bold("Installation Summary"));for(let e of s){y.message(` ${R.default.cyan(p(e))}`);for(let r of t){let i=gt(e.name,r,{global:n}),o=await yt(e.name,r,{global:n})?R.default.yellow(" (will overwrite)"):"";y.message(` ${R.default.dim("→")} ${N[r].displayName}: ${R.default.dim(i)}${o}`)}}if(!l.yes){let e=await rl({message:"Proceed with installation?"});if(G(e)||!e)return C("Installation cancelled"),!1}return!0}async function vn(l,s,t,n,e,r){let i=l.flatMap((c)=>s.map(($)=>ql(c,$,{global:t}))),f=await Promise.all(i),o=f.map((c,$)=>{let I=Math.floor($/s.length),h=$%s.length,B=l[I],z=s[h];return{skill:p(B),agent:N[z].displayName,...c}}),a=new Map;for(let[c,$]of f.entries()){if(!$.success)continue;let I=Math.floor(c/s.length),h=c%s.length,B=l[I],z=s[h];if(t){let W=Lt(B.name,n.url,n.subpath,r,e,{agent:z,type:"global",path:$.originalPath});if(W.updated&&W.previousBranch){let Q=a.get(B.name);a.set(B.name,{previous:Q?.previous??W.previousBranch,current:Q?.current??r})}}}if(!t)for(let c of l)Pt(c.name,n.url,n.subpath,r,e);let k=o.filter((c)=>c.success),S=o.filter((c)=>!c.success);if(a.size>0)for(let[c,{previous:$,current:I}]of a)y.warn(R.default.yellow(` ${R.default.cyan(c)}: ${R.default.dim($)} → ${R.default.green(I)}`));if(k.length>0){y.success(R.default.green(`Successfully installed ${k.length} skill${k.length!==1?"s":""}`));for(let c of k)y.message(` ${R.default.green("✓")} ${c.skill} → ${c.agent}`),y.message(` ${R.default.dim(c.path)}`)}if(S.length>0){y.error(R.default.red(`Failed to install ${S.length} skill${S.length!==1?"s":""}`));for(let c of S)y.message(` ${R.default.red("✗")} ${c.skill} → ${c.agent}`),y.message(` ${R.default.dim(c.error)}`)}return J(R.default.green("Done!")),{success:S.length===0,installed:k.length,failed:S.length,results:o}}var b=v(il(),1);import{join as un}from"path";function _t(){let l=[],s=new Set,t=Xl();if(t)for(let[e,r]of Object.entries(t.skills)){let i=zl(e);l.push({skillName:e,state:{...r,installations:i},isLocal:!0}),s.add(e.toLowerCase())}let n=Yl();for(let[e,r]of Object.entries(n.skills)){let i=e.toLowerCase();if(!s.has(i))l.push({skillName:e,state:r,isLocal:!1})}return l}async function Bt(l,s){let t=s.installations.map((e)=>{let r=tl(e);return{agent:N[e.agent].displayName,path:r,exists:V(r)}});if(t.filter((e)=>e.exists).length===0)return{skillName:l,currentCommit:s.commit,latestCommit:s.commit,status:"orphaned",installations:t};try{let e=await ft(s.url,s.branch),r=e===s.commit;return{skillName:l,currentCommit:s.commit,latestCommit:e,status:r?"latest":"update-available",installations:t}}catch(e){return{skillName:l,currentCommit:s.commit,latestCommit:s.commit,status:"error",installations:t,error:e instanceof Error?e.message:"Unknown error"}}}async function bs(l){let s=_t(),t=[],n;if(l&&l.length>0){let r=new Set(l.map((i)=>i.toLowerCase()));n=s.filter(({skillName:i})=>r.has(i.toLowerCase()))}else n=s;if(n.length===0)return[];let e=sl();if(n.length===1){let{skillName:r,state:i}=n[0];e.start(`Checking ${b.default.cyan(r)}...`);let f=await Bt(r,i);e.stop(f.status==="latest"?b.default.green("Up to date"):b.default.yellow("Update available")),t.push(f)}else{e.start(`Checking ${n.length} ${E(n.length,"skill")}...`);for(let{skillName:r,state:i}of n){let f=await Bt(r,i);t.push(f)}e.stop("Check complete")}return t}async function qt(l,s={}){let t=_t(),n=[],e;if(l&&l.length>0){let c=new Set(l.map(($)=>$.toLowerCase()));e=t.filter(({skillName:$})=>c.has($.toLowerCase()))}else e=t;if(e.length===0)return y.warn("No skills found to update"),[];let r=await bs(l),i=r.filter((c)=>c.status==="update-available");if(i.length===0){let c=r.filter(($)=>$.status==="orphaned");if(c.length>0){y.warn(`${c.length} skill${c.length>1?"s":""} have no valid installations`);for(let $ of c)y.message(` ${b.default.yellow("○")} ${b.default.cyan($.skillName)} - all installations removed`)}return y.success(b.default.green("All skills are up to date")),[]}y.step(b.default.bold("Updates Available"));let f=i.map((c)=>({value:c.skillName,label:c.skillName,hint:`${c.currentCommit.slice(0,7)} → ${c.latestCommit.slice(0,7)}`})),o;if(s.yes)o=i.map((c)=>c.skillName);else{let c=await F({message:"Select skills to update",options:f,required:!0,initialValues:i.map(($)=>$.skillName)});if(G(c))return C("Update cancelled"),[];o=c}y.step(b.default.bold("Will Update"));for(let c of o){let $=i.find((I)=>I.skillName===c);if($)y.message(` ${b.default.cyan($.skillName)}`),y.message(` ${b.default.dim("Current:")} ${b.default.yellow($.currentCommit.slice(0,7))} ${b.default.dim("→")} ${b.default.green($.latestCommit.slice(0,7))}`)}if(!s.yes){let c=await rl({message:"Proceed with update?"});if(G(c)||!c)return C("Update cancelled"),[]}let a=sl();a.start(`Updating ${o.length} ${E(o.length,"skill")}...`);for(let{skillName:c,state:$,isLocal:I}of e){let h=r.find((Q)=>Q.skillName===c);if(!h||h.status!=="update-available"){if(h?.status==="latest")n.push({skillName:c,success:!0,updated:0,failed:0});else n.push({skillName:c,success:!1,updated:0,failed:0});continue}if(!o.includes(c))continue;let B=null,z=0,W=0;try{B=await Ul($.url);let Q=await Nl(B),m=$.subpath?un(B,$.subpath):B,x=(await _l(m)).find((M)=>M.name.toLowerCase()===c.toLowerCase());if(!x)throw Error("Skill not found in repository");for(let M of $.installations){let Ml=tl(M);if(!V(Ml)){if(!I)ml(c,M.agent,M.path);continue}if((await ql(x,M.agent,{global:M.type==="global"})).success)z++;else W++}if(I)Ut(c,Q);else Rt(c,Q);n.push({skillName:c,success:W===0,updated:z,failed:W})}catch(Q){n.push({skillName:c,success:!1,updated:z,failed:W+1,error:Q instanceof Error?Q.message:"Unknown error"})}finally{if(B)await Bl(B)}}a.stop("Update complete");let k=n.filter((c)=>c.success&&c.updated>0),S=n.filter((c)=>!c.success||c.failed>0);if(k.length>0){y.success(b.default.green(`Updated ${k.length} ${E(k.length,"skill")}`));for(let c of k)y.message(` ${b.default.green("✓")} ${b.default.cyan(c.skillName)} (${c.updated} ${E(c.updated,"installation")})`)}if(S.length>0){y.error(b.default.red(`Failed to update ${S.length} ${E(S.length,"skill")}`));for(let c of S)if(y.message(` ${b.default.red("✗")} ${b.default.cyan(c.skillName)}`),c.error)y.message(` ${b.default.dim(c.error)}`)}if(k.length>0)J(b.default.green("Done!"));else J(b.default.yellow("No skills were updated"));return n}async function jt(l,s=!1){if(l.length===0){yl();return}y.step(b.default.bold("Skills Status"));for(let t of l){let n={latest:b.default.green("✓"),"update-available":b.default.yellow("↓"),error:b.default.red("✗"),orphaned:b.default.dim("○")}[t.status],e={latest:b.default.green("latest"),"update-available":b.default.yellow("update available"),error:b.default.red("error"),orphaned:b.default.dim("orphaned")}[t.status],r=t.installations.filter((f)=>f.exists),i=t.installations.filter((f)=>!f.exists);if(!s){let f=r.length,o=f>0?` (${f} ${E(f,"installation")})`:"";y.message(`${n} ${b.default.cyan(t.skillName)}${b.default.dim(o)} - ${e}`)}else{if(y.message(`${n} ${b.default.cyan(t.skillName)}`),y.message(` Status: ${e}`),t.status==="update-available")y.message(` ${b.default.dim("Commit:")} ${b.default.yellow(t.currentCommit.slice(0,7))} ${b.default.dim("→")} ${b.default.green(t.latestCommit.slice(0,7))}`);else if(t.status==="latest")y.message(` ${b.default.dim("Commit:")} ${t.currentCommit.slice(0,7)}`);if(t.error)y.message(` ${b.default.red(t.error)}`);if(r.length>0){y.message(` ${b.default.dim("Installed in:")}`);for(let f of r)y.message(` ${b.default.dim("•")} ${f.agent}: ${b.default.dim(f.path)}`)}if(i.length>0){y.message(` ${b.default.yellow("Missing installations:")}`);for(let f of i)y.message(` ${b.default.dim("•")} ${f.agent}: ${b.default.dim(f.path)}`)}}}if(!s)y.info(`Use ${b.default.cyan("--verbose")} or ${b.default.cyan("-v")} for detailed information`)}async function Jt(){let l=sl();l.start("Checking for orphaned entries..."),await Tt(),l.stop(b.default.green("Cleaned up orphaned entries"))}var w=v(il(),1);import{existsSync as On,rmSync as Fn}from"fs";function mt(){let l=[],s=new Set,t=Xl();if(t)for(let[e,r]of Object.entries(t.skills)){let i=zl(e);l.push({skillName:e,state:{...r,installations:i},isLocal:!0}),s.add(e.toLowerCase())}let n=Yl();for(let[e,r]of Object.entries(n.skills)){let i=e.toLowerCase();if(!s.has(i))l.push({skillName:e,state:r,isLocal:!1})}return l}async function dn(l){try{if(On(l))Fn(l,{recursive:!0,force:!0});return{success:!0}}catch(s){return{success:!1,error:s instanceof Error?s.message:"Unknown error"}}}async function Yt(l=[],s={}){let t=mt(),n=[];if(t.length===0)return yl(),[];let e;if(l.length>0){let S=new Set(l.map((c)=>c.toLowerCase()));e=t.filter(({skillName:c})=>S.has(c.toLowerCase()))}else{let c=t.map(({skillName:$,state:I})=>{let h=I.installations.map((B)=>({installation:B,resolvedPath:tl(B)})).filter(({resolvedPath:B})=>V(B));return{value:$,label:$,hint:h.length>0?`${h.length} ${E(h.length,"installation")}`:"no valid installations"}}).filter(($)=>$.hint!=="no valid installations");if(c.length===0)return y.warn("No valid installations found"),[];if(s.yes)e=t.filter(({skillName:$})=>c.some((I)=>I.value===$));else{let $=await F({message:"Select skills to remove",options:c,required:!0,initialValues:c.map((h)=>h.value)});if(G($))return C("Remove cancelled"),[];let I=$;e=t.filter(({skillName:h})=>I.includes(h))}}if(e.length===0){if(l.length>0){y.error(`No matching skills found for: ${l.join(", ")}`),y.info("Tracked skills:");for(let S of t)y.message(` - ${w.default.cyan(S.skillName)}`)}return[]}y.step(w.default.bold("Skills to Remove"));let r=[];for(let{skillName:S,state:c,isLocal:$}of e){let I=c.installations.map((h)=>({installation:h,resolvedPath:tl(h)})).filter(({resolvedPath:h})=>V(h));if(I.length>0){r.push({skillName:S,isLocal:$,installations:I}),y.message(` ${w.default.cyan(S)}`);for(let{resolvedPath:h}of I)y.message(` ${w.default.dim("→")} ${h}`)}}if(r.length===0)return y.warn("No installations match the specified criteria"),[];let i=l.length===0,f;if(s.yes||i)f=r.map(({skillName:S})=>S);else{let S=r.map(({skillName:$,installations:I})=>({value:$,label:$,hint:`${I.length} ${E(I.length,"installation")}`})),c=await F({message:"Select skills to remove",options:S,required:!0,initialValues:r.map(({skillName:$})=>$)});if(G(c))return C("Remove cancelled"),[];f=c}y.step(w.default.bold("Will Remove"));for(let S of f){let c=r.find(($)=>$.skillName===S);if(c){y.message(` ${w.default.cyan(c.skillName)}`);for(let{resolvedPath:$}of c.installations)y.message(` ${w.default.dim("→")} ${$}`)}}if(!s.yes){let S=await rl({message:"Remove these skills?"});if(G(S)||!S)return C("Remove cancelled"),[]}let o=sl();o.start(`Removing ${f.length} skill${f.length>1?"s":""}...`);for(let{skillName:S,isLocal:c,installations:$}of r){if(!f.includes(S))continue;let I={skillName:S,success:!0,removed:0,failed:0,installations:[]};for(let{installation:h,resolvedPath:B}of $){let z=await dn(B);if(I.installations.push({agent:N[h.agent].displayName,path:B,removed:z.success,error:z.error}),z.success){if(I.removed++,!c)ml(S,h.agent,h.path)}else I.failed++,I.success=!1}if(c&&I.removed>0)ht(S);n.push(I)}o.stop("Remove complete");let a=n.filter((S)=>S.success&&S.removed>0),k=n.filter((S)=>!S.success||S.failed>0);if(a.length>0){y.success(w.default.green(`Removed ${a.length} ${E(a.length,"skill")}`));for(let S of a)y.message(` ${w.default.green("✓")} ${w.default.cyan(S.skillName)}`),y.message(` ${w.default.dim(`${S.removed} ${E(S.removed,"installation")} removed`)}`)}if(k.length>0){y.error(w.default.red(`Failed to remove ${k.length} ${E(k.length,"skill")}`));for(let S of k){y.message(` ${w.default.red("✗")} ${w.default.cyan(S.skillName)}`);for(let c of S.installations.filter(($)=>!$.removed))if(c.error)y.message(` ${w.default.dim(c.error)}`)}}return J(w.default.green("Done!")),n}async function Gt(){let l=mt();if(l.length===0){yl();return}y.step(w.default.bold("Installed Skills"));let s=[],t=[];for(let{skillName:n,state:e,isLocal:r}of l)if(r)s.push({skillName:n,state:e});else t.push({skillName:n,state:e});if(s.length>0){if(t.length>0)y.message(w.default.bold(w.default.cyan("Local skills (from ./skills.lock)")));for(let{skillName:n,state:e}of s){y.message(`${w.default.cyan(n)}`);let r=e.installations.map((i)=>({installation:i,resolvedPath:tl(i)})).filter(({resolvedPath:i})=>V(i));if(r.length>0){y.message(` ${w.default.dim("Installed in:")}`);for(let{installation:i,resolvedPath:f}of r){let o=i.type==="global"?"global":"project";y.message(` ${w.default.dim("•")} ${N[i.agent].displayName} ${w.default.dim(`(${o})`)}: ${w.default.dim(f)}`)}}}}if(t.length>0){if(s.length>0)y.message(""),y.message(w.default.bold(w.default.cyan("Global skills (from ~/.give-skill/state.json)")));for(let{skillName:n,state:e}of t){y.message(`${w.default.cyan(n)}`);let r=e.installations.map((i)=>({installation:i,resolvedPath:tl(i)})).filter(({resolvedPath:i})=>V(i));if(r.length>0){y.message(` ${w.default.dim("Installed in:")}`);for(let{installation:i,resolvedPath:f}of r){let o=i.type==="global"?"global":"project";y.message(` ${w.default.dim("•")} ${N[i.agent].displayName} ${w.default.dim(`(${o})`)}: ${w.default.dim(f)}`)}}}}}var Xt={name:"give-skill",version:"1.2.0",description:"Universal skill installer for AI coding agents - Claude, Cursor, Copilot, and more",type:"module",bin:{"give-skill":"./dist/index.js"},files:["dist","README.md"],scripts:{build:"bun build src/index.ts --outdir dist --target node --minify",dev:"bun src/index.ts",typecheck:"tsc --noEmit",prepublishOnly:"bun run build"},keywords:["cli","skills","claude","cursor","copilot","github-copilot","ai-agents","agent-skills","coding-assistant"],repository:{type:"git",url:"git+https://github.com/compilecafe/give-skill.git"},homepage:"https://github.com/compilecafe/give-skill#readme",bugs:{url:"https://github.com/compilecafe/give-skill/issues"},author:"Compile Café",license:"MIT",dependencies:{"@clack/prompts":"^0.11.0",commander:"^14.0.2",picocolors:"^1.1.1"},devDependencies:{"@types/bun":"latest",typescript:"^5.9.3"},module:"src/index.ts"};var Dn=Xt.version;D.name("give-skill").description("Install skills onto coding agents (Claude Code, Cursor, Copilot, Gemini, Windsurf, Trae, Factory, Letta, OpenCode, Codex, Antigravity, Amp, Kilo, Roo, Goose)").version(Dn).argument("<source>","Git repo URL, GitHub shorthand (owner/repo), or direct path to skill").option("-g, --global","Install skill globally (user-level) instead of project-level").option("-a, --agent <agents...>","Specify agents to install to (windsurf, gemini, claude-code, cursor, copilot, etc.)").option("-s, --skill <skills...>","Specify skill names to install (skip selection prompt)").option("-l, --list","List available skills in the repository without installing").option("-y, --yes","Skip confirmation prompts").action(async(l,s)=>{await le(l,s)});D.command("update [skills...]").description("Update installed skills to their latest versions").option("-y, --yes","Skip confirmation prompts").action(async(l,s)=>{await se(l,s)});D.command("status [skills...]").description("Check status of installed skills (updates available, orphaned, etc.)").option("-v, --verbose","Show detailed information including installation paths").action(async(l,s)=>{await te(l,s)});D.command("remove [skills...]").description("Remove installed skills").option("-y, --yes","Skip confirmation prompts").action(async(l,s)=>{await ie(l,s)});D.command("list").description("List all installed skills").action(async()=>{await ne()});D.command("clean").description("Remove orphaned skill entries from state").action(async()=>{await ee()});D.parse();async function le(l,s){nl(j.default.bgCyan(j.default.black(" give-skill ")));try{let t=await Nt(l,s);if(!t.success&&t.installed===0&&t.failed===0)process.exit(1);if(t.failed>0)process.exit(1)}catch(t){y.error(t instanceof Error?t.message:"Unknown error occurred"),J(j.default.red("Installation failed")),process.exit(1)}}async function se(l,s){nl(j.default.bgCyan(j.default.black(" give-skill ")));try{await qt(l.length>0?l:void 0,s)}catch(t){y.error(t instanceof Error?t.message:"Unknown error occurred"),J(j.default.red("Update failed")),process.exit(1)}}async function te(l,s={}){nl(j.default.bgCyan(j.default.black(" give-skill ")));try{let t=await bs(l.length>0?l:void 0),n=s.verbose||l.length>0;await jt(t,n),J("Done!")}catch(t){y.error(t instanceof Error?t.message:"Unknown error occurred"),J(j.default.red("Status check failed")),process.exit(1)}}async function ie(l,s){nl(j.default.bgCyan(j.default.black(" give-skill ")));try{await Yt(l,s)}catch(t){y.error(t instanceof Error?t.message:"Unknown error occurred"),J(j.default.red("Remove failed")),process.exit(1)}}async function ne(){nl(j.default.bgCyan(j.default.black(" give-skill ")));try{await Gt(),J("Done!")}catch(l){y.error(l instanceof Error?l.message:"Unknown error occurred"),J(j.default.red("List failed")),process.exit(1)}}async function ee(){nl(j.default.bgCyan(j.default.black(" give-skill ")));try{await Jt(),J(j.default.green("Done!"))}catch(l){y.error(l instanceof Error?l.message:"Unknown error occurred"),J(j.default.red("Clean failed")),process.exit(1)}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "give-skill",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Universal skill installer for AI coding agents - Claude, Cursor, Copilot, and more",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "bun build src/index.ts --outdir dist --target node --minify",
|
|
15
15
|
"dev": "bun src/index.ts",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
16
17
|
"prepublishOnly": "bun run build"
|
|
17
18
|
},
|
|
18
19
|
"keywords": [
|
|
@@ -42,7 +43,8 @@
|
|
|
42
43
|
"picocolors": "^1.1.1"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@types/bun": "latest"
|
|
46
|
+
"@types/bun": "latest",
|
|
47
|
+
"typescript": "^5.9.3"
|
|
46
48
|
},
|
|
47
49
|
"module": "src/index.ts"
|
|
48
50
|
}
|