@shell-shock/core 0.5.1 → 0.7.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.
Files changed (66) hide show
  1. package/README.md +1 -1
  2. package/dist/components/docs.d.cts +5 -5
  3. package/dist/components/docs.d.mts +5 -5
  4. package/dist/components/index.cjs +3 -1
  5. package/dist/components/index.d.cts +2 -2
  6. package/dist/components/index.d.mts +2 -2
  7. package/dist/components/index.mjs +2 -2
  8. package/dist/components/options-parser-logic.cjs +127 -31
  9. package/dist/components/options-parser-logic.cjs.map +1 -1
  10. package/dist/components/options-parser-logic.d.cts +37 -10
  11. package/dist/components/options-parser-logic.d.cts.map +1 -1
  12. package/dist/components/options-parser-logic.d.mts +31 -4
  13. package/dist/components/options-parser-logic.d.mts.map +1 -1
  14. package/dist/components/options-parser-logic.mjs +126 -32
  15. package/dist/components/options-parser-logic.mjs.map +1 -1
  16. package/dist/components/usage.cjs +6 -5
  17. package/dist/components/usage.cjs.map +1 -1
  18. package/dist/components/usage.d.cts +2 -4
  19. package/dist/components/usage.d.cts.map +1 -1
  20. package/dist/components/usage.d.mts +2 -4
  21. package/dist/components/usage.d.mts.map +1 -1
  22. package/dist/components/usage.mjs +7 -6
  23. package/dist/components/usage.mjs.map +1 -1
  24. package/dist/helpers/persistence.cjs +48 -3
  25. package/dist/helpers/persistence.cjs.map +1 -1
  26. package/dist/helpers/persistence.mjs +48 -3
  27. package/dist/helpers/persistence.mjs.map +1 -1
  28. package/dist/helpers/resolve-command.cjs +103 -53
  29. package/dist/helpers/resolve-command.cjs.map +1 -1
  30. package/dist/helpers/resolve-command.mjs +105 -55
  31. package/dist/helpers/resolve-command.mjs.map +1 -1
  32. package/dist/helpers/validations.cjs +20 -20
  33. package/dist/helpers/validations.cjs.map +1 -1
  34. package/dist/helpers/validations.mjs +21 -21
  35. package/dist/helpers/validations.mjs.map +1 -1
  36. package/dist/index.d.cts +2 -2
  37. package/dist/index.d.mts +2 -2
  38. package/dist/plugin-utils/context-helpers.cjs +105 -4
  39. package/dist/plugin-utils/context-helpers.cjs.map +1 -1
  40. package/dist/plugin-utils/context-helpers.d.cts +89 -3
  41. package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
  42. package/dist/plugin-utils/context-helpers.d.mts +89 -3
  43. package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
  44. package/dist/plugin-utils/context-helpers.mjs +99 -3
  45. package/dist/plugin-utils/context-helpers.mjs.map +1 -1
  46. package/dist/plugin-utils/get-command-tree.cjs +1 -1
  47. package/dist/plugin-utils/get-command-tree.cjs.map +1 -1
  48. package/dist/plugin-utils/get-command-tree.mjs +2 -2
  49. package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
  50. package/dist/plugin-utils/index.cjs +7 -2
  51. package/dist/plugin-utils/index.d.cts +2 -2
  52. package/dist/plugin-utils/index.d.mts +2 -2
  53. package/dist/plugin-utils/index.mjs +2 -2
  54. package/dist/plugin.cjs +1 -1
  55. package/dist/plugin.cjs.map +1 -1
  56. package/dist/plugin.d.cts.map +1 -1
  57. package/dist/plugin.d.mts.map +1 -1
  58. package/dist/plugin.mjs +2 -2
  59. package/dist/plugin.mjs.map +1 -1
  60. package/dist/types/command.d.cts +291 -9
  61. package/dist/types/command.d.cts.map +1 -1
  62. package/dist/types/command.d.mts +291 -9
  63. package/dist/types/command.d.mts.map +1 -1
  64. package/dist/types/index.d.cts +2 -2
  65. package/dist/types/index.d.mts +2 -2
  66. package/package.json +3 -3
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.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)
30
+ [![Version](https://img.shields.io/badge/version-0.5.0-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 -->
@@ -1,5 +1,5 @@
1
1
  import { CommandTree } from "../types/command.cjs";
2
- import * as _alloy_js_core5 from "@alloy-js/core";
2
+ import * as _alloy_js_core0 from "@alloy-js/core";
3
3
  import { MarkdownFileProps } from "@powerlines/plugin-alloy/markdown/components/markdown-file";
4
4
 
5
5
  //#region src/components/docs.d.ts
@@ -12,7 +12,7 @@ interface CommandOptionsDocsProps {
12
12
  /**
13
13
  * Generates the options markdown documentation for a command.
14
14
  */
15
- declare function CommandOptionsDocs(props: CommandOptionsDocsProps): _alloy_js_core5.Children;
15
+ declare function CommandOptionsDocs(props: CommandOptionsDocsProps): _alloy_js_core0.Children;
16
16
  interface CommandDocsUsageExampleProps {
17
17
  /**
18
18
  * The package manager to generate the usage example for.
@@ -31,7 +31,7 @@ interface CommandDocsUsageExampleProps {
31
31
  /**
32
32
  * Generates the markdown documentation for a command.
33
33
  */
34
- declare function CommandDocsUsageExample(props: CommandDocsUsageExampleProps): _alloy_js_core5.Children;
34
+ declare function CommandDocsUsageExample(props: CommandDocsUsageExampleProps): _alloy_js_core0.Children;
35
35
  interface CommandDocsProps {
36
36
  /**
37
37
  * The heading level offset to apply to the generated documentation.
@@ -56,7 +56,7 @@ interface CommandDocsProps {
56
56
  /**
57
57
  * Generates the markdown documentation for a command.
58
58
  */
59
- declare function CommandDocs(props: CommandDocsProps): _alloy_js_core5.Children;
59
+ declare function CommandDocs(props: CommandDocsProps): _alloy_js_core0.Children;
60
60
  interface CommandDocsFileProps extends Partial<MarkdownFileProps> {
61
61
  /**
62
62
  * The heading level offset to apply to the generated documentation.
@@ -75,7 +75,7 @@ interface CommandDocsFileProps extends Partial<MarkdownFileProps> {
75
75
  /**
76
76
  * Generates the markdown documentation file for a command.
77
77
  */
78
- declare function CommandDocsFile(props: CommandDocsFileProps): _alloy_js_core5.Children;
78
+ declare function CommandDocsFile(props: CommandDocsFileProps): _alloy_js_core0.Children;
79
79
  //#endregion
80
80
  export { CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps };
81
81
  //# sourceMappingURL=docs.d.cts.map
@@ -1,5 +1,5 @@
1
1
  import { CommandTree } from "../types/command.mjs";
2
- import * as _alloy_js_core6 from "@alloy-js/core";
2
+ import * as _alloy_js_core7 from "@alloy-js/core";
3
3
  import { MarkdownFileProps } from "@powerlines/plugin-alloy/markdown/components/markdown-file";
4
4
 
5
5
  //#region src/components/docs.d.ts
@@ -12,7 +12,7 @@ interface CommandOptionsDocsProps {
12
12
  /**
13
13
  * Generates the options markdown documentation for a command.
14
14
  */
15
- declare function CommandOptionsDocs(props: CommandOptionsDocsProps): _alloy_js_core6.Children;
15
+ declare function CommandOptionsDocs(props: CommandOptionsDocsProps): _alloy_js_core7.Children;
16
16
  interface CommandDocsUsageExampleProps {
17
17
  /**
18
18
  * The package manager to generate the usage example for.
@@ -31,7 +31,7 @@ interface CommandDocsUsageExampleProps {
31
31
  /**
32
32
  * Generates the markdown documentation for a command.
33
33
  */
34
- declare function CommandDocsUsageExample(props: CommandDocsUsageExampleProps): _alloy_js_core6.Children;
34
+ declare function CommandDocsUsageExample(props: CommandDocsUsageExampleProps): _alloy_js_core7.Children;
35
35
  interface CommandDocsProps {
36
36
  /**
37
37
  * The heading level offset to apply to the generated documentation.
@@ -56,7 +56,7 @@ interface CommandDocsProps {
56
56
  /**
57
57
  * Generates the markdown documentation for a command.
58
58
  */
59
- declare function CommandDocs(props: CommandDocsProps): _alloy_js_core6.Children;
59
+ declare function CommandDocs(props: CommandDocsProps): _alloy_js_core7.Children;
60
60
  interface CommandDocsFileProps extends Partial<MarkdownFileProps> {
61
61
  /**
62
62
  * The heading level offset to apply to the generated documentation.
@@ -75,7 +75,7 @@ interface CommandDocsFileProps extends Partial<MarkdownFileProps> {
75
75
  /**
76
76
  * Generates the markdown documentation file for a command.
77
77
  */
78
- declare function CommandDocsFile(props: CommandDocsFileProps): _alloy_js_core6.Children;
78
+ declare function CommandDocsFile(props: CommandDocsFileProps): _alloy_js_core7.Children;
79
79
  //#endregion
80
80
  export { CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps };
81
81
  //# sourceMappingURL=docs.d.mts.map
@@ -6,10 +6,12 @@ exports.CommandDocs = require_components_docs.CommandDocs;
6
6
  exports.CommandDocsFile = require_components_docs.CommandDocsFile;
7
7
  exports.CommandDocsUsageExample = require_components_docs.CommandDocsUsageExample;
8
8
  exports.CommandOptionsDocs = require_components_docs.CommandOptionsDocs;
9
+ exports.CommandParserLogic = require_components_options_parser_logic.CommandParserLogic;
10
+ exports.DynamicPathSegmentsParserLogic = require_components_options_parser_logic.DynamicPathSegmentsParserLogic;
9
11
  exports.OptionsInterfaceDeclaration = require_components_options_parser_logic.OptionsInterfaceDeclaration;
10
12
  exports.OptionsMember = require_components_options_parser_logic.OptionsMember;
11
13
  exports.OptionsMemberParserCondition = require_components_options_parser_logic.OptionsMemberParserCondition;
12
14
  exports.OptionsMemberParserLogic = require_components_options_parser_logic.OptionsMemberParserLogic;
13
15
  exports.OptionsParserLogic = require_components_options_parser_logic.OptionsParserLogic;
14
- exports.PositionalOptionsParserLogic = require_components_options_parser_logic.PositionalOptionsParserLogic;
16
+ exports.PositionalParametersParserLogic = require_components_options_parser_logic.PositionalParametersParserLogic;
15
17
  exports.Usage = require_components_usage.Usage;
@@ -1,4 +1,4 @@
1
1
  import { CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps } from "./docs.cjs";
2
- import { OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps, PositionalOptionsParserLogic, PositionalOptionsParserLogicProps } from "./options-parser-logic.cjs";
2
+ import { CommandParserLogic, CommandParserLogicProps, DynamicPathSegmentsParserLogic, DynamicPathSegmentsParserLogicProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps, PositionalParametersParserLogic, PositionalParametersParserLogicProps } from "./options-parser-logic.cjs";
3
3
  import { Usage, UsageProps } from "./usage.cjs";
4
- export { CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps, PositionalOptionsParserLogic, PositionalOptionsParserLogicProps, Usage, UsageProps };
4
+ export { CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps, CommandParserLogic, CommandParserLogicProps, DynamicPathSegmentsParserLogic, DynamicPathSegmentsParserLogicProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps, PositionalParametersParserLogic, PositionalParametersParserLogicProps, Usage, UsageProps };
@@ -1,4 +1,4 @@
1
1
  import { CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps } from "./docs.mjs";
2
- import { OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps, PositionalOptionsParserLogic, PositionalOptionsParserLogicProps } from "./options-parser-logic.mjs";
2
+ import { CommandParserLogic, CommandParserLogicProps, DynamicPathSegmentsParserLogic, DynamicPathSegmentsParserLogicProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps, PositionalParametersParserLogic, PositionalParametersParserLogicProps } from "./options-parser-logic.mjs";
3
3
  import { Usage, UsageProps } from "./usage.mjs";
4
- export { CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps, PositionalOptionsParserLogic, PositionalOptionsParserLogicProps, Usage, UsageProps };
4
+ export { CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps, CommandParserLogic, CommandParserLogicProps, DynamicPathSegmentsParserLogic, DynamicPathSegmentsParserLogicProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps, PositionalParametersParserLogic, PositionalParametersParserLogicProps, Usage, UsageProps };
@@ -1,5 +1,5 @@
1
1
  import { Usage } from "./usage.mjs";
2
2
  import { CommandDocs, CommandDocsFile, CommandDocsUsageExample, CommandOptionsDocs } from "./docs.mjs";
3
- import { OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserLogic, OptionsParserLogic, PositionalOptionsParserLogic } from "./options-parser-logic.mjs";
3
+ import { CommandParserLogic, DynamicPathSegmentsParserLogic, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserLogic, OptionsParserLogic, PositionalParametersParserLogic } from "./options-parser-logic.mjs";
4
4
 
5
- export { CommandDocs, CommandDocsFile, CommandDocsUsageExample, CommandOptionsDocs, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserLogic, OptionsParserLogic, PositionalOptionsParserLogic, Usage };
5
+ export { CommandDocs, CommandDocsFile, CommandDocsUsageExample, CommandOptionsDocs, CommandParserLogic, DynamicPathSegmentsParserLogic, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserLogic, OptionsParserLogic, PositionalParametersParserLogic, Usage };
@@ -3,7 +3,6 @@ const require_plugin_utils_context_helpers = require('../plugin-utils/context-he
3
3
  const require_contexts_options = require('../contexts/options.cjs');
4
4
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
5
  let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
6
- let __stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
7
6
  let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
8
7
  let __alloy_js_core = require("@alloy-js/core");
9
8
  let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
@@ -11,46 +10,42 @@ let __alloy_js_typescript = require("@alloy-js/typescript");
11
10
  let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
12
11
 
13
12
  //#region src/components/options-parser-logic.tsx
14
- function PositionalOptionsParserLogic(props) {
15
- const { path, envPrefix } = props;
13
+ function DynamicPathSegmentsParserLogic(props) {
14
+ const { path } = props;
16
15
  return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
17
16
  get each() {
18
17
  return path.segments ?? [];
19
18
  },
20
19
  children: (segment, index) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
21
20
  get when() {
22
- return require_plugin_utils_context_helpers.isPositionalCommandOption(segment);
21
+ return require_plugin_utils_context_helpers.isDynamicPathSegment(segment);
23
22
  },
24
23
  get children() {
25
24
  return [
26
25
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
27
26
  "let": true,
28
27
  get name() {
29
- return (0, __stryke_string_format_camel_case.camelCase)(require_plugin_utils_context_helpers.getPositionalCommandOptionName(segment));
28
+ return (0, __stryke_string_format_camel_case.camelCase)(require_plugin_utils_context_helpers.getDynamicPathSegmentName(segment));
30
29
  },
31
30
  get type() {
32
- return (0, __alloy_js_core_jsx_runtime.memo)(() => path.positional[require_plugin_utils_context_helpers.getPositionalCommandOptionName(segment)]?.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number)() ? path.positional[require_plugin_utils_context_helpers.getPositionalCommandOptionName(segment)]?.variadic ? "number[]" : "number | undefined" : path.positional[require_plugin_utils_context_helpers.getPositionalCommandOptionName(segment)]?.variadic ? "string[]" : "string | undefined";
31
+ return `${path.dynamics[require_plugin_utils_context_helpers.getDynamicPathSegmentName(segment)]?.variadic ? "string[]" : "string"}${path.dynamics[require_plugin_utils_context_helpers.getDynamicPathSegmentName(segment)]?.optional ? " | undefined" : ""}`;
33
32
  },
34
33
  get initializer() {
35
- return (0, __alloy_js_core_jsx_runtime.memo)(() => !!path.positional[require_plugin_utils_context_helpers.getPositionalCommandOptionName(segment)]?.variadic)() ? __alloy_js_core.code`[]` : [
36
- (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`env.${envPrefix}_${(0, __stryke_string_format_constant_case.constantCase)(path.positional[require_plugin_utils_context_helpers.getPositionalCommandOptionName(segment)]?.name)} ?? `),
37
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
38
- get when() {
39
- return (0, __stryke_type_checks_is_set_string.isSetString)(path.positional[require_plugin_utils_context_helpers.getPositionalCommandOptionName(segment)]?.default);
40
- },
41
- get children() {
42
- return __alloy_js_core.code`"${path.positional[require_plugin_utils_context_helpers.getPositionalCommandOptionName(segment)]?.default}"`;
43
- }
44
- }),
45
- __alloy_js_core.code`undefined;`
46
- ];
34
+ return (0, __alloy_js_core_jsx_runtime.memo)(() => !!path.dynamics[require_plugin_utils_context_helpers.getDynamicPathSegmentName(segment)]?.variadic)() ? __alloy_js_core.code`[]` : [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
35
+ get when() {
36
+ return (0, __stryke_type_checks_is_set_string.isSetString)(path.dynamics[require_plugin_utils_context_helpers.getDynamicPathSegmentName(segment)]?.default);
37
+ },
38
+ get children() {
39
+ return __alloy_js_core.code`"${path.dynamics[require_plugin_utils_context_helpers.getDynamicPathSegmentName(segment)]?.default}"`;
40
+ }
41
+ }), __alloy_js_core.code`undefined;`];
47
42
  }
48
43
  }),
49
44
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
50
45
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
51
46
  condition: __alloy_js_core.code`args.length > ${2 + index} && args[${2 + index}]`,
52
47
  get children() {
53
- return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(require_plugin_utils_context_helpers.getPositionalCommandOptionName(segment))} = args[${2 + index}];`;
48
+ return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(require_plugin_utils_context_helpers.getDynamicPathSegmentName(segment))} = args[${2 + index}];`;
54
49
  }
55
50
  }),
56
51
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
@@ -60,6 +55,61 @@ function PositionalOptionsParserLogic(props) {
60
55
  })
61
56
  });
62
57
  }
58
+ function PositionalParametersParserLogic(props) {
59
+ const { command, envPrefix } = props;
60
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
61
+ get each() {
62
+ return command.params ?? [];
63
+ },
64
+ hardline: true,
65
+ children: (param) => [
66
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
67
+ "let": true,
68
+ get name() {
69
+ return param.name;
70
+ },
71
+ get type() {
72
+ return `${param.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean ? "boolean" : param.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? "number" : "string"}${(param.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || param.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && param.variadic ? "[]" : ""}${param.optional ? " | undefined" : ""}`;
73
+ },
74
+ get initializer() {
75
+ return [(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`env.${envPrefix}_${param.env} ?? `), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
76
+ get when() {
77
+ return param.default !== void 0;
78
+ },
79
+ get fallback() {
80
+ return (param.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || param.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && param.variadic ? __alloy_js_core.code`[]` : __alloy_js_core.code`undefined;`;
81
+ },
82
+ get children() {
83
+ return param.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string ? __alloy_js_core.code`"${param.default}"` : __alloy_js_core.code`${param.default}`;
84
+ }
85
+ })];
86
+ }
87
+ }),
88
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
89
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
90
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
91
+ get condition() {
92
+ return __alloy_js_core.code`args.length > ${command.path.segments.filter((segment) => require_plugin_utils_context_helpers.isDynamicPathSegment(segment)).length + 1} && args[${command.path.segments.filter((segment) => require_plugin_utils_context_helpers.isDynamicPathSegment(segment)).length + 1}]`;
93
+ },
94
+ get children() {
95
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
96
+ get when() {
97
+ return param.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || param.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
98
+ },
99
+ get fallback() {
100
+ return __alloy_js_core.code`${param.name} = args[${command.path.segments.filter((segment) => require_plugin_utils_context_helpers.isDynamicPathSegment(segment)).length + 1}];`;
101
+ },
102
+ get children() {
103
+ return __alloy_js_core.code`${param.name} = ${(param.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || param.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && param.variadic ? `args.slice(${command.path.segments.filter((segment) => require_plugin_utils_context_helpers.isDynamicPathSegment(segment)).length + 1})` : `args[${command.path.segments.filter((segment) => require_plugin_utils_context_helpers.isDynamicPathSegment(segment)).length + 1}]`}${param.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? ".map(Number).filter(value => !Number.isNaN(value))" : ""};`;
104
+ }
105
+ });
106
+ }
107
+ }),
108
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
109
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
110
+ ]
111
+ })];
112
+ }
63
113
  /**
64
114
  * The command option interface property.
65
115
  */
