skill-creator 1.5.1 → 1.5.2
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 +173 -103
- package/dist/buildIndex-B_9ABRtx.mjs +2 -0
- package/dist/buildIndex-B_9ABRtx.mjs.map +1 -0
- package/dist/buildIndex-Cea97e0l.mjs +1 -0
- package/dist/cli.d.mts +0 -0
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +17 -33
- package/dist/cli.mjs.map +1 -1
- package/dist/contentManager-CoVTiSDT.mjs +13 -0
- package/dist/contentManager-CoVTiSDT.mjs.map +1 -0
- package/dist/contentManager-CwquwC1s.mjs +1 -0
- package/dist/context7-BejCCqkm.mjs +1 -0
- package/dist/context7-BxMpyQiW.mjs +2 -0
- package/dist/context7-BxMpyQiW.mjs.map +1 -0
- package/dist/index.d.mts +317 -123
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -20
- package/dist/index.mjs.map +1 -1
- package/dist/{listContext7-DKXzgWdn.mjs → listContext7-DHj9AL-z.mjs} +2 -2
- package/dist/{listContext7-DKXzgWdn.mjs.map → listContext7-DHj9AL-z.mjs.map} +1 -1
- package/dist/package-CFJazwTO.mjs +2 -0
- package/dist/package-CFJazwTO.mjs.map +1 -0
- package/dist/referenceSearchUtils-DZgupMZp.mjs +2 -0
- package/dist/referenceSearchUtils-DZgupMZp.mjs.map +1 -0
- package/dist/removeContext7-BZtL4_CJ.mjs +3 -0
- package/dist/{removeContext7-DOXrTXeI.mjs.map → removeContext7-BZtL4_CJ.mjs.map} +1 -1
- package/dist/{removeSkill-C-ehFexk.mjs → removeSkill-Bat_plVG.mjs} +4 -4
- package/dist/removeSkill-Bat_plVG.mjs.map +1 -0
- package/dist/removeSkill-DjDZjhJU.mjs +1 -0
- package/dist/runScript-CSKqb831.mjs +13 -0
- package/dist/runScript-CSKqb831.mjs.map +1 -0
- package/dist/scopeSelection-BWteJQSv.mjs +2 -0
- package/dist/scopeSelection-BWteJQSv.mjs.map +1 -0
- package/dist/searchQuality-DVdHmamh.mjs +2 -0
- package/dist/searchQuality-DVdHmamh.mjs.map +1 -0
- package/dist/search_format-RyjXACJa.mjs +5 -0
- package/dist/search_format-RyjXACJa.mjs.map +1 -0
- package/dist/shared-DsVh4gOV.mjs +2 -0
- package/dist/shared-DsVh4gOV.mjs.map +1 -0
- package/dist/skillCreator-BomXoqdw.mjs +2 -0
- package/dist/skillCreator-BomXoqdw.mjs.map +1 -0
- package/dist/skillMdManager-DGBZ6M5J.mjs +7 -0
- package/dist/skillMdManager-DGBZ6M5J.mjs.map +1 -0
- package/dist/sqliteVectorSearchAdapter-56kZjbUT.mjs +28 -0
- package/dist/sqliteVectorSearchAdapter-56kZjbUT.mjs.map +1 -0
- package/dist/sqliteVectorSearchAdapter-DNkyKuZs.mjs +1 -0
- package/dist/unifiedSearch-CLdazMYU.mjs +4 -0
- package/dist/unifiedSearch-CLdazMYU.mjs.map +1 -0
- package/dist/unifiedSearch-DCFPrtzZ.mjs +1 -0
- package/package.json +32 -28
- package/templates/SKILL.md +19 -4
- package/templates/SKILL.zh-CN.md +54 -12
- package/templates/skill-creator.md +52 -19
- package/templates/skill-creator.zh-CN.md +55 -22
- package/dist/chunk-Da8dvM5T.mjs +0 -1
- package/dist/contentManager-8rmWJMb6.mjs +0 -22
- package/dist/contentManager-8rmWJMb6.mjs.map +0 -1
- package/dist/contentManager-Xt8N5psY.mjs +0 -1
- package/dist/dist-DZL34HNo.mjs +0 -8
- package/dist/dist-DZL34HNo.mjs.map +0 -1
- package/dist/dist-X_kVEzbK.mjs +0 -1
- package/dist/esm-8qfZdcpd.mjs +0 -33
- package/dist/esm-8qfZdcpd.mjs.map +0 -1
- package/dist/esm-BF5pvSbc.mjs +0 -1
- package/dist/esm-BbhxxeGF.mjs +0 -4
- package/dist/esm-BbhxxeGF.mjs.map +0 -1
- package/dist/package-Cxx_VSyD.mjs +0 -2
- package/dist/package-Cxx_VSyD.mjs.map +0 -1
- package/dist/path-CuoiIaIe.mjs +0 -2
- package/dist/path-CuoiIaIe.mjs.map +0 -1
- package/dist/removeContext7-DOXrTXeI.mjs +0 -3
- package/dist/removeSkill-C-ehFexk.mjs.map +0 -1
- package/dist/removeSkill-DWwhvzej.mjs +0 -1
- package/dist/runScript-Cr9RRN9y.mjs +0 -14
- package/dist/runScript-Cr9RRN9y.mjs.map +0 -1
- package/dist/search_format-DIs-1lKk.mjs +0 -5
- package/dist/search_format-DIs-1lKk.mjs.map +0 -1
- package/dist/shared-CFoY2Xhg.mjs +0 -2
- package/dist/shared-CFoY2Xhg.mjs.map +0 -1
- package/dist/skillMdManager-DP8fGZb7.mjs +0 -7
- package/dist/skillMdManager-DP8fGZb7.mjs.map +0 -1
- package/dist/unifiedSearch-CGZXw0NB.mjs +0 -1
- package/dist/unifiedSearch-l-lrSc9C.mjs +0 -4
- package/dist/unifiedSearch-l-lrSc9C.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,36 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
3
|
-
|
|
4
|
-
`+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
|
|
5
|
-
`)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),m=n((e=>{let{InvalidArgumentError:t}=d();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.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(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r===void 0?!1:r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
|
|
6
|
-
- a short flag is a single dash and a single character
|
|
7
|
-
- either use a single dash and a single character (for a short flag)
|
|
8
|
-
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`):r.test(t)?Error(`${n}
|
|
9
|
-
- too many short flags`):i.test(t)?Error(`${n}
|
|
10
|
-
- too many long flags`):Error(`${n}
|
|
11
|
-
- unrecognised flag format`)}if(t===void 0&&n===void 0)throw Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}e.Option=n,e.DualOptions=r})),h=n((e=>{function t(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let t=0;t<=e.length;t++)n[t]=[t];for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=t.length;r++)for(let i=1;i<=e.length;i++){let a=1;a=e[i-1]===t[r-1]?0:1,n[i][r]=Math.min(n[i-1][r]+1,n[i][r-1]+1,n[i-1][r-1]+a),i>1&&r>1&&e[i-1]===t[r-2]&&e[i-2]===t[r-1]&&(n[i][r]=Math.min(n[i][r],n[i-2][r-2]+1))}return n[e.length][t.length]}function n(e,n){if(!n||n.length===0)return``;n=Array.from(new Set(n));let r=e.startsWith(`--`);r&&(e=e.slice(2),n=n.map(e=>e.slice(2)));let i=[],a=3;return n.forEach(n=>{if(n.length<=1)return;let r=t(e,n),o=Math.max(e.length,n.length);(o-r)/o>.4&&(r<a?(a=r,i=[n]):r===a&&i.push(n))}),i.sort((e,t)=>e.localeCompare(t)),r&&(i=i.map(e=>`--${e}`)),i.length>1?`\n(Did you mean one of ${i.join(`, `)}?)`:i.length===1?`\n(Did you mean ${i[0]}?)`:``}e.suggestSimilar=n})),g=n((e=>{let n=t(`node:events`).EventEmitter,r=t(`node:child_process`),i=t(`node:path`),a=t(`node:fs`),o=t(`node:process`),{Argument:s,humanReadableArgName:c}=f(),{CommanderError:l}=d(),{Help:u,stripColor:g}=p(),{Option:_,DualOptions:v}=m(),{suggestSimilar:y}=h();var b=class e extends n{constructor(e){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=e||``,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=>o.stdout.write(e),writeErr:e=>o.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>o.stdout.isTTY?o.stdout.columns:void 0,getErrHelpWidth:()=>o.stderr.isTTY?o.stderr.columns:void 0,getOutHasColors:()=>S()??(o.stdout.isTTY&&o.stdout.hasColors?.()),getErrHasColors:()=>S()??(o.stderr.isTTY&&o.stderr.hasColors?.()),stripColor:e=>g(e)},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(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,i=n;typeof r==`object`&&r&&(i=r,r=null),i||={};let[,a,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(a);return r&&(s.description(r),s._executableHandler=!0),i.isDefault&&(this._defaultCommandName=s._name),s._hidden=!!(i.noHelp||i.hidden),s._executableFile=i.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),r?this:s}createCommand(t){return new e(t)}createHelp(){return Object.assign(new u,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!=`string`&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
|
|
12
|
-
- specify the name in Command constructor or using .name()`);return t||={},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new s(e,t)}argument(e,t,n,r){let i=this.createArgument(e,t);return typeof n==`function`?i.default(r).argParser(n):i.default(n),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t?.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e==`boolean`)return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let[,n,r]=(e??`help [command]`).match(/([^ ]+) *(.*)/),i=t??`display help for command`,a=this.createCommand(n);return a.helpOption(!1),r&&a.arguments(r),i&&a.description(i),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||t)&&this._initCommandGroup(a),this}addHelpCommand(e,t){return typeof e==`object`?(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this):(this.helpCommand(e,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(e,t){let n=[`preSubcommand`,`preAction`,`postAction`];if(!n.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
|
|
13
|
-
Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=e=>{if(e.code!==`commander.executeSubCommandAsync`)throw e},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new l(e,t,n)),o.exit(e)}action(e){return this._actionHandler=t=>{let n=this.registeredArguments.length,r=t.slice(0,n);return this._storeOptionsAsProperties?r[n]=this:r[n]=this.opts(),r.push(this),e.apply(this,r)},this}createOption(e,t){return new _(e,t)}_callParseArg(e,t,n,r){try{return e.parseArg(t,n)}catch(e){if(e.code===`commander.invalidArgument`){let t=`${r} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
|
|
14
|
-
- already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=e=>[e.name()].concat(e.aliases()),n=t(e).find(e=>this._findCommand(e));if(n){let r=t(this._findCommand(n)).join(`|`),i=t(e).join(`|`);throw Error(`cannot add command '${i}' as already have command '${r}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let t=e.long.replace(/^--no-/,`--`);this._findOption(t)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,`default`)}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,`default`);let r=(t,r,i)=>{t==null&&e.presetArg!==void 0&&(t=e.presetArg);let a=this.getOptionValue(n);t!==null&&e.parseArg?t=this._callParseArg(e,t,a,r):t!==null&&e.variadic&&(t=e._collectValue(t,a)),t??=e.negate?!1:e.isBoolean()||e.optional?!0:``,this.setOptionValueWithSource(n,t,i)};return this.on(`option:`+t,t=>{r(t,`error: option '${e.flags}' argument '${t}' is invalid.`,`cli`)}),e.envVar&&this.on(`optionEnv:`+t,t=>{r(t,`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`,`env`)}),this}_optionEx(e,t,n,r,i){if(typeof t==`object`&&t instanceof _)throw Error(`To add an Option object use addOption() instead of option() or requiredOption()`);let a=this.createOption(t,n);if(a.makeOptionMandatory(!!e.mandatory),typeof r==`function`)a.default(i).argParser(r);else if(r instanceof RegExp){let e=r;r=(t,n)=>{let r=e.exec(t);return r?r[0]:n},a.default(i).argParser(r)}else a.default(r);return this.addOption(a)}option(e,t,n,r){return this._optionEx({},e,t,n,r)}requiredOption(e,t,n,r){return this._optionEx({mandatory:!0},e,t,n,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,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(e=!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=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw Error(`first parameter to parse must be array or undefined`);if(t||={},e===void 0&&t.from===void 0){o.versions?.electron&&(t.from=`electron`);let e=o.execArgv??[];(e.includes(`-e`)||e.includes(`--eval`)||e.includes(`-p`)||e.includes(`--print`))&&(t.from=`eval`)}e===void 0&&(e=o.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case`node`:this._scriptPath=e[1],n=e.slice(2);break;case`electron`:o.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case`user`:n=e.slice(0);break;case`eval`:n=e.slice(1);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||`program`,n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),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 Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
15
|
-
- 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(e,t,n){if(a.existsSync(e))return;let r=`'${e}' does not exist
|
|
16
|
-
- if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
17
|
-
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
18
|
-
- ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let n=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function c(e,t){let n=i.resolve(e,t);if(a.existsSync(n))return n;if(s.includes(i.extname(t)))return;let r=s.find(e=>a.existsSync(`${n}${e}`));if(r)return`${n}${r}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=a.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=i.resolve(i.dirname(e),d)}if(d){let t=c(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=i.basename(this._scriptPath,i.extname(this._scriptPath));n!==this._name&&(t=c(d,`${n}-${e._name}`))}u=t||u}n=s.includes(i.extname(u));let f;o.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=x(o.execArgv).concat(t),f=r.spawn(o.execPath,t,{stdio:`inherit`})):n?(t.unshift(u),t=x(o.execArgv).concat(t),f=r.spawn(o.argv[0],t,{stdio:`inherit`})):f=r.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{o.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e??=1,p?p(new l(e,`commander.executeSubCommandAsync`,`(close)`)):o.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)o.exit(1);else{let e=new l(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)===void 0?!1:this.getOptionValueSource(t)!==`default`});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-\d*\.?\d+(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
19
|
-
`),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in o.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,o.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new v(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=y(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=y(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t||=`-V, --version`,n||=`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>c(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=i.basename(e,i.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e||={};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(o.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
|
|
20
|
-
Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function x(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function S(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=b,e.useColor=S}));const{program:_,createCommand:v,createArgument:y,createOption:b,CommanderError:x,InvalidArgumentError:S,InvalidOptionArgumentError:C,Command:w,Argument:T,Option:E,Help:D}=e(n((e=>{let{Argument:t}=f(),{Command:n}=g(),{CommanderError:r,InvalidArgumentError:i}=d(),{Help:a}=p(),{Option:o}=m();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default;async function O(e){let t=new r;console.log(a(`cyan`,`magenta`)(`
|
|
21
|
-
🚀 Creating skill...`));let n=await t.createSkill(e);if(n.created)return console.log(a(`green`,`cyan`)(`\n✅ ${n.message}`)),console.log(a(`blue`,`cyan`)(`📍 Skill Path: ${n.skillPath}`)),console.log(`
|
|
2
|
+
import{t as e}from"./package-CFJazwTO.mjs";import{t}from"./skillCreator-BomXoqdw.mjs";import{a as n,i as r,o as i,r as a,t as o}from"./scopeSelection-BWteJQSv.mjs";import s from"node:path";import{Command as c}from"commander";import l from"gradient-string";async function u(e,n={}){let r=new t;n.json||console.log(l(`cyan`,`magenta`)(`
|
|
3
|
+
🚀 Creating skill...`));let i=await r.createSkill(e);if(i.created)return n.json||(console.log(l(`green`,`cyan`)(`\n✅ ${i.message}`)),console.log(l(`blue`,`cyan`)(`📍 Skill Path: ${i.skillPath}`)),console.log(`
|
|
22
4
|
🎉 Skill created successfully!`),console.log(`
|
|
23
|
-
Next steps:`),console.log(`1. Add content: skill-creator add-skill --pwd "${
|
|
24
|
-
Final Configuration:`),console.log(`- Storage location: ${
|
|
25
|
-
🔍 Searching in skill...`)),console.log(`Skill Path: ${n}`),console.log(`Query: ${e}`);let{chdir:r}=await import(`node:process`),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
5
|
+
Next steps:`),console.log(`1. Add content: skill-creator add-skill --pwd "${i.skillPath}" --title "My Note" --content "Your content"`),console.log(`2. Search skill: skill-creator search-skill --pwd "${i.skillPath}" "query"`),console.log(`3. Download docs: skill-creator download-context7 --pwd "${i.skillPath}"`),console.log(`4. Resolve Context7 id explicitly when needed: skill-creator resolve-context7 <package-name> [--package-version <version>]`)),i.skillPath;throw Error(i.message||`Failed to create skill`)}const d=`Skill creation cancelled.`;async function f(e,t,r){let i=r.cwd??process.cwd(),{scope:c,interactive:l,force:u,description:f,name:p,skillName:m}=t,h=m||p||e;if(l){if(console.log(`Skill Creation Configuration:`),!c&&(c=(await r.prompt.prompt([{type:`list`,name:`scope`,message:`Where would you like to store this skill?`,choices:[{name:`Current directory (./.claude/skills/)`,value:`current`},{name:`User home directory (~/.claude/skills)`,value:`user`},...r.prompt.Separator?[new r.prompt.Separator]:[],{name:`Custom directory`,value:`custom`}],default:o(i)}])).scope,c===`custom`)){let e=await r.prompt.prompt([{type:`input`,name:`scope`,message:`Directory to store skills`,validate:e=>e.trim()!==``||`Directory cannot be empty`}]);c=s.join(i,e.scope)}if(!m){let{packageNameConfirmed:e}=await r.prompt.prompt([{type:`confirm`,name:`packageNameConfirmed`,message:`Use '${h}' as the visible skill name?`,default:!0}]);if(!e){let{customSkillName:e}=await r.prompt.prompt([{type:`input`,name:`customSkillName`,message:`Enter the skill name:`,validate:e=>e.trim()!==``||`Skill name cannot be empty`}]);h=e.trim()}}if(!f){let{customDescription:e}=await r.prompt.prompt([{type:`input`,name:`customDescription`,message:`Enter the skill description:`}]);f=e.trim()}}if(c==null)throw Error(`Error: --scope is required. Use --scope current, --scope user, or --scope auto.`);let{requestedScope:g,resolvedScope:_,scopePath:v}=a(c,i);if(l){console.log(`
|
|
6
|
+
Final Configuration:`),console.log(`- Storage location: ${v}`),console.log(`- Skill directory name: ${e}`),console.log(`- Visible Skill Name: ${h}`),console.log(`- Skill Description: ${f}`);let{confirmFinal:t}=await r.prompt.prompt([{type:`confirm`,name:`confirmFinal`,message:`Proceed with skill creation?`,default:!0}]);if(!t)throw Error(d)}let y=p??h,b=n(e);return{createOptions:{baseDir:v,skillDirname:e,skillName:h,skillDescription:f,sourcePackageName:y,sourcePackageVersionHint:b,force:u},summary:{requestedScope:g,resolvedScope:_,scopePath:v,skillDirName:e,skillName:h,sourcePackageName:y,sourcePackageVersionHint:b,skillDescription:f}}}const p=new c;let m={};p.name(`skill-creator`).description(`Create claude-code-skills with documentation management`).version(e.getCurrentPackageInfo()?.version??`0.0.0`).option(`--pwd <path>`,`Global path to the skill directory (used for all commands)`),p.hook(`preAction`,e=>{m.pwd=e.opts().pwd}),p.command(`create-cc-skill`).option(`--interactive`,`Enable interactive confirmation prompts`).option(`--scope <scope>`,`Storage scope (user, current, or auto), or a custom directory to store skills`).option(`--name <name>`,`Source package name stored in SKILL.md for later package-aware workflows`).option(`--skill-name <name>`,`Visible skill name used in SKILL.md and JSON output`).option(`--description <description>`,`Custom description for the skill`).option(`--force`,`Force overwrite existing files in the skill directory`).option(`--json`,`Print machine-readable creation output`).argument(`<skill_dir_name>`,`The name of the skill directory to create`).action(async(e,t)=>{try{let{default:n}=await import(`inquirer`),r=await f(e,t,{cwd:process.cwd(),prompt:{prompt:n.prompt.bind(n),Separator:n.Separator}}),i=await u(r.createOptions,{json:t.json});t.json?console.log(JSON.stringify({skillPath:i,requestedScope:r.summary.requestedScope,resolvedScope:r.summary.resolvedScope,scopePath:r.summary.scopePath,skillDirName:r.summary.skillDirName,skillName:r.summary.skillName,sourcePackageName:r.summary.sourcePackageName,sourcePackageVersionHint:r.summary.sourcePackageVersionHint??``,skillDescription:r.summary.skillDescription??``},null,2)):console.log(`Skill created successfully at: ${i}`)}catch(e){e instanceof Error&&e.message===d&&(console.log(e.message),process.exit(0)),console.error(`Error:`,e instanceof Error?e.stack??e.message:String(e)),process.exit(1)}}),p.command(`init`).description(`Install skill-creator as subagent (interactive mode)`).option(`--scope <scope>`,`Storage scope (user, current, or auto)`).option(`--json`,`Print machine-readable installation output`).action(async e=>{let{runScript:t}=await import(`./runScript-CSKqb831.mjs`),n=[];e.scope&&n.push(`--scope`,e.scope),e.json&&n.push(`--json`),await t(`init`,n)}),p.command(`init-cc`).description(`Install skill-creator as subagent in ~/.claude/agents/`).option(`--json`,`Print machine-readable installation output`).action(async e=>{let{runScript:t}=await import(`./runScript-CSKqb831.mjs`),n=[`--scope`,`user`];e.json&&n.push(`--json`),await t(`init`,n)}),p.command(`search`).argument(`<keywords>`,`Search keywords for npm packages`).option(`-l, --limit <limit>`,`Number of results to show`,`10`).action(async(t,n)=>{let r=t,i=await e.suggestPackages(r,{limit:parseInt(n.limit)});console.log(JSON.stringify(i,null,2))}),p.command(`get-info`).argument(`<package_name>`,`The npm package name to get information for`).action(async t=>{let n=await e.getPackageInfo(t);n||(console.error(`❌ Package "${t}" not found or API error occurred.`),process.exit(1));let r=n.version,i={skill_dir_name:e.createSkillFolderName(t,r),name:n.name,version:r,description:n.description||``,keywords:n.keywords||[],license:n.license||``,author:n.author||``,maintainers:n.maintainers||[],homepage:n.homepage||``,repo:n.repository?.url||``,repository:{url:n.repository?.url||``,type:n.repository?.type||``},bugs:{url:n.bugs?.url||``},funding:n.funding||``,scripts:n.scripts||{},engines:n.engines||{},types:n.types||``,dependencies:n.dependencies||{},devDependencies:n.devDependencies||{},time:{created:n.time?.created||``,modified:n.time?.modified||``}};console.log(JSON.stringify(i,null,2))}),p.command(`resolve-context7`).description(`Resolve the best Context7 library id for an npm package`).argument(`<package_name>`,`The npm package name to resolve against Context7`).option(`--package-version <version>`,`Explicit package version to use in the Context7 query`).option(`-l, --limit <limit>`,`Number of candidates to keep in the response`,`5`).action(async(e,t)=>{let{Context7Utils:n}=await import(`./context7-BejCCqkm.mjs`),r=await n.resolveLibrary(e,{version:t.packageVersion,limit:parseInt(t.limit,10)});r||(console.error(`❌ No Context7 library found for package "${e}".`),process.exit(1)),console.log(JSON.stringify(r,null,2))}),p.command(`search-skill`).argument(`<query>`,`Search query`).option(`--pwd <path>`,`Path to the skill directory`).option(`--package <name>`,`Package name to find skill directory for`).option(`--mode <mode>`,`Search mode: auto, fulltext, fuzzy, or vector`,`auto`).option(`--vector-embedder <mode>`,`Vector embedder mode: deterministic for offline local embeddings, or omit for the default runtime embedder`).option(`--list`,`Show simplified list view (basic info only)`,!1).action(async(e,t)=>{try{let n=i(t,m);console.log(l(`cyan`,`magenta`)(`
|
|
7
|
+
🔍 Searching in skill...`)),console.log(`Skill Path: ${n}`),console.log(`Query: ${e}`);let{chdir:r}=await import(`node:process`),a=process.cwd();r(n);try{let{runScript:n}=await import(`./runScript-CSKqb831.mjs`),r=[`--query`,e];t.mode!==`auto`&&r.push(`--mode`,t.mode),t.vectorEmbedder&&r.push(`--vector-embedder`,t.vectorEmbedder),t.list&&r.push(`--list`),await n(`search-skill`,r)}finally{r(a)}}catch(e){console.error(e),process.exit(1)}}),p.command(`download-context7`).argument(`[project_id]`,`Context7 library ID`).option(`--pwd <path>`,`Path to the skill directory`).option(`--package <name>`,`Package name to find skill directory for`).option(`--package-version <version>`,`Version hint used when resolving a Context7 library from --package`).option(`-f, --force`,`Force update even if up to date`).option(`--skip-indexing`,`Skip automatic local index building after download`).option(`--json`,`Print machine-readable download output`).action(async(e,t)=>{try{let a=i(t,m),o=e,s,c,u;if(!o){let e=r(a),i=t.package||e.packageName,d=t.packageVersion||e.versionHint||n(a);i||(console.error(`❌ Please provide either a Context7 project ID, --package <name>, or a skill created with package metadata`),process.exit(1));let{Context7Utils:f}=await import(`./context7-BejCCqkm.mjs`);t.json||(console.log(l(`cyan`,`magenta`)(`
|
|
8
|
+
🧭 Resolving Context7 library...`)),console.log(`Package: ${i}`),d&&console.log(`Version hint: ${d}`));let p=await f.resolveLibrary(i,{version:d});p||(console.error(`❌ No Context7 library found for package "${i}".`),process.exit(1)),o=p.bestMatch.id,s=p.query,c=i,u=p.version??d,t.json||(console.log(`Resolved Context7 ID: ${o}`),console.log(`Resolution query: ${p.query}`))}t.json||(console.log(l(`cyan`,`magenta`)(`
|
|
9
|
+
📥 Downloading Context7 documentation...`)),console.log(`Skill Path: ${a}`),console.log(`Context7 ID: ${o}`));let{chdir:d}=await import(`node:process`),f=process.cwd();d(a);try{let{runScript:n}=await import(`./runScript-CSKqb831.mjs`),r=[];t.force&&r.push(`--force`),t.skipIndexing&&r.push(`--skip-indexing`),t.json&&r.push(`--json`),c&&r.push(`--package-name`,c),u&&r.push(`--package-version`,u),r.push(`--project-id`,o);let i=await n(`download-context7`,r);t.json&&console.log(JSON.stringify({skillPath:a,requestedProjectId:e??null,resolvedProjectId:o,resolvedPackageName:c??null,resolvedVersionHint:u??null,resolutionQuery:s??null,...i},null,2))}finally{d(f)}t.json||console.log(l(`green`,`cyan`)(`
|
|
10
|
+
✅ Documentation downloaded and sliced!`))}catch(e){console.error(e),process.exit(1)}}),p.command(`add-skill`).option(`--pwd <path>`,`Path to the skill directory`).option(`--package <name>`,`Package name to find skill directory for`).option(`-t, --title <title>`,`Content title`).option(`-c, --content <content>`,`Content text`).option(`-f, --file <file>`,`Read content from file`).option(`--force`,`Replace the closest matching user knowledge note`).option(`--force-append`,`Append content as a knowledge update in the closest matching user note`).option(`--json`,`Print machine-readable add-content output`).action(async e=>{!e.title&&!e.file&&(console.error(`❌ Please provide either --title or --file`),process.exit(1));try{let t=i(e,m);e.json||(console.log(l(`cyan`,`magenta`)(`
|
|
11
|
+
📝 Adding content to skill...`)),console.log(`Skill Path: ${t}`));let{chdir:n}=await import(`node:process`),r=process.cwd();n(t);try{let{runScript:n}=await import(`./runScript-CSKqb831.mjs`),r=[];e.title&&r.push(`--title`,e.title),e.content&&r.push(`--content`,e.content),e.file&&r.push(`--file`,e.file),e.force&&r.push(`--force`),e.forceAppend&&r.push(`--force-append`),e.json&&r.push(`--json`);let i=await n(`add`,r);e.json&&console.log(JSON.stringify({skillPath:t,...i},null,2))}finally{n(r)}}catch(e){console.error(e),process.exit(1)}}),p.command(`build-index`).description(`Build or refresh the local search index for a skill`).option(`--pwd <path>`,`Path to the skill directory`).option(`--package <name>`,`Package name to find skill directory for`).option(`--mode <mode>`,`Index mode: auto, fulltext, or vector`,`auto`).option(`--vector-embedder <mode>`,`Vector embedder mode: deterministic for offline local embeddings, or omit for the default runtime embedder`).option(`--json`,`Print machine-readable index build output`).action(async e=>{try{let t=i(e,m);e.json||(console.log(l(`cyan`,`magenta`)(`
|
|
12
|
+
🔧 Building search index...`)),console.log(`Skill Path: ${t}`));let{chdir:n}=await import(`node:process`),r=process.cwd();n(t);try{let{buildIndex:n}=await import(`./buildIndex-Cea97e0l.mjs`),r=[];e.mode!==`auto`&&r.push(`--mode`,e.mode),e.vectorEmbedder&&r.push(`--vector-embedder`,e.vectorEmbedder),e.json&&r.push(`--json`);let i=await n(r);e.json&&console.log(JSON.stringify({skillPath:t,...i},null,2))}finally{n(r)}e.json||console.log(l(`green`,`cyan`)(`
|
|
13
|
+
✅ Search index ready!`))}catch(e){console.error(e),process.exit(1)}}),p.command(`list-skills`).description(`List all skill content files`).option(`--pwd <path>`,`Path to the skill directory`).option(`--package <name>`,`Package name to find skill directory for`).action(async e=>{try{let t=i(e,m);console.log(l(`cyan`,`magenta`)(`
|
|
14
|
+
📚 Skill Content`)),console.log(`Skill Path: ${t}`);let{chdir:n}=await import(`node:process`),r=process.cwd();n(t);try{let{runScript:t}=await import(`./runScript-CSKqb831.mjs`);await t(`list-skills`,process.argv.slice(3).filter(t=>!t.startsWith(`--pwd`)&&!t.startsWith(`--package`)&&t!==e.pwd&&t!==e.package))}finally{n(r)}}catch(e){console.error(e),process.exit(1)}}),p.command(`remove-skill`).description(`Remove a skill file`).option(`--pwd <path>`,`Path to the skill directory`).option(`--package <name>`,`Package name to find skill directory for`).option(`--type <type>`,`Type: user or context7:<project_id>`,`user`).option(`--file <file>`,`File name to remove`).action(async e=>{try{e.file||(console.error(`❌ Please provide --file <filename>`),process.exit(1));let t=i(e,m);console.log(l(`cyan`,`magenta`)(`
|
|
15
|
+
🗑️ Remove Skill File`)),console.log(`Skill Path: ${t}`),console.log(`Type: ${e.type}`),console.log(`File: ${e.file}`);let{chdir:n}=await import(`node:process`),r=process.cwd();n(t);try{let{removeSkill:t}=await import(`./removeSkill-DjDZjhJU.mjs`);await t([`--type`,e.type,`--file`,e.file])}finally{n(r)}console.log(l(`green`,`cyan`)(`
|
|
16
|
+
✅ Skill file removed!`))}catch(e){console.error(e),process.exit(1)}}),p.command(`list-context7`).description(`List all Context7 projects`).option(`--pwd <path>`,`Path to the skill directory`).option(`--package <name>`,`Package name to find skill directory for`).action(async e=>{try{let t=i(e,m);console.log(l(`cyan`,`magenta`)(`
|
|
17
|
+
📦 Context7 Projects`)),console.log(`Skill Path: ${t}`);let{chdir:n}=await import(`node:process`),r=process.cwd();n(t);try{let{listContext7:e}=await import(`./listContext7-DHj9AL-z.mjs`);await e()}finally{n(r)}}catch(e){console.error(e),process.exit(1)}}),p.command(`remove-context7`).argument(`<project_id>`,`Context7 project ID to remove`).description(`Remove a Context7 project`).option(`--pwd <path>`,`Path to the skill directory`).option(`--package <name>`,`Package name to find skill directory for`).action(async(e,t)=>{try{let n=i(t,m);console.log(l(`cyan`,`magenta`)(`
|
|
18
|
+
🗑️ Remove Context7 Project`)),console.log(`Skill Path: ${n}`),console.log(`Project ID: ${e}`);let{chdir:r}=await import(`node:process`),a=process.cwd();r(n);try{let{removeContext7:t}=await import(`./removeContext7-BZtL4_CJ.mjs`);await t([`--project-id`,e])}finally{r(a)}console.log(l(`green`,`cyan`)(`
|
|
19
|
+
✅ Context7 project removed!`))}catch(e){console.error(e),process.exit(1)}}),p.parse();export{p as program};
|
|
36
20
|
//# sourceMappingURL=cli.mjs.map
|