@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.
Files changed (52) hide show
  1. package/dist/components/banner-builtin.cjs +2 -2
  2. package/dist/components/banner-builtin.d.cts.map +1 -1
  3. package/dist/components/banner-builtin.d.mts.map +1 -1
  4. package/dist/components/banner-builtin.mjs +2 -2
  5. package/dist/components/banner-builtin.mjs.map +1 -1
  6. package/dist/components/command-entry.cjs +21 -12
  7. package/dist/components/command-entry.mjs +20 -11
  8. package/dist/components/command-entry.mjs.map +1 -1
  9. package/dist/components/command-router.cjs +3 -3
  10. package/dist/components/command-router.mjs +3 -3
  11. package/dist/components/command-router.mjs.map +1 -1
  12. package/dist/components/upgrade-builtin.cjs +8 -8
  13. package/dist/components/upgrade-builtin.mjs +8 -8
  14. package/dist/components/upgrade-builtin.mjs.map +1 -1
  15. package/dist/components/virtual-command-entry.cjs +13 -5
  16. package/dist/components/virtual-command-entry.mjs +13 -5
  17. package/dist/components/virtual-command-entry.mjs.map +1 -1
  18. package/dist/helpers/{get-default-options.cjs → get-global-options.cjs} +5 -5
  19. package/dist/helpers/{get-default-options.mjs → get-global-options.mjs} +6 -6
  20. package/dist/helpers/get-global-options.mjs.map +1 -0
  21. package/dist/index.cjs +9 -9
  22. package/dist/index.d.cts.map +1 -1
  23. package/dist/index.d.mts.map +1 -1
  24. package/dist/index.mjs +9 -9
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/node_modules/.pnpm/@stryke_types@0.11.3/node_modules/@stryke/types/dist/base.d.cts +17 -0
  27. package/dist/node_modules/.pnpm/@stryke_types@0.11.3/node_modules/@stryke/types/dist/base.d.cts.map +1 -0
  28. package/dist/node_modules/.pnpm/@stryke_types@0.11.3/node_modules/@stryke/types/dist/base.d.mts +17 -0
  29. package/dist/node_modules/.pnpm/@stryke_types@0.11.3/node_modules/@stryke/types/dist/base.d.mts.map +1 -0
  30. package/dist/packages/plugin-changelog/dist/components/changelog-command.mjs +130 -0
  31. package/dist/packages/plugin-changelog/dist/components/changelog-command.mjs.map +1 -0
  32. package/dist/packages/plugin-changelog/dist/components/index.mjs +3 -0
  33. package/dist/packages/plugin-changelog/dist/index.d.cts +2 -0
  34. package/dist/packages/plugin-changelog/dist/index.d.mts +2 -0
  35. package/dist/packages/plugin-changelog/dist/index.mjs +52 -0
  36. package/dist/packages/plugin-changelog/dist/index.mjs.map +1 -0
  37. package/dist/packages/plugin-changelog/dist/types/plugin.d.cts +43 -0
  38. package/dist/packages/plugin-changelog/dist/types/plugin.d.cts.map +1 -0
  39. package/dist/packages/plugin-changelog/dist/types/plugin.d.mts +43 -0
  40. package/dist/packages/plugin-changelog/dist/types/plugin.d.mts.map +1 -0
  41. package/dist/packages/unified/dist/markdown/index.mjs +6 -0
  42. package/dist/packages/unified/dist/markdown/index.mjs.map +1 -0
  43. package/dist/plugin-changelog/dist/components/changelog-command.cjs +130 -0
  44. package/dist/plugin-changelog/dist/components/index.cjs +1 -0
  45. package/dist/plugin-changelog/dist/index.cjs +53 -0
  46. package/dist/types/plugin.d.cts +11 -6
  47. package/dist/types/plugin.d.cts.map +1 -1
  48. package/dist/types/plugin.d.mts +11 -6
  49. package/dist/types/plugin.d.mts.map +1 -1
  50. package/dist/unified/dist/markdown/index.cjs +6 -0
  51. package/package.json +21 -20
  52. package/dist/helpers/get-default-options.mjs.map +0 -1
@@ -2,9 +2,9 @@ import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
2
2
  import { Show, code, splitProps } from "@alloy-js/core";
3
3
  import { ElseClause, ElseIfClause, FunctionDeclaration, IfStatement, VarDeclaration } from "@alloy-js/typescript";
4
4
  import { getAppBin, getAppTitle } 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";
7
6
  import { defu as defu$1 } from "defu";
7
+ import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
8
8
  import { UpgradeBuiltin as UpgradeBuiltin$1 } from "@shell-shock/plugin-upgrade/components/upgrade-builtin";
9
9
 
10
10
  //#region src/components/upgrade-builtin.tsx
@@ -46,7 +46,7 @@ function ExecuteUpgradeFunctionDeclaration() {
46
46
  condition: code`(result as CheckForUpdatesErrorResult)?.isError`,
47
47
  get children() {
48
48
  return code`spinner.error(\`An error occurred while checking for ${getAppTitle(context, true)} application updates. Please try again later - if the problem persists, please contact support.\`);
49
- debug(result.error); `;
49
+ debug((result as CheckForUpdatesErrorResult).error); `;
50
50
  }
51
51
  }),
52
52
  createComponent(ElseIfClause, {
@@ -58,7 +58,7 @@ function ExecuteUpgradeFunctionDeclaration() {
58
58
  },
59
59
  get fallback() {
60
60
  return [memo(() => code`spinner.stop();
61
- info(\`A new version of ${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})\`) : ""}\`);
61
+ info(\`A new version of ${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})\`) : ""}\`);
62
62
 
63
63
  try {
64
64
  await upgrade();
@@ -70,14 +70,14 @@ function ExecuteUpgradeFunctionDeclaration() {
70
70
  await waitForKeyPress();
71
71
  return;
72
72
  } catch (err) {
73
- spinner.error(\`An error occurred while updating ${getAppTitle(context, true)} to v\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\`);
73
+ spinner.error(\`An error occurred while updating ${getAppTitle(context, true)} to v\${(result as CheckForUpdatesSuccessResult).latestVersion}. Please try again later - if the problem persists, please contact support.\`);
74
74
  debug(err);
75
75
  } `), createComponent(Spacing, {})];
76
76
  },
77
77
  get children() {
78
78
  return [
79
79
  memo(() => code`spinner.stop();
80
- warn(\`A new version of ${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 \`${getAppBin(context)} upgrade\` to upgrade to the latest version.` : ""}\`); `),
80
+ warn(\`A new version of ${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 \`${getAppBin(context)} upgrade\` to upgrade to the latest version.` : ""}\`); `),
81
81
  createComponent(Spacing, {}),
