@shell-shock/preset-cli 0.7.12 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/components/banner-function-declaration.cjs +15 -15
  2. package/dist/components/banner-function-declaration.d.cts +2 -2
  3. package/dist/components/banner-function-declaration.d.mts +2 -2
  4. package/dist/components/banner-function-declaration.mjs +1 -1
  5. package/dist/components/banner-function-declaration.mjs.map +1 -1
  6. package/dist/components/command-entry.cjs +128 -89
  7. package/dist/components/command-entry.d.cts +3 -3
  8. package/dist/components/command-entry.d.cts.map +1 -1
  9. package/dist/components/command-entry.d.mts +3 -3
  10. package/dist/components/command-entry.d.mts.map +1 -1
  11. package/dist/components/command-entry.mjs +127 -88
  12. package/dist/components/command-entry.mjs.map +1 -1
  13. package/dist/components/command-router.cjs +5 -4
  14. package/dist/components/command-router.d.cts +5 -5
  15. package/dist/components/command-router.d.cts.map +1 -1
  16. package/dist/components/command-router.d.mts +2 -2
  17. package/dist/components/command-router.d.mts.map +1 -1
  18. package/dist/components/command-router.mjs +3 -2
  19. package/dist/components/command-router.mjs.map +1 -1
  20. package/dist/components/virtual-command-entry.cjs +2 -2
  21. package/dist/components/virtual-command-entry.d.cts +3 -3
  22. package/dist/components/virtual-command-entry.d.mts +3 -3
  23. package/dist/components/virtual-command-entry.mjs +1 -1
  24. package/dist/components/virtual-command-entry.mjs.map +1 -1
  25. package/dist/helpers/get-default-options.cjs +3 -3
  26. package/dist/helpers/get-default-options.mjs +3 -3
  27. package/dist/helpers/get-default-options.mjs.map +1 -1
  28. package/dist/types/plugin.d.cts +1 -2
  29. package/dist/types/plugin.d.cts.map +1 -1
  30. package/dist/types/plugin.d.mts +1 -2
  31. package/dist/types/plugin.d.mts.map +1 -1
  32. package/package.json +14 -14
@@ -1,6 +1,6 @@
1
- import * as _alloy_js_core1 from "@alloy-js/core";
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
2
  import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
3
- import { CommandTree } from "@shell-shock/core/types/command";
3
+ import { CommandTree } from "@shell-shock/core";
4
4
 
5
5
  //#region src/components/command-entry.d.ts
6
6
  interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
@@ -9,7 +9,7 @@ interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinitio
9
9
  /**
10
10
  * The command entry point for the Shell Shock project.
11
11
  */
12
- declare function CommandEntry(props: CommandEntryProps): _alloy_js_core1.Children;
12
+ declare function CommandEntry(props: CommandEntryProps): _alloy_js_core0.Children;
13
13
  //#endregion
14
14
  export { CommandEntry, CommandEntryProps };
15
15
  //# sourceMappingURL=command-entry.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAyCiB,iBAAA,SAA0B,KACzC;WAGS;;AAJX;;;AAA2C,iBAU3B,YAAA,CAV2B,KAAA,EAUP,iBAVO,CAAA,EAUU,eAAA,CAAA,QAVV"}
1
+ {"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAiDiB,iBAAA,SAA0B,KACzC;WAGS;;AAJX;;;AAA2C,iBAU3B,YAAA,CAV2B,KAAA,EAUP,iBAVO,CAAA,EAUU,eAAA,CAAA,QAVV"}
@@ -1,6 +1,6 @@
1
- import * as _alloy_js_core2 from "@alloy-js/core";
1
+ import * as _alloy_js_core3 from "@alloy-js/core";
2
2
  import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
3
- import { CommandTree } from "@shell-shock/core/types/command";
3
+ import { CommandTree } from "@shell-shock/core";
4
4
 
5
5
  //#region src/components/command-entry.d.ts
6
6
  interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
@@ -9,7 +9,7 @@ interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinitio
9
9
  /**
10
10
  * The command entry point for the Shell Shock project.
11
11
  */
12
- declare function CommandEntry(props: CommandEntryProps): _alloy_js_core2.Children;
12
+ declare function CommandEntry(props: CommandEntryProps): _alloy_js_core3.Children;
13
13
  //#endregion
14
14
  export { CommandEntry, CommandEntryProps };
15
15
  //# sourceMappingURL=command-entry.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAyCiB,iBAAA,SAA0B,KACzC;WAGS;;AAJX;;;AAA2C,iBAU3B,YAAA,CAV2B,KAAA,EAUP,iBAVO,CAAA,EAUU,eAAA,CAAA,QAVV"}
1
+ {"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAiDiB,iBAAA,SAA0B,KACzC;WAGS;;AAJX;;;AAA2C,iBAU3B,YAAA,CAV2B,KAAA,EAUP,iBAVO,CAAA,EAUU,eAAA,CAAA,QAVV"}
@@ -5,9 +5,9 @@ import { For, Match, Show, Switch, code, computed } from "@alloy-js/core";
5
5
  import { ElseIfClause, IfStatement } from "@alloy-js/typescript";
6
6
  import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
7
7
  import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
