@shell-shock/preset-cli 0.9.8 → 0.9.9
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/dist/components/banner-builtin.cjs +2 -2
- package/dist/components/banner-builtin.d.cts.map +1 -1
- package/dist/components/banner-builtin.d.mts.map +1 -1
- package/dist/components/banner-builtin.mjs +2 -2
- package/dist/components/banner-builtin.mjs.map +1 -1
- package/dist/components/command-entry.cjs +21 -12
- package/dist/components/command-entry.mjs +20 -11
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +3 -3
- package/dist/components/command-router.mjs +3 -3
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/upgrade-builtin.cjs +8 -8
- package/dist/components/upgrade-builtin.mjs +8 -8
- package/dist/components/upgrade-builtin.mjs.map +1 -1
- package/dist/components/virtual-command-entry.cjs +13 -5
- package/dist/components/virtual-command-entry.mjs +13 -5
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/{get-default-options.cjs → get-global-options.cjs} +5 -5
- package/dist/helpers/{get-default-options.mjs → get-global-options.mjs} +6 -6
- package/dist/helpers/get-global-options.mjs.map +1 -0
- package/dist/index.cjs +9 -9
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +9 -9
- package/dist/index.mjs.map +1 -1
- package/dist/node_modules/.pnpm/@stryke_types@0.11.3/node_modules/@stryke/types/dist/base.d.cts +17 -0
- package/dist/node_modules/.pnpm/@stryke_types@0.11.3/node_modules/@stryke/types/dist/base.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_types@0.11.3/node_modules/@stryke/types/dist/base.d.mts +17 -0
- package/dist/node_modules/.pnpm/@stryke_types@0.11.3/node_modules/@stryke/types/dist/base.d.mts.map +1 -0
- package/dist/packages/plugin-changelog/dist/components/changelog-command.mjs +130 -0
- package/dist/packages/plugin-changelog/dist/components/changelog-command.mjs.map +1 -0
- package/dist/packages/plugin-changelog/dist/components/index.mjs +3 -0
- package/dist/packages/plugin-changelog/dist/index.d.cts +2 -0
- package/dist/packages/plugin-changelog/dist/index.d.mts +2 -0
- package/dist/packages/plugin-changelog/dist/index.mjs +52 -0
- package/dist/packages/plugin-changelog/dist/index.mjs.map +1 -0
- package/dist/packages/plugin-changelog/dist/types/plugin.d.cts +43 -0
- package/dist/packages/plugin-changelog/dist/types/plugin.d.cts.map +1 -0
- package/dist/packages/plugin-changelog/dist/types/plugin.d.mts +43 -0
- package/dist/packages/plugin-changelog/dist/types/plugin.d.mts.map +1 -0
- package/dist/packages/unified/dist/markdown/index.mjs +6 -0
- package/dist/packages/unified/dist/markdown/index.mjs.map +1 -0
- package/dist/plugin-changelog/dist/components/changelog-command.cjs +130 -0
- package/dist/plugin-changelog/dist/components/index.cjs +1 -0
- package/dist/plugin-changelog/dist/index.cjs +53 -0
- package/dist/types/plugin.d.cts +11 -6
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +11 -6
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/unified/dist/markdown/index.cjs +6 -0
- package/package.json +21 -20
- package/dist/helpers/get-default-options.mjs.map +0 -1
|
@@ -3,8 +3,8 @@ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
|
3
3
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
4
|
let _alloy_js_core = require("@alloy-js/core");
|
|
5
5
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
6
|
-
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
7
6
|
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
7
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
8
8
|
let _shell_shock_plugin_banner_components_banner_builtin = require("@shell-shock/plugin-banner/components/banner-builtin");
|
|
9
9
|
let _shell_shock_plugin_banner_components_banner_function_declaration = require("@shell-shock/plugin-banner/components/banner-function-declaration");
|
|
10
10
|
let _shell_shock_plugin_theme_contexts_theme = require("@shell-shock/plugin-theme/contexts/theme");
|
|
@@ -59,7 +59,7 @@ function BannerFunctionBodyDeclaration(props) {
|
|
|
59
59
|
splitText(title,
|
|
60
60
|
Math.max(process.stdout.columns - ${totalPadding.value}, 20)
|
|
61
61
|
).forEach((line) => {
|
|
62
|
-
writeLine(
|
|
62
|
+
writeLine(borderColors.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.bold(colors.text.banner.title.${variant}(line)) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + borderColors.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
63
63
|
}); `;
|
|
64
64
|
}
|
|
65
65
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner-builtin.d.cts","names":[],"sources":["../../src/components/banner-builtin.tsx"],"mappings":";;;;;;;;;iBAqCgB,6BAAA,CACd,KAAA,EAAO,IAAA,CACL,kCAAA,yCADS,iBAAA,CAGV,QAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"banner-builtin.d.cts","names":[],"sources":["../../src/components/banner-builtin.tsx"],"mappings":";;;;;;;;;iBAqCgB,6BAAA,CACd,KAAA,EAAO,IAAA,CACL,kCAAA,yCADS,iBAAA,CAGV,QAAA;AAAA,KAqFS,kBAAA,GAAqB,IAAA,CAC/B,gBAAA;;;;EAMA,OAAA,EAAS,WAAA;AAAA;;;;iBAMK,aAAA,CAAc,KAAA,EAAO,kBAAA,GAAkB,iBAAA,CAAA,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner-builtin.d.mts","names":[],"sources":["../../src/components/banner-builtin.tsx"],"mappings":";;;;;;;;;iBAqCgB,6BAAA,CACd,KAAA,EAAO,IAAA,CACL,kCAAA,yCADS,iBAAA,CAGV,QAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"banner-builtin.d.mts","names":[],"sources":["../../src/components/banner-builtin.tsx"],"mappings":";;;;;;;;;iBAqCgB,6BAAA,CACd,KAAA,EAAO,IAAA,CACL,kCAAA,yCADS,iBAAA,CAGV,QAAA;AAAA,KAqFS,kBAAA,GAAqB,IAAA,CAC/B,gBAAA;;;;EAMA,OAAA,EAAS,WAAA;AAAA;;;;iBAMK,aAAA,CAAc,KAAA,EAAO,kBAAA,GAAkB,iBAAA,CAAA,QAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { Show, code, computed, splitProps } from "@alloy-js/core";
|
|
3
3
|
import { getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils";
|
|
4
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
5
4
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
5
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
6
6
|
import { BannerBuiltin as BannerBuiltin$1 } from "@shell-shock/plugin-banner/components/banner-builtin";
|
|
7
7
|
import { BannerFunctionBodyDeclaration as BannerFunctionBodyDeclaration$1, BannerFunctionDeclarationWrapper } from "@shell-shock/plugin-banner/components/banner-function-declaration";
|
|
8
8
|
import { useTheme } from "@shell-shock/plugin-theme/contexts/theme";
|
|
@@ -57,7 +57,7 @@ function BannerFunctionBodyDeclaration(props) {
|
|
|
57
57
|
splitText(title,
|
|
58
58
|
Math.max(process.stdout.columns - ${totalPadding.value}, 20)
|
|
59
59
|
).forEach((line) => {
|
|
60
|
-
writeLine(
|
|
60
|
+
writeLine(borderColors.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.bold(colors.text.banner.title.${variant}(line)) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + borderColors.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
61
61
|
}); `;
|
|
62
62
|
}
|
|
63
63
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner-builtin.mjs","names":[],"sources":["../../src/components/banner-builtin.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, Show, splitProps } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport type { CommandTree } from \"@shell-shock/core\";\nimport { getAppDescription, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { BannerBuiltin as BaseBannerBuiltin } from \"@shell-shock/plugin-banner/components/banner-builtin\";\nimport type { BannerFunctionBodyDeclarationProps } from \"@shell-shock/plugin-banner/components/banner-function-declaration\";\nimport {\n BannerFunctionDeclarationWrapper,\n BannerFunctionBodyDeclaration as BaseBannerFunctionBodyDeclaration\n} from \"@shell-shock/plugin-banner/components/banner-function-declaration\";\nimport { useTheme } from \"@shell-shock/plugin-theme/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 BannerFunctionBodyDeclaration(\n props: Omit<\n BannerFunctionBodyDeclarationProps,\n \"header\" | \"description\" | \"footer\"\n >\n) {\n const { consoleFnName = \"log\", variant = \"primary\", command } = props;\n\n const theme = useTheme();\n const context = usePowerlines<CLIPresetContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context)} v${\n context.packageJson.version || \"1.0.0\"\n }`\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n const title = computed(() =>\n getAppTitle(context, true).replace(\n `v${context.packageJson.version || \"1.0.0\"}`,\n \"\"\n )\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n\n const titleLines = computed(() => {\n
|
|
1
|
+
{"version":3,"file":"banner-builtin.mjs","names":[],"sources":["../../src/components/banner-builtin.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, Show, splitProps } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport type { CommandTree } from \"@shell-shock/core\";\nimport { getAppDescription, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { BannerBuiltin as BaseBannerBuiltin } from \"@shell-shock/plugin-banner/components/banner-builtin\";\nimport type { BannerFunctionBodyDeclarationProps } from \"@shell-shock/plugin-banner/components/banner-function-declaration\";\nimport {\n BannerFunctionDeclarationWrapper,\n BannerFunctionBodyDeclaration as BaseBannerFunctionBodyDeclaration\n} from \"@shell-shock/plugin-banner/components/banner-function-declaration\";\nimport { useTheme } from \"@shell-shock/plugin-theme/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 BannerFunctionBodyDeclaration(\n props: Omit<\n BannerFunctionBodyDeclarationProps,\n \"header\" | \"description\" | \"footer\"\n >\n) {\n const { consoleFnName = \"log\", variant = \"primary\", command } = props;\n\n const theme = useTheme();\n const context = usePowerlines<CLIPresetContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context)} v${\n context.packageJson.version || \"1.0.0\"\n }`\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n const title = computed(() =>\n getAppTitle(context, true).replace(\n `v${context.packageJson.version || \"1.0.0\"}`,\n \"\"\n )\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n\n const titleLines = computed(() => {\n const result = render(getAppTitle(context, true), {\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, true)} Command-Line Interface`];\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 ?? 0) +\n (theme.borderStyles.banner.outline[variant]?.right.length ?? 0)\n );\n const totalPadding = computed(\n () => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value\n );\n\n return (\n <BaseBannerFunctionBodyDeclaration\n header={header.value}\n description={description.value}\n footer={footer.value}\n variant={variant}\n consoleFnName={consoleFnName}\n command={command}\n insertNewlineAfterDescription>\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 }, 20) ? \"${title.value}\" : \\`\\\\n\\${titleLines.join(\"\\\\n\")}\\\\n\\`;\n\n splitText(title,\n Math.max(process.stdout.columns - ${totalPadding.value}, 20)\n ).forEach((line) => {\n writeLine(borderColors.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.bold(colors.text.banner.title.${variant}(line)) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + borderColors.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n }); `}\n </BaseBannerFunctionBodyDeclaration>\n );\n}\n\nexport type BannerBuiltinProps = Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> & {\n /**\n * The command to generate the `banner` function declaration for.\n */\n command: CommandTree;\n};\n\n/**\n * A built-in banner module for Shell Shock.\n */\nexport function BannerBuiltin(props: BannerBuiltinProps) {\n const [{ command, children }, rest] = splitProps(props, [\n \"command\",\n \"children\"\n ]);\n\n return (\n <BaseBannerBuiltin {...rest} command={command}>\n <BannerFunctionDeclarationWrapper command={command}>\n <BannerFunctionBodyDeclaration command={command} />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BannerFunctionDeclarationWrapper>\n </BaseBannerBuiltin>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAmCA,SAAe,8BAAyB,OAAoD;CAC1F,MAAA,EACF,gBAAgB,OACd,UAAW,WACT,YACC;CACH,MAAA,QAAA,UAAA;CACA,MAAA,UA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F,SAAM,cAAA,OAA6B;CACjC,MAAK,CAAA,EACH,SACA,YACC,QAAO,WAAY,OAAO,CAAC,WAAW,WAAW,CAAC;AACrD,QAAM,gBAAa,iBAAA,WAAA,MAAA;EACR;;AAEP,UAAA,gBAAe,kCAAA;IACJ;IACT,IAAA,WAAe;AACf,YAAS;MAAC,gBAAa,+BAA4B,EAC3C,SACL,CAAC;MAAE,gBAAgB,SAAS,EAAA,CAAK;MAAE,gBAAe,MAAS;OAC5D,IAAA,OAAa;AACT,eAAO,QAAG,SAAY;;OAEd;OACZ,CAAA;MAAA;;IAEH,CAAC;;EAEL,CAAA,CAAA"}
|
|
@@ -5,19 +5,19 @@ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
|
5
5
|
let _alloy_js_core = require("@alloy-js/core");
|
|
6
6
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
7
7
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
8
|
-
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
9
8
|
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
9
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
10
|
+
let defu = require("defu");
|
|
11
|
+
defu = require_runtime.__toESM(defu);
|
|
12
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
10
13
|
let _powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
|
|
11
14
|
let _shell_shock_core = require("@shell-shock/core");
|
|
12
15
|
let _shell_shock_core_components_command_validation_logic = require("@shell-shock/core/components/command-validation-logic");
|
|
13
16
|
let _shell_shock_preset_script_components_command_entry = require("@shell-shock/preset-script/components/command-entry");
|
|
14
17
|
let _stryke_path_find = require("@stryke/path/find");
|
|
15
|
-
let _stryke_path_join = require("@stryke/path/join");
|
|
16
18
|
let _stryke_path_replace = require("@stryke/path/replace");
|
|
17
19
|
let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
18
20
|
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
19
|
-
let defu = require("defu");
|
|
20
|
-
defu = require_runtime.__toESM(defu);
|
|
21
21
|
|
|
22
22
|
//#region src/components/command-entry.tsx
|
|
23
23
|
/**
|
|
@@ -62,18 +62,25 @@ function CommandEntry(props) {
|
|
|
62
62
|
"stripAnsi",
|
|
63
63
|
"writeLine",
|
|
64
64
|
"splitText",
|
|
65
|
+
"textColors",
|
|
65
66
|
"createSpinner"
|
|
66
67
|
],
|
|
67
68
|
utils: [
|
|
68
69
|
"sleep",
|
|
69
|
-
"useApp",
|
|
70
|
-
"useArgs",
|
|
71
|
-
"hasFlag",
|
|
72
70
|
"isMinimal",
|
|
73
71
|
"isInteractive",
|
|
72
|
+
"isUnicodeSupported"
|
|
73
|
+
],
|
|
74
|
+
state: [
|
|
75
|
+
"useGlobal",
|
|
76
|
+
"withCommand",
|
|
77
|
+
"useArgs",
|
|
78
|
+
"hasFlag",
|
|
74
79
|
"isHelp",
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
{
|
|
81
|
+
name: "GlobalOptions",
|
|
82
|
+
type: true
|
|
83
|
+
}
|
|
77
84
|
],
|
|
78
85
|
prompts: [
|
|
79
86
|
"text",
|
|
@@ -107,7 +114,7 @@ function CommandEntry(props) {
|
|
|
107
114
|
get children() {
|
|
108
115
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
109
116
|
get condition() {
|
|
110
|
-
return _alloy_js_core.code`!isHelp && (${Object.values(command.options ?? {}).filter((option) => !option.optional).map((option) => (option.kind === _shell_shock_core.CommandParameterKinds.string || option.kind === _shell_shock_core.CommandParameterKinds.number) && option.variadic ? `(!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} || options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0)` : `options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} === undefined`).join(" || ")}${Object.values(command.options ?? {}).filter((option) => !option.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 === _shell_shock_core.CommandParameterKinds.string || arg.kind === _shell_shock_core.CommandParameterKinds.number) && arg.variadic ? `(!${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} || ${(0, _stryke_string_format_camel_case.camelCase)(arg.name)}.length === 0)` : `${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} === undefined`).join(" || ")}) `;
|
|
117
|
+
return _alloy_js_core.code`!isHelp() && (${Object.values(command.options ?? {}).filter((option) => !option.optional).map((option) => (option.kind === _shell_shock_core.CommandParameterKinds.string || option.kind === _shell_shock_core.CommandParameterKinds.number) && option.variadic ? `(!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} || options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0)` : `options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} === undefined`).join(" || ")}${Object.values(command.options ?? {}).filter((option) => !option.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 === _shell_shock_core.CommandParameterKinds.string || arg.kind === _shell_shock_core.CommandParameterKinds.number) && arg.variadic ? `(!${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} || ${(0, _stryke_string_format_camel_case.camelCase)(arg.name)}.length === 0)` : `${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} === undefined`).join(" || ")}) `;
|
|
111
118
|
},
|
|
112
119
|
get children() {
|
|
113
120
|
return [
|
|
@@ -407,8 +414,10 @@ function CommandEntry(props) {
|
|
|
407
414
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_command_validation_logic.CommandValidationLogic, { command }),
|
|
408
415
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
409
416
|
condition: _alloy_js_core.code`failures.length > 0`,
|
|
410
|
-
children
|
|
411
|
-
|
|
417
|
+
get children() {
|
|
418
|
+
return _alloy_js_core.code`error(\`The following validation failures were found while processing the user provided input, and must be corrected before the \${italic("${command.title}")} command can be executed: \\n\\n\${failures.map(failure => " - " + failure).join("\\n")}\`);
|
|
419
|
+
options.help = true; `;
|
|
420
|
+
}
|
|
412
421
|
})
|
|
413
422
|
];
|
|
414
423
|
}
|
|
@@ -3,18 +3,18 @@ import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
|
3
3
|
import { For, Match, Show, Switch, code, computed } from "@alloy-js/core";
|
|
4
4
|
import { ElseIfClause, IfStatement } from "@alloy-js/typescript";
|
|
5
5
|
import { formatDescription, formatShortDescription, isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
|
|
6
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
7
6
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
7
|
+
import { joinPaths } from "@stryke/path/join";
|
|
8
|
+
import defu from "defu";
|
|
9
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
8
10
|
import { EntryFile } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
9
11
|
import { CommandParameterKinds } from "@shell-shock/core";
|
|
10
12
|
import { CommandValidationLogic } from "@shell-shock/core/components/command-validation-logic";
|
|
11
13
|
import { CommandHandlerDeclaration } from "@shell-shock/preset-script/components/command-entry";
|
|
12
14
|
import { findFilePath, relativePath } from "@stryke/path/find";
|
|
13
|
-
import { joinPaths } from "@stryke/path/join";
|
|
14
15
|
import { replaceExtension } from "@stryke/path/replace";
|
|
15
16
|
import { camelCase } from "@stryke/string-format/camel-case";
|
|
16
17
|
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
17
|
-
import defu from "defu";
|
|
18
18
|
|
|
19
19
|
//#region src/components/command-entry.tsx
|
|
20
20
|
/**
|
|
@@ -59,18 +59,25 @@ function CommandEntry(props) {
|
|
|
59
59
|
"stripAnsi",
|
|
60
60
|
"writeLine",
|
|
61
61
|
"splitText",
|
|
62
|
+
"textColors",
|
|
62
63
|
"createSpinner"
|
|
63
64
|
],
|
|
64
65
|
utils: [
|
|
65
66
|
"sleep",
|
|
66
|
-
"useApp",
|
|
67
|
-
"useArgs",
|
|
68
|
-
"hasFlag",
|
|
69
67
|
"isMinimal",
|
|
70
68
|
"isInteractive",
|
|
69
|
+
"isUnicodeSupported"
|
|
70
|
+
],
|
|
71
|
+
state: [
|
|
72
|
+
"useGlobal",
|
|
73
|
+
"withCommand",
|
|
74
|
+
"useArgs",
|
|
75
|
+
"hasFlag",
|
|
71
76
|
"isHelp",
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
{
|
|
78
|
+
name: "GlobalOptions",
|
|
79
|
+
type: true
|
|
80
|
+
}
|
|
74
81
|
],
|
|
75
82
|
prompts: [
|
|
76
83
|
"text",
|
|
@@ -104,7 +111,7 @@ function CommandEntry(props) {
|
|
|
104
111
|
get children() {
|
|
105
112
|
return createComponent(ElseIfClause, {
|
|
106
113
|
get condition() {
|
|
107
|
-
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(" || ")}) `;
|
|
114
|
+
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(" || ")}) `;
|
|
108
115
|
},
|
|
109
116
|
get children() {
|
|
110
117
|
return [
|
|
@@ -404,8 +411,10 @@ function CommandEntry(props) {
|
|
|
404
411
|
createComponent(CommandValidationLogic, { command }),
|
|
405
412
|
createComponent(IfStatement, {
|
|
406
413
|
condition: code`failures.length > 0`,
|
|
407
|
-
children
|
|
408
|
-
|
|
414
|
+
get children() {
|
|
415
|
+
return code`error(\`The following validation failures were found while processing the user provided input, and must be corrected before the \${italic("${command.title}")} command can be executed: \\n\\n\${failures.map(failure => " - " + failure).join("\\n")}\`);
|
|
416
|
+
options.help = true; `;
|
|
417
|
+
}
|
|
409
418
|
})
|
|
410
419
|
];
|
|
411
420
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.mjs","names":[],"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 { CommandValidationLogic } from \"@shell-shock/core/components/command-validation-logic\";\nimport {\n formatDescription,\n formatShortDescription,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport { CommandHandlerDeclaration } 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 { 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.startsWith(\".\")\n ? commandSourcePath.value\n : `./${commandSourcePath.value}`]:\n `handle${pascalCase(command.name)}`\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 \"italic\",\n \"cursor\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"createSpinner\"\n ],\n utils: [\n \"sleep\",\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 ],\n [joinPaths(\n \"help\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showHelp\"],\n [joinPaths(\n \"banner\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showBanner\"],\n upgrade: [\"executeUpgrade\"]\n })}>\n <Spacing />\n <CommandHandlerDeclaration\n command={command}\n banner={code`await showBanner();\n await executeUpgrade(); `}>\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 \\${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 \\${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 \\${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 \\${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 \\${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 \\${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 \\${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 \\${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 \\${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 \\${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 <CommandValidationLogic command={command} />\n <IfStatement condition={code`failures.length > 0`}>\n {code`error(\"The following validation failures were found while processing the user provided input, and must be corrected before the command-line process can be executed: \\\\n\\\\n\" + failures.map(failure => \" - \" + failure).join(\"\\\\n\"));\n options.help = true; `}\n </IfStatement>\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":";;;;;;;;;;;;;;;;;;;;;;;CA8CA,MAAO,EACL,SACC,SACD,gBACA,GAAA,SACF;;CAEE,MAAA,WAAA,eAAA,UAAA,QAAA,SAAA,QAAA,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,KAAA,IAA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L,CAAC,CAAC;;YAEN,CAAC,CAAC;WACJ,CAAC;UAAE,IAAI;UAAM,gBAAA,SAAA,EAAA,CAAA;UAAA,gBAAA,wBAAA,EACH,SACV,CAAC;UAAE,gBAAQ,aAAA;WACV,WAAU,IAAA;WACV,UAAU,IAAE;;WAEb,CAAC;UAAC;;QAEN,CAAC;;MAEL,CAAC,CAAC;;IAEN,CAAC,CAAC;;EAEN,CAAC,CAAC,EAAE,gBAAkB,KAAK;EAC1B,IAAI,OAAO;AACT,UAAO,OAAO,OAAO,QAAG,SAAA;;EAE1B,WAAU,UAAS,gBAAe,MAAA;GAChC,IAAI,OAAO;AACT,WAAO,MAAM;;GAEf,IAAI,WAAO;AACT,WAAO,gBAAI,cAAA,EACT,SAAK,OACN,CAAC;;GAEJ,IAAI,WAAS;AACX,WAAO,gBAAkB,qBAAa,EACpC,SAAS,OACV,CAAC;;GAEL,CAAC;EACH,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"command-entry.mjs","names":[],"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 { CommandValidationLogic } from \"@shell-shock/core/components/command-validation-logic\";\nimport {\n formatDescription,\n formatShortDescription,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport { CommandHandlerDeclaration } 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 { 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.startsWith(\".\")\n ? commandSourcePath.value\n : `./${commandSourcePath.value}`]:\n `handle${pascalCase(command.name)}`\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 \"italic\",\n \"cursor\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"textColors\",\n \"createSpinner\"\n ],\n utils: [\"sleep\", \"isMinimal\", \"isInteractive\", \"isUnicodeSupported\"],\n state: [\n \"useGlobal\",\n \"withCommand\",\n \"useArgs\",\n \"hasFlag\",\n \"isHelp\",\n { name: \"GlobalOptions\", type: true }\n ],\n prompts: [\n \"text\",\n \"numeric\",\n \"toggle\",\n \"select\",\n \"confirm\",\n \"waitForKeyPress\",\n \"isCancel\"\n ],\n [joinPaths(\n \"help\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showHelp\"],\n [joinPaths(\n \"banner\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showBanner\"],\n upgrade: [\"executeUpgrade\"]\n })}>\n <Spacing />\n <CommandHandlerDeclaration\n command={command}\n banner={code`await showBanner();\n await executeUpgrade(); `}>\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(\n command.options ?? {}\n )\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 \\${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 \\${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 \\${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 \\${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 \\${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 \\${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 \\${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 \\${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 \\${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 \\${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 <CommandValidationLogic command={command} />\n <IfStatement condition={code`failures.length > 0`}>\n {code`error(\\`The following validation failures were found while processing the user provided input, and must be corrected before the \\${italic(\"${command.title}\")} command can be executed: \\\\n\\\\n\\${failures.map(failure => \" - \" + failure).join(\"\\\\n\")}\\`);\n options.help = true; `}\n </IfStatement>\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":";;;;;;;;;;;;;;;;;;;;;;;CA8CA,MAAO,EACL,SACC,SACD,gBACA,GAAA,SACF;;CAEE,MAAA,WAAA,eAAA,UAAA,QAAA,SAAA,QAAA,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,KAAA,IAAA,EAAA,WAAA,CAAA;CACA,MAAK,oBAAoB,eAAc,iBAAa,aAAA,UAAA,QAAA,WAAA,aAAA,SAAA,MAAA,CAAA,EAAA,QAAA,MAAA,OAAA,QAAA,QAAA,MAAA,KAAA,CAAA,CAAA;CACpD,MAAA,iBAAA,gBAAA;EACF,GAAO,QAAQ;EACb,QAAQ,QAAS;;AAEjB,QAAM,CAAA,gBAAU,WAAc,WAAmB,MAAA;EACjD,IAAM,OAAA;AACJ,UAAS,SAAA;;EAET,IAAI,iBAAiB;AACnB,UAAO,eAAK;;EAEd,IAAA,UAAA;AACD,UAAA,KAAA,WAAA,EAAA,EAAA,GACK,kBAAmB,MAAC,WAAa,IAAA,GAAA,kBAAA,QAAA,KAAA,kBAAA,UAAA,SAAA,WAAA,QAAA,KAAA,IACrC,CAAA;;EAEA,IAAI,iBAAiB;AACnB,UAAE,KAAQ,kBAAoB,EAAC,EAAA;IAC/B,KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IACF,SAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;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|
|
@@ -4,8 +4,8 @@ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
|
4
4
|
let _alloy_js_core = require("@alloy-js/core");
|
|
5
5
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
6
6
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
7
|
-
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
8
7
|
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
8
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
9
9
|
let _shell_shock_preset_script_components = require("@shell-shock/preset-script/components");
|
|
10
10
|
|
|
11
11
|
//#region src/components/command-router.tsx
|
|
@@ -35,7 +35,7 @@ function CommandRouter(props) {
|
|
|
35
35
|
})),
|
|
36
36
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
37
37
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
38
|
-
condition: _alloy_js_core.code`isInteractive && !isHelp`,
|
|
38
|
+
condition: _alloy_js_core.code`isInteractive && !isHelp()`,
|
|
39
39
|
get children() {
|
|
40
40
|
return [
|
|
41
41
|
_alloy_js_core.code`await showBanner();
|
|
@@ -62,7 +62,7 @@ function CommandRouter(props) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
segments = segments.map(segment => dynamics[segment] || segment);
|
|
65
|
-
const context =
|
|
65
|
+
const context = useGlobal();
|
|
66
66
|
context.set("args", [args.length > 0 ? args[0] : undefined, args.length > 1 ? args[1] : undefined, ...segments, ...args.slice(${segments.length + 2})].filter(Boolean) as string[]);
|
|
67
67
|
|
|
68
68
|
command = segments[0];
|
|
@@ -2,8 +2,8 @@ import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
|
2
2
|
import { For, code } from "@alloy-js/core";
|
|
3
3
|
import { IfStatement } from "@alloy-js/typescript";
|
|
4
4
|
import { getAppBin } from "@shell-shock/core/plugin-utils";
|
|
5
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
6
5
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
6
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
7
7
|
import { CommandRouter as CommandRouter$1, CommandRouterBody } from "@shell-shock/preset-script/components";
|
|
8
8
|
|
|
9
9
|
//#region src/components/command-router.tsx
|
|
@@ -33,7 +33,7 @@ function CommandRouter(props) {
|
|
|
33
33
|
})),
|
|
34
34
|
createComponent(Spacing, {}),
|
|
35
35
|
createComponent(IfStatement, {
|
|
36
|
-
condition: code`isInteractive && !isHelp`,
|
|
36
|
+
condition: code`isInteractive && !isHelp()`,
|
|
37
37
|
get children() {
|
|
38
38
|
return [
|
|
39
39
|
code`await showBanner();
|
|
@@ -60,7 +60,7 @@ function CommandRouter(props) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
segments = segments.map(segment => dynamics[segment] || segment);
|
|
63
|
-
const context =
|
|
63
|
+
const context = useGlobal();
|
|
64
64
|
context.set("args", [args.length > 0 ? args[0] : undefined, args.length > 1 ? args[1] : undefined, ...segments, ...args.slice(${segments.length + 2})].filter(Boolean) as string[]);
|
|
65
65
|
|
|
66
66
|
command = segments[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-router.mjs","names":[],"sources":["../../src/components/command-router.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, For } from \"@alloy-js/core\";\nimport { 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 { CommandTree } from \"@shell-shock/core\";\nimport { getAppBin } from \"@shell-shock/core/plugin-utils\";\nimport type { CommandRouterProps } from \"@shell-shock/preset-script/components\";\nimport {\n CommandRouter as BaseCommandRouter,\n CommandRouterBody\n} from \"@shell-shock/preset-script/components\";\nimport type { CLIPresetContext } from \"../types\";\n\nexport interface CommandRouterSelectOptionsProps {\n commands?: Record<string, CommandTree>;\n}\n\nexport function CommandRouterSelectOptions(\n props: CommandRouterSelectOptionsProps\n) {\n const { commands } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n\n return (\n <For each={Object.values(commands ?? {})} joiner=\",\" hardline>\n {command =>\n command.isVirtual ? (\n <CommandRouterSelectOptions commands={command.children ?? {}} />\n ) : (\n code`{ value: [${command.segments\n .map(segment => `\"${segment}\"`)\n .join(\n \", \"\n )}], label: \"${command.title}\", description: \\`(${getAppBin(\n context\n )} ${command.segments.join(\" \")})\\`${\n command.icon ? `, icon: \"${command.icon.trim()}\"` : \"\"\n } }`\n )\n }\n </For>\n );\n}\n\n/**\n * 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.\n */\nexport function CommandRouter(props: CommandRouterProps) {\n const { segments, commands } = props;\n\n return (\n <>\n <BaseCommandRouter {...props} segments={segments} commands={commands} />\n <Spacing />\n <IfStatement condition={code`isInteractive && !isHelp`}>\n {code`await showBanner();\n\n let segments = await select({\n message: \"Which command would you like to execute?\",\n options: [ `}\n <CommandRouterSelectOptions commands={commands} />\n {` ],\n });\n if (isCancel(segments)) {\n return;\n }\n\n let dynamics = {} as Record<string, string>;\n for (const dynamic of segments.filter(segment => segment.startsWith(\"[\") && segment.endsWith(\"]\"))) {\n const value = await text({\n message: \\`Please provide a value for \\${dynamic.replace(/^\\[+/, \"\").replace(/\\]+$/, \"\")}:\\`,\n });\n if (isCancel(value)) {\n return;\n }\n dynamics[dynamic] = value;\n }\n\n segments = segments.map(segment => dynamics[segment] || segment);\n const context =
|
|
1
|
+
{"version":3,"file":"command-router.mjs","names":[],"sources":["../../src/components/command-router.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, For } from \"@alloy-js/core\";\nimport { 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 { CommandTree } from \"@shell-shock/core\";\nimport { getAppBin } from \"@shell-shock/core/plugin-utils\";\nimport type { CommandRouterProps } from \"@shell-shock/preset-script/components\";\nimport {\n CommandRouter as BaseCommandRouter,\n CommandRouterBody\n} from \"@shell-shock/preset-script/components\";\nimport type { CLIPresetContext } from \"../types\";\n\nexport interface CommandRouterSelectOptionsProps {\n commands?: Record<string, CommandTree>;\n}\n\nexport function CommandRouterSelectOptions(\n props: CommandRouterSelectOptionsProps\n) {\n const { commands } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n\n return (\n <For each={Object.values(commands ?? {})} joiner=\",\" hardline>\n {command =>\n command.isVirtual ? (\n <CommandRouterSelectOptions commands={command.children ?? {}} />\n ) : (\n code`{ value: [${command.segments\n .map(segment => `\"${segment}\"`)\n .join(\n \", \"\n )}], label: \"${command.title}\", description: \\`(${getAppBin(\n context\n )} ${command.segments.join(\" \")})\\`${\n command.icon ? `, icon: \"${command.icon.trim()}\"` : \"\"\n } }`\n )\n }\n </For>\n );\n}\n\n/**\n * 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.\n */\nexport function CommandRouter(props: CommandRouterProps) {\n const { segments, commands } = props;\n\n return (\n <>\n <BaseCommandRouter {...props} segments={segments} commands={commands} />\n <Spacing />\n <IfStatement condition={code`isInteractive && !isHelp()`}>\n {code`await showBanner();\n\n let segments = await select({\n message: \"Which command would you like to execute?\",\n options: [ `}\n <CommandRouterSelectOptions commands={commands} />\n {` ],\n });\n if (isCancel(segments)) {\n return;\n }\n\n let dynamics = {} as Record<string, string>;\n for (const dynamic of segments.filter(segment => segment.startsWith(\"[\") && segment.endsWith(\"]\"))) {\n const value = await text({\n message: \\`Please provide a value for \\${dynamic.replace(/^\\[+/, \"\").replace(/\\]+$/, \"\")}:\\`,\n });\n if (isCancel(value)) {\n return;\n }\n dynamics[dynamic] = value;\n }\n\n segments = segments.map(segment => dynamics[segment] || segment);\n const context = useGlobal();\n context.set(\"args\", [args.length > 0 ? args[0] : undefined, args.length > 1 ? args[1] : undefined, ...segments, ...args.slice(${\n segments.length + 2\n })].filter(Boolean) as string[]);\n\n command = segments[0];\n args = context.get(\"args\"); `}\n <CommandRouterBody {...props} segments={segments} commands={commands} />\n </IfStatement>\n <Spacing />\n </>\n );\n}\n"],"mappings":";;;;;;;;;AA+BA,SAAgB,2BAAC,OAAgC;CAC/C,MAAA,EACF;CAEA,MAAO,UAAS,eAA0B;AACxC,QAAO,gBAAA,KAAA;EACP,IAAA,OAAA;AACA,UAAQ,OAAU,OAAG,YAAK,EAAA,CAAA;;EAE1B,QAAM;;EAEN,WAAO,YAAA,QAAA,YAAA,gBAAA,4BAAA,EACJ,IAAI,WAAY;AACd,UAAQ,QAAC,YAAA,EAAA;KAEX,CAAC,GAAG,IAAE,aAAA,QAAA,SAA2B,KAAS,YAAS,IAAA,QAAc,GAAG,CAAA,KAAA,KAAA,CAAA,aAAA,QAAA,MAAA,qBAAA,UAAA,QAAA,CAAA,GAAA,QAAA,SAAA,KAAA,IAAA,CAAA,KAAA,QAAA,OAAA,YAAA,QAAA,KAAA,MAAA,CAAA,KAAA,GAAA;EACtE,CAAC;;;;;AAMJ,SAAY,cAAA,OAAA;CACV,MAAM,EACJ,UACA,aACE;AACJ,QAAI;EAAA,gBAAA,iBAAA,WAAA,OAAA;GACG;GACN;GACH,CAAA,CAAA;EAAA,gBAAA,SAAA,EAAA,CAAA;EAAA,gBAAA,aAAA;;GAEE,IAAA,WAAA;AACG,WAAA;KAAS,IAAC;;;;;mDAKN,UACJ,CAAA;KAAA,WAAA;;;;;;;;;;;;;;;;;;;wIAmBmG,SAAA,SAAA,EAAA;;;sCAGtF;KAAA,gBAAA,mBAAA,WAAA,OAAA;MACR;MACQ;MACX,CAAC,CAAA;KAAA;;GAEL,CAAC;EAAE,gBAAa,SAAa,EAAA,CAAA;EAAA"}
|
|
@@ -4,9 +4,9 @@ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
|
4
4
|
let _alloy_js_core = require("@alloy-js/core");
|
|
5
5
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
6
6
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
7
|
-
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
8
7
|
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
9
8
|
let defu = require("defu");
|
|
9
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
10
10
|
let _shell_shock_plugin_upgrade_components_upgrade_builtin = require("@shell-shock/plugin-upgrade/components/upgrade-builtin");
|
|
11
11
|
|
|
12
12
|
//#region src/components/upgrade-builtin.tsx
|
|
@@ -48,7 +48,7 @@ function ExecuteUpgradeFunctionDeclaration() {
|
|
|
48
48
|
condition: _alloy_js_core.code`(result as CheckForUpdatesErrorResult)?.isError`,
|
|
49
49
|
get children() {
|
|
50
50
|
return _alloy_js_core.code`spinner.error(\`An error occurred while checking for ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} application updates. Please try again later - if the problem persists, please contact support.\`);
|
|
51
|
-
debug(result.error); `;
|
|
51
|
+
debug((result as CheckForUpdatesErrorResult).error); `;
|
|
52
52
|
}
|
|
53
53
|
}),
|
|
54
54
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
@@ -60,7 +60,7 @@ function ExecuteUpgradeFunctionDeclaration() {
|
|
|
60
60
|
},
|
|
61
61
|
get fallback() {
|
|
62
62
|
return [(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`spinner.stop();
|
|
63
|
-
info(\`A new version of ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} is available: \${red(\`v\${result.currentVersion}\`)} \${textColors.body.tertiary("➜")} \${green(\`v\${result.latestVersion}\`)}\${result.package.date ? textColors.body.tertiary(\` (updated on \${result.package.date})\`) : ""}\`);
|
|
63
|
+
info(\`A new version of ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} is available: \${red(\`v\${(result as CheckForUpdatesSuccessResult).currentVersion}\`)} \${textColors.body.tertiary("➜")} \${green(\`v\${(result as CheckForUpdatesSuccessResult).latestVersion}\`)}\${(result as CheckForUpdatesSuccessResult).package.date ? textColors.body.tertiary(\` (updated on \${(result as CheckForUpdatesSuccessResult).package.date})\`) : ""}\`);
|
|
64
64
|
|
|
65
65
|
try {
|
|
66
66
|
await upgrade();
|
|
@@ -72,14 +72,14 @@ function ExecuteUpgradeFunctionDeclaration() {
|
|
|
72
72
|
await waitForKeyPress();
|
|
73
73
|
return;
|
|
74
74
|
} catch (err) {
|
|
75
|
-
spinner.error(\`An error occurred while updating ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} to v\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\`);
|
|
75
|
+
spinner.error(\`An error occurred while updating ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} to v\${(result as CheckForUpdatesSuccessResult).latestVersion}. Please try again later - if the problem persists, please contact support.\`);
|
|
76
76
|
debug(err);
|
|
77
77
|
} `), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})];
|
|
78
78
|
},
|
|
79
79
|
get children() {
|
|
80
80
|
return [
|
|
81
81
|
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`spinner.stop();
|
|
82
|
-
warn(\`A new version of ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} is available: \${red(\`v\${result.currentVersion}\`)} \${textColors.body.tertiary("➜")} \${green(\`v\${result.latestVersion}\`)}\${result.package.date ? textColors.body.tertiary(\` (updated on \${result.package.date})\`) : ""}${context.config.upgradeType !== false && context.config.upgradeType === "manual" ? ` \\nPlease run \`${(0, _shell_shock_core_plugin_utils.getAppBin)(context)} upgrade\` to upgrade to the latest version.` : ""}\`); `),
|
|
82
|
+
warn(\`A new version of ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} is available: \${red(\`v\${(result as CheckForUpdatesSuccessResult).currentVersion}\`)} \${textColors.body.tertiary("➜")} \${green(\`v\${(result as CheckForUpdatesSuccessResult).latestVersion}\`)}\${(result as CheckForUpdatesSuccessResult).package.date ? textColors.body.tertiary(\` (updated on \${(result as CheckForUpdatesSuccessResult).package.date})\`) : ""}${context.config.upgradeType !== false && context.config.upgradeType === "manual" ? ` \\nPlease run \`${(0, _shell_shock_core_plugin_utils.getAppBin)(context)} upgrade\` to upgrade to the latest version.` : ""}\`); `),
|
|
83
83
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
84
84
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
85
85
|
get when() {
|
|
@@ -87,7 +87,7 @@ function ExecuteUpgradeFunctionDeclaration() {
|
|
|
87
87
|
},
|
|
88
88
|
get children() {
|
|
89
89
|
return _alloy_js_core.code`const willUpgradeNow = await confirm({
|
|
90
|
-
message: \`Would you like to update to v\${result.latestVersion} now?\`,
|
|
90
|
+
message: \`Would you like to update to v\${(result as CheckForUpdatesSuccessResult).latestVersion} now?\`,
|
|
91
91
|
initialValue: true
|
|
92
92
|
});
|
|
93
93
|
if (isCancel(willUpgradeNow)) {
|
|
@@ -95,7 +95,7 @@ function ExecuteUpgradeFunctionDeclaration() {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
if (willUpgradeNow) {
|
|
98
|
-
spinner.text = \`Updating ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} to v\${result.latestVersion}...\`;
|
|
98
|
+
spinner.text = \`Updating ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} to v\${(result as CheckForUpdatesSuccessResult).latestVersion}...\`;
|
|
99
99
|
spinner.start();
|
|
100
100
|
|
|
101
101
|
try {
|
|
@@ -108,7 +108,7 @@ function ExecuteUpgradeFunctionDeclaration() {
|
|
|
108
108
|
await waitForKeyPress();
|
|
109
109
|
return;
|
|
110
110
|
} catch (err) {
|
|
111
|
-
spinner.error(\`An error occurred while updating ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} to v\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\`);
|
|
111
|
+
spinner.error(\`An error occurred while updating ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} to v\${(result as CheckForUpdatesSuccessResult).latestVersion}. Please try again later - if the problem persists, please contact support.\`);
|
|
112
112
|
return { error: err };
|
|
113
113
|
}
|
|
114
114
|
} else {
|