@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
package/dist/plugin.mjs CHANGED
@@ -1,31 +1,30 @@
1
1
  import { getAppDescription, getAppName, getAppTitle, getDynamicPathSegmentName, isDynamicPathSegment, isPathSegmentGroup } from "./plugin-utils/context-helpers.mjs";
2
2
  import { CommandDocsFile } from "./components/docs.mjs";
3
3
  import { ExecBuiltin } from "./components/exec-builtin.mjs";
4
- import { extractType } from "./plugin-utils/deepkit.mjs";
5
4
  import { traverseCommands } from "./plugin-utils/traverse-command-tree.mjs";
6
5
  import { getCommandTree } from "./plugin-utils/get-command-tree.mjs";
7
- import "./plugin-utils/index.mjs";
8
6
  import { StateBuiltin } from "./components/state-builtin.mjs";
9
7
  import { UtilsBuiltin } from "./components/utils-builtin.mjs";
10
8
  import { commands } from "./helpers/automd.mjs";
9
+ import { getFramework } from "./helpers/get-framework.mjs";
11
10
  import { findCommandsRoot, resolveCommandId, resolveCommandName, resolveCommandPath } from "./helpers/paths.mjs";
12
- import { getCommandsPersistencePath, readCommandsPersistence, writeCommandsPersistence } from "./helpers/persistence.mjs";
11
+ import { writeCommandsPersistence } from "./helpers/persistence.mjs";
13
12
  import { formatBinaryPath, updatePackageJsonBinary } from "./helpers/update-package-json.mjs";
14
13
  import { formatCommandTree, getGlobalOptions } from "./helpers/utilities.mjs";
15
14
  import { validateCommand } from "./helpers/validations.mjs";
16
15
  import { resolve } from "./resolver/resolve.mjs";
17
16
  import { createComponent } from "@alloy-js/core/jsx-runtime";
18
- import { For, Show } from "@alloy-js/core/components";
19
- import { ReflectionVisibility } from "@powerlines/deepkit/vendor/type";
17
+ import { For, Show } from "@alloy-js/core";
20
18
  import { render } from "@powerlines/plugin-alloy/render";
21
19
  import automd from "@powerlines/plugin-automd";
22
- import { writeEnvTypeReflection } from "@powerlines/plugin-env/helpers";
20
+ import { extractEnv, writeEnv } from "@powerlines/plugin-env/helpers/schema";
23
21
  import nodejs from "@powerlines/plugin-nodejs";
24
22
  import tsdown from "@powerlines/plugin-tsdown";
23
+ import { addProperty, getCacheFilePath, getProperties, isJsonSchemaObject } from "@powerlines/schema";
25
24
  import { toArray } from "@stryke/convert/to-array";
26
25
  import { chmodX } from "@stryke/fs/chmod-x";
27
26
  import { appendPath } from "@stryke/path/append";
28
- import { findFilePath } from "@stryke/path/file-path-fns";
27
+ import { findFilePath } from "@stryke/path/find";
29
28
  import { isParentPath } from "@stryke/path/is-parent-path";
30
29
  import { joinPaths } from "@stryke/path/join-paths";
31
30
  import { replacePath } from "@stryke/path/replace";
@@ -34,8 +33,10 @@ import { camelCase } from "@stryke/string-format/camel-case";
34
33
  import { constantCase } from "@stryke/string-format/constant-case";
35
34
  import { kebabCase } from "@stryke/string-format/kebab-case";
36
35
  import { isObject } from "@stryke/type-checks/is-object";
36
+ import { isSetObject } from "@stryke/type-checks/is-set-object";
37
37
  import { isSetString } from "@stryke/type-checks/is-set-string";
38
38
  import { defu } from "defu";
39
+ import { isFileReference } from "powerlines";
39
40
  import { resolveInputs } from "powerlines/utils";
40
41
 
41
42
  //#region src/plugin.tsx
