@shell-shock/core 0.10.0 → 0.12.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 (161) hide show
  1. package/dist/components/docs.cjs +4 -4
  2. package/dist/components/docs.cjs.map +1 -1
  3. package/dist/components/docs.d.cts +5 -5
  4. package/dist/components/docs.d.cts.map +1 -1
  5. package/dist/components/docs.d.mts +5 -5
  6. package/dist/components/docs.d.mts.map +1 -1
  7. package/dist/components/helpers.cjs +9 -0
  8. package/dist/components/helpers.cjs.map +1 -1
  9. package/dist/components/helpers.d.cts +15 -7
  10. package/dist/components/helpers.d.cts.map +1 -1
  11. package/dist/components/helpers.d.mts +15 -7
  12. package/dist/components/helpers.d.mts.map +1 -1
  13. package/dist/components/helpers.mjs +9 -1
  14. package/dist/components/helpers.mjs.map +1 -1
  15. package/dist/components/index.cjs +1 -0
  16. package/dist/components/index.d.cts +2 -2
  17. package/dist/components/index.d.mts +2 -2
  18. package/dist/components/index.mjs +2 -2
  19. package/dist/components/options-parser-logic.cjs +167 -87
  20. package/dist/components/options-parser-logic.cjs.map +1 -1
  21. package/dist/components/options-parser-logic.d.cts +15 -15
  22. package/dist/components/options-parser-logic.d.cts.map +1 -1
  23. package/dist/components/options-parser-logic.d.mts +15 -15
  24. package/dist/components/options-parser-logic.d.mts.map +1 -1
  25. package/dist/components/options-parser-logic.mjs +163 -83
  26. package/dist/components/options-parser-logic.mjs.map +1 -1
  27. package/dist/components/usage.cjs +5 -5
  28. package/dist/components/usage.cjs.map +1 -1
  29. package/dist/components/usage.d.cts +2 -2
  30. package/dist/components/usage.d.cts.map +1 -1
  31. package/dist/components/usage.d.mts +2 -2
  32. package/dist/components/usage.mjs +4 -4
  33. package/dist/components/usage.mjs.map +1 -1
  34. package/dist/components/utils-builtin.cjs +2 -2
  35. package/dist/components/utils-builtin.cjs.map +1 -1
  36. package/dist/components/utils-builtin.d.cts +9 -9
  37. package/dist/components/utils-builtin.d.cts.map +1 -1
  38. package/dist/components/utils-builtin.d.mts +9 -9
  39. package/dist/components/utils-builtin.d.mts.map +1 -1
  40. package/dist/components/utils-builtin.mjs +5 -5
  41. package/dist/components/utils-builtin.mjs.map +1 -1
  42. package/dist/contexts/options.cjs +2 -2
  43. package/dist/contexts/options.cjs.map +1 -1
  44. package/dist/contexts/options.d.cts +1 -1
  45. package/dist/contexts/options.d.cts.map +1 -1
  46. package/dist/contexts/options.d.mts +1 -1
  47. package/dist/contexts/options.d.mts.map +1 -1
  48. package/dist/contexts/options.mjs +4 -4
  49. package/dist/contexts/options.mjs.map +1 -1
  50. package/dist/helpers/automd.cjs +2 -2
  51. package/dist/helpers/automd.cjs.map +1 -1
  52. package/dist/helpers/automd.mjs.map +1 -1
  53. package/dist/helpers/paths.cjs +125 -0
  54. package/dist/helpers/paths.cjs.map +1 -0
  55. package/dist/helpers/paths.mjs +121 -0
  56. package/dist/helpers/paths.mjs.map +1 -0
  57. package/dist/helpers/persistence.cjs +68 -116
  58. package/dist/helpers/persistence.cjs.map +1 -1
  59. package/dist/helpers/persistence.mjs +68 -116
  60. package/dist/helpers/persistence.mjs.map +1 -1
  61. package/dist/helpers/update-package-json.cjs +4 -4
  62. package/dist/helpers/update-package-json.cjs.map +1 -1
  63. package/dist/helpers/utilities.cjs +1 -1
  64. package/dist/helpers/utilities.mjs +1 -1
  65. package/dist/helpers/validations.cjs +2 -3
  66. package/dist/helpers/validations.cjs.map +1 -1
  67. package/dist/helpers/validations.mjs +2 -2
  68. package/dist/helpers/validations.mjs.map +1 -1
  69. package/dist/index.cjs +14 -11
  70. package/dist/index.d.cts +2 -2
  71. package/dist/index.d.mts +2 -2
  72. package/dist/index.mjs +3 -3
  73. package/dist/plugin-utils/deepkit.cjs +72 -0
  74. package/dist/plugin-utils/deepkit.cjs.map +1 -0
  75. package/dist/plugin-utils/deepkit.d.cts +24 -0
  76. package/dist/plugin-utils/deepkit.d.cts.map +1 -0
  77. package/dist/plugin-utils/deepkit.d.mts +24 -0
  78. package/dist/plugin-utils/deepkit.d.mts.map +1 -0
  79. package/dist/plugin-utils/deepkit.mjs +70 -0
  80. package/dist/plugin-utils/deepkit.mjs.map +1 -0
  81. package/dist/plugin-utils/description-helpers.cjs +105 -0
  82. package/dist/plugin-utils/description-helpers.cjs.map +1 -0
  83. package/dist/plugin-utils/description-helpers.d.cts +44 -0
  84. package/dist/plugin-utils/description-helpers.d.cts.map +1 -0
  85. package/dist/plugin-utils/description-helpers.d.mts +44 -0
  86. package/dist/plugin-utils/description-helpers.d.mts.map +1 -0
  87. package/dist/plugin-utils/description-helpers.mjs +101 -0
  88. package/dist/plugin-utils/description-helpers.mjs.map +1 -0
  89. package/dist/plugin-utils/get-command-tree.cjs +2 -2
  90. package/dist/plugin-utils/get-command-tree.cjs.map +1 -1
  91. package/dist/plugin-utils/index.cjs +32 -18
  92. package/dist/plugin-utils/index.d.cts +4 -1
  93. package/dist/plugin-utils/index.d.mts +4 -1
  94. package/dist/plugin-utils/index.mjs +4 -1
  95. package/dist/plugin-utils/reflect.cjs +4 -5
  96. package/dist/plugin-utils/reflect.cjs.map +1 -1
  97. package/dist/plugin-utils/reflect.mjs +4 -4
  98. package/dist/plugin-utils/reflect.mjs.map +1 -1
  99. package/dist/plugin-utils/type-checks.cjs +89 -0
  100. package/dist/plugin-utils/type-checks.cjs.map +1 -0
  101. package/dist/plugin-utils/type-checks.d.cts +42 -0
  102. package/dist/plugin-utils/type-checks.d.cts.map +1 -0
  103. package/dist/plugin-utils/type-checks.d.mts +42 -0
  104. package/dist/plugin-utils/type-checks.d.mts.map +1 -0
  105. package/dist/plugin-utils/type-checks.mjs +84 -0
  106. package/dist/plugin-utils/type-checks.mjs.map +1 -0
  107. package/dist/plugin.cjs +31 -29
  108. package/dist/plugin.cjs.map +1 -1
  109. package/dist/plugin.d.cts.map +1 -1
  110. package/dist/plugin.d.mts.map +1 -1
  111. package/dist/plugin.mjs +15 -13
  112. package/dist/plugin.mjs.map +1 -1
  113. package/dist/resolver/deepkit.cjs +132 -0
  114. package/dist/resolver/deepkit.cjs.map +1 -0
  115. package/dist/resolver/deepkit.mjs +131 -0
  116. package/dist/resolver/deepkit.mjs.map +1 -0
  117. package/dist/resolver/helpers.cjs +167 -0
  118. package/dist/resolver/helpers.cjs.map +1 -0
  119. package/dist/resolver/helpers.mjs +162 -0
  120. package/dist/resolver/helpers.mjs.map +1 -0
  121. package/dist/resolver/module.cjs +144 -0
  122. package/dist/resolver/module.cjs.map +1 -0
  123. package/dist/resolver/module.mjs +143 -0
  124. package/dist/resolver/module.mjs.map +1 -0
  125. package/dist/resolver/resolve.cjs +209 -0
  126. package/dist/resolver/resolve.cjs.map +1 -0
  127. package/dist/resolver/resolve.mjs +208 -0
  128. package/dist/resolver/resolve.mjs.map +1 -0
  129. package/dist/types/command.cjs +127 -104
  130. package/dist/types/command.cjs.map +1 -1
  131. package/dist/types/command.d.cts +39 -78
  132. package/dist/types/command.d.cts.map +1 -1
  133. package/dist/types/command.d.mts +39 -78
  134. package/dist/types/command.d.mts.map +1 -1
  135. package/dist/types/command.mjs +115 -95
  136. package/dist/types/command.mjs.map +1 -1
  137. package/dist/types/config.cjs +5 -3
  138. package/dist/types/config.cjs.map +1 -1
  139. package/dist/types/config.d.cts +7 -3
  140. package/dist/types/config.d.cts.map +1 -1
  141. package/dist/types/config.d.mts +7 -3
  142. package/dist/types/config.d.mts.map +1 -1
  143. package/dist/types/config.mjs +5 -3
  144. package/dist/types/config.mjs.map +1 -1
  145. package/dist/types/context.cjs +1 -1
  146. package/dist/types/context.cjs.map +1 -1
  147. package/dist/types/context.d.cts +2 -2
  148. package/dist/types/context.d.cts.map +1 -1
  149. package/dist/types/context.d.mts +2 -2
  150. package/dist/types/context.d.mts.map +1 -1
  151. package/dist/types/context.mjs +1 -1
  152. package/dist/types/context.mjs.map +1 -1
  153. package/dist/types/index.cjs +13 -10
  154. package/dist/types/index.d.cts +2 -2
  155. package/dist/types/index.d.mts +2 -2
  156. package/dist/types/index.mjs +2 -2
  157. package/package.json +24 -75
  158. package/dist/helpers/resolve-command.cjs +0 -430
  159. package/dist/helpers/resolve-command.cjs.map +0 -1
  160. package/dist/helpers/resolve-command.mjs +0 -425
  161. package/dist/helpers/resolve-command.mjs.map +0 -1
