@shell-shock/preset-cli 0.4.1 → 0.5.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.
- package/README.md +1 -1
- package/dist/components/banner-function-declaration.cjs +1 -1
- package/dist/components/banner-function-declaration.d.cts +2 -2
- package/dist/components/banner-function-declaration.d.mts +2 -2
- package/dist/components/banner-function-declaration.d.mts.map +1 -1
- package/dist/components/banner-function-declaration.mjs +1 -1
- package/dist/components/banner-function-declaration.mjs.map +1 -1
- package/dist/components/command-entry.cjs +18 -11
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts +2 -2
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +18 -11
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.d.cts +3 -3
- package/dist/components/command-router.d.mts +3 -3
- package/dist/components/prompts-builtin.cjs +83 -65
- package/dist/components/prompts-builtin.d.cts +8 -8
- package/dist/components/prompts-builtin.d.cts.map +1 -1
- package/dist/components/prompts-builtin.d.mts.map +1 -1
- package/dist/components/prompts-builtin.mjs +83 -65
- package/dist/components/prompts-builtin.mjs.map +1 -1
- package/dist/components/virtual-command-entry.d.cts +2 -2
- package/dist/components/virtual-command-entry.d.mts +2 -2
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ This package is part of the ⚡<b>Shell Shock</b> monorepo. The Shell Shock pack
|
|
|
27
27
|
|
|
28
28
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
29
29
|
|
|
30
|
-
[](https://stormsoftware.com/projects/shell-shock/) [](http://commitizen.github.io/cz-cli/)  
|
|
31
31
|
|
|
32
32
|
<!-- prettier-ignore-start -->
|
|
33
33
|
<!-- markdownlint-disable -->
|
|
@@ -45,7 +45,7 @@ function BannerFunctionDeclaration(props) {
|
|
|
45
45
|
parameters: [{
|
|
46
46
|
name: "pause",
|
|
47
47
|
type: "number",
|
|
48
|
-
default:
|
|
48
|
+
default: 500
|
|
49
49
|
}],
|
|
50
50
|
get children() {
|
|
51
51
|
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_banner_function_declaration.BannerFunctionBodyDeclaration, {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core2 from "@alloy-js/core";
|
|
2
2
|
import { BannerFunctionDeclarationProps } from "@shell-shock/preset-script/components/banner-function-declaration";
|
|
3
3
|
|
|
4
4
|
//#region src/components/banner-function-declaration.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
7
7
|
*/
|
|
8
|
-
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps):
|
|
8
|
+
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core2.Children;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { BannerFunctionDeclaration };
|
|
11
11
|
//# sourceMappingURL=banner-function-declaration.d.cts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core9 from "@alloy-js/core";
|
|
2
2
|
import { BannerFunctionDeclarationProps } from "@shell-shock/preset-script/components/banner-function-declaration";
|
|
3
3
|
|
|
4
4
|
//#region src/components/banner-function-declaration.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
7
7
|
*/
|
|
8
|
-
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps):
|
|
8
|
+
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core9.Children;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { BannerFunctionDeclaration };
|
|
11
11
|
//# sourceMappingURL=banner-function-declaration.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner-function-declaration.d.mts","names":[],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAkCgB,iBAAA,yBAAA,CACP,KAAA,EAAA,8BAA8B,CAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"banner-function-declaration.d.mts","names":[],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAkCgB,iBAAA,yBAAA,CACP,KAAA,EAAA,8BAA8B,CAAA,EAAA,eAAA,CAAA,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner-function-declaration.mjs","names":["code","computed","FunctionDeclaration","IfStatement","usePowerlines","getAppDescription","getAppTitle","BannerFunctionBodyDeclaration","useTheme","render","BannerFunctionDeclaration","props","consoleFnName","variant","command","theme","context","header","labels","banner","packageJson","version","description","footer","title","test","value","toLowerCase","replace","trim","titleLines","result","font","align","background","letterSpacing","lineHeight","gradient","transitionGradient","env","array","bannerPadding","Math","max","padding","app","borderStyles","outline","left","length","right","totalPadding","_$createComponent","async","name","doc","parameters","type","default","children","map","line","JSON","stringify","join","condition"],"sources":["../../src/components/banner-function-declaration.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 } from \"@alloy-js/core\";\nimport { FunctionDeclaration, IfStatement } from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { BannerFunctionDeclarationProps } from \"@shell-shock/preset-script/components/banner-function-declaration\";\nimport { BannerFunctionBodyDeclaration } from \"@shell-shock/preset-script/components/banner-function-declaration\";\nimport { useTheme } from \"@shell-shock/preset-script/contexts/theme\";\nimport { render } from \"cfonts\";\nimport type { CLIPresetContext } from \"../types/plugin\";\n\n/**\n * A component to generate the `banner` function in the `shell-shock:console` builtin module.\n */\nexport function BannerFunctionDeclaration(\n props: BannerFunctionDeclarationProps\n) {\n const { consoleFnName = \"log\", variant = \"primary\", command } = props;\n\n const theme = useTheme();\n\n const context = usePowerlines<CLIPresetContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context)} v${context.packageJson.version || \"1.0.0\"}`\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n\n const title = computed(() =>\n getAppTitle(context) ||\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n header.value.toLowerCase()\n )\n ? header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()\n : `${header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()} Command-Line Application`\n );\n\n const titleLines = computed(() => {\n const result = render(getAppTitle(context), {\n font: \"tiny\",\n align: \"left\",\n background: \"transparent\",\n letterSpacing: 1,\n lineHeight: 1,\n gradient: false,\n transitionGradient: false,\n env: \"node\"\n });\n if (!result) {\n return [getAppTitle(context)];\n }\n\n return result.array;\n });\n\n const bannerPadding = computed(\n () =>\n Math.max(theme.padding.app, 0) * 2 +\n theme.borderStyles.banner.outline[variant].left.length +\n theme.borderStyles.banner.outline[variant].right.length\n );\n const totalPadding = computed(\n () => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value\n );\n\n return (\n <>\n <FunctionDeclaration\n async\n name=\"banner\"\n doc={`Write the ${getAppTitle(context)} application banner ${\n command ? `for the ${command.title} command ` : \"\"\n }to the console.`}\n parameters={[{ name: \"pause\", type: \"number\", default:
|
|
1
|
+
{"version":3,"file":"banner-function-declaration.mjs","names":["code","computed","FunctionDeclaration","IfStatement","usePowerlines","getAppDescription","getAppTitle","BannerFunctionBodyDeclaration","useTheme","render","BannerFunctionDeclaration","props","consoleFnName","variant","command","theme","context","header","labels","banner","packageJson","version","description","footer","title","test","value","toLowerCase","replace","trim","titleLines","result","font","align","background","letterSpacing","lineHeight","gradient","transitionGradient","env","array","bannerPadding","Math","max","padding","app","borderStyles","outline","left","length","right","totalPadding","_$createComponent","async","name","doc","parameters","type","default","children","map","line","JSON","stringify","join","condition"],"sources":["../../src/components/banner-function-declaration.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 } from \"@alloy-js/core\";\nimport { FunctionDeclaration, IfStatement } from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { BannerFunctionDeclarationProps } from \"@shell-shock/preset-script/components/banner-function-declaration\";\nimport { BannerFunctionBodyDeclaration } from \"@shell-shock/preset-script/components/banner-function-declaration\";\nimport { useTheme } from \"@shell-shock/preset-script/contexts/theme\";\nimport { render } from \"cfonts\";\nimport type { CLIPresetContext } from \"../types/plugin\";\n\n/**\n * A component to generate the `banner` function in the `shell-shock:console` builtin module.\n */\nexport function BannerFunctionDeclaration(\n props: BannerFunctionDeclarationProps\n) {\n const { consoleFnName = \"log\", variant = \"primary\", command } = props;\n\n const theme = useTheme();\n\n const context = usePowerlines<CLIPresetContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context)} v${context.packageJson.version || \"1.0.0\"}`\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n\n const title = computed(() =>\n getAppTitle(context) ||\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n header.value.toLowerCase()\n )\n ? header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()\n : `${header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()} Command-Line Application`\n );\n\n const titleLines = computed(() => {\n const result = render(getAppTitle(context), {\n font: \"tiny\",\n align: \"left\",\n background: \"transparent\",\n letterSpacing: 1,\n lineHeight: 1,\n gradient: false,\n transitionGradient: false,\n env: \"node\"\n });\n if (!result) {\n return [getAppTitle(context)];\n }\n\n return result.array;\n });\n\n const bannerPadding = computed(\n () =>\n Math.max(theme.padding.app, 0) * 2 +\n theme.borderStyles.banner.outline[variant].left.length +\n theme.borderStyles.banner.outline[variant].right.length\n );\n const totalPadding = computed(\n () => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value\n );\n\n return (\n <>\n <FunctionDeclaration\n async\n name=\"banner\"\n doc={`Write the ${getAppTitle(context)} application banner ${\n command ? `for the ${command.title} command ` : \"\"\n }to the console.`}\n parameters={[{ name: \"pause\", type: \"number\", default: 500 }]}>\n <BannerFunctionBodyDeclaration\n header={header.value}\n description={description.value}\n footer={footer.value}\n variant={variant}\n consoleFnName={consoleFnName}\n command={command}>\n {code`const titleLines = [${titleLines.value\n .map(line => JSON.stringify(line.trim()))\n .join(\", \")}];\n const title = Math.max(...titleLines.map(line => stripAnsi(line).length)) > Math.max(process.stdout.columns - ${\n totalPadding.value\n }, 0) ? \"${title.value}\" : \\`\\\\n\\${titleLines.join(\"\\\\n\")}\\\\n\\`; `}\n </BannerFunctionBodyDeclaration>\n <IfStatement condition={code`isInteractive && !isHelp`}>\n {code`await sleep(pause);`}\n </IfStatement>\n </FunctionDeclaration>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAkCA,SAAgBU,0BACdC,OACA;CACA,MAAM,EAAEC,gBAAgB,OAAOC,UAAU,WAAWC,YAAYH;CAEhE,MAAMI,QAAQP,UAAU;CAExB,MAAMQ,UAAUZ,eAAiC;CAEjD,MAAMa,SAAShB,eAEX,GAAGc,MAAMG,OAAOC,OAAOF,OAAOJ,YAAYP,YAAYU,QAAQ,CAAA,IAAKA,QAAQI,YAAYC,WAAW,UACrG;CACD,MAAMC,cAAcrB,eACZa,SAASQ,eAAejB,kBAAkBW,QAClD,CAAC;CACD,MAAMO,SAAStB,eAAec,MAAMG,OAAOC,OAAOI,OAAOV,SAAS;CAElE,MAAMW,QAAQvB,eACZK,YAAYU,QAAQ,IACpB,4DAA4DS,KAC1DR,OAAOS,MAAMC,aACf,CAAC,GACGV,OAAOS,MACJE,QAAQ,IAAIZ,QAAQI,YAAYC,WAAW,WAAW,GAAG,CACzDQ,MAAM,GACT,GAAGZ,OAAOS,MACPE,QAAQ,IAAIZ,QAAQI,YAAYC,WAAW,WAAW,GAAG,CACzDQ,MAAM,CAAA,2BACd;CAED,MAAMC,aAAa7B,eAAe;EAChC,MAAM8B,SAAStB,OAAOH,YAAYU,QAAQ,EAAE;GAC1CgB,MAAM;GACNC,OAAO;GACPC,YAAY;GACZC,eAAe;GACfC,YAAY;GACZC,UAAU;GACVC,oBAAoB;GACpBC,KAAK;GACN,CAAC;AACF,MAAI,CAACR,OACH,QAAO,CAACzB,YAAYU,QAAQ,CAAC;AAG/B,SAAOe,OAAOS;GACd;CAEF,MAAMC,gBAAgBxC,eAElByC,KAAKC,IAAI5B,MAAM6B,QAAQC,KAAK,EAAE,GAAG,IACjC9B,MAAM+B,aAAa3B,OAAO4B,QAAQlC,SAASmC,KAAKC,SAChDlC,MAAM+B,aAAa3B,OAAO4B,QAAQlC,SAASqC,MAAMD,OACpD;CACD,MAAME,eAAelD,eACbyC,KAAKC,IAAI5B,MAAM6B,QAAQzB,QAAQ,EAAE,GAAG,IAAIsB,cAAcf,MAC7D;AAED,QAAA,CAAA0B,gBAEKlD,qBAAmB;EAClBmD,OAAK;EACLC,MAAI;EAAA,IACJC,MAAG;AAAA,UAAE,aAAajD,YAAYU,QAAQ,CAAA,sBACpCF,UAAU,WAAWA,QAAQU,MAAK,aAAc,GAAE;;EAEpDgC,YAAY,CAAC;GAAEF,MAAM;GAASG,MAAM;GAAUC,SAAS;GAAK,CAAC;EAAA,IAAAC,WAAA;AAAA,UAAA,CAAAP,gBAC5D7C,+BAA6B;IAAA,IAC5BU,SAAM;AAAA,YAAEA,OAAOS;;IAAK,IACpBJ,cAAW;AAAA,YAAEA,YAAYI;;IAAK,IAC9BH,SAAM;AAAA,YAAEA,OAAOG;;IACNb;IACMD;IACNE;IAAO,IAAA6C,WAAA;AAAA,YACf3D,IAAI,uBAAuB8B,WAAWJ,MACpCkC,KAAIC,SAAQC,KAAKC,UAAUF,KAAKhC,MAAM,CAAC,CAAC,CACxCmC,KAAK,KAAK,CAAA;wHAEbb,aAAazB,MAAK,UACTF,MAAME,MAAK;;IAA4C,CAAA,EAAA0B,gBAEjEjD,aAAW;IAAC8D,WAAWjE,IAAI;IAA0B2D,UACnD3D,IAAI;IAAqB,CAAA,CAAA;;EAAA,CAAA,CAAA"}
|
|
@@ -14,7 +14,6 @@ let __stryke_path_find = require("@stryke/path/find");
|
|
|
14
14
|
let __stryke_path_join = require("@stryke/path/join");
|
|
15
15
|
let __stryke_path_replace = require("@stryke/path/replace");
|
|
16
16
|
let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
17
|
-
let __stryke_string_format_lower_case_first = require("@stryke/string-format/lower-case-first");
|
|
18
17
|
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
19
18
|
let defu = require("defu");
|
|
20
19
|
defu = require_rolldown_runtime.__toESM(defu);
|
|
@@ -126,8 +125,9 @@ function CommandEntry(props) {
|
|
|
126
125
|
get children() {
|
|
127
126
|
return __alloy_js_core.code`
|
|
128
127
|
const value = await text({
|
|
129
|
-
message: "Please provide a${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""} value for the \\"${option.name}\\" option
|
|
130
|
-
|
|
128
|
+
message: "Please provide a${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""} value for the \\"${option.name}\\" option",
|
|
129
|
+
${option.description ? `description: "${option.description}",
|
|
130
|
+
` : ""}validate(val) {
|
|
131
131
|
if (!val || val.trim() === "") {
|
|
132
132
|
return "A value must be provided for this option";
|
|
133
133
|
}
|
|
@@ -151,7 +151,9 @@ function CommandEntry(props) {
|
|
|
151
151
|
get children() {
|
|
152
152
|
return __alloy_js_core.code`
|
|
153
153
|
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} = await toggle({
|
|
154
|
-
message: "Please select a value for the "${option.name}" option
|
|
154
|
+
message: "Please select a value for the "${option.name}" option",
|
|
155
|
+
${option.description ? `description: "${option.description}",
|
|
156
|
+
` : ""}
|
|
155
157
|
});
|
|
156
158
|
`;
|
|
157
159
|
}
|
|
@@ -170,8 +172,9 @@ function CommandEntry(props) {
|
|
|
170
172
|
get children() {
|
|
171
173
|
return __alloy_js_core.code`
|
|
172
174
|
const value = await text({
|
|
173
|
-
message: "Please provide one or more${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""} values for the \\"${option.name}\\" option
|
|
174
|
-
|
|
175
|
+
message: "Please provide one or more${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""} values for the \\"${option.name}\\" option (values are separated by a \\",\\" character)",
|
|
176
|
+
${option.description ? `description: "${option.description}",
|
|
177
|
+
` : ""}validate(val) {
|
|
175
178
|
if (!val || val.trim() === "") {
|
|
176
179
|
return "A value must be provided for this option";
|
|
177
180
|
}
|
|
@@ -222,8 +225,9 @@ function CommandEntry(props) {
|
|
|
222
225
|
get children() {
|
|
223
226
|
return __alloy_js_core.code`
|
|
224
227
|
const value = await text({
|
|
225
|
-
message: "Please provide a${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""} value for the \\"${argument.name}\\" argument
|
|
226
|
-
|
|
228
|
+
message: "Please provide a${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""} value for the \\"${argument.name}\\" argument",
|
|
229
|
+
${argument.description ? `description: "${argument.description}",
|
|
230
|
+
` : ""}validate(val) {
|
|
227
231
|
if (!val || val.trim() === "") {
|
|
228
232
|
return "A value must be provided for this argument";
|
|
229
233
|
}
|
|
@@ -247,7 +251,9 @@ function CommandEntry(props) {
|
|
|
247
251
|
get children() {
|
|
248
252
|
return __alloy_js_core.code`
|
|
249
253
|
${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} = await toggle({
|
|
250
|
-
message:
|
|
254
|
+
message: "Please select a value for the \\"${argument.name}\\" argument",
|
|
255
|
+
${argument.description ? `description: "${argument.description}",
|
|
256
|
+
` : ""}
|
|
251
257
|
});
|
|
252
258
|
`;
|
|
253
259
|
}
|
|
@@ -266,8 +272,9 @@ function CommandEntry(props) {
|
|
|
266
272
|
get children() {
|
|
267
273
|
return __alloy_js_core.code`
|
|
268
274
|
const value = await text({
|
|
269
|
-
message: "Please provide one or more${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""}
|
|
270
|
-
|
|
275
|
+
message: "Please provide one or more${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""} (values are separated by a \\",\\" character)",
|
|
276
|
+
${argument.description ? `description: "${argument.description}",
|
|
277
|
+
` : ""}validate(val) {
|
|
271
278
|
if (!val || val.trim() === "") {
|
|
272
279
|
return "A value must be provided for this argument";
|
|
273
280
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAyCiB,iBAAA,SACP,KAAK;WACJ;;AAFX;;;AACU,iBAOM,YAAA,CAPN,KAAA,EAO0B,iBAP1B,CAAA,EAO2C,eAAA,CAAA,QAP3C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core10 from "@alloy-js/core";
|
|
2
2
|
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
3
3
|
import { CommandTree } from "@shell-shock/core/types/command";
|
|
4
4
|
|
|
@@ -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):
|
|
12
|
+
declare function CommandEntry(props: CommandEntryProps): _alloy_js_core10.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":";;;;;
|
|
1
|
+
{"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAyCiB,iBAAA,SACP,KAAK;WACJ;;AAFX;;;AACU,iBAOM,YAAA,CAPN,KAAA,EAO0B,iBAP1B,CAAA,EAO2C,gBAAA,CAAA,QAP3C"}
|
|
@@ -13,7 +13,6 @@ import { findFilePath, relativePath } from "@stryke/path/find";
|
|
|
13
13
|
import { joinPaths } from "@stryke/path/join";
|
|
14
14
|
import { replaceExtension } from "@stryke/path/replace";
|
|
15
15
|
import { camelCase } from "@stryke/string-format/camel-case";
|
|
16
|
-
import { lowerCaseFirst } from "@stryke/string-format/lower-case-first";
|
|
17
16
|
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
18
17
|
import defu from "defu";
|
|
19
18
|
|
|
@@ -124,8 +123,9 @@ function CommandEntry(props) {
|
|
|
124
123
|
get children() {
|
|
125
124
|
return code`
|
|
126
125
|
const value = await text({
|
|
127
|
-
message: "Please provide a${option.kind === ReflectionKind.number ? " numeric" : ""} value for the \\"${option.name}\\" option
|
|
128
|
-
|
|
126
|
+
message: "Please provide a${option.kind === ReflectionKind.number ? " numeric" : ""} value for the \\"${option.name}\\" option",
|
|
127
|
+
${option.description ? `description: "${option.description}",
|
|
128
|
+
` : ""}validate(val) {
|
|
129
129
|
if (!val || val.trim() === "") {
|
|
130
130
|
return "A value must be provided for this option";
|
|
131
131
|
}
|
|
@@ -149,7 +149,9 @@ function CommandEntry(props) {
|
|
|
149
149
|
get children() {
|
|
150
150
|
return code`
|
|
151
151
|
options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} = await toggle({
|
|
152
|
-
message: "Please select a value for the "${option.name}" option
|
|
152
|
+
message: "Please select a value for the "${option.name}" option",
|
|
153
|
+
${option.description ? `description: "${option.description}",
|
|
154
|
+
` : ""}
|
|
153
155
|
});
|
|
154
156
|
`;
|
|
155
157
|
}
|
|
@@ -168,8 +170,9 @@ function CommandEntry(props) {
|
|
|
168
170
|
get children() {
|
|
169
171
|
return code`
|
|
170
172
|
const value = await text({
|
|
171
|
-
message: "Please provide one or more${option.kind === ReflectionKind.number ? " numeric" : ""} values for the \\"${option.name}\\" option
|
|
172
|
-
|
|
173
|
+
message: "Please provide one or more${option.kind === ReflectionKind.number ? " numeric" : ""} values for the \\"${option.name}\\" option (values are separated by a \\",\\" character)",
|
|
174
|
+
${option.description ? `description: "${option.description}",
|
|
175
|
+
` : ""}validate(val) {
|
|
173
176
|
if (!val || val.trim() === "") {
|
|
174
177
|
return "A value must be provided for this option";
|
|
175
178
|
}
|
|
@@ -220,8 +223,9 @@ function CommandEntry(props) {
|
|
|
220
223
|
get children() {
|
|
221
224
|
return code`
|
|
222
225
|
const value = await text({
|
|
223
|
-
message: "Please provide a${argument.kind === ReflectionKind.number ? " numeric" : ""} value for the \\"${argument.name}\\" argument
|
|
224
|
-
|
|
226
|
+
message: "Please provide a${argument.kind === ReflectionKind.number ? " numeric" : ""} value for the \\"${argument.name}\\" argument",
|
|
227
|
+
${argument.description ? `description: "${argument.description}",
|
|
228
|
+
` : ""}validate(val) {
|
|
225
229
|
if (!val || val.trim() === "") {
|
|
226
230
|
return "A value must be provided for this argument";
|
|
227
231
|
}
|
|
@@ -245,7 +249,9 @@ function CommandEntry(props) {
|
|
|
245
249
|
get children() {
|
|
246
250
|
return code`
|
|
247
251
|
${camelCase(argument.name)} = await toggle({
|
|
248
|
-
message:
|
|
252
|
+
message: "Please select a value for the \\"${argument.name}\\" argument",
|
|
253
|
+
${argument.description ? `description: "${argument.description}",
|
|
254
|
+
` : ""}
|
|
249
255
|
});
|
|
250
256
|
`;
|
|
251
257
|
}
|
|
@@ -264,8 +270,9 @@ function CommandEntry(props) {
|
|
|
264
270
|
get children() {
|
|
265
271
|
return code`
|
|
266
272
|
const value = await text({
|
|
267
|
-
message: "Please provide one or more${argument.kind === ReflectionKind.number ? " numeric" : ""}
|
|
268
|
-
|
|
273
|
+
message: "Please provide one or more${argument.kind === ReflectionKind.number ? " numeric" : ""} (values are separated by a \\",\\" character)",
|
|
274
|
+
${argument.description ? `description: "${argument.description}",
|
|
275
|
+
` : ""}validate(val) {
|
|
269
276
|
if (!val || val.trim() === "") {
|
|
270
277
|
return "A value must be provided for this argument";
|
|
271
278
|
}
|
|
@@ -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","lowerCaseFirst","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","children","_$createIntrinsic","banner","condition","Object","values","options","option","optional","map","kind","string","number","variadic","includes","length","arguments","argument","each","doubleHardline","when","description","replace","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 { lowerCaseFirst } from \"@stryke/string-format/lower-case-first\";\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\n extends Omit<EntryFileProps, \"path\" | \"typeDefinition\"> {\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\"],\n console: [\n \"debug\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isInteractive\",\n \"isHelp\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ],\n prompts: [\"text\", \"toggle\", \"select\", \"isCancel\", \"sleep\"]\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 <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={\n option.kind === ReflectionKind.string ||\n option.kind === ReflectionKind.number\n }>{code`\n const value = await text({\n message: \"Please provide a${\n option.kind === ReflectionKind.number\n ? \" numeric\"\n : \"\"\n } value for the \\\\\"${option.name}\\\\\" option${\n option.description\n ? ` (${lowerCaseFirst(\n option.description\n ).replace(/\\.+$/, \"\")})`\n : \"\"\n }\",\n validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this option\";\n }\n ${\n option.kind === ReflectionKind.number\n ? `if (Number.isNaN(Number(val))) {\n return \"The value provided 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 } = ${\n option.kind === ReflectionKind.number\n ? `Number(value)`\n : \"value\"\n };\n `}</Match>\n <Match\n when={option.kind === ReflectionKind.boolean}>{code`\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = await toggle({\n message: \"Please select a value for the \"${\n option.name\n }\" option${\n option.description\n ? ` (${lowerCaseFirst(\n option.description\n ).replace(/\\.+$/, \"\")})`\n : \"\"\n }\"\n });\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 \\\\\"${option.name}\\\\\" option${\n option.description\n ? ` (${lowerCaseFirst(\n option.description\n ).replace(/\\.+$/, \"\")})`\n : \"\"\n } - values are separated by a \\\\\",\\\\\" character\",\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 condition={code`!${camelCase(argument.name)}`}>\n <Switch>\n <Match\n when={\n argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number\n }>{code`\n const value = await text({\n message: \"Please provide a${\n argument.kind === ReflectionKind.number\n ? \" numeric\"\n : \"\"\n } value for the \\\\\"${argument.name}\\\\\" argument${\n argument.description\n ? ` (${lowerCaseFirst(argument.description).replace(/\\.+$/, \"\")})`\n : \"\"\n }\",\n validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this argument\";\n }\n ${\n argument.kind === ReflectionKind.number\n ? `if (Number.isNaN(Number(val))) {\n return \"The provided value must be a valid number\";\n }`\n : \"\"\n }\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = ${\n argument.kind === ReflectionKind.number\n ? `Number(value)`\n : \"value\"\n };\n `}</Match>\n <Match\n when={argument.kind === ReflectionKind.boolean}>{code`\n ${camelCase(argument.name)} = await toggle({\n message: 'Please select a value for the \"${argument.name}\" argument${\n argument.description\n ? ` (${lowerCaseFirst(argument.description).replace(/\\.+$/, \"\")})`\n : \"\"\n }:'\n });\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 \\\\\"${argument.name}\\\\\" argument${\n argument.description\n ? ` (${lowerCaseFirst(argument.description).replace(/\\.+$/, \"\")})`\n : \"\"\n } - values are separated by a \\\\\",\\\\\" character\",\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 </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":";;;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAgByB,aAAaC,OAA0B;CACrD,MAAM,EAAEC,SAASC,SAASC,gBAAgB,GAAGC,SAASJ;CAEtD,MAAMK,UAAUrB,eAAiC;CACjD,MAAMsB,WAAW/B,eACfgB,UACEU,QAAQM,SACLC,QAAOC,YAAW,CAACvB,qBAAqBuB,QAAQ,CAAC,CACjDC,KAAK,IAAI,EACZ,WAEJ,CAAC;CACD,MAAMC,oBAAoBpC,eACxBiB,iBACEF,aACEC,UAAUc,QAAQO,WAAWvB,aAAaiB,SAASO,MAAM,CAAC,EAC1DZ,QAAQa,MAAMC,OAAOC,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L,KAAKvD,eAAemD,SAASI,YAAY,CAACC,QAAQ,QAAQ,GAAG,CAAA,KAC7D,GAAE;;;;;;;;kCAUJL,SAASP,SAASxD,eAAe0D,SAC7B;;;0CAIA,GAAE;;;;;;;;;8BAUV/C,UAAUoD,SAAStB,KAAK,CAAA,gEACxBsB,SAASP,SAASxD,eAAe0D,SAC7B,iBACA,GAAE;;;eAET,CAAA;;aAAA,CAAA,CAAA;;WAAA,CAAA,CAAA;UAKZ,CAAA;SAEFlE,IAAI;SAAiB8C,gBACrBrC,SAAO,EAAA,CAAA;SAAA;;OAAA,CAAA,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAAqC,gBAIb5C,KAAG;EAAA,IAACsE,OAAI;AAAA,UAAEd,OAAOC,OAAOhC,QAAQ2B,SAAS;;EAAAA,WACvCwB,UAAKhC,gBACH1C,MAAI;GAAA,IACHsE,OAAI;AAAA,WAAEI,MAAMC;;GAAS,IACrBC,WAAQ;AAAA,WAAAlC,gBAAGrB,cAAY,EAACE,SAASmD,OAAK,CAAA;;GAAA,IAAAxB,WAAA;AAAA,WAAAR,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","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","children","_$createIntrinsic","banner","condition","Object","values","options","option","optional","map","kind","string","number","variadic","includes","length","arguments","argument","each","doubleHardline","when","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\n extends Omit<EntryFileProps, \"path\" | \"typeDefinition\"> {\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\"],\n console: [\n \"debug\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isInteractive\",\n \"isHelp\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ],\n prompts: [\"text\", \"toggle\", \"select\", \"isCancel\", \"sleep\"]\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 <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={\n option.kind === ReflectionKind.string ||\n option.kind === ReflectionKind.number\n }>{code`\n const value = await text({\n message: \"Please provide a${\n option.kind === ReflectionKind.number\n ? \" numeric\"\n : \"\"\n } value for the \\\\\"${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 option.kind === ReflectionKind.number\n ? `if (Number.isNaN(Number(val))) {\n return \"The value provided 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 } = ${\n option.kind === ReflectionKind.number\n ? `Number(value)`\n : \"value\"\n };\n `}</Match>\n <Match\n when={option.kind === ReflectionKind.boolean}>{code`\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = await toggle({\n message: \"Please select a value for the \"${\n option.name\n }\" option\",\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }\n });\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 \\\\\"${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 condition={code`!${camelCase(argument.name)}`}>\n <Switch>\n <Match\n when={\n argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number\n }>{code`\n const value = await text({\n message: \"Please provide a${\n argument.kind === ReflectionKind.number\n ? \" numeric\"\n : \"\"\n } value for the \\\\\"${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 argument.kind === ReflectionKind.number\n ? `if (Number.isNaN(Number(val))) {\n return \"The provided value must be a valid number\";\n }`\n : \"\"\n }\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = ${\n argument.kind === ReflectionKind.number\n ? `Number(value)`\n : \"value\"\n };\n `}</Match>\n <Match\n when={argument.kind === ReflectionKind.boolean}>{code`\n ${camelCase(argument.name)} = await toggle({\n message: \"Please select a value for the \\\\\"${argument.name}\\\\\" argument\",\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }\n });\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 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 </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":";;;;;;;;;;;;;;;;;;;;;;AAiDA,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;KAAU;IACxCC,SAAS;KACP;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACD;IACDC,OAAO;KACL;KACA;KACA;KACA;KACA;KACA;KAC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-js/core";
|
|
2
2
|
import { CommandTree } from "@shell-shock/core/types/command";
|
|
3
3
|
import { CommandRouterProps } from "@shell-shock/preset-script/components/command-router";
|
|
4
4
|
|
|
@@ -6,11 +6,11 @@ import { CommandRouterProps } from "@shell-shock/preset-script/components/comman
|
|
|
6
6
|
interface CommandRouterSelectOptionsProps {
|
|
7
7
|
commands?: Record<string, CommandTree>;
|
|
8
8
|
}
|
|
9
|
-
declare function CommandRouterSelectOptions(props: CommandRouterSelectOptionsProps):
|
|
9
|
+
declare function CommandRouterSelectOptions(props: CommandRouterSelectOptionsProps): _alloy_js_core0.Children;
|
|
10
10
|
/**
|
|
11
11
|
* A component that renders a command router interface, allowing users to select and execute commands from a provided list of commands and segments. This component serves as a wrapper around the base CommandRouter, adding additional UI elements and logic for command selection.
|
|
12
12
|
*/
|
|
13
|
-
declare function CommandRouter(props: CommandRouterProps):
|
|
13
|
+
declare function CommandRouter(props: CommandRouterProps): _alloy_js_core0.Children;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { CommandRouter, CommandRouterSelectOptions, CommandRouterSelectOptionsProps };
|
|
16
16
|
//# sourceMappingURL=command-router.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core6 from "@alloy-js/core";
|
|
2
2
|
import { CommandRouterProps } from "@shell-shock/preset-script/components/command-router";
|
|
3
3
|
import { CommandTree } from "@shell-shock/core/types/command";
|
|
4
4
|
|
|
@@ -6,11 +6,11 @@ import { CommandTree } from "@shell-shock/core/types/command";
|
|
|
6
6
|
interface CommandRouterSelectOptionsProps {
|
|
7
7
|
commands?: Record<string, CommandTree>;
|
|
8
8
|
}
|
|
9
|
-
declare function CommandRouterSelectOptions(props: CommandRouterSelectOptionsProps):
|
|
9
|
+
declare function CommandRouterSelectOptions(props: CommandRouterSelectOptionsProps): _alloy_js_core6.Children;
|
|
10
10
|
/**
|
|
11
11
|
* A component that renders a command router interface, allowing users to select and execute commands from a provided list of commands and segments. This component serves as a wrapper around the base CommandRouter, adding additional UI elements and logic for command selection.
|
|
12
12
|
*/
|
|
13
|
-
declare function CommandRouter(props: CommandRouterProps):
|
|
13
|
+
declare function CommandRouter(props: CommandRouterProps): _alloy_js_core6.Children;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { CommandRouter, CommandRouterSelectOptions, CommandRouterSelectOptionsProps };
|
|
16
16
|
//# sourceMappingURL=command-router.d.mts.map
|