@shell-shock/core 0.17.10 → 0.17.12

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 (257) hide show
  1. package/dist/api.cjs +31 -143
  2. package/dist/api.cjs.map +1 -0
  3. package/dist/api.d.cts +2 -77
  4. package/dist/api.d.cts.map +1 -1
  5. package/dist/api.d.mts +2 -76
  6. package/dist/api.d.mts.map +1 -1
  7. package/dist/api.mjs +30 -140
  8. package/dist/api.mjs.map +1 -1
  9. package/dist/components/command-validation-logic.cjs +14 -15
  10. package/dist/components/command-validation-logic.cjs.map +1 -0
  11. package/dist/components/command-validation-logic.d.cts +1 -3
  12. package/dist/components/command-validation-logic.d.cts.map +1 -1
  13. package/dist/components/command-validation-logic.d.mts +1 -3
  14. package/dist/components/command-validation-logic.d.mts.map +1 -1
  15. package/dist/components/command-validation-logic.mjs +12 -13
  16. package/dist/components/command-validation-logic.mjs.map +1 -1
  17. package/dist/components/docs.cjs +6 -6
  18. package/dist/components/docs.cjs.map +1 -0
  19. package/dist/components/docs.d.cts +4 -5
  20. package/dist/components/docs.d.cts.map +1 -1
  21. package/dist/components/docs.d.mts +4 -5
  22. package/dist/components/docs.d.mts.map +1 -1
  23. package/dist/components/docs.mjs +4 -4
  24. package/dist/components/docs.mjs.map +1 -1
  25. package/dist/components/exec-builtin.cjs +9 -11
  26. package/dist/components/exec-builtin.cjs.map +1 -0
  27. package/dist/components/exec-builtin.d.cts +1 -2
  28. package/dist/components/exec-builtin.d.cts.map +1 -1
  29. package/dist/components/exec-builtin.d.mts +1 -2
  30. package/dist/components/exec-builtin.d.mts.map +1 -1
  31. package/dist/components/exec-builtin.mjs +7 -10
  32. package/dist/components/exec-builtin.mjs.map +1 -1
  33. package/dist/components/helpers.cjs +4 -5
  34. package/dist/components/helpers.cjs.map +1 -0
  35. package/dist/components/helpers.d.cts +6 -8
  36. package/dist/components/helpers.d.cts.map +1 -1
  37. package/dist/components/helpers.d.mts +6 -8
  38. package/dist/components/helpers.d.mts.map +1 -1
  39. package/dist/components/helpers.mjs +2 -3
  40. package/dist/components/helpers.mjs.map +1 -1
  41. package/dist/components/options-parser-logic.cjs +29 -30
  42. package/dist/components/options-parser-logic.cjs.map +1 -0
  43. package/dist/components/options-parser-logic.d.cts +8 -9
  44. package/dist/components/options-parser-logic.d.cts.map +1 -1
  45. package/dist/components/options-parser-logic.d.mts +8 -9
  46. package/dist/components/options-parser-logic.d.mts.map +1 -1
  47. package/dist/components/options-parser-logic.mjs +27 -28
  48. package/dist/components/options-parser-logic.mjs.map +1 -1
  49. package/dist/components/state-builtin.cjs +3 -2
  50. package/dist/components/state-builtin.cjs.map +1 -0
  51. package/dist/components/state-builtin.d.cts +4 -5
  52. package/dist/components/state-builtin.d.cts.map +1 -1
  53. package/dist/components/state-builtin.d.mts +4 -5
  54. package/dist/components/state-builtin.d.mts.map +1 -1
  55. package/dist/components/state-builtin.mjs +1 -1
  56. package/dist/components/state-builtin.mjs.map +1 -1
  57. package/dist/components/usage.cjs +4 -6
  58. package/dist/components/usage.cjs.map +1 -0
  59. package/dist/components/usage.d.cts +1 -2
  60. package/dist/components/usage.d.cts.map +1 -1
  61. package/dist/components/usage.d.mts +1 -2
  62. package/dist/components/usage.d.mts.map +1 -1
  63. package/dist/components/usage.mjs +2 -4
  64. package/dist/components/usage.mjs.map +1 -1
  65. package/dist/components/utils-builtin.cjs +5 -4
  66. package/dist/components/utils-builtin.cjs.map +1 -0
  67. package/dist/components/utils-builtin.d.cts +7 -8
  68. package/dist/components/utils-builtin.d.cts.map +1 -1
  69. package/dist/components/utils-builtin.d.mts +7 -8
  70. package/dist/components/utils-builtin.d.mts.map +1 -1
  71. package/dist/components/utils-builtin.mjs +3 -3
  72. package/dist/components/utils-builtin.mjs.map +1 -1
  73. package/dist/config.cjs +53 -19
  74. package/dist/config.cjs.map +1 -0
  75. package/dist/config.d.cts +29 -8
  76. package/dist/config.d.cts.map +1 -1
  77. package/dist/config.d.mts +29 -8
  78. package/dist/config.d.mts.map +1 -1
  79. package/dist/config.mjs +51 -18
  80. package/dist/config.mjs.map +1 -1
  81. package/dist/contexts/command.cjs +2 -2
  82. package/dist/contexts/command.cjs.map +1 -0
  83. package/dist/contexts/command.d.cts.map +1 -1
  84. package/dist/contexts/command.d.mts.map +1 -1
  85. package/dist/contexts/command.mjs.map +1 -1
  86. package/dist/contexts/options.cjs +4 -4
  87. package/dist/contexts/options.cjs.map +1 -0
  88. package/dist/contexts/options.d.cts.map +1 -1
  89. package/dist/contexts/options.d.mts.map +1 -1
  90. package/dist/contexts/options.mjs +2 -3
  91. package/dist/contexts/options.mjs.map +1 -1
  92. package/dist/engine.cjs +138 -0
  93. package/dist/engine.cjs.map +1 -0
  94. package/dist/engine.d.cts +79 -0
  95. package/dist/engine.d.cts.map +1 -0
  96. package/dist/engine.d.mts +79 -0
  97. package/dist/engine.d.mts.map +1 -0
  98. package/dist/engine.mjs +136 -0
  99. package/dist/engine.mjs.map +1 -0
  100. package/dist/helpers/automd.cjs +6 -7
  101. package/dist/helpers/automd.cjs.map +1 -0
  102. package/dist/helpers/automd.mjs +2 -3
  103. package/dist/helpers/automd.mjs.map +1 -1
  104. package/dist/helpers/docs-helpers.cjs +2 -2
  105. package/dist/helpers/docs-helpers.cjs.map +1 -0
  106. package/dist/helpers/docs-helpers.mjs.map +1 -1
  107. package/dist/helpers/get-framework.cjs +24 -0
  108. package/dist/helpers/get-framework.cjs.map +1 -0
  109. package/dist/helpers/get-framework.mjs +24 -0
  110. package/dist/helpers/get-framework.mjs.map +1 -0
  111. package/dist/helpers/paths.cjs +5 -5
  112. package/dist/helpers/paths.cjs.map +1 -0
  113. package/dist/helpers/paths.mjs +4 -4
  114. package/dist/helpers/paths.mjs.map +1 -1
  115. package/dist/helpers/persistence.cjs +4 -6
  116. package/dist/helpers/persistence.cjs.map +1 -0
  117. package/dist/helpers/persistence.mjs +3 -3
  118. package/dist/helpers/persistence.mjs.map +1 -1
  119. package/dist/helpers/update-package-json.cjs +2 -2
  120. package/dist/helpers/update-package-json.cjs.map +1 -0
  121. package/dist/helpers/update-package-json.mjs.map +1 -1
  122. package/dist/helpers/utilities.cjs +3 -3
  123. package/dist/helpers/utilities.cjs.map +1 -0
  124. package/dist/helpers/utilities.mjs +1 -1
  125. package/dist/helpers/utilities.mjs.map +1 -1
  126. package/dist/helpers/validations.cjs +3 -3
  127. package/dist/helpers/validations.cjs.map +1 -0
  128. package/dist/helpers/validations.mjs +1 -3
  129. package/dist/helpers/validations.mjs.map +1 -1
  130. package/dist/index.cjs +121 -51
  131. package/dist/index.cjs.map +1 -0
  132. package/dist/index.d.cts +80 -5
  133. package/dist/index.d.cts.map +1 -0
  134. package/dist/index.d.mts +80 -5
  135. package/dist/index.d.mts.map +1 -0
  136. package/dist/index.mjs +118 -6
  137. package/dist/index.mjs.map +1 -0
  138. package/dist/package.cjs +12 -0
  139. package/dist/package.cjs.map +1 -0
  140. package/dist/package.mjs +6 -0
  141. package/dist/package.mjs.map +1 -0
  142. package/dist/plugin-utils/compute-bin.cjs +8 -10
  143. package/dist/plugin-utils/compute-bin.cjs.map +1 -0
  144. package/dist/plugin-utils/compute-bin.d.cts +2 -2
  145. package/dist/plugin-utils/compute-bin.d.cts.map +1 -1
  146. package/dist/plugin-utils/compute-bin.d.mts +2 -2
  147. package/dist/plugin-utils/compute-bin.d.mts.map +1 -1
  148. package/dist/plugin-utils/compute-bin.mjs +6 -8
  149. package/dist/plugin-utils/compute-bin.mjs.map +1 -1
  150. package/dist/plugin-utils/context-helpers.cjs +7 -14
  151. package/dist/plugin-utils/context-helpers.cjs.map +1 -0
  152. package/dist/plugin-utils/context-helpers.d.cts +4 -4
  153. package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
  154. package/dist/plugin-utils/context-helpers.d.mts +4 -4
  155. package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
  156. package/dist/plugin-utils/context-helpers.mjs +5 -12
  157. package/dist/plugin-utils/context-helpers.mjs.map +1 -1
  158. package/dist/plugin-utils/deepkit.cjs +15 -16
  159. package/dist/plugin-utils/deepkit.cjs.map +1 -0
  160. package/dist/plugin-utils/deepkit.d.cts +5 -5
  161. package/dist/plugin-utils/deepkit.d.cts.map +1 -1
  162. package/dist/plugin-utils/deepkit.d.mts +5 -5
  163. package/dist/plugin-utils/deepkit.d.mts.map +1 -1
  164. package/dist/plugin-utils/deepkit.mjs +14 -15
  165. package/dist/plugin-utils/deepkit.mjs.map +1 -1
  166. package/dist/plugin-utils/description-helpers.cjs +2 -1
  167. package/dist/plugin-utils/description-helpers.cjs.map +1 -0
  168. package/dist/plugin-utils/description-helpers.d.cts.map +1 -1
  169. package/dist/plugin-utils/description-helpers.d.mts.map +1 -1
  170. package/dist/plugin-utils/description-helpers.mjs.map +1 -1
  171. package/dist/plugin-utils/get-command-tree.cjs +2 -1
  172. package/dist/plugin-utils/get-command-tree.cjs.map +1 -0
  173. package/dist/plugin-utils/get-command-tree.d.cts.map +1 -1
  174. package/dist/plugin-utils/get-command-tree.d.mts.map +1 -1
  175. package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
  176. package/dist/plugin-utils/index.cjs +1 -1
  177. package/dist/plugin-utils/index.d.cts +2 -2
  178. package/dist/plugin-utils/index.d.mts +2 -2
  179. package/dist/plugin-utils/index.mjs +2 -2
  180. package/dist/plugin-utils/reflect.cjs +5 -5
  181. package/dist/plugin-utils/reflect.cjs.map +1 -0
  182. package/dist/plugin-utils/reflect.d.cts.map +1 -1
  183. package/dist/plugin-utils/reflect.d.mts.map +1 -1
  184. package/dist/plugin-utils/reflect.mjs +3 -5
  185. package/dist/plugin-utils/reflect.mjs.map +1 -1
  186. package/dist/plugin-utils/traverse-command-tree.cjs +2 -1
  187. package/dist/plugin-utils/traverse-command-tree.cjs.map +1 -0
  188. package/dist/plugin-utils/traverse-command-tree.d.cts.map +1 -1
  189. package/dist/plugin-utils/traverse-command-tree.d.mts.map +1 -1
  190. package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
  191. package/dist/plugin-utils/type-checks.cjs +146 -17
  192. package/dist/plugin-utils/type-checks.cjs.map +1 -0
  193. package/dist/plugin-utils/type-checks.d.cts +5 -5
  194. package/dist/plugin-utils/type-checks.d.cts.map +1 -1
  195. package/dist/plugin-utils/type-checks.d.mts +5 -5
  196. package/dist/plugin-utils/type-checks.d.mts.map +1 -1
  197. package/dist/plugin-utils/type-checks.mjs +145 -16
  198. package/dist/plugin-utils/type-checks.mjs.map +1 -1
  199. package/dist/plugin.cjs +80 -56
  200. package/dist/plugin.cjs.map +1 -0
  201. package/dist/plugin.d.cts.map +1 -1
  202. package/dist/plugin.d.mts.map +1 -1
  203. package/dist/plugin.mjs +75 -52
  204. package/dist/plugin.mjs.map +1 -1
  205. package/dist/resolver/helpers.cjs +33 -24
  206. package/dist/resolver/helpers.cjs.map +1 -0
  207. package/dist/resolver/helpers.mjs +32 -22
  208. package/dist/resolver/helpers.mjs.map +1 -1
  209. package/dist/resolver/resolve.cjs +319 -61
  210. package/dist/resolver/resolve.cjs.map +1 -0
  211. package/dist/resolver/resolve.mjs +316 -58
  212. package/dist/resolver/resolve.mjs.map +1 -1
  213. package/dist/types/command.cjs +43 -82
  214. package/dist/types/command.cjs.map +1 -0
  215. package/dist/types/command.d.cts +61 -119
  216. package/dist/types/command.d.cts.map +1 -1
  217. package/dist/types/command.d.mts +61 -119
  218. package/dist/types/command.d.mts.map +1 -1
  219. package/dist/types/command.mjs +42 -80
  220. package/dist/types/command.mjs.map +1 -1
  221. package/dist/types/config.cjs +45 -4
  222. package/dist/types/config.cjs.map +1 -0
  223. package/dist/types/config.d.cts +16 -11
  224. package/dist/types/config.d.cts.map +1 -1
  225. package/dist/types/config.d.mts +16 -11
  226. package/dist/types/config.d.mts.map +1 -1
  227. package/dist/types/config.mjs +40 -4
  228. package/dist/types/config.mjs.map +1 -1
  229. package/dist/types/context.cjs +9 -1
  230. package/dist/types/context.cjs.map +1 -0
  231. package/dist/types/context.d.cts +3 -2
  232. package/dist/types/context.d.cts.map +1 -1
  233. package/dist/types/context.d.mts +3 -2
  234. package/dist/types/context.d.mts.map +1 -1
  235. package/dist/types/context.mjs +7 -1
  236. package/dist/types/context.mjs.map +1 -1
  237. package/dist/types/env.cjs +2 -1
  238. package/dist/types/env.cjs.map +1 -0
  239. package/dist/types/env.d.cts.map +1 -1
  240. package/dist/types/env.d.mts.map +1 -1
  241. package/dist/types/env.mjs.map +1 -1
  242. package/dist/types/index.cjs +6 -3
  243. package/dist/types/index.d.cts +4 -4
  244. package/dist/types/index.d.mts +4 -4
  245. package/dist/types/index.mjs +4 -4
  246. package/dist/types/options.cjs +2 -1
  247. package/dist/types/options.cjs.map +1 -0
  248. package/dist/types/options.d.cts.map +1 -1
  249. package/dist/types/options.d.mts.map +1 -1
  250. package/dist/types/options.mjs.map +1 -1
  251. package/package.json +43 -35
  252. package/dist/resolver/deepkit.cjs +0 -135
  253. package/dist/resolver/deepkit.mjs +0 -135
  254. package/dist/resolver/deepkit.mjs.map +0 -1
  255. package/dist/resolver/module.cjs +0 -145
  256. package/dist/resolver/module.mjs +0 -145
  257. package/dist/resolver/module.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"get-command-tree.d.mts","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"mappings":";;;;;;AA8BA;;;;;iBAAgB,cAAA,CACd,OAAA,EAAS,OAAA,EACT,IAAA,cACC,WAAA;;;;;AA+BH;;iBAAsB,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,OAAA,CAAQ,WAAA;;;;;;;iBAe1C,eAAA,CAAgB,OAAA,EAAS,OAAA,GAAU,OAAA;;;;;AAAzD;;iBAiBsB,kBAAA,CACpB,OAAA,EAAS,OAAA,GACR,OAAA"}