82
82
  createComponent(Show, {
83
83
  get when() {
@@ -85,7 +85,7 @@ function ExecuteUpgradeFunctionDeclaration() {
85
85
  },
86
86
  get children() {
87
87
  return code`const willUpgradeNow = await confirm({
88
- message: \`Would you like to update to v\${result.latestVersion} now?\`,
88
+ message: \`Would you like to update to v\${(result as CheckForUpdatesSuccessResult).latestVersion} now?\`,
89
89
  initialValue: true
90
90
  });
91
91
  if (isCancel(willUpgradeNow)) {
@@ -93,7 +93,7 @@ function ExecuteUpgradeFunctionDeclaration() {
93
93
  }
94
94
 
95
95
  if (willUpgradeNow) {
96
- spinner.text = \`Updating ${getAppTitle(context, true)} to v\${result.latestVersion}...\`;
96
+ spinner.text = \`Updating ${getAppTitle(context, true)} to v\${(result as CheckForUpdatesSuccessResult).latestVersion}...\`;
97
97
  spinner.start();
98
98
 
99
99
  try {
@@ -106,7 +106,7 @@ function ExecuteUpgradeFunctionDeclaration() {
106
106
  await waitForKeyPress();
107
107
  return;
108
108
  } catch (err) {
109
- spinner.error(\`An error occurred while updating ${getAppTitle(context, true)} to v\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\`);
109
+ spinner.error(\`An error occurred while updating ${getAppTitle(context, true)} to v\${(result as CheckForUpdatesSuccessResult).latestVersion}. Please try again later - if the problem persists, please contact support.\`);
110
110
  return { error: err };
111
111
  }
112
112
  } else {
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade-builtin.mjs","names":[],"sources":["../../src/components/upgrade-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, Show, splitProps } from \"@alloy-js/core\";\nimport {\n ElseClause,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { getAppBin, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport type { UpgradeBuiltinProps } from \"@shell-shock/plugin-upgrade/components/upgrade-builtin\";\nimport { UpgradeBuiltin as BaseUpgradeBuiltin } from \"@shell-shock/plugin-upgrade/components/upgrade-builtin\";\nimport { defu } from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\n\n/**\n * A component to generate the `executeUpgrade` function in the `shell-shock:upgrade` builtin module.\n */\nexport function ExecuteUpgradeFunctionDeclaration() {\n const context = usePowerlines<CLIPresetContext>();\n\n return (\n <Show when={context.config.upgradeType !== false}>\n <FunctionDeclaration\n export\n async\n name=\"executeUpgrade\"\n doc={`Run upgrade processing for the ${getAppTitle(\n context,\n true\n )} application.`}>\n <IfStatement condition={code`await isCheckForUpdatesRequired()`}>\n <VarDeclaration\n const\n name=\"spinner\"\n initializer={code`createSpinner({\n message: \"Checking for updates...\"\n }).start(); `}\n />\n <VarDeclaration\n const\n name=\"result\"\n initializer={code`await checkForUpdates({ force: true }); `}\n />\n <IfStatement\n condition={code`(result as CheckForUpdatesErrorResult)?.isError`}>\n {code`spinner.error(\\`An error occurred while checking for ${getAppTitle(\n context,\n true\n )} application updates. Please try again later - if the problem persists, please contact support.\\`);\n debug(result.error); `}\n </IfStatement>\n <ElseIfClause\n condition={code`!(result as CheckForUpdatesSuccessResult)?.isUpToDate`}>\n <Show\n when={\n context.config.upgradeType !== false &&\n (context.config.upgradeType === \"confirm\" ||\n context.config.upgradeType === \"manual\")\n }\n fallback={\n <>\n {code`spinner.stop();\n info(\\`A new version of ${getAppTitle(\n context,\n true\n )} is available: \\${red(\\`v\\${result.currentVersion}\\`)} \\${textColors.body.tertiary(\"➜\")} \\${green(\\`v\\${result.latestVersion}\\`)}\\${result.package.date ? textColors.body.tertiary(\\` (updated on \\${result.package.date})\\`) : \"\"}\\`);\n\n try {\n await upgrade();\n spinner.success(\"Update successful! Please restart the application to apply the update.\");\n\n writeLine(\"\");\n writeLine(\"Press any key to exit the application...\");\n\n await waitForKeyPress();\n return;\n } catch (err) {\n spinner.error(\\`An error occurred while updating ${getAppTitle(\n context,\n true\n )} to v\\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\\`);\n debug(err);\n } `}\n <Spacing />\n </>\n }>\n {code`spinner.stop();\n warn(\\`A new version of ${getAppTitle(\n context,\n true\n )} is available: \\${red(\\`v\\${result.currentVersion}\\`)} \\${textColors.body.tertiary(\"➜\")} \\${green(\\`v\\${result.latestVersion}\\`)}\\${result.package.date ? textColors.body.tertiary(\\` (updated on \\${result.package.date})\\`) : \"\"}${\n context.config.upgradeType !== false &&\n context.config.upgradeType === \"manual\"\n ? ` \\\\nPlease run \\`${getAppBin(\n context\n )} upgrade\\` to upgrade to the latest version.`\n : \"\"\n }\\`); `}\n <Spacing />\n <Show\n when={\n context.config.upgradeType !== false &&\n context.config.upgradeType === \"confirm\"\n }>\n {code`const willUpgradeNow = await confirm({\n message: \\`Would you like to update to v\\${result.latestVersion} now?\\`,\n initialValue: true\n });\n if (isCancel(willUpgradeNow)) {\n return;\n }\n\n if (willUpgradeNow) {\n spinner.text = \\`Updating ${getAppTitle(\n context,\n true\n )} to v\\${result.latestVersion}...\\`;\n spinner.start();\n\n try {\n await upgrade();\n spinner.success(\"Update successful! Please restart the application to apply the update.\");\n\n writeLine(\"\");\n writeLine(\"Press any key to exit the application...\");\n\n await waitForKeyPress();\n return;\n } catch (err) {\n spinner.error(\\`An error occurred while updating ${getAppTitle(\n context,\n true\n )} to v\\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\\`);\n return { error: err };\n }\n } else {\n help(\"Updates can be performed at any time by running the \\`${getAppBin(\n context\n )} upgrade\\` command. Please remember that keeping your application up to date is important for ensuring you have the latest features, performance improvements, and security patches.\");\n } `}\n </Show>\n </Show>\n </ElseIfClause>\n <ElseClause>{code`spinner.success(\"Currently running the latest version of ${getAppTitle(\n context,\n true\n )}.\");\n writeLine(\"\");\n `}</ElseClause>\n </IfStatement>\n </FunctionDeclaration>\n </Show>\n );\n}\n\n/**\n * A built-in upgrade module for Shell Shock.\n */\nexport function UpgradeBuiltin(props: UpgradeBuiltinProps) {\n const [{ children, builtinImports }, rest] = splitProps(props, [\n \"children\",\n \"builtinImports\"\n ]);\n\n return (\n <BaseUpgradeBuiltin\n {...rest}\n builtinImports={defu(builtinImports ?? {}, {\n console: [\"createSpinner\", \"debug\", \"info\"],\n prompts: [\"waitForKeyPress\"]\n })}>\n <ExecuteUpgradeFunctionDeclaration />\n <Spacing />\n <Show when={Boolean(children)}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,CAAA;;;;gFAIsC,UAAA,QAAA,CAAA;;;cAGzC,CAAA;aAAA;;WAEA,CAAA;;;sCAGF,IAAI,WAAA;AACF,gBAAO,IAAC,4DAA+B,YAAA,SAAA,KAAA,CAAA;;;WAI1C,CAAC;QAAC;;MAEN,CAAC;;IAEL,CAAC;;EAEL,CAAC;;;;;AAMJ,SAAgB,eAAY,OAA+B;CACzD,MAAM,CAAC,EACL,UACA,kBACC,QAAQ,WAAO,OAAS,CAAA,YAAY,iBAAA,CAAA;AACvC,QAAO,gBAAS,kBAAA,WAAA,MAAA;EACd,IAAI,iBAAe;AACjB,UAAO,OAAK,kBAAkB,EAAE,EAAC;IAC/B,SAAS;KAAC;KAAE;KAAA;KAAA;IACZ,SAAS,CAAC,kBAAa;IACxB,CAAC;;EAEJ,IAAI,WAAU;AACZ,UAAM;IAAA,gBAAY,mCAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,MAAA;KAChB,IAAG,OAAA;AACD,aAAE,QAAO,SAAA;;KAEJ;KACR,CAAC;IAAC;;EAEN,CAAC,CAAC"}
1
+ {"version":3,"file":"upgrade-builtin.mjs","names":[],"sources":["../../src/components/upgrade-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, Show, splitProps } from \"@alloy-js/core\";\nimport {\n ElseClause,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { getAppBin, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport type { UpgradeBuiltinProps } from \"@shell-shock/plugin-upgrade/components/upgrade-builtin\";\nimport { UpgradeBuiltin as BaseUpgradeBuiltin } from \"@shell-shock/plugin-upgrade/components/upgrade-builtin\";\nimport { defu } from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\n\n/**\n * A component to generate the `executeUpgrade` function in the `shell-shock:upgrade` builtin module.\n */\nexport function ExecuteUpgradeFunctionDeclaration() {\n const context = usePowerlines<CLIPresetContext>();\n\n return (\n <Show when={context.config.upgradeType !== false}>\n <FunctionDeclaration\n export\n async\n name=\"executeUpgrade\"\n doc={`Run upgrade processing for the ${getAppTitle(\n context,\n true\n )} application.`}>\n <IfStatement condition={code`await isCheckForUpdatesRequired()`}>\n <VarDeclaration\n const\n name=\"spinner\"\n initializer={code`createSpinner({\n message: \"Checking for updates...\"\n }).start(); `}\n />\n <VarDeclaration\n const\n name=\"result\"\n initializer={code`await checkForUpdates({ force: true }); `}\n />\n <IfStatement\n condition={code`(result as CheckForUpdatesErrorResult)?.isError`}>\n {code`spinner.error(\\`An error occurred while checking for ${getAppTitle(\n context,\n true\n )} application updates. Please try again later - if the problem persists, please contact support.\\`);\n debug((result as CheckForUpdatesErrorResult).error); `}\n </IfStatement>\n <ElseIfClause\n condition={code`!(result as CheckForUpdatesSuccessResult)?.isUpToDate`}>\n <Show\n when={\n context.config.upgradeType !== false &&\n (context.config.upgradeType === \"confirm\" ||\n context.config.upgradeType === \"manual\")\n }\n fallback={\n <>\n {code`spinner.stop();\n info(\\`A new version of ${getAppTitle(\n context,\n true\n )} 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})\\`) : \"\"}\\`);\n\n try {\n await upgrade();\n spinner.success(\"Update successful! Please restart the application to apply the update.\");\n\n writeLine(\"\");\n writeLine(\"Press any key to exit the application...\");\n\n await waitForKeyPress();\n return;\n } catch (err) {\n spinner.error(\\`An error occurred while updating ${getAppTitle(\n context,\n true\n )} to v\\${(result as CheckForUpdatesSuccessResult).latestVersion}. Please try again later - if the problem persists, please contact support.\\`);\n debug(err);\n } `}\n <Spacing />\n </>\n }>\n {code`spinner.stop();\n warn(\\`A new version of ${getAppTitle(\n context,\n true\n )} 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})\\`) : \"\"}${\n context.config.upgradeType !== false &&\n context.config.upgradeType === \"manual\"\n ? ` \\\\nPlease run \\`${getAppBin(\n context\n )} upgrade\\` to upgrade to the latest version.`\n : \"\"\n }\\`); `}\n <Spacing />\n <Show\n when={\n context.config.upgradeType !== false &&\n context.config.upgradeType === \"confirm\"\n }>\n {code`const willUpgradeNow = await confirm({\n message: \\`Would you like to update to v\\${(result as CheckForUpdatesSuccessResult).latestVersion} now?\\`,\n initialValue: true\n });\n if (isCancel(willUpgradeNow)) {\n return;\n }\n\n if (willUpgradeNow) {\n spinner.text = \\`Updating ${getAppTitle(\n context,\n true\n )} to v\\${(result as CheckForUpdatesSuccessResult).latestVersion}...\\`;\n spinner.start();\n\n try {\n await upgrade();\n spinner.success(\"Update successful! Please restart the application to apply the update.\");\n\n writeLine(\"\");\n writeLine(\"Press any key to exit the application...\");\n\n await waitForKeyPress();\n return;\n } catch (err) {\n spinner.error(\\`An error occurred while updating ${getAppTitle(\n context,\n true\n )} to v\\${(result as CheckForUpdatesSuccessResult).latestVersion}. Please try again later - if the problem persists, please contact support.\\`);\n return { error: err };\n }\n } else {\n help(\"Updates can be performed at any time by running the \\`${getAppBin(\n context\n )} upgrade\\` command. Please remember that keeping your application up to date is important for ensuring you have the latest features, performance improvements, and security patches.\");\n } `}\n </Show>\n </Show>\n </ElseIfClause>\n <ElseClause>{code`spinner.success(\"Currently running the latest version of ${getAppTitle(\n context,\n true\n )}.\");\n writeLine(\"\");\n `}</ElseClause>\n </IfStatement>\n </FunctionDeclaration>\n </Show>\n );\n}\n\n/**\n * A built-in upgrade module for Shell Shock.\n */\nexport function UpgradeBuiltin(props: UpgradeBuiltinProps) {\n const [{ children, builtinImports }, rest] = splitProps(props, [\n \"children\",\n \"builtinImports\"\n ]);\n\n return (\n <BaseUpgradeBuiltin\n {...rest}\n builtinImports={defu(builtinImports ?? {}, {\n console: [\"createSpinner\", \"debug\", \"info\"],\n prompts: [\"waitForKeyPress\"]\n })}>\n <ExecuteUpgradeFunctionDeclaration />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BaseUpgradeBuiltin>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAgCA,SAAc,oCAAkC;;AAE9C,QAAA,gBAAA,MAAA;EACE,IAAC,OAAU;AACb,UAAA,QAAA,OAAA,gBAAA;;EAEA,IAAM,WAAU;;IAEV,UAAC;IACJ,OAAU;IACR,MAAA;IACC,IAAA,MAAA;AACA,YAAA,kCAAA,YAAA,SAAA,KAAA,CAAA;;IAEA,IAAI,WAAM;AACR,YAAO,gBAAA,aAAA;MACP,WAAA,IAAA;MACC,IAAA,WAAc;AAChB,cAAY;QAAA,gBAAgB,gBAAM;SAChC,SAAA;SACC,MAAA;SACI,aAAS,IAAA;;;SAGV,CAAC;QAAC,gBAAU,gBAAA;SAChB,SAAA;SACA,MAAA;SACC,aAAA,IAAA;SACA,CAAI;QAAE,gBAAM,aAAA;SACZ,WAAa,IAAK;SACnB,IAAA,WAAA;AACA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EAAA,CAAA;IAAA,gBAAA,MAAA;KAChB,IAAG,OAAA;AACD,aAAE,QAAO,SAAA;;KAEJ;KACR,CAAC;IAAC;;EAEN,CAAC,CAAC"}
@@ -8,9 +8,9 @@ let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy
8
8
  let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
9
9
  let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
10
10
  let _stryke_path_join = require("@stryke/path/join");
11
- let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
12
11
  let defu = require("defu");
13
12
  defu = require_runtime.__toESM(defu);
13
+ let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
14
14
  let _powerlines_plugin_alloy_typescript_components_typescript_file = require("@powerlines/plugin-alloy/typescript/components/typescript-file");
15
15
  let _shell_shock_preset_script_components_virtual_command_entry = require("@shell-shock/preset-script/components/virtual-command-entry");
16
16
 
@@ -46,19 +46,27 @@ function VirtualCommandEntry(props) {
46
46
  "table",
47
47
  "writeLine",
48
48
  "splitText",
49
+ "textColors",
49
50
  "stripAnsi"
50
51
  ],
51
52
  utils: [
52
- "useApp",
53
- "useArgs",
54
- "hasFlag",
55
53
  "isMinimal",
56
54
  "isUnicodeSupported",
57
55
  "isInteractive",
58
- "isHelp",
59
56
  "findSuggestions",
60
57
  "sleep"
61
58
  ],
59
+ state: [
60
+ "useGlobal",
61
+ "withCommand",
62
+ "useArgs",
63
+ "hasFlag",
64
+ "isHelp",
65
+ {
66
+ name: "GlobalOptions",
67
+ type: true
68
+ }
69
+ ],
62
70
  prompts: [
63
71
  "text",
64
72
  "numeric",
@@ -6,8 +6,8 @@ import { Spacing } from "@powerlines/plugin-alloy/core/components";
6
6
  import { isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
7
7
  import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
8
8
  import { joinPaths } from "@stryke/path/join";
9
- import { pascalCase } from "@stryke/string-format/pascal-case";
10
9
  import defu from "defu";
10
+ import { pascalCase } from "@stryke/string-format/pascal-case";
11
11
  import { TypescriptFile } from "@powerlines/plugin-alloy/typescript/components/typescript-file";
12
12
  import { VirtualCommandHandlerDeclaration } from "@shell-shock/preset-script/components/virtual-command-entry";
13
13
 
@@ -43,19 +43,27 @@ function VirtualCommandEntry(props) {
43
43
  "table",
44
44
  "writeLine",
45
45
  "splitText",
46
+ "textColors",
46
47
  "stripAnsi"
47
48
  ],
48
49
  utils: [
49
- "useApp",
50
- "useArgs",
51
- "hasFlag",
52
50
  "isMinimal",
53
51
  "isUnicodeSupported",
54
52
  "isInteractive",
55
- "isHelp",
56
53
  "findSuggestions",
57
54
  "sleep"
58
55
  ],
56
+ state: [
57
+ "useGlobal",
58
+ "withCommand",
59
+ "useArgs",
60
+ "hasFlag",
61
+ "isHelp",
62
+ {
63
+ name: "GlobalOptions",
64
+ type: true
65
+ }
66
+ ],
59
67
  prompts: [
60
68
  "text",
61
69
  "numeric",
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-command-entry.mjs","names":[],"sources":["../../src/components/virtual-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 { computed, For, Show } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { TypescriptFileImports } from \"@powerlines/plugin-alloy/types/components\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport type { CommandTree } from \"@shell-shock/core\";\nimport { isDynamicPathSegment } from \"@shell-shock/core/plugin-utils\";\nimport { VirtualCommandHandlerDeclaration } from \"@shell-shock/preset-script/components/virtual-command-entry\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\n\nexport interface VirtualCommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The virtual command entry point for the Shell Shock project.\n */\nexport function VirtualCommandEntry(props: VirtualCommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"isDevelopment\", \"isDebug\"],\n console: [\n \"warn\",\n \"error\",\n \"info\",\n \"help\",\n \"table\",\n \"writeLine\",\n \"splitText\",\n \"stripAnsi\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"isInteractive\",\n \"isHelp\",\n \"findSuggestions\",\n \"sleep\"\n ],\n prompts: [\"text\", \"numeric\", \"toggle\", \"select\", \"isCancel\"],\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 })}>\n <Spacing />\n <VirtualCommandHandlerDeclaration command={command}>\n <CommandRouter\n segments={command.segments}\n commands={command.children}\n />\n </VirtualCommandHandlerDeclaration>\n </TypescriptFile>\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":";;;;;;;;;;;;;;;;;AAyCA,SAAE,oBAAA,OAAA;CACA,MAAK,EACL,SACF,SACE,4BAEA;CACA,MAAM,UAAU,eAAc;CAC9B,MAAE,WAAS,eAAA,UAAA,QAAA,WAAA,QAAA,SAAA,QAAA,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,KAAA,IAAA,EAAA,WAAA,CAAA;AACX,QAAI,CAAA,gBAAiB,gBAAA,WAAA,MAAA;EACnB,IAAE,OAAQ;AACR,UAAG,SAAO;;EAEZ,IAAG,UAAQ;AACX,UAAA,KAAA,WAAA,EAAA,EAAA,OAAA,QAAA,QAAA,SAAA,CAAA,QAAA,GAAA,WAAA,MAAA,UAAA,CAAA,QAAA,KAAA,CAAA,MAAA,WAAA;AACD,QAAA,KAAA,MAAA,UAAA,CAAA;;KAEM,OAAA,SAAA,WAAA,KAAA;KACJ,CAAA;AACE,WAAA;MACE,EAAE,CAAK,CAAA;;EAEZ,IAAI,iBAAa;AACf,UAAI,KAAQ,kBAAK,EAAA,EAAA;IACf,KAAE,CAAA,iBAAe,UAAgB;IACjC,SAAK;KAAA;KAAW;KAAW;KAAM;KAAS;KAAA;KAAA;KAAA;KAAA;IAC1C,OAAK;KAAA;KAAa;KAAO;KAAW;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IACpC,SAAS;KAAC;KAAK;KAAc;KAAE;KAAA;KAAA;KAC9B,UAAS,QAAO,GAAA,QAAU,SAAQ,QAAQ,YAAW,CAAI,qBAAI,QAAA,CAAA,CAAA,GAAA,CAAA,WAAA;KAC7D,UAAM,UAAA,GAAA,QAAA,SAAA,QAAA,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,GAAA,CAAA,aAAA;;;EAGX,IAAI,WAAU;AACZ,UAAG,CAAA,gBAAA,SAAA,EAAA,CAAA,EAAA,gBAAA,kCAAA;IACD;IACA,IAAE,WAAO;AACP,YAAO,gBAAE,eAAA;MACP,IAAC,WAAK;AACL,cAAM,QAAA;;MAEP,IAAC,WAAK;AACL,cAAM,QAAA;;MAER,CAAC;;IAEL,CAAC,CAAC;;EAEN,CAAC,CAAC,EAAE,gBAAa,KAAA;EAChB,IAAI,OAAK;AACP,UAAO,OAAO,OAAC,QAAA,SAAA;;EAEjB,WAAS,UAAA,gBAAmB,MAAA;GAC1B,IAAI,OAAG;AACL,WAAK,MAAO;;GAEd,IAAI,WAAQ;AACV,WAAG,gBAAA,cAAA,EACD,SAAS,OACV,CAAC;;GAEJ,IAAI,WAAK;AACP,WAAM,gBAAY,qBAA4B,EAC5C,SAAE,OACH,CAAC;;GAEL,CAAC;EACH,CAAC,CAAC"}
1
+ {"version":3,"file":"virtual-command-entry.mjs","names":[],"sources":["../../src/components/virtual-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 { computed, For, Show } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { TypescriptFileImports } from \"@powerlines/plugin-alloy/types/components\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport type { CommandTree } from \"@shell-shock/core\";\nimport { isDynamicPathSegment } from \"@shell-shock/core/plugin-utils\";\nimport { VirtualCommandHandlerDeclaration } from \"@shell-shock/preset-script/components/virtual-command-entry\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\n\nexport interface VirtualCommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The virtual command entry point for the Shell Shock project.\n */\nexport function VirtualCommandEntry(props: VirtualCommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"isDevelopment\", \"isDebug\"],\n console: [\n \"warn\",\n \"error\",\n \"info\",\n \"help\",\n \"table\",\n \"writeLine\",\n \"splitText\",\n \"textColors\",\n \"stripAnsi\"\n ],\n utils: [\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"isInteractive\",\n \"findSuggestions\",\n \"sleep\"\n ],\n state: [\n \"useGlobal\",\n \"withCommand\",\n \"useArgs\",\n \"hasFlag\",\n \"isHelp\",\n { name: \"GlobalOptions\", type: true }\n ],\n prompts: [\"text\", \"numeric\", \"toggle\", \"select\", \"isCancel\"],\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 })}>\n <Spacing />\n <VirtualCommandHandlerDeclaration command={command}>\n <CommandRouter\n segments={command.segments}\n commands={command.children}\n />\n </VirtualCommandHandlerDeclaration>\n </TypescriptFile>\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":";;;;;;;;;;;;;;;;;AAyCA,SAAE,oBAAA,OAAA;CACA,MAAK,EACL,SACF,SACE,4BAEA;CACA,MAAM,UAAU,eAAc;CAC9B,MAAE,WAAS,eAAA,UAAA,QAAA,WAAA,QAAA,SAAA,QAAA,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,KAAA,IAAA,EAAA,WAAA,CAAA;AACX,QAAI,CAAA,gBAAiB,gBAAA,WAAA,MAAA;EACnB,IAAE,OAAQ;AACR,UAAG,SAAO;;EAEZ,IAAG,UAAQ;AACX,UAAA,KAAA,WAAA,EAAA,EAAA,OAAA,QAAA,QAAA,SAAA,CAAA,QAAA,GAAA,WAAA,MAAA,UAAA,CAAA,QAAA,KAAA,CAAA,MAAA,WAAA;AACD,QAAA,KAAA,MAAA,UAAA,CAAA;;KAEM,OAAA,SAAA,WAAA,KAAA;KACJ,CAAA;AACE,WAAA;MACE,EAAE,CAAK,CAAA;;EAEZ,IAAI,iBAAa;AACf,UAAI,KAAQ,kBAAK,EAAA,EAAA;IACf,KAAE,CAAA,iBAAe,UAAgB;IACjC,SAAK;KAAA;KAAW;KAAW;KAAM;KAAS;KAAA;KAAA;KAAA;KAAA;KAAA;IAC1C,OAAK;KAAA;KAAc;KAAiB;KAAA;KAAA;KAAA;IACpC,OAAM;KAAA;KAAe;KAAU;KAAA;KAAA;KAAA;MAC7B,MAAM;MACN,MAAK;;;IAEP,SAAM;KAAA;KAAU;KAAA;KAAA;KAAA;KAAA;KACf,UAAS,QAAG,GAAA,QAAA,SAAqB,QAAA,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,GAAA,CAAA,WAAA;KACjC,UAAA,UAAA,GAAA,QAAA,SAAA,QAAA,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,GAAA,CAAA,aAAA;IACF,CAAC;;EAEJ,IAAI,WAAW;AACb,UAAO,CAAA,gBAAK,SAAA,EAAA,CAAA,EAAA,gBAAA,kCAAA;IACL;IACL,IAAI,WAAM;AACR,YAAO,gBAAC,eAAA;MACN,IAAC,WAAM;AACN,cAAA,QAAU;;MAEX,IAAC,WAAW;AACX,cAAA,QAAS;;MAEZ,CAAA;;IAEH,CAAC,CAAC;;EAEN,CAAC,CAAC,EAAE,gBAAM,KAAgB;EACzB,IAAI,OAAK;AACP,UAAK,OAAA,OAAA,QAAA,SAAA;;EAEP,WAAS,UAAU,gBAAA,MAAA;GACjB,IAAI,OAAG;AACL,WAAK,MAAQ;;GAEf,IAAI,WAAU;AACZ,WAAM,gBAAO,cAA0B,EACrC,SAAC,OACF,CAAC;;GAEJ,IAAI,WAAQ;AACV,WAAO,gBAAiB,qBAAM,EAC5B,SAAI,OACL,CAAC;;GAEL,CAAC;EACH,CAAC,CAAC"}
@@ -1,8 +1,8 @@
1
1
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
2
  let _shell_shock_core = require("@shell-shock/core");
3
- let _shell_shock_preset_script_helpers_get_default_options = require("@shell-shock/preset-script/helpers/get-default-options");
3
+ let _shell_shock_preset_script_helpers_get_global_options = require("@shell-shock/preset-script/helpers/get-global-options");
4
4
 
5
- //#region src/helpers/get-default-options.ts
5
+ //#region src/helpers/get-global-options.ts
6
6
  /**
7
7
  * Get the default command options.
8
8
  *
@@ -10,9 +10,9 @@ let _shell_shock_preset_script_helpers_get_default_options = require("@shell-sho
10
10
  * @param _ - The command input.
11
11
  * @returns The default command options.
12
12
  */
13
- function getDefaultOptions(context, _) {
13
+ function getGlobalOptions(context, _) {
14
14
  return [
15
- ...(0, _shell_shock_preset_script_helpers_get_default_options.getDefaultOptions)(),
15
+ ...(0, _shell_shock_preset_script_helpers_get_global_options.getGlobalOptions)(),
16
16
  context.config.interactive !== "never" && context.config.interactive !== true && {
17
17
  name: "interactive",
18
18
  title: "Interactive",
@@ -36,4 +36,4 @@ function getDefaultOptions(context, _) {
36
36
  }
37
37
 
38
38
  //#endregion
39
- exports.getDefaultOptions = getDefaultOptions;
39
+ exports.getGlobalOptions = getGlobalOptions;
@@ -1,7 +1,7 @@
1
1
  import { CommandParameterKinds } from "@shell-shock/core";
2
- import { getDefaultOptions } from "@shell-shock/preset-script/helpers/get-default-options";
2
+ import { getGlobalOptions } from "@shell-shock/preset-script/helpers/get-global-options";
3
3
 
4
- //#region src/helpers/get-default-options.ts
4
+ //#region src/helpers/get-global-options.ts
5
5
  /**
6
6
  * Get the default command options.
7
7
  *
@@ -9,9 +9,9 @@ import { getDefaultOptions } from "@shell-shock/preset-script/helpers/get-defaul
9
9
  * @param _ - The command input.
10
10
  * @returns The default command options.
11
11
  */
12
- function getDefaultOptions$1(context, _) {
12
+ function getGlobalOptions$1(context, _) {
13
13
  return [
14
- ...getDefaultOptions(),
14
+ ...getGlobalOptions(),
15
15
  context.config.interactive !== "never" && context.config.interactive !== true && {
16
16
  name: "interactive",
17
17
  title: "Interactive",
@@ -35,5 +35,5 @@ function getDefaultOptions$1(context, _) {
35
35
  }
36
36
 
37
37
  //#endregion
38
- export { getDefaultOptions$1 as getDefaultOptions };
39
- //# sourceMappingURL=get-default-options.mjs.map
38
+ export { getGlobalOptions$1 as getGlobalOptions };
39
+ //# sourceMappingURL=get-global-options.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-global-options.mjs","names":["getGlobalOptions","_getGlobalOptions"],"sources":["../../src/helpers/get-global-options.ts"],"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 type { CommandBase, CommandOption } from \"@shell-shock/core\";\nimport { CommandParameterKinds } from \"@shell-shock/core\";\nimport { getGlobalOptions as _getGlobalOptions } from \"@shell-shock/preset-script/helpers/get-global-options\";\nimport type { CLIPresetContext } from \"../types\";\n\n/**\n * Get the default command options.\n *\n * @param context - The build context.\n * @param _ - The command input.\n * @returns The default command options.\n */\nexport function getGlobalOptions(\n context: CLIPresetContext,\n _: CommandBase\n): CommandOption[] {\n return [\n ..._getGlobalOptions(),\n context.config.interactive !== \"never\" &&\n context.config.interactive !== true && {\n name: \"interactive\",\n title: \"Interactive\",\n description:\n \"Enable interactive mode - will be set to false if running in a CI pipeline.\",\n alias: [\"i\", \"interact\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: context.config.interactive !== false\n },\n context.config.interactive !== \"never\" &&\n context.config.interactive !== false && {\n name: \"non-interactive\",\n title: \"Non-Interactive\",\n description:\n \"Disable interactive mode - will be set to true if running in a CI pipeline.\",\n alias: [\"no-interactive\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n isNegativeOf: \"interactive\"\n }\n ].filter(Boolean) as CommandOption[];\n}\n"],"mappings":";;;;;;;;;;;AA8BA,SAAgBA,mBACd,SACA,GACiB;AACjB,QAAO;EACL,GAAGC,kBAAmB;EACtB,QAAQ,OAAO,gBAAgB,WAC7B,QAAQ,OAAO,gBAAgB,QAAQ;GACrC,MAAM;GACN,OAAO;GACP,aACE;GACF,OAAO,CAAC,KAAK,WAAW;GACxB,MAAM,sBAAsB;GAC5B,UAAU;GACV,SAAS,QAAQ,OAAO,gBAAgB;GACzC;EACH,QAAQ,OAAO,gBAAgB,WAC7B,QAAQ,OAAO,gBAAgB,SAAS;GACtC,MAAM;GACN,OAAO;GACP,aACE;GACF,OAAO,CAAC,iBAAiB;GACzB,MAAM,sBAAsB;GAC5B,UAAU;GACV,SAAS;GACT,cAAc;GACf;EACJ,CAAC,OAAO,QAAQ"}
package/dist/index.cjs CHANGED
@@ -1,17 +1,19 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_index = require('./plugin-changelog/dist/index.cjs');
3
4
  const require_components_banner_builtin = require('./components/banner-builtin.cjs');
4
5
  const require_components_command_router = require('./components/command-router.cjs');
5
6
  const require_components_virtual_command_entry = require('./components/virtual-command-entry.cjs');
6
7
  const require_components_command_entry = require('./components/command-entry.cjs');
7
8
  const require_components_upgrade_builtin = require('./components/upgrade-builtin.cjs');
8
- const require_get_default_options = require('./helpers/get-default-options.cjs');
9
+ const require_get_global_options = require('./helpers/get-global-options.cjs');
9
10
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
10
11
  let _alloy_js_core = require("@alloy-js/core");
11
12
  let _alloy_js_typescript = require("@alloy-js/typescript");
12
13
  let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
13
14
  let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
14
15
  let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
16
+ let _stryke_path = require("@stryke/path");
15
17
  let _shell_shock_plugin_completions = require("@shell-shock/plugin-completions");
16
18
  _shell_shock_plugin_completions = require_runtime.__toESM(_shell_shock_plugin_completions);
17
19
  let _shell_shock_plugin_console = require("@shell-shock/plugin-console");
@@ -23,7 +25,6 @@ _shell_shock_plugin_prompts = require_runtime.__toESM(_shell_shock_plugin_prompt
23
25
  let _shell_shock_plugin_upgrade = require("@shell-shock/plugin-upgrade");
24
26
  _shell_shock_plugin_upgrade = require_runtime.__toESM(_shell_shock_plugin_upgrade);
25
27
  let _shell_shock_preset_script_components_bin_entry = require("@shell-shock/preset-script/components/bin-entry");
26
- let _stryke_path = require("@stryke/path");
27
28
 
28
29
  //#region src/index.tsx
29
30
  /**
@@ -37,6 +38,7 @@ const plugin = (options = {}) => {
37
38
  ...(0, _shell_shock_plugin_console.default)(options),
38
39
  ...(0, _shell_shock_plugin_help.default)(options),
39
40
  ...(0, _shell_shock_plugin_prompts.default)(options),
41
+ ...options.changelog !== false ? [require_index.plugin(options.changelog)] : [],
40
42
  ...options.completions !== false ? (0, _shell_shock_plugin_completions.default)(options.completions) : [],
41
43
  (0, _shell_shock_plugin_upgrade.default)(options),
42
44
  {
@@ -44,7 +46,7 @@ const plugin = (options = {}) => {
44
46
  config() {
45
47
  this.debug("Providing default configuration for the Shell Shock `cli` preset.");
46
48
  return {
47
- defaultOptions: require_get_default_options.getDefaultOptions,
49
+ globalOptions: require_get_global_options.getGlobalOptions,
48
50
  isCaseSensitive: false,
49
51
  ...options
50
52
  };
@@ -107,14 +109,12 @@ const plugin = (options = {}) => {
107
109
  "divider",
108
110
  "stripAnsi",
109
111
  "writeLine",
110
- "splitText",
111
- "colors"
112
+ "splitText"
112
113
  ],
113
- utils: [
114
- "useApp",
114
+ utils: ["isMinimal", "isInteractive"],
115
+ state: [
116
+ "useGlobal",
115
117
  "useArgs",
116
- "isMinimal",
117
- "isInteractive",
118
118
  "isHelp"
119
119
  ],
120
120
  prompts: [
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;AAiDA;;;;cAAa,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KACR,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;AAkDA;;;;cAAa,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KACR,MAAA,CAAO,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;AAiDA;;;;cAAa,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KACR,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;AAkDA;;;;cAAa,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KACR,MAAA,CAAO,QAAA"}
package/dist/index.mjs CHANGED
@@ -1,22 +1,23 @@
1
+ import { plugin as plugin$1 } from "./packages/plugin-changelog/dist/index.mjs";
1
2
  import { BannerBuiltin } from "./components/banner-builtin.mjs";
2
3
  import { CommandRouter } from "./components/command-router.mjs";
3
4
  import { VirtualCommandEntry } from "./components/virtual-command-entry.mjs";
4
5
  import { CommandEntry } from "./components/command-entry.mjs";
5
6
  import { UpgradeBuiltin } from "./components/upgrade-builtin.mjs";
6
- import { getDefaultOptions } from "./helpers/get-default-options.mjs";
7
+ import { getGlobalOptions } from "./helpers/get-global-options.mjs";
7
8
  import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
8
9
  import { For, Show, code, computed } from "@alloy-js/core";
9
10
  import { VarDeclaration } from "@alloy-js/typescript";
10
11
  import { Spacing } from "@powerlines/plugin-alloy/core/components";
11
12
  import { render } from "@powerlines/plugin-alloy/render";
12
13
  import { getAppDescription, getAppName, getCommandList } from "@shell-shock/core/plugin-utils";
14
+ import { joinPaths } from "@stryke/path";
13
15
  import completions from "@shell-shock/plugin-completions";
14
16
  import console from "@shell-shock/plugin-console";
15
17
  import help from "@shell-shock/plugin-help";
16
18
  import prompts from "@shell-shock/plugin-prompts";
17
19
  import upgrade from "@shell-shock/plugin-upgrade";
18
20
  import { BinEntry } from "@shell-shock/preset-script/components/bin-entry";
19
- import { joinPaths } from "@stryke/path";
20
21
 
21
22
  //#region src/index.tsx
22
23
  /**
@@ -30,6 +31,7 @@ const plugin = (options = {}) => {
30
31
  ...console(options),
31
32
  ...help(options),
32
33
  ...prompts(options),
34
+ ...options.changelog !== false ? [plugin$1(options.changelog)] : [],
33
35
  ...options.completions !== false ? completions(options.completions) : [],
34
36
  upgrade(options),
35
37
  {
@@ -37,7 +39,7 @@ const plugin = (options = {}) => {
37
39
  config() {
38
40
  this.debug("Providing default configuration for the Shell Shock `cli` preset.");
39
41
  return {
40
- defaultOptions: getDefaultOptions,
42
+ globalOptions: getGlobalOptions,
41
43
  isCaseSensitive: false,
42
44
  ...options
43
45
  };
@@ -100,14 +102,12 @@ const plugin = (options = {}) => {
100
102
  "divider",
101
103
  "stripAnsi",
102
104
  "writeLine",
103
- "splitText",
104
- "colors"
105
+ "splitText"
105
106
  ],
106
- utils: [
107
- "useApp",
107
+ utils: ["isMinimal", "isInteractive"],
108
+ state: [
109
+ "useGlobal",
108
110
  "useArgs",
109
- "isMinimal",
110
- "isInteractive",
111
111
  "isHelp"
112
112
  ],
113
113
  prompts: [
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.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, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport {\n getAppDescription,\n getAppName,\n getCommandList\n} from \"@shell-shock/core/plugin-utils\";\nimport completions from \"@shell-shock/plugin-completions\";\nimport console from \"@shell-shock/plugin-console\";\nimport help from \"@shell-shock/plugin-help\";\nimport prompts from \"@shell-shock/plugin-prompts\";\nimport upgrade from \"@shell-shock/plugin-upgrade\";\nimport { BinEntry } from \"@shell-shock/preset-script/components/bin-entry\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { Plugin } from \"powerlines\";\nimport { BannerBuiltin } from \"./components/banner-builtin\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { UpgradeBuiltin } from \"./components/upgrade-builtin\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { CLIPresetContext, CLIPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock CLI Preset plugin.\n *\n * @remarks\n * This preset includes a set of built-in modules and commands to create a CLI application, as well as configuration options to customize the generated code. It also includes the `prompts` plugin to provide interactive prompts in the CLI application, and the `upgrade` plugin to manage upgrading the local application's version.\n */\nexport const plugin = <TContext extends CLIPresetContext = CLIPresetContext>(\n options: CLIPresetOptions = {}\n): Plugin<TContext>[] => {\n return [\n ...console<TContext>(options),\n ...help<TContext>(options),\n ...prompts<TContext>(options),\n ...(options.completions !== false\n ? completions<TContext>(options.completions)\n : []),\n upgrade<TContext>(options),\n {\n name: \"shell-shock:cli-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `cli` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n },\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\"Rendering built-in modules.\");\n\n const commands = await getCommandList(this);\n this.debug(\n `Rendering \\`banner\\` built-ins for each of the ${\n commands.length\n } command modules.`\n );\n\n const bin = computed(() => ({\n id: \"\",\n name: getAppName(this),\n title: \"\",\n description: getAppDescription(this),\n isVirtual: true,\n path: null,\n segments: [],\n alias: [],\n tags: [],\n options: Object.fromEntries(\n this.options.map(option => [option.name, option])\n ),\n entry: {\n file: joinPaths(this.entryPath, \"bin.ts\")\n },\n args: [],\n parent: null,\n children: this.commands\n }));\n\n return render(\n this,\n <>\n <UpgradeBuiltin />\n <BannerBuiltin command={bin.value} />\n <Spacing />\n <For\n each={commands.sort((a, b) => a.name.localeCompare(b.name))}\n doubleHardline>\n {command => <BannerBuiltin command={command} />}\n </For>\n </>\n );\n }\n }\n },\n {\n name: \"shell-shock:cli-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `cli` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"info\",\n \"debug\",\n \"warn\",\n \"help\",\n \"error\",\n \"cursor\",\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"isMinimal\",\n \"isInteractive\",\n \"isHelp\"\n ],\n prompts: [\n \"text\",\n \"numeric\",\n \"toggle\",\n \"select\",\n \"confirm\",\n \"isCancel\"\n ],\n env: [\"env\", \"paths\"],\n upgrade: [\"executeUpgrade\"]\n }}>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n let\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <hbr />\n {code`await showBanner(0);`}\n <Spacing />\n {code`return showHelp(); `}\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAI,UAAA,UAAA,EAAA,KAAA;AACF,QAAM;EAAA,GAAA,QAAsB,QAAS;EAAE,GAAC,KAAY,QAAY;EAAA,GAAM,QAAkB,QAAK;EAAK,GAAG,QAAA,gBAAyB,QAAA,YAA8B,QAAQ,YAAY,GAAE,EAAA;EAAA,QAAmB,QAAQ;EAAA;GAC7M,MAAA;GACF,SAAa;AACX,SAAS,MAAA,oEAAoB;AAC5B,WAAO;KACF,gBAAC;KACF,iBAAkB;KAClB,GAAI;KACJ;;GAEH,SAAI;IACF,OAAK;IACP,MAAQ,UAAU;AAClB,UAAA,MAAA,8BAAA;KACE,MAAO,WAAY,MAAI,eAAO,KAAA;AAC9B,UAAO,MAAE,kDAAA,SAAA,OAAA,mBAAA;KACP,MAAK,MAAK,gBAAA;MACR,IAAC;MACF,MAAA,WAAA,KAAA;;MAED,aAAO,kBAAA,KAAA;MACL,WAAA;MACA,MAAA;MACA,UAAG,EAAA;MACJ,OAAA,EAAA;MACF,MAAA,EAAA;MACD,SAAS,OAAA,YAAA,KAAA,QAAA,KAAA,WAAA,CAAA,OAAA,MAAA,OAAA,CAAA,CAAA;MACP,OAAQ,EACR,MAAM,UAAU,KAAA,WAAA,SAAA,EACd;;MAEA,QAAM;MACN,UAAU,KAAA;MACX,EAAE;AACH,YAAM,OAAQ,MAAC;MAAA,gBAAA,gBAAA,EAAA,CAAA;MAAA,gBAAA,eAAA,EACb,IAAI,UAAQ;AACX,cAAA,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,IAAI,OAAO;AACT,gBAAK,OAAM,OAAA,OAAA,SAAA;;QAEb,gBAAY;QACZ,WAAO,UAAM,gBAAA,MAAA;SACX,IAAI,OAAO;AACT,iBAAG,MAAQ;;SAEb,IAAI,WAAW;AACb,iBAAG,gBAAU,cAAA,EACX,SAAO,OACR,CAAA;;SAEH,IAAI,WAAQ;AACV,iBAAG,gBAAQ,qBAAA,EACT,SAAC,OACF,CAAC;;SAEL,CAAC;QACH,CAAC;;MAEL,CAAC,CAAC,CAAC;;IAEP;GACF;EAAC"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.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, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport {\n getAppDescription,\n getAppName,\n getCommandList\n} from \"@shell-shock/core/plugin-utils\";\nimport changelog from \"@shell-shock/plugin-changelog\";\nimport completions from \"@shell-shock/plugin-completions\";\nimport console from \"@shell-shock/plugin-console\";\nimport help from \"@shell-shock/plugin-help\";\nimport prompts from \"@shell-shock/plugin-prompts\";\nimport upgrade from \"@shell-shock/plugin-upgrade\";\nimport { BinEntry } from \"@shell-shock/preset-script/components/bin-entry\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { Plugin } from \"powerlines\";\nimport { BannerBuiltin } from \"./components/banner-builtin\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { UpgradeBuiltin } from \"./components/upgrade-builtin\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getGlobalOptions } from \"./helpers/get-global-options\";\nimport type { CLIPresetContext, CLIPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock CLI Preset plugin.\n *\n * @remarks\n * This preset includes a set of built-in modules and commands to create a CLI application, as well as configuration options to customize the generated code. It also includes the `prompts` plugin to provide interactive prompts in the CLI application, and the `upgrade` plugin to manage upgrading the local application's version.\n */\nexport const plugin = <TContext extends CLIPresetContext = CLIPresetContext>(\n options: CLIPresetOptions = {}\n): Plugin<TContext>[] => {\n return [\n ...console<TContext>(options),\n ...help<TContext>(options),\n ...prompts<TContext>(options),\n ...(options.changelog !== false\n ? [changelog<TContext>(options.changelog)]\n : []),\n ...(options.completions !== false\n ? completions<TContext>(options.completions)\n : []),\n upgrade<TContext>(options),\n {\n name: \"shell-shock:cli-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `cli` preset.\"\n );\n\n return {\n globalOptions: getGlobalOptions,\n isCaseSensitive: false,\n ...options\n };\n },\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\"Rendering built-in modules.\");\n\n const commands = await getCommandList(this);\n this.debug(\n `Rendering \\`banner\\` built-ins for each of the ${\n commands.length\n } command modules.`\n );\n\n const bin = computed(() => ({\n id: \"\",\n name: getAppName(this),\n title: \"\",\n description: getAppDescription(this),\n isVirtual: true,\n path: null,\n segments: [],\n alias: [],\n tags: [],\n options: Object.fromEntries(\n this.options.map(option => [option.name, option])\n ),\n entry: {\n file: joinPaths(this.entryPath, \"bin.ts\")\n },\n args: [],\n parent: null,\n children: this.commands\n }));\n\n return render(\n this,\n <>\n <UpgradeBuiltin />\n <BannerBuiltin command={bin.value} />\n <Spacing />\n <For\n each={commands.sort((a, b) => a.name.localeCompare(b.name))}\n doubleHardline>\n {command => <BannerBuiltin command={command} />}\n </For>\n </>\n );\n }\n }\n },\n {\n name: \"shell-shock:cli-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `cli` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"info\",\n \"debug\",\n \"warn\",\n \"help\",\n \"error\",\n \"cursor\",\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\"isMinimal\", \"isInteractive\"],\n state: [\"useGlobal\", \"useArgs\", \"isHelp\"],\n prompts: [\n \"text\",\n \"numeric\",\n \"toggle\",\n \"select\",\n \"confirm\",\n \"isCancel\"\n ],\n env: [\"env\", \"paths\"],\n upgrade: [\"executeUpgrade\"]\n }}>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n let\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <hbr />\n {code`await showBanner(0);`}\n <Spacing />\n {code`return showHelp(); `}\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAI,UAAA,UAAA,EAAA,KAAA;AACF,QAAM;EAAA,GAAA,QAAsB,QAAS;EAAE,GAAC,KAAY,QAAY;EAAA,GAAM,QAAkB,QAAK;EAAK,GAAG,QAAA,cAAsB,QAAG,CAAA,SAAwB,QAAS,UAAK,CAAQ,GAAC,EAAI;EAAC,GAAA,QAAS,gBAAkB,QAAW,YAAoB,QAAA,YAAsB,GAAA,EAAA;EAAQ,QAAkB,QAAA;EAAU;GAC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,SAAI,CAAA,iBAAA;OACL;MACD,IAAI,WAAC;AACH,cAAG;QAAA,gBAAuB,MAAI;SAC5B,IAAC,OAAS;AACT,iBAAA,OAAA,KAAA,OAAA,SAAA,CAAA,SAAA;;SAED,IAAE,WAAA;AACA,iBAAC;WAAO,gBAAkB,gBAAU;YACpC,OAAG;YACL,MAAA;YACH,MAAA;YACH,aAAA,IAAA;YACF,CAAA;WAAA,gBAAA,OAAA,EAAA,CAAA;WAAA,gBAAA,eAAA;YACD,UAAA,EAAA;YACD,IAAA,WAAA;AACe,oBAAM,OAAI,YAAgB,EAAA;;YAE7B,CAAA;WAAI,gBAAC,OAAA,EAAA,CAAA;WAAA;;SAEX,CAAI;QAAC,gBAAK,OAAA,EAAA,CAAA;QAAA,IAAA;QAAA,gBAAA,SAAA,EAAA,CAAA;QAAA,IAAA;QAAA;;MAEX,CAAC,EAAC,gBAAA,MAAA;;AAED,cAAO,OAAM,OAAA,OAAA,SAAA,CAAA,SAAA;;MAEb,IAAG,WAAA;AACD,cAAG,gBAAA,KAAA;QACD,IAAE,OAAA;AACA,gBAAE,OAAS,OAAA,OAAA,SAAA;;QAEb,gBAAa;QACb,WAAO,UAAK,gBAAA,MAAA;SACV,IAAI,OAAM;AACR,iBAAG,MAAM;;SAEX,IAAI,WAAS;AACX,iBAAG,gBAAU,cAAA,EACX,SAAC,OACF,CAAC;;SAEJ,IAAE,WAAS;AACT,iBAAO,gBAAe,qBAAmB,EACzC,SAAS,OACR,CAAC;;SAEL,CAAC;QACH,CAAC;;MAEL,CAAC,CAAC,CAAC;;IAEP;GACF;EAAC"}
@@ -0,0 +1,17 @@
1
+ //#region ../../node_modules/.pnpm/@stryke+types@0.11.3/node_modules/@stryke/types/dist/base.d.cts
2
+ /**
3
+ * Create a type that makes the given keys required. The remaining keys are kept as is.
4
+ *
5
+ * @remarks
6
+ * Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required.
7
+ */
8
+ type RequiredKeys<BaseType, Keys extends keyof BaseType> = Required<Pick<BaseType, Keys>> & Omit<BaseType, Keys>;
9
+ /**
10
+ * Create a type that makes the given keys optional. The remaining keys are kept as is.
11
+ *
12
+ * @remarks
13
+ * Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are optional.
14
+ */
15
+ //#endregion
16
+ export { RequiredKeys };
17
+ //# sourceMappingURL=base.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.cts","names":["TypedArray","SerializablePrimitive","Primitive","BuiltIns","Date","RegExp","AtomicObject","Function","Promise","TypeTester","value","TypeMap","Record","emptyObjectSymbol","FunctionOrValue","Value","X","List","A","ReadonlyArray","FunctionLike","P","R$1","args","AnyFunction","Nullish","Nullishable","T","NonNullishObject","NativeClass","AnyNumber","AnyString","AnyBoolean","AnyArray","PlainObject","AnyMap","Map","AnyWeakMap","WeakKey","WeakMap","EmptyArray","EmptyObject","Any","IndexType","TypedIndexable","Indexable","Dictionary","EMPTY_STRING","NEWLINE_STRING","EMPTY_OBJECT","AnyCase","F1","Uppercase","Lowercase","F2","R","F","Newable","_args","Abstract","prototype","Clonable","clone","MaybePromise","ReducerFunction","TState","TAction","state","action","TYPE_ARGUMENTS","TYPE_ARRAY","TYPE_OBJECT","TYPE_MAP","TYPE_SET","Collection","IArguments","Set","NonUndefined","BrowserNativeObject","File","DeepPartial","NestedValue","K","Rollback","initialValue","currentValue","RequiredKeysOf","BaseType","Key","Exclude","IsEqual","G","B","Filter","KeyType$1","ExcludeType","ExceptOptions","requireExactProps","Except","ObjectType","KeysType","Options","KeyType","Partial","Simplify","RequiredKeys","Keys","Pick","Required","Omit","PartialKeys","$NestedValue","TValue","RefObject","current","Identity","id","Versioned","version","Sequenced","sequence","Typed","__type","ClassTypeCheckable","isTypeOf","NonRecursiveType","arguments_","IsPrimitive","IsNever","IsAny","IsNull","IsUndefined","IsUnknown","IsNullish","IsFunction","GlobalThis","globalThis","Class","Arguments","Constructor","AbstractClass","AbstractConstructor","BuildTuple","L","Fill","HasMultipleCallSignatures","StructuredCloneablePrimitive","StructuredCloneableData","ArrayBuffer","DataView","Error","Blob","StructuredCloneableCollection","StructuredCloneable","ReadonlyMap","ReadonlySet","key"],"sources":["../../../../../../../../../../node_modules/.pnpm/@stryke+types@0.11.3/node_modules/@stryke/types/dist/base.d.cts"],"x_google_ignoreList":[0],"mappings":";;;;;;;KAiLKyG,YAAAA,8BAA0ClB,QAAAA,IAAYqB,QAAAA,CAASD,IAAAA,CAAKpB,QAAAA,EAAUmB,IAAAA,KAASG,IAAAA,CAAKtB,QAAAA,EAAUmB,IAAAA"}
@@ -0,0 +1,17 @@
1
+ //#region ../../node_modules/.pnpm/@stryke+types@0.11.3/node_modules/@stryke/types/dist/base.d.cts
2
+ /**
3
+ * Create a type that makes the given keys required. The remaining keys are kept as is.
4
+ *
5
+ * @remarks
6
+ * Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required.
7
+ */
8
+ type RequiredKeys<BaseType, Keys extends keyof BaseType> = Required<Pick<BaseType, Keys>> & Omit<BaseType, Keys>;
9
+ /**
10
+ * Create a type that makes the given keys optional. The remaining keys are kept as is.
11
+ *
12
+ * @remarks
13
+ * Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are optional.
14
+ */
15
+ //#endregion
16
+ export { RequiredKeys };
17
+ //# sourceMappingURL=base.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.mts","names":["TypedArray","SerializablePrimitive","Primitive","BuiltIns","Date","RegExp","AtomicObject","Function","Promise","TypeTester","value","TypeMap","Record","emptyObjectSymbol","FunctionOrValue","Value","X","List","A","ReadonlyArray","FunctionLike","P","R$1","args","AnyFunction","Nullish","Nullishable","T","NonNullishObject","NativeClass","AnyNumber","AnyString","AnyBoolean","AnyArray","PlainObject","AnyMap","Map","AnyWeakMap","WeakKey","WeakMap","EmptyArray","EmptyObject","Any","IndexType","TypedIndexable","Indexable","Dictionary","EMPTY_STRING","NEWLINE_STRING","EMPTY_OBJECT","AnyCase","F1","Uppercase","Lowercase","F2","R","F","Newable","_args","Abstract","prototype","Clonable","clone","MaybePromise","ReducerFunction","TState","TAction","state","action","TYPE_ARGUMENTS","TYPE_ARRAY","TYPE_OBJECT","TYPE_MAP","TYPE_SET","Collection","IArguments","Set","NonUndefined","BrowserNativeObject","File","DeepPartial","NestedValue","K","Rollback","initialValue","currentValue","RequiredKeysOf","BaseType","Key","Exclude","IsEqual","G","B","Filter","KeyType$1","ExcludeType","ExceptOptions","requireExactProps","Except","ObjectType","KeysType","Options","KeyType","Partial","Simplify","RequiredKeys","Keys","Pick","Required","Omit","PartialKeys","$NestedValue","TValue","RefObject","current","Identity","id","Versioned","version","Sequenced","sequence","Typed","__type","ClassTypeCheckable","isTypeOf","NonRecursiveType","arguments_","IsPrimitive","IsNever","IsAny","IsNull","IsUndefined","IsUnknown","IsNullish","IsFunction","GlobalThis","globalThis","Class","Arguments","Constructor","AbstractClass","AbstractConstructor","BuildTuple","L","Fill","HasMultipleCallSignatures","StructuredCloneablePrimitive","StructuredCloneableData","ArrayBuffer","DataView","Error","Blob","StructuredCloneableCollection","StructuredCloneable","ReadonlyMap","ReadonlySet","key"],"sources":["../../../../../../../../../../node_modules/.pnpm/@stryke+types@0.11.3/node_modules/@stryke/types/dist/base.d.cts"],"x_google_ignoreList":[0],"mappings":";;;;;;;KAiLKyG,YAAAA,8BAA0ClB,QAAAA,IAAYqB,QAAAA,CAASD,IAAAA,CAAKpB,QAAAA,EAAUmB,IAAAA,KAASG,IAAAA,CAAKtB,QAAAA,EAAUmB,IAAAA"}