@@ -1,8 +1,8 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  const require_contexts_command = require('../contexts/command.cjs');
3
3
  const require_docs_helpers = require('../helpers/docs-helpers.cjs');
4
- const require_plugin_utils_context_helpers = require('../plugin-utils/context-helpers.cjs');
5
- const require_plugin_utils_reflect = require('../plugin-utils/reflect.cjs');
4
+ const require_context_helpers = require('../plugin-utils/context-helpers.cjs');
5
+ const require_reflect = require('../plugin-utils/reflect.cjs');
6
6
  const require_components_usage = require('./usage.cjs');
7
7
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
8
8
  let __alloy_js_core = require("@alloy-js/core");
@@ -21,7 +21,7 @@ function CommandOptionsDocs(props) {
21
21
  const { command } = props;
22
22
  if (Object.keys(command.options).length === 0) return __alloy_js_core.code`This command does not have any options.`;
23
23
  return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_markdown_components_markdown_table.MarkdownTable, { get data() {
24
- return require_plugin_utils_reflect.sortOptions(Object.values(command.options)).map((option) => {
24
+ return require_reflect.sortOptions(Object.values(command.options)).map((option) => {
25
25
  return {
26
26
  name: option.name.trim(),
27
27
  description: option.description.trim(),
@@ -44,7 +44,7 @@ function CommandDocsUsageExample(props) {
44
44
  (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_usage.Usage, {
45
45
  command,
46
46
  get bin() {
47
- return require_plugin_utils_context_helpers.getAppBin(context);
47
+ return require_context_helpers.getAppBin(context);
48
48
  },
49
49
  packageManager
50
50
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"docs.cjs","names":["code","For","memo","Show","Heading","Spacing","usePowerlines","MarkdownFile","MarkdownTable","joinPaths","CommandContext","getDocsOutputPath","getAppBin","sortOptions","Usage","CommandOptionsDocs","props","command","Object","keys","options","length","_$createComponent","data","values","map","option","name","trim","description","defaultValue","default","String","includes","required","optional","CommandDocsUsageExample","packageManager","context","_$createIntrinsic","bin","CommandDocs","levelOffset","usageExamples","level","children","title","_$memo","when","fallback","each","hardline","CommandDocsFile","rest","Provider","value","_$mergeProps","path"],"sources":["../../src/components/docs.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 { code, For, memo, Show } from \"@alloy-js/core\";\nimport { Heading } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { MarkdownFileProps } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownFile } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownTable } from \"@powerlines/plugin-alloy/markdown/components/markdown-table\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { CommandContext } from \"../contexts/command\";\nimport { getDocsOutputPath } from \"../helpers/docs-helpers\";\nimport { getAppBin } from \"../plugin-utils/context-helpers\";\nimport { sortOptions } from \"../plugin-utils/reflect\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { Usage } from \"./usage\";\n\nexport interface CommandOptionsDocsProps {\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the options markdown documentation for a command.\n */\nexport function CommandOptionsDocs(props: CommandOptionsDocsProps) {\n const { command } = props;\n if (Object.keys(command.options).length === 0) {\n return code`This command does not have any options.`;\n }\n\n return (\n <MarkdownTable\n data={sortOptions(Object.values(command.options)).map(option => {\n return {\n name: option.name.trim(),\n description: option.description.trim(),\n defaultValue: option.default\n ? String(option.default)?.includes('\"')\n ? option.default\n : `\\`${option.default}\\``\n : \"\",\n required: option.optional || option.default ? \"\" : \"✔\"\n };\n })}\n />\n );\n}\n\nexport interface CommandDocsUsageExampleProps {\n /**\n * The package manager to generate the usage example for.\n *\n * @remarks\n * If not specified, examples for all supported package managers will be generated.\n *\n * @defaultValue \"npm\"\n */\n packageManager?: \"npm\" | \"yarn\" | \"pnpm\" | \"bun\";\n\n /**\n * The command to generate the usage example for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocsUsageExample(props: CommandDocsUsageExampleProps) {\n const { packageManager = \"npm\", command } = props;\n\n const context = usePowerlines<Context>();\n\n return (\n <>\n <hbr />\n {code`\\`\\`\\`bash `}\n <hbr />\n <Usage\n command={command}\n bin={getAppBin(context)}\n packageManager={packageManager}\n />\n <hbr />\n {code`\\`\\`\\``}\n <hbr />\n </>\n );\n}\n\nexport interface CommandDocsProps {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n\n /**\n * Optional usage examples to include in the documentation.\n *\n * @defaultValue `[\"npm\"]`\n */\n usageExamples?: Required<CommandDocsUsageExampleProps>[\"packageManager\"][];\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocs(props: CommandDocsProps) {\n const { levelOffset = 0, command, usageExamples } = props;\n\n return (\n <>\n <Heading level={1 + levelOffset}>{command.title}</Heading>\n <Spacing />\n {code`${command.description}`}\n <Spacing />\n <Heading level={2 + levelOffset}>Usage</Heading>\n <Spacing />\n {code`The ${command.name} command can be executed using the following syntax: `}\n <Spacing />\n <Show\n when={usageExamples && usageExamples.length > 0}\n fallback={\n <CommandDocsUsageExample packageManager=\"npm\" command={command} />\n }>\n <For each={usageExamples!} hardline>\n {packageManager => (\n <CommandDocsUsageExample\n packageManager={packageManager}\n command={command}\n />\n )}\n </For>\n </Show>\n <Spacing />\n <Heading level={2 + levelOffset}>Options</Heading>\n <Spacing />\n {code`The following options are available for the ${\n command.name\n } command:`}\n <Spacing />\n <CommandOptionsDocs command={command} />\n <Spacing />\n </>\n );\n}\n\nexport interface CommandDocsFileProps extends Partial<MarkdownFileProps> {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation file for a command.\n */\nexport function CommandDocsFile(props: CommandDocsFileProps) {\n const { levelOffset = 0, command, ...rest } = props;\n\n const context = usePowerlines<Context>();\n const usageExamples = memo(\n () => [\"npm\", \"yarn\", \"pnpm\", \"bun\"] as CommandDocsProps[\"usageExamples\"]\n );\n\n return (\n <CommandContext.Provider value={command}>\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context), `${command.path}.md`)}\n {...rest}>\n <CommandDocs\n levelOffset={levelOffset}\n command={command}\n usageExamples={usageExamples()}\n />\n </MarkdownFile>\n </CommandContext.Provider>\n );\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"docs.cjs","names":["code","For","memo","Show","Heading","Spacing","usePowerlines","MarkdownFile","MarkdownTable","joinPaths","CommandContext","getDocsOutputPath","getAppBin","sortOptions","Usage","CommandOptionsDocs","props","command","Object","keys","options","length","_$createComponent","data","values","map","option","name","trim","description","defaultValue","default","String","includes","required","optional","CommandDocsUsageExample","packageManager","context","_$createIntrinsic","bin","CommandDocs","levelOffset","usageExamples","level","children","title","_$memo","when","fallback","each","hardline","CommandDocsFile","rest","Provider","value","_$mergeProps","path"],"sources":["../../src/components/docs.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 { code, For, memo, Show } from \"@alloy-js/core\";\nimport { Heading } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { MarkdownFileProps } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownFile } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownTable } from \"@powerlines/plugin-alloy/markdown/components/markdown-table\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { CommandContext } from \"../contexts/command\";\nimport { getDocsOutputPath } from \"../helpers/docs-helpers\";\nimport { getAppBin } from \"../plugin-utils/context-helpers\";\nimport { sortOptions } from \"../plugin-utils/reflect\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { Usage } from \"./usage\";\n\nexport interface CommandOptionsDocsProps {\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the options markdown documentation for a command.\n */\nexport function CommandOptionsDocs(props: CommandOptionsDocsProps) {\n const { command } = props;\n if (Object.keys(command.options).length === 0) {\n return code`This command does not have any options.`;\n }\n\n return (\n <MarkdownTable\n data={sortOptions(Object.values(command.options)).map(option => {\n return {\n name: option.name.trim(),\n description: option.description.trim(),\n defaultValue: option.default\n ? String(option.default)?.includes('\"')\n ? option.default\n : `\\`${option.default}\\``\n : \"\",\n required: option.optional || option.default ? \"\" : \"✔\"\n };\n })}\n />\n );\n}\n\nexport interface CommandDocsUsageExampleProps {\n /**\n * The package manager to generate the usage example for.\n *\n * @remarks\n * If not specified, examples for all supported package managers will be generated.\n *\n * @defaultValue \"npm\"\n */\n packageManager?: \"npm\" | \"yarn\" | \"pnpm\" | \"bun\";\n\n /**\n * The command to generate the usage example for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocsUsageExample(props: CommandDocsUsageExampleProps) {\n const { packageManager = \"npm\", command } = props;\n\n const context = usePowerlines<Context>();\n\n return (\n <>\n <hbr />\n {code`\\`\\`\\`bash `}\n <hbr />\n <Usage\n command={command}\n bin={getAppBin(context)}\n packageManager={packageManager}\n />\n <hbr />\n {code`\\`\\`\\``}\n <hbr />\n </>\n );\n}\n\nexport interface CommandDocsProps {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n\n /**\n * Optional usage examples to include in the documentation.\n *\n * @defaultValue `[\"npm\"]`\n */\n usageExamples?: Required<CommandDocsUsageExampleProps>[\"packageManager\"][];\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocs(props: CommandDocsProps) {\n const { levelOffset = 0, command, usageExamples } = props;\n\n return (\n <>\n <Heading level={1 + levelOffset}>{command.title}</Heading>\n <Spacing />\n {code`${command.description}`}\n <Spacing />\n <Heading level={2 + levelOffset}>Usage</Heading>\n <Spacing />\n {code`The ${command.name} command can be executed using the following syntax: `}\n <Spacing />\n <Show\n when={usageExamples && usageExamples.length > 0}\n fallback={\n <CommandDocsUsageExample packageManager=\"npm\" command={command} />\n }>\n <For each={usageExamples!} hardline>\n {packageManager => (\n <CommandDocsUsageExample\n packageManager={packageManager}\n command={command}\n />\n )}\n </For>\n </Show>\n <Spacing />\n <Heading level={2 + levelOffset}>Options</Heading>\n <Spacing />\n {code`The following options are available for the ${\n command.name\n } command:`}\n <Spacing />\n <CommandOptionsDocs command={command} />\n <Spacing />\n </>\n );\n}\n\nexport interface CommandDocsFileProps extends Partial<MarkdownFileProps> {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation file for a command.\n */\nexport function CommandDocsFile(props: CommandDocsFileProps) {\n const { levelOffset = 0, command, ...rest } = props;\n\n const context = usePowerlines<Context>();\n const usageExamples = memo(\n () => [\"npm\", \"yarn\", \"pnpm\", \"bun\"] as CommandDocsProps[\"usageExamples\"]\n );\n\n return (\n <CommandContext.Provider value={command}>\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context), `${command.path}.md`)}\n {...rest}>\n <CommandDocs\n levelOffset={levelOffset}\n command={command}\n usageExamples={usageExamples()}\n />\n </MarkdownFile>\n </CommandContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4CA,SAAgBe,mBAAmBC,OAAgC;CACjE,MAAM,EAAEC,YAAYD;AACpB,KAAIE,OAAOC,KAAKF,QAAQG,QAAQ,CAACC,WAAW,EAC1C,QAAOrB,oBAAI;AAGb,yDACGQ,4EAAa,EAAA,IACZe,OAAI;AAAA,SAAEV,4BAAYK,OAAOM,OAAOP,QAAQG,QAAQ,CAAC,CAACK,KAAIC,WAAU;AAC9D,UAAO;IACLC,MAAMD,OAAOC,KAAKC,MAAM;IACxBC,aAAaH,OAAOG,YAAYD,MAAM;IACtCE,cAAcJ,OAAOK,UACjBC,OAAON,OAAOK,QAAQ,EAAEE,SAAS,KAAI,GACnCP,OAAOK,UACP,KAAKL,OAAOK,QAAO,MACrB;IACJG,UAAUR,OAAOS,YAAYT,OAAOK,UAAU,KAAK;IACpD;IACD;IAAA,CAAA;;;;;AAyBR,SAAgBK,wBAAwBpB,OAAqC;CAC3E,MAAM,EAAEqB,iBAAiB,OAAOpB,YAAYD;CAE5C,MAAMsB,8EAAkC;AAExC,QAAA;mDAAA,OAAA,EAAA,CAAA;EAGKtC,oBAAI;mDAAa,OAAA,EAAA,CAAA;mDAEjBc,gCAAK;GACKG;GAAO,IAChBuB,MAAG;AAAA,WAAE5B,kCAAU0B,QAAQ;;GACPD;GAAc,CAAA;mDAAA,OAAA,EAAA,CAAA;EAG/BrC,oBAAI;mDAAQ,OAAA,EAAA,CAAA;EAAA;;;;;AAiCnB,SAAgByC,YAAYzB,OAAyB;CACnD,MAAM,EAAE0B,cAAc,GAAGzB,SAAS0B,kBAAkB3B;AAEpD,QAAA;mDAEKZ,6BAAO;GAACwC,OAAO,IAAIF;GAAW,IAAAG,WAAA;AAAA,WAAG5B,QAAQ6B;;GAAK,CAAA;mDAC9CzC,2DAAO,EAAA,CAAA;8CACPL,oBAAI,GAAGiB,QAAQY,cAAa;mDAC5BxB,2DAAO,EAAA,CAAA;mDACPD,6BAAO;GAACwC,OAAO,IAAIF;GAAWG,UAAA;GAAA,CAAA;mDAC9BxC,2DAAO,EAAA,CAAA;8CACPL,oBAAI,OAAOiB,QAAQU,KAAI,uDAAuD;mDAC9EtB,2DAAO,EAAA,CAAA;mDACPF,sBAAI;GAAA,IACH6C,OAAI;AAAA,WAAEL,iBAAiBA,cAActB,SAAS;;GAAC,IAC/C4B,WAAQ;AAAA,4DACLb,yBAAuB;KAACC,gBAAc;KAAgBpB;KAAO,CAAA;;GAAA,IAAA4B,WAAA;AAAA,4DAE/D5C,qBAAG;KAACiD,MAAMP;KAAgBQ,UAAQ;KAAAN,WAChCR,oEACED,yBAAuB;MACNC;MACPpB;MAAO,CAAA;KAEnB,CAAA;;GAAA,CAAA;mDAGJZ,2DAAO,EAAA,CAAA;mDACPD,6BAAO;GAACwC,OAAO,IAAIF;GAAWG,UAAA;GAAA,CAAA;mDAC9BxC,2DAAO,EAAA,CAAA;8CACPL,oBAAI,+CACHiB,QAAQU,KAAI,WACH;mDACVtB,2DAAO,EAAA,CAAA;mDACPU,oBAAkB,EAAUE,SAAO,CAAA;mDACnCZ,2DAAO,EAAA,CAAA;EAAA;;;;;AAyBd,SAAgB+C,gBAAgBpC,OAA6B;CAC3D,MAAM,EAAE0B,cAAc,GAAGzB,SAAS,GAAGoC,SAASrC;CAE9C,MAAMsB,8EAAkC;CACxC,MAAMK,gDACE;EAAC;EAAO;EAAQ;EAAQ;EAChC,CAAC;AAED,yDACGjC,wCAAe4C,UAAQ;EAACC,OAAOtC;EAAO,IAAA4B,WAAA;AAAA,2DACpCtC,sHAAY,EAAA,IACXkD,OAAI;AAAA,6CAAY9C,uCAAkB2B,QAAQ,EAAE,GAAGrB,QAAQwC,KAAI,KAAM;MAAA,EAC7DJ,MAAI,EAAA,IAAAR,WAAA;AAAA,4DACPJ,aAAW;KACGC;KACJzB;KAAO,IAChB0B,gBAAa;AAAA,aAAEA,eAAe;;KAAA,CAAA;MAAA,CAAA,CAAA;;EAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { CommandTree } from "../types/command.cjs";
2
- import * as _alloy_js_core16 from "@alloy-js/core";
2
+ import * as _alloy_js_core5 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_core16.Children;
15
+ declare function CommandOptionsDocs(props: CommandOptionsDocsProps): _alloy_js_core5.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_core16.Children;
34
+ declare function CommandDocsUsageExample(props: CommandDocsUsageExampleProps): _alloy_js_core5.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_core16.Children;
59
+ declare function CommandDocs(props: CommandDocsProps): _alloy_js_core5.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_core16.Children;
78
+ declare function CommandDocsFile(props: CommandDocsFileProps): _alloy_js_core5.Children;
79
79
  //#endregion
80
80
  export { CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps };
81
81
  //# sourceMappingURL=docs.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"docs.d.cts","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":[],"mappings":";;;;;UAkCiB,uBAAA;;;AAAjB;EAUgB,OAAA,EANL,WAMK;AAwBhB;AAoBA;AAsBA;;AAqB2B,iBAvFX,kBAAA,CAuFW,KAAA,EAvFe,uBAuFf,CAAA,EAvFsC,gBAAA,CAAA,QAuFtC;AAAT,UA/DD,4BAAA,CA+DC;EAAQ;AAM1B;AAwCA;;;;;AAoBA;;;;;WAnHW;;;;;iBAMK,uBAAA,QAA+B,+BAA4B,gBAAA,CAAA;UAsB1D,gBAAA;;;;;;;;;;;;;WAcN;;;;;;kBAOO,SAAS;;;;;iBAMX,WAAA,QAAmB,mBAAgB,gBAAA,CAAA;UAwClC,oBAAA,SAA6B,QAAQ;;;;;;;;;;;;;WAc3C;;;;;iBAMK,eAAA,QAAuB,uBAAoB,gBAAA,CAAA"}
1
+ {"version":3,"file":"docs.d.cts","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":[],"mappings":";;;;;UAkCiB,uBAAA;;;AAAjB;EAUgB,OAAA,EANL,WAMK;AAwBhB;AAoBA;AAsBA;;AAqB2B,iBAvFX,kBAAA,CAuFW,KAAA,EAvFe,uBAuFf,CAAA,EAvFsC,eAAA,CAAA,QAuFtC;AAAT,UA/DD,4BAAA,CA+DC;EAAQ;AAM1B;AAwCA;;;;;AAoBA;;;;;WAnHW;;;;;iBAMK,uBAAA,QAA+B,+BAA4B,eAAA,CAAA;UAsB1D,gBAAA;;;;;;;;;;;;;WAcN;;;;;;kBAOO,SAAS;;;;;iBAMX,WAAA,QAAmB,mBAAgB,eAAA,CAAA;UAwClC,oBAAA,SAA6B,QAAQ;;;;;;;;;;;;;WAc3C;;;;;iBAMK,eAAA,QAAuB,uBAAoB,eAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { CommandTree } from "../types/command.mjs";
2
- import * as _alloy_js_core21 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_core21.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_core21.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_core21.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_core21.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.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"docs.d.mts","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":[],"mappings":";;;;;UAkCiB,uBAAA;;;AAAjB;EAUgB,OAAA,EANL,WAMK;AAwBhB;AAoBA;AAsBA;;AAqB2B,iBAvFX,kBAAA,CAuFW,KAAA,EAvFe,uBAuFf,CAAA,EAvFsC,gBAAA,CAAA,QAuFtC;AAAT,UA/DD,4BAAA,CA+DC;EAAQ;AAM1B;AAwCA;;;;;AAoBA;;;;;WAnHW;;;;;iBAMK,uBAAA,QAA+B,+BAA4B,gBAAA,CAAA;UAsB1D,gBAAA;;;;;;;;;;;;;WAcN;;;;;;kBAOO,SAAS;;;;;iBAMX,WAAA,QAAmB,mBAAgB,gBAAA,CAAA;UAwClC,oBAAA,SAA6B,QAAQ;;;;;;;;;;;;;WAc3C;;;;;iBAMK,eAAA,QAAuB,uBAAoB,gBAAA,CAAA"}
1
+ {"version":3,"file":"docs.d.mts","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":[],"mappings":";;;;;UAkCiB,uBAAA;;;AAAjB;EAUgB,OAAA,EANL,WAMK;AAwBhB;AAoBA;AAsBA;;AAqB2B,iBAvFX,kBAAA,CAuFW,KAAA,EAvFe,uBAuFf,CAAA,EAvFsC,eAAA,CAAA,QAuFtC;AAAT,UA/DD,4BAAA,CA+DC;EAAQ;AAM1B;AAwCA;;;;;AAoBA;;;;;WAnHW;;;;;iBAMK,uBAAA,QAA+B,+BAA4B,eAAA,CAAA;UAsB1D,gBAAA;;;;;;;;;;;;;WAcN;;;;;;kBAOO,SAAS;;;;;iBAMX,WAAA,QAAmB,mBAAgB,eAAA,CAAA;UAwClC,oBAAA,SAA6B,QAAQ;;;;;;;;;;;;;WAc3C;;;;;iBAMK,eAAA,QAAuB,uBAAoB,eAAA,CAAA"}
@@ -1,4 +1,5 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_types_command = require('../types/command.cjs');
2
3
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
3
4
  let __alloy_js_core = require("@alloy-js/core");
4
5
 
@@ -52,9 +53,17 @@ function IsNotVerbose() {
52
53
  __alloy_js_core.code`)`
53
54
  ];
54
55
  }
56
+ /**
57
+ * Write the type declaration for a command parameter based on its configuration.
58
+ */
59
+ function CommandParameterType(props) {
60
+ const { parameter } = props;
61
+ return __alloy_js_core.code`${(parameter.kind === require_types_command.CommandParameterKinds.string || parameter.kind === require_types_command.CommandParameterKinds.number) && parameter.choices && parameter.choices.length > 0 ? parameter.choices.map((choice) => typeof choice === "string" ? `"${choice}"` : choice).join(" | ") : parameter.kind === require_types_command.CommandParameterKinds.boolean ? "boolean" : parameter.kind === require_types_command.CommandParameterKinds.number ? "number" : "string"}${(parameter.kind === require_types_command.CommandParameterKinds.string || parameter.kind === require_types_command.CommandParameterKinds.number) && parameter.variadic ? "[]" : ""}${parameter.optional ? " | undefined" : ""}`;
62
+ }
55
63
 
56
64
  //#endregion
57
65
  exports.BooleanInputParserLogic = BooleanInputParserLogic;
66
+ exports.CommandParameterType = CommandParameterType;
58
67
  exports.IsDebug = IsDebug;
59
68
  exports.IsNotDebug = IsNotDebug;
60
69
  exports.IsNotVerbose = IsNotVerbose;
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.cjs","names":["code","BooleanInputParserLogic","props","name","IsDebug","IsNotDebug","_$createComponent","IsVerbose","IsNotVerbose"],"sources":["../../src/components/helpers.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 { code } from \"@alloy-js/core\";\n\nexport interface BooleanInputParserLogicProps {\n name: string;\n}\n\n/**\n * Parses a string input into a boolean value, interpreting common truthy and falsy string representations.\n */\nexport function BooleanInputParserLogic(props: BooleanInputParserLogicProps) {\n const { name } = props;\n\n return (\n <>{code` !!${name} && ${name}.toLowerCase() !== \"false\" && ${\n name\n }.toLowerCase() !== \"f\" && ${name}.toLowerCase() !== \"no\" && ${\n name\n } !== \"n\" && ${name}.toLowerCase() !== \"0\" && ${\n name\n }.toLowerCase() !== \"off\" && ${\n name\n } !== \"disable\" && ${name}.toLowerCase() !== \"disabled\" && ${\n name\n }.toLowerCase() !== \"never\" && (Number.isNaN(Number.parseFloat(${\n name\n })) || Number.parseFloat(${name}) > 0) `}</>\n );\n}\n\n/**\n * Write the logic to determine if the application is running in debug mode.\n *\n * @remarks\n * This is used to conditionally include debug-only logic in the generated application, such as additional logging or development tools. The logic should check for common indicators of debug mode, such as environment variables or the presence of a debugger.\n */\nexport function IsDebug() {\n return code`isDevelopment || isDebug || env.LOG_LEVEL === \"debug\"`;\n}\n\n/**\n * Write the logic to determine if the application is **not** running in debug mode.\n */\nexport function IsNotDebug() {\n return (\n <>\n {code`!(`}\n <IsDebug />\n {code`)`}\n </>\n );\n}\n\n/**\n * Write the logic to determine if the application is running in verbose mode.\n *\n * @remarks\n * This is used to conditionally include verbose-only logic in the generated application, such as additional logging or detailed output. The logic should check for common indicators of verbose mode, such as environment variables or command-line flags.\n */\nexport function IsVerbose() {\n return (\n <>\n {code`( `}\n <IsDebug />\n {code`|| hasFlag([\"verbose\", \"verbose=true\", \"verbose=always\"]))`}\n </>\n );\n}\n\n/**\n * Write the logic to determine if the application is **not** running in verbose mode.\n */\nexport function IsNotVerbose() {\n return (\n <>\n {code`!(`}\n <IsVerbose />\n {code`)`}\n </>\n );\n}\n"],"mappings":";;;;;;;;AA2BA,SAAgBC,wBAAwBC,OAAqC;CAC3E,MAAM,EAAEC,SAASD;AAEjB,QAAA,CACKF,oBAAI,MAAMG,KAAI,MAAOA,KAAI,gCAC1BA,KAAI,4BACuBA,KAAI,6BAC/BA,KAAI,cACSA,KAAI,4BACjBA,KAAI,8BAEJA,KAAI,oBACeA,KAAI,mCACvBA,KAAI,gEAEJA,KAAI,0BACqBA,KAAI,SAAS;;;;;;;;AAU5C,SAAgBC,UAAU;AACxB,QAAOJ,oBAAI;;;;;AAMb,SAAgBK,aAAa;AAC3B,QAAA;EAEKL,oBAAI;mDACJI,SAAO,EAAA,CAAA;EACPJ,oBAAI;EAAG;;;;;;;;AAWd,SAAgBO,YAAY;AAC1B,QAAA;EAEKP,oBAAI;mDACJI,SAAO,EAAA,CAAA;EACPJ,oBAAI;EAA4D;;;;;AAQvE,SAAgBQ,eAAe;AAC7B,QAAA;EAEKR,oBAAI;mDACJO,WAAS,EAAA,CAAA;EACTP,oBAAI;EAAG"}
1
+ {"version":3,"file":"helpers.cjs","names":["code","CommandParameterKinds","BooleanInputParserLogic","props","name","IsDebug","IsNotDebug","_$createComponent","IsVerbose","IsNotVerbose","CommandParameterType","parameter","kind","string","number","choices","length","map","choice","join","boolean","variadic","optional"],"sources":["../../src/components/helpers.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 { code } from \"@alloy-js/core\";\nimport type { CommandParameter } from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\n\nexport interface BooleanInputParserLogicProps {\n name: string;\n}\n\n/**\n * Parses a string input into a boolean value, interpreting common truthy and falsy string representations.\n */\nexport function BooleanInputParserLogic(props: BooleanInputParserLogicProps) {\n const { name } = props;\n\n return (\n <>{code` !!${name} && ${name}.toLowerCase() !== \"false\" && ${\n name\n }.toLowerCase() !== \"f\" && ${name}.toLowerCase() !== \"no\" && ${\n name\n } !== \"n\" && ${name}.toLowerCase() !== \"0\" && ${\n name\n }.toLowerCase() !== \"off\" && ${\n name\n } !== \"disable\" && ${name}.toLowerCase() !== \"disabled\" && ${\n name\n }.toLowerCase() !== \"never\" && (Number.isNaN(Number.parseFloat(${\n name\n })) || Number.parseFloat(${name}) > 0) `}</>\n );\n}\n\n/**\n * Write the logic to determine if the application is running in debug mode.\n *\n * @remarks\n * This is used to conditionally include debug-only logic in the generated application, such as additional logging or development tools. The logic should check for common indicators of debug mode, such as environment variables or the presence of a debugger.\n */\nexport function IsDebug() {\n return code`isDevelopment || isDebug || env.LOG_LEVEL === \"debug\"`;\n}\n\n/**\n * Write the logic to determine if the application is **not** running in debug mode.\n */\nexport function IsNotDebug() {\n return (\n <>\n {code`!(`}\n <IsDebug />\n {code`)`}\n </>\n );\n}\n\n/**\n * Write the logic to determine if the application is running in verbose mode.\n *\n * @remarks\n * This is used to conditionally include verbose-only logic in the generated application, such as additional logging or detailed output. The logic should check for common indicators of verbose mode, such as environment variables or command-line flags.\n */\nexport function IsVerbose() {\n return (\n <>\n {code`( `}\n <IsDebug />\n {code`|| hasFlag([\"verbose\", \"verbose=true\", \"verbose=always\"]))`}\n </>\n );\n}\n\n/**\n * Write the logic to determine if the application is **not** running in verbose mode.\n */\nexport function IsNotVerbose() {\n return (\n <>\n {code`!(`}\n <IsVerbose />\n {code`)`}\n </>\n );\n}\n\n/**\n * Write the type declaration for a command parameter based on its configuration.\n */\nexport function CommandParameterType(props: { parameter: CommandParameter }) {\n const { parameter } = props;\n\n return code`${\n (parameter.kind === CommandParameterKinds.string ||\n parameter.kind === CommandParameterKinds.number) &&\n parameter.choices &&\n parameter.choices.length > 0\n ? parameter.choices\n .map(choice => (typeof choice === \"string\" ? `\"${choice}\"` : choice))\n .join(\" | \")\n : parameter.kind === CommandParameterKinds.boolean\n ? \"boolean\"\n : parameter.kind === CommandParameterKinds.number\n ? \"number\"\n : \"string\"\n }${\n (parameter.kind === CommandParameterKinds.string ||\n parameter.kind === CommandParameterKinds.number) &&\n parameter.variadic\n ? \"[]\"\n : \"\"\n }${parameter.optional ? \" | undefined\" : \"\"}`;\n}\n"],"mappings":";;;;;;;;;AA6BA,SAAgBE,wBAAwBC,OAAqC;CAC3E,MAAM,EAAEC,SAASD;AAEjB,QAAA,CACKH,oBAAI,MAAMI,KAAI,MAAOA,KAAI,gCAC1BA,KAAI,4BACuBA,KAAI,6BAC/BA,KAAI,cACSA,KAAI,4BACjBA,KAAI,8BAEJA,KAAI,oBACeA,KAAI,mCACvBA,KAAI,gEAEJA,KAAI,0BACqBA,KAAI,SAAS;;;;;;;;AAU5C,SAAgBC,UAAU;AACxB,QAAOL,oBAAI;;;;;AAMb,SAAgBM,aAAa;AAC3B,QAAA;EAEKN,oBAAI;mDACJK,SAAO,EAAA,CAAA;EACPL,oBAAI;EAAG;;;;;;;;AAWd,SAAgBQ,YAAY;AAC1B,QAAA;EAEKR,oBAAI;mDACJK,SAAO,EAAA,CAAA;EACPL,oBAAI;EAA4D;;;;;AAQvE,SAAgBS,eAAe;AAC7B,QAAA;EAEKT,oBAAI;mDACJQ,WAAS,EAAA,CAAA;EACTR,oBAAI;EAAG;;;;;AAQd,SAAgBU,qBAAqBP,OAAwC;CAC3E,MAAM,EAAEQ,cAAcR;AAEtB,QAAOH,oBAAI,IACRW,UAAUC,SAASX,4CAAsBY,UACxCF,UAAUC,SAASX,4CAAsBa,WAC3CH,UAAUI,WACVJ,UAAUI,QAAQC,SAAS,IACvBL,UAAUI,QACPE,KAAIC,WAAW,OAAOA,WAAW,WAAW,IAAIA,OAAM,KAAMA,OAAQ,CACpEC,KAAK,MAAM,GACdR,UAAUC,SAASX,4CAAsBmB,UACvC,YACAT,UAAUC,SAASX,4CAAsBa,SACvC,WACA,YAEPH,UAAUC,SAASX,4CAAsBY,UACxCF,UAAUC,SAASX,4CAAsBa,WAC3CH,UAAUU,WACN,OACA,KACHV,UAAUW,WAAW,iBAAiB"}
@@ -1,4 +1,6 @@
1
- import * as _alloy_js_core20 from "@alloy-js/core";
1
+ import { CommandParameter } from "../types/command.cjs";
2
+ import "../types/index.cjs";
3
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
4
 
3
5
  //#region src/components/helpers.d.ts
4
6
  interface BooleanInputParserLogicProps {
@@ -7,29 +9,35 @@ interface BooleanInputParserLogicProps {
7
9
  /**
8
10
  * Parses a string input into a boolean value, interpreting common truthy and falsy string representations.
9
11
  */
10
- declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): _alloy_js_core20.Children;
12
+ declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): _alloy_js_core0.Children;
11
13
  /**
12
14
  * Write the logic to determine if the application is running in debug mode.
13
15
  *
14
16
  * @remarks
15
17
  * This is used to conditionally include debug-only logic in the generated application, such as additional logging or development tools. The logic should check for common indicators of debug mode, such as environment variables or the presence of a debugger.
16
18
  */
17
- declare function IsDebug(): _alloy_js_core20.Children;
19
+ declare function IsDebug(): _alloy_js_core0.Children;
18
20
  /**
19
21
  * Write the logic to determine if the application is **not** running in debug mode.
20
22
  */
21
- declare function IsNotDebug(): _alloy_js_core20.Children;
23
+ declare function IsNotDebug(): _alloy_js_core0.Children;
22
24
  /**
23
25
  * Write the logic to determine if the application is running in verbose mode.
24
26
  *
25
27
  * @remarks
26
28
  * This is used to conditionally include verbose-only logic in the generated application, such as additional logging or detailed output. The logic should check for common indicators of verbose mode, such as environment variables or command-line flags.
27
29
  */
28
- declare function IsVerbose(): _alloy_js_core20.Children;
30
+ declare function IsVerbose(): _alloy_js_core0.Children;
29
31
  /**
30
32
  * Write the logic to determine if the application is **not** running in verbose mode.
31
33
  */
32
- declare function IsNotVerbose(): _alloy_js_core20.Children;
34
+ declare function IsNotVerbose(): _alloy_js_core0.Children;
35
+ /**
36
+ * Write the type declaration for a command parameter based on its configuration.
37
+ */
38
+ declare function CommandParameterType(props: {
39
+ parameter: CommandParameter;
40
+ }): _alloy_js_core0.Children;
33
41
  //#endregion
34
- export { BooleanInputParserLogic, BooleanInputParserLogicProps, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose };
42
+ export { BooleanInputParserLogic, BooleanInputParserLogicProps, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose };
35
43
  //# sourceMappingURL=helpers.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.cts","names":[],"sources":["../../src/components/helpers.tsx"],"sourcesContent":[],"mappings":";;;UAoBiB,4BAAA;;;AAAjB;AAOA;AA0BA;AAOgB,iBAjCA,uBAAA,CAiCU,KAAA,EAjCqB,4BAiCrB,CAAA,EAjCiD,gBAAA,CAAA,QAiCjD;AAgB1B;AAaA;;;;;iBApCgB,OAAA,CAAA,GAAO,gBAAA,CAAA;;;;iBAOP,UAAA,CAAA,GAAU,gBAAA,CAAA;;;;;;;iBAgBV,SAAA,CAAA,GAAS,gBAAA,CAAA;;;;iBAaT,YAAA,CAAA,GAAY,gBAAA,CAAA"}
1
+ {"version":3,"file":"helpers.d.cts","names":[],"sources":["../../src/components/helpers.tsx"],"sourcesContent":[],"mappings":";;;;;UAsBiB,4BAAA;;;;AAAjB;AAOA;AA0BgB,iBA1BA,uBAAA,CA0BO,KAAA,EA1BwB,4BA0BxB,CAAA,EA1BoD,eAAA,CAAA,QA0BpD;AAOvB;AAgBA;AAaA;AAaA;;;iBAjDgB,OAAA,CAAA,GAAO,eAAA,CAAA;;;;iBAOP,UAAA,CAAA,GAAU,eAAA,CAAA;;;;;;;iBAgBV,SAAA,CAAA,GAAS,eAAA,CAAA;;;;iBAaT,YAAA,CAAA,GAAY,eAAA,CAAA;;;;iBAaZ,oBAAA;aAAyC;IAAgB,eAAA,CAAE"}
@@ -1,4 +1,6 @@
1
- import * as _alloy_js_core8 from "@alloy-js/core";
1
+ import { CommandParameter } from "../types/command.mjs";
2
+ import "../types/index.mjs";
3
+ import * as _alloy_js_core3 from "@alloy-js/core";
2
4
 
3
5
  //#region src/components/helpers.d.ts
4
6
  interface BooleanInputParserLogicProps {
@@ -7,29 +9,35 @@ interface BooleanInputParserLogicProps {
7
9
  /**
8
10
  * Parses a string input into a boolean value, interpreting common truthy and falsy string representations.
9
11
  */
10
- declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): _alloy_js_core8.Children;
12
+ declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): _alloy_js_core3.Children;
11
13
  /**
12
14
  * Write the logic to determine if the application is running in debug mode.
13
15
  *
14
16
  * @remarks
15
17
  * This is used to conditionally include debug-only logic in the generated application, such as additional logging or development tools. The logic should check for common indicators of debug mode, such as environment variables or the presence of a debugger.
16
18
  */
17
- declare function IsDebug(): _alloy_js_core8.Children;
19
+ declare function IsDebug(): _alloy_js_core3.Children;
18
20
  /**
19
21
  * Write the logic to determine if the application is **not** running in debug mode.
20
22
  */
21
- declare function IsNotDebug(): _alloy_js_core8.Children;
23
+ declare function IsNotDebug(): _alloy_js_core3.Children;
22
24
  /**
23
25
  * Write the logic to determine if the application is running in verbose mode.
24
26
  *
25
27
  * @remarks
26
28
  * This is used to conditionally include verbose-only logic in the generated application, such as additional logging or detailed output. The logic should check for common indicators of verbose mode, such as environment variables or command-line flags.
27
29
  */
28
- declare function IsVerbose(): _alloy_js_core8.Children;
30
+ declare function IsVerbose(): _alloy_js_core3.Children;
29
31
  /**
30
32
  * Write the logic to determine if the application is **not** running in verbose mode.
31
33
  */
32
- declare function IsNotVerbose(): _alloy_js_core8.Children;
34
+ declare function IsNotVerbose(): _alloy_js_core3.Children;
35
+ /**
36
+ * Write the type declaration for a command parameter based on its configuration.
37
+ */
38
+ declare function CommandParameterType(props: {
39
+ parameter: CommandParameter;
40
+ }): _alloy_js_core3.Children;
33
41
  //#endregion
34
- export { BooleanInputParserLogic, BooleanInputParserLogicProps, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose };
42
+ export { BooleanInputParserLogic, BooleanInputParserLogicProps, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose };
35
43
  //# sourceMappingURL=helpers.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.mts","names":[],"sources":["../../src/components/helpers.tsx"],"sourcesContent":[],"mappings":";;;UAoBiB,4BAAA;;;AAAjB;AAOA;AA0BA;AAOgB,iBAjCA,uBAAA,CAiCU,KAAA,EAjCqB,4BAiCrB,CAAA,EAjCiD,eAAA,CAAA,QAiCjD;AAgB1B;AAaA;;;;;iBApCgB,OAAA,CAAA,GAAO,eAAA,CAAA;;;;iBAOP,UAAA,CAAA,GAAU,eAAA,CAAA;;;;;;;iBAgBV,SAAA,CAAA,GAAS,eAAA,CAAA;;;;iBAaT,YAAA,CAAA,GAAY,eAAA,CAAA"}
1
+ {"version":3,"file":"helpers.d.mts","names":[],"sources":["../../src/components/helpers.tsx"],"sourcesContent":[],"mappings":";;;;;UAsBiB,4BAAA;;;;AAAjB;AAOA;AA0BgB,iBA1BA,uBAAA,CA0BO,KAAA,EA1BwB,4BA0BxB,CAAA,EA1BoD,eAAA,CAAA,QA0BpD;AAOvB;AAgBA;AAaA;AAaA;;;iBAjDgB,OAAA,CAAA,GAAO,eAAA,CAAA;;;;iBAOP,UAAA,CAAA,GAAU,eAAA,CAAA;;;;;;;iBAgBV,SAAA,CAAA,GAAS,eAAA,CAAA;;;;iBAaT,YAAA,CAAA,GAAY,eAAA,CAAA;;;;iBAaZ,oBAAA;aAAyC;IAAgB,eAAA,CAAE"}
@@ -1,3 +1,4 @@
1
+ import { CommandParameterKinds } from "../types/command.mjs";
1
2
  import { createComponent } from "@alloy-js/core/jsx-runtime";
2
3
  import { code } from "@alloy-js/core";
3
4
 
@@ -51,7 +52,14 @@ function IsNotVerbose() {
51
52
  code`)`
52
53
  ];
53
54
  }
55
+ /**
56
+ * Write the type declaration for a command parameter based on its configuration.
57
+ */
58
+ function CommandParameterType(props) {
59
+ const { parameter } = props;
60
+ return code`${(parameter.kind === CommandParameterKinds.string || parameter.kind === CommandParameterKinds.number) && parameter.choices && parameter.choices.length > 0 ? parameter.choices.map((choice) => typeof choice === "string" ? `"${choice}"` : choice).join(" | ") : parameter.kind === CommandParameterKinds.boolean ? "boolean" : parameter.kind === CommandParameterKinds.number ? "number" : "string"}${(parameter.kind === CommandParameterKinds.string || parameter.kind === CommandParameterKinds.number) && parameter.variadic ? "[]" : ""}${parameter.optional ? " | undefined" : ""}`;
61
+ }
54
62
 
55
63
  //#endregion
56
- export { BooleanInputParserLogic, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose };
64
+ export { BooleanInputParserLogic, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose };
57
65
  //# sourceMappingURL=helpers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.mjs","names":["code","BooleanInputParserLogic","props","name","IsDebug","IsNotDebug","_$createComponent","IsVerbose","IsNotVerbose"],"sources":["../../src/components/helpers.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 { code } from \"@alloy-js/core\";\n\nexport interface BooleanInputParserLogicProps {\n name: string;\n}\n\n/**\n * Parses a string input into a boolean value, interpreting common truthy and falsy string representations.\n */\nexport function BooleanInputParserLogic(props: BooleanInputParserLogicProps) {\n const { name } = props;\n\n return (\n <>{code` !!${name} && ${name}.toLowerCase() !== \"false\" && ${\n name\n }.toLowerCase() !== \"f\" && ${name}.toLowerCase() !== \"no\" && ${\n name\n } !== \"n\" && ${name}.toLowerCase() !== \"0\" && ${\n name\n }.toLowerCase() !== \"off\" && ${\n name\n } !== \"disable\" && ${name}.toLowerCase() !== \"disabled\" && ${\n name\n }.toLowerCase() !== \"never\" && (Number.isNaN(Number.parseFloat(${\n name\n })) || Number.parseFloat(${name}) > 0) `}</>\n );\n}\n\n/**\n * Write the logic to determine if the application is running in debug mode.\n *\n * @remarks\n * This is used to conditionally include debug-only logic in the generated application, such as additional logging or development tools. The logic should check for common indicators of debug mode, such as environment variables or the presence of a debugger.\n */\nexport function IsDebug() {\n return code`isDevelopment || isDebug || env.LOG_LEVEL === \"debug\"`;\n}\n\n/**\n * Write the logic to determine if the application is **not** running in debug mode.\n */\nexport function IsNotDebug() {\n return (\n <>\n {code`!(`}\n <IsDebug />\n {code`)`}\n </>\n );\n}\n\n/**\n * Write the logic to determine if the application is running in verbose mode.\n *\n * @remarks\n * This is used to conditionally include verbose-only logic in the generated application, such as additional logging or detailed output. The logic should check for common indicators of verbose mode, such as environment variables or command-line flags.\n */\nexport function IsVerbose() {\n return (\n <>\n {code`( `}\n <IsDebug />\n {code`|| hasFlag([\"verbose\", \"verbose=true\", \"verbose=always\"]))`}\n </>\n );\n}\n\n/**\n * Write the logic to determine if the application is **not** running in verbose mode.\n */\nexport function IsNotVerbose() {\n return (\n <>\n {code`!(`}\n <IsVerbose />\n {code`)`}\n </>\n );\n}\n"],"mappings":";;;;;;;AA2BA,SAAgBC,wBAAwBC,OAAqC;CAC3E,MAAM,EAAEC,SAASD;AAEjB,QAAA,CACKF,IAAI,MAAMG,KAAI,MAAOA,KAAI,gCAC1BA,KAAI,4BACuBA,KAAI,6BAC/BA,KAAI,cACSA,KAAI,4BACjBA,KAAI,8BAEJA,KAAI,oBACeA,KAAI,mCACvBA,KAAI,gEAEJA,KAAI,0BACqBA,KAAI,SAAS;;;;;;;;AAU5C,SAAgBC,UAAU;AACxB,QAAOJ,IAAI;;;;;AAMb,SAAgBK,aAAa;AAC3B,QAAA;EAEKL,IAAI;EAAIM,gBACRF,SAAO,EAAA,CAAA;EACPJ,IAAI;EAAG;;;;;;;;AAWd,SAAgBO,YAAY;AAC1B,QAAA;EAEKP,IAAI;EAAIM,gBACRF,SAAO,EAAA,CAAA;EACPJ,IAAI;EAA4D;;;;;AAQvE,SAAgBQ,eAAe;AAC7B,QAAA;EAEKR,IAAI;EAAIM,gBACRC,WAAS,EAAA,CAAA;EACTP,IAAI;EAAG"}
1
+ {"version":3,"file":"helpers.mjs","names":["code","CommandParameterKinds","BooleanInputParserLogic","props","name","IsDebug","IsNotDebug","_$createComponent","IsVerbose","IsNotVerbose","CommandParameterType","parameter","kind","string","number","choices","length","map","choice","join","boolean","variadic","optional"],"sources":["../../src/components/helpers.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 { code } from \"@alloy-js/core\";\nimport type { CommandParameter } from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\n\nexport interface BooleanInputParserLogicProps {\n name: string;\n}\n\n/**\n * Parses a string input into a boolean value, interpreting common truthy and falsy string representations.\n */\nexport function BooleanInputParserLogic(props: BooleanInputParserLogicProps) {\n const { name } = props;\n\n return (\n <>{code` !!${name} && ${name}.toLowerCase() !== \"false\" && ${\n name\n }.toLowerCase() !== \"f\" && ${name}.toLowerCase() !== \"no\" && ${\n name\n } !== \"n\" && ${name}.toLowerCase() !== \"0\" && ${\n name\n }.toLowerCase() !== \"off\" && ${\n name\n } !== \"disable\" && ${name}.toLowerCase() !== \"disabled\" && ${\n name\n }.toLowerCase() !== \"never\" && (Number.isNaN(Number.parseFloat(${\n name\n })) || Number.parseFloat(${name}) > 0) `}</>\n );\n}\n\n/**\n * Write the logic to determine if the application is running in debug mode.\n *\n * @remarks\n * This is used to conditionally include debug-only logic in the generated application, such as additional logging or development tools. The logic should check for common indicators of debug mode, such as environment variables or the presence of a debugger.\n */\nexport function IsDebug() {\n return code`isDevelopment || isDebug || env.LOG_LEVEL === \"debug\"`;\n}\n\n/**\n * Write the logic to determine if the application is **not** running in debug mode.\n */\nexport function IsNotDebug() {\n return (\n <>\n {code`!(`}\n <IsDebug />\n {code`)`}\n </>\n );\n}\n\n/**\n * Write the logic to determine if the application is running in verbose mode.\n *\n * @remarks\n * This is used to conditionally include verbose-only logic in the generated application, such as additional logging or detailed output. The logic should check for common indicators of verbose mode, such as environment variables or command-line flags.\n */\nexport function IsVerbose() {\n return (\n <>\n {code`( `}\n <IsDebug />\n {code`|| hasFlag([\"verbose\", \"verbose=true\", \"verbose=always\"]))`}\n </>\n );\n}\n\n/**\n * Write the logic to determine if the application is **not** running in verbose mode.\n */\nexport function IsNotVerbose() {\n return (\n <>\n {code`!(`}\n <IsVerbose />\n {code`)`}\n </>\n );\n}\n\n/**\n * Write the type declaration for a command parameter based on its configuration.\n */\nexport function CommandParameterType(props: { parameter: CommandParameter }) {\n const { parameter } = props;\n\n return code`${\n (parameter.kind === CommandParameterKinds.string ||\n parameter.kind === CommandParameterKinds.number) &&\n parameter.choices &&\n parameter.choices.length > 0\n ? parameter.choices\n .map(choice => (typeof choice === \"string\" ? `\"${choice}\"` : choice))\n .join(\" | \")\n : parameter.kind === CommandParameterKinds.boolean\n ? \"boolean\"\n : parameter.kind === CommandParameterKinds.number\n ? \"number\"\n : \"string\"\n }${\n (parameter.kind === CommandParameterKinds.string ||\n parameter.kind === CommandParameterKinds.number) &&\n parameter.variadic\n ? \"[]\"\n : \"\"\n }${parameter.optional ? \" | undefined\" : \"\"}`;\n}\n"],"mappings":";;;;;;;;AA6BA,SAAgBE,wBAAwBC,OAAqC;CAC3E,MAAM,EAAEC,SAASD;AAEjB,QAAA,CACKH,IAAI,MAAMI,KAAI,MAAOA,KAAI,gCAC1BA,KAAI,4BACuBA,KAAI,6BAC/BA,KAAI,cACSA,KAAI,4BACjBA,KAAI,8BAEJA,KAAI,oBACeA,KAAI,mCACvBA,KAAI,gEAEJA,KAAI,0BACqBA,KAAI,SAAS;;;;;;;;AAU5C,SAAgBC,UAAU;AACxB,QAAOL,IAAI;;;;;AAMb,SAAgBM,aAAa;AAC3B,QAAA;EAEKN,IAAI;EAAIO,gBACRF,SAAO,EAAA,CAAA;EACPL,IAAI;EAAG;;;;;;;;AAWd,SAAgBQ,YAAY;AAC1B,QAAA;EAEKR,IAAI;EAAIO,gBACRF,SAAO,EAAA,CAAA;EACPL,IAAI;EAA4D;;;;;AAQvE,SAAgBS,eAAe;AAC7B,QAAA;EAEKT,IAAI;EAAIO,gBACRC,WAAS,EAAA,CAAA;EACTR,IAAI;EAAG;;;;;AAQd,SAAgBU,qBAAqBP,OAAwC;CAC3E,MAAM,EAAEQ,cAAcR;AAEtB,QAAOH,IAAI,IACRW,UAAUC,SAASX,sBAAsBY,UACxCF,UAAUC,SAASX,sBAAsBa,WAC3CH,UAAUI,WACVJ,UAAUI,QAAQC,SAAS,IACvBL,UAAUI,QACPE,KAAIC,WAAW,OAAOA,WAAW,WAAW,IAAIA,OAAM,KAAMA,OAAQ,CACpEC,KAAK,MAAM,GACdR,UAAUC,SAASX,sBAAsBmB,UACvC,YACAT,UAAUC,SAASX,sBAAsBa,SACvC,WACA,YAEPH,UAAUC,SAASX,sBAAsBY,UACxCF,UAAUC,SAASX,sBAAsBa,WAC3CH,UAAUU,WACN,OACA,KACHV,UAAUW,WAAW,iBAAiB"}
@@ -12,6 +12,7 @@ exports.CommandDocs = require_components_docs.CommandDocs;
12
12
  exports.CommandDocsFile = require_components_docs.CommandDocsFile;
13
13
  exports.CommandDocsUsageExample = require_components_docs.CommandDocsUsageExample;
14
14
  exports.CommandOptionsDocs = require_components_docs.CommandOptionsDocs;
15
+ exports.CommandParameterType = require_components_helpers.CommandParameterType;
15
16
  exports.CommandParserLogic = require_components_options_parser_logic.CommandParserLogic;
16
17
  exports.ContextUtilities = require_components_utils_builtin.ContextUtilities;
17
18
  exports.DynamicSegmentsParserLogic = require_components_options_parser_logic.DynamicSegmentsParserLogic;
@@ -1,6 +1,6 @@
1
1
  import { CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps } from "./docs.cjs";
2
- import { BooleanInputParserLogic, BooleanInputParserLogicProps, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose } from "./helpers.cjs";
2
+ import { BooleanInputParserLogic, BooleanInputParserLogicProps, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose } from "./helpers.cjs";
3
3
  import { ArgumentsParserLogic, ArgumentsParserLogicProps, CommandParserLogic, CommandParserLogicProps, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps } from "./options-parser-logic.cjs";
4
4
  import { Usage, UsageProps } from "./usage.cjs";
5
5
  import { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, SpawnFunctionDeclaration, UtilsBuiltin, UtilsBuiltinProps } from "./utils-builtin.cjs";
6
- export { ArgsUtilities, ArgumentsParserLogic, ArgumentsParserLogicProps, BooleanInputParserLogic, BooleanInputParserLogicProps, ColorSupportUtilities, CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps, CommandParserLogic, CommandParserLogicProps, ContextUtilities, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps, SpawnFunctionDeclaration, Usage, UsageProps, UtilsBuiltin, UtilsBuiltinProps };
6
+ export { ArgsUtilities, ArgumentsParserLogic, ArgumentsParserLogicProps, BooleanInputParserLogic, BooleanInputParserLogicProps, ColorSupportUtilities, CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps, CommandParameterType, CommandParserLogic, CommandParserLogicProps, ContextUtilities, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps, SpawnFunctionDeclaration, Usage, UsageProps, UtilsBuiltin, UtilsBuiltinProps };
@@ -1,6 +1,6 @@
1
1
  import { CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps } from "./docs.mjs";
2
- import { BooleanInputParserLogic, BooleanInputParserLogicProps, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose } from "./helpers.mjs";
2
+ import { BooleanInputParserLogic, BooleanInputParserLogicProps, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose } from "./helpers.mjs";
3
3
  import { ArgumentsParserLogic, ArgumentsParserLogicProps, CommandParserLogic, CommandParserLogicProps, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps } from "./options-parser-logic.mjs";
4
4
  import { Usage, UsageProps } from "./usage.mjs";
5
5
  import { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, SpawnFunctionDeclaration, UtilsBuiltin, UtilsBuiltinProps } from "./utils-builtin.mjs";
6
- export { ArgsUtilities, ArgumentsParserLogic, ArgumentsParserLogicProps, BooleanInputParserLogic, BooleanInputParserLogicProps, ColorSupportUtilities, CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps, CommandParserLogic, CommandParserLogicProps, ContextUtilities, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps, SpawnFunctionDeclaration, Usage, UsageProps, UtilsBuiltin, UtilsBuiltinProps };
6
+ export { ArgsUtilities, ArgumentsParserLogic, ArgumentsParserLogicProps, BooleanInputParserLogic, BooleanInputParserLogicProps, ColorSupportUtilities, CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps, CommandParameterType, CommandParserLogic, CommandParserLogicProps, ContextUtilities, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps, SpawnFunctionDeclaration, Usage, UsageProps, UtilsBuiltin, UtilsBuiltinProps };
@@ -1,7 +1,7 @@
1
1
  import { Usage } from "./usage.mjs";
2
2
  import { CommandDocs, CommandDocsFile, CommandDocsUsageExample, CommandOptionsDocs } from "./docs.mjs";
3
3
  import { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, SpawnFunctionDeclaration, UtilsBuiltin } from "./utils-builtin.mjs";
4
- import { BooleanInputParserLogic, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose } from "./helpers.mjs";
4
+ import { BooleanInputParserLogic, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose } from "./helpers.mjs";
5
5
  import { ArgumentsParserLogic, CommandParserLogic, DynamicSegmentsParserLogic, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserLogic, OptionsParserLogic } from "./options-parser-logic.mjs";
6
6
 
7
- export { ArgsUtilities, ArgumentsParserLogic, BooleanInputParserLogic, ColorSupportUtilities, CommandDocs, CommandDocsFile, CommandDocsUsageExample, CommandOptionsDocs, CommandParserLogic, ContextUtilities, DynamicSegmentsParserLogic, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserLogic, OptionsParserLogic, SpawnFunctionDeclaration, Usage, UtilsBuiltin };
7
+ export { ArgsUtilities, ArgumentsParserLogic, BooleanInputParserLogic, ColorSupportUtilities, CommandDocs, CommandDocsFile, CommandDocsUsageExample, CommandOptionsDocs, CommandParameterType, CommandParserLogic, ContextUtilities, DynamicSegmentsParserLogic, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserLogic, OptionsParserLogic, SpawnFunctionDeclaration, Usage, UtilsBuiltin };