@shell-shock/preset-script 0.5.0 → 0.6.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 CHANGED
@@ -27,7 +27,7 @@ This package is part of the ⚡<b>Shell Shock</b> monorepo. The Shell Shock pack
27
27
 
28
28
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
29
29
 
30
- [![Version](https://img.shields.io/badge/version-0.3.3-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://stormsoftware.com/projects/shell-shock/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/shell-shock/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
30
+ [![Version](https://img.shields.io/badge/version-0.4.2-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://stormsoftware.com/projects/shell-shock/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/shell-shock/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
31
31
 
32
32
  <!-- prettier-ignore-start -->
33
33
  <!-- markdownlint-disable -->
@@ -14,6 +14,8 @@ let __stryke_path_replace = require("@stryke/path/replace");
14
14
  let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
15
15
  let defu = require("defu");
16
16
  defu = require_rolldown_runtime.__toESM(defu);
17
+ let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
18
+ let __powerlines_plugin_alloy_core_components_single_line_comment = require("@powerlines/plugin-alloy/core/components/single-line-comment");
17
19
  let __shell_shock_core_components_options_parser_logic = require("@shell-shock/core/components/options-parser-logic");
18
20
  let __stryke_path_find = require("@stryke/path/find");
19
21
  let __stryke_path_join = require("@stryke/path/join");
@@ -188,7 +190,160 @@ function CommandEntry(props) {
188
190
  (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_core_components_options_parser_logic.OptionsInterfaceDeclaration, { command }),
189
191
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
190
192
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
191
- (0, __alloy_js_core_jsx_runtime.createComponent)(CommandHandlerDeclaration, { command })
193
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_single_line_comment.SingleLineComment, { children: __alloy_js_core.code`Validate required options and arguments` }),
194
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
195
+ (0, __alloy_js_core_jsx_runtime.createComponent)(CommandHandlerDeclaration, {
196
+ command,
197
+ get children() {
198
+ return [
199
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
200
+ name: "failures",
201
+ type: "string[]",
202
+ initializer: __alloy_js_core.code`[];`
203
+ }),
204
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
205
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
206
+ get each() {
207
+ return Object.values(command.options ?? {});
208
+ },
209
+ doubleHardline: true,
210
+ children: (option) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
211
+ get when() {
212
+ return !option.optional;
213
+ },
214
+ get children() {
215
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
216
+ get condition() {
217
+ return __alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}`;
218
+ },
219
+ get children() {
220
+ return __alloy_js_core.code`failures.push("Missing required \\"${option.name}\\" option");`;
221
+ }
222
+ }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
223
+ get when() {
224
+ return (option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && option.variadic;
225
+ },
226
+ get children() {
227
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
228
+ get condition() {
229
+ return __alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0`;
230
+ },
231
+ get children() {
232
+ return __alloy_js_core.code`failures.push("No values were provided to the required \\"${option.name}\\" array option");`;
233
+ }
234
+ });
235
+ }
236
+ })];
237
+ }
238
+ }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
239
+ get when() {
240
+ return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
241
+ },
242
+ get children() {
243
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
244
+ get when() {
245
+ return option.variadic;
246
+ },
247
+ get fallback() {
248
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
249
+ get condition() {
250
+ return __alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} && Number.isNaN(options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`})`;
251
+ },
252
+ get children() {
253
+ return __alloy_js_core.code`failures.push("Invalid numeric value provided for the \\"${option.name}\\" option");`;
254
+ }
255
+ });
256
+ },
257
+ get children() {
258
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
259
+ get condition() {
260
+ return __alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}.some(value => Number.isNaN(value))`;
261
+ },
262
+ get children() {
263
+ return __alloy_js_core.code`failures.push("Invalid numeric value provided in the \\"${option.name}\\" array option");`;
264
+ }
265
+ });
266
+ }
267
+ });
268
+ }
269
+ })]
270
+ }),
271
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
272
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
273
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
274
+ get each() {
275
+ return command.arguments;
276
+ },
277
+ doubleHardline: true,
278
+ children: (argument) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
279
+ get when() {
280
+ return !argument.optional;
281
+ },
282
+ get children() {
283
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
284
+ get condition() {
285
+ return __alloy_js_core.code`!${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}`;
286
+ },
287
+ get children() {
288
+ return __alloy_js_core.code`failures.push("Missing required \\"${argument.name}\\" positional argument");`;
289
+ }
290
+ }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
291
+ get when() {
292
+ return (argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && argument.variadic;
293
+ },
294
+ get children() {
295
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
296
+ get condition() {
297
+ return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.length === 0`;
298
+ },
299
+ get children() {
300
+ return __alloy_js_core.code`failures.push("No values were provided to the required \\"${argument.name}\\" array positional argument");`;
301
+ }
302
+ });
303
+ }
304
+ })];
305
+ }
306
+ }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
307
+ get when() {
308
+ return argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
309
+ },
310
+ get children() {
311
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
312
+ get when() {
313
+ return argument.variadic;
314
+ },
315
+ get fallback() {
316
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
317
+ get condition() {
318
+ return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} && Number.isNaN(${(0, __stryke_string_format_camel_case.camelCase)(argument.name)})`;
319
+ },
320
+ get children() {
321
+ return __alloy_js_core.code`failures.push("Invalid numeric value provided for the \\"${argument.name}\\" positional argument");`;
322
+ }
323
+ });
324
+ },
325
+ get children() {
326
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
327
+ get condition() {
328
+ return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.some(value => Number.isNaN(value))`;
329
+ },
330
+ get children() {
331
+ return __alloy_js_core.code`failures.push("Invalid numeric value provided in the \\"${argument.name}\\" array positional argument");`;
332
+ }
333
+ });
334
+ }
335
+ });
336
+ }
337
+ })]
338
+ }),
339
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
340
+ condition: __alloy_js_core.code`failures.length > 0`,
341
+ children: __alloy_js_core.code`error(colors.text.message.description.error("The following validation failures were found while processing the user provided input, and must be corrected before the command line process can be executed: \\n\\n") + failures.map(failure => colors.text.body.secondary(" - " + failure)).join("\\n"));
342
+ options.help = true; `
343
+ })
344
+ ];
345
+ }
346
+ })
192
347
  ];
193
348
  }
194
349
  })), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