@@ -135,7 +185,7 @@ function OptionsMember({ option }) {
135
185
  */
136
186
  function OptionsMemberParserLogic(props) {
137
187
  const { name, option, isCaseSensitive } = props;
138
- const equalsRegex = `/^--?(${isCaseSensitive && name.length > 1 ? name : name.toLowerCase()}${option.alias && option.alias.length > 0 ? "|" : ""}${option.alias?.map((a) => (isCaseSensitive && name.length > 1 ? a : a.toLowerCase()) === "?" ? "\\?" : isCaseSensitive && name.length > 1 ? a : a.toLowerCase()).join("|")})=/`;
188
+ const equalsRegex = `/^--?(${isCaseSensitive || name.length === 1 ? name : name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}${option.alias && option.alias.length > 0 ? "|" : ""}${option.alias?.map((a) => (isCaseSensitive || name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", "")) === "?" ? "\\?" : isCaseSensitive || name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", "")).join("|")})=/`;
139
189
  return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
140
190
  get when() {
141
191
  return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
@@ -156,7 +206,7 @@ function OptionsMemberParserLogic(props) {
156
206
  }),
157
207
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
158
208
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
159
- condition: `${equalsRegex}.test(arg${isCaseSensitive ? "" : ".toLowerCase()"})`,
209
+ condition: `${equalsRegex}.test(${isCaseSensitive ? "arg" : "\"-\" + arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"})`,
160
210
  get children() {
161
211
  return [
162
212
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
@@ -218,7 +268,7 @@ function OptionsMemberParserLogic(props) {
218
268
  get children() {
219
269
  return [
220
270
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
221
- condition: `${equalsRegex}.test(arg${isCaseSensitive ? "" : ".toLowerCase()"})`,
271
+ condition: `${equalsRegex}.test(${isCaseSensitive ? "arg" : "\"-\" + arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"})`,
222
272
  get children() {
223
273
  return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
224
274
  get when() {
@@ -319,7 +369,7 @@ function OptionsMemberParserLogic(props) {
319
369
  get children() {
320
370
  return [
321
371
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
322
- condition: `${equalsRegex}.test(arg${isCaseSensitive ? "" : ".toLowerCase()"})`,
372
+ condition: `${equalsRegex}.test(${isCaseSensitive ? "arg" : "\"-\" + arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"})`,
323
373
  get children() {
324
374
  return [
325
375
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
@@ -371,15 +421,15 @@ function OptionsMemberParserLogic(props) {
371
421
  })];
372
422
  }
373
423
  function OptionsMemberParserCondition(props) {
374
- const { name, alias, isCaseSensitive } = props;
375
- return [(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`arg${isCaseSensitive ? "" : ".toLowerCase()"}.startsWith("--${isCaseSensitive ? name : name.toLowerCase()}=") || arg${isCaseSensitive ? "" : ".toLowerCase()"} === "--${isCaseSensitive ? name : name.toLowerCase()}" || arg.startsWith("-${name}=") || arg === "-${name}"`), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
424
+ const { name, alias: aliasProp, isCaseSensitive } = props;
425
+ return [(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`${isCaseSensitive ? "arg.startsWith(\"--" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\""}${isCaseSensitive ? name : name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}=") || ${isCaseSensitive ? "arg" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"} === "${isCaseSensitive ? name : name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}" || ${isCaseSensitive ? "arg.startsWith(\"-" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\""}${isCaseSensitive ? name : name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}=") || ${isCaseSensitive ? "arg" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"} === "${isCaseSensitive ? name : name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}"`), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
376
426
  get when() {
377
- return alias && alias.length > 0;
427
+ return aliasProp && aliasProp.length > 0;
378
428
  },
379
429
  get children() {
380
430
  return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
381
- each: alias ?? [],
382
- children: (a) => __alloy_js_core.code` || arg${isCaseSensitive ? "" : ".toLowerCase()"}.startsWith("--${isCaseSensitive || a.length === 1 ? a : a.toLowerCase()}=") || arg${isCaseSensitive ? "" : ".toLowerCase()"} === "--${isCaseSensitive || a.length === 1 ? a : a.toLowerCase()}" || arg.startsWith("-${a}=") || arg === "-${a}"`
431
+ each: aliasProp ?? [],
432
+ children: (alias) => __alloy_js_core.code` || ${isCaseSensitive || alias.length === 1 ? "arg.startsWith(\"--" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\""}${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll("-", "").replaceAll("_", "")}=") || ${isCaseSensitive || alias.length === 1 ? "arg" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"} === "${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll("-", "").replaceAll("_", "")}" || ${isCaseSensitive || alias.length === 1 ? "arg.startsWith(\"-" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\""}${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll("-", "").replaceAll("_", "")}=") || ${isCaseSensitive || alias.length === 1 ? "arg" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"} === "${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll("-", "").replaceAll("_", "")}"`
383
433
  });
384
434
  }
385
435
  })];
@@ -426,14 +476,14 @@ function OptionsParserLogic(props) {
426
476
  }),
427
477
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
428
478
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
429
- (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`for (let i = 0; i < args.slice(${command.path.segments.filter((segment) => require_plugin_utils_context_helpers.isPositionalCommandOption(segment)).length}).length; i++) { `),
479
+ (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`for (let i = 0; i < args.slice(${command.path.segments.filter((segment) => require_plugin_utils_context_helpers.isDynamicPathSegment(segment)).length}).length; i++) { `),
430
480
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
431
481
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
432
482
  "const": true,
433
483
  name: "arg",
434
484
  type: "string",
435
485
  initializer: __alloy_js_core.code` args[i].length > 3 && args[i].startsWith("--")
436
- ? \`--\${args[i].slice(2).replaceAll("-", "")${isCaseSensitive ? "" : ".toLowerCase()"}}\`
486
+ ? \`--\${args[i].slice(2).replaceAll("-", "")${isCaseSensitive ? "" : ".toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"}}\`
437
487
  : args[i].length > 2 && args[i].startsWith("-")
438
488
  ? \`-\${args[i].slice(1).replaceAll("-", "")}\`
439
489
  : args[i]; `
@@ -493,12 +543,58 @@ function OptionsParserLogic(props) {
493
543
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
494
544
  ];
495
545
  }
546
+ /**
547
+ * The command parser logic, which includes parsing dynamic path segments, positional parameters, and options.
548
+ */
549
+ function CommandParserLogic(props) {
550
+ const { command, envPrefix, isCaseSensitive = false } = props;
551
+ return [
552
+ (0, __alloy_js_core_jsx_runtime.createComponent)(DynamicPathSegmentsParserLogic, { get path() {
553
+ return command.path;
554
+ } }),
555
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
556
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
557
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
558
+ "const": true,
559
+ name: "lastSegmentIndex",
560
+ type: "number",
561
+ get initializer() {
562
+ return (0, __alloy_js_core_jsx_runtime.memo)(() => !!require_plugin_utils_context_helpers.isDynamicPathSegment(command.path.segments[command.path.segments.length - 1]))() ? `args.some(arg => /^--?(${Object.keys(command.options).map((key) => key.toLowerCase().replaceAll("-", "").replaceAll("_", "")).join("|")})(=.*)?$/.test(arg${isCaseSensitive ? "" : ".toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"})) ? args.findIndex(arg => /^--?(${Object.keys(command.options).map((key) => key.toLowerCase().replaceAll("-", "").replaceAll("_", "")).join("|")})(=.*)?$/.test(arg${isCaseSensitive ? "" : ".toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"})) : args.length - ${command.params.length + 1}` : `args.reduce((ret, arg, index) => {
563
+ if (ret === -1 && (index < args.findIndex(a => /^--?(${Object.keys(command.options).map((key) => key.toLowerCase().replaceAll("-", "").replaceAll("_", "")).join("|")})(=.*)?$/.test(a${isCaseSensitive ? "" : ".toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"})) || !args.some(a => /^--?(${Object.keys(command.options).map((key) => key.toLowerCase().replaceAll("-", "").replaceAll("_", "")).join("|")})(=.*)?$/.test(a${isCaseSensitive ? "" : ".toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"}))) && arg${isCaseSensitive ? "" : ".toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"} === "${command.path.segments[command.path.segments.length - 1]?.toLowerCase()}") {
564
+ return index;
565
+ }
566
+
567
+ return ret;
568
+ }, -1); `;
569
+ }
570
+ }),
571
+ __alloy_js_core.code`
572
+ `,
573
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
574
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
575
+ (0, __alloy_js_core_jsx_runtime.createComponent)(OptionsParserLogic, {
576
+ command,
577
+ envPrefix,
578
+ isCaseSensitive
579
+ }),
580
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
581
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
582
+ (0, __alloy_js_core_jsx_runtime.createComponent)(PositionalParametersParserLogic, {
583
+ command,
584
+ envPrefix
585
+ }),
586
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
587
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
588
+ ];
589
+ }
496
590
 
497
591
  //#endregion
592
+ exports.CommandParserLogic = CommandParserLogic;
593
+ exports.DynamicPathSegmentsParserLogic = DynamicPathSegmentsParserLogic;
498
594
  exports.OptionsInterfaceDeclaration = OptionsInterfaceDeclaration;
499
595
  exports.OptionsMember = OptionsMember;
500
596
  exports.OptionsMemberParserCondition = OptionsMemberParserCondition;
501
597
  exports.OptionsMemberParserLogic = OptionsMemberParserLogic;
502
598
  exports.OptionsParserLogic = OptionsParserLogic;
503
- exports.PositionalOptionsParserLogic = PositionalOptionsParserLogic;
599
+ exports.PositionalParametersParserLogic = PositionalParametersParserLogic;
504
600
  //# sourceMappingURL=options-parser-logic.cjs.map