@shell-shock/preset-cli 0.9.34 → 0.9.36

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 (64) hide show
  1. package/dist/command-entry-BCDDI3RN.mjs +548 -0
  2. package/dist/command-entry-BCDDI3RN.mjs.map +1 -0
  3. package/dist/command-entry-iZ5O5Iza.cjs +558 -0
  4. package/dist/components/banner-builtin.cjs +39 -14
  5. package/dist/components/banner-builtin.d.cts +1 -2
  6. package/dist/components/banner-builtin.d.cts.map +1 -1
  7. package/dist/components/banner-builtin.d.mts +1 -2
  8. package/dist/components/banner-builtin.mjs +6 -6
  9. package/dist/components/command-entry.cjs +2 -447
  10. package/dist/components/command-entry.d.cts +1 -2
  11. package/dist/components/command-entry.d.cts.map +1 -1
  12. package/dist/components/command-entry.d.mts +1 -2
  13. package/dist/components/command-entry.mjs +2 -446
  14. package/dist/components/command-router.cjs +6 -6
  15. package/dist/components/command-router.d.cts +0 -1
  16. package/dist/components/command-router.d.cts.map +1 -1
  17. package/dist/components/command-router.d.mts +0 -1
  18. package/dist/components/command-router.mjs +3 -3
  19. package/dist/components/index.cjs +3 -4
  20. package/dist/components/index.mjs +1 -2
  21. package/dist/components/update-builtin.cjs +7 -7
  22. package/dist/components/update-builtin.d.cts +0 -1
  23. package/dist/components/update-builtin.d.cts.map +1 -1
  24. package/dist/components/update-builtin.d.mts +0 -1
  25. package/dist/components/update-builtin.mjs +5 -5
  26. package/dist/components/virtual-command-entry.cjs +2 -114
  27. package/dist/components/virtual-command-entry.d.cts +1 -2
  28. package/dist/components/virtual-command-entry.d.cts.map +1 -1
  29. package/dist/components/virtual-command-entry.d.mts +1 -2
  30. package/dist/components/virtual-command-entry.mjs +2 -113
  31. package/dist/generator.cjs +158 -0
  32. package/dist/generator.d.cts +16 -0
  33. package/dist/generator.d.cts.map +1 -0
  34. package/dist/generator.d.mts +16 -0
  35. package/dist/generator.d.mts.map +1 -0
  36. package/dist/generator.mjs +156 -0
  37. package/dist/generator.mjs.map +1 -0
  38. package/dist/helpers/get-global-options.cjs +1 -0
  39. package/dist/helpers/get-global-options.d.cts +15 -0
  40. package/dist/helpers/get-global-options.d.cts.map +1 -0
  41. package/dist/helpers/get-global-options.d.mts +15 -0
  42. package/dist/helpers/get-global-options.d.mts.map +1 -0
  43. package/dist/helpers/get-global-options.mjs +4 -4
  44. package/dist/index.cjs +20 -130
  45. package/dist/index.d.cts +3 -3
  46. package/dist/index.d.cts.map +1 -1
  47. package/dist/index.d.mts +3 -3
  48. package/dist/index.mjs +25 -129
  49. package/dist/plugin-BUwcMpPx.d.mts +100 -0
  50. package/dist/plugin-BUwcMpPx.d.mts.map +1 -0
  51. package/dist/plugin-Bsdv5DH-.d.cts +100 -0
  52. package/dist/plugin-Bsdv5DH-.d.cts.map +1 -0
  53. package/dist/types/index.cjs +1 -0
  54. package/dist/types/index.d.cts +1 -1
  55. package/dist/types/index.d.mts +1 -1
  56. package/dist/types/index.mjs +2 -0
  57. package/dist/types/plugin.d.cts +2 -101
  58. package/dist/types/plugin.d.mts +2 -101
  59. package/package.json +53 -25
  60. package/dist/_virtual/_rolldown/runtime.cjs +0 -29
  61. package/dist/components/command-entry.mjs.map +0 -1
  62. package/dist/components/virtual-command-entry.mjs.map +0 -1
  63. package/dist/types/plugin.d.cts.map +0 -1
  64. package/dist/types/plugin.d.mts.map +0 -1
