@shell-shock/core 0.17.21 → 0.17.23

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 (307) hide show
  1. package/README.md +16 -7
  2. package/dist/api.cjs +4 -5
  3. package/dist/api.d.cts +1 -1
  4. package/dist/api.d.mts +1 -1
  5. package/dist/api.mjs +2 -2
  6. package/dist/command-B6KYexlV.d.mts +308 -0
  7. package/dist/command-B6KYexlV.d.mts.map +1 -0
  8. package/dist/command-CtfR7hKM.d.cts +308 -0
  9. package/dist/command-CtfR7hKM.d.cts.map +1 -0
  10. package/dist/components/command-validation-logic.cjs +153 -216
  11. package/dist/components/command-validation-logic.d.cts +2 -1
  12. package/dist/components/command-validation-logic.d.cts.map +1 -1
  13. package/dist/components/command-validation-logic.d.mts +2 -1
  14. package/dist/components/command-validation-logic.mjs +153 -214
  15. package/dist/components/docs.cjs +6 -364
  16. package/dist/components/docs.d.cts +2 -3
  17. package/dist/components/docs.d.cts.map +1 -1
  18. package/dist/components/docs.d.mts +2 -3
  19. package/dist/components/docs.mjs +2 -356
  20. package/dist/components/exec-builtin.cjs +63 -100
  21. package/dist/components/exec-builtin.d.cts +1 -2
  22. package/dist/components/exec-builtin.d.cts.map +1 -1
  23. package/dist/components/exec-builtin.d.mts +1 -2
  24. package/dist/components/exec-builtin.mjs +7 -41
  25. package/dist/components/helpers.cjs +2 -52
  26. package/dist/components/helpers.d.cts +2 -1
  27. package/dist/components/helpers.d.cts.map +1 -1
  28. package/dist/components/helpers.d.mts +2 -1
  29. package/dist/components/helpers.mjs +2 -50
  30. package/dist/components/index.cjs +7 -23
  31. package/dist/components/index.mjs +9 -9
  32. package/dist/components/options-parser-logic.cjs +198 -420
  33. package/dist/components/options-parser-logic.d.cts +2 -5
  34. package/dist/components/options-parser-logic.d.cts.map +1 -1
  35. package/dist/components/options-parser-logic.d.mts +2 -5
  36. package/dist/components/options-parser-logic.mjs +192 -407
  37. package/dist/components/state-builtin.cjs +106 -164
  38. package/dist/components/state-builtin.d.cts +1 -2
  39. package/dist/components/state-builtin.d.cts.map +1 -1
  40. package/dist/components/state-builtin.d.mts +1 -2
  41. package/dist/components/state-builtin.mjs +12 -68
  42. package/dist/components/usage.cjs +4 -48
  43. package/dist/components/usage.d.cts +1 -2
  44. package/dist/components/usage.d.cts.map +1 -1
  45. package/dist/components/usage.d.mts +1 -2
  46. package/dist/components/usage.mjs +4 -46
  47. package/dist/components/utils-builtin.cjs +77 -144
  48. package/dist/components/utils-builtin.d.cts +1 -2
  49. package/dist/components/utils-builtin.d.cts.map +1 -1
  50. package/dist/components/utils-builtin.d.mts +1 -2
  51. package/dist/components/utils-builtin.mjs +9 -74
  52. package/dist/config-BIF9mEz0.d.cts +157 -0
  53. package/dist/config-BIF9mEz0.d.cts.map +1 -0
  54. package/dist/config-CnNYdfsL.d.mts +157 -0
  55. package/dist/config-CnNYdfsL.d.mts.map +1 -0
  56. package/dist/config.cjs +24 -58
  57. package/dist/config.d.cts +1 -2
  58. package/dist/config.d.cts.map +1 -1
  59. package/dist/config.d.mts +1 -2
  60. package/dist/config.mjs +23 -55
  61. package/dist/{plugin-utils/context-helpers.mjs → context-helpers-D3EJxwbq.mjs} +5 -83
  62. package/dist/context-helpers-D3EJxwbq.mjs.map +1 -0
  63. package/dist/{plugin-utils/context-helpers.cjs → context-helpers-_wUuFRB8.cjs} +63 -92
  64. package/dist/contexts/command.cjs +3 -9
  65. package/dist/contexts/command.d.cts +1 -2
  66. package/dist/contexts/command.d.cts.map +1 -1
  67. package/dist/contexts/command.d.mts +1 -2
  68. package/dist/contexts/command.mjs +2 -7
  69. package/dist/contexts/index.cjs +19 -1
  70. package/dist/contexts/index.d.cts +2 -1
  71. package/dist/contexts/index.d.mts +2 -1
  72. package/dist/contexts/index.mjs +2 -1
  73. package/dist/contexts/options.cjs +7 -30
  74. package/dist/contexts/options.d.cts +1 -2
  75. package/dist/contexts/options.d.cts.map +1 -1
  76. package/dist/contexts/options.d.mts +1 -2
  77. package/dist/contexts/options.mjs +7 -27
  78. package/dist/contexts/power-plant.cjs +19 -0
  79. package/dist/contexts/power-plant.d.cts +2 -0
  80. package/dist/contexts/power-plant.d.mts +2 -0
  81. package/dist/contexts/power-plant.mjs +5 -0
  82. package/dist/docs-C6ZvsVMu.cjs +278 -0
  83. package/dist/docs-CGQ2HtEY.mjs +249 -0
  84. package/dist/docs-CGQ2HtEY.mjs.map +1 -0
  85. package/dist/engine.cjs +5 -39
  86. package/dist/engine.d.cts +1 -2
  87. package/dist/engine.d.cts.map +1 -1
  88. package/dist/engine.d.mts +1 -2
  89. package/dist/engine.mjs +4 -37
  90. package/dist/generator.cjs +68 -0
  91. package/dist/generator.d.cts +15 -0
  92. package/dist/generator.d.cts.map +1 -0
  93. package/dist/generator.d.mts +15 -0
  94. package/dist/generator.d.mts.map +1 -0
  95. package/dist/generator.mjs +66 -0
  96. package/dist/generator.mjs.map +1 -0
  97. package/dist/{helpers/get-framework.cjs → get-framework-CxZc2krd.cjs} +7 -8
  98. package/dist/{helpers/get-framework.mjs → get-framework-Dlqz2hVZ.mjs} +3 -8
  99. package/dist/get-framework-Dlqz2hVZ.mjs.map +1 -0
  100. package/dist/helpers/power-plant.cjs +102 -0
  101. package/dist/helpers/power-plant.d.cts +61 -0
  102. package/dist/helpers/power-plant.d.cts.map +1 -0
  103. package/dist/helpers/power-plant.d.mts +61 -0
  104. package/dist/helpers/power-plant.d.mts.map +1 -0
  105. package/dist/helpers/power-plant.mjs +99 -0
  106. package/dist/helpers/power-plant.mjs.map +1 -0
  107. package/dist/index-D4klH_pj.d.mts +2 -0
  108. package/dist/index-DYOBadKY.d.cts +2 -0
  109. package/dist/index.cjs +1 -37
  110. package/dist/index.d.cts +4 -6
  111. package/dist/index.d.cts.map +1 -1
  112. package/dist/index.d.mts +4 -6
  113. package/dist/index.mjs +0 -35
  114. package/dist/package-B7Vu265G.mjs +6 -0
  115. package/dist/package-B7Vu265G.mjs.map +1 -0
  116. package/dist/{package.cjs → package-BLC4qc8t.cjs} +2 -4
  117. package/dist/plugin-B-hM2twc.mjs +1458 -0
  118. package/dist/plugin-B-hM2twc.mjs.map +1 -0
  119. package/dist/plugin-Bhfq0DMC.cjs +1490 -0
  120. package/dist/plugin-utils/index.cjs +359 -26
  121. package/dist/plugin-utils/index.d.cts +273 -9
  122. package/dist/plugin-utils/index.d.cts.map +1 -0
  123. package/dist/plugin-utils/index.d.mts +273 -9
  124. package/dist/plugin-utils/index.d.mts.map +1 -0
  125. package/dist/plugin-utils/index.mjs +346 -10
  126. package/dist/plugin-utils/index.mjs.map +1 -0
  127. package/dist/plugin.cjs +3 -496
  128. package/dist/plugin.d.cts +1 -3
  129. package/dist/plugin.d.cts.map +1 -1
  130. package/dist/plugin.d.mts +1 -3
  131. package/dist/plugin.mjs +2 -491
  132. package/dist/power-plant-LgxcvlMN.d.cts +4 -0
  133. package/dist/power-plant-LgxcvlMN.d.mts +4 -0
  134. package/dist/reflect-CSiffeL9.cjs +27 -0
  135. package/dist/reflect-DXKSFgvS.mjs +23 -0
  136. package/dist/reflect-DXKSFgvS.mjs.map +1 -0
  137. package/dist/schemas/env.cjs +91 -0
  138. package/dist/schemas/env.d.cts +145 -0
  139. package/dist/schemas/env.d.cts.map +1 -0
  140. package/dist/schemas/env.d.mts +145 -0
  141. package/dist/{types → schemas}/env.d.mts.map +1 -1
  142. package/dist/schemas/env.mjs +91 -0
  143. package/dist/schemas/index.cjs +4 -0
  144. package/dist/schemas/index.d.cts +2 -0
  145. package/dist/schemas/index.d.mts +2 -0
  146. package/dist/schemas/index.mjs +3 -0
  147. package/dist/types/command.cjs +0 -402
  148. package/dist/types/command.d.cts +2 -309
  149. package/dist/types/command.d.mts +2 -309
  150. package/dist/types/command.mjs +1 -368
  151. package/dist/types/config.cjs +0 -175
  152. package/dist/types/config.d.cts +2 -126
  153. package/dist/types/config.d.mts +2 -126
  154. package/dist/types/config.mjs +1 -164
  155. package/dist/types/context.cjs +0 -45
  156. package/dist/types/context.d.cts +2 -31
  157. package/dist/types/context.d.mts +2 -31
  158. package/dist/types/context.mjs +1 -41
  159. package/dist/types/index.cjs +3 -53
  160. package/dist/types/index.d.cts +4 -5
  161. package/dist/types/index.d.mts +4 -5
  162. package/dist/types/index.mjs +4 -5
  163. package/package.json +106 -42
  164. package/dist/_virtual/_rolldown/runtime.cjs +0 -29
  165. package/dist/api.cjs.map +0 -1
  166. package/dist/components/command-validation-logic.cjs.map +0 -1
  167. package/dist/components/docs.cjs.map +0 -1
  168. package/dist/components/docs.mjs.map +0 -1
  169. package/dist/components/exec-builtin.cjs.map +0 -1
  170. package/dist/components/helpers.cjs.map +0 -1
  171. package/dist/components/options-parser-logic.cjs.map +0 -1
  172. package/dist/components/state-builtin.cjs.map +0 -1
  173. package/dist/components/usage.cjs.map +0 -1
  174. package/dist/components/utils-builtin.cjs.map +0 -1
  175. package/dist/config.cjs.map +0 -1
  176. package/dist/contexts/command.cjs.map +0 -1
  177. package/dist/contexts/options.cjs.map +0 -1
  178. package/dist/engine.cjs.map +0 -1
  179. package/dist/helpers/automd.cjs +0 -193
  180. package/dist/helpers/automd.cjs.map +0 -1
  181. package/dist/helpers/automd.mjs +0 -190
  182. package/dist/helpers/automd.mjs.map +0 -1
  183. package/dist/helpers/docs-helpers.cjs +0 -24
  184. package/dist/helpers/docs-helpers.cjs.map +0 -1
  185. package/dist/helpers/docs-helpers.mjs +0 -24
  186. package/dist/helpers/docs-helpers.mjs.map +0 -1
  187. package/dist/helpers/get-framework.cjs.map +0 -1
  188. package/dist/helpers/get-framework.mjs.map +0 -1
  189. package/dist/helpers/paths.cjs +0 -137
  190. package/dist/helpers/paths.cjs.map +0 -1
  191. package/dist/helpers/paths.mjs +0 -134
  192. package/dist/helpers/paths.mjs.map +0 -1
  193. package/dist/helpers/persistence.cjs +0 -114
  194. package/dist/helpers/persistence.cjs.map +0 -1
  195. package/dist/helpers/persistence.mjs +0 -113
  196. package/dist/helpers/persistence.mjs.map +0 -1
  197. package/dist/helpers/update-package-json.cjs +0 -65
  198. package/dist/helpers/update-package-json.cjs.map +0 -1
  199. package/dist/helpers/update-package-json.mjs +0 -64
  200. package/dist/helpers/update-package-json.mjs.map +0 -1
  201. package/dist/helpers/utilities.cjs +0 -95
  202. package/dist/helpers/utilities.cjs.map +0 -1
  203. package/dist/helpers/utilities.mjs +0 -94
  204. package/dist/helpers/utilities.mjs.map +0 -1
  205. package/dist/helpers/validations.cjs +0 -71
  206. package/dist/helpers/validations.cjs.map +0 -1
  207. package/dist/helpers/validations.mjs +0 -70
  208. package/dist/helpers/validations.mjs.map +0 -1
  209. package/dist/index.cjs.map +0 -1
  210. package/dist/package.cjs.map +0 -1
  211. package/dist/package.mjs +0 -6
  212. package/dist/package.mjs.map +0 -1
  213. package/dist/plugin-utils/compute-bin.cjs +0 -49
  214. package/dist/plugin-utils/compute-bin.cjs.map +0 -1
  215. package/dist/plugin-utils/compute-bin.d.cts +0 -13
  216. package/dist/plugin-utils/compute-bin.d.cts.map +0 -1
  217. package/dist/plugin-utils/compute-bin.d.mts +0 -13
  218. package/dist/plugin-utils/compute-bin.d.mts.map +0 -1
  219. package/dist/plugin-utils/compute-bin.mjs +0 -49
  220. package/dist/plugin-utils/compute-bin.mjs.map +0 -1
  221. package/dist/plugin-utils/context-helpers.cjs.map +0 -1
  222. package/dist/plugin-utils/context-helpers.d.cts +0 -106
  223. package/dist/plugin-utils/context-helpers.d.cts.map +0 -1
  224. package/dist/plugin-utils/context-helpers.d.mts +0 -106
  225. package/dist/plugin-utils/context-helpers.d.mts.map +0 -1
  226. package/dist/plugin-utils/context-helpers.mjs.map +0 -1
  227. package/dist/plugin-utils/deepkit.cjs +0 -70
  228. package/dist/plugin-utils/deepkit.cjs.map +0 -1
  229. package/dist/plugin-utils/deepkit.d.cts +0 -23
  230. package/dist/plugin-utils/deepkit.d.cts.map +0 -1
  231. package/dist/plugin-utils/deepkit.d.mts +0 -23
  232. package/dist/plugin-utils/deepkit.d.mts.map +0 -1
  233. package/dist/plugin-utils/deepkit.mjs +0 -69
  234. package/dist/plugin-utils/deepkit.mjs.map +0 -1
  235. package/dist/plugin-utils/description-helpers.cjs +0 -112
  236. package/dist/plugin-utils/description-helpers.cjs.map +0 -1
  237. package/dist/plugin-utils/description-helpers.d.cts +0 -44
  238. package/dist/plugin-utils/description-helpers.d.cts.map +0 -1
  239. package/dist/plugin-utils/description-helpers.d.mts +0 -44
  240. package/dist/plugin-utils/description-helpers.d.mts.map +0 -1
  241. package/dist/plugin-utils/description-helpers.mjs +0 -108
  242. package/dist/plugin-utils/description-helpers.mjs.map +0 -1
  243. package/dist/plugin-utils/get-command-tree.cjs +0 -118
  244. package/dist/plugin-utils/get-command-tree.cjs.map +0 -1
  245. package/dist/plugin-utils/get-command-tree.d.cts +0 -36
  246. package/dist/plugin-utils/get-command-tree.d.cts.map +0 -1
  247. package/dist/plugin-utils/get-command-tree.d.mts +0 -36
  248. package/dist/plugin-utils/get-command-tree.d.mts.map +0 -1
  249. package/dist/plugin-utils/get-command-tree.mjs +0 -115
  250. package/dist/plugin-utils/get-command-tree.mjs.map +0 -1
  251. package/dist/plugin-utils/reflect.cjs +0 -54
  252. package/dist/plugin-utils/reflect.cjs.map +0 -1
  253. package/dist/plugin-utils/reflect.d.cts +0 -14
  254. package/dist/plugin-utils/reflect.d.cts.map +0 -1
  255. package/dist/plugin-utils/reflect.d.mts +0 -14
  256. package/dist/plugin-utils/reflect.d.mts.map +0 -1
  257. package/dist/plugin-utils/reflect.mjs +0 -53
  258. package/dist/plugin-utils/reflect.mjs.map +0 -1
  259. package/dist/plugin-utils/traverse-command-tree.cjs +0 -65
  260. package/dist/plugin-utils/traverse-command-tree.cjs.map +0 -1
  261. package/dist/plugin-utils/traverse-command-tree.d.cts +0 -22
  262. package/dist/plugin-utils/traverse-command-tree.d.cts.map +0 -1
  263. package/dist/plugin-utils/traverse-command-tree.d.mts +0 -22
  264. package/dist/plugin-utils/traverse-command-tree.d.mts.map +0 -1
  265. package/dist/plugin-utils/traverse-command-tree.mjs +0 -63
  266. package/dist/plugin-utils/traverse-command-tree.mjs.map +0 -1
  267. package/dist/plugin-utils/type-checks.cjs +0 -222
  268. package/dist/plugin-utils/type-checks.cjs.map +0 -1
  269. package/dist/plugin-utils/type-checks.d.cts +0 -41
  270. package/dist/plugin-utils/type-checks.d.cts.map +0 -1
  271. package/dist/plugin-utils/type-checks.d.mts +0 -41
  272. package/dist/plugin-utils/type-checks.d.mts.map +0 -1
  273. package/dist/plugin-utils/type-checks.mjs +0 -218
  274. package/dist/plugin-utils/type-checks.mjs.map +0 -1
  275. package/dist/plugin.cjs.map +0 -1
  276. package/dist/plugin.mjs.map +0 -1
  277. package/dist/resolver/deepkit.cjs +0 -110
  278. package/dist/resolver/deepkit.cjs.map +0 -1
  279. package/dist/resolver/deepkit.mjs +0 -109
  280. package/dist/resolver/deepkit.mjs.map +0 -1
  281. package/dist/resolver/helpers.cjs +0 -184
  282. package/dist/resolver/helpers.cjs.map +0 -1
  283. package/dist/resolver/helpers.mjs +0 -180
  284. package/dist/resolver/helpers.mjs.map +0 -1
  285. package/dist/resolver/resolve.cjs +0 -473
  286. package/dist/resolver/resolve.cjs.map +0 -1
  287. package/dist/resolver/resolve.mjs +0 -473
  288. package/dist/resolver/resolve.mjs.map +0 -1
  289. package/dist/types/command.cjs.map +0 -1
  290. package/dist/types/command.d.cts.map +0 -1
  291. package/dist/types/command.d.mts.map +0 -1
  292. package/dist/types/command.mjs.map +0 -1
  293. package/dist/types/config.cjs.map +0 -1
  294. package/dist/types/config.d.cts.map +0 -1
  295. package/dist/types/config.d.mts.map +0 -1
  296. package/dist/types/config.mjs.map +0 -1
  297. package/dist/types/context.cjs.map +0 -1
  298. package/dist/types/context.d.cts.map +0 -1
  299. package/dist/types/context.d.mts.map +0 -1
  300. package/dist/types/context.mjs.map +0 -1
  301. package/dist/types/env.cjs +0 -53
  302. package/dist/types/env.cjs.map +0 -1
  303. package/dist/types/env.d.cts +0 -71
  304. package/dist/types/env.d.cts.map +0 -1
  305. package/dist/types/env.d.mts +0 -71
  306. package/dist/types/env.mjs +0 -51
  307. /package/dist/{types → schemas}/env.mjs.map +0 -0
