openskillmd 0.3.2 → 0.4.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 +8 -8
- package/dist/{add-77ZPOLTV.js → add-6HD5JXVM.js} +1 -1
- package/dist/{browse-P7RXLMMF.js → browse-ZYG3RRU4.js} +1 -1
- package/dist/chunk-AZ56ID7P.js +8 -0
- package/dist/{chunk-5CDG6OB7.js → chunk-C5KG3WI6.js} +2 -2
- package/dist/chunk-GTRQVB2J.js +7 -0
- package/dist/{chunk-IZJHFL7T.js → chunk-K3MPWRF4.js} +1 -1
- package/dist/{chunk-MWJMJUS4.js → chunk-KS57GYQM.js} +1 -1
- package/dist/index.js +21 -21
- package/dist/{info-5GSXNJ5W.js → info-7CODYQGV.js} +1 -1
- package/dist/{init-ZDBNGFX7.js → init-DMS3SQYU.js} +1 -1
- package/dist/{list-SMKTYTII.js → list-T3BOFCW2.js} +1 -1
- package/dist/{mcp-UHV7L4RE.js → mcp-3VMRNDNM.js} +1 -1
- package/dist/{remove-QKFHXT73.js → remove-F65O3ISJ.js} +1 -1
- package/dist/router-ACAGHZ73.js +3 -0
- package/dist/{score-CPVOUARV.js → score-YDX36SCU.js} +1 -1
- package/dist/{search-JQMXVSCW.js → search-KROHSMVC.js} +1 -1
- package/package.json +5 -3
- package/dist/chunk-ONVELHE6.js +0 -8
- package/dist/chunk-OVTYCRA4.js +0 -7
- package/dist/router-AVHY4U3G.js +0 -3
package/dist/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as
|
|
4
|
-
`)}displayWidth(t){return
|
|
5
|
-
`+" ".repeat(e+
|
|
6
|
-
${r}`)}boxWrap(t,e){if(e<this.minWidthToWrap)return t;let i=t.split(/\r\n|\n/),n=/[\s]*[^\s]+/g,s=[];return i.forEach(r=>{let
|
|
7
|
-
`)}};function
|
|
3
|
+
import{a as C,b as _,d as mt,f,g as G,k as E,l as A,n as J,p as K}from"./chunk-GTRQVB2J.js";var b=_(v=>{"use strict";var y=class extends Error{constructor(t,e,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=e,this.exitCode=t,this.nestedError=void 0}},S=class extends y{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};v.CommanderError=y;v.InvalidArgumentError=S});var w=_(k=>{"use strict";var{InvalidArgumentError:pt}=b(),$=class{constructor(t,e){switch(this.description=e||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(t,e){return e===this.defaultValue||!Array.isArray(e)?[t]:e.concat(t)}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(e,i)=>{if(!this.argChoices.includes(e))throw new pt(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,i):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function dt(o){let t=o.name()+(o.variadic===!0?"...":"");return o.required?"<"+t+">":"["+t+"]"}k.Argument=$;k.humanReadableArgName=dt});var T=_(V=>{"use strict";var{humanReadableArgName:ft}=w(),H=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let e=t.commands.filter(n=>!n._hidden),i=t._getHelpCommand();return i&&!i._hidden&&e.push(i),this.sortSubcommands&&e.sort((n,s)=>n.name().localeCompare(s.name())),e}compareOptions(t,e){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(t).localeCompare(i(e))}visibleOptions(t){let e=t.options.filter(n=>!n.hidden),i=t._getHelpOption();if(i&&!i.hidden){let n=i.short&&t._findOption(i.short),s=i.long&&t._findOption(i.long);!n&&!s?e.push(i):i.long&&!s?e.push(t.createOption(i.long,i.description)):i.short&&!n&&e.push(t.createOption(i.short,i.description))}return this.sortOptions&&e.sort(this.compareOptions),e}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let e=[];for(let i=t.parent;i;i=i.parent){let n=i.options.filter(s=>!s.hidden);e.push(...n)}return this.sortOptions&&e.sort(this.compareOptions),e}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(e=>{e.description=e.description||t._argsDescription[e.name()]||""}),t.registeredArguments.find(e=>e.description)?t.registeredArguments:[]}subcommandTerm(t){let e=t.registeredArguments.map(i=>ft(i)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(e?" "+e:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,e){return e.visibleCommands(t).reduce((i,n)=>Math.max(i,this.displayWidth(e.styleSubcommandTerm(e.subcommandTerm(n)))),0)}longestOptionTermLength(t,e){return e.visibleOptions(t).reduce((i,n)=>Math.max(i,this.displayWidth(e.styleOptionTerm(e.optionTerm(n)))),0)}longestGlobalOptionTermLength(t,e){return e.visibleGlobalOptions(t).reduce((i,n)=>Math.max(i,this.displayWidth(e.styleOptionTerm(e.optionTerm(n)))),0)}longestArgumentTermLength(t,e){return e.visibleArguments(t).reduce((i,n)=>Math.max(i,this.displayWidth(e.styleArgumentTerm(e.argumentTerm(n)))),0)}commandUsage(t){let e=t._name;t._aliases[0]&&(e=e+"|"+t._aliases[0]);let i="";for(let n=t.parent;n;n=n.parent)i=n.name()+" "+i;return i+e+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let e=[];return t.argChoices&&e.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&e.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&e.push(`env: ${t.envVar}`),e.length>0?`${t.description} (${e.join(", ")})`:t.description}argumentDescription(t){let e=[];if(t.argChoices&&e.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),e.length>0){let i=`(${e.join(", ")})`;return t.description?`${t.description} ${i}`:i}return t.description}formatHelp(t,e){let i=e.padWidth(t,e),n=e.helpWidth??80;function s(c,p){return e.formatItem(c,i,p,e)}let r=[`${e.styleTitle("Usage:")} ${e.styleUsage(e.commandUsage(t))}`,""],l=e.commandDescription(t);l.length>0&&(r=r.concat([e.boxWrap(e.styleCommandDescription(l),n),""]));let a=e.visibleArguments(t).map(c=>s(e.styleArgumentTerm(e.argumentTerm(c)),e.styleArgumentDescription(e.argumentDescription(c))));a.length>0&&(r=r.concat([e.styleTitle("Arguments:"),...a,""]));let h=e.visibleOptions(t).map(c=>s(e.styleOptionTerm(e.optionTerm(c)),e.styleOptionDescription(e.optionDescription(c))));if(h.length>0&&(r=r.concat([e.styleTitle("Options:"),...h,""])),e.showGlobalOptions){let c=e.visibleGlobalOptions(t).map(p=>s(e.styleOptionTerm(e.optionTerm(p)),e.styleOptionDescription(e.optionDescription(p))));c.length>0&&(r=r.concat([e.styleTitle("Global Options:"),...c,""]))}let u=e.visibleCommands(t).map(c=>s(e.styleSubcommandTerm(e.subcommandTerm(c)),e.styleSubcommandDescription(e.subcommandDescription(c))));return u.length>0&&(r=r.concat([e.styleTitle("Commands:"),...u,""])),r.join(`
|
|
4
|
+
`)}displayWidth(t){return Y(t).length}styleTitle(t){return t}styleUsage(t){return t.split(" ").map(e=>e==="[options]"?this.styleOptionText(e):e==="[command]"?this.styleSubcommandText(e):e[0]==="["||e[0]==="<"?this.styleArgumentText(e):this.styleCommandText(e)).join(" ")}styleCommandDescription(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(e=>e==="[options]"?this.styleOptionText(e):e[0]==="["||e[0]==="<"?this.styleArgumentText(e):this.styleSubcommandText(e)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,e){return Math.max(e.longestOptionTermLength(t,e),e.longestGlobalOptionTermLength(t,e),e.longestSubcommandTermLength(t,e),e.longestArgumentTermLength(t,e))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,e,i,n){let r=" ".repeat(2);if(!i)return r+t;let l=t.padEnd(e+t.length-n.displayWidth(t)),a=2,u=(this.helpWidth??80)-e-a-2,c;return u<this.minWidthToWrap||n.preformatted(i)?c=i:c=n.boxWrap(i,u).replace(/\n/g,`
|
|
5
|
+
`+" ".repeat(e+a)),r+l+" ".repeat(a)+c.replace(/\n/g,`
|
|
6
|
+
${r}`)}boxWrap(t,e){if(e<this.minWidthToWrap)return t;let i=t.split(/\r\n|\n/),n=/[\s]*[^\s]+/g,s=[];return i.forEach(r=>{let l=r.match(n);if(l===null){s.push("");return}let a=[l.shift()],h=this.displayWidth(a[0]);l.forEach(u=>{let c=this.displayWidth(u);if(h+c<=e){a.push(u),h+=c;return}s.push(a.join(""));let p=u.trimStart();a=[p],h=this.displayWidth(p)}),s.push(a.join(""))}),s.join(`
|
|
7
|
+
`)}};function Y(o){let t=/\x1b\[\d*(;\d*)*m/g;return o.replace(t,"")}V.Help=H;V.stripColor=Y});var F=_(W=>{"use strict";var{InvalidArgumentError:gt}=b(),P=class{constructor(t,e){this.flags=t,this.description=e||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let i=_t(t);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let e=t;return typeof t=="string"&&(e={[t]:!0}),this.implied=Object.assign(this.implied||{},e),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_concatValue(t,e){return e===this.defaultValue||!Array.isArray(e)?[t]:e.concat(t)}choices(t){return this.argChoices=t.slice(),this.parseArg=(e,i)=>{if(!this.argChoices.includes(e))throw new gt(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,i):e},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?z(this.name().replace(/^no-/,"")):z(this.name())}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},D=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(t,e){let i=e.attributeName();if(!this.dualOptions.has(i))return!0;let n=this.negativeOptions.get(i).presetArg,s=n!==void 0?n:!1;return e.negate===(s===t)}};function z(o){return o.split("-").reduce((t,e)=>t+e[0].toUpperCase()+e.slice(1))}function _t(o){let t,e,i=/^-[^-]$/,n=/^--[^-]/,s=o.split(/[ |,]+/).concat("guard");if(i.test(s[0])&&(t=s.shift()),n.test(s[0])&&(e=s.shift()),!t&&i.test(s[0])&&(t=s.shift()),!t&&n.test(s[0])&&(t=e,e=s.shift()),s[0].startsWith("-")){let r=s[0],l=`option creation failed due to '${r}' in option flags '${o}'`;throw/^-[^-][^-]/.test(r)?new Error(`${l}
|
|
8
8
|
- a short flag is a single dash and a single character
|
|
9
9
|
- either use a single dash and a single character (for a short flag)
|
|
10
|
-
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`):i.test(r)?new Error(`${
|
|
11
|
-
- too many short flags`):n.test(r)?new Error(`${
|
|
12
|
-
- too many long flags`):new Error(`${
|
|
13
|
-
- unrecognised flag format`)}if(t===void 0&&e===void 0)throw new Error(`option creation failed due to no flags found in '${
|
|
10
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`):i.test(r)?new Error(`${l}
|
|
11
|
+
- too many short flags`):n.test(r)?new Error(`${l}
|
|
12
|
+
- too many long flags`):new Error(`${l}
|
|
13
|
+
- unrecognised flag format`)}if(t===void 0&&e===void 0)throw new Error(`option creation failed due to no flags found in '${o}'.`);return{shortFlag:t,longFlag:e}}W.Option=P;W.DualOptions=D});var X=_(Q=>{"use strict";function Ot(o,t){if(Math.abs(o.length-t.length)>3)return Math.max(o.length,t.length);let e=[];for(let i=0;i<=o.length;i++)e[i]=[i];for(let i=0;i<=t.length;i++)e[0][i]=i;for(let i=1;i<=t.length;i++)for(let n=1;n<=o.length;n++){let s=1;o[n-1]===t[i-1]?s=0:s=1,e[n][i]=Math.min(e[n-1][i]+1,e[n][i-1]+1,e[n-1][i-1]+s),n>1&&i>1&&o[n-1]===t[i-2]&&o[n-2]===t[i-1]&&(e[n][i]=Math.min(e[n][i],e[n-2][i-2]+1))}return e[o.length][t.length]}function Ct(o,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let e=o.startsWith("--");e&&(o=o.slice(2),t=t.map(r=>r.slice(2)));let i=[],n=3,s=.4;return t.forEach(r=>{if(r.length<=1)return;let l=Ot(o,r),a=Math.max(o.length,r.length);(a-l)/a>s&&(l<n?(n=l,i=[r]):l===n&&i.push(r))}),i.sort((r,l)=>r.localeCompare(l)),e&&(i=i.map(r=>`--${r}`)),i.length>1?`
|
|
14
14
|
(Did you mean one of ${i.join(", ")}?)`:i.length===1?`
|
|
15
|
-
(Did you mean ${i[0]}?)`:""}
|
|
16
|
-
- specify the name in Command constructor or using .name()`);return e=e||{},e.isDefault&&(this._defaultCommandName=t._name),(e.noHelp||e.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,e){return new
|
|
17
|
-
Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(e):this._lifeCycleHooks[t]=[e],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=e=>{if(e.code!=="commander.executeSubCommandAsync")throw e},this}_exit(t,e,i){this._exitCallback&&this._exitCallback(new
|
|
18
|
-
- already used by option '${e.flags}'`)}this.options.push(t)}_registerCommand(t){let e=n=>[n.name()].concat(n.aliases()),i=e(t).find(n=>this._findCommand(n));if(i){let n=e(this._findCommand(i)).join("|"),s=e(t).join("|");throw new Error(`cannot add command '${s}' as already have command '${n}'`)}this.commands.push(t)}addOption(t){this._registerOption(t);let e=t.name(),i=t.attributeName();if(t.negate){let s=t.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(i,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(i,t.defaultValue,"default");let n=(s,r,
|
|
19
|
-
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(t,e,i){if(
|
|
15
|
+
(Did you mean ${i[0]}?)`:""}Q.suggestSimilar=Ct});var it=_(M=>{"use strict";var bt=C("events").EventEmitter,I=C("child_process"),g=C("path"),x=C("fs"),m=C("process"),{Argument:At,humanReadableArgName:yt}=w(),{CommanderError:N}=b(),{Help:wt,stripColor:xt}=T(),{Option:Z,DualOptions:Et}=F(),{suggestSimilar:tt}=X(),q=class o extends bt{constructor(t){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=t||"",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:e=>m.stdout.write(e),writeErr:e=>m.stderr.write(e),outputError:(e,i)=>i(e),getOutHelpWidth:()=>m.stdout.isTTY?m.stdout.columns:void 0,getErrHelpWidth:()=>m.stderr.isTTY?m.stderr.columns:void 0,getOutHasColors:()=>j()??(m.stdout.isTTY&&m.stdout.hasColors?.()),getErrHasColors:()=>j()??(m.stderr.isTTY&&m.stderr.hasColors?.()),stripColor:e=>xt(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let e=this;e;e=e.parent)t.push(e);return t}command(t,e,i){let n=e,s=i;typeof n=="object"&&n!==null&&(s=n,n=null),s=s||{};let[,r,l]=t.match(/([^ ]+) *(.*)/),a=this.createCommand(r);return n&&(a.description(n),a._executableHandler=!0),s.isDefault&&(this._defaultCommandName=a._name),a._hidden=!!(s.noHelp||s.hidden),a._executableFile=s.executableFile||null,l&&a.arguments(l),this._registerCommand(a),a.parent=this,a.copyInheritedSettings(this),n?this:a}createCommand(t){return new o(t)}createHelp(){return Object.assign(new wt,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,t),this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,e){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
16
|
+
- specify the name in Command constructor or using .name()`);return e=e||{},e.isDefault&&(this._defaultCommandName=t._name),(e.noHelp||e.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,e){return new At(t,e)}argument(t,e,i,n){let s=this.createArgument(t,e);return typeof i=="function"?s.default(n).argParser(i):s.default(i),this.addArgument(s),this}arguments(t){return t.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(t){let e=this.registeredArguments.slice(-1)[0];if(e&&e.variadic)throw new Error(`only the last argument can be variadic '${e.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,e){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,this;t=t??"help [command]";let[,i,n]=t.match(/([^ ]+) *(.*)/),s=e??"display help for command",r=this.createCommand(i);return r.helpOption(!1),n&&r.arguments(n),s&&r.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=r,this}addHelpCommand(t,e){return typeof t!="object"?(this.helpCommand(t,e),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(t,e){let i=["preSubcommand","preAction","postAction"];if(!i.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
|
|
17
|
+
Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(e):this._lifeCycleHooks[t]=[e],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=e=>{if(e.code!=="commander.executeSubCommandAsync")throw e},this}_exit(t,e,i){this._exitCallback&&this._exitCallback(new N(t,e,i)),m.exit(t)}action(t){let e=i=>{let n=this.registeredArguments.length,s=i.slice(0,n);return this._storeOptionsAsProperties?s[n]=this:s[n]=this.opts(),s.push(this),t.apply(this,s)};return this._actionHandler=e,this}createOption(t,e){return new Z(t,e)}_callParseArg(t,e,i,n){try{return t.parseArg(e,i)}catch(s){if(s.code==="commander.invalidArgument"){let r=`${n} ${s.message}`;this.error(r,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(t){let e=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(e){let i=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
|
|
18
|
+
- already used by option '${e.flags}'`)}this.options.push(t)}_registerCommand(t){let e=n=>[n.name()].concat(n.aliases()),i=e(t).find(n=>this._findCommand(n));if(i){let n=e(this._findCommand(i)).join("|"),s=e(t).join("|");throw new Error(`cannot add command '${s}' as already have command '${n}'`)}this.commands.push(t)}addOption(t){this._registerOption(t);let e=t.name(),i=t.attributeName();if(t.negate){let s=t.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(i,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(i,t.defaultValue,"default");let n=(s,r,l)=>{s==null&&t.presetArg!==void 0&&(s=t.presetArg);let a=this.getOptionValue(i);s!==null&&t.parseArg?s=this._callParseArg(t,s,a,r):s!==null&&t.variadic&&(s=t._concatValue(s,a)),s==null&&(t.negate?s=!1:t.isBoolean()||t.optional?s=!0:s=""),this.setOptionValueWithSource(i,s,l)};return this.on("option:"+e,s=>{let r=`error: option '${t.flags}' argument '${s}' is invalid.`;n(s,r,"cli")}),t.envVar&&this.on("optionEnv:"+e,s=>{let r=`error: option '${t.flags}' value '${s}' from env '${t.envVar}' is invalid.`;n(s,r,"env")}),this}_optionEx(t,e,i,n,s){if(typeof e=="object"&&e instanceof Z)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let r=this.createOption(e,i);if(r.makeOptionMandatory(!!t.mandatory),typeof n=="function")r.default(s).argParser(n);else if(n instanceof RegExp){let l=n;n=(a,h)=>{let u=l.exec(a);return u?u[0]:h},r.default(s).argParser(n)}else r.default(n);return this.addOption(r)}option(t,e,i,n){return this._optionEx({},t,e,i,n)}requiredOption(t,e,i,n){return this._optionEx({mandatory:!0},t,e,i,n)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(t=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,e){return this.setOptionValueWithSource(t,e,void 0)}setOptionValueWithSource(t,e,i){return this._storeOptionsAsProperties?this[t]=e:this._optionValues[t]=e,this._optionValueSources[t]=i,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let e;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(t)!==void 0&&(e=i.getOptionValueSource(t))}),e}_prepareUserArgs(t,e){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(e=e||{},t===void 0&&e.from===void 0){m.versions?.electron&&(e.from="electron");let n=m.execArgv??[];(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))&&(e.from="eval")}t===void 0&&(t=m.argv),this.rawArgs=t.slice();let i;switch(e.from){case void 0:case"node":this._scriptPath=t[1],i=t.slice(2);break;case"electron":m.defaultApp?(this._scriptPath=t[1],i=t.slice(2)):i=t.slice(1);break;case"user":i=t.slice(0);break;case"eval":i=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${e.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",i}parse(t,e){this._prepareForParse();let i=this._prepareUserArgs(t,e);return this._parseCommand([],i),this}async parseAsync(t,e){this._prepareForParse();let i=this._prepareUserArgs(t,e);return await this._parseCommand([],i),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
19
|
+
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(t,e,i){if(x.existsSync(t))return;let n=e?`searched for local subcommand relative to directory '${e}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",s=`'${t}' does not exist
|
|
20
20
|
- if '${i}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
21
21
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
22
|
-
- ${n}`;throw new Error(s)}_executeSubCommand(t,e){e=e.slice();let i=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function s(u,c){let p=
|
|
22
|
+
- ${n}`;throw new Error(s)}_executeSubCommand(t,e){e=e.slice();let i=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function s(u,c){let p=g.resolve(u,c);if(x.existsSync(p))return p;if(n.includes(g.extname(c)))return;let B=n.find(ct=>x.existsSync(`${p}${ct}`));if(B)return`${p}${B}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=t._executableFile||`${this._name}-${t._name}`,l=this._executableDir||"";if(this._scriptPath){let u;try{u=x.realpathSync(this._scriptPath)}catch{u=this._scriptPath}l=g.resolve(g.dirname(u),l)}if(l){let u=s(l,r);if(!u&&!t._executableFile&&this._scriptPath){let c=g.basename(this._scriptPath,g.extname(this._scriptPath));c!==this._name&&(u=s(l,`${c}-${t._name}`))}r=u||r}i=n.includes(g.extname(r));let a;m.platform!=="win32"?i?(e.unshift(r),e=et(m.execArgv).concat(e),a=I.spawn(m.argv[0],e,{stdio:"inherit"})):a=I.spawn(r,e,{stdio:"inherit"}):(this._checkForMissingExecutable(r,l,t._name),e.unshift(r),e=et(m.execArgv).concat(e),a=I.spawn(m.execPath,e,{stdio:"inherit"})),a.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(c=>{m.on(c,()=>{a.killed===!1&&a.exitCode===null&&a.kill(c)})});let h=this._exitCallback;a.on("close",u=>{u=u??1,h?h(new N(u,"commander.executeSubCommandAsync","(close)")):m.exit(u)}),a.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(r,l,t._name);else if(u.code==="EACCES")throw new Error(`'${r}' not executable`);if(!h)m.exit(1);else{let c=new N(1,"commander.executeSubCommandAsync","(error)");c.nestedError=u,h(c)}}),this.runningCommand=a}_dispatchSubcommand(t,e,i){let n=this._findCommand(t);n||this.help({error:!0}),n._prepareForParse();let s;return s=this._chainOrCallSubCommandHook(s,n,"preSubcommand"),s=this._chainOrCall(s,()=>{if(n._executableHandler)this._executeSubCommand(n,e.concat(i));else return n._parseCommand(e,i)}),s}_dispatchHelpCommand(t){t||this.help();let e=this._findCommand(t);return e&&!e._executableHandler&&e.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,e)=>{t.required&&this.args[e]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(i,n,s)=>{let r=n;if(n!==null&&i.parseArg){let l=`error: command-argument value '${n}' is invalid for argument '${i.name()}'.`;r=this._callParseArg(i,n,s,l)}return r};this._checkNumberOfArguments();let e=[];this.registeredArguments.forEach((i,n)=>{let s=i.defaultValue;i.variadic?n<this.args.length?(s=this.args.slice(n),i.parseArg&&(s=s.reduce((r,l)=>t(i,l,r),i.defaultValue))):s===void 0&&(s=[]):n<this.args.length&&(s=this.args[n],i.parseArg&&(s=t(i,s,i.defaultValue))),e[n]=s}),this.processedArgs=e}_chainOrCall(t,e){return t&&t.then&&typeof t.then=="function"?t.then(()=>e()):e()}_chainOrCallHooks(t,e){let i=t,n=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[e]!==void 0).forEach(s=>{s._lifeCycleHooks[e].forEach(r=>{n.push({hookedCommand:s,callback:r})})}),e==="postAction"&&n.reverse(),n.forEach(s=>{i=this._chainOrCall(i,()=>s.callback(s.hookedCommand,this))}),i}_chainOrCallSubCommandHook(t,e,i){let n=t;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(s=>{n=this._chainOrCall(n,()=>s(this,e))}),n}_parseCommand(t,e){let i=this.parseOptions(e);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(i.operands),e=i.unknown,this.args=t.concat(e),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),e);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(e),this._dispatchSubcommand(this._defaultCommandName,t,e);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let r;return r=this._chainOrCallHooks(r,"preAction"),r=this._chainOrCall(r,()=>this._actionHandler(this.processedArgs)),this.parent&&(r=this._chainOrCall(r,()=>{this.parent.emit(s,t,e)})),r=this._chainOrCallHooks(r,"postAction"),r}if(this.parent&&this.parent.listenerCount(s))n(),this._processArguments(),this.parent.emit(s,t,e);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,e);this.listenerCount("command:*")?this.emit("command:*",t,e):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(e=>e._name===t||e._aliases.includes(t))}_findOption(t){return this.options.find(e=>e.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(e=>{e.mandatory&&t.getOptionValue(e.attributeName())===void 0&&t.missingMandatoryOptionValue(e)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(i=>{let n=i.attributeName();return this.getOptionValue(n)===void 0?!1:this.getOptionValueSource(n)!=="default"});t.filter(i=>i.conflictsWith.length>0).forEach(i=>{let n=t.find(s=>i.conflictsWith.includes(s.attributeName()));n&&this._conflictingOption(i,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let e=[],i=[],n=e,s=t.slice();function r(a){return a.length>1&&a[0]==="-"}let l=null;for(;s.length;){let a=s.shift();if(a==="--"){n===i&&n.push(a),n.push(...s);break}if(l&&!r(a)){this.emit(`option:${l.name()}`,a);continue}if(l=null,r(a)){let h=this._findOption(a);if(h){if(h.required){let u=s.shift();u===void 0&&this.optionMissingArgument(h),this.emit(`option:${h.name()}`,u)}else if(h.optional){let u=null;s.length>0&&!r(s[0])&&(u=s.shift()),this.emit(`option:${h.name()}`,u)}else this.emit(`option:${h.name()}`);l=h.variadic?h:null;continue}}if(a.length>2&&a[0]==="-"&&a[1]!=="-"){let h=this._findOption(`-${a[1]}`);if(h){h.required||h.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${h.name()}`,a.slice(2)):(this.emit(`option:${h.name()}`),s.unshift(`-${a.slice(2)}`));continue}}if(/^--[^=]+=/.test(a)){let h=a.indexOf("="),u=this._findOption(a.slice(0,h));if(u&&(u.required||u.optional)){this.emit(`option:${u.name()}`,a.slice(h+1));continue}}if(r(a)&&(n=i),(this._enablePositionalOptions||this._passThroughOptions)&&e.length===0&&i.length===0){if(this._findCommand(a)){e.push(a),s.length>0&&i.push(...s);break}else if(this._getHelpCommand()&&a===this._getHelpCommand().name()){e.push(a),s.length>0&&e.push(...s);break}else if(this._defaultCommandName){i.push(a),s.length>0&&i.push(...s);break}}if(this._passThroughOptions){n.push(a),s.length>0&&n.push(...s);break}n.push(a)}return{operands:e,unknown:i}}opts(){if(this._storeOptionsAsProperties){let t={},e=this.options.length;for(let i=0;i<e;i++){let n=this.options[i].attributeName();t[n]=n===this._versionOptionName?this._version:this[n]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,e)=>Object.assign(t,e.opts()),{})}error(t,e){this._outputConfiguration.outputError(`${t}
|
|
23
23
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
24
24
|
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
25
|
-
`),this.outputHelp({error:!0}));let i=e||{},n=i.exitCode||1,s=i.code||"commander.error";this._exit(n,s,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in m.env){let e=t.attributeName();(this.getOptionValue(e)===void 0||["default","config","env"].includes(this.getOptionValueSource(e)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,m.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new
|
|
26
|
-
`),this._exit(0,"commander.version",t)}),this}description(t,e){return t===void 0&&e===void 0?this._description:(this._description=t,e&&(this._argsDescription=e),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let e=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(e=this.commands[this.commands.length-1]),t===e._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(t);if(i){let n=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${n}'`)}return e._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(e=>this.alias(e)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(i=>
|
|
25
|
+
`),this.outputHelp({error:!0}));let i=e||{},n=i.exitCode||1,s=i.code||"commander.error";this._exit(n,s,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in m.env){let e=t.attributeName();(this.getOptionValue(e)===void 0||["default","config","env"].includes(this.getOptionValueSource(e)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,m.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new Et(this.options),e=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&e(i.attributeName())&&t.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(n=>!e(n)).forEach(n=>{this.setOptionValueWithSource(n,i.implied[n],"implied")})})}missingArgument(t){let e=`error: missing required argument '${t}'`;this.error(e,{code:"commander.missingArgument"})}optionMissingArgument(t){let e=`error: option '${t.flags}' argument missing`;this.error(e,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let e=`error: required option '${t.flags}' not specified`;this.error(e,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,e){let i=r=>{let l=r.attributeName(),a=this.getOptionValue(l),h=this.options.find(c=>c.negate&&l===c.attributeName()),u=this.options.find(c=>!c.negate&&l===c.attributeName());return h&&(h.presetArg===void 0&&a===!1||h.presetArg!==void 0&&a===h.presetArg)?h:u||r},n=r=>{let l=i(r),a=l.attributeName();return this.getOptionValueSource(a)==="env"?`environment variable '${l.envVar}'`:`option '${l.flags}'`},s=`error: ${n(t)} cannot be used with ${n(e)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let e="";if(t.startsWith("--")&&this._showSuggestionAfterError){let n=[],s=this;do{let r=s.createHelp().visibleOptions(s).filter(l=>l.long).map(l=>l.long);n=n.concat(r),s=s.parent}while(s&&!s._enablePositionalOptions);e=tt(t,n)}let i=`error: unknown option '${t}'${e}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let e=this.registeredArguments.length,i=e===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${e} argument${i} but got ${t.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],e="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(s=>{n.push(s.name()),s.alias()&&n.push(s.alias())}),e=tt(t,n)}let i=`error: unknown command '${t}'${e}`;this.error(i,{code:"commander.unknownCommand"})}version(t,e,i){if(t===void 0)return this._version;this._version=t,e=e||"-V, --version",i=i||"output the version number";let n=this.createOption(e,i);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${t}
|
|
26
|
+
`),this._exit(0,"commander.version",t)}),this}description(t,e){return t===void 0&&e===void 0?this._description:(this._description=t,e&&(this._argsDescription=e),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let e=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(e=this.commands[this.commands.length-1]),t===e._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(t);if(i){let n=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${n}'`)}return e._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(e=>this.alias(e)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(i=>yt(i));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?e:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}nameFromFilename(t){return this._name=g.basename(t,g.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let e=this.createHelp(),i=this._getOutputContext(t);e.prepareContext({error:i.error,helpWidth:i.helpWidth,outputHasColors:i.hasColors});let n=e.formatHelp(this,e);return i.hasColors?n:this._outputConfiguration.stripColor(n)}_getOutputContext(t){t=t||{};let e=!!t.error,i,n,s;return e?(i=l=>this._outputConfiguration.writeErr(l),n=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(i=l=>this._outputConfiguration.writeOut(l),n=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth()),{error:e,write:l=>(n||(l=this._outputConfiguration.stripColor(l)),i(l)),hasColors:n,helpWidth:s}}outputHelp(t){let e;typeof t=="function"&&(e=t,t=void 0);let i=this._getOutputContext(t),n={error:i.error,write:i.write,command:this};this._getCommandAndAncestors().reverse().forEach(r=>r.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let s=this.helpInformation({error:i.error});if(e&&(s=e(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(r=>r.emit("afterAllHelp",n))}helpOption(t,e){return typeof t=="boolean"?(t?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(t=t??"-h, --help",e=e??"display help for command",this._helpOption=this.createOption(t,e),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this}help(t){this.outputHelp(t);let e=Number(m.exitCode??0);e===0&&t&&typeof t!="function"&&t.error&&(e=1),this._exit(e,"commander.help","(outputHelp)")}addHelpText(t,e){let i=["beforeAll","before","after","afterAll"];if(!i.includes(t))throw new Error(`Unexpected value for position to addHelpText.
|
|
27
27
|
Expecting one of '${i.join("', '")}'`);let n=`${t}Help`;return this.on(n,s=>{let r;typeof e=="function"?r=e({error:s.error,command:s.command}):r=e,r&&s.write(`${r}
|
|
28
|
-
`)}),this}_outputHelpIfRequested(t){let e=this._getHelpOption();e&&t.find(n=>e.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function
|
|
29
|
-
`)}function
|
|
30
|
-
`)}var
|
|
31
|
-
${super.helpInformation()}`}};function
|
|
28
|
+
`)}),this}_outputHelpIfRequested(t){let e=this._getHelpOption();e&&t.find(n=>e.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function et(o){return o.map(t=>{if(!t.startsWith("--inspect"))return t;let e,i="127.0.0.1",n="9229",s;return(s=t.match(/^(--inspect(-brk)?)$/))!==null?e=s[1]:(s=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(e=s[1],/^\d+$/.test(s[3])?n=s[3]:i=s[3]):(s=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(e=s[1],i=s[3],n=s[4]),e&&n!=="0"?`${e}=${i}:${parseInt(n)+1}`:t})}function j(){if(m.env.NO_COLOR||m.env.FORCE_COLOR==="0"||m.env.FORCE_COLOR==="false")return!1;if(m.env.FORCE_COLOR||m.env.CLICOLOR_FORCE!==void 0)return!0}M.Command=q;M.useColor=j});var ot=_(d=>{"use strict";var{Argument:nt}=w(),{Command:L}=it(),{CommanderError:St,InvalidArgumentError:st}=b(),{Help:vt}=T(),{Option:rt}=F();d.program=new L;d.createCommand=o=>new L(o);d.createOption=(o,t)=>new rt(o,t);d.createArgument=(o,t)=>new nt(o,t);d.Command=L;d.Option=rt;d.Argument=nt;d.Help=vt;d.CommanderError=St;d.InvalidArgumentError=st;d.InvalidOptionArgumentError=st});var at=mt(ot(),1),{program:Nt,createCommand:qt,createArgument:jt,createOption:Mt,CommanderError:Lt,InvalidArgumentError:Rt,InvalidOptionArgumentError:Ut,Command:lt,Argument:Bt,Option:Gt,Help:Jt}=at.default;var ut=[" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557","\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551","\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551","\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551","\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551"," \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D"],$t="OpenSkill.md \u2014 the npm for AI skills";function R(){return["",...ut.map((o,t)=>K(o,t,ut.length)),J(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),A.bold(` ${$t}`),""].join(`
|
|
29
|
+
`)}function O(){process.stderr.write(R()+`
|
|
30
|
+
`)}var kt="0.4.0",U=class o extends lt{createCommand(t){return new o(t)}helpInformation(){return`${R()}
|
|
31
|
+
${super.helpInformation()}`}},Ht={styleTitle:o=>G.bold(o),styleUsage:o=>f.lavender(o),styleCommandText:o=>A(o),styleCommandDescription:o=>f.subtext1(o),styleDescriptionText:o=>f.subtext1(o),styleSubcommandTerm:o=>E(o),styleSubcommandDescription:o=>f.subtext1(o),styleOptionTerm:o=>f.peach(o),styleOptionDescription:o=>f.subtext1(o),styleArgumentTerm:o=>f.green(o),styleArgumentDescription:o=>f.subtext1(o),styleSubcommandText:o=>E(o),styleOptionText:o=>f.peach(o),styleArgumentText:o=>f.green(o)};function ht(){let o=new U;o.configureHelp(Ht);function t(n,s,r){o.command(n).description(s).action(async(...l)=>{O(),await(await r())(...l.slice(0,-1))})}o.name("osm").description("The CLI for OpenSkill.md \u2014 search, add, score, and explore AI agent skills").version(kt),t("search <query>","Search skills and blueprints by keyword",async()=>(await import("./search-KROHSMVC.js")).searchCommand),t("info <slug>","Show details about a skill or blueprint",async()=>(await import("./info-7CODYQGV.js")).infoCommand),o.command("add <source>").alias("install").description("Add a skill from a source repo (owner/repo or owner/repo@skill)").option("-a, --agent <agent...>","Target coding agent(s) \u2014 may repeat. If omitted, auto-detects installed agents.").option("-g, --global","Add at user scope (~/) instead of project").option("--copy","Copy files instead of symlinking to agent directories").option("--json","Emit a single-line JSON result on stdout (machine-readable)").action(async(n,s)=>{O();let{addCommand:r}=await import("./add-6HD5JXVM.js");await r(n,s)}),t("list","Show installed skills and blueprints in this project",async()=>(await import("./list-T3BOFCW2.js")).listCommand),t("score <filepath>","Score a local SKILL.md file for quality",async()=>(await import("./score-YDX36SCU.js")).scoreCommand),t("init <type>","Scaffold a new skill or blueprint (type: skill | blueprint)",async()=>(await import("./init-DMS3SQYU.js")).initCommand),t("browse","Explore skills by category (interactive)",async()=>(await import("./browse-ZYG3RRU4.js")).browseCommand),t("remove <slug>","Remove an installed skill or blueprint from the project",async()=>(await import("./remove-F65O3ISJ.js")).removeCommand),o.command("router").description("Manage the OpenSkill router skill").command("install").description("Download the OpenSkill router SKILL.md into .skills/").action(async()=>{O();let{routerInstallCommand:n}=await import("./router-ACAGHZ73.js");await n()});let i=o.command("mcp").description("Explore and configure MCP servers");return i.command("setup").description("Print MCP configuration for Claude/Cursor").action(async()=>{O();let{mcpSetupCommand:n}=await import("./mcp-3VMRNDNM.js");await n()}),i.command("info <slug>").description("Show details about an MCP server").action(async n=>{O();let{mcpInfoCommand:s}=await import("./mcp-3VMRNDNM.js");await s(n)}),o.configureOutput({writeOut:n=>process.stderr.write(n),writeErr:n=>process.stderr.write(n)}),o.action(()=>{o.outputHelp()}),o}ht().parseAsync(process.argv).catch(o=>{console.error(o),process.exit(1)});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as y}from"./chunk-
|
|
3
|
+
import{a as y}from"./chunk-K3MPWRF4.js";import{b as x,c as m,e as S,f as v}from"./chunk-C5KG3WI6.js";import"./chunk-YAZPI4SK.js";import{a as p,b as w,c as $,d as l,e as d,f}from"./chunk-AZ56ID7P.js";import{g as u,k as g,l as a,m as s,o as b}from"./chunk-GTRQVB2J.js";async function F(e){let o=y({text:`Fetching info for "${e}"...`,spinner:b,color:!1}).start();try{let r=await S(e);o.stop(),U(r);return}catch(r){if(!(r instanceof m&&r.statusCode===404)){o.fail("Failed to fetch info"),process.stderr.write(f(r instanceof Error?r.message:"Unknown error")+`
|
|
4
4
|
`);return}}try{let r=await v(e);o.stop(),await O(r);return}catch(r){o.stop(),r instanceof m&&r.statusCode===404?process.stderr.write(f(`"${e}" not found.`,`Try ${g("osm search <query>")} to find it.`)+`
|
|
5
5
|
`):process.stderr.write(f(r instanceof Error?r.message:"Unknown error")+`
|
|
6
6
|
`)}}function U(e){process.stdout.write(`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as l,b as p}from"./chunk-AXKAVWKJ.js";import{a as c}from"./chunk-
|
|
3
|
+
import{a as l,b as p}from"./chunk-AXKAVWKJ.js";import{a as c}from"./chunk-KS57GYQM.js";import"./chunk-YAZPI4SK.js";import{f as g,g as d}from"./chunk-AZ56ID7P.js";import{g as f,k as u,m as a}from"./chunk-GTRQVB2J.js";import n from"fs";import h from"path";async function R(e){if(e!=="skill"&&e!=="blueprint"){console.error(g(`Unknown type "${e}".`,`Use ${u("osm init skill")} or ${u("osm init blueprint")}`));return}e==="skill"?await y():await w()}async function y(){let e=await c.prompt([{type:"input",name:"name",message:"Skill name (slug):",validate:t=>{try{return l(t.trim()),!0}catch(o){return o instanceof Error?o.message:"Invalid slug"}}},{type:"input",name:"description",message:"Short description:",validate:t=>t.trim().length>0||"Required"},{type:"input",name:"version",message:"Version:",default:"1.0.0"}]),r=l(e.name.trim()),m=`---
|
|
4
4
|
name: ${r}
|
|
5
5
|
description: ${e.description}
|
|
6
6
|
version: ${e.version}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{e as p,f as u}from"./chunk-
|
|
3
|
+
import{e as p,f as u}from"./chunk-AZ56ID7P.js";import{g as l,k as a,l as c,m as d}from"./chunk-GTRQVB2J.js";import h from"fs";import n from"path";async function k(){let t=process.cwd(),i=n.join(t,".skills"),m=n.join(t,".blueprints"),r=f(i),e=f(m);if(r.length===0&&e.length===0){process.stderr.write(u("No skills or blueprints installed in this project.",`Run ${a("osm search <query>")} to find and install skills.`)+`
|
|
4
4
|
`);return}if(r.length>0){process.stderr.write(p(`Installed Skills (${r.length})`)+`
|
|
5
5
|
`);for(let s of r){let o=n.basename(s,".md");process.stdout.write(` ${l("\u2022")} ${c(o)} ${d(`(.skills/${s})`)}
|
|
6
6
|
`)}}if(e.length>0){process.stderr.write(p(`Installed Blueprints (${e.length})`)+`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as u,b as d,c as f,k as m}from"./chunk-
|
|
3
|
+
import{a as u,b as d,c as f,k as m}from"./chunk-C5KG3WI6.js";import{e as c,f as p}from"./chunk-AZ56ID7P.js";import{g as n,h as a,l,m as e}from"./chunk-GTRQVB2J.js";async function h(){let o={mcpServers:{openskill:{url:`${await u()}/mcp/sse`}}};console.error(c("MCP Server Configuration")),console.error(e(` Add this to your Claude Desktop or Cursor MCP config:
|
|
4
4
|
`)),console.log(JSON.stringify(o,null,2)),console.error(""),console.error(n.bold(" For Claude Desktop:")),console.error(e(" Add to ~/Library/Application Support/Claude/claude_desktop_config.json")),console.error(""),console.error(n.bold(" For Cursor:")),console.error(e(" Add to .cursor/mcp.json in your project root")),console.error(""),console.error(e(" The OpenSkill MCP server gives your AI agent access to the full")),console.error(e(" skill and blueprint registry via tool calls.")),console.error("")}async function b(t){console.error(c(`MCP Server: ${t}`));let o;try{o=await m(t)}catch(r){if(r instanceof f&&r.statusCode===404){let i=await d();process.stderr.write(p(`MCP server "${t}" not found.`,`Browse available servers at ${i}/mcp-servers`)+`
|
|
5
5
|
`);return}process.stderr.write(p(r instanceof Error?r.message:"Unknown error")+`
|
|
6
6
|
`);return}console.error(""),console.error(n.bold(` ${o.displayName||o.name}`)),o.description&&console.error(e(` ${o.description}`)),console.error(""),o.mcpEndpointUrl&&(console.error(a.bold(" Endpoint URL:")),console.error(a(` ${o.mcpEndpointUrl}`)),console.error(""));let s=[];if(o.transportType){let r=o.transportType==="sse"||o.transportType==="streamable-http";s.push(["Transport",r?"Remote (SSE)":"Local install (stdio)"])}o.authType&&s.push(["Auth",o.authType==="none"?"None required":o.authType]),o.verified&&s.push(["Verified","Yes"]),o.status&&s.push(["Status",o.status]),o.stargazerCount!=null&&s.push(["Stars",String(o.stargazerCount)]),o.toolCount&&s.push(["Tools",String(o.toolCount)]),o.primaryLanguage&&s.push(["Language",o.primaryLanguage]),o.category&&s.push(["Category",o.category]);for(let[r,i]of s)console.error(` ${e(`${r}:`)} ${l(i)}`);if(console.error(""),o.installCommand&&(console.error(n.bold(" Install:")),console.error(l(` ${o.installCommand}`)),console.error("")),o.toolNames&&o.toolNames.length>0){console.error(n.bold(" Tools:"));for(let r of o.toolNames.slice(0,20))console.error(e(` - ${r}`));o.toolNames.length>20&&console.error(e(` ... and ${o.toolNames.length-20} more`)),console.error("")}if(o.mcpEndpointUrl){console.error(n.bold(" Config JSON (Claude Desktop / Cursor):"));let r={mcpServers:{[o.slug]:{url:o.mcpEndpointUrl}}};console.log(JSON.stringify(r,null,2)),console.error("")}else o.githubUrl&&(console.error(n.bold(" GitHub:")),console.error(l(` ${o.githubUrl}`)),console.error(""))}export{b as mcpInfoCommand,h as mcpSetupCommand};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as p,b as m}from"./chunk-AXKAVWKJ.js";import{f as n,g as o}from"./chunk-
|
|
3
|
+
import{a as p,b as m}from"./chunk-AXKAVWKJ.js";import{f as n,g as o}from"./chunk-AZ56ID7P.js";import{k as d}from"./chunk-GTRQVB2J.js";import s from"fs";import t from"path";async function h(e){try{e=p(e)}catch(a){process.stderr.write(n(a instanceof Error?a.message:"Invalid slug")+`
|
|
4
4
|
`);return}let r=process.cwd(),l=t.join(r,".skills",`${e}.md`),c=t.join(r,".blueprints",`${e}.md`),i=!1;s.existsSync(l)&&(m(t.join(r,".skills"),`${e}.md`),s.unlinkSync(l),process.stderr.write(o(`Removed skill "${e}" from .skills/`)+`
|
|
5
5
|
`),i=!0),s.existsSync(c)&&(m(t.join(r,".blueprints"),`${e}.md`),s.unlinkSync(c),process.stderr.write(o(`Removed blueprint "${e}" from .blueprints/`)+`
|
|
6
6
|
`),i=!0),i||process.stderr.write(n(`"${e}" is not installed.`,`Run ${d("osm list")} to see installed skills and blueprints.`)+`
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
+
import{a}from"./chunk-K3MPWRF4.js";import{b as m}from"./chunk-C5KG3WI6.js";import"./chunk-YAZPI4SK.js";import{f as c,g as d}from"./chunk-AZ56ID7P.js";import{g as t,l,m as o,o as i}from"./chunk-GTRQVB2J.js";import u from"fs";import p from"path";async function I(){let s=a({text:"Downloading OpenSkill router...",spinner:i,color:!1}).start();try{let r=await m(),e=await fetch(`${r}/skills/router/SKILL.md`);if(!e.ok)throw new Error(`Failed to download router SKILL.md (HTTP ${e.status})`);let f=await e.text(),n=p.join(process.cwd(),".skills");u.mkdirSync(n,{recursive:!0});let h=p.join(n,"openskill-router.md");u.writeFileSync(h,f,"utf-8"),s.stop(),console.error(d("Installed OpenSkill router to .skills/openskill-router.md")),console.error(""),console.error(t.bold(" What is the router?")),console.error(o(" The router skill teaches your AI agent how to discover and install")),console.error(o(" skills on-demand from the OpenSkill registry.")),console.error(""),console.error(t.bold(" How to use:")),console.error(l(' Point your agent at the file: "Read .skills/openskill-router.md"')),console.error(o(" The agent will then automatically search for relevant skills as needed.")),console.error("")}catch(r){s.fail("Failed to install router"),console.error(c(r instanceof Error?r.message:"Unknown error"))}}export{I as routerInstallCommand};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{b as l,c as m,e as d,f as u}from"./chunk-
|
|
3
|
+
import{b as l,c as m,e as d,f as u}from"./chunk-AZ56ID7P.js";import{h as p,i as f}from"./chunk-GTRQVB2J.js";import g from"fs";function h(s){let t=[],e=A(s,t),o=w(s,t),r=$(s,t),a=k(s,t);return{overall:e+o+r+a,format:e,structure:o,security:r,specificity:a,suggestions:t}}function A(s,t){let e=0,o=s.split(`
|
|
4
4
|
`);if(s.startsWith("---")){let n=s.indexOf("---",3);if(n>3){let c=s.slice(3,n).trim(),v=/^name:/m.test(c),S=/^description:/m.test(c),b=/^version:/m.test(c);v?e+=3:t.push("Add a 'name' field to your YAML frontmatter"),S?e+=3:t.push("Add a 'description' field to your YAML frontmatter"),b?e+=2:t.push("Add a 'version' field to your YAML frontmatter"),e+=4}else t.push("Your YAML frontmatter is not properly closed with '---'")}else t.push("Add YAML frontmatter at the top of your SKILL.md (between --- delimiters)");let a=o.some(n=>/^# /.test(n)),i=o.some(n=>/^## /.test(n));return a?e+=4:t.push("Add a top-level heading (# Title)"),i?e+=3:t.push("Add section headings (## Section)"),/```[\s\S]*?```/.test(s)&&(e+=3),o.some(n=>/^\s*[-*]\s/.test(n)||/^\s*\d+\.\s/.test(n))&&(e+=3),Math.min(e,25)}function w(s,t){let e=0,o=[{pattern:/when to use/i,name:"When to Use",points:5},{pattern:/workflow|process|steps/i,name:"Workflow",points:5},{pattern:/rules|guidelines|constraints/i,name:"Rules/Guidelines",points:5}];for(let i of o)i.pattern.test(s)?e+=i.points:t.push(`Add a '${i.name}' section to improve structure`);let r=s.match(/^##?\s+.+$/gm)||[];r.length>=3?e+=4:r.length>=2?e+=2:t.push("Add more sections to organize your content (aim for 3+ headings)");let a=s.split(/\s+/).length;return a>=500?e+=3:a>=200?e+=2:t.push("Expand your content \u2014 aim for at least 500 words for a comprehensive skill"),/examples?/i.test(s)?e+=3:t.push("Add an 'Examples' section with concrete usage scenarios"),Math.min(e,25)}function $(s,t){let e=25,o=[{pattern:/(?:api[_-]?key|secret|password|token)\s*[:=]\s*['"][^'"]+['"]/gi,name:"hardcoded secrets",penalty:8},{pattern:/rm\s+-rf\s+\//g,name:"dangerous rm -rf / commands",penalty:8},{pattern:/eval\s*\(/g,name:"eval() usage",penalty:5},{pattern:/sudo\s+/g,name:"sudo commands",penalty:3},{pattern:/chmod\s+777/g,name:"chmod 777 permissions",penalty:5},{pattern:/curl.*\|\s*(ba)?sh/g,name:"piping curl to shell",penalty:5}];for(let r of o)r.pattern.test(s)&&(e-=r.penalty,t.push(`Security concern: contains ${r.name}`));return/environment\s*variable|env\s+var|\$\{?\w+\}?/i.test(s)&&!/hardcod/i.test(s)&&(e=Math.min(e+2,25)),/sanitiz|validat|escape|safe/i.test(s)&&(e=Math.min(e+2,25)),Math.max(e,0)}function k(s,t){let e=0,o=s.match(/```[\s\S]*?```/g)||[];return o.length>=3?e+=6:o.length>=1?e+=3:t.push("Add code examples to make your skill more actionable"),/for example|e\.g\.|such as|here's|consider this/i.test(s)?e+=4:t.push("Add concrete examples with phrases like 'For example...' or 'Here's how...'"),/\.\w{2,4}\b/.test(s)&&/file|path|directory|folder/i.test(s)&&(e+=3),/do not|don't|avoid|never|always|must|should not/i.test(s)?e+=4:t.push("Add clear do's and don'ts (use 'Always...', 'Never...', 'Avoid...')"),/output|result|returns|produces|generates/i.test(s)&&(e+=3),/edge case|corner case|error|exception|fallback|handle/i.test(s)?e+=3:t.push("Document edge cases and error handling scenarios"),s.split(/\s+/).length>=1e3&&(e+=2),Math.min(e,25)}async function D(s){if(!g.existsSync(s)){console.error(u(`File not found: ${s}`,"Provide a path to a SKILL.md file."));return}let t=g.readFileSync(s,"utf-8");if(t.trim().length===0){console.error(u("File is empty."));return}let e=h(t);console.error(d(`Score: ${s}`));let o=[{label:"Format",score:e.format,max:25},{label:"Structure",score:e.structure,max:25},{label:"Security",score:e.security,max:25},{label:"Specificity",score:e.specificity,max:25}];for(let r of o)console.error(` ${r.label.padEnd(14)} ${m(r.score,r.max)} ${l(r.score,r.max)}/${r.max}`);if(console.error(""),console.error(` ${"Overall".padEnd(14)} ${m(e.overall,100)} ${l(e.overall,100)}/100`),e.suggestions.length>0){console.error(d("Suggestions"));for(let r of e.suggestions)console.error(` ${f("\u2192")} ${r}`)}else console.error(""),console.error(p(" \u2728 Great job! No suggestions for improvement."));console.error(""),console.log(JSON.stringify(e))}export{D as scoreCommand};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as k}from"./chunk-
|
|
3
|
+
import{a as k}from"./chunk-K3MPWRF4.js";import{d as C,e as P,f as x}from"./chunk-C5KG3WI6.js";import"./chunk-YAZPI4SK.js";import{a as w,b as v,d as $,e as d,f as h}from"./chunk-AZ56ID7P.js";import{g as n,m as t,o as S}from"./chunk-GTRQVB2J.js";async function A(p){let b=k({text:`Searching for "${p}"...`,spinner:S,color:!1}).start();try{let s=await C(p);b.stop();let a=s.mcpServers??[];if(s.skills.length+s.blueprints.length+a.length===0){process.stderr.write(h(`No results found for "${p}".`)+`
|
|
4
4
|
`),process.stderr.write(t(` \u2192 Try broader search terms or run ${n("osm browse")} to explore categories.
|
|
5
5
|
`)+`
|
|
6
6
|
`);return}if(s.skills.length>0){process.stderr.write(d(`Skills (${s.skills.length})`)+`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openskillmd",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "The OpenSkill CLI (osm) — search, add, score, and explore AI agent skills from your terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -19,8 +19,10 @@
|
|
|
19
19
|
"lint:fix": "biome check --write .",
|
|
20
20
|
"test": "vitest run",
|
|
21
21
|
"prepublishOnly": "pnpm run build",
|
|
22
|
-
"publish:beta": "node scripts/publish
|
|
23
|
-
"publish:beta:dry": "node scripts/publish
|
|
22
|
+
"publish:beta": "node scripts/publish.mjs --tag beta",
|
|
23
|
+
"publish:beta:dry": "node scripts/publish.mjs --tag beta --dry-run",
|
|
24
|
+
"publish:latest": "node scripts/publish.mjs --tag latest",
|
|
25
|
+
"publish:latest:dry": "node scripts/publish.mjs --tag latest --dry-run"
|
|
24
26
|
},
|
|
25
27
|
"keywords": [
|
|
26
28
|
"openskill",
|
package/dist/chunk-ONVELHE6.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{f as c,g as e,h as o,i,l as u}from"./chunk-OVTYCRA4.js";function a(r){return r?.verificationStatus==="verified"?e(" \u2713 verified"):""}function d(r,n){let t=r/n;return t>=.8?e(String(r)):t>=.6?o(String(r)):i(String(r))}function l(r,n){let t=Math.round(r/n*20),f=20-t,s=r/n;return(s>=.8?e:s>=.6?o:i)("\u2588".repeat(t))+u("\u2591".repeat(f))}function m(r){return r?r>=1e3?`${(r/1e3).toFixed(1)}k`:String(r):"0"}function x(r){return c.bold(`
|
|
4
|
-
${r}
|
|
5
|
-
${"\u2500".repeat(r.length)}
|
|
6
|
-
`)}function b(r,n){let t=i(` \u2716 ${r}`);return n&&(t+=u(`
|
|
7
|
-
\u2192 ${n}`)),t}function S(r){return e(` \u2714 ${r}`)}function v(r){process.stdout.write(JSON.stringify(r)+`
|
|
8
|
-
`)}export{a,d as b,l as c,m as d,x as e,b as f,S as g,v as h};
|
package/dist/chunk-OVTYCRA4.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
var k=Object.create;var O=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var G=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var se=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var le=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ie=(r,e)=>{for(var t in e)O(r,t,{get:e[t],enumerable:!0})},D=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of P(e))!Y.call(r,n)&&n!==t&&O(r,n,{get:()=>e[n],enumerable:!(o=L(e,n))||o.enumerable});return r};var ce=(r,e,t)=>(t=r!=null?k(G(r)):{},D(e||!r||!r.__esModule?O(t,"default",{value:r,enumerable:!0}):t,r));var v=(r=0)=>e=>`\x1B[${e+r}m`,E=(r=0)=>e=>`\x1B[${38+r};5;${e}m`,N=(r=0)=>(e,t,o)=>`\x1B[${38+r};2;${e};${t};${o}m`,l={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]}},ue=Object.keys(l.modifier),$=Object.keys(l.color),U=Object.keys(l.bgColor),fe=[...$,...U];function V(){let r=new Map;for(let[e,t]of Object.entries(l)){for(let[o,n]of Object.entries(t))l[o]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},t[o]=l[o],r.set(n[0],n[1]);Object.defineProperty(l,e,{value:t,enumerable:!1})}return Object.defineProperty(l,"codes",{value:r,enumerable:!1}),l.color.close="\x1B[39m",l.bgColor.close="\x1B[49m",l.color.ansi=v(),l.color.ansi256=E(),l.color.ansi16m=N(),l.bgColor.ansi=v(10),l.bgColor.ansi256=E(10),l.bgColor.ansi16m=N(10),Object.defineProperties(l,{rgbToAnsi256:{value(e,t,o){return e===t&&t===o?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(o/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[o]=t;o.length===3&&(o=[...o].map(c=>c+c).join(""));let n=Number.parseInt(o,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:e=>l.rgbToAnsi256(...l.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,o,n;if(e>=232)t=((e-232)*10+8)/255,o=t,n=t;else{e-=16;let A=e%36;t=Math.floor(e/36)/5,o=Math.floor(A/6)/5,n=A%6/5}let c=Math.max(t,o,n)*2;if(c===0)return 30;let a=30+(Math.round(n)<<2|Math.round(o)<<1|Math.round(t));return c===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,o)=>l.ansi256ToAnsi(l.rgbToAnsi256(e,t,o)),enumerable:!1},hexToAnsi:{value:e=>l.ansi256ToAnsi(l.hexToAnsi256(e)),enumerable:!1}}),l}var K=V(),f=K;import T from"process";import W from"os";import B from"tty";function u(r,e=globalThis.Deno?globalThis.Deno.args:T.argv){let t=r.startsWith("-")?"":r.length===1?"-":"--",o=e.indexOf(t+r),n=e.indexOf("--");return o!==-1&&(n===-1||o<n)}var{env:i}=T,g;u("no-color")||u("no-colors")||u("color=false")||u("color=never")?g=0:(u("color")||u("colors")||u("color=true")||u("color=always"))&&(g=1);function z(){if("FORCE_COLOR"in i)return i.FORCE_COLOR==="true"?1:i.FORCE_COLOR==="false"?0:i.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(i.FORCE_COLOR,10),3)}function H(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function q(r,{streamIsTTY:e,sniffFlags:t=!0}={}){let o=z();o!==void 0&&(g=o);let n=t?g:o;if(n===0)return 0;if(t){if(u("color=16m")||u("color=full")||u("color=truecolor"))return 3;if(u("color=256"))return 2}if("TF_BUILD"in i&&"AGENT_NAME"in i)return 1;if(r&&!e&&n===void 0)return 0;let c=n||0;if(i.TERM==="dumb")return c;if(T.platform==="win32"){let a=W.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in i)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in i)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in i)||i.CI_NAME==="codeship"?1:c;if("TEAMCITY_VERSION"in i)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(i.TEAMCITY_VERSION)?1:0;if(i.COLORTERM==="truecolor"||i.TERM==="xterm-kitty"||i.TERM==="xterm-ghostty"||i.TERM==="wezterm")return 3;if("TERM_PROGRAM"in i){let a=Number.parseInt((i.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(i.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(i.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(i.TERM)||"COLORTERM"in i?1:c}function M(r,e={}){let t=q(r,{streamIsTTY:r&&r.isTTY,...e});return H(t)}var J={stdout:M({isTTY:B.isatty(1)}),stderr:M({isTTY:B.isatty(2)})},I=J;function S(r,e,t){let o=r.indexOf(e);if(o===-1)return r;let n=e.length,c=0,a="";do a+=r.slice(c,o)+e+t,c=o+n,o=r.indexOf(e,c);while(o!==-1);return a+=r.slice(c),a}function F(r,e,t,o){let n=0,c="";do{let a=r[o-1]==="\r";c+=r.slice(n,a?o-1:o)+e+(a?`\r
|
|
4
|
-
`:`
|
|
5
|
-
`)+t,n=o+1,o=r.indexOf(`
|
|
6
|
-
`,n)}while(o!==-1);return c+=r.slice(n),c}var{stdout:_,stderr:w}=I,C=Symbol("GENERATOR"),b=Symbol("STYLER"),d=Symbol("IS_EMPTY"),j=["ansi","ansi","ansi256","ansi16m"],p=Object.create(null),Q=(r,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let t=_?_.level:0;r.level=e.level===void 0?t:e.level};var X=r=>{let e=(...t)=>t.join(" ");return Q(e,r),Object.setPrototypeOf(e,m.prototype),e};function m(r){return X(r)}Object.setPrototypeOf(m.prototype,Function.prototype);for(let[r,e]of Object.entries(f))p[r]={get(){let t=x(this,y(e.open,e.close,this[b]),this[d]);return Object.defineProperty(this,r,{value:t}),t}};p.visible={get(){let r=x(this,this[b],!0);return Object.defineProperty(this,"visible",{value:r}),r}};var R=(r,e,t,...o)=>r==="rgb"?e==="ansi16m"?f[t].ansi16m(...o):e==="ansi256"?f[t].ansi256(f.rgbToAnsi256(...o)):f[t].ansi(f.rgbToAnsi(...o)):r==="hex"?R("rgb",e,t,...f.hexToRgb(...o)):f[t][r](...o),Z=["rgb","hex","ansi256"];for(let r of Z){p[r]={get(){let{level:t}=this;return function(...o){let n=y(R(r,j[t],"color",...o),f.color.close,this[b]);return x(this,n,this[d])}}};let e="bg"+r[0].toUpperCase()+r.slice(1);p[e]={get(){let{level:t}=this;return function(...o){let n=y(R(r,j[t],"bgColor",...o),f.bgColor.close,this[b]);return x(this,n,this[d])}}}}var ee=Object.defineProperties(()=>{},{...p,level:{enumerable:!0,get(){return this[C].level},set(r){this[C].level=r}}}),y=(r,e,t)=>{let o,n;return t===void 0?(o=r,n=e):(o=t.openAll+r,n=e+t.closeAll),{open:r,close:e,openAll:o,closeAll:n,parent:t}},x=(r,e,t)=>{let o=(...n)=>re(o,n.length===1?""+n[0]:n.join(" "));return Object.setPrototypeOf(o,ee),o[C]=r,o[b]=e,o[d]=t,o},re=(r,e)=>{if(r.level<=0||!e)return r[d]?"":e;let t=r[b];if(t===void 0)return e;let{openAll:o,closeAll:n}=t;if(e.includes("\x1B"))for(;t!==void 0;)e=S(e,t.close,t.open),t=t.parent;let c=e.indexOf(`
|
|
7
|
-
`);return c!==-1&&(e=F(e,n,o,c)),o+e+n};Object.defineProperties(m.prototype,p);var te=m(),Ce=m({level:w?w.level:0});var s=te;var h={rosewater:s.hex("#f5e0dc"),flamingo:s.hex("#f2cdcd"),pink:s.hex("#f5c2e7"),mauve:s.hex("#cba6f7"),red:s.hex("#f38ba8"),maroon:s.hex("#eba0ac"),peach:s.hex("#fab387"),yellow:s.hex("#f9e2af"),green:s.hex("#a6e3a1"),teal:s.hex("#94e2d5"),sky:s.hex("#89dceb"),sapphire:s.hex("#74c7ec"),blue:s.hex("#89b4fa"),lavender:s.hex("#b4befe"),text:s.hex("#cdd6f4"),subtext1:s.hex("#bac2de"),subtext0:s.hex("#a6adc8"),overlay2:s.hex("#9399b2"),overlay1:s.hex("#7f849c"),overlay0:s.hex("#6c7086"),surface2:s.hex("#585b70"),surface1:s.hex("#45475a"),surface0:s.hex("#313244"),base:s.hex("#1e1e2e"),mantle:s.hex("#181825"),crust:s.hex("#11111b")},oe=h.mauve,Ae=h.green,ve=h.yellow,Ee=h.red,Ne=h.teal,Be=h.text,Me=h.overlay1,Ie=h.overlay0,Se=h.surface2,ne=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],Fe={interval:80,frames:ne.map(r=>oe(r))};export{se as a,le as b,ie as c,ce as d,s as e,oe as f,Ae as g,ve as h,Ee as i,Ne as j,Be as k,Me as l,Se as m,Fe as n};
|
package/dist/router-AVHY4U3G.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a}from"./chunk-IZJHFL7T.js";import{b as m}from"./chunk-5CDG6OB7.js";import"./chunk-YAZPI4SK.js";import{f as c,g as d}from"./chunk-ONVELHE6.js";import{f as t,k as l,l as o,n as i}from"./chunk-OVTYCRA4.js";import u from"fs";import p from"path";async function I(){let s=a({text:"Downloading OpenSkill router...",spinner:i,color:!1}).start();try{let r=await m(),e=await fetch(`${r}/skills/router/SKILL.md`);if(!e.ok)throw new Error(`Failed to download router SKILL.md (HTTP ${e.status})`);let f=await e.text(),n=p.join(process.cwd(),".skills");u.mkdirSync(n,{recursive:!0});let h=p.join(n,"openskill-router.md");u.writeFileSync(h,f,"utf-8"),s.stop(),console.error(d("Installed OpenSkill router to .skills/openskill-router.md")),console.error(""),console.error(t.bold(" What is the router?")),console.error(o(" The router skill teaches your AI agent how to discover and install")),console.error(o(" skills on-demand from the OpenSkill registry.")),console.error(""),console.error(t.bold(" How to use:")),console.error(l(' Point your agent at the file: "Read .skills/openskill-router.md"')),console.error(o(" The agent will then automatically search for relevant skills as needed.")),console.error("")}catch(r){s.fail("Failed to install router"),console.error(c(r instanceof Error?r.message:"Unknown error"))}}export{I as routerInstallCommand};
|