@@ -1 +1 @@
1
- {"version":3,"file":"command-entry.cjs","names":["code","computed","For","Show","ElseClause","FunctionDeclaration","IfStatement","VarDeclaration","usePowerlines","EntryFile","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","CommandParserLogic","OptionsInterfaceDeclaration","getAppBin","getDynamicPathSegmentName","isDynamicPathSegment","findFilePath","relativePath","joinPaths","replaceExtension","camelCase","constantCase","kebabCase","pascalCase","defu","BannerFunctionDeclaration","CommandHelp","IsDebug","VirtualCommandEntry","CommandInvocation","props","command","_$createComponent","name","initializer","segments","map","segment","join","_$createIntrinsic","_$memo","arguments","length","argument","CommandHandlerDeclaration","children","context","heading","title","description","replace","async","parameters","type","default","envPrefix","config","isCaseSensitive","condition","Object","values","options","option","CommandEntry","imports","builtinImports","rest","filePath","filter","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$mergeProps","path","env","console","utils","each","child","when","isVirtual","fallback"],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport {\n ElseClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport {\n CommandParserLogic,\n OptionsInterfaceDeclaration\n} from \"@shell-shock/core/components/options-parser-logic\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { CommandHelp } from \"./help\";\nimport { IsDebug } from \"./helpers\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport function CommandInvocation(props: { command: CommandTree }) {\n const { command } = props;\n\n return (\n <>\n <VarDeclaration\n name=\"__context\"\n initializer={code`{ path: \\`${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `\\${${camelCase(getDynamicPathSegmentName(segment))}}`\n : segment\n )\n .join(\"/\")}\\`, segments: [${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? camelCase(getDynamicPathSegmentName(segment))\n : `\"${segment}\"`\n )\n .join(\", \")}] }`}\n />\n <hbr />\n <hbr />\n {code`\n\n internal_commandContext.call(__context, () => {\n return Promise.resolve(Reflect.apply(handle${pascalCase(\n command.name\n )}, __context, [options${\n command.arguments.length > 0\n ? `, ${command.arguments\n .map(argument => camelCase(argument.name))\n .join(\", \")}`\n : \"\"\n }]));\n });\n\n `}\n <hbr />\n </>\n );\n}\n\nexport interface CommandHandlerDeclarationProps {\n command: CommandTree;\n children?: Children;\n}\n\n/**\n * A component that generates the `handler` function declaration for a command.\n */\nexport function CommandHandlerDeclaration(\n props: CommandHandlerDeclarationProps\n) {\n const { command, children } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <OptionsInterfaceDeclaration command={command} />\n <hbr />\n <hbr />\n <TSDoc\n heading={`The ${command.title} (${getAppBin(context)} ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `[${constantCase(getDynamicPathSegmentName(segment))}]`\n : segment\n )\n .join(\" \")}) command.`}>\n <TSDocRemarks>{`${command.description.replace(/\\.+$/, \"\")}.`}</TSDocRemarks>\n <hbr />\n <TSDocTitle>{command.title}</TSDocTitle>\n <TSDocParam name=\"args\">{`The command-line arguments passed to the command.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"handler\"\n parameters={[{ name: \"args\", type: \"string[]\", default: \"getArgs()\" }]}>\n <CommandParserLogic\n command={command}\n envPrefix={context.config.envPrefix}\n isCaseSensitive={context.config.isCaseSensitive}\n />\n <hbr />\n <hbr />\n {code`writeLine(\"\");\n banner(); `}\n <hbr />\n <hbr />\n <IfStatement condition={<IsDebug />}>\n {code`\n writeLine(\"\");\n writeLine(colors.text.body.tertiary(\"Debug mode is enabled. Additional debug information may be logged to the console.\"));\n\n writeLine(\"\");\n debug(\\`Command path: ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `\\${${camelCase(getDynamicPathSegmentName(segment))}}`\n : segment\n )\n .join(\" / \")} \\\\n\\\\nOptions: \\\\n${Object.values(command.options)\n .map(\n option =>\n ` - ${kebabCase(option.name)}: \\${options.${camelCase(\n option.name\n )} === undefined ? \"\" : JSON.stringify(options.${camelCase(\n option.name\n )})}`\n )\n .join(\"\\\\n\")}${\n command.arguments.length > 0\n ? ` \\\\n\\\\nArguments: \\\\n${command.arguments\n .map(\n argument =>\n ` - ${kebabCase(argument.name)}: \\${${camelCase(\n argument.name\n )} === undefined ? \"\" : JSON.stringify(${camelCase(\n argument.name\n )})}`\n )\n .join(\"\\\\n\")}`\n : \"\"\n }\\`); `}\n </IfStatement>\n <hbr />\n <hbr />\n {children}\n <hbr />\n <hbr />\n <IfStatement condition={code`options.help`}>\n <CommandHelp command={command} />\n </IfStatement>\n <ElseClause>\n <hbr />\n <CommandInvocation command={command} />\n </ElseClause>\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n const commandSourcePath = computed(() =>\n replaceExtension(\n relativePath(\n joinPaths(context.entryPath, findFilePath(filePath.value)),\n command.entry.input?.file || command.entry.file\n )\n )\n );\n const typeDefinition = computed(() => ({\n ...command.entry,\n output: command.id\n }));\n\n return (\n <>\n <EntryFile\n {...rest}\n path={filePath.value}\n typeDefinition={typeDefinition.value}\n imports={defu(imports ?? {}, {\n [commandSourcePath.value]: `handle${pascalCase(command.name)}`\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isCI\", \"isDevelopment\", \"isDebug\"],\n console: [\n \"debug\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\n \"getArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <OptionsInterfaceDeclaration command={command} />\n <hbr />\n <hbr />\n <CommandHandlerDeclaration command={command} />\n </EntryFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback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A;KACA;KACA;KACD;IACDC,OAAO;KACL;KACA;KACA;KACA;KACA;KAAyB;IAE5B,CAAC;;EAAA,IAAArC,WAAA;AAAA,UAAA;qDACDpB,0EAAyB,EAAUM,SAAO,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAG1CnB,gFAA2B,EAAUmB,SAAO,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAG5Ca,2BAAyB,EAAUb,SAAO,CAAA;IAAA;;EAAA,CAAA,CAAA,mDAE5ChC,qBAAG;EAAA,IAACoF,OAAI;AAAA,UAAExB,OAAOC,OAAO7B,QAAQc,SAAS;;EAAAA,WACvCuC,2DACEpF,sBAAI;GAAA,IACHqF,OAAI;AAAA,WAAED,MAAME;;GAAS,IACrBC,WAAQ;AAAA,4DAAGxB,cAAY,EAAChC,SAASqD,OAAK,CAAA;;GAAA,IAAAvC,WAAA;AAAA,4DACrCjB,8DAAmB,EAACG,SAASqD,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
1
+ {"version":3,"file":"command-entry.cjs","names":["code","computed","For","Show","ElseClause","ElseIfClause","FunctionDeclaration","IfStatement","VarDeclaration","ReflectionKind","SingleLineComment","usePowerlines","EntryFile","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","CommandParserLogic","OptionsInterfaceDeclaration","getAppBin","getDynamicPathSegmentName","isDynamicPathSegment","findFilePath","relativePath","joinPaths","replaceExtension","camelCase","constantCase","kebabCase","pascalCase","defu","BannerFunctionDeclaration","CommandHelp","IsDebug","VirtualCommandEntry","CommandInvocation","props","command","_$createComponent","name","initializer","segments","map","segment","join","_$createIntrinsic","_$memo","arguments","length","argument","CommandHandlerDeclaration","children","context","heading","title","description","replace","async","parameters","type","default","envPrefix","config","isCaseSensitive","condition","Object","values","options","option","CommandEntry","imports","builtinImports","rest","filePath","filter","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$mergeProps","path","env","console","utils","each","doubleHardline","when","optional","includes","kind","string","number","variadic","fallback","child","isVirtual"],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport {\n ElseClause,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { SingleLineComment } from \"@powerlines/plugin-alloy/core/components/single-line-comment\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport {\n CommandParserLogic,\n OptionsInterfaceDeclaration\n} from \"@shell-shock/core/components/options-parser-logic\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type {\n CommandTree,\n NumberCommandArgument,\n NumberCommandOption\n} from \"@shell-shock/core/types/command\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { CommandHelp } from \"./help\";\nimport { IsDebug } from \"./helpers\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport function CommandInvocation(props: { command: CommandTree }) {\n const { command } = props;\n\n return (\n <>\n <VarDeclaration\n name=\"__context\"\n initializer={code`{ path: \\`${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `\\${${camelCase(getDynamicPathSegmentName(segment))}}`\n : segment\n )\n .join(\"/\")}\\`, segments: [${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? camelCase(getDynamicPathSegmentName(segment))\n : `\"${segment}\"`\n )\n .join(\", \")}] }`}\n />\n <hbr />\n <hbr />\n {code`\n\n internal_commandContext.call(__context, () => {\n return Promise.resolve(Reflect.apply(handle${pascalCase(\n command.name\n )}, __context, [options${\n command.arguments.length > 0\n ? `, ${command.arguments\n .map(argument => camelCase(argument.name))\n .join(\", \")}`\n : \"\"\n }]));\n });\n\n `}\n <hbr />\n </>\n );\n}\n\nexport interface CommandHandlerDeclarationProps {\n command: CommandTree;\n children?: Children;\n}\n\n/**\n * A component that generates the `handler` function declaration for a command.\n */\nexport function CommandHandlerDeclaration(\n props: CommandHandlerDeclarationProps\n) {\n const { command, children } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <OptionsInterfaceDeclaration command={command} />\n <hbr />\n <hbr />\n <TSDoc\n heading={`The ${command.title} (${getAppBin(context)} ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `[${constantCase(getDynamicPathSegmentName(segment))}]`\n : segment\n )\n .join(\" \")}) command.`}>\n <TSDocRemarks>{`${command.description.replace(/\\.+$/, \"\")}.`}</TSDocRemarks>\n <hbr />\n <TSDocTitle>{command.title}</TSDocTitle>\n <TSDocParam name=\"args\">{`The command-line arguments passed to the command.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"handler\"\n parameters={[{ name: \"args\", type: \"string[]\", default: \"getArgs()\" }]}>\n <CommandParserLogic\n command={command}\n envPrefix={context.config.envPrefix}\n isCaseSensitive={context.config.isCaseSensitive}\n />\n <hbr />\n <hbr />\n {code`writeLine(\"\");\n banner(); `}\n <hbr />\n <hbr />\n <IfStatement condition={<IsDebug />}>\n {code`\n writeLine(\"\");\n writeLine(colors.text.body.tertiary(\"Debug mode is enabled. Additional debug information may be logged to the console.\"));\n\n writeLine(\"\");\n debug(\\`Command path: ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `\\${${camelCase(getDynamicPathSegmentName(segment))}}`\n : segment\n )\n .join(\" / \")} \\\\n\\\\nOptions: \\\\n${Object.values(command.options)\n .map(\n option =>\n ` - ${kebabCase(option.name)}: \\${options.${camelCase(\n option.name\n )} === undefined ? \"\" : JSON.stringify(options.${camelCase(\n option.name\n )})}`\n )\n .join(\"\\\\n\")}${\n command.arguments.length > 0\n ? ` \\\\n\\\\nArguments: \\\\n${command.arguments\n .map(\n argument =>\n ` - ${kebabCase(argument.name)}: \\${${camelCase(\n argument.name\n )} === undefined ? \"\" : JSON.stringify(${camelCase(\n argument.name\n )})}`\n )\n .join(\"\\\\n\")}`\n : \"\"\n }\\`); `}\n </IfStatement>\n <hbr />\n <hbr />\n {children}\n <hbr />\n <hbr />\n <IfStatement condition={code`options.help`}>\n <CommandHelp command={command} />\n </IfStatement>\n <ElseClause>\n <hbr />\n <CommandInvocation command={command} />\n </ElseClause>\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n const commandSourcePath = computed(() =>\n replaceExtension(\n relativePath(\n joinPaths(context.entryPath, findFilePath(filePath.value)),\n command.entry.input?.file || command.entry.file\n )\n )\n );\n const typeDefinition = computed(() => ({\n ...command.entry,\n output: command.id\n }));\n\n return (\n <>\n <EntryFile\n {...rest}\n path={filePath.value}\n typeDefinition={typeDefinition.value}\n imports={defu(imports ?? {}, {\n [commandSourcePath.value]: `handle${pascalCase(command.name)}`\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isCI\", \"isDevelopment\", \"isDebug\"],\n console: [\n \"debug\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\n \"getArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <OptionsInterfaceDeclaration command={command} />\n <hbr />\n <hbr />\n <SingleLineComment>{code`Validate required options and arguments`}</SingleLineComment>\n <hbr />\n <CommandHandlerDeclaration command={command}>\n <VarDeclaration\n name=\"failures\"\n type=\"string[]\"\n initializer={code`[];`}\n />\n <hbr />\n <For each={Object.values(command.options ?? {})} doubleHardline>\n {option => (\n <>\n <Show when={!option.optional}>\n <IfStatement\n condition={code`!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }`}>\n {code`failures.push(\"Missing required \\\\\"${option.name}\\\\\" option\");`}\n </IfStatement>\n <Show\n when={\n (option.kind === ReflectionKind.string ||\n option.kind === ReflectionKind.number) &&\n option.variadic\n }>\n <ElseIfClause\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0`}>\n {code`failures.push(\"No values were provided to the required \\\\\"${\n option.name\n }\\\\\" array option\");`}\n </ElseIfClause>\n </Show>\n </Show>\n <Show when={option.kind === ReflectionKind.number}>\n <Show\n when={(option as NumberCommandOption).variadic}\n fallback={\n <IfStatement\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } && Number.isNaN(options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n })`}>\n {code`failures.push(\"Invalid numeric value provided for the \\\\\"${\n option.name\n }\\\\\" option\");`}\n </IfStatement>\n }>\n <IfStatement\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.some(value => Number.isNaN(value))`}>\n {code`failures.push(\"Invalid numeric value provided in the \\\\\"${\n option.name\n }\\\\\" array option\");`}\n </IfStatement>\n </Show>\n </Show>\n </>\n )}\n </For>\n <hbr />\n <hbr />\n <For each={command.arguments} doubleHardline>\n {argument => (\n <>\n <Show when={!argument.optional}>\n <IfStatement condition={code`!${camelCase(argument.name)}`}>\n {code`failures.push(\"Missing required \\\\\"${\n argument.name\n }\\\\\" positional argument\");`}\n </IfStatement>\n <Show\n when={\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n }>\n <ElseIfClause\n condition={code`${camelCase(argument.name)}.length === 0`}>\n {code`failures.push(\"No values were provided to the required \\\\\"${\n argument.name\n }\\\\\" array positional argument\");`}\n </ElseIfClause>\n </Show>\n </Show>\n <Show when={argument.kind === ReflectionKind.number}>\n <Show\n when={(argument as NumberCommandArgument).variadic}\n fallback={\n <IfStatement\n condition={code`${camelCase(\n argument.name\n )} && Number.isNaN(${camelCase(argument.name)})`}>\n {code`failures.push(\"Invalid numeric value provided for the \\\\\"${\n argument.name\n }\\\\\" positional argument\");`}\n </IfStatement>\n }>\n <IfStatement\n condition={code`${camelCase(argument.name)}.some(value => Number.isNaN(value))`}>\n {code`failures.push(\"Invalid numeric value provided in the \\\\\"${\n argument.name\n }\\\\\" array positional argument\");`}\n </IfStatement>\n </Show>\n </Show>\n </>\n )}\n </For>\n <IfStatement condition={code`failures.length > 0`}>\n {code`error(colors.text.message.description.error(\"The following validation failures were found while processing the user provided input, and must be corrected before the command line process can be executed: \\\\n\\\\n\") + failures.map(failure => colors.text.body.secondary(\" - \" + failure)).join(\"\\\\n\"));\n options.help = true; `}\n </IfStatement>\n </CommandHandlerDeclaration>\n </EntryFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,SAAgBmC,kBAAkBC,OAAiC;CACjE,MAAM,EAAEC,YAAYD;AAEpB,QAAA;mDAEK5B,sCAAc;GACb+B,MAAI;GAAA,IACJC,cAAW;AAAA,WAAExC,oBAAI,aAAaqC,QAAQI,SACnCC,KAAIC,sFACkBA,QAAQ,GACzB,sIAA0CA,QAAQ,CAAC,CAAA,KACnDA,QACL,CACAC,KAAK,IAAI,CAAA,iBAAkBP,QAAQI,SACnCC,KAAIC,sFACkBA,QAAQ,mIACWA,QAAQ,CAAC,GAC7C,IAAIA,QAAO,GAChB,CACAC,KAAK,KAAK,CAAA;;GAAK,CAAA;mDAAA,OAAA,EAAA,CAAA;mDAAA,OAAA,EAAA,CAAA;8CAInB5C,oBAAI;;;wGAIDqC,QAAQE,KACT,CAAA,uBACCF,QAAQU,UAAUC,SAAS,IACvB,KAAKX,QAAQU,UACVL,KAAIO,8DAAsBA,SAASV,KAAK,CAAC,CACzCK,KAAK,KAAK,KACb,GAAE;;;QAIT;mDAAA,OAAA,EAAA,CAAA;EAAA;;;;;AAcP,SAAgBM,0BACdd,OACA;CACA,MAAM,EAAEC,SAASc,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"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;iBAkEgB,iBAAA;WAAoC;AAApD,CAAA,CAAA,EAAiE,QAAjD;AA2CC,UAAA,8BAAA,CAA8B;EAQ/B,OAAA,EAPL,WAOK;EA8FC,QAAA,CAAA,EApGJ,QAoGI;;;;;AAUD,iBAxGA,yBAAA,CAwGqC,KAAA,EAvG5C,8BAuG4C,CAAA,EAvGd,QAuGc;UAVpC,iBAAA,SAA0B,KACzC;WAGS;;;;;iBAMK,YAAA,QAAoB,oBAAiB"}
@@ -1 +1 @@
1
- {"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;iBA2DgB,iBAAA;WAAoC;AAApD,CAAA,CAAA,EAAiE,QAAjD;AA2CC,UAAA,8BAAA,CAA8B;EAQ/B,OAAA,EAPL,WAOK;EA8FC,QAAA,CAAA,EApGJ,QAoGI;;;;;AAUD,iBAxGA,yBAAA,CAwGqC,KAAA,EAvG5C,8BAuG4C,CAAA,EAvGd,QAuGc;UAVpC,iBAAA,SAA0B,KACzC;WAGS;;;;;iBAMK,YAAA,QAAoB,oBAAiB"}
1
+ {"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;iBAkEgB,iBAAA;WAAoC;AAApD,CAAA,CAAA,EAAiE,QAAjD;AA2CC,UAAA,8BAAA,CAA8B;EAQ/B,OAAA,EAPL,WAOK;EA8FC,QAAA,CAAA,EApGJ,QAoGI;;;;;AAUD,iBAxGA,yBAAA,CAwGqC,KAAA,EAvG5C,8BAuG4C,CAAA,EAvGd,QAuGc;UAVpC,iBAAA,SAA0B,KACzC;WAGS;;;;;iBAMK,YAAA,QAAoB,oBAAiB"}
@@ -4,7 +4,7 @@ import { IsDebug } from "./helpers.mjs";
4
4
  import { VirtualCommandEntry } from "./virtual-command-entry.mjs";
5
5
  import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
6
6
  import { For, Show, code, computed } from "@alloy-js/core";
7
- import { ElseClause, FunctionDeclaration, IfStatement, VarDeclaration } from "@alloy-js/typescript";
7
+ import { ElseClause, ElseIfClause, FunctionDeclaration, IfStatement, VarDeclaration } from "@alloy-js/typescript";
8
8
  import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
9
9
  import { getAppBin, getDynamicPathSegmentName, isDynamicPathSegment } from "@shell-shock/core/plugin-utils/context-helpers";
10
10
  import { EntryFile } from "@powerlines/plugin-alloy/typescript/components/entry-file";
@@ -12,6 +12,8 @@ import { TSDoc, TSDocParam, TSDocRemarks, TSDocTitle } from "@powerlines/plugin-
12
12
  import { replaceExtension } from "@stryke/path/replace";
13
13
  import { pascalCase } from "@stryke/string-format/pascal-case";
14
14
  import defu from "defu";
15
+ import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
16
+ import { SingleLineComment } from "@powerlines/plugin-alloy/core/components/single-line-comment";
15
17
  import { CommandParserLogic, OptionsInterfaceDeclaration } from "@shell-shock/core/components/options-parser-logic";
16
18
  import { findFilePath, relativePath } from "@stryke/path/find";
17
19
  import { joinPaths } from "@stryke/path/join";
@@ -186,7 +188,160 @@ function CommandEntry(props) {
186
188
  createComponent(OptionsInterfaceDeclaration, { command }),
187
189
  createIntrinsic("hbr", {}),
188
190
  createIntrinsic("hbr", {}),
189
- createComponent(CommandHandlerDeclaration, { command })
191
+ createComponent(SingleLineComment, { children: code`Validate required options and arguments` }),
192
+ createIntrinsic("hbr", {}),
193
+ createComponent(CommandHandlerDeclaration, {
194
+ command,
195
+ get children() {
196
+ return [
197
+ createComponent(VarDeclaration, {
198
+ name: "failures",
199
+ type: "string[]",
200
+ initializer: code`[];`
201
+ }),
202
+ createIntrinsic("hbr", {}),
203
+ createComponent(For, {
204
+ get each() {
205
+ return Object.values(command.options ?? {});
206
+ },
207
+ doubleHardline: true,
208
+ children: (option) => [createComponent(Show, {
209
+ get when() {
210
+ return !option.optional;
211
+ },
212
+ get children() {
213
+ return [createComponent(IfStatement, {
214
+ get condition() {
215
+ return code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}`;
216
+ },
217
+ get children() {
218
+ return code`failures.push("Missing required \\"${option.name}\\" option");`;
219
+ }
220
+ }), createComponent(Show, {
221
+ get when() {
222
+ return (option.kind === ReflectionKind.string || option.kind === ReflectionKind.number) && option.variadic;
223
+ },
224
+ get children() {
225
+ return createComponent(ElseIfClause, {
226
+ get condition() {
227
+ return code`options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}.length === 0`;
228
+ },
229
+ get children() {
230
+ return code`failures.push("No values were provided to the required \\"${option.name}\\" array option");`;
231
+ }
232
+ });
233
+ }
234
+ })];
235
+ }
236
+ }), createComponent(Show, {
237
+ get when() {
238
+ return option.kind === ReflectionKind.number;
239
+ },
240
+ get children() {
241
+ return createComponent(Show, {
242
+ get when() {
243
+ return option.variadic;
244
+ },
245
+ get fallback() {
246
+ return createComponent(IfStatement, {
247
+ get condition() {
248
+ return code`options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} && Number.isNaN(options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`})`;
249
+ },
250
+ get children() {
251
+ return code`failures.push("Invalid numeric value provided for the \\"${option.name}\\" option");`;
252
+ }
253
+ });
254
+ },
255
+ get children() {
256
+ return createComponent(IfStatement, {
257
+ get condition() {
258
+ return code`options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}.some(value => Number.isNaN(value))`;
259
+ },
260
+ get children() {
261
+ return code`failures.push("Invalid numeric value provided in the \\"${option.name}\\" array option");`;
262
+ }
263
+ });
264
+ }
265
+ });
266
+ }
267
+ })]
268
+ }),
269
+ createIntrinsic("hbr", {}),
270
+ createIntrinsic("hbr", {}),
271
+ createComponent(For, {
272
+ get each() {
273
+ return command.arguments;
274
+ },
275
+ doubleHardline: true,
276
+ children: (argument) => [createComponent(Show, {
277
+ get when() {
278
+ return !argument.optional;
279
+ },
280
+ get children() {
281
+ return [createComponent(IfStatement, {
282
+ get condition() {
283
+ return code`!${camelCase(argument.name)}`;
284
+ },
285
+ get children() {
286
+ return code`failures.push("Missing required \\"${argument.name}\\" positional argument");`;
287
+ }
288
+ }), createComponent(Show, {
289
+ get when() {
290
+ return (argument.kind === ReflectionKind.string || argument.kind === ReflectionKind.number) && argument.variadic;
291
+ },
292
+ get children() {
293
+ return createComponent(ElseIfClause, {
294
+ get condition() {
295
+ return code`${camelCase(argument.name)}.length === 0`;
296
+ },
297
+ get children() {
298
+ return code`failures.push("No values were provided to the required \\"${argument.name}\\" array positional argument");`;
299
+ }
300
+ });
301
+ }
302
+ })];
303
+ }
304
+ }), createComponent(Show, {
305
+ get when() {
306
+ return argument.kind === ReflectionKind.number;
307
+ },
308
+ get children() {
309
+ return createComponent(Show, {
310
+ get when() {
311
+ return argument.variadic;
312
+ },
313
+ get fallback() {
314
+ return createComponent(IfStatement, {
315
+ get condition() {
316
+ return code`${camelCase(argument.name)} && Number.isNaN(${camelCase(argument.name)})`;
317
+ },
318
+ get children() {
319
+ return code`failures.push("Invalid numeric value provided for the \\"${argument.name}\\" positional argument");`;
320
+ }
321
+ });
322
+ },
323
+ get children() {
324
+ return createComponent(IfStatement, {
325
+ get condition() {
326
+ return code`${camelCase(argument.name)}.some(value => Number.isNaN(value))`;
327
+ },
328
+ get children() {
329
+ return code`failures.push("Invalid numeric value provided in the \\"${argument.name}\\" array positional argument");`;
330
+ }
331
+ });
332
+ }
333
+ });
334
+ }
335
+ })]
336
+ }),
337
+ createComponent(IfStatement, {
338
+ condition: code`failures.length > 0`,
339
+ children: code`error(colors.text.message.description.error("The following validation failures were found while processing the user provided input, and must be corrected before the command line process can be executed: \\n\\n") + failures.map(failure => colors.text.body.secondary(" - " + failure)).join("\\n"));
340
+ options.help = true; `
341
+ })
342
+ ];
343
+ }
344
+ })
190
345
  ];