1
+ {"version":3,"file":"get-command-tree.d.mts","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"get-command-tree.mjs","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { isDynamicPathSegment } from \"./context-helpers\";\nimport { traverseCommands } from \"./traverse-command-tree\";\n\n/**\n * Retrieves a specific command tree based on the provided path.\n *\n * @param context - The build context containing the command definitions.\n * @param path - An array of strings representing the command path.\n * @returns The command tree at the specified path, or null if not found.\n */\nexport function getCommandTree(\n context: Context,\n path = [] as string[]\n): CommandTree | null {\n if (path.length === 0) {\n return null;\n }\n\n let currentTree: CommandTree | null = context.commands[path[0]!] ?? null;\n if (path.length > 1) {\n const segments = path\n .slice(1)\n .filter(segment => !isDynamicPathSegment(segment));\n for (const segment of segments) {\n if (\n currentTree?.children &&\n Object.prototype.hasOwnProperty.call(currentTree.children, segment)\n ) {\n currentTree = currentTree.children[segment] ?? null;\n } else {\n return null;\n }\n }\n }\n\n return currentTree;\n}\n\n/**\n * Retrieves a list of all command trees defined in the context.\n *\n * @param context - The build context containing the command definitions.\n * @returns A promise that resolves to an array of all command trees in the context.\n */\nexport async function getCommandList(context: Context): Promise<CommandTree[]> {\n const commandList: CommandTree[] = [];\n await traverseCommands(context, commandTree => {\n commandList.push(commandTree);\n });\n\n return commandList;\n}\n\n/**\n * Retrieves a list of all command paths defined in the context.\n *\n * @param context - The build context containing the command definitions.\n * @returns A promise that resolves to an array of all command paths in the context.\n */\nexport async function getCommandPaths(context: Context): Promise<string[]> {\n const commandPaths: string[] = [];\n await traverseCommands(context, commandTree => {\n if (commandTree.path) {\n commandPaths.push(commandTree.path);\n }\n });\n\n return commandPaths;\n}\n\n/**\n * Retrieves a list of all command segments defined in the context.\n *\n * @param context - The build context containing the command definitions.\n * @returns A promise that resolves to an array of all command segments in the context.\n */\nexport async function getCommandSegments(\n context: Context\n): Promise<string[][]> {\n const commandSegments: string[][] = [];\n await traverseCommands(context, commandTree => {\n if (commandTree.path) {\n commandSegments.push(commandTree.segments);\n }\n });\n\n return commandSegments;\n}\n"],"mappings":";;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE9B,QAAO;;;;;;;;;;AAYR,KAAK,KAAA,WAAQ;;AAId,KAAM,KAAK,SAAG,GAAA;EACd,MAAO,WAAc,KAAG,MAAQ,EAAC,CAAA,OAAM,cAAQ,YAAA,CAAA,qBAAA,QAAA,EAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;AAC/C,OAAS,MAAA,WAAA,SACH,KAAG,aAAA,YAA0B,OAAC,UAAgB,eAAM,KAAA,YAAA,UAAA,QAAA;MAGvD,QAAY;;AAIb,QAAE;;AAEJ,eAAe,SAAC;CAAA;CAAc;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;CAQ5B,MAAI,cAAa,EAAA;AACjB,OAAI,iBAAiB,SAAA,cAAA,gBAAA;AACnB,cAAM,KAAW,YAAA;IAChB;EAAC;EAAQ;EAAA;EAAA,CAAA,CAAA;AACZ,QAAK;;AAEP,eAAS,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOT,eAAM,gBAAA,SAAA;CACJ,MAAE,eAAA,EAAA;AACF,OAAA,iBAAA,SAAA,cAAA,gBAAA;uBAEA,cAAO,KAAW,YAAA,KAAA;;;;;;AAGlB,QAAA;;AAEF,gBAAC,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOD,eAAqB,mBAAY,SAAA;CAC/B,MAAE,kBAAA,EAAA;;AAEF,MAAM,YAAY,KACpB,iBAAA,KAAA,YAAA,SAAA;IAEE;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA;AACA,QAAC;;AAEH,mBAAmB,SAAK;CAAK;CAAS;CAAW;CAAuB;CAAA;CAAA"}
1
+ {"version":3,"file":"get-command-tree.mjs","names":[],"sources":[],"mappings":""}
@@ -30,7 +30,7 @@ exports.isCommandArgument = require_type_checks.isCommandArgument;
30
30
  exports.isCommandOption = require_type_checks.isCommandOption;