@@ -0,0 +1,558 @@
1
+ const require_components_command_router = require('./components/command-router.cjs');
2
+ let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
3
+ let _stryke_path_join = require("@stryke/path/join");
4
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
+ let _alloy_js_core = require("@alloy-js/core");
6
+ let _alloy_js_typescript = require("@alloy-js/typescript");
7
+ let _power_plant_alloy_js_core_components = require("@power-plant/alloy-js/core/components");
8
+ let _power_plant_alloy_js_core_components_spacing = require("@power-plant/alloy-js/core/components/spacing");
9
+ let _shell_shock_core_contexts_power_plant = require("@shell-shock/core/contexts/power-plant");
10
+ let defu = require("defu");
11
+ let _shell_shock_core_components_command_validation_logic = require("@shell-shock/core/components/command-validation-logic");
12
+ let _shell_shock_preset_script_components_command_entry = require("@shell-shock/preset-script/components/command-entry");
13
+ let _stryke_path_find = require("@stryke/path/find");
14
+ let _stryke_path_replace = require("@stryke/path/replace");
15
+ let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
16
+ let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
17
+ let _power_plant_alloy_js_typescript_components_typescript_file = require("@power-plant/alloy-js/typescript/components/typescript-file");
18
+ let _shell_shock_preset_script_components_virtual_command_entry = require("@shell-shock/preset-script/components/virtual-command-entry");
19
+
20
+ //#region src/components/virtual-command-entry.tsx
21
+ /**
22
+ * The virtual command entry point for the Shell Shock project.
23
+ */
24
+ function VirtualCommandEntry(props) {
25
+ const { command, imports, builtinImports, ...rest } = props;
26
+ const context = (0, _shell_shock_core_contexts_power_plant.usePowerlines)();
27
+ const filePath = (0, _alloy_js_core.computed)(() => (0, _stryke_path_join.joinPaths)(context.entryPath, command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)).join("/"), "index.ts"));
28
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_typescript_file.TypescriptFile, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
29
+ get path() {
30
+ return filePath.value;
31
+ },
32
+ get imports() {
33
+ return (0, defu.defu)(imports ?? {}, Object.entries(command.children).filter(([, child]) => child.virtual).reduce((ret, [name, child]) => {
34
+ ret[`./${child.name}`] = [{
35
+ name: "handler",
36
+ alias: `handle${(0, _stryke_string_format_pascal_case.pascalCase)(name)}`
37
+ }];
38
+ return ret;
39
+ }, {}));
40
+ },
41
+ get builtinImports() {
42
+ return (0, defu.defu)(builtinImports ?? {}, {
43
+ env: ["isDevelopment", "isDebug"],
44
+ console: [
45
+ "warn",
46
+ "error",
47
+ "info",
48
+ "help",
49
+ "table",
50
+ "writeLine",
51
+ "splitText",
52
+ "textColors",
53
+ "stripAnsi"
54
+ ],
55
+ utils: [
56
+ "isMinimal",
57
+ "isUnicodeSupported",
58
+ "isInteractive",
59
+ "findSuggestions",
60
+ "sleep"
61
+ ],
62
+ state: [
63
+ {
64
+ name: "GlobalOptions",
65
+ type: true
66
+ },
67
+ "useGlobal",
68
+ "useGlobalOptions",
69
+ "withCommand",
70
+ "useArgs",
71
+ "hasFlag",
72
+ "isHelp"
73
+ ],
74
+ prompts: [
75
+ "text",
76
+ "numeric",
77
+ "toggle",
78
+ "select",
79
+ "isCancel"
80
+ ],
81
+ [(0, _stryke_path_join.joinPaths)("help", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showHelp"],
82
+ [(0, _stryke_path_join.joinPaths)("banner", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showBanner"]
83
+ });
84
+ },
85
+ get children() {
86
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components.Spacing, {}), (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_preset_script_components_virtual_command_entry.VirtualCommandHandlerDeclaration, {
87
+ command,
88
+ get children() {
89
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
90
+ get segments() {
91
+ return command.segments;
92
+ },
93
+ get commands() {
94
+ return command.children;
95
+ }
96
+ });
97
+ }
98
+ })];
99
+ }
100
+ })), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
101
+ get each() {
102
+ return Object.values(command.children);
103
+ },
104
+ children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
105
+ get when() {
106
+ return child.virtual;
107
+ },
108
+ get fallback() {
109
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(CommandEntry, { command: child });
110
+ },
111
+ get children() {
112
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(VirtualCommandEntry, { command: child });
113
+ }
114
+ })
115
+ })];
116
+ }
117
+
118
+ //#endregion
119
+ //#region src/components/command-entry.tsx
120
+ /**
121
+ * The command entry point for the Shell Shock project.
122
+ */
123
+ function CommandEntry(props) {
124
+ const { command, imports, builtinImports, ...rest } = props;
125
+ const context = (0, _shell_shock_core_contexts_power_plant.usePowerlines)();
126
+ const filePath = (0, _alloy_js_core.computed)(() => (0, _stryke_path_join.joinPaths)(command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)).join("/"), "index.ts"));
127
+ const commandSourcePath = (0, _alloy_js_core.computed)(() => (0, _stryke_path_replace.replaceExtension)((0, _stryke_path_find.relativePath)((0, _stryke_path_join.joinPaths)(context.entryPath, (0, _stryke_path_find.findFilePath)(filePath.value)), command.entry.input?.file || command.entry.file)));
128
+ const typeDefinition = (0, _alloy_js_core.computed)(() => ({
129
+ ...command.entry,
130
+ output: command.id
131
+ }));
132
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_contexts_power_plant.EntryFile, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
133
+ get path() {
134
+ return filePath.value;
135
+ },
136
+ get typeDefinition() {
137
+ return typeDefinition.value;
138
+ },
139
+ get imports() {
140
+ return (0, defu.defu)(imports ?? {}, { [commandSourcePath.value.startsWith(".") ? commandSourcePath.value : `./${commandSourcePath.value}`]: `handle${(0, _stryke_string_format_pascal_case.pascalCase)(command.name)}` });
141
+ },
142
+ get builtinImports() {
143
+ return (0, defu.defu)(builtinImports ?? {}, {
144
+ env: [
145
+ "env",
146
+ "isDevelopment",
147
+ "isDebug",
148
+ "paths"
149
+ ],
150
+ console: [
151
+ "debug",
152
+ "info",
153
+ "help",
154
+ "warn",
155
+ "error",
156
+ "table",
157
+ "italic",
158
+ "cursor",
159
+ "stripAnsi",
160
+ "writeLine",
161
+ "splitText",
162
+ "textColors",
163
+ "createSpinner"
164
+ ],
165
+ utils: [
166
+ "sleep",
167
+ "isMinimal",
168
+ "isInteractive",
169
+ "isUnicodeSupported"
170
+ ],
171
+ state: [
172
+ {
173
+ name: "GlobalOptions",
174
+ type: true
175
+ },
176
+ "useGlobal",
177
+ "useGlobalOptions",
178
+ "withCommand",
179
+ "useArgs",
180
+ "hasFlag",
181
+ "isHelp"
182
+ ],
183
+ prompts: [
184
+ "text",
185
+ "numeric",
186
+ "toggle",
187
+ "select",
188
+ "confirm",
189
+ "waitForKeyPress",
190
+ "isCancel"
191
+ ],
192
+ [(0, _stryke_path_join.joinPaths)("help", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showHelp"],
193
+ [(0, _stryke_path_join.joinPaths)("banner", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showBanner"],
194
+ update: ["executeUpdate"]
195
+ });
196
+ },
197
+ get children() {
198
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}), (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_preset_script_components_command_entry.CommandHandlerDeclaration, {
199
+ command,
200
+ banner: _alloy_js_core.code`await showBanner();
201
+ await executeUpdate(); `,
202
+ get children() {
203
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
204
+ condition: _alloy_js_core.code`!isInteractive`,
205
+ get children() {
206
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_command_validation_logic.CommandValidationLogic, { command });
207
+ }
208
+ }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
209
+ get when() {
210
+ return Object.values(command.options ?? {}).filter((option) => option.required).length > 0 || Object.values(command.args ?? {}).filter((arg) => arg.required).length > 0;
211
+ },
212
+ get children() {
213
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
214
+ get condition() {
215
+ return _alloy_js_core.code`!isHelp() && (${Object.values(command.options ?? {}).filter((option) => option.required).map((option) => (option.type === "string" || option.type === "number") && option.variadic ? `(!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} || options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0)` : `options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} === undefined`).join(" || ")}${Object.values(command.options ?? {}).filter((option) => option.required).length > 0 && Object.values(command.args ?? {}).filter((arg) => arg.required).length > 0 ? " || " : ""}${Object.values(command.args ?? {}).filter((arg) => arg.required).map((arg) => (arg.type === "string" || arg.type === "number") && arg.variadic ? `(!${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} || ${(0, _stryke_string_format_camel_case.camelCase)(arg.name)}.length === 0)` : `${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} === undefined`).join(" || ")}) `;
216
+ },
217
+ get children() {
218
+ return [
219
+ _alloy_js_core.code`writeLine(""); `,
220
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
221
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
222
+ get each() {
223
+ return Object.values(command.options ?? {});
224
+ },
225
+ doubleHardline: true,
226
+ children: (option) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
227
+ get when() {
228
+ return option.required;
229
+ },
230
+ get children() {
231
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
232
+ get condition() {
233
+ return _alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}`;
234
+ },
235
+ get children() {
236
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
237
+ get when() {
238
+ return option.type === "boolean" || !option.choices || option.choices.length === 0;
239
+ },
240
+ get fallback() {
241
+ return _alloy_js_core.code`const value = await select({
242
+ message: \`Please select a value for the \${italic("${option.name}")} option\`, ${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
243
+ ` : ""}options: [ ${option.choices?.map((choice) => `{ value: ${JSON.stringify(choice)}, label: "${choice}", ${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(option.description)}\`` : ""} }`).join(", ")} ]
244
+ });
245
+ if (isCancel(value)) {
246
+ return;
247
+ }
248
+
249
+ options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
250
+ `;
251
+ },
252
+ get children() {
253
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Switch, { get children() {
254
+ return [
255
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
256
+ get when() {
257
+ return option.type === "string";
258
+ },
259
+ get children() {
260
+ return _alloy_js_core.code`
261
+ const value = await text({
262
+ message: \`Please provide a value for the \${italic("${option.name}")} option\`,
263
+ ${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
264
+ ` : ""}validate(val) {
265
+ if (!val || val.trim() === "") {
266
+ return "A value must be provided for this option";
267
+ }
268
+
269
+ return null;
270
+ }
271
+ });
272
+ if (isCancel(value)) {
273
+ return;
274
+ }
275
+
276
+ options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
277
+ `;
278
+ }
279
+ }),
280
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
281
+ get when() {
282
+ return option.type === "number";
283
+ },
284
+ get children() {
285
+ return _alloy_js_core.code`
286
+ const value = await numeric({
287
+ message: \`Please provide a numeric value for the \${italic("${option.name}")} option\`,
288
+ ${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
289
+ ` : ""}
290
+ });
291
+ if (isCancel(value)) {
292
+ return;
293
+ }
294
+
295
+ options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
296
+ `;
297
+ }
298
+ }),
299
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
300
+ get when() {
301
+ return option.type === "boolean";
302
+ },
303
+ get children() {
304
+ return _alloy_js_core.code`
305
+ const value = await toggle({
306
+ message: \`Please select a value for the \${italic("${option.name}")} option\`,
307
+ ${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
308
+ ` : ""}
309
+ });
310
+ if (isCancel(value)) {
311
+ return;
312
+ }
313
+
314
+ options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
315
+ `;
316
+ }
317
+ })
318
+ ];
319
+ } });
320
+ }
321
+ });
322
+ }
323
+ }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
324
+ get when() {
325
+ return (option.type === "string" || option.type === "number") && option.variadic;
326
+ },
327
+ get children() {
328
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
329
+ get condition() {
330
+ return _alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0`;
331
+ },
332
+ get children() {
333
+ return _alloy_js_core.code`
334
+ const value = await text({
335
+ message: \`Please provide one or more${option.type === "number" ? " numeric" : ""} values for the \${italic("${option.name}")} option (values are separated by a \\",\\" character)\`,
336
+ ${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
337
+ ` : ""}validate(val) {
338
+ if (!val || val.trim() === "") {
339
+ return "A value must be provided for this option";
340
+ }
341
+ if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
342
+ return "At least one value must be provided for this option";
343
+ }
344
+ ${option.type === "number" ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
345
+ if (invalidIndex !== -1) {
346
+ return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
347
+ } ` : ""}
348
+ return undefined;
349
+ }
350
+ });
351
+ if (isCancel(value)) {
352
+ return;
353
+ }
354
+
355
+ options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value.split(",").map(value => value.trim()).filter(Boolean)${option.type === "number" ? `.map(Number)` : ""} ;
356
+ `;
357
+ }
358
+ });
359
+ }
360
+ })];
361
+ }
362
+ })]
363
+ }),
364
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
365
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
366
+ get each() {
367
+ return command.args;
368
+ },
369
+ doubleHardline: true,
370
+ children: (arg) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
371
+ get when() {
372
+ return arg.required;
373
+ },
374
+ get children() {
375
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
376
+ get condition() {
377
+ return _alloy_js_core.code`!${(0, _stryke_string_format_camel_case.camelCase)(arg.name)}`;
378
+ },
379
+ get children() {
380
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
381
+ get when() {
382
+ return arg.type === "boolean" || !arg.choices || arg.choices.length === 0;
383
+ },
384
+ get fallback() {
385
+ return _alloy_js_core.code`const value = await select({
386
+ message: \`Please select a value for the \${italic("${arg.name}")} argument\`,${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(arg.description)}\`,
387
+ ` : ""}
388
+ options: [ ${arg.choices?.map((choice) => `{ value: ${JSON.stringify(choice)}, label: "${choice}", ${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`` : ""} }`).join(", ")} ]
389
+ });
390
+ if (isCancel(value)) {
391
+ return;
392
+ }
393
+
394
+ ${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value;
395
+ `;
396
+ },
397
+ get children() {
398
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Switch, { get children() {
399
+ return [
400
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
401
+ get when() {
402
+ return arg.type === "string";
403
+ },
404
+ get children() {
405
+ return _alloy_js_core.code`
406
+ const value = await text({
407
+ message: \`Please provide a value for the \${italic("${arg.name}")} argument\`,
408
+ ${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
409
+ ` : ""}validate(val) {
410
+ if (!val || val.trim() === "") {
411
+ return "A value must be provided for this argument";
412
+ }
413
+
414
+ return null;
415
+ }
416
+ });
417
+ if (isCancel(value)) {
418
+ return;
419
+ }
420
+
421
+ ${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value;
422
+ `;
423
+ }
424
+ }),
425
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
426
+ get when() {
427
+ return arg.type === "number";
428
+ },
429
+ get children() {
430
+ return _alloy_js_core.code`
431
+ const value = await numeric({
432
+ message: \`Please provide a numeric value for the \${italic("${arg.name}")} argument\`,
433
+ ${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
434
+ ` : ""}
435
+ });
436
+ if (isCancel(value)) {
437
+ return;
438
+ }
439
+
440
+ ${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value;
441
+ `;
442
+ }
443
+ }),
444
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
445
+ get when() {
446
+ return arg.type === "boolean";
447
+ },
448
+ get children() {
449
+ return _alloy_js_core.code`
450
+ const value = await toggle({
451
+ message: \`Please select a value for the \${italic("${arg.name}")} argument\`,
452
+ ${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
453
+ ` : ""}
454
+ });
455
+ if (isCancel(value)) {
456
+ return;
457
+ }
458
+
459
+ ${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value;
460
+ `;
461
+ }
462
+ })
463
+ ];
464
+ } });
465
+ }
466
+ });
467
+ }
468
+ }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
469
+ get when() {
470
+ return arg.variadic;
471
+ },
472
+ get children() {
473
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
474
+ get condition() {
475
+ return _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(arg.name)}.length === 0`;
476
+ },
477
+ get children() {
478
+ return _alloy_js_core.code`
479
+ const value = await text({
480
+ message: \`Please provide one or more${arg.type === "number" ? " numeric" : ""} values for the \${italic("${arg.name}")} argument (values are separated by a \\",\\" character)\`,
481
+ ${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
482
+ ` : ""}validate(val) {
483
+ if (!val || val.trim() === "") {
484
+ return "A value must be provided for this argument";
485
+ }
486
+ if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
487
+ return "At least one value must be provided for this argument";
488
+ }
489
+ ${arg.type === "number" ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
490
+ if (invalidIndex !== -1) {
491
+ return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
492
+ } ` : ""}
493
+
494
+ return undefined;
495
+ }
496
+ });
497
+ if (isCancel(value)) {
498
+ return;
499
+ }
500
+
501
+ ${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value.split(",").map(value => value.trim()).filter(Boolean)${arg.type === "number" ? `.map(Number)` : arg.type === "boolean" ? `.map(Boolean)` : ""} ;
502
+ `;
503
+ }
504
+ });
505
+ }
506
+ })];
507
+ }
508
+ })]
509
+ }),
510
+ _alloy_js_core.code`writeLine(""); `,
511
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
512
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_command_validation_logic.CommandValidationLogic, { command }),
513
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
514
+ condition: _alloy_js_core.code`failures.length > 0`,
515
+ get children() {
516
+ return _alloy_js_core.code`error(\`The following validation failures were found while processing the user provided input, and must be corrected before the \${italic("${command.title}")} command can be executed: \\n\\n\${failures.map(failure => " - " + failure).join("\\n")}\`);
517
+ options.help = true; `;
518
+ }
519
+ })
520
+ ];
521
+ }
522
+ });
523
+ }
524
+ })];
525
+ }
526
+ })];
527
+ }
528
+ })), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
529
+ get each() {
530
+ return Object.values(command.children);
531
+ },
532
+ children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
533
+ get when() {
534
+ return child.virtual;
535
+ },
536
+ get fallback() {
537
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(CommandEntry, { command: child });
538
+ },
539
+ get children() {
540
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(VirtualCommandEntry, { command: child });
541
+ }
542
+ })
543
+ })];
544
+ }
545
+
546
+ //#endregion
547
+ Object.defineProperty(exports, 'CommandEntry', {
548
+ enumerable: true,
549
+ get: function () {
550
+ return CommandEntry;
551
+ }
552
+ });
553
+ Object.defineProperty(exports, 'VirtualCommandEntry', {
554
+ enumerable: true,
555
+ get: function () {
556
+ return VirtualCommandEntry;
557
+ }
558
+ });
@@ -1,22 +1,47 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) {
14
+ __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ }
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+
28
+ //#endregion
29
+ let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
30
+ let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
3
31
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
4
32
  let _alloy_js_core = require("@alloy-js/core");
