give-skill 1.1.1 → 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 +7 -25
- package/dist/index.js +66 -66
- 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
|
|
@@ -288,43 +288,25 @@ If a folder matches an agent's skill directory, the CLI will find it.
|
|
|
288
288
|
|
|
289
289
|
## State Management
|
|
290
290
|
|
|
291
|
-
`give-skill`
|
|
291
|
+
`give-skill` tracks installed skills for version control and updates:
|
|
292
292
|
|
|
293
|
-
- **
|
|
294
|
-
- **
|
|
295
|
-
- **Batch operations**: Update all skills without re-specifying sources
|
|
296
|
-
- **Branch tracking**: Remember which branch was used for installation
|
|
297
|
-
|
|
298
|
-
**Important**: State tracking only works for skills installed via `give-skill`. Manually installed skills are not tracked.
|
|
299
|
-
|
|
300
|
-
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
|
|
301
295
|
|
|
302
296
|
```json
|
|
303
297
|
{
|
|
304
|
-
"
|
|
298
|
+
"version": "1.0.0",
|
|
305
299
|
"skills": {
|
|
306
300
|
"pr-reviewer": {
|
|
307
|
-
"source": "https://github.com/expo/skills.git",
|
|
308
301
|
"url": "https://github.com/expo/skills.git",
|
|
309
302
|
"branch": "main",
|
|
310
|
-
"commit": "abc123..."
|
|
311
|
-
"subpath": "skills/.curated",
|
|
312
|
-
"installedAt": "2025-01-15T10:00:00Z",
|
|
313
|
-
"installations": [
|
|
314
|
-
{
|
|
315
|
-
"agent": "claude-code",
|
|
316
|
-
"type": "global",
|
|
317
|
-
"path": "~/.claude/skills/pr-reviewer"
|
|
318
|
-
}
|
|
319
|
-
]
|
|
303
|
+
"commit": "abc123..."
|
|
320
304
|
}
|
|
321
305
|
}
|
|
322
306
|
}
|
|
323
307
|
```
|
|
324
308
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
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.
|
|
328
310
|
|
|
329
311
|
## Troubleshooting
|
|
330
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(n.test(
|
|
10
|
-
- too many short flags`);if(
|
|
11
|
-
- too many long flags`);throw Error(`${
|
|
12
|
-
- unrecognised flag format`)}if(s===void 0&&
|
|
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
13
|
(Did you mean one of ${n.join(", ")}?)`;if(n.length===1)return`
|
|
14
|
-
(Did you mean ${n[0]}?)`;return""}
|
|
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=(n)=>{return[n.name()].concat(n.aliases())},
|
|
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 '${
|
|
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
|
-
- ${n}`;throw Error(
|
|
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((n)=>s.is(n)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function Ts(l){return l.map((s)=>{if(!s.startsWith("--inspect"))return s;let i,n="127.0.0.1",f="9229",c;if((c=s.match(/^(--inspect(-brk)?)$/))!==null)i=c[1];else if((c=s.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(i=c[1],/^\d+$/.test(c[3]))f=c[3];else n=c[3];else if((c=s.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)i=c[1],n=c[3],f=c[4];if(i&&f!=="0")return`${i}=${n}:${parseInt(f)+1}`;return s})}function Hl(){if(R.env.NO_COLOR||R.env.FORCE_COLOR==="0"||R.env.FORCE_COLOR==="false")return!1;if(R.env.FORCE_COLOR||R.env.CLICOLOR_FORCE!==void 0)return!0;return}li.Command=hl;li.useColor=Hl});var Ns=v((fi)=>{var{Argument:Ls}=ol(),{Command:Kl}=Ps(),{CommanderError:ii,InvalidArgumentError:Us}=al(),{Help:ni}=zl(),{Option:Bs}=Ml();fi.program=new Kl;fi.createCommand=(l)=>new Kl(l);fi.createOption=(l,s)=>new Bs(l,s);fi.createArgument=(l,s)=>new Ls(l,s);fi.Command=Kl;fi.Option=Bs;fi.Argument=Ls;fi.Help=ni;fi.CommanderError=ii;fi.InvalidArgumentError=Us;fi.InvalidOptionArgumentError=Us});var Wl=v(($f,_s)=>{var xl={to(l,s){if(!s)return`\x1B[${l+1}G`;return`\x1B[${s+1};${l+1}H`},move(l,s){let i="";if(l<0)i+=`\x1B[${-l}D`;else if(l>0)i+=`\x1B[${l}C`;if(s<0)i+=`\x1B[${-s}A`;else if(s>0)i+=`\x1B[${s}B`;return i},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"},Ii={up:(l=1)=>"\x1B[S".repeat(l),down:(l=1)=>"\x1B[T".repeat(l)},wi={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 i=0;i<l;i++)s+=this.line+(i<l-1?xl.up():"");if(l)s+=xl.left;return s}};_s.exports={cursor:xl,scroll:Ii,erase:wi,beep:"\x07"}});var tl=v((of,El)=>{var Il=process||{},Js=Il.argv||[],gl=Il.env||{},Ri=!(!!gl.NO_COLOR||Js.includes("--no-color"))&&(!!gl.FORCE_COLOR||Js.includes("--color")||Il.platform==="win32"||(Il.stdout||{}).isTTY&&gl.TERM!=="dumb"||!!gl.CI),Ti=(l,s,i=l)=>(n)=>{let f=""+n,c=f.indexOf(s,l.length);return~c?l+Pi(f,s,i,c)+s:l+f+s},Pi=(l,s,i,n)=>{let f="",c=0;do f+=l.substring(c,n)+i,c=n+s.length,n=l.indexOf(s,c);while(~n);return f+l.substring(c)},js=(l=Ri)=>{let s=l?Ti:()=>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")}};El.exports=js();El.exports.createColors=js});var qs=A(Ns(),1),{program:D,createCommand:sf,createArgument:tf,createOption:nf,CommanderError:ff,InvalidArgumentError:cf,InvalidOptionArgumentError:rf,Command:ef,Argument:af,Option:kf,Help:yf}=qs.default;var z=A(Wl(),1);import{stdin as Ks,stdout as xs}from"node:process";import*as ll from"node:readline";import Ys from"node:readline";import{Writable as Li}from"node:stream";function Ui({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 Bi=Ui();function Ws(l){if(typeof l!="string")throw TypeError(`Expected a \`string\`, got \`${typeof l}\``);return l.replace(Bi,"")}function Es(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Cs={exports:{}};(function(l){var s={};l.exports=s,s.eastAsianWidth=function(n){var f=n.charCodeAt(0),c=n.length==2?n.charCodeAt(1):0,t=f;return 55296<=f&&f<=56319&&56320<=c&&c<=57343&&(f&=1023,c&=1023,t=f<<10|c,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(n){var f=this.eastAsianWidth(n);return f=="F"||f=="W"||f=="A"?2:1};function i(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}s.length=function(n){for(var f=i(n),c=0,t=0;t<f.length;t++)c=c+this.characterLength(f[t]);return c},s.slice=function(n,f,c){textLen=s.length(n),f=f||0,c=c||1,f<0&&(f=textLen+f),c<0&&(c=textLen+c);for(var t="",r=0,a=i(n),e=0;e<a.length;e++){var k=a[e],b=s.length(k);if(r>=f-(b==2?1:0))if(r+b<=c)t+=k;else break;r+=b}return t}})(Cs);var Ni=Cs.exports,qi=Es(Ni),_i=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},Ji=Es(_i);function kl(l,s={}){if(typeof l!="string"||l.length===0||(s={ambiguousIsNarrow:!0,...s},l=Ws(l),l.length===0))return 0;l=l.replace(Ji()," ");let i=s.ambiguousIsNarrow?1:2,n=0;for(let f of l){let c=f.codePointAt(0);if(c<=31||c>=127&&c<=159||c>=768&&c<=879)continue;switch(qi.eastAsianWidth(f)){case"F":case"W":n+=2;break;case"A":n+=i;break;default:n+=1}}return n}var Cl=10,Gs=(l=0)=>(s)=>`\x1B[${s+l}m`,Xs=(l=0)=>(s)=>`\x1B[${38+l};5;${s}m`,zs=(l=0)=>(s,i,n)=>`\x1B[${38+l};2;${s};${i};${n}m`,N={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(N.modifier);var ji=Object.keys(N.color),Yi=Object.keys(N.bgColor);[...ji,...Yi];function Gi(){let l=new Map;for(let[s,i]of Object.entries(N)){for(let[n,f]of Object.entries(i))N[n]={open:`\x1B[${f[0]}m`,close:`\x1B[${f[1]}m`},i[n]=N[n],l.set(f[0],f[1]);Object.defineProperty(N,s,{value:i,enumerable:!1})}return Object.defineProperty(N,"codes",{value:l,enumerable:!1}),N.color.close="\x1B[39m",N.bgColor.close="\x1B[49m",N.color.ansi=Gs(),N.color.ansi256=Xs(),N.color.ansi16m=zs(),N.bgColor.ansi=Gs(Cl),N.bgColor.ansi256=Xs(Cl),N.bgColor.ansi16m=zs(Cl),Object.defineProperties(N,{rgbToAnsi256:{value:(s,i,n)=>s===i&&i===n?s<8?16:s>248?231:Math.round((s-8)/247*24)+232:16+36*Math.round(s/255*5)+6*Math.round(i/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:(s)=>{let i=/[a-f\d]{6}|[a-f\d]{3}/i.exec(s.toString(16));if(!i)return[0,0,0];let[n]=i;n.length===3&&(n=[...n].map((c)=>c+c).join(""));let f=Number.parseInt(n,16);return[f>>16&255,f>>8&255,f&255]},enumerable:!1},hexToAnsi256:{value:(s)=>N.rgbToAnsi256(...N.hexToRgb(s)),enumerable:!1},ansi256ToAnsi:{value:(s)=>{if(s<8)return 30+s;if(s<16)return 90+(s-8);let i,n,f;if(s>=232)i=((s-232)*10+8)/255,n=i,f=i;else{s-=16;let r=s%36;i=Math.floor(s/36)/5,n=Math.floor(r/6)/5,f=r%6/5}let c=Math.max(i,n,f)*2;if(c===0)return 30;let t=30+(Math.round(f)<<2|Math.round(n)<<1|Math.round(i));return c===2&&(t+=60),t},enumerable:!1},rgbToAnsi:{value:(s,i,n)=>N.ansi256ToAnsi(N.rgbToAnsi256(s,i,n)),enumerable:!1},hexToAnsi:{value:(s)=>N.ansi256ToAnsi(N.hexToAnsi256(s)),enumerable:!1}}),N}var Xi=Gi(),Tl=new Set(["\x1B",""]),zi=39,Al="\x07",Vs="[",Mi="]",ms="m",vl=`${Mi}8;;`,Ms=(l)=>`${Tl.values().next().value}${Vs}${l}${ms}`,Qs=(l)=>`${Tl.values().next().value}${vl}${l}${Al}`,Qi=(l)=>l.split(" ").map((s)=>kl(s)),Vl=(l,s,i)=>{let n=[...s],f=!1,c=!1,t=kl(Ws(l[l.length-1]));for(let[r,a]of n.entries()){let e=kl(a);if(t+e<=i?l[l.length-1]+=a:(l.push(a),t=0),Tl.has(a)&&(f=!0,c=n.slice(r+1).join("").startsWith(vl)),f){c?a===Al&&(f=!1,c=!1):a===ms&&(f=!1);continue}t+=e,t===i&&r<n.length-1&&(l.push(""),t=0)}!t&&l[l.length-1].length>0&&l.length>1&&(l[l.length-2]+=l.pop())},Zi=(l)=>{let s=l.split(" "),i=s.length;for(;i>0&&!(kl(s[i-1])>0);)i--;return i===s.length?l:s.slice(0,i).join(" ")+s.slice(i).join("")},Hi=(l,s,i={})=>{if(i.trim!==!1&&l.trim()==="")return"";let n="",f,c,t=Qi(l),r=[""];for(let[e,k]of l.split(" ").entries()){i.trim!==!1&&(r[r.length-1]=r[r.length-1].trimStart());let b=kl(r[r.length-1]);if(e!==0&&(b>=s&&(i.wordWrap===!1||i.trim===!1)&&(r.push(""),b=0),(b>0||i.trim===!1)&&(r[r.length-1]+=" ",b++)),i.hard&&t[e]>s){let $=s-b,y=1+Math.floor((t[e]-$-1)/s);Math.floor((t[e]-1)/s)<y&&r.push(""),Vl(r,k,s);continue}if(b+t[e]>s&&b>0&&t[e]>0){if(i.wordWrap===!1&&b<s){Vl(r,k,s);continue}r.push("")}if(b+t[e]>s&&i.wordWrap===!1){Vl(r,k,s);continue}r[r.length-1]+=k}i.trim!==!1&&(r=r.map((e)=>Zi(e)));let a=[...r.join(`
|
|
28
|
-
`)];for(let[
|
|
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((n)=>
|
|
33
|
-
`)}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
34
|
`),n=s.split(`
|
|
35
|
-
`),
|
|
36
|
-
`),
|
|
37
|
-
`).length-1;this.output.write(
|
|
38
|
-
`);this.output.write(n[
|
|
39
|
-
`).slice(
|
|
40
|
-
`)),this._prevFrame=l;return}this.output.write(
|
|
41
|
-
${
|
|
42
|
-
`,
|
|
43
|
-
${
|
|
44
|
-
${
|
|
45
|
-
`}}}).prompt()},
|
|
46
|
-
${
|
|
47
|
-
`;switch(this.state){case"submit":return`${
|
|
48
|
-
${
|
|
49
|
-
${
|
|
50
|
-
${
|
|
51
|
-
`}}}).prompt()};var F=(l)=>{let s=(
|
|
52
|
-
${
|
|
53
|
-
${
|
|
54
|
-
`,n=(
|
|
55
|
-
${
|
|
56
|
-
`).map((
|
|
57
|
-
`);return`${
|
|
58
|
-
${
|
|
59
|
-
${
|
|
60
|
-
`}default:return`${
|
|
61
|
-
${
|
|
62
|
-
${
|
|
63
|
-
`}}}).prompt()};var
|
|
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
|
-
${
|
|
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=c.indexOf(":");if(t===-1)continue;let r=c.slice(0,t).trim(),a=c.slice(t+1).trim();if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))f[r]=a.slice(1,-1);else if(r==="metadata")try{let e={},k=a.replace(/^\{|\}$/g,"").trim();if(k){for(let b of k.split(",")){let[$,y]=b.split("=").map((g)=>g.trim());if($&&y)e[$]=y.replace(/^['"]|['"]$/g,"")}f[r]=JSON.stringify(e)}}catch{f[r]=a}else f[r]=a}return{data:f,content:n}}async function fs(l){try{let s=u(l,"SKILL.md");return(await an(s)).isFile()}catch{return!1}}async function ns(l){try{let s=await en(l,"utf-8"),{data:i}=bn(s);if(!i.name||!i.description)return null;return{name:i.name,description:i.description,path:yn(l),metadata:i.metadata?JSON.parse(i.metadata):void 0}}catch{return null}}async function tt(l,s=0,i=5){let n=[];if(s>i)return n;try{if(await fs(l))n.push(l);let f=await st(l,{withFileTypes:!0});for(let c of f)if(c.isDirectory()&&!Sn.includes(c.name)){let t=await tt(u(l,c.name),s+1,i);n.push(...t)}}catch{}return n}async function ql(l,s){let i=[],n=new Set,f=s?u(l,s):l;if(await fs(f)){let t=await ns(u(f,"SKILL.md"));if(t)return i.push(t),i}let c=on(f);for(let t of c)try{let r=await st(t,{withFileTypes:!0});for(let a of r)if(a.isDirectory()){let e=u(t,a.name);if(await fs(e)){let k=await ns(u(e,"SKILL.md"));if(k&&!n.has(k.name))i.push(k),n.add(k.name)}}}catch{}if(i.length===0){let t=await tt(f);for(let r of t){let a=await ns(u(r,"SKILL.md"));if(a&&!n.has(a.name))i.push(a),n.add(a.name)}}return i}function d(l){return l.name||kn(l.path)}import{mkdir as it,cp as gn,access as In,readdir as wn}from"fs/promises";import{join as m,basename as Rn}from"path";async function _l(l,s,i={}){let n=_[s],f=l.name||Rn(l.path),c=i.cwd||process.cwd(),t=i.global?n.globalSkillsDir:m(c,n.skillsDir),r=m(t,f);try{return await it(r,{recursive:!0}),await nt(l.path,r),{success:!0,path:r,originalPath:i.global?r:m(n.skillsDir,f)}}catch(a){return{success:!1,path:r,originalPath:i.global?r:m(n.skillsDir,f),error:a instanceof Error?a.message:"Unknown error"}}}var Tn=new Set(["README.md","metadata.json"]),Pn=(l)=>{if(Tn.has(l))return!0;if(l.startsWith("_"))return!0;return!1};async function nt(l,s){await it(s,{recursive:!0});let i=await wn(l,{withFileTypes:!0});for(let n of i){if(Pn(n.name))continue;let f=m(l,n.name),c=m(s,n.name);if(n.isDirectory())await nt(f,c);else await gn(f,c)}}async function ft(l,s,i={}){let n=_[s],f=i.global?n.globalSkillsDir:m(i.cwd||process.cwd(),n.skillsDir),c=m(f,l);try{return await In(c),!0}catch{return!1}}function ct(l,s,i={}){let n=_[s],f=i.global?n.globalSkillsDir:m(i.cwd||process.cwd(),n.skillsDir);return m(f,l)}import{homedir as Nn}from"os";import{join as rs}from"path";import{existsSync as et,readFileSync as qn,writeFileSync as at,mkdirSync as _n}from"fs";import{existsSync as Ln,readdirSync as Un}from"fs";import{resolve as Bn}from"path";var rt=A(tl(),1);function p(l){if(!Ln(l))return!1;try{let s=Un(l);if(s.length===0)return!1;return s.includes("SKILL.md")}catch{return!1}}function nl(l){return l.type==="global"?l.path:Bn(process.cwd(),l.path)}function Sl(){S.warn("No skills tracked. Install skills with:"),S.message(` ${rt.default.cyan("npx give-skill <repo>")}`)}var W=(l,s,i)=>{return l===1?s:i??`${s}s`};var cs=rs(Nn(),".give-skill"),Jl=rs(cs,"state.json");function kt(){if(!et(cs))_n(cs,{recursive:!0})}function $l(){if(kt(),!et(Jl)){let l={lastUpdate:new Date().toISOString(),skills:{}};return at(Jl,JSON.stringify(l,null,2)),l}try{let l=qn(Jl,"utf-8");return JSON.parse(l)}catch{return{lastUpdate:new Date().toISOString(),skills:{}}}}function jl(l){kt(),l.lastUpdate=new Date().toISOString(),at(Jl,JSON.stringify(l,null,2))}function yt(l,s,i,n,f,c){let t=$l(),r=l.toLowerCase(),a=!1,e;if(!t.skills[r])t.skills[r]={source:s,url:s,subpath:i,branch:n,commit:f,installedAt:new Date().toISOString(),installations:[]};else{if(t.skills[r].branch!==n)e=t.skills[r].branch,t.skills[r].branch=n,t.skills[r].commit=f,a=!0;if(t.skills[r].url=s,t.skills[r].source=s,i)t.skills[r].subpath=i}let k=t.skills[r].installations.findIndex((b)=>b.agent===c.agent&&b.path===c.path);if(k>=0)t.skills[r].installations[k]=c;else t.skills[r].installations.push(c);return jl(t),{updated:a,previousBranch:e}}function Yl(l,s,i){let n=$l(),f=l.toLowerCase();if(!n.skills[f])return;if(n.skills[f].installations=n.skills[f].installations.filter((c)=>!(c.agent===s&&c.path===i)),n.skills[f].installations.length===0)delete n.skills[f];jl(n)}function St(l,s){let i=$l(),n=l.toLowerCase();if(i.skills[n])i.skills[n].commit=s,jl(i)}function rl(){return $l()}async function $t(){let l=$l(),s=[];for(let[i,n]of Object.entries(l.skills)){let f=[];for(let c of n.installations)try{let t=c.type==="global"?c.path:rs(process.cwd(),c.path);if(p(t))f.push(c)}catch{}if(f.length===0)s.push(i);else if(f.length!==n.installations.length)n.installations=f}for(let i of s)delete l.skills[i];if(s.length>0)jl(l)}async function ot(l,s){let i={tempDir:null,spinner:sl()};try{i.spinner.start("Parsing source...");let n=ps(l),f=n.branch??"main";i.spinner.stop(`Source: ${T.default.cyan(n.url)}${n.subpath?` (${n.subpath})`:""}${n.branch?` @ ${T.default.cyan(n.branch)}`:""}`),i.spinner.start("Cloning repository..."),i.tempDir=await Ul(n.url,n.branch),i.spinner.stop("Repository cloned");let c=await Bl(i.tempDir);i.spinner.start("Discovering skills...");let t=await ql(i.tempDir,n.subpath);if(t.length===0)return i.spinner.stop(T.default.red("No skills found")),G(T.default.red("No valid skills found. Skills require a SKILL.md with name and description.")),{success:!1,installed:0,failed:0,results:[]};if(i.spinner.stop(`Found ${T.default.green(t.length)} skill${t.length>1?"s":""}`),s.list){S.step(T.default.bold("Available Skills"));for(let $ of t)S.message(` ${T.default.cyan(d($))}`),S.message(` ${T.default.dim($.description)}`);return G("Use --skill <name> to install specific skills"),{success:!0,installed:0,failed:0,results:[]}}let r=await Jn(t,s);if(!r)return{success:!1,installed:0,failed:0,results:[]};let a=await jn(s,i);if(!a)return{success:!1,installed:0,failed:0,results:[]};let e=await Yn(s);if(e===null)return{success:!1,installed:0,failed:0,results:[]};if(!await Gn(s,r,a,e))return{success:!1,installed:0,failed:0,results:[]};i.spinner.start("Installing skills...");let b=await Xn(r,a,e,n,c,f);return i.spinner.stop("Installation complete"),b}finally{if(i.tempDir)await Nl(i.tempDir)}}async function Jn(l,s){let i;if(s.skill&&s.skill.length>0){if(i=l.filter((n)=>s.skill.some((f)=>n.name.toLowerCase()===f.toLowerCase()||d(n).toLowerCase()===f.toLowerCase())),i.length===0){S.error(`No matching skills found for: ${s.skill.join(", ")}`),S.info("Available skills:");for(let n of l)S.message(` - ${d(n)}`);return null}S.info(`Selected ${i.length} skill${i.length!==1?"s":""}: ${i.map((n)=>T.default.cyan(d(n))).join(", ")}`)}else if(l.length===1){i=l;let n=l[0];S.info(`Skill: ${T.default.cyan(d(n))}`),S.message(T.default.dim(n.description))}else if(s.yes)i=l,S.info(`Installing all ${l.length} skills`);else{let n=l.map((c)=>({value:c,label:d(c),hint:c.description.length>60?c.description.slice(0,57)+"...":c.description})),f=await F({message:"Select skills to install",options:n,required:!0});if(M(f))return x("Installation cancelled"),null;i=f}return i}async function jn(l,s){if(l.agent&&l.agent.length>0){let n=Object.keys(_),f=l.agent.filter((c)=>!n.includes(c));if(f.length>0)return S.error(`Invalid agents: ${f.join(", ")}`),S.info(`Valid agents: ${n.join(", ")}`),null;return l.agent}s.spinner.start("Detecting installed agents...");let i=await lt();if(s.spinner.stop(`Detected ${i.length} agent${i.length!==1?"s":""}`),i.length===0)if(l.yes){let n=Object.keys(_);return S.info("Installing to all agents (none detected)"),n}else{S.warn("No coding agents detected. You can still install skills.");let n=Object.entries(_).map(([c,t])=>({value:c,label:t.displayName})),f=await F({message:"Select agents to install skills to",options:n,required:!0});if(M(f))return x("Installation cancelled"),null;return f}else if(i.length===1||l.yes){if(i.length===1){let n=i[0];S.info(`Installing to: ${T.default.cyan(_[n].displayName)}`)}else S.info(`Installing to: ${i.map((n)=>T.default.cyan(_[n].displayName)).join(", ")}`);return i}else{let n=i.map((c)=>({value:c,label:_[c].displayName,hint:_[c].skillsDir})),f=await F({message:"Select agents to install skills to",options:n,required:!0,initialValues:i});if(M(f))return x("Installation cancelled"),null;return f}}async function Yn(l){let s=l.global??!1;if(l.global===void 0&&!l.yes){let i=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(M(i))return x("Installation cancelled"),null;s=i}return s}async function Gn(l,s,i,n){S.step(T.default.bold("Installation Summary"));for(let f of s){S.message(` ${T.default.cyan(d(f))}`);for(let c of i){let t=ct(f.name,c,{global:n}),a=await ft(f.name,c,{global:n})?T.default.yellow(" (will overwrite)"):"";S.message(` ${T.default.dim("→")} ${_[c].displayName}: ${T.default.dim(t)}${a}`)}}if(!l.yes){let f=await cl({message:"Proceed with installation?"});if(M(f)||!f)return x("Installation cancelled"),!1}return!0}async function Xn(l,s,i,n,f,c){let t=l.flatMap(($)=>s.map((y)=>_l($,y,{global:i}))),r=await Promise.all(t),a=r.map(($,y)=>{let g=Math.floor(y/s.length),w=y%s.length,U=l[g],Y=s[w];return{skill:d(U),agent:_[Y].displayName,...$}}),e=new Map;for(let[$,y]of r.entries())if(y.success){let g=Math.floor($/s.length),w=$%s.length,U=l[g],Y=s[w],V=yt(U.name,n.url,n.subpath,c,f,{agent:Y,type:i?"global":"project",path:y.originalPath});if(V.updated&&V.previousBranch){let E=e.get(U.name);e.set(U.name,{previous:E?.previous??V.previousBranch,current:E?.current??c})}}let k=a.filter(($)=>$.success),b=a.filter(($)=>!$.success);if(e.size>0)for(let[$,{previous:y,current:g}]of e)S.warn(T.default.yellow(` ${T.default.cyan($)}: ${T.default.dim(y)} → ${T.default.green(g)}`));if(k.length>0){S.success(T.default.green(`Successfully installed ${k.length} skill${k.length!==1?"s":""}`));for(let $ of k)S.message(` ${T.default.green("✓")} ${$.skill} → ${$.agent}`),S.message(` ${T.default.dim($.path)}`)}if(b.length>0){S.error(T.default.red(`Failed to install ${b.length} skill${b.length!==1?"s":""}`));for(let $ of b)S.message(` ${T.default.red("✗")} ${$.skill} → ${$.agent}`),S.message(` ${T.default.dim($.error)}`)}return G(T.default.green("Done!")),{success:b.length===0,installed:k.length,failed:b.length,results:a}}var I=A(tl(),1);import{join as zn}from"path";async function bt(l,s){let i=s.installations.map((f)=>{let c=nl(f);return{agent:_[f.agent].displayName,path:c,exists:p(c)}});if(i.filter((f)=>f.exists).length===0)return{skillName:l,currentCommit:s.commit,latestCommit:s.commit,status:"orphaned",installations:i};try{let f=await Ds(s.url,s.branch),c=f===s.commit;return{skillName:l,currentCommit:s.commit,latestCommit:f,status:c?"latest":"update-available",installations:i}}catch(f){return{skillName:l,currentCommit:s.commit,latestCommit:s.commit,status:"error",installations:i,error:f instanceof Error?f.message:"Unknown error"}}}async function es(l){let s=rl(),i=[],n=Object.entries(s.skills).map(([t,r])=>({skillName:t,state:r})),f;if(l&&l.length>0){let t=new Set(l.map((r)=>r.toLowerCase()));f=n.filter(({skillName:r})=>t.has(r.toLowerCase()))}else f=n;if(f.length===0)return[];let c=sl();if(f.length===1){let{skillName:t,state:r}=f[0];c.start(`Checking ${I.default.cyan(t)}...`);let a=await bt(t,r);c.stop(a.status==="latest"?I.default.green("Up to date"):I.default.yellow("Update available")),i.push(a)}else{c.start(`Checking ${f.length} ${W(f.length,"skill")}...`);for(let{skillName:t,state:r}of f){let a=await bt(t,r);i.push(a)}c.stop("Check complete")}return i}async function gt(l,s={}){let i=rl(),n=[],f=Object.entries(i.skills).map(([y,g])=>({skillName:y,state:g})),c;if(l&&l.length>0){let y=new Set(l.map((g)=>g.toLowerCase()));c=f.filter(({skillName:g})=>y.has(g.toLowerCase()))}else c=f;if(c.length===0)return S.warn("No skills found to update"),[];let t=await es(l),r=t.filter((y)=>y.status==="update-available");if(r.length===0){let y=t.filter((g)=>g.status==="orphaned");if(y.length>0){S.warn(`${y.length} skill${y.length>1?"s":""} have no valid installations`);for(let g of y)S.message(` ${I.default.yellow("○")} ${I.default.cyan(g.skillName)} - all installations removed`)}return S.success(I.default.green("All skills are up to date")),[]}S.step(I.default.bold("Updates Available"));let a=r.map((y)=>({value:y.skillName,label:y.skillName,hint:`${y.currentCommit.slice(0,7)} → ${y.latestCommit.slice(0,7)}`})),e;if(s.yes)e=r.map((y)=>y.skillName);else{let y=await F({message:"Select skills to update",options:a,required:!0,initialValues:r.map((g)=>g.skillName)});if(M(y))return x("Update cancelled"),[];e=y}S.step(I.default.bold("Will Update"));for(let y of e){let g=r.find((w)=>w.skillName===y);if(g)S.message(` ${I.default.cyan(g.skillName)}`),S.message(` ${I.default.dim("Current:")} ${I.default.yellow(g.currentCommit.slice(0,7))} ${I.default.dim("→")} ${I.default.green(g.latestCommit.slice(0,7))}`)}if(!s.yes){let y=await cl({message:"Proceed with update?"});if(M(y)||!y)return x("Update cancelled"),[]}let k=sl();k.start(`Updating ${e.length} ${W(e.length,"skill")}...`);for(let{skillName:y,state:g}of c){let w=t.find((E)=>E.skillName===y);if(!w||w.status!=="update-available"){if(w?.status==="latest")n.push({skillName:y,success:!0,updated:0,failed:0});else n.push({skillName:y,success:!1,updated:0,failed:0});continue}if(!e.includes(y))continue;let U=null,Y=0,V=0;try{U=await Ul(g.url);let E=await Bl(U),X=g.subpath?zn(U,g.subpath):U,h=(await ql(X)).find((Z)=>Z.name.toLowerCase()===y.toLowerCase());if(!h)throw Error("Skill not found in repository");for(let Z of g.installations){let Gl=nl(Z);if(!p(Gl)){Yl(y,Z.agent,Z.path);continue}if((await _l(h,Z.agent,{global:Z.type==="global"})).success)Y++;else V++}St(y,E),n.push({skillName:y,success:V===0,updated:Y,failed:V})}catch(E){n.push({skillName:y,success:!1,updated:Y,failed:V+1,error:E instanceof Error?E.message:"Unknown error"})}finally{if(U)await Nl(U)}}k.stop("Update complete");let b=n.filter((y)=>y.success&&y.updated>0),$=n.filter((y)=>!y.success||y.failed>0);if(b.length>0){S.success(I.default.green(`Updated ${b.length} ${W(b.length,"skill")}`));for(let y of b)S.message(` ${I.default.green("✓")} ${I.default.cyan(y.skillName)} (${y.updated} ${W(y.updated,"installation")})`)}if($.length>0){S.error(I.default.red(`Failed to update ${$.length} ${W($.length,"skill")}`));for(let y of $)if(S.message(` ${I.default.red("✗")} ${I.default.cyan(y.skillName)}`),y.error)S.message(` ${I.default.dim(y.error)}`)}if(b.length>0)G(I.default.green("Done!"));else G(I.default.yellow("No skills were updated"));return n}async function It(l,s=!1){if(l.length===0){Sl();return}S.step(I.default.bold("Skills Status"));for(let i of l){let n={latest:I.default.green("✓"),"update-available":I.default.yellow("↓"),error:I.default.red("✗"),orphaned:I.default.dim("○")}[i.status],f={latest:I.default.green("latest"),"update-available":I.default.yellow("update available"),error:I.default.red("error"),orphaned:I.default.dim("orphaned")}[i.status],c=i.installations.filter((r)=>r.exists),t=i.installations.filter((r)=>!r.exists);if(!s){let r=c.length,a=r>0?` (${r} ${W(r,"installation")})`:"";S.message(`${n} ${I.default.cyan(i.skillName)}${I.default.dim(a)} - ${f}`)}else{if(S.message(`${n} ${I.default.cyan(i.skillName)}`),S.message(` Status: ${f}`),i.status==="update-available")S.message(` ${I.default.dim("Commit:")} ${I.default.yellow(i.currentCommit.slice(0,7))} ${I.default.dim("→")} ${I.default.green(i.latestCommit.slice(0,7))}`);else if(i.status==="latest")S.message(` ${I.default.dim("Commit:")} ${i.currentCommit.slice(0,7)}`);if(i.error)S.message(` ${I.default.red(i.error)}`);if(c.length>0){S.message(` ${I.default.dim("Installed in:")}`);for(let r of c)S.message(` ${I.default.dim("•")} ${r.agent}: ${I.default.dim(r.path)}`)}if(t.length>0){S.message(` ${I.default.yellow("Missing installations:")}`);for(let r of t)S.message(` ${I.default.dim("•")} ${r.agent}: ${I.default.dim(r.path)}`)}}}if(!s)S.info(`Use ${I.default.cyan("--verbose")} or ${I.default.cyan("-v")} for detailed information`)}async function wt(){let l=sl();l.start("Checking for orphaned entries..."),await $t(),l.stop(I.default.green("Cleaned up orphaned entries"))}var q=A(tl(),1);import{existsSync as Mn,rmSync as Qn}from"fs";async function Zn(l){try{if(Mn(l))Qn(l,{recursive:!0,force:!0});return{success:!0}}catch(s){return{success:!1,error:s instanceof Error?s.message:"Unknown error"}}}async function Rt(l=[],s={}){let i=rl(),n=[];if(Object.keys(i.skills).length===0)return Sl(),[];let f=Object.entries(i.skills).map(([$,y])=>({skillName:$,state:y})),c;if(l.length>0){let $=new Set(l.map((y)=>y.toLowerCase()));c=f.filter(({skillName:y})=>$.has(y.toLowerCase()))}else{let y=f.map(({skillName:g,state:w})=>{let U=w.installations.map((Y)=>({installation:Y,resolvedPath:nl(Y)})).filter(({resolvedPath:Y})=>p(Y));return{value:g,label:g,hint:U.length>0?`${U.length} ${W(U.length,"installation")}`:"no valid installations"}}).filter((g)=>g.hint!=="no valid installations");if(y.length===0)return S.warn("No valid installations found"),[];if(s.yes)c=f.filter(({skillName:g})=>y.some((w)=>w.value===g));else{let g=await F({message:"Select skills to remove",options:y,required:!0,initialValues:y.map((U)=>U.value)});if(M(g))return x("Remove cancelled"),[];let w=g;c=f.filter(({skillName:U})=>w.includes(U))}}if(c.length===0){if(l.length>0){S.error(`No matching skills found for: ${l.join(", ")}`),S.info("Tracked skills:");for(let $ of f)S.message(` - ${q.default.cyan($.skillName)}`)}return[]}S.step(q.default.bold("Skills to Remove"));let t=[];for(let{skillName:$,state:y}of c){let g=y.installations.map((w)=>({installation:w,resolvedPath:nl(w)})).filter(({resolvedPath:w})=>p(w));if(g.length>0){t.push({skillName:$,installations:g}),S.message(` ${q.default.cyan($)}`);for(let{resolvedPath:w}of g)S.message(` ${q.default.dim("→")} ${w}`)}}if(t.length===0)return S.warn("No installations match the specified criteria"),[];let r=l.length===0,a;if(s.yes||r)a=t.map(({skillName:$})=>$);else{let $=t.map(({skillName:g,installations:w})=>({value:g,label:g,hint:`${w.length} ${W(w.length,"installation")}`})),y=await F({message:"Select skills to remove",options:$,required:!0,initialValues:t.map(({skillName:g})=>g)});if(M(y))return x("Remove cancelled"),[];a=y}S.step(q.default.bold("Will Remove"));for(let $ of a){let y=t.find((g)=>g.skillName===$);if(y){S.message(` ${q.default.cyan(y.skillName)}`);for(let{resolvedPath:g}of y.installations)S.message(` ${q.default.dim("→")} ${g}`)}}if(!s.yes){let $=await cl({message:"Remove these skills?"});if(M($)||!$)return x("Remove cancelled"),[]}let e=sl();e.start(`Removing ${a.length} skill${a.length>1?"s":""}...`);for(let{skillName:$,installations:y}of t){if(!a.includes($))continue;let g={skillName:$,success:!0,removed:0,failed:0,installations:[]};for(let{installation:w,resolvedPath:U}of y){let Y=await Zn(U);if(g.installations.push({agent:_[w.agent].displayName,path:U,removed:Y.success,error:Y.error}),Y.success)g.removed++,Yl($,w.agent,w.path);else g.failed++,g.success=!1}n.push(g)}e.stop("Remove complete");let k=n.filter(($)=>$.success&&$.removed>0),b=n.filter(($)=>!$.success||$.failed>0);if(k.length>0){S.success(q.default.green(`Removed ${k.length} ${W(k.length,"skill")}`));for(let $ of k)S.message(` ${q.default.green("✓")} ${q.default.cyan($.skillName)}`),S.message(` ${q.default.dim(`${$.removed} ${W($.removed,"installation")} removed`)}`)}if(b.length>0){S.error(q.default.red(`Failed to remove ${b.length} ${W(b.length,"skill")}`));for(let $ of b){S.message(` ${q.default.red("✗")} ${q.default.cyan($.skillName)}`);for(let y of $.installations.filter((g)=>!g.removed))if(y.error)S.message(` ${q.default.dim(y.error)}`)}}return G(q.default.green("Done!")),n}async function Tt(){let l=rl();if(Object.keys(l.skills).length===0){Sl();return}S.step(q.default.bold("Installed Skills"));for(let[s,i]of Object.entries(l.skills)){S.message(`${q.default.cyan(s)}`);let n=i.installations.map((f)=>({installation:f,resolvedPath:nl(f)})).filter(({resolvedPath:f})=>p(f));if(n.length>0){S.message(` ${q.default.dim("Installed in:")}`);for(let{installation:f,resolvedPath:c}of n){let t=f.type==="global"?"global":"project";S.message(` ${q.default.dim("•")} ${_[f.agent].displayName} ${q.default.dim(`(${t})`)}: ${q.default.dim(c)}`)}}}}var Pt={name:"give-skill",version:"1.1.1",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 hn=Pt.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(hn).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 Kn(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 xn(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 Wn(l,s)});D.command("remove [skills...]").description("Remove installed skills").option("-y, --yes","Skip confirmation prompts").action(async(l,s)=>{await En(l,s)});D.command("list").description("List all installed skills").action(async()=>{await Cn()});D.command("clean").description("Remove orphaned skill entries from state").action(async()=>{await Vn()});D.parse();async function Kn(l,s){il(j.default.bgCyan(j.default.black(" give-skill ")));try{let i=await ot(l,s);if(!i.success&&i.installed===0&&i.failed===0)process.exit(1);if(i.failed>0)process.exit(1)}catch(i){S.error(i instanceof Error?i.message:"Unknown error occurred"),G(j.default.red("Installation failed")),process.exit(1)}}async function xn(l,s){il(j.default.bgCyan(j.default.black(" give-skill ")));try{await gt(l.length>0?l:void 0,s)}catch(i){S.error(i instanceof Error?i.message:"Unknown error occurred"),G(j.default.red("Update failed")),process.exit(1)}}async function Wn(l,s={}){il(j.default.bgCyan(j.default.black(" give-skill ")));try{let i=await es(l.length>0?l:void 0),n=s.verbose||l.length>0;await It(i,n),G("Done!")}catch(i){S.error(i instanceof Error?i.message:"Unknown error occurred"),G(j.default.red("Status check failed")),process.exit(1)}}async function En(l,s){il(j.default.bgCyan(j.default.black(" give-skill ")));try{await Rt(l,s)}catch(i){S.error(i instanceof Error?i.message:"Unknown error occurred"),G(j.default.red("Remove failed")),process.exit(1)}}async function Cn(){il(j.default.bgCyan(j.default.black(" give-skill ")));try{await Tt(),G("Done!")}catch(l){S.error(l instanceof Error?l.message:"Unknown error occurred"),G(j.default.red("List failed")),process.exit(1)}}async function Vn(){il(j.default.bgCyan(j.default.black(" give-skill ")));try{await wt(),G(j.default.green("Done!"))}catch(l){S.error(l instanceof Error?l.message:"Unknown error occurred"),G(j.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
|
}
|