8
- import { isDynamicPathSegment } from "@shell-shock/core/plugin-utils/context-helpers";
9
- import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
8
+ import { formatDescription, formatShortDescription, isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
10
9
  import { EntryFile } from "@powerlines/plugin-alloy/typescript/components/entry-file";
10
+ import { CommandParameterKinds } from "@shell-shock/core";
11
11
  import { CommandHandlerDeclaration, CommandValidationLogic } from "@shell-shock/preset-script/components/command-entry";
12
12
  import { findFilePath, relativePath } from "@stryke/path/find";
13
13
  import { joinPaths } from "@stryke/path/join";
@@ -24,7 +24,7 @@ function CommandEntry(props) {
24
24
  const { command, imports, builtinImports, ...rest } = props;
25
25
  const context = usePowerlines();
26
26
  const filePath = computed(() => joinPaths(command.segments.filter((segment) => !isDynamicPathSegment(segment)).join("/"), "index.ts"));
27
- const commandSourcePath = computed(() => replaceExtension(relativePath(joinPaths(context.entryPath, findFilePath(filePath.value)), command.entry.input?.file || command.entry.file)));
27
+ const commandSourcePath = computed(() => `./${replaceExtension(relativePath(joinPaths(context.entryPath, findFilePath(filePath.value)), command.entry.input?.file || command.entry.file))}`);
28
28
  const typeDefinition = computed(() => ({
29
29
  ...command.entry,
30
30
  output: command.id
@@ -107,12 +107,12 @@ function CommandEntry(props) {
107
107
  }
108
108
  }), createComponent(Show, {
109
109
  get when() {
110
- return Object.values(command.options ?? {}).filter((option) => !option.optional).length > 0 || Object.values(command.arguments ?? {}).filter((argument) => !argument.optional).length > 0;
110
+ return Object.values(command.options ?? {}).filter((option) => !option.optional).length > 0 || Object.values(command.args ?? {}).filter((arg) => !arg.optional).length > 0;
111
111
  },
112
112
  get children() {
113
113
  return createComponent(ElseIfClause, {
114
114
  get condition() {
115
- return code`!isHelp && (${Object.values(command.options ?? {}).filter((option) => !option.optional).map((option) => (option.kind === ReflectionKind.string || option.kind === ReflectionKind.number) && option.variadic ? `(!options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} || options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}.length === 0)` : `options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} === undefined`).join(" || ")}${Object.values(command.options ?? {}).filter((option) => !option.optional).length > 0 && Object.values(command.arguments ?? {}).filter((argument) => !argument.optional).length > 0 ? " || " : ""}${Object.values(command.arguments ?? {}).filter((argument) => !argument.optional).map((argument) => (argument.kind === ReflectionKind.string || argument.kind === ReflectionKind.number) && argument.variadic ? `(!${camelCase(argument.name)} || ${camelCase(argument.name)}.length === 0)` : `${camelCase(argument.name)} === undefined`).join(" || ")}) `;
115
+ return code`!isHelp && (${Object.values(command.options ?? {}).filter((option) => !option.optional).map((option) => (option.kind === CommandParameterKinds.string || option.kind === CommandParameterKinds.number) && option.variadic ? `(!options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} || options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}.length === 0)` : `options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} === undefined`).join(" || ")}${Object.values(command.options ?? {}).filter((option) => !option.optional).length > 0 && Object.values(command.args ?? {}).filter((arg) => !arg.optional).length > 0 ? " || " : ""}${Object.values(command.args ?? {}).filter((arg) => !arg.optional).map((arg) => (arg.kind === CommandParameterKinds.string || arg.kind === CommandParameterKinds.number) && arg.variadic ? `(!${camelCase(arg.name)} || ${camelCase(arg.name)}.length === 0)` : `${camelCase(arg.name)} === undefined`).join(" || ")}) `;
116
116
  },
117
117
  get children() {
118
118
  return [
@@ -133,17 +133,34 @@ function CommandEntry(props) {
133
133
  return code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}`;
134
134
  },
135
135
  get children() {
136
- return createComponent(Switch, { get children() {
137
- return [
138
- createComponent(Match, {
139
- get when() {
140
- return option.kind === ReflectionKind.string;
141
- },
142
- get children() {
143
- return code`
136
+ return createComponent(Show, {
137
+ get when() {
138
+ return option.kind === CommandParameterKinds.boolean || !option.choices || option.choices.length === 0;
139
+ },
140
+ get fallback() {
141
+ return code`const value = await select({
142
+ message: \`Please select a value for the \${colors.italic("${option.name}")} option\`, ${option.description ? `description: \`${formatDescription(option.description)}\`,
143
+ ` : ""}options: [ ${option.choices?.map((choice) => `{ value: ${JSON.stringify(choice)}, label: "${choice}", ${option.description ? `description: \`${formatShortDescription(option.description)}\`` : ""} }`).join(", ")} ]
144
+ });
145
+ if (isCancel(value)) {
146
+ return;
147
+ }
148
+
149
+ options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} = value;
150
+ `;
151
+ },
152
+ get children() {
153
+ return createComponent(Switch, { get children() {
154
+ return [
155
+ createComponent(Match, {
156
+ get when() {
157
+ return option.kind === CommandParameterKinds.string;
158
+ },
159
+ get children() {
160
+ return code`
144
161
  const value = await text({
145
162
  message: \`Please provide a value for the \${colors.italic("${option.name}")} option\`,
146
- ${option.description ? `description: "${option.description}",
163
+ ${option.description ? `description: \`${formatDescription(option.description)}\`,
147
164
  ` : ""}validate(val) {
148
165
  if (!val || val.trim() === "") {
149
166
  return "A value must be provided for this option";
@@ -158,17 +175,17 @@ function CommandEntry(props) {
158
175
 
159
176
  options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} = value;
160
177
  `;
161
- }
162
- }),
163
- createComponent(Match, {
164
- get when() {
165
- return option.kind === ReflectionKind.number;
166
- },
167
- get children() {
168
- return code`
178
+ }
179
+ }),
180
+ createComponent(Match, {
181
+ get when() {
182
+ return option.kind === CommandParameterKinds.number;
183
+ },
184
+ get children() {
185
+ return code`
169
186
  const value = await numeric({
170
187
  message: \`Please provide a numeric value for the \${colors.italic("${option.name}")} option\`,
171
- ${option.description ? `description: "${option.description}",
188
+ ${option.description ? `description: \`${formatDescription(option.description)}\`,
172
189
  ` : ""}
173
190
  });
174
191
  if (isCancel(value)) {
@@ -177,17 +194,17 @@ function CommandEntry(props) {
177
194
 
178
195
  options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} = value;
179
196
  `;
180
- }
181
- }),
182
- createComponent(Match, {
183
- get when() {
184
- return option.kind === ReflectionKind.boolean;
185
- },
186
- get children() {
187
- return code`
197
+ }
198
+ }),
199
+ createComponent(Match, {
200
+ get when() {
201
+ return option.kind === CommandParameterKinds.boolean;
202
+ },
203
+ get children() {
204
+ return code`
188
205
  const value = await toggle({
189
206
  message: \`Please select a value for the \${colors.italic("${option.name}")} option\`,
190
- ${option.description ? `description: "${option.description}",
207
+ ${option.description ? `description: \`${formatDescription(option.description)}\`,
191
208
  ` : ""}
192
209
  });
193
210
  if (isCancel(value)) {
@@ -196,14 +213,16 @@ function CommandEntry(props) {
196
213
 
197
214
  options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} = value;
198
215
  `;
199
- }
200
- })
201
- ];
202
- } });
216
+ }
217
+ })
218
+ ];
219
+ } });
220
+ }
221
+ });
203
222
  }
204
223
  }), createComponent(Show, {
205
224
  get when() {
206
- return (option.kind === ReflectionKind.string || option.kind === ReflectionKind.number) && option.variadic;
225
+ return (option.kind === CommandParameterKinds.string || option.kind === CommandParameterKinds.number) && option.variadic;
207
226
  },
208
227
  get children() {
209
228
  return createComponent(ElseIfClause, {
@@ -213,8 +232,8 @@ function CommandEntry(props) {
213
232
  get children() {
214
233
  return code`
215
234
  const value = await text({
216
- message: \`Please provide one or more${option.kind === ReflectionKind.number ? " numeric" : ""} values for the \${colors.italic("${option.name}")} option (values are separated by a \\",\\" character)\`,
217
- ${option.description ? `description: "${option.description}",
235
+ message: \`Please provide one or more${option.kind === CommandParameterKinds.number ? " numeric" : ""} values for the \${colors.italic("${option.name}")} option (values are separated by a \\",\\" character)\`,
236
+ ${option.description ? `description: \`${formatDescription(option.description)}\`,
218
237
  ` : ""}validate(val) {
219
238
  if (!val || val.trim() === "") {
220
239
  return "A value must be provided for this option";
@@ -222,7 +241,7 @@ function CommandEntry(props) {
222
241
  if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
223
242
  return "At least one value must be provided for this option";
224
243
  }
225
- ${option.kind === ReflectionKind.number ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
244
+ ${option.kind === CommandParameterKinds.number ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
226
245
  if (invalidIndex !== -1) {
227
246
  return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
228
247
  } ` : ""}
@@ -233,7 +252,7 @@ function CommandEntry(props) {
233
252
  return;
234
253
  }
235
254
 
236
- options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} = value.split(",").map(value => value.trim()).filter(Boolean)${option.kind === ReflectionKind.number ? `.map(Number)` : ""} ;
255
+ options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} = value.split(",").map(value => value.trim()).filter(Boolean)${option.kind === CommandParameterKinds.number ? `.map(Number)` : ""} ;
237
256
  `;
238
257
  }
239
258
  });
@@ -245,30 +264,48 @@ function CommandEntry(props) {
245
264
  createComponent(Spacing, {}),
246
265
  createComponent(For, {
247
266
  get each() {
248
- return command.arguments;
267
+ return command.args;
249
268
  },
250
269
  doubleHardline: true,
251
- children: (argument) => [createComponent(Show, {
270
+ children: (arg) => [createComponent(Show, {
252
271
  get when() {
253
- return !argument.optional;
272
+ return !arg.optional;
254
273
  },
255
274
  get children() {
256
275
  return [createComponent(IfStatement, {
257
276
  get condition() {
258
- return code`!${camelCase(argument.name)}`;
277
+ return code`!${camelCase(arg.name)}`;
259
278
  },
260
279
  get children() {
261
- return createComponent(Switch, { get children() {
262
- return [
263
- createComponent(Match, {
264
- get when() {
265
- return argument.kind === ReflectionKind.string;
266
- },
267
- get children() {
268
- return code`
280
+ return createComponent(Show, {
281
+ get when() {
282
+ return arg.kind === CommandParameterKinds.boolean || !arg.choices || arg.choices.length === 0;
283
+ },
284
+ get fallback() {
285
+ return code`const value = await select({
286
+ message: \`Please select a value for the \${colors.italic("${arg.name}")} argument\`,${arg.description ? `description: \`${formatDescription(arg.description)}\`,
287
+ ` : ""}
288
+ options: [ ${arg.choices?.map((choice) => `{ value: ${JSON.stringify(choice)}, label: "${choice}", ${arg.description ? `description: \`${formatShortDescription(arg.description)}\`` : ""} }`).join(", ")} ]
289
+ });
290
+ if (isCancel(value)) {
291
+ return;
292
+ }
293
+
294
+ ${camelCase(arg.name)} = value;
295
+ `;
296
+ },
297
+ get children() {
298
+ return createComponent(Switch, { get children() {
299
+ return [
300
+ createComponent(Match, {
301
+ get when() {
302
+ return arg.kind === CommandParameterKinds.string;
303
+ },
304
+ get children() {
305
+ return code`
269
306
  const value = await text({
270
- message: \`Please provide a value for the \${colors.italic("${argument.name}")} argument\`,
271
- ${argument.description ? `description: "${argument.description}",
307
+ message: \`Please provide a value for the \${colors.italic("${arg.name}")} argument\`,
308
+ ${arg.description ? `description: \`${formatShortDescription(arg.description)}\`,
272
309
  ` : ""}validate(val) {
273
310
  if (!val || val.trim() === "") {
274
311
  return "A value must be provided for this argument";
@@ -281,65 +318,67 @@ function CommandEntry(props) {
281
318
  return;
282
319
  }
283
320
 
284
- ${camelCase(argument.name)} = value;
321
+ ${camelCase(arg.name)} = value;
285
322
  `;
286
- }
287
- }),
288
- createComponent(Match, {
289
- get when() {
290
- return argument.kind === ReflectionKind.number;
291
- },
292
- get children() {
293
- return code`
323
+ }
324
+ }),
325
+ createComponent(Match, {
326
+ get when() {
327
+ return arg.kind === CommandParameterKinds.number;
328
+ },
329
+ get children() {
330
+ return code`
294
331
  const value = await numeric({
295
- message: \`Please provide a numeric value for the \${colors.italic("${argument.name}")} argument\`,
296
- ${argument.description ? `description: "${argument.description}",
332
+ message: \`Please provide a numeric value for the \${colors.italic("${arg.name}")} argument\`,
333
+ ${arg.description ? `description: \`${formatShortDescription(arg.description)}\`,
297
334
  ` : ""}
298
335
  });
299
336
  if (isCancel(value)) {
300
337
  return;
301
338
  }
302
339
 
303
- ${camelCase(argument.name)} = value;
340
+ ${camelCase(arg.name)} = value;
304
341
  `;
305
- }
306
- }),
307
- createComponent(Match, {
308
- get when() {
309
- return argument.kind === ReflectionKind.boolean;
310
- },
311
- get children() {
312
- return code`
342
+ }
343
+ }),
344
+ createComponent(Match, {
345
+ get when() {
346
+ return arg.kind === CommandParameterKinds.boolean;
347
+ },
348
+ get children() {
349
+ return code`
313
350
  const value = await toggle({
314
- message: \`Please select a value for the \${colors.italic("${argument.name}")} argument\`,
315
- ${argument.description ? `description: "${argument.description}",
351
+ message: \`Please select a value for the \${colors.italic("${arg.name}")} argument\`,
352
+ ${arg.description ? `description: \`${formatShortDescription(arg.description)}\`,
316
353
  ` : ""}
317
354
  });
318
355
  if (isCancel(value)) {
319
356
  return;
320
357
  }
321
358
 
322
- ${camelCase(argument.name)} = value;
359
+ ${camelCase(arg.name)} = value;
323
360
  `;
324
- }
325
- })
326
- ];
327
- } });
361
+ }
362
+ })
363
+ ];
364
+ } });
365
+ }
366
+ });
328
367
  }
329
368
  }), createComponent(Show, {
330
369
  get when() {
331
- return (argument.kind === ReflectionKind.string || argument.kind === ReflectionKind.number) && argument.variadic;
370
+ return (arg.kind === CommandParameterKinds.string || arg.kind === CommandParameterKinds.number) && arg.variadic;
332
371
  },
333
372
  get children() {
334
373
  return createComponent(ElseIfClause, {
335
374
  get condition() {
336
- return code`${camelCase(argument.name)}.length === 0`;
375
+ return code`${camelCase(arg.name)}.length === 0`;
337
376
  },
338
377
  get children() {
339
378
  return code`
340
379
  const value = await text({
341
- message: \`Please provide one or more${argument.kind === ReflectionKind.number ? " numeric" : ""} values for the \${colors.italic("${argument.name}")} argument (values are separated by a \\",\\" character)\`,
342
- ${argument.description ? `description: "${argument.description}",
380
+ message: \`Please provide one or more${arg.kind === CommandParameterKinds.number ? " numeric" : ""} values for the \${colors.italic("${arg.name}")} argument (values are separated by a \\",\\" character)\`,
381
+ ${arg.description ? `description: \`${formatShortDescription(arg.description)}\`,
343
382
  ` : ""}validate(val) {
344
383
  if (!val || val.trim() === "") {
345
384
  return "A value must be provided for this argument";
@@ -347,7 +386,7 @@ function CommandEntry(props) {
347
386
  if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
348
387
  return "At least one value must be provided for this argument";
349
388
  }
350
- ${argument.kind === ReflectionKind.number ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
389
+ ${arg.kind === CommandParameterKinds.number ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
351
390
  if (invalidIndex !== -1) {
352
391
  return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
353
392
  } ` : ""}
@@ -359,7 +398,7 @@ function CommandEntry(props) {
359
398
  return;
360
399
  }
361
400
 
362
- ${camelCase(argument.name)} = value.split(",").map(value => value.trim()).filter(Boolean)${argument.kind === ReflectionKind.number ? `.map(Number)` : ""} ;
401
+ ${camelCase(arg.name)} = value.split(",").map(value => value.trim()).filter(Boolean)${arg.kind === CommandParameterKinds.number ? `.map(Number)` : ""} ;
363
402
  `;
364
403
  }
365
404
  });
@@ -1 +1 @@
1
- {"version":3,"file":"command-entry.mjs","names":["code","computed","For","Match","Show","Switch","ElseIfClause","IfStatement","ReflectionKind","Spacing","usePowerlines","EntryFile","isDynamicPathSegment","CommandHandlerDeclaration","CommandValidationLogic","findFilePath","relativePath","joinPaths","replaceExtension","camelCase","pascalCase","defu","BannerFunctionDeclaration","VirtualCommandEntry","CommandEntry","props","command","imports","builtinImports","rest","context","filePath","segments","filter","segment","join","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$createComponent","_$mergeProps","path","name","prompts","env","console","utils","upgrade","children","_$createIntrinsic","banner","condition","when","Object","values","options","option","optional","length","arguments","argument","map","kind","string","number","variadic","includes","each","doubleHardline","description","boolean","child","isVirtual","fallback"],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, For, Match, Show, Switch } from \"@alloy-js/core\";\nimport { ElseIfClause, IfStatement } from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { isDynamicPathSegment } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport {\n CommandHandlerDeclaration,\n CommandValidationLogic\n} from \"@shell-shock/preset-script/components/command-entry\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n const commandSourcePath = computed(() =>\n replaceExtension(\n relativePath(\n joinPaths(context.entryPath, findFilePath(filePath.value)),\n command.entry.input?.file || command.entry.file\n )\n )\n );\n const typeDefinition = computed(() => ({\n ...command.entry,\n output: command.id\n }));\n\n return (\n <>\n <EntryFile\n {...rest}\n path={filePath.value}\n typeDefinition={typeDefinition.value}\n imports={defu(imports ?? {}, {\n [commandSourcePath.value]: `handle${pascalCase(command.name)}`,\n prompts: \"prompts\"\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isDevelopment\", \"isDebug\", \"paths\"],\n console: [\n \"debug\",\n \"info\",\n \"help\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"cursor\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"createSpinner\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isInteractive\",\n \"isHelp\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ],\n prompts: [\n \"text\",\n \"numeric\",\n \"toggle\",\n \"select\",\n \"confirm\",\n \"waitForKeyPress\",\n \"isCancel\",\n \"sleep\"\n ],\n upgrade: [\"checkForUpdates\", \"isCheckForUpdatesRequired\", \"upgrade\"]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <CommandHandlerDeclaration\n command={command}\n banner={code`await banner(); `}>\n <IfStatement condition={code`!isInteractive`}>\n <CommandValidationLogic command={command} />\n </IfStatement>\n <Show\n when={\n Object.values(command.options ?? {}).filter(\n option => !option.optional\n ).length > 0 ||\n Object.values(command.arguments ?? {}).filter(\n argument => !argument.optional\n ).length > 0\n }>\n <ElseIfClause\n condition={code`!isHelp && (${Object.values(command.options ?? {})\n .filter(option => !option.optional)\n .map(option =>\n (option.kind === ReflectionKind.string ||\n option.kind === ReflectionKind.number) &&\n option.variadic\n ? `(!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } || options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0)`\n : `options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } === undefined`\n )\n .join(\" || \")}${\n Object.values(command.options ?? {}).filter(\n option => !option.optional\n ).length > 0 &&\n Object.values(command.arguments ?? {}).filter(\n argument => !argument.optional\n ).length > 0\n ? \" || \"\n : \"\"\n }${Object.values(command.arguments ?? {})\n .filter(argument => !argument.optional)\n .map(argument =>\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n ? `(!${camelCase(\n argument.name\n )} || ${camelCase(argument.name)}.length === 0)`\n : `${camelCase(argument.name)} === undefined`\n )\n .join(\" || \")}) `}>\n {code`writeLine(\"\"); `}\n <Spacing />\n <For each={Object.values(command.options ?? {})} doubleHardline>\n {option => (\n <>\n <Show when={!option.optional}>\n <IfStatement\n condition={code`!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }`}>\n <Switch>\n <Match\n when={option.kind === ReflectionKind.string}>{code`\n const value = await text({\n message: \\`Please provide a value for the \\${colors.italic(\"${option.name}\")} option\\`,\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this option\";\n }\n\n return null;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n <Match\n when={option.kind === ReflectionKind.number}>{code`\n const value = await numeric({\n message: \\`Please provide a numeric value for the \\${colors.italic(\"${option.name}\")} option\\`,\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n <Match\n when={option.kind === ReflectionKind.boolean}>{code`\n const value = await toggle({\n message: \\`Please select a value for the \\${colors.italic(\"${option.name}\")} option\\`,\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n </Switch>\n </IfStatement>\n <Show\n when={\n (option.kind === ReflectionKind.string ||\n option.kind === ReflectionKind.number) &&\n option.variadic\n }>\n <ElseIfClause\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0`}>\n {code`\n const value = await text({\n message: \\`Please provide one or more${\n option.kind === ReflectionKind.number\n ? \" numeric\"\n : \"\"\n } values for the \\${colors.italic(\"${option.name}\")} option (values are separated by a \\\\\",\\\\\" character)\\`,\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this option\";\n }\n if (val.split(\",\").map(v => v.trim()).filter(Boolean).length === 0) {\n return \"At least one value must be provided for this option\";\n }\n ${\n option.kind === ReflectionKind.number\n ? `const invalidIndex = val.split(\",\").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));\n if (invalidIndex !== -1) {\n return \\`Invalid numeric value provided for item #\\${invalidIndex + 1} - all provided items must be a valid number\\`;\n } `\n : \"\"\n }\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value.split(\",\").map(value => value.trim()).filter(Boolean)${\n option.kind === ReflectionKind.number\n ? `.map(Number)`\n : \"\"\n } ;\n `}\n </ElseIfClause>\n </Show>\n </Show>\n </>\n )}\n </For>\n <Spacing />\n <For each={command.arguments} doubleHardline>\n {argument => (\n <>\n <Show when={!argument.optional}>\n <IfStatement\n condition={code`!${camelCase(argument.name)}`}>\n <Switch>\n <Match\n when={\n argument.kind === ReflectionKind.string\n }>{code`\n const value = await text({\n message: \\`Please provide a value for the \\${colors.italic(\"${argument.name}\")} argument\\`,\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this argument\";\n }\n\n return null;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value;\n `}</Match>\n <Match\n when={\n argument.kind === ReflectionKind.number\n }>{code`\n const value = await numeric({\n message: \\`Please provide a numeric value for the \\${colors.italic(\"${argument.name}\")} argument\\`,\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value;\n `}</Match>\n <Match\n when={\n argument.kind === ReflectionKind.boolean\n }>{code`\n const value = await toggle({\n message: \\`Please select a value for the \\${colors.italic(\"${argument.name}\")} argument\\`,\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value;\n `}</Match>\n </Switch>\n </IfStatement>\n <Show\n when={\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n }>\n <ElseIfClause\n condition={code`${camelCase(argument.name)}.length === 0`}>\n {code`\n const value = await text({\n message: \\`Please provide one or more${\n argument.kind === ReflectionKind.number\n ? \" numeric\"\n : \"\"\n } values for the \\${colors.italic(\"${argument.name}\")} argument (values are separated by a \\\\\",\\\\\" character)\\`,\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this argument\";\n }\n if (val.split(\",\").map(v => v.trim()).filter(Boolean).length === 0) {\n return \"At least one value must be provided for this argument\";\n }\n ${\n argument.kind === ReflectionKind.number\n ? `const invalidIndex = val.split(\",\").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));\n if (invalidIndex !== -1) {\n return \\`Invalid numeric value provided for item #\\${invalidIndex + 1} - all provided items must be a valid number\\`;\n } `\n : \"\"\n }\n\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value.split(\",\").map(value => value.trim()).filter(Boolean)${\n argument.kind === ReflectionKind.number\n ? `.map(Number)`\n : \"\"\n } ;\n `}\n </ElseIfClause>\n </Show>\n </Show>\n </>\n )}\n </For>\n {code`writeLine(\"\"); `}\n <Spacing />\n </ElseIfClause>\n </Show>\n </CommandHandlerDeclaration>\n </EntryFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmDA,SAAgBwB,aAAaC,OAA0B;CACrD,MAAM,EAAEC,SAASC,SAASC,gBAAgB,GAAGC,SAASJ;CAEtD,MAAMK,UAAUpB,eAAiC;CACjD,MAAMqB,WAAW9B,eACfgB,UACES,QAAQM,SACLC,QAAOC,YAAW,CAACtB,qBAAqBsB,QAAQ,CAAC,CACjDC,KAAK,IAAI,EACZ,WAEJ,CAAC;CACD,MAAMC,oBAAoBnC,eACxBiB,iBACEF,aACEC,UAAUa,QAAQO,WAAWtB,aAAagB,SAASO,MAAM,CAAC,EAC1DZ,QAAQa,MAAMC,OAAOC,QAAQf,QAAQa,MAAME,KAE/C,CACF,CAAC;CACD,MAAMC,iBAAiBzC,gBAAgB;EACrC,GAAGyB,QAAQa;EACXI,QAAQjB,QAAQkB;EACjB,EAAE;AAEH,QAAA,CAAAC,gBAEKlC,WAASmC,WACJjB,MAAI;EAAA,IACRkB,OAAI;AAAA,UAAEhB,SAASO;;EAAK,IACpBI,iBAAc;AAAA,UAAEA,eAAeJ;;EAAK,IACpCX,UAAO;AAAA,UAAEN,KAAKM,WAAW,EAAE,EAAE;KAC1BS,kBAAkBE,QAAQ,SAASlB,WAAWM,QAAQsB,KAAK;IAC5DC,SAAS;IACV,CAAC;;EAAA,IACFrB,iBAAc;AAAA,UAAEP,KAAKO,kBAAkB,EAAE,EAAE;IACzCsB,KAAK;KAAC;KAAO;KAAiB;KAAW;KAAQ;IACjDC,SAAS;KACP;KACA;KACA;KACA;KACA;KACA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D,UAAU+C,SAASlB,KAAK,CAAA,gEACxBkB,SAASE,SAAS5D,eAAe8D,SAC7B,iBACA,GAAE;;;iBAET,CAAA;;eAAA,CAAA,CAAA;;aAAA,CAAA,CAAA;YAKV,CAAA;WAEFtE,IAAI;WAAiB6C,gBACrBpC,SAAO,EAAA,CAAA;WAAA;;SAAA,CAAA;;OAAA,CAAA,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAAoC,gBAKf3C,KAAG;EAAA,IAACuE,OAAI;AAAA,UAAEd,OAAOC,OAAOlC,QAAQ4B,SAAS;;EAAAA,WACvCuB,UAAKhC,gBACHzC,MAAI;GAAA,IACHsD,OAAI;AAAA,WAAEmB,MAAMC;;GAAS,IACrBC,WAAQ;AAAA,WAAAlC,gBAAGrB,cAAY,EAACE,SAASmD,OAAK,CAAA;;GAAA,IAAAvB,WAAA;AAAA,WAAAT,gBACrCtB,qBAAmB,EAACG,SAASmD,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
1
+ {"version":3,"file":"command-entry.mjs","names":["code","computed","For","Match","Show","Switch","ElseIfClause","IfStatement","Spacing","usePowerlines","EntryFile","CommandParameterKinds","formatDescription","formatShortDescription","isDynamicPathSegment","CommandHandlerDeclaration","CommandValidationLogic","findFilePath","relativePath","joinPaths","replaceExtension","camelCase","pascalCase","defu","BannerFunctionDeclaration","VirtualCommandEntry","CommandEntry","props","command","imports","builtinImports","rest","context","filePath","segments","filter","segment","join","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$createComponent","_$mergeProps","path","name","prompts","env","console","utils","upgrade","children","_$createIntrinsic","banner","condition","when","Object","values","options","option","optional","length","args","arg","map","kind","string","number","variadic","includes","each","doubleHardline","boolean","choices","fallback","description","choice","JSON","stringify","child","isVirtual"],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, For, Match, Show, Switch } from \"@alloy-js/core\";\nimport { ElseIfClause, IfStatement } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport type {\n CommandTree,\n NumberCommandParameter,\n StringCommandParameter\n} from \"@shell-shock/core\";\nimport { CommandParameterKinds } from \"@shell-shock/core\";\nimport {\n formatDescription,\n formatShortDescription,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport {\n CommandHandlerDeclaration,\n CommandValidationLogic\n} from \"@shell-shock/preset-script/components/command-entry\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n const commandSourcePath = computed(\n () =>\n `./${replaceExtension(\n relativePath(\n joinPaths(context.entryPath, findFilePath(filePath.value)),\n command.entry.input?.file || command.entry.file\n )\n )}`\n );\n const typeDefinition = computed(() => ({\n ...command.entry,\n output: command.id\n }));\n\n return (\n <>\n <EntryFile\n {...rest}\n path={filePath.value}\n typeDefinition={typeDefinition.value}\n imports={defu(imports ?? {}, {\n [commandSourcePath.value]: `handle${pascalCase(command.name)}`,\n prompts: \"prompts\"\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isDevelopment\", \"isDebug\", \"paths\"],\n console: [\n \"debug\",\n \"info\",\n \"help\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"cursor\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"createSpinner\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isInteractive\",\n \"isHelp\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ],\n prompts: [\n \"text\",\n \"numeric\",\n \"toggle\",\n \"select\",\n \"confirm\",\n \"waitForKeyPress\",\n \"isCancel\",\n \"sleep\"\n ],\n upgrade: [\"checkForUpdates\", \"isCheckForUpdatesRequired\", \"upgrade\"]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <CommandHandlerDeclaration\n command={command}\n banner={code`await banner(); `}>\n <IfStatement condition={code`!isInteractive`}>\n <CommandValidationLogic command={command} />\n </IfStatement>\n <Show\n when={\n Object.values(command.options ?? {}).filter(\n option => !option.optional\n ).length > 0 ||\n Object.values(command.args ?? {}).filter(arg => !arg.optional)\n .length > 0\n }>\n <ElseIfClause\n condition={code`!isHelp && (${Object.values(command.options ?? {})\n .filter(option => !option.optional)\n .map(option =>\n (option.kind === CommandParameterKinds.string ||\n option.kind === CommandParameterKinds.number) &&\n option.variadic\n ? `(!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } || options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0)`\n : `options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } === undefined`\n )\n .join(\" || \")}${\n Object.values(command.options ?? {}).filter(\n option => !option.optional\n ).length > 0 &&\n Object.values(command.args ?? {}).filter(arg => !arg.optional)\n .length > 0\n ? \" || \"\n : \"\"\n }${Object.values(command.args ?? {})\n .filter(arg => !arg.optional)\n .map(arg =>\n (arg.kind === CommandParameterKinds.string ||\n arg.kind === CommandParameterKinds.number) &&\n arg.variadic\n ? `(!${camelCase(\n arg.name\n )} || ${camelCase(arg.name)}.length === 0)`\n : `${camelCase(arg.name)} === undefined`\n )\n .join(\" || \")}) `}>\n {code`writeLine(\"\"); `}\n <Spacing />\n <For each={Object.values(command.options ?? {})} doubleHardline>\n {option => (\n <>\n <Show when={!option.optional}>\n <IfStatement\n condition={code`!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }`}>\n <Show\n when={\n option.kind === CommandParameterKinds.boolean ||\n !option.choices ||\n option.choices.length === 0\n }\n fallback={code`const value = await select({\n message: \\`Please select a value for the \\${colors.italic(\"${\n option.name\n }\")} option\\`, ${\n option.description\n ? `description: \\`${formatDescription(\n option.description\n )}\\`,\n `\n : \"\"\n }options: [ ${(\n option as\n | StringCommandParameter\n | NumberCommandParameter\n ).choices\n ?.map(\n choice =>\n `{ value: ${JSON.stringify(\n choice\n )}, label: \"${choice}\", ${\n option.description\n ? `description: \\`${formatShortDescription(\n option.description\n )}\\``\n : \"\"\n } }`\n )\n .join(\", \")} ]\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}>\n <Switch>\n <Match\n when={\n option.kind === CommandParameterKinds.string\n }>{code`\n const value = await text({\n message: \\`Please provide a value for the \\${colors.italic(\"${\n option.name\n }\")} option\\`,\n ${\n option.description\n ? `description: \\`${formatDescription(\n option.description\n )}\\`,\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this option\";\n }\n\n return null;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n <Match\n when={\n option.kind === CommandParameterKinds.number\n }>{code`\n const value = await numeric({\n message: \\`Please provide a numeric value for the \\${colors.italic(\"${option.name}\")} option\\`,\n ${\n option.description\n ? `description: \\`${formatDescription(\n option.description\n )}\\`,\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n <Match\n when={\n option.kind === CommandParameterKinds.boolean\n }>{code`\n const value = await toggle({\n message: \\`Please select a value for the \\${colors.italic(\"${option.name}\")} option\\`,\n ${\n option.description\n ? `description: \\`${formatDescription(\n option.description\n )}\\`,\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n </Switch>\n </Show>\n </IfStatement>\n <Show\n when={\n (option.kind === CommandParameterKinds.string ||\n option.kind === CommandParameterKinds.number) &&\n option.variadic\n }>\n <ElseIfClause\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0`}>\n {code`\n const value = await text({\n message: \\`Please provide one or more${\n option.kind === CommandParameterKinds.number\n ? \" numeric\"\n : \"\"\n } values for the \\${colors.italic(\"${\n option.name\n }\")} option (values are separated by a \\\\\",\\\\\" character)\\`,\n ${\n option.description\n ? `description: \\`${formatDescription(\n option.description\n )}\\`,\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this option\";\n }\n if (val.split(\",\").map(v => v.trim()).filter(Boolean).length === 0) {\n return \"At least one value must be provided for this option\";\n }\n ${\n option.kind === CommandParameterKinds.number\n ? `const invalidIndex = val.split(\",\").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));\n if (invalidIndex !== -1) {\n return \\`Invalid numeric value provided for item #\\${invalidIndex + 1} - all provided items must be a valid number\\`;\n } `\n : \"\"\n }\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value.split(\",\").map(value => value.trim()).filter(Boolean)${\n option.kind === CommandParameterKinds.number\n ? `.map(Number)`\n : \"\"\n } ;\n `}\n </ElseIfClause>\n </Show>\n </Show>\n </>\n )}\n </For>\n <Spacing />\n <For each={command.args} doubleHardline>\n {arg => (\n <>\n <Show when={!arg.optional}>\n <IfStatement condition={code`!${camelCase(arg.name)}`}>\n <Show\n when={\n arg.kind === CommandParameterKinds.boolean ||\n !arg.choices ||\n arg.choices.length === 0\n }\n fallback={code`const value = await select({\n message: \\`Please select a value for the \\${colors.italic(\"${\n arg.name\n }\")} argument\\`,${\n arg.description\n ? `description: \\`${formatDescription(\n arg.description\n )}\\`,\n `\n : \"\"\n }\n options: [ ${(\n arg as\n | StringCommandParameter\n | NumberCommandParameter\n ).choices\n ?.map(\n choice =>\n `{ value: ${JSON.stringify(\n choice\n )}, label: \"${choice}\", ${\n arg.description\n ? `description: \\`${formatShortDescription(\n arg.description\n )}\\``\n : \"\"\n } }`\n )\n .join(\", \")} ]\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(arg.name)} = value;\n `}>\n <Switch>\n <Match\n when={\n arg.kind === CommandParameterKinds.string\n }>{code`\n const value = await text({\n message: \\`Please provide a value for the \\${colors.italic(\"${arg.name}\")} argument\\`,\n ${\n arg.description\n ? `description: \\`${formatShortDescription(\n arg.description\n )}\\`,\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this argument\";\n }\n\n return null;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(arg.name)} = value;\n `}</Match>\n <Match\n when={\n arg.kind === CommandParameterKinds.number\n }>{code`\n const value = await numeric({\n message: \\`Please provide a numeric value for the \\${colors.italic(\"${arg.name}\")} argument\\`,\n ${\n arg.description\n ? `description: \\`${formatShortDescription(\n arg.description\n )}\\`,\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(arg.name)} = value;\n `}</Match>\n <Match\n when={\n arg.kind === CommandParameterKinds.boolean\n }>{code`\n const value = await toggle({\n message: \\`Please select a value for the \\${colors.italic(\"${arg.name}\")} argument\\`,\n ${\n arg.description\n ? `description: \\`${formatShortDescription(\n arg.description\n )}\\`,\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(arg.name)} = value;\n `}</Match>\n </Switch>\n </Show>\n </IfStatement>\n <Show\n when={\n (arg.kind === CommandParameterKinds.string ||\n arg.kind === CommandParameterKinds.number) &&\n arg.variadic\n }>\n <ElseIfClause\n condition={code`${camelCase(arg.name)}.length === 0`}>\n {code`\n const value = await text({\n message: \\`Please provide one or more${\n arg.kind === CommandParameterKinds.number\n ? \" numeric\"\n : \"\"\n } values for the \\${colors.italic(\"${arg.name}\")} argument (values are separated by a \\\\\",\\\\\" character)\\`,\n ${\n arg.description\n ? `description: \\`${formatShortDescription(\n arg.description\n )}\\`,\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this argument\";\n }\n if (val.split(\",\").map(v => v.trim()).filter(Boolean).length === 0) {\n return \"At least one value must be provided for this argument\";\n }\n ${\n arg.kind === CommandParameterKinds.number\n ? `const invalidIndex = val.split(\",\").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));\n if (invalidIndex !== -1) {\n return \\`Invalid numeric value provided for item #\\${invalidIndex + 1} - all provided items must be a valid number\\`;\n } `\n : \"\"\n }\n\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(arg.name)} = value.split(\",\").map(value => value.trim()).filter(Boolean)${\n arg.kind === CommandParameterKinds.number\n ? `.map(Number)`\n : \"\"\n } ;\n `}\n </ElseIfClause>\n </Show>\n </Show>\n </>\n )}\n </For>\n {code`writeLine(\"\"); `}\n <Spacing />\n </ElseIfClause>\n </Show>\n </CommandHandlerDeclaration>\n </EntryFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2DA,SAAgB0B,aAAaC,OAA0B;CACrD,MAAM,EAAEC,SAASC,SAASC,gBAAgB,GAAGC,SAASJ;CAEtD,MAAMK,UAAUvB,eAAiC;CACjD,MAAMwB,WAAWhC,eACfkB,UACES,QAAQM,SACLC,QAAOC,YAAW,CAACtB,qBAAqBsB,QAAQ,CAAC,CACjDC,KAAK,IAAI,EACZ,WAEJ,CAAC;CACD,MAAMC,oBAAoBrC,eAEtB,KAAKmB,iBACHF,aACEC,UAAUa,QAAQO,WAAWtB,aAAagB,SAASO,MAAM,CAAC,EAC1DZ,QAAQa,MAAMC,OAAOC,QAAQf,QAAQa,MAAME,KAE/C,CAAC,GACJ;CACD,MAAMC,iBAAiB3C,gBAAgB;EACrC,GAAG2B,QAAQa;EACXI,QAAQjB,QAAQkB;EACjB,EAAE;AAEH,QAAA,CAAAC,gBAEKrC,WAASsC,WACJjB,MAAI;EAAA,IACRkB,OAAI;AAAA,UAAEhB,SAASO;;EAAK,IACpBI,iBAAc;AAAA,UAAEA,eAAe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AAIK;;eAAQ,IAAAjB,WAAA;AAAA,uBAAAT,gBAEbzC,cAAY;iBAAA,IACXqD,YAAS;AAAA,yBAAE3D,IAAI,GAAGqB,UAAU+C,IAAIlB,KAAK,CAAA;;iBAAe,IAAAM,WAAA;AAAA,yBACnDxD,IAAI;;qEAGCoE,IAAIE,SAAS3D,sBAAsB6D,SAC/B,aACA,GAAE,oCAC6BJ,IAAIlB,KAAI;gCAE3CkB,IAAIY,cACA,kBAAkBnE,uBAChBuD,IAAIY,YACL,CAAA;kCAED,GAAE;;;;;;;kCASJZ,IAAIE,SAAS3D,sBAAsB6D,SAC/B;;;0CAIA,GAAE;;;;;;;;;8BAUVnD,UAAU+C,IAAIlB,KAAK,CAAA,gEACnBkB,IAAIE,SAAS3D,sBAAsB6D,SAC/B,iBACA,GAAE;;;iBAET,CAAA;;eAAA,CAAA,CAAA;;aAAA,CAAA,CAAA;YAKV,CAAA;WAEFxE,IAAI;WAAiB+C,gBACrBvC,SAAO,EAAA,CAAA;WAAA;;SAAA,CAAA;;OAAA,CAAA,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAAuC,gBAKf7C,KAAG;EAAA,IAACyE,OAAI;AAAA,UAAEd,OAAOC,OAAOlC,QAAQ4B,SAAS;;EAAAA,WACvC4B,UAAKrC,gBACH3C,MAAI;GAAA,IACHwD,OAAI;AAAA,WAAEwB,MAAMC;;GAAS,IACrBN,WAAQ;AAAA,WAAAhC,gBAAGrB,cAAY,EAACE,SAASwD,OAAK,CAAA;;GAAA,IAAA5B,WAAA;AAAA,WAAAT,gBACrCtB,qBAAmB,EAACG,SAASwD,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
@@ -3,7 +3,8 @@ let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
3
3
  let __alloy_js_core = require("@alloy-js/core");
4
4
  let __alloy_js_typescript = require("@alloy-js/typescript");
5
5
  let __powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
6
- let __shell_shock_preset_script_components_command_router = require("@shell-shock/preset-script/components/command-router");
6
+ let __shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
7
+ let __shell_shock_preset_script_components = require("@shell-shock/preset-script/components");
7
8
 
8
9
  //#region src/components/command-router.tsx
9
10
  function CommandRouterSelectOptions(props) {
@@ -16,7 +17,7 @@ function CommandRouterSelectOptions(props) {
16
17
  hardline: true,
17
18
  children: (command) => command.isVirtual ? (0, __alloy_js_core_jsx_runtime.createComponent)(CommandRouterSelectOptions, { get commands() {
18
19
  return command.children ?? {};
19
- } }) : __alloy_js_core.code`{ value: [${command.segments.map((segment) => `"${segment}"`).join(", ")}], label: "${command.title}", description: "${command.description}"${command.icon ? `, icon: "${command.icon}"` : ""} }`
20
+ } }) : __alloy_js_core.code`{ value: [${command.segments.map((segment) => `"${segment}"`).join(", ")}], label: "${command.title}", description: \`${(0, __shell_shock_core_plugin_utils.formatShortDescription)(command.description)}\`${command.icon ? `, icon: "${command.icon}"` : ""} }`
20
21
  });
21
22
  }
22
23
  /**
@@ -25,7 +26,7 @@ function CommandRouterSelectOptions(props) {
25
26
  function CommandRouter(props) {
26
27
  const { segments, commands } = props;
27
28
  return [
28
- (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_router.CommandRouter, (0, __alloy_js_core_jsx_runtime.mergeProps)(props, {
29
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components.CommandRouter, (0, __alloy_js_core_jsx_runtime.mergeProps)(props, {
29
30
  segments,
30
31
  commands
31
32
  })),
@@ -63,7 +64,7 @@ function CommandRouter(props) {
63
64
 
64
65
  command = segments[0];
65
66
  args = context.get("args"); `),
66
- (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_router.CommandRouterBody, (0, __alloy_js_core_jsx_runtime.mergeProps)(props, {
67
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components.CommandRouterBody, (0, __alloy_js_core_jsx_runtime.mergeProps)(props, {
67
68
  segments,
68
69
  commands
69
70
  }))