5
33
  let _alloy_js_typescript = require("@alloy-js/typescript");
6
- let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
7
- let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
8
- let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
9
- let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
34
+ let _power_plant_alloy_js_core_components_spacing = require("@power-plant/alloy-js/core/components/spacing");
35
+ let _shell_shock_core_contexts_power_plant = require("@shell-shock/core/contexts/power-plant");
10
36
  let _shell_shock_plugin_banner_components_banner_builtin = require("@shell-shock/plugin-banner/components/banner-builtin");
11
37
  let _shell_shock_plugin_banner_components_banner_function_declaration = require("@shell-shock/plugin-banner/components/banner-function-declaration");
12
38
  let _shell_shock_plugin_theme_contexts_theme = require("@shell-shock/plugin-theme/contexts/theme");
13
39
  let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
14
40
  let defu = require("defu");
15
- defu = require_runtime.__toESM(defu, 1);
16
41
  let figlet = require("figlet");
17
- figlet = require_runtime.__toESM(figlet, 1);
42
+ figlet = __toESM(figlet, 1);
18
43
  let strip_ansi = require("strip-ansi");
19
- strip_ansi = require_runtime.__toESM(strip_ansi, 1);
44
+ strip_ansi = __toESM(strip_ansi, 1);
20
45
 
21
46
  //#region src/components/banner-builtin.tsx