191
346
  }
192
347
  })), createComponent(For, {
@@ -1 +1 @@
1
- {"version":3,"file":"command-entry.mjs","names":["code","computed","For","Show","ElseClause","FunctionDeclaration","IfStatement","VarDeclaration","usePowerlines","EntryFile","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","CommandParserLogic","OptionsInterfaceDeclaration","getAppBin","getDynamicPathSegmentName","isDynamicPathSegment","findFilePath","relativePath","joinPaths","replaceExtension","camelCase","constantCase","kebabCase","pascalCase","defu","BannerFunctionDeclaration","CommandHelp","IsDebug","VirtualCommandEntry","CommandInvocation","props","command","_$createComponent","name","initializer","segments","map","segment","join","_$createIntrinsic","_$memo","arguments","length","argument","CommandHandlerDeclaration","children","context","heading","title","description","replace","async","parameters","type","default","envPrefix","config","isCaseSensitive","condition","Object","values","options","option","CommandEntry","imports","builtinImports","rest","filePath","filter","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$mergeProps","path","env","console","utils","each","child","when","isVirtual","fallback"],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport {\n ElseClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport {\n CommandParserLogic,\n OptionsInterfaceDeclaration\n} from \"@shell-shock/core/components/options-parser-logic\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { CommandHelp } from \"./help\";\nimport { IsDebug } from \"./helpers\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport function CommandInvocation(props: { command: CommandTree }) {\n const { command } = props;\n\n return (\n <>\n <VarDeclaration\n name=\"__context\"\n initializer={code`{ path: \\`${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `\\${${camelCase(getDynamicPathSegmentName(segment))}}`\n : segment\n )\n .join(\"/\")}\\`, segments: [${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? camelCase(getDynamicPathSegmentName(segment))\n : `\"${segment}\"`\n )\n .join(\", \")}] }`}\n />\n <hbr />\n <hbr />\n {code`\n\n internal_commandContext.call(__context, () => {\n return Promise.resolve(Reflect.apply(handle${pascalCase(\n command.name\n )}, __context, [options${\n command.arguments.length > 0\n ? `, ${command.arguments\n .map(argument => camelCase(argument.name))\n .join(\", \")}`\n : \"\"\n }]));\n });\n\n `}\n <hbr />\n </>\n );\n}\n\nexport interface CommandHandlerDeclarationProps {\n command: CommandTree;\n children?: Children;\n}\n\n/**\n * A component that generates the `handler` function declaration for a command.\n */\nexport function CommandHandlerDeclaration(\n props: CommandHandlerDeclarationProps\n) {\n const { command, children } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <OptionsInterfaceDeclaration command={command} />\n <hbr />\n <hbr />\n <TSDoc\n heading={`The ${command.title} (${getAppBin(context)} ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `[${constantCase(getDynamicPathSegmentName(segment))}]`\n : segment\n )\n .join(\" \")}) command.`}>\n <TSDocRemarks>{`${command.description.replace(/\\.+$/, \"\")}.`}</TSDocRemarks>\n <hbr />\n <TSDocTitle>{command.title}</TSDocTitle>\n <TSDocParam name=\"args\">{`The command-line arguments passed to the command.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"handler\"\n parameters={[{ name: \"args\", type: \"string[]\", default: \"getArgs()\" }]}>\n <CommandParserLogic\n command={command}\n envPrefix={context.config.envPrefix}\n isCaseSensitive={context.config.isCaseSensitive}\n />\n <hbr />\n <hbr />\n {code`writeLine(\"\");\n banner(); `}\n <hbr />\n <hbr />\n <IfStatement condition={<IsDebug />}>\n {code`\n writeLine(\"\");\n writeLine(colors.text.body.tertiary(\"Debug mode is enabled. Additional debug information may be logged to the console.\"));\n\n writeLine(\"\");\n debug(\\`Command path: ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `\\${${camelCase(getDynamicPathSegmentName(segment))}}`\n : segment\n )\n .join(\" / \")} \\\\n\\\\nOptions: \\\\n${Object.values(command.options)\n .map(\n option =>\n ` - ${kebabCase(option.name)}: \\${options.${camelCase(\n option.name\n )} === undefined ? \"\" : JSON.stringify(options.${camelCase(\n option.name\n )})}`\n )\n .join(\"\\\\n\")}${\n command.arguments.length > 0\n ? ` \\\\n\\\\nArguments: \\\\n${command.arguments\n .map(\n argument =>\n ` - ${kebabCase(argument.name)}: \\${${camelCase(\n argument.name\n )} === undefined ? \"\" : JSON.stringify(${camelCase(\n argument.name\n )})}`\n )\n .join(\"\\\\n\")}`\n : \"\"\n }\\`); `}\n </IfStatement>\n <hbr />\n <hbr />\n {children}\n <hbr />\n <hbr />\n <IfStatement condition={code`options.help`}>\n <CommandHelp command={command} />\n </IfStatement>\n <ElseClause>\n <hbr />\n <CommandInvocation command={command} />\n </ElseClause>\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n const commandSourcePath = computed(() =>\n replaceExtension(\n relativePath(\n joinPaths(context.entryPath, findFilePath(filePath.value)),\n command.entry.input?.file || command.entry.file\n )\n )\n );\n const typeDefinition = computed(() => ({\n ...command.entry,\n output: command.id\n }));\n\n return (\n <>\n <EntryFile\n {...rest}\n path={filePath.value}\n typeDefinition={typeDefinition.value}\n imports={defu(imports ?? {}, {\n [commandSourcePath.value]: `handle${pascalCase(command.name)}`\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isCI\", \"isDevelopment\", \"isDebug\"],\n console: [\n \"debug\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\n \"getArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <OptionsInterfaceDeclaration command={command} />\n <hbr />\n <hbr />\n <CommandHandlerDeclaration command={command} />\n </EntryFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2DA,SAAgBgC,kBAAkBC,OAAiC;CACjE,MAAM,EAAEC,YAAYD;AAEpB,QAAA;EAAAE,gBAEK5B,gBAAc;GACb6B,MAAI;GAAA,IACJC,cAAW;AAAA,WAAErC,IAAI,aAAakC,QAAQI,SACnCC,KAAIC,YACHtB,qBAAqBsB,QAAQ,GACzB,MAAMjB,UAAUN,0BAA0BuB,QAAQ,CAAC,CAAA,KACnDA,QACL,CACAC,KAAK,IAAI,CAAA,iBAAkBP,QAAQI,SACnCC,KAAIC,YACHtB,qBAAqBsB,QAAQ,GACzBjB,UAAUN,0BAA0BuB,QAAQ,CAAC,GAC7C,IAAIA,QAAO,GAChB,CACAC,KAAK,KAAK,CAAA;;GAAK,CAAA;EAAAC,gBAAA,OAAA,EAAA,CAAA;EAAAA,gBAAA,OAAA,EAAA,CAAA;EAAAC,WAInB3C,IAAI;;;qDAG0C0B,WAC3CQ,QAAQE,KACT,CAAA,uBACCF,QAAQU,UAAUC,SAAS,IACvB,KAAKX,QAAQU,UACVL,KAAIO,aAAYvB,UAAUuB,SAASV,KAAK,CAAC,CACzCK,KAAK,KAAK,KACb,GAAE;;;QAIT;EAAAC,gBAAA,OAAA,EAAA,CAAA;EAAA;;;;;AAcP,SAAgBK,0BACdd,OACA;CACA,MAAM,EAAEC,SAASc,aAAaf;CAE9B,MAAMgB,UAAUzC,eAAoC;AAEpD,QAAA;EAAA2B,gBAEKpB,6BAA2B,EAAUmB,SAAO,CAAA;EAAAQ,gBAAA,OAAA,EAAA,CAAA;EAAAA,gBAAA,OAAA,EAAA,CAAA;EAAAP,gBAG5CzB,OAAK;GAAA,IACJwC,UAAO;AAAA,WAAE,OAAOhB,QAAQiB,MAAK,IAAKnC,UAAUiC,QAAQ,CAAA,GAAIf,QAAQ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SAASqD,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
1
+ {"version":3,"file":"command-entry.mjs","names":["code","computed","For","Show","ElseClause","ElseIfClause","FunctionDeclaration","IfStatement","VarDeclaration","ReflectionKind","SingleLineComment","usePowerlines","EntryFile","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","CommandParserLogic","OptionsInterfaceDeclaration","getAppBin","getDynamicPathSegmentName","isDynamicPathSegment","findFilePath","relativePath","joinPaths","replaceExtension","camelCase","constantCase","kebabCase","pascalCase","defu","BannerFunctionDeclaration","CommandHelp","IsDebug","VirtualCommandEntry","CommandInvocation","props","command","_$createComponent","name","initializer","segments","map","segment","join","_$createIntrinsic","_$memo","arguments","length","argument","CommandHandlerDeclaration","children","context","heading","title","description","replace","async","parameters","type","default","envPrefix","config","isCaseSensitive","condition","Object","values","options","option","CommandEntry","imports","builtinImports","rest","filePath","filter","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$mergeProps","path","env","console","utils","each","doubleHardline","when","optional","includes","kind","string","number","variadic","fallback","child","isVirtual"],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport {\n ElseClause,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { SingleLineComment } from \"@powerlines/plugin-alloy/core/components/single-line-comment\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport {\n CommandParserLogic,\n OptionsInterfaceDeclaration\n} from \"@shell-shock/core/components/options-parser-logic\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type {\n CommandTree,\n NumberCommandArgument,\n NumberCommandOption\n} from \"@shell-shock/core/types/command\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { CommandHelp } from \"./help\";\nimport { IsDebug } from \"./helpers\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport function CommandInvocation(props: { command: CommandTree }) {\n const { command } = props;\n\n return (\n <>\n <VarDeclaration\n name=\"__context\"\n initializer={code`{ path: \\`${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `\\${${camelCase(getDynamicPathSegmentName(segment))}}`\n : segment\n )\n .join(\"/\")}\\`, segments: [${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? camelCase(getDynamicPathSegmentName(segment))\n : `\"${segment}\"`\n )\n .join(\", \")}] }`}\n />\n <hbr />\n <hbr />\n {code`\n\n internal_commandContext.call(__context, () => {\n return Promise.resolve(Reflect.apply(handle${pascalCase(\n command.name\n )}, __context, [options${\n command.arguments.length > 0\n ? `, ${command.arguments\n .map(argument => camelCase(argument.name))\n .join(\", \")}`\n : \"\"\n }]));\n });\n\n `}\n <hbr />\n </>\n );\n}\n\nexport interface CommandHandlerDeclarationProps {\n command: CommandTree;\n children?: Children;\n}\n\n/**\n * A component that generates the `handler` function declaration for a command.\n */\nexport function CommandHandlerDeclaration(\n props: CommandHandlerDeclarationProps\n) {\n const { command, children } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <OptionsInterfaceDeclaration command={command} />\n <hbr />\n <hbr />\n <TSDoc\n heading={`The ${command.title} (${getAppBin(context)} ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `[${constantCase(getDynamicPathSegmentName(segment))}]`\n : segment\n )\n .join(\" \")}) command.`}>\n <TSDocRemarks>{`${command.description.replace(/\\.+$/, \"\")}.`}</TSDocRemarks>\n <hbr />\n <TSDocTitle>{command.title}</TSDocTitle>\n <TSDocParam name=\"args\">{`The command-line arguments passed to the command.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"handler\"\n parameters={[{ name: \"args\", type: \"string[]\", default: \"getArgs()\" }]}>\n <CommandParserLogic\n command={command}\n envPrefix={context.config.envPrefix}\n isCaseSensitive={context.config.isCaseSensitive}\n />\n <hbr />\n <hbr />\n {code`writeLine(\"\");\n banner(); `}\n <hbr />\n <hbr />\n <IfStatement condition={<IsDebug />}>\n {code`\n writeLine(\"\");\n writeLine(colors.text.body.tertiary(\"Debug mode is enabled. Additional debug information may be logged to the console.\"));\n\n writeLine(\"\");\n debug(\\`Command path: ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `\\${${camelCase(getDynamicPathSegmentName(segment))}}`\n : segment\n )\n .join(\" / \")} \\\\n\\\\nOptions: \\\\n${Object.values(command.options)\n .map(\n option =>\n ` - ${kebabCase(option.name)}: \\${options.${camelCase(\n option.name\n )} === undefined ? \"\" : JSON.stringify(options.${camelCase(\n option.name\n )})}`\n )\n .join(\"\\\\n\")}${\n command.arguments.length > 0\n ? ` \\\\n\\\\nArguments: \\\\n${command.arguments\n .map(\n argument =>\n ` - ${kebabCase(argument.name)}: \\${${camelCase(\n argument.name\n )} === undefined ? \"\" : JSON.stringify(${camelCase(\n argument.name\n )})}`\n )\n .join(\"\\\\n\")}`\n : \"\"\n }\\`); `}\n </IfStatement>\n <hbr />\n <hbr />\n {children}\n <hbr />\n <hbr />\n <IfStatement condition={code`options.help`}>\n <CommandHelp command={command} />\n </IfStatement>\n <ElseClause>\n <hbr />\n <CommandInvocation command={command} />\n </ElseClause>\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n const commandSourcePath = computed(() =>\n replaceExtension(\n relativePath(\n joinPaths(context.entryPath, findFilePath(filePath.value)),\n command.entry.input?.file || command.entry.file\n )\n )\n );\n const typeDefinition = computed(() => ({\n ...command.entry,\n output: command.id\n }));\n\n return (\n <>\n <EntryFile\n {...rest}\n path={filePath.value}\n typeDefinition={typeDefinition.value}\n imports={defu(imports ?? {}, {\n [commandSourcePath.value]: `handle${pascalCase(command.name)}`\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isCI\", \"isDevelopment\", \"isDebug\"],\n console: [\n \"debug\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\n \"getArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <OptionsInterfaceDeclaration command={command} />\n <hbr />\n <hbr />\n <SingleLineComment>{code`Validate required options and arguments`}</SingleLineComment>\n <hbr />\n <CommandHandlerDeclaration command={command}>\n <VarDeclaration\n name=\"failures\"\n type=\"string[]\"\n initializer={code`[];`}\n />\n <hbr />\n <For each={Object.values(command.options ?? {})} doubleHardline>\n {option => (\n <>\n <Show when={!option.optional}>\n <IfStatement\n condition={code`!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }`}>\n {code`failures.push(\"Missing required \\\\\"${option.name}\\\\\" option\");`}\n </IfStatement>\n <Show\n when={\n (option.kind === ReflectionKind.string ||\n option.kind === ReflectionKind.number) &&\n option.variadic\n }>\n <ElseIfClause\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0`}>\n {code`failures.push(\"No values were provided to the required \\\\\"${\n option.name\n }\\\\\" array option\");`}\n </ElseIfClause>\n </Show>\n </Show>\n <Show when={option.kind === ReflectionKind.number}>\n <Show\n when={(option as NumberCommandOption).variadic}\n fallback={\n <IfStatement\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } && Number.isNaN(options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n })`}>\n {code`failures.push(\"Invalid numeric value provided for the \\\\\"${\n option.name\n }\\\\\" option\");`}\n </IfStatement>\n }>\n <IfStatement\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.some(value => Number.isNaN(value))`}>\n {code`failures.push(\"Invalid numeric value provided in the \\\\\"${\n option.name\n }\\\\\" array option\");`}\n </IfStatement>\n </Show>\n </Show>\n </>\n )}\n </For>\n <hbr />\n <hbr />\n <For each={command.arguments} doubleHardline>\n {argument => (\n <>\n <Show when={!argument.optional}>\n <IfStatement condition={code`!${camelCase(argument.name)}`}>\n {code`failures.push(\"Missing required \\\\\"${\n argument.name\n }\\\\\" positional argument\");`}\n </IfStatement>\n <Show\n when={\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n }>\n <ElseIfClause\n condition={code`${camelCase(argument.name)}.length === 0`}>\n {code`failures.push(\"No values were provided to the required \\\\\"${\n argument.name\n }\\\\\" array positional argument\");`}\n </ElseIfClause>\n </Show>\n </Show>\n <Show when={argument.kind === ReflectionKind.number}>\n <Show\n when={(argument as NumberCommandArgument).variadic}\n fallback={\n <IfStatement\n condition={code`${camelCase(\n argument.name\n )} && Number.isNaN(${camelCase(argument.name)})`}>\n {code`failures.push(\"Invalid numeric value provided for the \\\\\"${\n argument.name\n }\\\\\" positional argument\");`}\n </IfStatement>\n }>\n <IfStatement\n condition={code`${camelCase(argument.name)}.some(value => Number.isNaN(value))`}>\n {code`failures.push(\"Invalid numeric value provided in the \\\\\"${\n argument.name\n }\\\\\" array positional argument\");`}\n </IfStatement>\n </Show>\n </Show>\n </>\n )}\n </For>\n <IfStatement condition={code`failures.length > 0`}>\n {code`error(colors.text.message.description.error(\"The following validation failures were found while processing the user provided input, and must be corrected before the command line process can be executed: \\\\n\\\\n\") + failures.map(failure => colors.text.body.secondary(\" - \" + failure)).join(\"\\\\n\"));\n options.help = true; `}\n </IfStatement>\n </CommandHandlerDeclaration>\n </EntryFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkEA,SAAgBmC,kBAAkBC,OAAiC;CACjE,MAAM,EAAEC,YAAYD;AAEpB,QAAA;EAAAE,gBAEK9B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wF,OAAI;AAAA,mBAAG1C,SAAmCgD;;WAAQ,IAClDC,WAAQ;AAAA,mBAAA5D,gBACL/B,aAAW;aAAA,IACVyD,YAAS;AAAA,qBAAEhE,IAAI,GAAG0B,UAChBuB,SAASV,KACV,CAAA,mBAAoBb,UAAUuB,SAASV,KAAK,CAAA;;aAAG,IAAAY,WAAA;AAAA,qBAC/CnD,IAAI,4DACHiD,SAASV,KAAI;;aACa,CAAA;;WAAA,IAAAY,WAAA;AAAA,mBAAAb,gBAG/B/B,aAAW;aAAA,IACVyD,YAAS;AAAA,qBAAEhE,IAAI,GAAG0B,UAAUuB,SAASV,KAAK,CAAA;;aAAqC,IAAAY,WAAA;AAAA,qBAC9EnD,IAAI,2DACHiD,SAASV,KAAI;;aACmB,CAAA;;WAAA,CAAA;;SAAA,CAAA,CAAA;QAK3C,CAAA;OAAAD,gBAEF/B,aAAW;QAACyD,WAAWhE,IAAI;QAAqBmD,UAC9CnD,IAAI;;QACiB,CAAA;OAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAAsC,gBAI3BpC,KAAG;EAAA,IAACuF,OAAI;AAAA,UAAExB,OAAOC,OAAO7B,QAAQc,SAAS;;EAAAA,WACvCgD,UAAK7D,gBACHnC,MAAI;GAAA,IACHwF,OAAI;AAAA,WAAEQ,MAAMC;;GAAS,IACrBF,WAAQ;AAAA,WAAA5D,gBAAG+B,cAAY,EAAChC,SAAS8D,OAAK,CAAA;;GAAA,IAAAhD,WAAA;AAAA,WAAAb,gBACrCJ,qBAAmB,EAACG,SAAS8D,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
@@ -5,8 +5,8 @@ let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
5
  let __alloy_js_core = require("@alloy-js/core");
6
6
  let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
7
7
  let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
8
- let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
9
8
  let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
9
+ let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
10
10
  let __shell_shock_core_plugin_utils_reflect = require("@shell-shock/core/plugin-utils/reflect");
11
11
  let __stryke_string_format_snake_case = require("@stryke/string-format/snake-case");
12
12
 
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core3 from "@alloy-js/core";
1
+ import * as _alloy_js_core10 from "@alloy-js/core";
2
2
  import { CommandOption, CommandTree } from "@shell-shock/core/types/command";
3
3
 
4
4
  //#region src/components/help.d.ts
@@ -20,7 +20,7 @@ interface HelpUsageProps {
20
20
  /**
21
21
  * A component that generates the usage display for a command.
22
22
  */
23
- declare function HelpUsage(props: HelpUsageProps): _alloy_js_core3.Children;
23
+ declare function HelpUsage(props: HelpUsageProps): _alloy_js_core10.Children;
24
24
  interface HelpOptionsProps {
25
25
  /**
26
26
  * The options to display help for.
@@ -30,7 +30,7 @@ interface HelpOptionsProps {
30
30
  /**
31
31
  * A component that generates the options table display for a command.
32
32
  */
33
- declare function HelpOptions(props: HelpOptionsProps): _alloy_js_core3.Children;
33
+ declare function HelpOptions(props: HelpOptionsProps): _alloy_js_core10.Children;
34
34
  interface HelpCommandsProps {
35
35
  /**
36
36
  * A mapping of command names to their command definitions.
@@ -40,7 +40,7 @@ interface HelpCommandsProps {
40
40
  /**
41
41
  * A component that generates the commands table display for a command.
42
42
  */
43
- declare function HelpCommands(props: HelpCommandsProps): _alloy_js_core3.Children;
43
+ declare function HelpCommands(props: HelpCommandsProps): _alloy_js_core10.Children;
44
44
  interface BaseHelpProps {
45
45
  /**
46
46
  * The command to generate help for.
@@ -68,7 +68,7 @@ interface BaseHelpProps {
68
68
  /**
69
69
  * A component that generates the `help` function declaration for a command.
70
70
  */
71
- declare function BaseHelp(props: BaseHelpProps): _alloy_js_core3.Children;
71
+ declare function BaseHelp(props: BaseHelpProps): _alloy_js_core10.Children;
72
72
  interface VirtualHelpProps {
73
73
  /**
74
74
  * The options to display help for.
@@ -89,7 +89,7 @@ interface VirtualHelpProps {
89
89
  /**
90
90
  * A component that generates the invocation of the `help` function for a command.
91
91
  */
92
- declare function VirtualHelp(props: VirtualHelpProps): _alloy_js_core3.Children;
92
+ declare function VirtualHelp(props: VirtualHelpProps): _alloy_js_core10.Children;
93
93
  interface CommandHelpProps {
94
94
  /**
95
95
  * A mapping of command names to their command definitions.
@@ -99,7 +99,7 @@ interface CommandHelpProps {
99
99
  /**
100
100
  * A component that generates the invocation of the `help` function for a command.
101
101
  */
102
- declare function CommandHelp(props: CommandHelpProps): _alloy_js_core3.Children;
102
+ declare function CommandHelp(props: CommandHelpProps): _alloy_js_core10.Children;
103
103
  //#endregion
104
104
  export { BaseHelp, BaseHelpProps, CommandHelp, CommandHelpProps, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpUsage, HelpUsageProps, VirtualHelp, VirtualHelpProps };
105
105
  //# sourceMappingURL=help.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"help.d.cts","names":[],"sources":["../../src/components/help.tsx"],"sourcesContent":[],"mappings":";;;;UAoCiB,cAAA;;;AAAjB;EAoBgB,OAAA,EAhBL,WAgBc;EA6FR;AAUjB;AA+DA;AAUA;AAuBA;AA8BA;AAsDA;;EAS2B,MAAA,CAAA,EAAA,MAAA;;;AAc3B;AAwDA;AAUgB,iBApXA,SAAA,CAoXmB,KAAA,EApXF,cAoXkB,CAAA,EApXJ,eAAA,CAAA,QAoXI;UAvRlC,gBAAA;;;;WAIN;;;;;iBAMK,WAAA,QAAmB,mBAAgB,eAAA,CAAA;UA+DlC,iBAAA;;;;YAIL,eAAe;;;;;iBAMX,YAAA,QAAoB,oBAAiB,eAAA,CAAA;UAuBpC,aAAA;;;;WAIN;;;;;;;;;;;;;;;;;;;;;;;iBA0BK,QAAA,QAAgB,gBAAa,eAAA,CAAA;UAsD5B,gBAAA;;;;WAIN;;;;YAKC,eAAe;;;;;;;;;;;;iBAcX,WAAA,QAAmB,mBAAgB,eAAA,CAAA;UAwDlC,gBAAA;;;;WAIN;;;;;iBAMK,WAAA,QAAmB,mBAAgB,eAAA,CAAA"}
1
+ {"version":3,"file":"help.d.cts","names":[],"sources":["../../src/components/help.tsx"],"sourcesContent":[],"mappings":";;;;UAoCiB,cAAA;;;AAAjB;EAoBgB,OAAA,EAhBL,WAgBc;EA6FR;AAUjB;AA+DA;AAUA;AAuBA;AA8BA;AAsDA;;EAS2B,MAAA,CAAA,EAAA,MAAA;;;AAc3B;AAwDA;AAUgB,iBApXA,SAAA,CAoXmB,KAAA,EApXF,cAoXkB,CAAA,EApXJ,gBAAA,CAAA,QAoXI;UAvRlC,gBAAA;;;;WAIN;;;;;iBAMK,WAAA,QAAmB,mBAAgB,gBAAA,CAAA;UA+DlC,iBAAA;;;;YAIL,eAAe;;;;;iBAMX,YAAA,QAAoB,oBAAiB,gBAAA,CAAA;UAuBpC,aAAA;;;;WAIN;;;;;;;;;;;;;;;;;;;;;;;iBA0BK,QAAA,QAAgB,gBAAa,gBAAA,CAAA;UAsD5B,gBAAA;;;;WAIN;;;;YAKC,eAAe;;;;;;;;;;;;iBAcX,WAAA,QAAmB,mBAAgB,gBAAA,CAAA;UAwDlC,gBAAA;;;;WAIN;;;;;iBAMK,WAAA,QAAmB,mBAAgB,gBAAA,CAAA"}
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core10 from "@alloy-js/core";
1
+ import * as _alloy_js_core3 from "@alloy-js/core";
2
2
  import { CommandOption, CommandTree } from "@shell-shock/core/types/command";
3
3
 
4
4
  //#region src/components/help.d.ts
@@ -20,7 +20,7 @@ interface HelpUsageProps {
20
20
  /**
21
21
  * A component that generates the usage display for a command.
22
22
  */
23
- declare function HelpUsage(props: HelpUsageProps): _alloy_js_core10.Children;
23
+ declare function HelpUsage(props: HelpUsageProps): _alloy_js_core3.Children;
24
24
  interface HelpOptionsProps {
25
25
  /**
26
26
  * The options to display help for.
@@ -30,7 +30,7 @@ interface HelpOptionsProps {
30
30
  /**
31
31
  * A component that generates the options table display for a command.
32
32
  */
33
- declare function HelpOptions(props: HelpOptionsProps): _alloy_js_core10.Children;
33
+ declare function HelpOptions(props: HelpOptionsProps): _alloy_js_core3.Children;
34
34
  interface HelpCommandsProps {
35
35
  /**
36
36
  * A mapping of command names to their command definitions.
@@ -40,7 +40,7 @@ interface HelpCommandsProps {
40
40
  /**
41
41
  * A component that generates the commands table display for a command.
42
42
  */
43
- declare function HelpCommands(props: HelpCommandsProps): _alloy_js_core10.Children;
43
+ declare function HelpCommands(props: HelpCommandsProps): _alloy_js_core3.Children;
44
44
  interface BaseHelpProps {
45
45
  /**
46
46
  * The command to generate help for.
@@ -68,7 +68,7 @@ interface BaseHelpProps {
68
68
  /**
69
69
  * A component that generates the `help` function declaration for a command.
70
70
  */
71
- declare function BaseHelp(props: BaseHelpProps): _alloy_js_core10.Children;
71
+ declare function BaseHelp(props: BaseHelpProps): _alloy_js_core3.Children;
72
72
  interface VirtualHelpProps {
73
73
  /**
74
74
  * The options to display help for.
@@ -89,7 +89,7 @@ interface VirtualHelpProps {
89
89
  /**
90
90
  * A component that generates the invocation of the `help` function for a command.
91
91
  */
92
- declare function VirtualHelp(props: VirtualHelpProps): _alloy_js_core10.Children;
92
+ declare function VirtualHelp(props: VirtualHelpProps): _alloy_js_core3.Children;
93
93
  interface CommandHelpProps {
94
94
  /**
95
95
  * A mapping of command names to their command definitions.
@@ -99,7 +99,7 @@ interface CommandHelpProps {
99
99
  /**
100
100
  * A component that generates the invocation of the `help` function for a command.
101
101
  */
102
- declare function CommandHelp(props: CommandHelpProps): _alloy_js_core10.Children;
102
+ declare function CommandHelp(props: CommandHelpProps): _alloy_js_core3.Children;
103
103
  //#endregion
104
104
  export { BaseHelp, BaseHelpProps, CommandHelp, CommandHelpProps, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpUsage, HelpUsageProps, VirtualHelp, VirtualHelpProps };
105
105
  //# sourceMappingURL=help.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"help.d.mts","names":[],"sources":["../../src/components/help.tsx"],"sourcesContent":[],"mappings":";;;;UAoCiB,cAAA;;;AAAjB;EAoBgB,OAAA,EAhBL,WAgBc;EA6FR;AAUjB;AA+DA;AAUA;AAuBA;AA8BA;AAsDA;;EAS2B,MAAA,CAAA,EAAA,MAAA;;;AAc3B;AAwDA;AAUgB,iBApXA,SAAA,CAoXmB,KAAA,EApXF,cAoXkB,CAAA,EApXJ,gBAAA,CAAA,QAoXI;UAvRlC,gBAAA;;;;WAIN;;;;;iBAMK,WAAA,QAAmB,mBAAgB,gBAAA,CAAA;UA+DlC,iBAAA;;;;YAIL,eAAe;;;;;iBAMX,YAAA,QAAoB,oBAAiB,gBAAA,CAAA;UAuBpC,aAAA;;;;WAIN;;;;;;;;;;;;;;;;;;;;;;;iBA0BK,QAAA,QAAgB,gBAAa,gBAAA,CAAA;UAsD5B,gBAAA;;;;WAIN;;;;YAKC,eAAe;;;;;;;;;;;;iBAcX,WAAA,QAAmB,mBAAgB,gBAAA,CAAA;UAwDlC,gBAAA;;;;WAIN;;;;;iBAMK,WAAA,QAAmB,mBAAgB,gBAAA,CAAA"}
1
+ {"version":3,"file":"help.d.mts","names":[],"sources":["../../src/components/help.tsx"],"sourcesContent":[],"mappings":";;;;UAoCiB,cAAA;;;AAAjB;EAoBgB,OAAA,EAhBL,WAgBc;EA6FR;AAUjB;AA+DA;AAUA;AAuBA;AA8BA;AAsDA;;EAS2B,MAAA,CAAA,EAAA,MAAA;;;AAc3B;AAwDA;AAUgB,iBApXA,SAAA,CAoXmB,KAAA,EApXF,cAoXkB,CAAA,EApXJ,eAAA,CAAA,QAoXI;UAvRlC,gBAAA;;;;WAIN;;;;;iBAMK,WAAA,QAAmB,mBAAgB,eAAA,CAAA;UA+DlC,iBAAA;;;;YAIL,eAAe;;;;;iBAMX,YAAA,QAAoB,oBAAiB,eAAA,CAAA;UAuBpC,aAAA;;;;WAIN;;;;;;;;;;;;;;;;;;;;;;;iBA0BK,QAAA,QAAgB,gBAAa,eAAA,CAAA;UAsD5B,gBAAA;;;;WAIN;;;;YAKC,eAAe;;;;;;;;;;;;iBAcX,WAAA,QAAmB,mBAAgB,eAAA,CAAA;UAwDlC,gBAAA;;;;WAIN;;;;;iBAMK,WAAA,QAAmB,mBAAgB,eAAA,CAAA"}
@@ -4,8 +4,8 @@ import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runti
4
4
  import { For, Show, code, computed } from "@alloy-js/core";
5
5
  import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
6
6
  import { getAppBin, getDynamicPathSegmentName, isDynamicPathSegment } from "@shell-shock/core/plugin-utils/context-helpers";
7
- import { kebabCase } from "@stryke/string-format/kebab-case";
8
7
  import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
8
+ import { kebabCase } from "@stryke/string-format/kebab-case";
9
9
  import { sortOptions } from "@shell-shock/core/plugin-utils/reflect";
10
10
  import { snakeCase } from "@stryke/string-format/snake-case";
11
11
 
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core9 from "@alloy-js/core";
1
+ import * as _alloy_js_core3 from "@alloy-js/core";
2
2
  import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
3
3
 
4
4
  //#region src/components/utils-builtin.d.ts
@@ -6,28 +6,28 @@ interface UtilsBuiltinProps extends Omit<BuiltinFileProps, "id" | "description">
6
6
  /**
7
7
  * Generates utilities for detecting terminal color support.
8
8
  */
9
- declare function EnvSupportUtilities(): _alloy_js_core9.Children;
9
+ declare function EnvSupportUtilities(): _alloy_js_core3.Children;
10
10
  /**
11
11
  * Generates utilities for detecting terminal color support.
12
12
  */
13
- declare function ColorSupportUtilities(): _alloy_js_core9.Children;
13
+ declare function ColorSupportUtilities(): _alloy_js_core3.Children;
14
14
  /**
15
15
  * Generates utilities for detecting terminal color support.
16
16
  */
17
- declare function HyperlinkSupportUtilities(): _alloy_js_core9.Children;
17
+ declare function HyperlinkSupportUtilities(): _alloy_js_core3.Children;
18
18
  /**
19
19
  * Generates utilities for detecting terminal color support.
20
20
  */
21
- declare function ArgsUtilities(): _alloy_js_core9.Children;
21
+ declare function ArgsUtilities(): _alloy_js_core3.Children;
22
22
  /**
23
23
  * The `exit` handler function declaration code for the Shell Shock project.
24
24
  */
25
- declare function ExitFunctionDeclaration(): _alloy_js_core9.Children;
26
- declare function ContextUtilities(): _alloy_js_core9.Children;
25
+ declare function ExitFunctionDeclaration(): _alloy_js_core3.Children;
26
+ declare function ContextUtilities(): _alloy_js_core3.Children;
27
27
  /**
28
28
  * A built-in utilities module for Shell Shock.
29
29
  */
30
- declare function UtilsBuiltin(props: UtilsBuiltinProps): _alloy_js_core9.Children;
30
+ declare function UtilsBuiltin(props: UtilsBuiltinProps): _alloy_js_core3.Children;
31
31
  //#endregion
32
32
  export { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin, UtilsBuiltinProps };
33
33
  //# sourceMappingURL=utils-builtin.d.cts.map
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core3 from "@alloy-js/core";
1
+ import * as _alloy_js_core9 from "@alloy-js/core";
2
2
  import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
3
3
 
4
4
  //#region src/components/utils-builtin.d.ts
@@ -6,28 +6,28 @@ interface UtilsBuiltinProps extends Omit<BuiltinFileProps, "id" | "description">
6
6
  /**
7
7
  * Generates utilities for detecting terminal color support.
8
8
  */
9
- declare function EnvSupportUtilities(): _alloy_js_core3.Children;
9
+ declare function EnvSupportUtilities(): _alloy_js_core9.Children;
10
10
  /**
11
11
  * Generates utilities for detecting terminal color support.
12
12
  */
13
- declare function ColorSupportUtilities(): _alloy_js_core3.Children;
13
+ declare function ColorSupportUtilities(): _alloy_js_core9.Children;
14
14
  /**
15
15
  * Generates utilities for detecting terminal color support.
16
16
  */
17
- declare function HyperlinkSupportUtilities(): _alloy_js_core3.Children;
17
+ declare function HyperlinkSupportUtilities(): _alloy_js_core9.Children;
18
18
  /**
19
19
  * Generates utilities for detecting terminal color support.
20
20
  */
21
- declare function ArgsUtilities(): _alloy_js_core3.Children;
21
+ declare function ArgsUtilities(): _alloy_js_core9.Children;
22
22
  /**
23
23
  * The `exit` handler function declaration code for the Shell Shock project.
24
24
  */
25
- declare function ExitFunctionDeclaration(): _alloy_js_core3.Children;
26
- declare function ContextUtilities(): _alloy_js_core3.Children;
25
+ declare function ExitFunctionDeclaration(): _alloy_js_core9.Children;
26
+ declare function ContextUtilities(): _alloy_js_core9.Children;
27
27
  /**
28
28
  * A built-in utilities module for Shell Shock.
29
29
  */
30
- declare function UtilsBuiltin(props: UtilsBuiltinProps): _alloy_js_core3.Children;
30
+ declare function UtilsBuiltin(props: UtilsBuiltinProps): _alloy_js_core9.Children;
31
31
  //#endregion
32
32
  export { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin, UtilsBuiltinProps };
33
33
  //# sourceMappingURL=utils-builtin.d.mts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/preset-script",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "description": "A Shell Shock preset that generates a fully-featured script application.",
6
6
  "repository": {
@@ -296,8 +296,8 @@
296
296
  "@powerlines/deepkit": "^0.6.51",
297
297
  "@powerlines/plugin-alloy": "^0.20.15",
298
298
  "@powerlines/plugin-plugin": "^0.12.222",
299
- "@shell-shock/core": "^0.8.0",
300
- "@shell-shock/plugin-theme": "^0.0.17",
299
+ "@shell-shock/core": "^0.8.1",
300
+ "@shell-shock/plugin-theme": "^0.0.18",
301
301
  "@stryke/path": "0.26.4",
302
302
  "@stryke/string-format": "0.13.7",
303
303
  "defu": "6.1.4",
@@ -310,5 +310,5 @@
310
310
  "@types/node": "^22.19.10"
311
311
  },
312
312
  "publishConfig": { "access": "public" },
313
- "gitHead": "a3710248496a9b6251c18d6ee4af3587a0dc1fa5"
313
+ "gitHead": "2d179aff07a4c04d5ff4a96ceed082077a51a7e6"
314
314
  }