@@ -1,39 +1,372 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_context_helpers = require('./context-helpers.cjs');
3
- const require_reflect = require('./reflect.cjs');
4
- const require_compute_bin = require('./compute-bin.cjs');
5
- const require_type_checks = require('./type-checks.cjs');
6
- const require_deepkit = require('./deepkit.cjs');
7
- const require_description_helpers = require('./description-helpers.cjs');
8
- const require_traverse_command_tree = require('./traverse-command-tree.cjs');
9
- const require_get_command_tree = require('./get-command-tree.cjs');
2
+ const require_context_helpers = require('../context-helpers-_wUuFRB8.cjs');
3
+ const require_reflect = require('../reflect-CSiffeL9.cjs');
4
+ let _stryke_path_join_paths = require("@stryke/path/join-paths");
5
+ let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
6
+ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
7
+ let _deepkit_type = require("@deepkit/type");
8
+ let _stryke_type_checks_is_boolean = require("@stryke/type-checks/is-boolean");
10
9
 
11
- exports.__ΩFormatDescriptionOptions = require_description_helpers.__ΩFormatDescriptionOptions;
12
- exports.__ΩFormatShortDescriptionOptions = require_description_helpers.__ΩFormatShortDescriptionOptions;
13
- exports.computeBin = require_compute_bin.computeBin;
14
- exports.extractReflectionKind = require_deepkit.extractReflectionKind;
15
- exports.extractType = require_deepkit.extractType;
16
- exports.formatDescription = require_description_helpers.formatDescription;
17
- exports.formatShortDescription = require_description_helpers.formatShortDescription;
10
+ //#region src/plugin-utils/compute-bin.ts
11
+ /**
12
+ * Computes the command tree for the root binary command based on the provided context.
13
+ *
14
+ * @param context - The plugin context containing the necessary information to compute the command tree.
15
+ * @returns The computed command tree for the root binary command.
16
+ */
17
+ function computeBin(context) {
18
+ return {
19
+ id: "",
20
+ name: require_context_helpers.getAppName(context),
21
+ title: require_context_helpers.getAppTitle(context),
22
+ description: require_context_helpers.getAppDescription(context),
23
+ virtual: true,
24
+ path: null,
25
+ segments: [],
26
+ alias: [],
27
+ tags: [],
28
+ options: Object.fromEntries(context.globalOptions.map((option) => [option.name, option])),
29
+ args: [],
30
+ entry: { file: (0, _stryke_path_join_paths.joinPaths)(context.entryPath, "bin.ts") },
31
+ parent: null,
32
+ children: context.commands,
33
+ docs: context.config.docs?.app
34
+ };
35
+ }
36
+
37
+ //#endregion
38
+ //#region src/plugin-utils/type-checks.ts
39
+ function isStringArray(value) {
40
+ return Array.isArray(value) && value.every((item) => (0, _stryke_type_checks_is_set_string.isSetString)(item));
41
+ }
42
+ function isNumberArray(value) {
43
+ return Array.isArray(value) && value.every((item) => typeof item === "number" && Number.isFinite(item));
44
+ }
45
+ function isBooleanArray(value) {
46
+ return Array.isArray(value) && value.every((item) => (0, _stryke_type_checks_is_boolean.isBoolean)(item));
47
+ }
48
+ function isAliasConfig(value) {
49
+ return (0, _stryke_type_checks_is_set_string.isSetString)(value) || isStringArray(value);
50
+ }
51
+ function isTypedDefaultValue(type, value, variadic) {
52
+ if (type === "string") {
53
+ if (variadic === true) return isStringArray(value);
54
+ if (variadic === false) return (0, _stryke_type_checks_is_set_string.isSetString)(value);
55
+ return (0, _stryke_type_checks_is_set_string.isSetString)(value) || isStringArray(value);
56
+ }
57
+ if (type === "number") {
58
+ if (variadic === true) return isNumberArray(value);
59
+ if (variadic === false) return typeof value === "number" && Number.isFinite(value);
60
+ return typeof value === "number" && Number.isFinite(value) || isNumberArray(value);
61
+ }
62
+ if (variadic === true) return isBooleanArray(value);
63
+ if (variadic === false) return (0, _stryke_type_checks_is_boolean.isBoolean)(value);
64
+ return (0, _stryke_type_checks_is_boolean.isBoolean)(value) || isBooleanArray(value);
65
+ }
66
+ function hasValidOptionalCommonFields(obj) {
67
+ if ("alias" in obj && obj.alias !== void 0 && !isAliasConfig(obj.alias)) return false;
68
+ if ("name" in obj && obj.name !== void 0 && !(0, _stryke_type_checks_is_set_string.isSetString)(obj.name)) return false;
69
+ if ("title" in obj && obj.title !== void 0 && !(0, _stryke_type_checks_is_set_string.isSetString)(obj.title)) return false;
70
+ if ("description" in obj && obj.description !== void 0 && !(0, _stryke_type_checks_is_set_string.isSetString)(obj.description)) return false;
71
+ if ("env" in obj && obj.env !== void 0 && !((0, _stryke_type_checks_is_set_string.isSetString)(obj.env) || obj.env === false)) return false;
72
+ if ("required" in obj && obj.required !== void 0 && !(0, _stryke_type_checks_is_boolean.isBoolean)(obj.required)) return false;
73
+ if ("variadic" in obj && obj.variadic !== void 0 && !(0, _stryke_type_checks_is_boolean.isBoolean)(obj.variadic)) return false;
74
+ return true;
75
+ }
76
+ function hasValidTypeSpecificFields(obj, type) {
77
+ const variadic = (0, _stryke_type_checks_is_boolean.isBoolean)(obj.variadic) ? obj.variadic : void 0;
78
+ if ("default" in obj && obj.default !== void 0 && !isTypedDefaultValue(type, obj.default, variadic)) return false;
79
+ if (type === "string") {
80
+ if ("format" in obj && obj.format !== void 0 && !(0, _stryke_type_checks_is_set_string.isSetString)(obj.format)) return false;
81
+ if ("choices" in obj && obj.choices !== void 0 && !isStringArray(obj.choices)) return false;
82
+ return true;
83
+ }
84
+ if (type === "number") {
85
+ if ("choices" in obj && obj.choices !== void 0 && !isNumberArray(obj.choices)) return false;
86
+ return true;
87
+ }
88
+ if ("choices" in obj && obj.choices !== void 0) return false;
89
+ if ("format" in obj && obj.format !== void 0) return false;
90
+ return true;
91
+ }
92
+ /**
93
+ * Type guard to check if a value is a valid {@link CommandParameterType} type.
94
+ *
95
+ * @param obj - The value to check.
96
+ * @returns True if the value is a valid {@link CommandParameterType} type, false otherwise.
97
+ */
98
+ function isCommandParameterType(obj) {
99
+ return (0, _stryke_type_checks_is_set_string.isSetString)(obj) && [
100
+ "string",
101
+ "number",
102
+ "boolean"
103
+ ].includes(obj);
104
+ }
105
+ /**
106
+ * Type guard to check if a value is a valid {@link CommandParameterConfig} type.
107
+ *
108
+ * @param obj - The value to check.
109
+ * @returns True if the value is a valid {@link CommandParameterConfig} type, false otherwise.
110
+ */
111
+ function isCommandParameterConfig(obj) {
112
+ if (!(0, _stryke_type_checks_is_set_object.isSetObject)(obj) || !("type" in obj) || !isCommandParameterType(obj.type)) return false;
113
+ return hasValidOptionalCommonFields(obj) && hasValidTypeSpecificFields(obj, obj.type);
114
+ }
115
+ /**
116
+ * Type guard to check if a value is a valid {@link CommandParameter} type.
117
+ *
118
+ * @param obj - The value to check.
119
+ * @returns True if the value is a valid {@link CommandParameter} type, false otherwise.
120
+ */
121
+ function isCommandParameter(obj) {
122
+ if (!isCommandParameterConfig(obj)) return false;
123
+ if (!("name" in obj) || !(0, _stryke_type_checks_is_set_string.isSetString)(obj.name)) return false;
124
+ if (!("title" in obj) || !(0, _stryke_type_checks_is_set_string.isSetString)(obj.title)) return false;
125
+ if (!("description" in obj) || !(0, _stryke_type_checks_is_set_string.isSetString)(obj.description)) return false;
126
+ if (!("alias" in obj) || !isStringArray(obj.alias)) return false;
127
+ if (!("env" in obj) || !((0, _stryke_type_checks_is_set_string.isSetString)(obj.env) || obj.env === false)) return false;
128
+ if (!("required" in obj) || !(0, _stryke_type_checks_is_boolean.isBoolean)(obj.required)) return false;
129
+ if (!("variadic" in obj) || !(0, _stryke_type_checks_is_boolean.isBoolean)(obj.variadic)) return false;
130
+ return hasValidTypeSpecificFields(obj, obj.type);
131
+ }
132
+ /**
133
+ * Type guard to check if a value is a valid {@link CommandOption} type.
134
+ *
135
+ * @param obj - The value to check.
136
+ * @returns True if the value is a valid {@link CommandOption} type, false otherwise.
137
+ */
138
+ function isCommandOption(obj) {
139
+ if (!isCommandParameter(obj)) return false;
140
+ if (obj.type !== "boolean") return true;
141
+ if ("isNegativeOf" in obj && obj.isNegativeOf !== void 0 && !(0, _stryke_type_checks_is_set_string.isSetString)(obj.isNegativeOf)) return false;
142
+ if ("skipAddingNegative" in obj && obj.skipAddingNegative !== void 0 && !(0, _stryke_type_checks_is_boolean.isBoolean)(obj.skipAddingNegative)) return false;
143
+ return true;
144
+ }
145
+ /**
146
+ * Type guard to check if a value is a valid {@link CommandArgument} type.
147
+ *
148
+ * @param obj - The value to check.
149
+ * @returns True if the value is a valid {@link CommandArgument} type, false otherwise.
150
+ */
151
+ function isCommandArgument(obj) {
152
+ return isCommandParameter(obj);
153
+ }
154
+
155
+ //#endregion
156
+ //#region src/plugin-utils/deepkit.ts
157
+ /**
158
+ * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterType}.
159
+ *
160
+ * @param command - The command parameter or kind to extract the reflection kind from.
161
+ * @param checkVariadic - Whether to check for variadic parameters (arrays).
162
+ * @returns The extracted {@link ReflectionKind}.
163
+ */
164
+ function extractReflectionKind(command, checkVariadic = true) {
165
+ if (isCommandParameterType(command) && command === "string" || (0, _stryke_type_checks_is_set_object.isSetObject)(command) && command.type === "string") return checkVariadic && command.variadic ? _deepkit_type.ReflectionKind.array : _deepkit_type.ReflectionKind.string;
166
+ else if (isCommandParameterType(command) && command === "number" || (0, _stryke_type_checks_is_set_object.isSetObject)(command) && command.type === "number") return checkVariadic && command.variadic ? _deepkit_type.ReflectionKind.array : _deepkit_type.ReflectionKind.number;
167
+ else if (isCommandParameterType(command) && command === "boolean" || (0, _stryke_type_checks_is_set_object.isSetObject)(command) && command.type === "boolean") return _deepkit_type.ReflectionKind.boolean;
168
+ else return _deepkit_type.ReflectionKind.string;
169
+ }
170
+ /**
171
+ * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterType}.
172
+ *
173
+ * @param command - The command parameter or kind to extract the type from.
174
+ * @param checkVariadic - Whether to check for variadic parameters (arrays).
175
+ * @returns The extracted {@link Type}.
176
+ */
177
+ function extractType(command, checkVariadic = true) {
178
+ const reflectionKind = extractReflectionKind(command, checkVariadic);
179
+ if (reflectionKind === _deepkit_type.ReflectionKind.string) return { kind: _deepkit_type.ReflectionKind.string };
180
+ else if (reflectionKind === _deepkit_type.ReflectionKind.number) return { kind: _deepkit_type.ReflectionKind.number };
181
+ else if (reflectionKind === _deepkit_type.ReflectionKind.boolean) return { kind: _deepkit_type.ReflectionKind.boolean };
182
+ else if (reflectionKind === _deepkit_type.ReflectionKind.array) {
183
+ if (isCommandParameterType(command)) return {
184
+ kind: _deepkit_type.ReflectionKind.array,
185
+ type: extractType({ type: command }, false)
186
+ };
187
+ else if ((0, _stryke_type_checks_is_set_object.isSetObject)(command)) return {
188
+ kind: _deepkit_type.ReflectionKind.array,
189
+ type: extractType({
190
+ ...command,
191
+ type: command.type
192
+ }, false)
193
+ };
194
+ else return {
195
+ kind: _deepkit_type.ReflectionKind.array,
196
+ type: { kind: _deepkit_type.ReflectionKind.string }
197
+ };
198
+ } else return { kind: _deepkit_type.ReflectionKind.string };
199
+ }
200
+
201
+ //#endregion
202
+ //#region src/plugin-utils/description-helpers.ts
203
+ /**
204
+ * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
205
+ *
206
+ * @remarks
207
+ * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
208
+ *
209
+ * @param description - The full description string.
210
+ * @returns The formatted description string.
211
+ */
212
+ function formatDescriptionWhitespace(description, options = {}) {
213
+ let formattedDescription = description.trim();
214
+ if (options.replaceNewlines) formattedDescription = formattedDescription.replace(/\s*\n\s*/g, " ");
215
+ if (options.collapseWhitespace) formattedDescription = formattedDescription.replace(/\s{2,}/g, " ");
216
+ return formattedDescription.trim();
217
+ }
218
+ /**
219
+ * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
220
+ *
221
+ * @remarks
222
+ * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
223
+ *
224
+ * @param description - The full description string.
225
+ * @returns The formatted description string.
226
+ */
227
+ function formatDescriptionEscapes(description) {
228
+ return description.replaceAll("'", "\\'").replaceAll("\"", "\\\"").replaceAll("`", "\\`").replace(/\$\{/g, "\\${");
229
+ }
230
+ /**
231
+ * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
232
+ *
233
+ * @remarks
234
+ * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
235
+ *
236
+ * @param description - The full description string.
237
+ * @returns The formatted description string.
238
+ */
239
+ function formatDescription(description, options = {}) {
240
+ return formatDescriptionEscapes(formatDescriptionWhitespace(description, options));
241
+ }
242
+ /**
243
+ * Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.
244
+ *
245
+ * @param description - The full description string.
246
+ * @param options - Options for formatting the short description, including the maximum length.
247
+ * @returns The extracted short description.
248
+ */
249
+ function formatShortDescription(description, options = {}) {
250
+ const length = options.length ?? 62;
251
+ const formattedDescription = formatDescriptionWhitespace(description, options);
252
+ let result = ((formattedDescription.indexOf("\n") < length - 3 || formattedDescription.search(/[.!?\n]\s*\S/) > length - 3 ? formattedDescription.match(/^.*[.!?\n]\s?\S/)?.[0]?.trim()?.slice(0, -1)?.trim() : void 0) || formattedDescription).trim();
253
+ if (result.trim().length > length) result = `${result.substring(0, Math.max(0, length - 3)).trim()}...`;
254
+ return formatDescriptionEscapes(result);
255
+ }
256
+
257
+ //#endregion
258
+ //#region src/plugin-utils/traverse-command-tree.ts
259
+ /**
260
+ * Traverses a command tree and applies a visitor function to each node.
261
+ *
262
+ * @param commandTree - The command tree to traverse.
263
+ * @param visitor - The visitor function to apply to each node.
264
+ */
265
+ async function traverseCommandTree(commandTree, visitor) {
266
+ if (!commandTree.children) return;
267
+ await Promise.all(Object.values(commandTree.children).map(async (childTree) => {
268
+ await Promise.resolve(visitor(childTree));
269
+ await traverseCommandTree(childTree, visitor);
270
+ }));
271
+ }
272
+ /**
273
+ * Traverses all commands in the context and applies a visitor function to each command tree.
274
+ *
275
+ * @param context - The build context containing the command definitions.
276
+ * @param visitor - The visitor function to apply to each command tree.
277
+ */
278
+ async function traverseCommands(context, visitor) {
279
+ if (!context.commands) return;
280
+ await Promise.all(Object.values(context.commands).map(async (childTree) => {
281
+ await Promise.resolve(visitor(childTree));
282
+ await traverseCommandTree(childTree, visitor);
283
+ }));
284
+ }
285
+
286
+ //#endregion
287
+ //#region src/plugin-utils/get-command-tree.ts
288
+ /**
289
+ * Retrieves a specific command tree based on the provided path.
290
+ *
291
+ * @param context - The build context containing the command definitions.
292
+ * @param path - An array of strings representing the command path.
293
+ * @returns The command tree at the specified path, or null if not found.
294
+ */
295
+ function getCommandTree(context, path = []) {
296
+ if (path.length === 0) return null;
297
+ let currentTree = context.commands[path[0]] ?? null;
298
+ if (path.length > 1) {
299
+ const segments = path.slice(1).filter((segment) => !require_context_helpers.isDynamicPathSegment(segment));
300
+ for (const segment of segments) if (currentTree?.children && Object.prototype.hasOwnProperty.call(currentTree.children, segment)) currentTree = currentTree.children[segment] ?? null;
301
+ else return null;
302
+ }
303
+ return currentTree;
304
+ }
305
+ /**
306
+ * Retrieves a list of all command trees defined in the context.
307
+ *
308
+ * @param context - The build context containing the command definitions.
309
+ * @returns A promise that resolves to an array of all command trees in the context.
310
+ */
311
+ async function getCommandList(context) {
312
+ const commandList = [];
313
+ await traverseCommands(context, (commandTree) => {
314
+ commandList.push(commandTree);
315
+ });
316
+ return commandList;
317
+ }
318
+ /**
319
+ * Retrieves a list of all command paths defined in the context.
320
+ *
321
+ * @param context - The build context containing the command definitions.
322
+ * @returns A promise that resolves to an array of all command paths in the context.
323
+ */
324
+ async function getCommandPaths(context) {
325
+ const commandPaths = [];
326
+ await traverseCommands(context, (commandTree) => {
327
+ if (commandTree.path) commandPaths.push(commandTree.path);
328
+ });
329
+ return commandPaths;
330
+ }
331
+ /**
332
+ * Retrieves a list of all command segments defined in the context.
333
+ *
334
+ * @param context - The build context containing the command definitions.
335
+ * @returns A promise that resolves to an array of all command segments in the context.
336
+ */
337
+ async function getCommandSegments(context) {
338
+ const commandSegments = [];
339
+ await traverseCommands(context, (commandTree) => {
340
+ if (commandTree.path) commandSegments.push(commandTree.segments);
341
+ });
342
+ return commandSegments;
343
+ }
344
+
345
+ //#endregion
346
+ exports.computeBin = computeBin;
347
+ exports.extractReflectionKind = extractReflectionKind;
348
+ exports.extractType = extractType;
349
+ exports.formatDescription = formatDescription;
350
+ exports.formatShortDescription = formatShortDescription;
18
351
  exports.getAppBin = require_context_helpers.getAppBin;
19
352
  exports.getAppDescription = require_context_helpers.getAppDescription;
20
353
  exports.getAppName = require_context_helpers.getAppName;
21
354
  exports.getAppTitle = require_context_helpers.getAppTitle;
22
- exports.getCommandList = require_get_command_tree.getCommandList;
23
- exports.getCommandPaths = require_get_command_tree.getCommandPaths;
24
- exports.getCommandSegments = require_get_command_tree.getCommandSegments;
25
- exports.getCommandTree = require_get_command_tree.getCommandTree;
355
+ exports.getCommandList = getCommandList;
356
+ exports.getCommandPaths = getCommandPaths;
357
+ exports.getCommandSegments = getCommandSegments;
358
+ exports.getCommandTree = getCommandTree;
26
359
  exports.getDynamicPathSegmentName = require_context_helpers.getDynamicPathSegmentName;
27
360
  exports.getPathSegmentGroupName = require_context_helpers.getPathSegmentGroupName;
28
361
  exports.getPathSegmentName = require_context_helpers.getPathSegmentName;
29
- exports.isCommandArgument = require_type_checks.isCommandArgument;
30
- exports.isCommandOption = require_type_checks.isCommandOption;
31
- exports.isCommandParameter = require_type_checks.isCommandParameter;
32
- exports.isCommandParameterConfig = require_type_checks.isCommandParameterConfig;
33
- exports.isCommandParameterType = require_type_checks.isCommandParameterType;
362
+ exports.isCommandArgument = isCommandArgument;
363
+ exports.isCommandOption = isCommandOption;
364
+ exports.isCommandParameter = isCommandParameter;
365
+ exports.isCommandParameterConfig = isCommandParameterConfig;
366
+ exports.isCommandParameterType = isCommandParameterType;
34
367
  exports.isDynamicPathSegment = require_context_helpers.isDynamicPathSegment;
35
368
  exports.isPathSegmentGroup = require_context_helpers.isPathSegmentGroup;
36
369
  exports.sortArgAliases = require_context_helpers.sortArgAliases;
37
370
  exports.sortOptions = require_reflect.sortOptions;
38
- exports.traverseCommandTree = require_traverse_command_tree.traverseCommandTree;
39
- exports.traverseCommands = require_traverse_command_tree.traverseCommands;
371
+ exports.traverseCommandTree = traverseCommandTree;
372
+ exports.traverseCommands = traverseCommands;