22
47
  /**
@@ -25,7 +50,7 @@ strip_ansi = require_runtime.__toESM(strip_ansi, 1);
25
50
  function BannerFunctionBodyDeclaration(props) {
26
51
  const { consoleFnName = "log", variant = "primary", command } = props;
27
52
  const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
28
- const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
53
+ const context = (0, _shell_shock_core_contexts_power_plant.usePowerlines)();
29
54
  const header = (0, _alloy_js_core.computed)(() => `${theme.labels.banner.header[variant] || (0, _shell_shock_core_plugin_utils.getAppTitle)(context)} v${context.packageJson.version || "1.0.0"}`);
30
55
  const footer = (0, _alloy_js_core.computed)(() => theme.labels.banner.footer[variant]);
31
56
  const title = (0, _alloy_js_core.computed)(() => (0, _shell_shock_core_plugin_utils.getAppTitle)(context, true).replace(`v${context.packageJson.version || "1.0.0"}`, ""));
@@ -68,9 +93,9 @@ function BannerFunctionBodyDeclaration(props) {
68
93
  */
69
94
  function BannerBuiltin(props) {
70
95
  const [{ command, children }, rest] = (0, _alloy_js_core.splitProps)(props, ["command", "children"]);
71
- const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
96
+ const context = (0, _shell_shock_core_contexts_power_plant.usePowerlines)();
72
97
  const titleLines = (0, _alloy_js_core.computed)(() => {
73
- const result = figlet.default.textSync((0, _stryke_type_checks_is_set_object.isSetObject)(context.config.banner) && (0, _stryke_type_checks_is_set_string.isSetString)(context.config.banner.override) ? context.config.banner.override : (0, _stryke_type_checks_is_set_string.isSetString)(context.config.banner) ? context.config.banner : (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.banner) && (0, _stryke_type_checks_is_set_string.isSetString)(context.config.banner.text) ? context.config.banner.text : (0, _shell_shock_core_plugin_utils.getAppTitle)(context, true), (0, defu.default)((0, _stryke_type_checks_is_set_object.isSetObject)(context.config.banner) ? context.config.banner : {}, { font: "ANSI Compact" }));
98
+ const result = figlet.default.textSync((0, _stryke_type_checks_is_set_object.isSetObject)(context.config.banner) && (0, _stryke_type_checks_is_set_string.isSetString)(context.config.banner.override) ? context.config.banner.override : (0, _stryke_type_checks_is_set_string.isSetString)(context.config.banner) ? context.config.banner : (0, _shell_shock_core_plugin_utils.getAppTitle)(context, true), (0, defu.defu)((0, _stryke_type_checks_is_set_object.isSetObject)(context.config.banner) ? context.config.banner : {}, { font: "ANSI Compact" }));
74
99
  if (!result) return [`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} Command-Line Interface`];
75
100
  const lines = result.trim().split("\n");
76
101
  const maxLength = Math.max(...lines.map((line) => (0, strip_ansi.default)(line).length));
@@ -83,7 +108,7 @@ function BannerBuiltin(props) {
83
108
  });
84
109
  return (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_plugin_banner_components_banner_builtin.BannerBuiltin, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
85
110
  get builtinImports() {
86
- return (0, _alloy_js_core_jsx_runtime.memo)(() => !!command?.path)() ? (0, defu.default)(rest.builtinImports ?? {}, { banner: ["TITLE_LINES"] }) : rest.builtinImports;
111
+ return (0, _alloy_js_core_jsx_runtime.memo)(() => !!command?.path)() ? (0, defu.defu)(rest.builtinImports ?? {}, { banner: ["TITLE_LINES"] }) : rest.builtinImports;
87
112
  },
88
113
  command,
89
114
  get children() {
@@ -99,14 +124,14 @@ function BannerBuiltin(props) {
99
124
  get initializer() {
100
125
  return _alloy_js_core.code` [${titleLines.value.map((line) => JSON.stringify(line)).join(", ")}];`;
101
126
  }
102
- }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})];
127
+ }), (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {})];
103
128
  }
104
129
  }), (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_plugin_banner_components_banner_function_declaration.BannerFunctionDeclarationWrapper, {
105
130
  command,
106
131
  get children() {
107
132
  return [
108
133
  (0, _alloy_js_core_jsx_runtime.createComponent)(BannerFunctionBodyDeclaration, { command }),
109
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
134
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
110
135
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
111
136
  get when() {
112
137
  return Boolean(children);
@@ -1,7 +1,6 @@
1
- import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
2
1
  import { CommandTree } from "@shell-shock/core";
2
+ import { BuiltinFileProps } from "@shell-shock/core/contexts/power-plant";
3
3
  import { BannerFunctionBodyDeclarationProps } from "@shell-shock/plugin-banner/components/banner-function-declaration";
4
-
5
4
  //#region src/components/banner-builtin.d.ts
6
5
  /**
7
6
  * A component to generate the `banner` function in the `shell-shock:console` builtin module.