@@ -52,7 +53,7 @@ const plugin = __assignType((options = {}) => {
52
53
  (tsdown.Ω = [["Context", "\"w!"]], tsdown()),
53
54
  (automd.Ω = [["Context", "\"w!"]], automd()),
54
55
  {
55
- name: "shell-shock:config",
56
+ name: "shell-shock/core:config",
56
57
  config: __assignType(async function config() {
57
58
  this.debug("Resolving the Shell Shock configuration.");
58
59
  return defu(options, {
@@ -61,7 +62,7 @@ const plugin = __assignType((options = {}) => {
61
62
  description: getAppDescription(this),
62
63
  platform: "node",
63
64
  projectType: "application",
64
- framework: "shell-shock",
65
+ framework: getFramework(),
65
66
  isCaseSensitive: false,
66
67
  output: {
67
68
  format: "esm",
@@ -106,13 +107,13 @@ const plugin = __assignType((options = {}) => {
106
107
  title: this.config.title,
107
108
  description: this.config.description,
108
109
  alias: [],
109
- isVirtual: false
110
+ virtual: false
110
111
  }));
111
112
  this.globalOptions = this.globalOptions.map(__assignType((option) => ({
112
113
  ...option,
113
114
  name: camelCase(option.name),
114
115
  alias: option.alias ?? [],
115
- optional: option.optional ?? false
116
+ required: option.required ?? true
116
117
  }), [
117
118
  "option",
118
119
  "",
@@ -122,13 +123,39 @@ const plugin = __assignType((options = {}) => {
122
123
  }
123
124
  },
124
125
  ...(nodejs.Ω = [["Context", "\"w!"]], nodejs(defu(options ?? {}, { env: {
125
- types: "@shell-shock/core/types/env#ShellShockEnv",
126
+ config: "@shell-shock/core/types/env#ShellShockEnv",
126
127
  validate: false
127
128
  } }))),
128
129
  {
129
- name: "shell-shock:inputs",
130
+ name: "shell-shock/core:inputs",
130
131
  async configResolved() {
131
- this.debug(`Checking for commands using input: ${JSON.stringify(this.config.input)}`);
132
+ const toInputLocation = __assignType((value) => {
133
+ if (isSetString(value)) return value;
134
+ if (isSetObject(value) && isFileReference(value)) return String(value.file);
135
+ return null;
136
+ }, [
137
+ "value",
138
+ "",
139
+ "P#2!P&,J/\""
140
+ ]);
141
+ const configuredInputs = [];
142
+ if (Array.isArray(this.config.input)) configuredInputs.push(...this.config.input.map(toInputLocation).filter(__assignType((value) => isSetString(value), [
143
+ "value",
144
+ "",
145
+ "P\"2!!/\""
146
+ ])));
147
+ else if (isSetString(this.config.input)) configuredInputs.push(this.config.input);
148
+ else if (isSetObject(this.config.input) && isFileReference(this.config.input)) configuredInputs.push(String(this.config.input.file));
149
+ else if (isSetObject(this.config.input)) configuredInputs.push(...Object.values(this.config.input).map(toInputLocation).filter(__assignType((value) => isSetString(value), [
150
+ "value",
151
+ "",
152
+ "P\"2!!/\""
153
+ ])));
154
+ this.debug(configuredInputs.length <= 1 ? `Checking for command modules in the following location: ${configuredInputs[0] ?? "(none configured)"}.` : `Checking for command modules in the following locations:\n${configuredInputs.map(__assignType((input) => ` - ${input}`, [
155
+ "input",
156
+ "",
157
+ "P\"2!\"/\""
158
+ ])).join("\n")}`);
132
159
  this.commandsPath = await findCommandsRoot(this);
133
160
  this.debug(`Resolved commands root path: ${this.commandsPath}`);
134
161
  const inputs = await resolveInputs(this, this.config.input);
@@ -168,14 +195,12 @@ const plugin = __assignType((options = {}) => {
168
195
  name,
169
196
  alias: [],
170
197
  tags: [],
171
- isVirtual: false,
172
- source: "file",
198
+ virtual: false,
173
199
  entry: {
174
200
  ...entry,
175
- file: entry.file,
176
201
  input: {
177
202
  file: entry.file,
178
- name: entry.name
203
+ export: entry.export
179
204
  },
180
205
  output: name
181
206
  }
@@ -204,7 +229,7 @@ const plugin = __assignType((options = {}) => {
204
229
  }, ["prepare", "P\"/!"])
205
230
  },
206
231
  {
207
- name: "shell-shock:virtual-inputs",
232
+ name: "shell-shock/core:virtual-inputs",
208
233
  configResolved: {
209
234
  order: "post",
210
235
  async handler() {
@@ -255,9 +280,8 @@ const plugin = __assignType((options = {}) => {
255
280
  name,
256
281
  alias: [],
257
282
  tags: [],
258
- isVirtual: true,
259
- entry: { file },
260
- source: "file"
283
+ virtual: true,
284
+ entry: { file }
261
285
  });
262
286
  }
263
287
  }
@@ -275,7 +299,7 @@ const plugin = __assignType((options = {}) => {
275
299
  "",
276
300
  "P\"2!\"2\"\"/#"
277
301
  ]));
278
- this.debug(`Final command input list: \n${this.inputs.map(__assignType((command) => ` - ${command.id}${command.isVirtual ? " (virtual)" : ""}: ${command.source === "file" ? replacePath(command.entry.file, this.commandsPath) : `added by ${command.source}`}`, [
302
+ this.debug(`Final command input list: \n${this.inputs.map(__assignType((command) => ` - ${command.id}${command.virtual ? " (virtual)" : ""}`, [
279
303
  "command",
280
304
  "",
281
305
  "P\"2!\"/\""
@@ -285,54 +309,53 @@ const plugin = __assignType((options = {}) => {
285
309
  }
286
310
  },
287
311
  {
288
- name: "shell-shock:update-env",
312
+ name: "shell-shock/core:update-env",
289
313
  configResolved: {
290
314
  order: "post",
291
315
  async handler() {
292
316
  this.debug("Adding global options to the CLI application's environment variables.");
317
+ if (!this.env.config) {
318
+ this.debug("Environment variable schema not found in plugin context. Extracting environment variable schema from type definitions provided in plugin options.");
319
+ await extractEnv(this);
320
+ if (!this.env.config) throw new Error("Failed to extract environment variable schema from type definitions provided in plugin options. Please ensure the `env.types` option is correctly specified and points to a valid TypeScript type definition file.");
321
+ }
322
+ if (!isJsonSchemaObject(this.env.config.schema)) throw new Error("Invalid environment variable schema extracted.");
323
+ const env = getProperties(this.env.config);
293
324
  for (const option of Object.values(this.globalOptions).filter(__assignType((option) => Boolean(option.env), [
294
325
  "option",
295
326
  "",
296
327
  "P\"2!\"/\""
297
- ])).filter(__assignType((option) => !this.env.types.env.getPropertyOrUndefined(option.env), [
328
+ ])).filter(__assignType((option) => isSetString(option.env) && !env[option.env], [
298
329
  "option",
299
330
  "",
300
331
  "P\"2!\"/\""
301
- ]))) this.env.types.env.addProperty({
332
+ ]))) addProperty(this.env.config, option.env, {
333
+ ...option,
302
334
  name: option.env,
303
- optional: option.optional ? true : void 0,
304
- description: option.description,
305
- visibility: ReflectionVisibility.public,
306
- type: extractType(option),
307
- default: option.default,
308
- tags: {
309
- title: option.title,
310
- alias: option.alias.filter(__assignType((alias) => alias.length > 1, [
311
- "alias",
312
- "",
313
- "P\"2!\"/\""
314
- ])).map(__assignType((alias) => constantCase(alias), [
315
- "alias",
316
- "",
317
- "P\"2!\"/\""
318
- ])),
319
- domain: "cli"
320
- }
335
+ alias: option.alias.filter(__assignType((alias) => alias.length > 1, [
336
+ "alias",
337
+ "",
338
+ "P\"2!\"/\""
339
+ ])).map(__assignType((alias) => constantCase(alias), [
340
+ "alias",
341
+ "",
342
+ "P\"2!\"/\""
343
+ ]))
321
344
  });
322
- await writeEnvTypeReflection(this, this.env.types.env, "env");
345
+ await writeEnv(this);
323
346
  }
324
347
  }
325
348
  },
326
349
  {
327
- name: "shell-shock:resolve-commands",
350
+ name: "shell-shock/core:resolve-commands",
328
351
  prepare: {
329
352
  order: "post",
330
353
  async handler() {
331
354
  this.debug("Initializing the CLI application's command tree.");
332
355
  this.commands = {};
333
- if (this.config.command !== "prepare" && this.config.skipCache !== true && this.persistedMeta?.checksum === this.meta.checksum && this.fs.existsSync(getCommandsPersistencePath(this))) {
356
+ if (this.config.command !== "prepare" && this.config.skipCache !== true && this.persistedMeta?.checksum === this.meta.checksum && this.fs.existsSync(getCacheFilePath(this, this.env.config))) {
334
357
  this.debug(`Skipping command resolution as the meta checksum has not changed.`);
335
- await readCommandsPersistence(this);
358
+ await extractEnv(this);
336
359
  } else {
337
360
  for (const input of this.inputs.filter(__assignType((input) => input.segments.filter(__assignType((segment) => !isDynamicPathSegment(segment) && !isPathSegmentGroup(segment), [
338
361
  "segment",
@@ -352,7 +375,7 @@ const plugin = __assignType((options = {}) => {
352
375
  ...option,
353
376
  name: camelCase(name),
354
377
  alias: option.alias ?? [],
355
- optional: option.optional ?? false
378
+ required: option.required ?? true
356
379
  }], [
357
380
  "param0",
358
381
  "",
@@ -388,7 +411,7 @@ const plugin = __assignType((options = {}) => {
388
411
  }
389
412
  },
390
413
  {
391
- name: "shell-shock:chmod+x",
414
+ name: "shell-shock/core:chmod+x",
392
415
  configResolved() {
393
416
  this.config.tsdown.hooks ??= {};
394
417
  this.config.tsdown.hooks["build:done"] = __assignType(async (_) => {
@@ -415,7 +438,7 @@ const plugin = __assignType((options = {}) => {
415
438
  }
416
439
  },
417
440
  {
418
- name: "shell-shock:docs",
441
+ name: "shell-shock/core:docs",
419
442
  configResolved: __assignType(function configResolved() {
420
443
  this.config.automd ??= {};
421
444
  this.config.automd.generators = {
@@ -438,7 +461,7 @@ const plugin = __assignType((options = {}) => {
438
461
  get children() {
439
462
  return __assignType((child) => createComponent(Show, {
440
463
  get when() {
441
- return !child.isVirtual;
464
+ return !child.virtual;
442
465
  },
443
466
  get children() {
444
467
  return createComponent(CommandDocsFile, { command: child });
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.mjs","names":[],"sources":["../src/plugin.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 { For, Show } from \"@alloy-js/core/components\";\nimport { ReflectionVisibility } from \"@powerlines/deepkit/vendor/type\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport { writeEnvTypeReflection } from \"@powerlines/plugin-env/helpers\";\nimport nodejs from \"@powerlines/plugin-nodejs\";\nimport tsdown from \"@powerlines/plugin-tsdown\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { chmodX } from \"@stryke/fs/chmod-x\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { findFilePath } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { defu } from \"defu\";\nimport type { Plugin } from \"powerlines\";\nimport { resolveInputs } from \"powerlines/utils\";\nimport type { BuildContext, RolldownChunk, TsdownHooks } from \"tsdown\";\nimport { CommandDocsFile } from \"./components/docs\";\nimport { ExecBuiltin } from \"./components/exec-builtin\";\nimport { StateBuiltin } from \"./components/state-builtin\";\nimport { UtilsBuiltin } from \"./components/utils-builtin\";\nimport { commands } from \"./helpers/automd\";\nimport {\n findCommandsRoot,\n resolveCommandId,\n resolveCommandName,\n resolveCommandPath\n} from \"./helpers/paths\";\nimport {\n getCommandsPersistencePath,\n readCommandsPersistence,\n writeCommandsPersistence\n} from \"./helpers/persistence\";\nimport {\n formatBinaryPath,\n updatePackageJsonBinary\n} from \"./helpers/update-package-json\";\nimport { formatCommandTree, getGlobalOptions } from \"./helpers/utilities\";\nimport { validateCommand } from \"./helpers/validations\";\nimport { extractType } from \"./plugin-utils\";\nimport {\n getAppDescription,\n getAppName,\n getAppTitle,\n getDynamicPathSegmentName,\n isDynamicPathSegment,\n isPathSegmentGroup\n} from \"./plugin-utils/context-helpers\";\nimport { getCommandTree } from \"./plugin-utils/get-command-tree\";\nimport { traverseCommands } from \"./plugin-utils/traverse-command-tree\";\nimport { resolve } from \"./resolver/resolve\";\nimport type { CommandTree } from \"./types/command\";\nimport type { Options } from \"./types/config\";\nimport type { Context } from \"./types/context\";\n\nconst MAX_DEPTH = 50;\n\n/**\n * The core Powerlines plugin to build Shell Shock projects.\n */\nexport const plugin = <TContext extends Context = Context>(\n options: Options = {}\n): Plugin<TContext>[] => {\n return [\n tsdown<TContext>(),\n automd<TContext>(),\n {\n name: \"shell-shock:config\",\n async config() {\n this.debug(\"Resolving the Shell Shock configuration.\");\n\n const result = defu(options, {\n name: getAppName(this),\n title: getAppTitle(this),\n description: getAppDescription(this),\n platform: \"node\",\n projectType: \"application\",\n framework: \"shell-shock\",\n isCaseSensitive: false,\n output: {\n format: \"esm\",\n dts: false\n },\n input:\n !this.config.input ||\n (Array.isArray(this.config.input) &&\n this.config.input.length === 0) ||\n (isObject(this.config.input) &&\n Object.keys(this.config.input).length === 0)\n ? [\"src/**/command.ts\", \"src/**/command.tsx\"]\n : undefined,\n resolve: {\n external: [\"@powerlines/deepkit\"],\n skipNodeModulesBundle: true\n },\n tsdown: {\n dts: false,\n nodeProtocol: true,\n unbundle: false\n }\n });\n\n return result;\n },\n configResolved: {\n order: \"pre\",\n async handler() {\n this.debug(\"Shell Shock configuration has been resolved.\");\n\n await updatePackageJsonBinary(this);\n\n this.config.appSpecificEnvPrefix = isSetString(\n this.config.autoAssignEnv\n )\n ? this.config.autoAssignEnv\n : constantCase(getAppName(this));\n if (\n !this.config.env.prefix ||\n !Array.isArray(this.config.env.prefix)\n ) {\n this.config.env.prefix = toArray(this.config.env.prefix);\n }\n\n if (\n !this.config.env.prefix.includes(this.config.appSpecificEnvPrefix)\n ) {\n this.config.env.prefix.push(this.config.appSpecificEnvPrefix);\n }\n\n this.config.bin = (isSetString(this.packageJson.bin)\n ? { [kebabCase(this.config.name)]: this.packageJson.bin }\n : this.packageJson.bin) ?? {\n [kebabCase(this.config.name)]: formatBinaryPath(\n this.config.output.format\n )\n };\n\n if (isSetString(this.config.reference)) {\n if (this.config.reference.includes(\"{command}\")) {\n this.config.reference = {\n app: this.config.reference\n .substring(0, this.config.reference.indexOf(\"{command}\"))\n .replace(/\\/?$/, \"/\"),\n commands: this.config.reference\n };\n } else if (this.config.reference.includes(\"{commands}\")) {\n this.config.reference = {\n app: this.config.reference\n .substring(0, this.config.reference.indexOf(\"{commands}\"))\n .replace(/\\/?$/, \"/\"),\n commands: this.config.reference\n };\n } else {\n this.config.reference = {\n app: this.config.reference\n };\n }\n }\n\n this.inputs ??= [];\n this.globalOptions = Object.values(\n getGlobalOptions(this, {\n id: null,\n name: this.config.name,\n path: null,\n segments: [],\n title: this.config.title,\n description: this.config.description,\n alias: [],\n isVirtual: false\n })\n );\n\n this.globalOptions = this.globalOptions.map(option => ({\n ...option,\n name: camelCase(option.name),\n alias: option.alias ?? [],\n optional: option.optional ?? false\n }));\n }\n }\n },\n ...nodejs<TContext>(\n defu(options ?? {}, {\n env: {\n types: \"@shell-shock/core/types/env#ShellShockEnv\",\n validate: false\n }\n })\n ),\n {\n name: \"shell-shock:inputs\",\n async configResolved() {\n this.debug(\n `Checking for commands using input: ${JSON.stringify(this.config.input)}`\n );\n\n this.commandsPath = await findCommandsRoot(this);\n this.debug(`Resolved commands root path: ${this.commandsPath}`);\n\n const inputs = await resolveInputs(this, this.config.input);\n\n this.debug(\n `Found ${\n inputs.length\n } entry points specified in the configuration options.`\n );\n\n this.inputs = inputs.reduce((ret, entry) => {\n if (\n entry.file !== this.commandsPath &&\n !isParentPath(entry.file, this.commandsPath)\n ) {\n throw new Error(\n `Command entry point \"${\n entry.file\n }\" is not located within the commands root \"${\n this.commandsPath\n }\". Please ensure that all command entry points are located within the current project.`\n );\n }\n\n const id = resolveCommandId(this, entry.file);\n if (!ret.some(existing => existing.id === id)) {\n const name = resolveCommandName(entry.file);\n let segments = resolveCommandPath(this, entry.file)\n .split(\"/\")\n .filter(Boolean);\n\n // Ensure unique segment names by appending an index suffix to duplicates\n segments = segments.map((segment, index) => {\n const found = segments.findIndex(\n existing => existing === segment\n );\n if (found !== -1 && found !== index) {\n segment += `_${\n segments.filter(\n segment =>\n isDynamicPathSegment(segment) &&\n getDynamicPathSegmentName(segment).replace(\n /_\\d+$/,\n \"\"\n ) === segment\n ).length\n }`;\n }\n\n return segment;\n });\n\n ret.push({\n id,\n path: segments.join(\"/\"),\n segments,\n name,\n alias: [],\n tags: [],\n isVirtual: false,\n source: \"file\",\n entry: {\n ...entry,\n file: entry.file,\n input: {\n file: entry.file,\n name: entry.name\n },\n output: name\n }\n });\n }\n\n return ret;\n }, this.inputs);\n\n this.debug(\n `Shell Shock will process ${\n this.inputs.length\n } command entry files: \\n${this.inputs\n .map(\n command =>\n ` - ${command.id}: ${replacePath(\n command.entry.file,\n this.commandsPath\n )}`\n )\n .join(\"\\n\")}`\n );\n },\n async prepare() {\n this.debug(\n \"Rendering base built-in modules for the Shell Shock application.\"\n );\n\n return render(\n this,\n <>\n <StateBuiltin />\n <UtilsBuiltin />\n <ExecBuiltin />\n </>\n );\n }\n },\n {\n name: \"shell-shock:virtual-inputs\",\n configResolved: {\n order: \"post\",\n async handler() {\n if (this.inputs.length === 0) {\n this.warn(\n \"No commands were found in the project. Please ensure at least one command exists.\"\n );\n } else {\n this.debug(\n \"Finding and adding virtual command inputs for each command previously found.\"\n );\n\n this.inputs = this.inputs\n .reduce((ret, command) => {\n let depth = 0;\n\n let parentPath = resolveParentPath(\n findFilePath(command.entry.file)\n );\n if (isParentPath(parentPath, this.commandsPath)) {\n while (parentPath !== this.commandsPath) {\n if (depth++ > MAX_DEPTH) {\n throw new Error(\n `Unable to process virtual commands for ${\n command.name\n } \\n\\nPlease ensure ${\n command.entry.file\n } is a valid command entry file and does not have an invalid path.`\n );\n }\n\n if (\n !ret.some(\n existing =>\n findFilePath(existing.entry.file) === parentPath\n )\n ) {\n const file = joinPaths(parentPath, \"command.ts\");\n const id = resolveCommandId(this, file);\n if (!ret.some(existing => existing.id === id)) {\n const name = resolveCommandName(file);\n\n let segments = resolveCommandPath(this, file)\n .split(\"/\")\n .filter(Boolean);\n\n // Ensure unique segment names by appending an index suffix to duplicates\n segments = segments.map((segment, index) => {\n const found = segments.findIndex(\n existing => existing === segment\n );\n if (found !== -1 && found !== index) {\n segment += `_${\n segments.filter(\n segment =>\n isDynamicPathSegment(segment) &&\n getDynamicPathSegmentName(segment).replace(\n /_\\d+$/,\n \"\"\n ) === segment\n ).length\n }`;\n }\n\n return segment;\n });\n\n ret.push({\n id,\n path: segments.join(\"/\"),\n segments,\n name,\n alias: [],\n tags: [],\n isVirtual: true,\n entry: {\n file\n },\n source: \"file\"\n });\n }\n }\n\n parentPath = resolveParentPath(parentPath);\n }\n }\n\n return ret;\n }, this.inputs)\n .sort((a, b) => a.segments.length - b.segments.length);\n\n this.debug(\n `Final command input list: \\n${this.inputs\n .map(\n command =>\n ` - ${command.id}${command.isVirtual ? \" (virtual)\" : \"\"}: ${\n command.source === \"file\"\n ? replacePath(command.entry.file, this.commandsPath)\n : `added by ${command.source}`\n }`\n )\n .join(\"\\n\")}`\n );\n }\n }\n }\n },\n {\n name: \"shell-shock:update-env\",\n configResolved: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Adding global options to the CLI application's environment variables.\"\n );\n\n for (const option of Object.values(this.globalOptions)\n .filter(option => Boolean(option.env))\n .filter(\n option =>\n !this.env.types.env.getPropertyOrUndefined(option.env as string)\n )) {\n this.env.types.env.addProperty({\n name: option.env as string,\n optional: option.optional ? true : undefined,\n description: option.description,\n visibility: ReflectionVisibility.public,\n type: extractType(option),\n default: option.default,\n tags: {\n title: option.title,\n alias: option.alias\n .filter(alias => alias.length > 1)\n .map(alias => constantCase(alias)),\n domain: \"cli\"\n }\n });\n }\n\n await writeEnvTypeReflection(this, this.env.types.env, \"env\");\n }\n }\n },\n {\n name: \"shell-shock:resolve-commands\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\"Initializing the CLI application's command tree.\");\n\n this.commands = {};\n if (\n this.config.command !== \"prepare\" &&\n this.config.skipCache !== true &&\n this.persistedMeta?.checksum === this.meta.checksum &&\n this.fs.existsSync(getCommandsPersistencePath(this))\n ) {\n this.debug(\n `Skipping command resolution as the meta checksum has not changed.`\n );\n\n await readCommandsPersistence(this);\n } else {\n for (const input of this.inputs.filter(\n input =>\n input.segments.filter(\n segment =>\n !isDynamicPathSegment(segment) &&\n !isPathSegmentGroup(segment)\n ).length === 1\n )) {\n this.commands[input.name] = await resolve({\n context: this,\n command: input\n });\n }\n\n this.debug(\"Post-processing commands to ensure proper reflection.\");\n\n await traverseCommands(this, command => {\n command.options = Object.fromEntries(\n Object.entries(command.options).map(([name, option]) => [\n camelCase(name),\n {\n ...option,\n name: camelCase(name),\n alias: option.alias ?? [],\n optional: option.optional ?? false\n }\n ])\n );\n });\n\n await writeCommandsPersistence(this);\n }\n\n this.debug(\"Validating the CLI applications command tree.\");\n\n let isValid = true;\n await traverseCommands(this, command => {\n const failures = validateCommand(command);\n if (failures.length > 0) {\n this.error(\n `Found ${failures.length} issue${failures.length > 1 ? \"s\" : \"\"} with the ${\n command.title\n } command: \\n${failures\n .map(failure => ` - ${failure.code}: ${failure.details}`)\n .join(\"\\n\")}\\n`\n );\n isValid = false;\n }\n });\n if (!isValid) {\n throw new Error(\n `One or more commands in the command tree are invalid. Please review the errors above and correct them before proceeding.`\n );\n }\n\n this.info(\n `\\nCreating an application with the following command tree: \\n${formatCommandTree(\n this\n )}\\n`\n );\n }\n }\n },\n {\n name: \"shell-shock:chmod+x\",\n configResolved() {\n this.config.tsdown.hooks ??= {};\n (this.config.tsdown.hooks as TsdownHooks)[\"build:done\"] = async (\n _: BuildContext & {\n chunks: RolldownChunk[];\n }\n ) => {\n await Promise.all(\n Object.values(this.config.bin).map(async bin => {\n const path = appendPath(\n bin,\n joinPaths(this.config.cwd, this.config.root)\n );\n if (this.fs.existsSync(path)) {\n this.debug(\n `Adding hashbang to binary executable output file: ${path}`\n );\n\n const content = await this.fs.read(path);\n if (content && !content.startsWith(\"#!\")) {\n await this.fs.write(\n path,\n `#!/usr/bin/env ${\n this.config.mode === \"development\"\n ? \"-S NODE_OPTIONS=--enable-source-maps\"\n : \"\"\n } node\\n\\n${content}`\n );\n }\n\n this.debug(\n `Adding executable permissions (chmod+x) to binary executable output file: ${\n path\n }`\n );\n\n await chmodX(path);\n } else {\n this.warn(\n `Expected binary output file not found at path: ${\n path\n }. Skipping adding hashbang and executable permissions (chmod+x).`\n );\n }\n })\n );\n };\n }\n },\n {\n name: \"shell-shock:docs\",\n configResolved() {\n this.config.automd ??= {};\n this.config.automd.generators = {\n ...(this.config.automd.generators ?? {}),\n commands: commands(this)\n };\n },\n async docs() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n const commands = this.inputs\n .map(input => getCommandTree(this, input.segments))\n .filter(Boolean) as CommandTree[];\n\n return render(\n this,\n <For each={Object.values(commands)} doubleHardline>\n {child => (\n <Show when={!child.isVirtual}>\n <CommandDocsFile command={child} />\n </Show>\n )}\n </For>\n );\n }\n }\n ];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEE,IAAG,SAAS;;;AAyDd,MAAE,YAAgB;;;;AAIlB,MAAS,SAAA,cAA0B,UAAQ,EAAA,KAAA;AAC3C,QAAS;GAAA,OAAA,IAAa,CAAC,CAAA,WAAQ,OAAO,CAAA,EAAM,QAAA;GAAA,OAAA,IAAA,CAAA,CAAA,WAAA,OAAA,CAAA,EAAA,QAAA;EAAA;GAC5C,MAAO;GACL,QAAA,aAAiB,eAAA,SAAA;AACjB,SAAA,MAAU,2CAAA;AAwBR,WAvBS,KAAA,SAAA;KACX,MAAA,WAAA,KAAyB;KACzB,OAAA,YAAoB,KAAA;KACpB,aAAA,kBAAA,KAAA;KACM,UAAS;KACT,aAAC;KACD,WAAC;KACD,iBAAiB;KAClB,QAAO;MACP,QAAO;MACP,KAAO;;KAER,OAAS,CAAC,KAAI,OAAA,SAAA,MAAA,QAAA,KAAA,OAAA,MAAA,IAAA,KAAA,OAAA,MAAA,WAAA,KAAA,SAAA,KAAA,OAAA,MAAA,IAAA,OAAA,KAAA,KAAA,OAAA,MAAA,CAAA,WAAA,IAAA,CAAA,qBAAA,qBA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AA;AACZ,YAAE,MAAK,qDAAqB,OAAA;OAC5B,MAAK,UAAI,MAAA,KAAA,GAAA,KAAA,KAAA;AACT,WAAG,WAAY,CAAA,QAAK,WAAa,KAAO,CACvC,OAAA,KAAA,GAAA,MAAA,MAAA,kBAAA,KAAA,OAAA,SAAA,gBAAA,yCAAA,GAAA,WAAA,UAAA;AAED,YAAK,MAAK,6EAAA,OAAA;AACV,aAAG,OAAQ,KAAI;;QAIhB;MAAC;MAAG;MAAQ;MAAK,CAAA,CAAO,CAAC;OAC3B;KAAC;KAAU;KAAK;KAAI;KAAA,CAAA;;GAE1B;EAAE;GACD,MAAM;GACN,gBAAa,aAAA,SAAA,iBAAA;AACX,SAAK,OAAO,WAAE,EAAA;AACd,SAAK,OAAO,OAAO,aAAa;KAC9B,GAAI,KAAK,OAAO,OAAO,cAAc,EAAA;KACrC,UAAU,SAAS,KAAK;KACzB;MACA,CAAC,kBAAkB,QAAO,CAAC;GAC9B,MAAM,OAAO;AACX,SAAK,MAAM,oEAAuB;IAClC,MAAM,WAAW,KAAK,OAAG,IAAM,cAAc,UAAS,eAAgB,MAAC,MAAQ,SAAK,EAAA;KAAA;KAAA;KAAA;KAAA,CAAA,CAAA,CAAA,OAAA,QAAA;AACpF,WAAO,OAAO,MAAG,gBAAA,KAAA;KACf,IAAI,OAAO;;;KAGX,gBAAe;KACf,IAAI,WAAW;AACb,aAAO,cAAS,UAAa,gBAAe,MAAS;OACnD,IAAI,OAAM;AACR,eAAO,CAAC,MAAA;;OAEV,IAAI,WAAW;AACb,eAAO,gBAAe,iBAAoB,EACxC,SAAQ;;OAGb,CAAC,EAAE;OAAC;OAAS;OAAG;OAAS,CAAA;;;;GAIjC;EAAC;GACD;CAAC;CAAW;QAAiB,EAAA;CAAM;CAAE;CAAS,CAAS"}
1
+ {"version":3,"file":"plugin.mjs","names":[],"sources":[],"mappings":""}
@@ -1,6 +1,4 @@
1
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
1
  const require_context_helpers = require('../plugin-utils/context-helpers.cjs');
3
- const require_types_command = require('../types/command.cjs');
4
2
  let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
5
3
  let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
6
4
  let defu = require("defu");
@@ -17,53 +15,57 @@ function __assignType(fn, args) {
17
15
  * Resolves the description for a command option based on its reflection.
18
16
  *
19
17
  * @param name - The name of the command option.
20
- * @param kind - The reflection kind of the command option.
21
- * @param optional - Whether the command option is optional.
18
+ * @param type - The reflection kind of the command option.
19
+ * @param required - Whether the command option is required.
22
20
  * @param variadic - Whether the command option is variadic (i.e., an array).
23
21
  * @param title - The title of the command option, if any.
24
22
  * @param defaultValue - The default value of the command option, if any.
25
23
  * @returns The resolved description for the command option.
26
24
  */
27
- function resolveCommandOptionDescription(name, kind, optional = false, variadic = false, title, defaultValue) {
28
- return `A${optional && !defaultValue ? "n optional" : ""} command-line ${kind === require_types_command.CommandParameterKinds.boolean ? "flag" : "option"} that allows the user to ${kind === require_types_command.CommandParameterKinds.boolean ? "set the" : variadic ? "specify custom" : "specify a custom"} ${title?.trim() || (0, _stryke_string_format_title_case.titleCase)(name)} ${kind === require_types_command.CommandParameterKinds.boolean ? "indicator" : `${kind === require_types_command.CommandParameterKinds.number ? "numeric" : "string"} value${variadic ? "s" : ""}`}.`;
25
+ function resolveCommandOptionDescription(name, type, required = true, variadic = false, title, defaultValue) {
26
+ return `A${!required && !defaultValue ? "n optional" : ""} command-line ${type === "boolean" ? "flag" : "option"} that allows the user to ${type === "boolean" ? "set the" : variadic ? "specify custom" : "specify a custom"} ${title?.trim() || (0, _stryke_string_format_title_case.titleCase)(name)} ${type === "boolean" ? "indicator" : `${type === "number" ? "numeric" : "string"} value${variadic ? "s" : ""}`}.`;
29
27
  }
30
28
  resolveCommandOptionDescription.__type = [
31
29
  "name",
32
- "CommandParameterKind",
33
- "kind",
34
- "optional",
30
+ "string",
31
+ "number",
32
+ "boolean",
33
+ "type",
34
+ "required",
35
35
  "variadic",
36
36
  "title",
37
37
  "defaultValue",
38
38
  "resolveCommandOptionDescription",
39
39
  "Resolves the description for a command option based on its reflection.",
40
- "P&2!\"w\"2#\"2$\"2%&2&8\"2'8&/(?)"
40
+ "P&2!P.\".#.$J2%\"2&\"2'&2(8\"2)8&/*?+"
41
41
  ];
42
42
  /**
43
43
  * Resolves the description for a command argument based on its reflection.
44
44
  *
45
45
  * @param name - The name of the command argument.
46
- * @param kind - The reflection kind of the command argument.
47
- * @param optional - Whether the command argument is optional.
46
+ * @param type - The reflection kind of the command argument.
47
+ * @param required - Whether the command argument is required.
48
48
  * @param variadic - Whether the command argument is variadic (i.e., an array).
49
49
  * @param title - The title of the command argument, if any.
50
50
  * @param defaultValue - The default value of the command argument, if any.
51
51
  * @returns The resolved description for the command argument.
52
52
  */
53
- function resolveCommandArgumentDescription(name, kind, optional = false, variadic = false, title, defaultValue) {
54
- return `An${optional && !defaultValue ? " optional" : ""} argument that allows the user to ${kind === require_types_command.CommandParameterKinds.boolean ? "set the" : variadic ? "specify custom" : "specify a custom"} ${title?.trim() || (0, _stryke_string_format_title_case.titleCase)(name)} ${kind === require_types_command.CommandParameterKinds.boolean ? "indicator" : `${kind === require_types_command.CommandParameterKinds.number ? "numeric" : "string"} value${variadic ? "s" : ""}`}.`;
53
+ function resolveCommandArgumentDescription(name, type, required = true, variadic = false, title, defaultValue) {
54
+ return `An${!required && !defaultValue ? " optional" : ""} argument that allows the user to ${type === "boolean" ? "set the" : variadic ? "specify custom" : "specify a custom"} ${title?.trim() || (0, _stryke_string_format_title_case.titleCase)(name)} ${type === "boolean" ? "indicator" : `${type === "number" ? "numeric" : "string"} value${variadic ? "s" : ""}`}.`;
55
55
  }
56
56
  resolveCommandArgumentDescription.__type = [
57
57
  "name",
58
- "CommandParameterKind",
59
- "kind",
60
- "optional",
58
+ "string",
59
+ "number",
60
+ "boolean",
61
+ "type",
62
+ "required",
61
63
  "variadic",
62
64
  "title",
63
65
  "defaultValue",
64
66
  "resolveCommandArgumentDescription",
65
67
  "Resolves the description for a command argument based on its reflection.",
66
- "P&2!\"w\"2#\"2$\"2%&2&8\"2'8&/(?)"
68
+ "P&2!P.\".#.$J2%\"2&\"2'&2(8\"2)8&/*?+"
67
69
  ];
68
70
  function applyOptionsDefaults(ctx) {
69
71
  return Object.fromEntries(Object.entries(ctx.output.options).map(__assignType(([key, option]) => {
@@ -73,7 +75,7 @@ function applyOptionsDefaults(ctx) {
73
75
  ...option,
74
76
  name,
75
77
  title,
76
- description: option.description || resolveCommandOptionDescription(name, option.kind, option.optional, option.kind !== require_types_command.CommandParameterKinds.boolean && option.variadic, title, option.default),
78
+ description: option.description || resolveCommandOptionDescription(name, option.type, option.required, option.type !== "boolean" && option.variadic, title, option.default),
77
79
  env: option.env || option.env === false ? option.env : ctx.input.context.config.autoAssignEnv ? (0, _stryke_string_format_constant_case.constantCase)(name) : false
78
80
  }];
79
81
  }, [
@@ -96,7 +98,7 @@ function applyArgsDefaults(ctx) {
96
98
  ...arg,
97
99
  name,
98
100
  title,
99
- description: arg.description || resolveCommandArgumentDescription(name, arg.kind, arg.optional, arg.kind !== require_types_command.CommandParameterKinds.boolean && arg.variadic, title, arg.default),
101
+ description: arg.description || resolveCommandArgumentDescription(name, arg.type, arg.required, arg.type !== "boolean" && arg.variadic, title, arg.default),
100
102
  env: arg.name ? arg.env || arg.env === false ? arg.env : ctx.input.context.config.autoAssignEnv ? (0, _stryke_string_format_constant_case.constantCase)(name) : false : false
101
103
  };
102
104
  }, [
@@ -115,7 +117,7 @@ applyArgsDefaults.__type = [
115
117
  ];
116
118
  function applyDefaults(ctx) {
117
119
  ctx.output.description ??= `The ${ctx.output.title.replace(/(?:c|C)ommands?$/, "").trim()} executable command-line interface.`;
118
- if ((0, _stryke_type_checks_is_set_string.isSetString)(ctx.input.context.config.reference?.commands) && ctx.input.context.config.reference.commands.includes("{command}")) ctx.output.reference ??= ctx.input.context.config.reference.commands ? ctx.input.context.config.reference.commands.replace("{command}", ctx.input.command.segments.filter(__assignType((segment) => !require_context_helpers.isDynamicPathSegment(segment), [
120
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(ctx.input.context.config.reference?.commands) && ctx.input.context.config.reference.commands.includes("{command}")) ctx.output.docs ??= ctx.input.context.config.reference.commands ? ctx.input.context.config.reference.commands.replace("{command}", ctx.input.command.segments.filter(__assignType((segment) => !require_context_helpers.isDynamicPathSegment(segment), [
119
121
  "segment",
120
122
  "",
121
123
  "P\"2!\"/\""
@@ -127,6 +129,12 @@ applyDefaults.__type = [
127
129
  "applyDefaults",
128
130
  "P\"w!2\"\"/#"
129
131
  ];
132
+ /**
133
+ * Resolves a virtual command by applying default values to its title and description based on the command name and application title.
134
+ *
135
+ * @template TContext - The type of the context object.
136
+ * @param ctx - The resolver context containing the input and output for the command resolution process.
137
+ */
130
138
  function resolveVirtualCommand(ctx) {
131
139
  ctx.output.title ??= (0, _stryke_string_format_title_case.titleCase)(ctx.input.command.name);
132
140
  ctx.output.description ??= `A collection of available ${ctx.output.title.replace(/(?:c|C)ommands?$/, "").trim() || (0, _stryke_string_format_title_case.titleCase)(ctx.input.command.name)} commands that are included in the ${require_context_helpers.getAppTitle(ctx.input.context, true)} command-line application.`;
@@ -135,7 +143,8 @@ resolveVirtualCommand.__type = [
135
143
  "ResolverContext",
136
144
  "ctx",
137
145
  "resolveVirtualCommand",
138
- "P\"w!2\"\"/#"
146
+ "Resolves a virtual command by applying default values to its title and description based on the command name and application title.",
147
+ "P\"w!2\"\"/#?$"
139
148
  ];
140
149
  /**
141
150
  * Merges two command parameters, giving precedence to string values in the second configuration.
@@ -169,5 +178,5 @@ const mergeCommandParameter = (0, defu.createDefu)(__assignType((obj, key, value
169
178
  exports.applyArgsDefaults = applyArgsDefaults;
170
179
  exports.applyDefaults = applyDefaults;
171
180
  exports.applyOptionsDefaults = applyOptionsDefaults;
172
- exports.mergeCommandParameter = mergeCommandParameter;
173
- exports.resolveVirtualCommand = resolveVirtualCommand;
181
+ exports.resolveVirtualCommand = resolveVirtualCommand;
182
+ //# sourceMappingURL=helpers.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.cjs","names":[],"sources":[],"mappings":""}