31
31
  exports.isCommandParameter = require_type_checks.isCommandParameter;
32
32
  exports.isCommandParameterConfig = require_type_checks.isCommandParameterConfig;
33
- exports.isCommandParameterKind = require_type_checks.isCommandParameterKind;
33
+ exports.isCommandParameterType = require_type_checks.isCommandParameterType;
34
34
  exports.isDynamicPathSegment = require_context_helpers.isDynamicPathSegment;
35
35
  exports.isPathSegmentGroup = require_context_helpers.isPathSegmentGroup;
36
36
  exports.sortArgAliases = require_context_helpers.sortArgAliases;
@@ -5,5 +5,5 @@ import { FormatDescriptionOptions, FormatShortDescriptionOptions, formatDescript
5
5
  import { getCommandList, getCommandPaths, getCommandSegments, getCommandTree } from "./get-command-tree.cjs";
6
6
  import { sortOptions } from "./reflect.cjs";
7
7
  import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.cjs";
8
- import { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind } from "./type-checks.cjs";
9
- export { FormatDescriptionOptions, FormatShortDescriptionOptions, computeBin, extractReflectionKind, extractType, formatDescription, formatShortDescription, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandList, getCommandPaths, getCommandSegments, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
8
+ import { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterType } from "./type-checks.cjs";
9
+ export { FormatDescriptionOptions, FormatShortDescriptionOptions, computeBin, extractReflectionKind, extractType, formatDescription, formatShortDescription, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandList, getCommandPaths, getCommandSegments, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterType, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
@@ -5,5 +5,5 @@ import { FormatDescriptionOptions, FormatShortDescriptionOptions, formatDescript
5
5
  import { getCommandList, getCommandPaths, getCommandSegments, getCommandTree } from "./get-command-tree.mjs";
6
6
  import { sortOptions } from "./reflect.mjs";
7
7
  import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.mjs";
8
- import { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind } from "./type-checks.mjs";
9
- export { FormatDescriptionOptions, FormatShortDescriptionOptions, computeBin, extractReflectionKind, extractType, formatDescription, formatShortDescription, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandList, getCommandPaths, getCommandSegments, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
8
+ import { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterType } from "./type-checks.mjs";
9
+ export { FormatDescriptionOptions, FormatShortDescriptionOptions, computeBin, extractReflectionKind, extractType, formatDescription, formatShortDescription, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandList, getCommandPaths, getCommandSegments, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterType, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
@@ -1,10 +1,10 @@
1
1
  import { getAppBin, getAppDescription, getAppName, getAppTitle, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases } from "./context-helpers.mjs";
2
2
  import { sortOptions } from "./reflect.mjs";
3
3
  import { computeBin } from "./compute-bin.mjs";
4
- import { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind } from "./type-checks.mjs";
4
+ import { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterType } from "./type-checks.mjs";
5
5
  import { extractReflectionKind, extractType } from "./deepkit.mjs";
6
6
  import { __ΩFormatDescriptionOptions, __ΩFormatShortDescriptionOptions, formatDescription, formatShortDescription } from "./description-helpers.mjs";
7
7
  import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.mjs";
8
8
  import { getCommandList, getCommandPaths, getCommandSegments, getCommandTree } from "./get-command-tree.mjs";
9
9
 
10
- export { __ΩFormatDescriptionOptions, __ΩFormatShortDescriptionOptions, computeBin, extractReflectionKind, extractType, formatDescription, formatShortDescription, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandList, getCommandPaths, getCommandSegments, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
10
+ export { __ΩFormatDescriptionOptions, __ΩFormatShortDescriptionOptions, computeBin, extractReflectionKind, extractType, formatDescription, formatShortDescription, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandList, getCommandPaths, getCommandSegments, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterType, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
@@ -1,4 +1,3 @@
1
- const require_types_command = require('../types/command.cjs');
2
1
 
3
2
  //#region src/plugin-utils/reflect.ts
4
3
  function __assignType(fn, args) {
@@ -13,7 +12,7 @@ function __assignType(fn, args) {
13
12
  */
14
13
  function sortOptions(options) {
15
14
  if (!options || options.length === 0) return [];
16
- return options.filter(__assignType((arg) => arg.kind !== require_types_command.CommandParameterKinds.boolean || arg.variadic || !arg.isNegativeOf, [
15
+ return options.filter(__assignType((arg) => arg.type !== "boolean" || arg.variadic || !arg.isNegativeOf, [
17
16
  "arg",
18
17
  "",
19
18
  "P\"2!\"/\""
@@ -24,8 +23,8 @@ function sortOptions(options) {
24
23
  "P\"2!\"2\"\"/#"
25
24
  ])).reduce(__assignType((ret, arg) => {
26
25
  ret.push(arg);
27
- if (arg.kind === require_types_command.CommandParameterKinds.boolean) {
28
- const negativeArg = options.find(__assignType((a) => a.kind === require_types_command.CommandParameterKinds.boolean && !a.variadic && a.isNegativeOf === arg.name, [
26
+ if (arg.type === "boolean") {
27
+ const negativeArg = options.find(__assignType((a) => a.type === "boolean" && !a.variadic && a.isNegativeOf === arg.name, [
29
28
  "a",
30
29
  "",
31
30
  "P\"2!\"/\""
@@ -49,4 +48,5 @@ sortOptions.__type = [
49
48
  ];
50
49
 
51
50
  //#endregion
52
- exports.sortOptions = sortOptions;
51
+ exports.sortOptions = sortOptions;
52
+ //# sourceMappingURL=reflect.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflect.cjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"reflect.d.cts","names":[],"sources":["../../src/plugin-utils/reflect.ts"],"mappings":";;;;;AA2BA;;;;iBAAgB,WAAA,CAAY,OAAA,EAAS,aAAA,KAAkB,aAAA"}
1
+ {"version":3,"file":"reflect.d.cts","names":[],"sources":["../../src/plugin-utils/reflect.ts"],"mappings":";;;;;AA0BA;;;;iBAAgB,WAAA,CAAY,OAAA,EAAS,aAAA,KAAkB,aAAa"}
@@ -1 +1 @@
1
- {"version":3,"file":"reflect.d.mts","names":[],"sources":["../../src/plugin-utils/reflect.ts"],"mappings":";;;;;AA2BA;;;;iBAAgB,WAAA,CAAY,OAAA,EAAS,aAAA,KAAkB,aAAA"}
1
+ {"version":3,"file":"reflect.d.mts","names":[],"sources":["../../src/plugin-utils/reflect.ts"],"mappings":""}
@@ -1,5 +1,3 @@
1
- import { CommandParameterKinds } from "../types/command.mjs";
2
-
3
1
  //#region src/plugin-utils/reflect.ts
4
2
  function __assignType(fn, args) {
5
3
  fn.__type = args;
@@ -13,7 +11,7 @@ function __assignType(fn, args) {
13
11
  */
14
12
  function sortOptions(options) {
15
13
  if (!options || options.length === 0) return [];
16
- return options.filter(__assignType((arg) => arg.kind !== CommandParameterKinds.boolean || arg.variadic || !arg.isNegativeOf, [
14
+ return options.filter(__assignType((arg) => arg.type !== "boolean" || arg.variadic || !arg.isNegativeOf, [
17
15
  "arg",
18
16
  "",
19
17
  "P\"2!\"/\""
@@ -24,8 +22,8 @@ function sortOptions(options) {
24
22
  "P\"2!\"2\"\"/#"
25
23
  ])).reduce(__assignType((ret, arg) => {
26
24
  ret.push(arg);
27
- if (arg.kind === CommandParameterKinds.boolean) {
28
- const negativeArg = options.find(__assignType((a) => a.kind === CommandParameterKinds.boolean && !a.variadic && a.isNegativeOf === arg.name, [
25
+ if (arg.type === "boolean") {
26
+ const negativeArg = options.find(__assignType((a) => a.type === "boolean" && !a.variadic && a.isNegativeOf === arg.name, [
29
27
  "a",
30
28
  "",
31
29
  "P\"2!\"/\""
@@ -1 +1 @@
1
- {"version":3,"file":"reflect.mjs","names":[],"sources":["../../src/plugin-utils/reflect.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandOption } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * Sort command options alphabetically by name, placing boolean options with negatives appropriately.\n *\n * @param options - The array of command options to sort.\n * @returns A new array of sorted command options.\n */\nexport function sortOptions(options: CommandOption[]): CommandOption[] {\n if (!options || options.length === 0) {\n return [];\n }\n\n return options\n .filter(\n arg =>\n arg.kind !== CommandParameterKinds.boolean ||\n arg.variadic ||\n !arg.isNegativeOf\n )\n .sort((a, b) => a.name.localeCompare(b.name))\n .reduce((ret, arg) => {\n ret.push(arg);\n\n if (arg.kind === CommandParameterKinds.boolean) {\n // Add the negative argument if it exists\n const negativeArg = options.find(\n a =>\n a.kind === CommandParameterKinds.boolean &&\n !a.variadic &&\n a.isNegativeOf === arg.name\n );\n if (negativeArg) {\n ret.push(negativeArg);\n }\n }\n\n return ret;\n }, [] as CommandOption[]);\n}\n"],"mappings":";;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE9B,QAAO;;;;;;;;AAST,SAAgB,YAAW,SAAQ;AAClC,KAAA,CAAA,WAAiB,QAAQ,WAAS;;;;;;;;;;;AAI/B,MAAI,KAAK,IAAI;;GAGX,MAAG,cAAA,QAAwB,KAAM,cAAS,MAAQ,EAAA,SAAA,sBAAA,WAAA,CAAA,EAAA,YAAA,EAAA,iBAAA,IAAA,MAAA;IAAA;IAAA;IAAA;IAAA,CAAA,CAAA;mBAEtD,KAAA,KAAA,YAAA;;AAGE,SAAM;IACN;EAAA;EAAS;EAAK;EAAM;EAAU,CAAA,EAAA,EAAQ,CAAA;;AAE1C,YAAO,SAAS;CAAA;CAAqB;CAAa;CAAK;CAAgB;CAAA"}
1
+ {"version":3,"file":"reflect.mjs","names":[],"sources":[],"mappings":""}
@@ -61,4 +61,5 @@ traverseCommands.__type = [
61
61
 
62
62
  //#endregion
63
63
  exports.traverseCommandTree = traverseCommandTree;
64
- exports.traverseCommands = traverseCommands;
64
+ exports.traverseCommands = traverseCommands;
65
+ //# sourceMappingURL=traverse-command-tree.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traverse-command-tree.cjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-command-tree.d.cts","names":[],"sources":["../../src/plugin-utils/traverse-command-tree.ts"],"mappings":";;;;;;;AA4BA;;;;iBAAsB,mBAAA,CACpB,WAAA,EAAa,WAAA,EACb,OAAA,GAAU,IAAA,EAAM,WAAA,KAAgB,YAAA,SAC/B,OAAA;;;;;;;iBAmBmB,gBAAA,kBAAkC,OAAA,CAAA,CACtD,OAAA,EAAS,QAAA,EACT,OAAA,GAAU,IAAA,EAAM,WAAA,KAAgB,YAAA,SAC/B,OAAA"}
1
+ {"version":3,"file":"traverse-command-tree.d.cts","names":[],"sources":["../../src/plugin-utils/traverse-command-tree.ts"],"mappings":";;;;;;;AA4BA;;;;iBAAsB,mBAAA,CACpB,WAAA,EAAa,WAAA,EACb,OAAA,GAAU,IAAA,EAAM,WAAA,KAAgB,YAAA,SAC/B,OAAA;;;;;;;iBAmBmB,gBAAA,kBAAkC,OAAA,EACtD,OAAA,EAAS,QAAA,EACT,OAAA,GAAU,IAAA,EAAM,WAAA,KAAgB,YAAA,SAC/B,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-command-tree.d.mts","names":[],"sources":["../../src/plugin-utils/traverse-command-tree.ts"],"mappings":";;;;;;;AA4BA;;;;iBAAsB,mBAAA,CACpB,WAAA,EAAa,WAAA,EACb,OAAA,GAAU,IAAA,EAAM,WAAA,KAAgB,YAAA,SAC/B,OAAA;;;;;;;iBAmBmB,gBAAA,kBAAkC,OAAA,CAAA,CACtD,OAAA,EAAS,QAAA,EACT,OAAA,GAAU,IAAA,EAAM,WAAA,KAAgB,YAAA,SAC/B,OAAA"}
1
+ {"version":3,"file":"traverse-command-tree.d.mts","names":[],"sources":["../../src/plugin-utils/traverse-command-tree.ts"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-command-tree.mjs","names":[],"sources":["../../src/plugin-utils/traverse-command-tree.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { MaybePromise } from \"@stryke/types/base\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Traverses a command tree and applies a visitor function to each node.\n *\n * @param commandTree - The command tree to traverse.\n * @param visitor - The visitor function to apply to each node.\n */\nexport async function traverseCommandTree(\n commandTree: CommandTree,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!commandTree.children) {\n return;\n }\n\n await Promise.all(\n Object.values(commandTree.children).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n\n/**\n * Traverses all commands in the context and applies a visitor function to each command tree.\n *\n * @param context - The build context containing the command definitions.\n * @param visitor - The visitor function to apply to each command tree.\n */\nexport async function traverseCommands<TContext extends Context>(\n context: TContext,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!context.commands) {\n return;\n }\n\n await Promise.all(\n Object.values(context.commands).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n"],"mappings":";AAAA,SAAS,aAAa,IAAI,MAAM;;AAE9B,QAAO;;;;;;;;AAQT,eAAsB,oBAAoB,aAAU,SAAS;AAC5D,KAAA,CAAA,YAAkB,SAClB;AAEA,OAAK,QAAQ,IAAA,OAAa,OAAO,YAAE,SAAA,CAAA,IAAA,aAAA,OAAA,cAAA;;AAEhC,QAAM,oBAAoB,WAAW,QAAQ;;;;;;;AAGjD,oBAAc,SAAc;CAAA;CAAe;CAAQ;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOnD,eAAoB,iBAAY,SAAY,SAAa;AACvD,KAAA,CAAA,QAAA,SACF;AAEE,OAAA,QAAc,IAAE,OAAA,OAAgB,QAAA,SAAiB,CAAA,IAAA,aAAA,OAAA,cAAA;AAChD,QAAO,QAAO,QAAA,QAAA,UAAA,CAAA;AACb,QAAG,oBAAsB,WAAA,QAAA;IACzB;EAAA;EAAM;EAAA;EAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"traverse-command-tree.mjs","names":[],"sources":[],"mappings":""}
@@ -1,27 +1,142 @@
1
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
- const require_types_command = require('../types/command.cjs');
3
- let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
4
1
  let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
2
+ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
5
3
  let _stryke_type_checks_is_boolean = require("@stryke/type-checks/is-boolean");
6
4
 
7
5
  //#region src/plugin-utils/type-checks.ts
6
+ const __ΩRecord = [
7
+ "K",
8
+ "T",
9
+ "Record",
10
+ "l'e#\"Rb!b\"Pde\"!N#!w#y"
11
+ ];
12
+ function __assignType(fn, args) {
13
+ fn.__type = args;
14
+ return fn;
15
+ }
16
+ function isStringArray(value) {
17
+ return Array.isArray(value) && value.every(__assignType((item) => (0, _stryke_type_checks_is_set_string.isSetString)(item), [
18
+ "item",
19
+ "",
20
+ "P\"2!\"/\""
21
+ ]));
22
+ }
23
+ isStringArray.__type = [
24
+ "value",
25
+ "isStringArray",
26
+ "P#2!!/\""
27
+ ];
28
+ function isNumberArray(value) {
29
+ return Array.isArray(value) && value.every(__assignType((item) => typeof item === "number" && Number.isFinite(item), [
30
+ "item",
31
+ "",
32
+ "P\"2!\"/\""
33
+ ]));
34
+ }
35
+ isNumberArray.__type = [
36
+ "value",
37
+ "isNumberArray",
38
+ "P#2!!/\""
39
+ ];
40
+ function isBooleanArray(value) {
41
+ return Array.isArray(value) && value.every(__assignType((item) => (0, _stryke_type_checks_is_boolean.isBoolean)(item), [
42
+ "item",
43
+ "",
44
+ "P\"2!\"/\""
45
+ ]));
46
+ }
47
+ isBooleanArray.__type = [
48
+ "value",
49
+ "isBooleanArray",
50
+ "P#2!!/\""
51
+ ];
52
+ function isAliasConfig(value) {
53
+ return (0, _stryke_type_checks_is_set_string.isSetString)(value) || isStringArray(value);
54
+ }
55
+ isAliasConfig.__type = [
56
+ "value",
57
+ "isAliasConfig",
58
+ "P#2!!/\""
59
+ ];
60
+ function isTypedDefaultValue(type, value, variadic) {
61
+ if (type === "string") {
62
+ if (variadic === true) return isStringArray(value);
63
+ if (variadic === false) return (0, _stryke_type_checks_is_set_string.isSetString)(value);
64
+ return (0, _stryke_type_checks_is_set_string.isSetString)(value) || isStringArray(value);
65
+ }
66
+ if (type === "number") {
67
+ if (variadic === true) return isNumberArray(value);
68
+ if (variadic === false) return typeof value === "number" && Number.isFinite(value);
69
+ return typeof value === "number" && Number.isFinite(value) || isNumberArray(value);
70
+ }
71
+ if (variadic === true) return isBooleanArray(value);
72
+ if (variadic === false) return (0, _stryke_type_checks_is_boolean.isBoolean)(value);
73
+ return (0, _stryke_type_checks_is_boolean.isBoolean)(value) || isBooleanArray(value);
74
+ }
75
+ isTypedDefaultValue.__type = [
76
+ "CommandParameterType",
77
+ "type",
78
+ "value",
79
+ "variadic",
80
+ "isTypedDefaultValue",
81
+ "P\"w!2\"#2#)2$8)/%"
82
+ ];
83
+ function hasValidOptionalCommonFields(obj) {
84
+ if ("alias" in obj && obj.alias !== void 0 && !isAliasConfig(obj.alias)) return false;
85
+ if ("name" in obj && obj.name !== void 0 && !(0, _stryke_type_checks_is_set_string.isSetString)(obj.name)) return false;
86
+ if ("title" in obj && obj.title !== void 0 && !(0, _stryke_type_checks_is_set_string.isSetString)(obj.title)) return false;
87
+ if ("description" in obj && obj.description !== void 0 && !(0, _stryke_type_checks_is_set_string.isSetString)(obj.description)) return false;
88
+ if ("env" in obj && obj.env !== void 0 && !((0, _stryke_type_checks_is_set_string.isSetString)(obj.env) || obj.env === false)) return false;
89
+ if ("required" in obj && obj.required !== void 0 && !(0, _stryke_type_checks_is_boolean.isBoolean)(obj.required)) return false;
90
+ if ("variadic" in obj && obj.variadic !== void 0 && !(0, _stryke_type_checks_is_boolean.isBoolean)(obj.variadic)) return false;
91
+ return true;
92
+ }
93
+ hasValidOptionalCommonFields.__type = [
94
+ () => __ΩRecord,
95
+ "obj",
96
+ "hasValidOptionalCommonFields",
97
+ "P&#o!#2\")/#"
98
+ ];
99
+ function hasValidTypeSpecificFields(obj, type) {
100
+ const variadic = (0, _stryke_type_checks_is_boolean.isBoolean)(obj.variadic) ? obj.variadic : void 0;
101
+ if ("default" in obj && obj.default !== void 0 && !isTypedDefaultValue(type, obj.default, variadic)) return false;
102
+ if (type === "string") {
103
+ if ("format" in obj && obj.format !== void 0 && !(0, _stryke_type_checks_is_set_string.isSetString)(obj.format)) return false;
104
+ if ("choices" in obj && obj.choices !== void 0 && !isStringArray(obj.choices)) return false;
105
+ return true;
106
+ }
107
+ if (type === "number") {
108
+ if ("choices" in obj && obj.choices !== void 0 && !isNumberArray(obj.choices)) return false;
109
+ return true;
110
+ }
111
+ if ("choices" in obj && obj.choices !== void 0) return false;
112
+ if ("format" in obj && obj.format !== void 0) return false;
113
+ return true;
114
+ }
115
+ hasValidTypeSpecificFields.__type = [
116
+ () => __ΩRecord,
117
+ "obj",
118
+ "CommandParameterType",
119
+ "type",
120
+ "hasValidTypeSpecificFields",
121
+ "P&#o!#2\"\"w#2$)/%"
122
+ ];
8
123
  /**
9
- * Type guard to check if a value is a valid {@link CommandParameterKind} type.
124
+ * Type guard to check if a value is a valid {@link CommandParameterType} type.
10
125
  *
11
126
  * @param obj - The value to check.
12
- * @returns True if the value is a valid {@link CommandParameterKind} type, false otherwise.
127
+ * @returns True if the value is a valid {@link CommandParameterType} type, false otherwise.
13
128
  */
14
- function isCommandParameterKind(obj) {
129
+ function isCommandParameterType(obj) {
15
130
  return (0, _stryke_type_checks_is_set_string.isSetString)(obj) && [
16
- require_types_command.CommandParameterKinds.string,
17
- require_types_command.CommandParameterKinds.number,
18
- require_types_command.CommandParameterKinds.boolean
131
+ "string",
132
+ "number",
133
+ "boolean"
19
134
  ].includes(obj);
20
135
  }
21
- isCommandParameterKind.__type = [
136
+ isCommandParameterType.__type = [
22
137
  "obj",
23
- "isCommandParameterKind",
24
- "Type guard to check if a value is a valid {@link CommandParameterKind} type.",
138
+ "isCommandParameterType",
139
+ "Type guard to check if a value is a valid {@link CommandParameterType} type.",
25
140
  "P\"2!!/\"?#"
26
141
  ];
27
142
  /**
@@ -31,7 +146,8 @@ isCommandParameterKind.__type = [
31
146
  * @returns True if the value is a valid {@link CommandParameterConfig} type, false otherwise.
32
147
  */
33
148
  function isCommandParameterConfig(obj) {
34
- return (0, _stryke_type_checks_is_set_object.isSetObject)(obj) && "kind" in obj && isCommandParameterKind(obj.kind);
149
+ if (!(0, _stryke_type_checks_is_set_object.isSetObject)(obj) || !("type" in obj) || !isCommandParameterType(obj.type)) return false;
150
+ return hasValidOptionalCommonFields(obj) && hasValidTypeSpecificFields(obj, obj.type);
35
151
  }
36
152
  isCommandParameterConfig.__type = [
37
153
  "obj",
@@ -46,7 +162,15 @@ isCommandParameterConfig.__type = [
46
162
  * @returns True if the value is a valid {@link CommandParameter} type, false otherwise.
47
163
  */
48
164
  function isCommandParameter(obj) {
49
- return isCommandParameterConfig(obj) && "name" in obj && (0, _stryke_type_checks_is_set_string.isSetString)(obj.name) && "title" in obj && (0, _stryke_type_checks_is_set_string.isSetString)(obj.title) && "description" in obj && (0, _stryke_type_checks_is_set_string.isSetString)(obj.description) && "alias" in obj && Array.isArray(obj.alias) && "env" in obj && ((0, _stryke_type_checks_is_set_string.isSetString)(obj.env) || obj.env === false) && "optional" in obj && (0, _stryke_type_checks_is_boolean.isBoolean)(obj.optional) && "variadic" in obj && (0, _stryke_type_checks_is_boolean.isBoolean)(obj.variadic);
165
+ if (!isCommandParameterConfig(obj)) return false;
166
+ if (!("name" in obj) || !(0, _stryke_type_checks_is_set_string.isSetString)(obj.name)) return false;
167
+ if (!("title" in obj) || !(0, _stryke_type_checks_is_set_string.isSetString)(obj.title)) return false;
168
+ if (!("description" in obj) || !(0, _stryke_type_checks_is_set_string.isSetString)(obj.description)) return false;
169
+ if (!("alias" in obj) || !isStringArray(obj.alias)) return false;
170
+ if (!("env" in obj) || !((0, _stryke_type_checks_is_set_string.isSetString)(obj.env) || obj.env === false)) return false;
171
+ if (!("required" in obj) || !(0, _stryke_type_checks_is_boolean.isBoolean)(obj.required)) return false;
172
+ if (!("variadic" in obj) || !(0, _stryke_type_checks_is_boolean.isBoolean)(obj.variadic)) return false;
173
+ return hasValidTypeSpecificFields(obj, obj.type);
50
174
  }
51
175
  isCommandParameter.__type = [
52
176
  "obj",
@@ -61,7 +185,11 @@ isCommandParameter.__type = [
61
185
  * @returns True if the value is a valid {@link CommandOption} type, false otherwise.
62
186
  */
63
187
  function isCommandOption(obj) {
64
- return isCommandParameterConfig(obj) && isCommandParameter(obj) && "default" in obj;
188
+ if (!isCommandParameter(obj)) return false;
189
+ if (obj.type !== "boolean") return true;
190
+ if ("isNegativeOf" in obj && obj.isNegativeOf !== void 0 && !(0, _stryke_type_checks_is_set_string.isSetString)(obj.isNegativeOf)) return false;
191
+ if ("skipAddingNegative" in obj && obj.skipAddingNegative !== void 0 && !(0, _stryke_type_checks_is_boolean.isBoolean)(obj.skipAddingNegative)) return false;
192
+ return true;
65
193
  }
66
194
  isCommandOption.__type = [
67
195
  "obj",
@@ -76,7 +204,7 @@ isCommandOption.__type = [
76
204
  * @returns True if the value is a valid {@link CommandArgument} type, false otherwise.
77
205
  */
78
206
  function isCommandArgument(obj) {
79
- return isCommandParameterConfig(obj) && isCommandParameter(obj);
207
+ return isCommandParameter(obj);
80
208
  }
81
209
  isCommandArgument.__type = [
82
210
  "obj",
@@ -90,4 +218,5 @@ exports.isCommandArgument = isCommandArgument;
90
218
  exports.isCommandOption = isCommandOption;
91
219
  exports.isCommandParameter = isCommandParameter;
92
220
  exports.isCommandParameterConfig = isCommandParameterConfig;
93
- exports.isCommandParameterKind = isCommandParameterKind;
221
+ exports.isCommandParameterType = isCommandParameterType;
222
+ //# sourceMappingURL=type-checks.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-checks.cjs","names":[],"sources":[],"mappings":""}
@@ -1,13 +1,13 @@
1
- import { CommandArgument, CommandOption, CommandParameter, CommandParameterConfig, CommandParameterKind } from "../types/command.cjs";
1
+ import { CommandArgument, CommandOption, CommandParameter, CommandParameterConfig, CommandParameterType } from "../types/command.cjs";
2
2
 
3
3
  //#region src/plugin-utils/type-checks.d.ts
4
4
  /**
5
- * Type guard to check if a value is a valid {@link CommandParameterKind} type.
5
+ * Type guard to check if a value is a valid {@link CommandParameterType} type.
6
6
  *
7
7
  * @param obj - The value to check.
8
- * @returns True if the value is a valid {@link CommandParameterKind} type, false otherwise.
8
+ * @returns True if the value is a valid {@link CommandParameterType} type, false otherwise.
9
9
  */
10
- declare function isCommandParameterKind(obj: any): obj is CommandParameterKind;
10
+ declare function isCommandParameterType(obj: any): obj is CommandParameterType;
11
11
  /**
12
12
  * Type guard to check if a value is a valid {@link CommandParameterConfig} type.
13
13
  *
@@ -37,5 +37,5 @@ declare function isCommandOption(obj: any): obj is CommandOption;
37
37
  */
38
38
  declare function isCommandArgument(obj: any): obj is CommandArgument;
39
39
  //#endregion
40
- export { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind };
40
+ export { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterType };
41
41
  //# sourceMappingURL=type-checks.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-checks.d.cts","names":[],"sources":["../../src/plugin-utils/type-checks.ts"],"mappings":";;;;;AAoCA;;;;iBAAgB,sBAAA,CAAuB,GAAA,QAAW,GAAA,IAAO,oBAAA;;;;;AAiBzD;;iBAAgB,wBAAA,CACd,GAAA,QACC,GAAA,IAAO,sBAAA;;;;;;;iBAUM,kBAAA,CAAmB,GAAA,QAAW,GAAA,IAAO,gBAAA;;;;;;;iBA0BrC,eAAA,CAAgB,GAAA,QAAW,GAAA,IAAO,aAAA;;AAAlD;;;;;iBAYgB,iBAAA,CAAkB,GAAA,QAAW,GAAA,IAAO,eAAA"}
1
+ {"version":3,"file":"type-checks.d.cts","names":[],"sources":["../../src/plugin-utils/type-checks.ts"],"mappings":";;;;;AA0MA;;;;iBAAgB,sBAAA,CAAuB,GAAA,QAAW,GAAA,IAAO,oBAAoB;;;;AAAA;AAU7E;;iBAAgB,wBAAA,CACd,GAAA,QACC,GAAA,IAAO,sBAAsB;;;;;;AAAA;iBAqBhB,kBAAA,CAAmB,GAAA,QAAW,GAAA,IAAO,gBAAgB;;;;;;;iBA0CrD,eAAA,CAAgB,GAAA,QAAW,GAAA,IAAO,aAAa;AA1CM;AA0CrE;;;;;AA1CqE,iBA4ErD,iBAAA,CAAkB,GAAA,QAAW,GAAA,IAAO,eAAe"}
@@ -1,13 +1,13 @@
1
- import { CommandArgument, CommandOption, CommandParameter, CommandParameterConfig, CommandParameterKind } from "../types/command.mjs";
1
+ import { CommandArgument, CommandOption, CommandParameter, CommandParameterConfig, CommandParameterType } from "../types/command.mjs";
2
2
 
3
3
  //#region src/plugin-utils/type-checks.d.ts
4
4
  /**
5
- * Type guard to check if a value is a valid {@link CommandParameterKind} type.
5
+ * Type guard to check if a value is a valid {@link CommandParameterType} type.
6
6
  *
7
7
  * @param obj - The value to check.
8
- * @returns True if the value is a valid {@link CommandParameterKind} type, false otherwise.
8
+ * @returns True if the value is a valid {@link CommandParameterType} type, false otherwise.
9
9
  */
10
- declare function isCommandParameterKind(obj: any): obj is CommandParameterKind;
10
+ declare function isCommandParameterType(obj: any): obj is CommandParameterType;
11
11
  /**
12
12
  * Type guard to check if a value is a valid {@link CommandParameterConfig} type.
13
13
  *
@@ -37,5 +37,5 @@ declare function isCommandOption(obj: any): obj is CommandOption;
37
37
  */
38
38
  declare function isCommandArgument(obj: any): obj is CommandArgument;
39
39
  //#endregion
40
- export { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind };
40
+ export { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterType };
41
41
  //# sourceMappingURL=type-checks.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-checks.d.mts","names":[],"sources":["../../src/plugin-utils/type-checks.ts"],"mappings":";;;;;AAoCA;;;;iBAAgB,sBAAA,CAAuB,GAAA,QAAW,GAAA,IAAO,oBAAA;;;;;AAiBzD;;iBAAgB,wBAAA,CACd,GAAA,QACC,GAAA,IAAO,sBAAA;;;;;;;iBAUM,kBAAA,CAAmB,GAAA,QAAW,GAAA,IAAO,gBAAA;;;;;;;iBA0BrC,eAAA,CAAgB,GAAA,QAAW,GAAA,IAAO,aAAA;;AAAlD;;;;;iBAYgB,iBAAA,CAAkB,GAAA,QAAW,GAAA,IAAO,eAAA"}
1
+ {"version":3,"file":"type-checks.d.mts","names":[],"sources":["../../src/plugin-utils/type-checks.ts"],"mappings":""}