@shell-shock/preset-cli 0.7.4 → 0.7.5

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.
@@ -42,33 +42,54 @@ function BannerFunctionDeclaration(props) {
42
42
  get doc() {
43
43
  return `Write the ${(0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context, true)} application banner ${command ? `for the ${command.title} command ` : ""}to the console.`;
44
44
  },
45
- parameters: [{
46
- name: "pause",
47
- type: "number",
48
- default: 500
49
- }],
45
+ get parameters() {
46
+ return [{
47
+ name: "pause",
48
+ type: "number",
49
+ default: 500
50
+ }, {
51
+ name: "upgradeCheck",
52
+ default: context.config.upgrade?.type === "auto" || context.config.upgrade?.type === "confirm" ? "true" : "false"
53
+ }];
54
+ },
50
55
  get children() {
51
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_banner_function_declaration.BannerFunctionBodyDeclaration, {
52
- get header() {
53
- return header.value;
54
- },
55
- get description() {
56
- return description.value;
57
- },
58
- get footer() {
59
- return footer.value;
60
- },
61
- variant,
62
- consoleFnName,
63
- command,
64
- get children() {
65
- return __alloy_js_core.code`const titleLines = [${titleLines.value.map((line) => JSON.stringify(line.trim())).join(", ")}];
56
+ return [
57
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_banner_function_declaration.BannerFunctionBodyDeclaration, {
58
+ get header() {
59
+ return header.value;
60
+ },
61
+ get description() {
62
+ return description.value;
63
+ },
64
+ get footer() {
65
+ return footer.value;
66
+ },
67
+ variant,
68
+ consoleFnName,
69
+ command,
70
+ get children() {
71
+ return __alloy_js_core.code`const titleLines = [${titleLines.value.map((line) => JSON.stringify(line.trim())).join(", ")}];
66
72
  const title = Math.max(...titleLines.map(line => stripAnsi(line).length)) > Math.max(process.stdout.columns - ${totalPadding.value}, 0) ? "${title.value}" : \`\\n\${titleLines.join("\\n")}\\n\`; `;
67
- }
68
- }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
69
- condition: __alloy_js_core.code`isInteractive && !isHelp`,
70
- children: __alloy_js_core.code`await sleep(pause);`
71
- })];
73
+ }
74
+ }),
75
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
76
+ condition: __alloy_js_core.code`isInteractive && !isHelp`,
77
+ children: __alloy_js_core.code`await sleep(pause);`
78
+ }),
79
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
80
+ condition: __alloy_js_core.code`upgradeCheck`,
81
+ get children() {
82
+ return [__alloy_js_core.code`const result = await checkForUpdates();`, (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
83
+ condition: __alloy_js_core.code`result?.updateAvailable`,
84
+ get children() {
85
+ return __alloy_js_core.code`
86
+ info(\`A new version of ${(0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context, true)} is available: \${colors.red(\`v\${result.currentVersion}\`)} \${colors.text.body.tertiary("➜")} \${colors.green(\`v\${result.latestVersion}\`)}\${result.package.date ? colors.text.body.tertiary(\` (updated on \${result.package.date})\`) : ""}\`);
87
+ `;
88
+ }
89
+ })];
90
+ }
91
+ })
92
+ ];
72
93
  }
73
94
  })];
74
95
  }
@@ -1,11 +1,11 @@
1
- import * as _alloy_js_core0 from "@alloy-js/core";
1
+ import * as _alloy_js_core3 from "@alloy-js/core";
2
2
  import { BannerFunctionDeclarationProps } from "@shell-shock/preset-script/components/banner-function-declaration";
3
3
 
4
4
  //#region src/components/banner-function-declaration.d.ts
5
5
  /**
6
6
  * A component to generate the `banner` function in the `shell-shock:console` builtin module.
7
7
  */
8
- declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core0.Children;
8
+ declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core3.Children;
9
9
  //#endregion
10
10
  export { BannerFunctionDeclaration };
11
11
  //# sourceMappingURL=banner-function-declaration.d.cts.map
@@ -41,33 +41,54 @@ function BannerFunctionDeclaration(props) {
41
41
  get doc() {
42
42
  return `Write the ${getAppTitle(context, true)} application banner ${command ? `for the ${command.title} command ` : ""}to the console.`;
43
43
  },
44
- parameters: [{
45
- name: "pause",
46
- type: "number",
47
- default: 500
48
- }],
44
+ get parameters() {
45
+ return [{
46
+ name: "pause",
47
+ type: "number",
48
+ default: 500
49
+ }, {
50
+ name: "upgradeCheck",
51
+ default: context.config.upgrade?.type === "auto" || context.config.upgrade?.type === "confirm" ? "true" : "false"
52
+ }];
53
+ },
49
54
  get children() {
50
- return [createComponent(BannerFunctionBodyDeclaration, {
51
- get header() {
52
- return header.value;
53
- },
54
- get description() {
55
- return description.value;
56
- },
57
- get footer() {
58
- return footer.value;
59
- },
60
- variant,
61
- consoleFnName,
62
- command,
63
- get children() {
64
- return code`const titleLines = [${titleLines.value.map((line) => JSON.stringify(line.trim())).join(", ")}];
55
+ return [
56
+ createComponent(BannerFunctionBodyDeclaration, {
57
+ get header() {
58
+ return header.value;
59
+ },
60
+ get description() {
61
+ return description.value;
62
+ },
63
+ get footer() {
64
+ return footer.value;
65
+ },
66
+ variant,
67
+ consoleFnName,
68
+ command,
69
+ get children() {
70
+ return code`const titleLines = [${titleLines.value.map((line) => JSON.stringify(line.trim())).join(", ")}];
65
71
  const title = Math.max(...titleLines.map(line => stripAnsi(line).length)) > Math.max(process.stdout.columns - ${totalPadding.value}, 0) ? "${title.value}" : \`\\n\${titleLines.join("\\n")}\\n\`; `;
66
- }
67
- }), createComponent(IfStatement, {
68
- condition: code`isInteractive && !isHelp`,
69
- children: code`await sleep(pause);`
70
- })];
72
+ }
73
+ }),
74
+ createComponent(IfStatement, {
75
+ condition: code`isInteractive && !isHelp`,
76
+ children: code`await sleep(pause);`
77
+ }),
78
+ createComponent(IfStatement, {
79
+ condition: code`upgradeCheck`,
80
+ get children() {
81
+ return [code`const result = await checkForUpdates();`, createComponent(IfStatement, {
82
+ condition: code`result?.updateAvailable`,
83
+ get children() {
84
+ return code`
85
+ info(\`A new version of ${getAppTitle(context, true)} is available: \${colors.red(\`v\${result.currentVersion}\`)} \${colors.text.body.tertiary("➜")} \${colors.green(\`v\${result.latestVersion}\`)}\${result.package.date ? colors.text.body.tertiary(\` (updated on \${result.package.date})\`) : ""}\`);
86
+ `;
87
+ }
88
+ })];
89
+ }
90
+ })
91
+ ];
71
92
  }
72
93
  })];
73
94
  }
@@ -1 +1 @@
1
- {"version":3,"file":"banner-function-declaration.mjs","names":["code","computed","FunctionDeclaration","IfStatement","usePowerlines","getAppDescription","getAppTitle","useTheme","BannerFunctionBodyDeclaration","render","BannerFunctionDeclaration","props","consoleFnName","variant","command","theme","context","header","labels","banner","packageJson","version","footer","title","replace","description","titleLines","result","font","align","background","letterSpacing","lineHeight","gradient","transitionGradient","env","array","bannerPadding","Math","max","padding","app","borderStyles","outline","left","length","right","totalPadding","value","_$createComponent","async","name","doc","parameters","type","default","children","map","line","JSON","stringify","trim","join","condition"],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed } from \"@alloy-js/core\";\nimport { FunctionDeclaration, IfStatement } from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { useTheme } from \"@shell-shock/plugin-theme/contexts/theme\";\nimport type { BannerFunctionDeclarationProps } from \"@shell-shock/preset-script/components/banner-function-declaration\";\nimport { BannerFunctionBodyDeclaration } from \"@shell-shock/preset-script/components/banner-function-declaration\";\nimport { render } from \"cfonts\";\nimport type { CLIPresetContext } from \"../types/plugin\";\n\n/**\n * A component to generate the `banner` function in the `shell-shock:console` builtin module.\n */\nexport function BannerFunctionDeclaration(\n props: BannerFunctionDeclarationProps\n) {\n const { consoleFnName = \"log\", variant = \"primary\", command } = props;\n\n const theme = useTheme();\n\n const context = usePowerlines<CLIPresetContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context)} v${\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 +\n theme.borderStyles.banner.outline[variant].right.length\n );\n const totalPadding = computed(\n () => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value\n );\n\n return (\n <>\n <FunctionDeclaration\n async\n name=\"banner\"\n doc={`Write the ${getAppTitle(context, true)} application banner ${\n command ? `for the ${command.title} command ` : \"\"\n }to the console.`}\n parameters={[{ name: \"pause\", type: \"number\", default: 500 }]}>\n <BannerFunctionBodyDeclaration\n header={header.value}\n description={description.value}\n footer={footer.value}\n variant={variant}\n consoleFnName={consoleFnName}\n command={command}>\n {code`const titleLines = [${titleLines.value\n .map(line => JSON.stringify(line.trim()))\n .join(\", \")}];\n const title = Math.max(...titleLines.map(line => stripAnsi(line).length)) > Math.max(process.stdout.columns - ${\n totalPadding.value\n }, 0) ? \"${title.value}\" : \\`\\\\n\\${titleLines.join(\"\\\\n\")}\\\\n\\`; `}\n </BannerFunctionBodyDeclaration>\n <IfStatement condition={code`isInteractive && !isHelp`}>\n {code`await sleep(pause);`}\n </IfStatement>\n </FunctionDeclaration>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAkCA,SAAgBU,0BACdC,OACA;CACA,MAAM,EAAEC,gBAAgB,OAAOC,UAAU,WAAWC,YAAYH;CAEhE,MAAMI,QAAQR,UAAU;CAExB,MAAMS,UAAUZ,eAAiC;CAEjD,MAAMa,SAAShB,eAEX,GAAGc,MAAMG,OAAOC,OAAOF,OAAOJ,YAAYP,YAAYU,QAAQ,CAAA,IAC5DA,QAAQI,YAAYC,WAAW,UAEpC;CACD,MAAMC,SAASrB,eAAec,MAAMG,OAAOC,OAAOG,OAAOT,SAAS;CAClE,MAAMU,QAAQtB,eACZK,YAAYU,SAAS,KAAK,CAACQ,QACzB,IAAIR,QAAQI,YAAYC,WAAW,WACnC,GAEJ,CAAC;CACD,MAAMI,cAAcxB,eACZa,SAASW,eAAepB,kBAAkBW,QAClD,CAAC;CAED,MAAMU,aAAazB,eAAe;EAChC,MAAM0B,SAASlB,OAAOH,YAAYU,SAAS,KAAK,EAAE;GAChDY,MAAM;GACNC,OAAO;GACPC,YAAY;GACZC,eAAe;GACfC,YAAY;GACZC,UAAU;GACVC,oBAAoB;GACpBC,KAAK;GACN,CAAC;AACF,MAAI,CAACR,OACH,QAAO,CAAC,GAAGrB,YAAYU,SAAS,KAAK,CAAA,yBAA0B;AAGjE,SAAOW,OAAOS;GACd;CAEF,MAAMC,gBAAgBpC,eAElBqC,KAAKC,IAAIxB,MAAMyB,QAAQC,KAAK,EAAE,GAAG,IACjC1B,MAAM2B,aAAavB,OAAOwB,QAAQ9B,SAAS+B,KAAKC,SAChD9B,MAAM2B,aAAavB,OAAOwB,QAAQ9B,SAASiC,MAAMD,OACpD;CACD,MAAME,eAAe9C,eACbqC,KAAKC,IAAIxB,MAAMyB,QAAQrB,QAAQ,EAAE,GAAG,IAAIkB,cAAcW,MAC7D;AAED,QAAA,CAAAC,gBAEK/C,qBAAmB;EAClBgD,OAAK;EACLC,MAAI;EAAA,IACJC,MAAG;AAAA,UAAE,aAAa9C,YAAYU,SAAS,KAAK,CAAA,sBAC1CF,UAAU,WAAWA,QAAQS,MAAK,aAAc,GAAE;;EAEpD8B,YAAY,CAAC;GAAEF,MAAM;GAASG,MAAM;GAAUC,SAAS;GAAK,CAAC;EAAA,IAAAC,WAAA;AAAA,UAAA,CAAAP,gBAC5DzC,+BAA6B;IAAA,IAC5BS,SAAM;AAAA,YAAEA,OAAO+B;;IAAK,IACpBvB,cAAW;AAAA,YAAEA,YAAYuB;;IAAK,IAC9B1B,SAAM;AAAA,YAAEA,OAAO0B;;IACNnC;IACMD;IACNE;IAAO,IAAA0C,WAAA;AAAA,YACfxD,IAAI,uBAAuB0B,WAAWsB,MACpCS,KAAIC,SAAQC,KAAKC,UAAUF,KAAKG,MAAM,CAAC,CAAC,CACxCC,KAAK,KAAK,CAAA;wHAEbf,aAAaC,MAAK,UACTzB,MAAMyB,MAAK;;IAA4C,CAAA,EAAAC,gBAEjE9C,aAAW;IAAC4D,WAAW/D,IAAI;IAA0BwD,UACnDxD,IAAI;IAAqB,CAAA,CAAA;;EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"banner-function-declaration.mjs","names":["code","computed","FunctionDeclaration","IfStatement","usePowerlines","getAppDescription","getAppTitle","useTheme","BannerFunctionBodyDeclaration","render","BannerFunctionDeclaration","props","consoleFnName","variant","command","theme","context","header","labels","banner","packageJson","version","footer","title","replace","description","titleLines","result","font","align","background","letterSpacing","lineHeight","gradient","transitionGradient","env","array","bannerPadding","Math","max","padding","app","borderStyles","outline","left","length","right","totalPadding","value","_$createComponent","async","name","doc","parameters","type","default","config","upgrade","children","map","line","JSON","stringify","trim","join","condition"],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed } from \"@alloy-js/core\";\nimport { FunctionDeclaration, IfStatement } from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { useTheme } from \"@shell-shock/plugin-theme/contexts/theme\";\nimport type { BannerFunctionDeclarationProps } from \"@shell-shock/preset-script/components/banner-function-declaration\";\nimport { BannerFunctionBodyDeclaration } from \"@shell-shock/preset-script/components/banner-function-declaration\";\nimport { render } from \"cfonts\";\nimport type { CLIPresetContext } from \"../types/plugin\";\n\n/**\n * A component to generate the `banner` function in the `shell-shock:console` builtin module.\n */\nexport function BannerFunctionDeclaration(\n props: BannerFunctionDeclarationProps\n) {\n const { consoleFnName = \"log\", variant = \"primary\", command } = props;\n\n const theme = useTheme();\n\n const context = usePowerlines<CLIPresetContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context)} v${\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 +\n theme.borderStyles.banner.outline[variant].right.length\n );\n const totalPadding = computed(\n () => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value\n );\n\n return (\n <>\n <FunctionDeclaration\n async\n name=\"banner\"\n doc={`Write the ${getAppTitle(context, true)} application banner ${\n command ? `for the ${command.title} command ` : \"\"\n }to the console.`}\n parameters={[\n { name: \"pause\", type: \"number\", default: 500 },\n {\n name: \"upgradeCheck\",\n default:\n context.config.upgrade?.type === \"auto\" ||\n context.config.upgrade?.type === \"confirm\"\n ? \"true\"\n : \"false\"\n }\n ]}>\n <BannerFunctionBodyDeclaration\n header={header.value}\n description={description.value}\n footer={footer.value}\n variant={variant}\n consoleFnName={consoleFnName}\n command={command}>\n {code`const titleLines = [${titleLines.value\n .map(line => JSON.stringify(line.trim()))\n .join(\", \")}];\n const title = Math.max(...titleLines.map(line => stripAnsi(line).length)) > Math.max(process.stdout.columns - ${\n totalPadding.value\n }, 0) ? \"${title.value}\" : \\`\\\\n\\${titleLines.join(\"\\\\n\")}\\\\n\\`; `}\n </BannerFunctionBodyDeclaration>\n <IfStatement condition={code`isInteractive && !isHelp`}>\n {code`await sleep(pause);`}\n </IfStatement>\n <IfStatement condition={code`upgradeCheck`}>\n {code`const result = await checkForUpdates();`}\n <IfStatement condition={code`result?.updateAvailable`}>\n {code`\n info(\\`A new version of ${getAppTitle(\n context,\n true\n )} is available: \\${colors.red(\\`v\\${result.currentVersion}\\`)} \\${colors.text.body.tertiary(\"➜\")} \\${colors.green(\\`v\\${result.latestVersion}\\`)}\\${result.package.date ? colors.text.body.tertiary(\\` (updated on \\${result.package.date})\\`) : \"\"}\\`);\n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;EAAA,IACJC,MAAG;AAAA,UAAE,aAAa9C,YAAYU,SAAS,KAAK,CAAA,sBAC1CF,UAAU,WAAWA,QAAQS,MAAK,aAAc,GAAE;;EACnC,IACjB8B,aAAU;AAAA,UAAE,CACV;IAAEF,MAAM;IAASG,MAAM;IAAUC,SAAS;IAAK,EAC/C;IACEJ,MAAM;IACNI,SACEvC,QAAQwC,OAAOC,SAASH,SAAS,UACjCtC,QAAQwC,OAAOC,SAASH,SAAS,YAC7B,SACA;IACP,CACF;;EAAA,IAAAI,WAAA;AAAA,UAAA;IAAAT,gBACAzC,+BAA6B;KAAA,IAC5BS,SAAM;AAAA,aAAEA,OAAO+B;;KAAK,IACpBvB,cAAW;AAAA,aAAEA,YAAYuB;;KAAK,IAC9B1B,SAAM;AAAA,aAAEA,OAAO0B;;KACNnC;KACMD;KACNE;KAAO,IAAA4C,WAAA;AAAA,aACf1D,IAAI,uBAAuB0B,WAAWsB,MACpCW,KAAIC,SAAQC,KAAKC,UAAUF,KAAKG,MAAM,CAAC,CAAC,CACxCC,KAAK,KAAK,CAAA;wHAEbjB,aAAaC,MAAK,UACTzB,MAAMyB,MAAK;;KAA4C,CAAA;IAAAC,gBAEjE9C,aAAW;KAAC8D,WAAWjE,IAAI;KAA0B0D,UACnD1D,IAAI;KAAqB,CAAA;IAAAiD,gBAE3B9C,aAAW;KAAC8D,WAAWjE,IAAI;KAAc,IAAA0D,WAAA;AAAA,aAAA,CACvC1D,IAAI,2CAAyCiD,gBAC7C9C,aAAW;OAAC8D,WAAWjE,IAAI;OAAyB,IAAA0D,WAAA;AAAA,eAClD1D,IAAI;sCACqBM,YACxBU,SACA,KACD,CAAA;;;OACA,CAAA,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA"}
@@ -53,6 +53,7 @@ function CommandEntry(props) {
53
53
  ],
54
54
  console: [
55
55
  "debug",
56
+ "info",
56
57
  "warn",
57
58
  "error",
58
59
  "table",
@@ -78,7 +79,8 @@ function CommandEntry(props) {
78
79
  "select",
79
80
  "isCancel",
80
81
  "sleep"
81
- ]
82
+ ],
83
+ upgrade: ["checkForUpdates"]
82
84
  });
83
85
  },
84
86
  get children() {
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core1 from "@alloy-js/core";
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
2
  import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
3
3
  import { CommandTree } from "@shell-shock/core/types/command";
4
4
 
@@ -9,7 +9,7 @@ interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinitio
9
9
  /**
10
10
  * The command entry point for the Shell Shock project.
11
11
  */
12
- declare function CommandEntry(props: CommandEntryProps): _alloy_js_core1.Children;
12
+ declare function CommandEntry(props: CommandEntryProps): _alloy_js_core0.Children;
13
13
  //#endregion
14
14
  export { CommandEntry, CommandEntryProps };
15
15
  //# sourceMappingURL=command-entry.d.cts.map
@@ -51,6 +51,7 @@ function CommandEntry(props) {
51
51
  ],
52
52
  console: [
53
53
  "debug",
54
+ "info",
54
55
  "warn",
55
56
  "error",
56
57
  "table",
@@ -76,7 +77,8 @@ function CommandEntry(props) {
76
77
  "select",
77
78
  "isCancel",
78
79
  "sleep"
79
- ]
80
+ ],
81
+ upgrade: ["checkForUpdates"]
80
82
  });
81
83
  },
82
84
  get children() {
@@ -1 +1 @@
1
- {"version":3,"file":"command-entry.mjs","names":["code","computed","For","Match","Show","Switch","ElseIfClause","IfStatement","ReflectionKind","Spacing","usePowerlines","EntryFile","isDynamicPathSegment","CommandHandlerDeclaration","CommandValidationLogic","findFilePath","relativePath","joinPaths","replaceExtension","camelCase","pascalCase","defu","BannerFunctionDeclaration","VirtualCommandEntry","CommandEntry","props","command","imports","builtinImports","rest","context","filePath","segments","filter","segment","join","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$createComponent","_$mergeProps","path","name","prompts","env","console","utils","children","_$createIntrinsic","banner","condition","when","Object","values","options","option","optional","length","arguments","argument","map","kind","string","number","variadic","includes","each","doubleHardline","description","boolean","child","isVirtual","fallback"],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, For, Match, Show, Switch } from \"@alloy-js/core\";\nimport { ElseIfClause, IfStatement } from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { isDynamicPathSegment } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport {\n CommandHandlerDeclaration,\n CommandValidationLogic\n} from \"@shell-shock/preset-script/components/command-entry\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n const commandSourcePath = computed(() =>\n replaceExtension(\n relativePath(\n joinPaths(context.entryPath, findFilePath(filePath.value)),\n command.entry.input?.file || command.entry.file\n )\n )\n );\n const typeDefinition = computed(() => ({\n ...command.entry,\n output: command.id\n }));\n\n return (\n <>\n <EntryFile\n {...rest}\n path={filePath.value}\n typeDefinition={typeDefinition.value}\n imports={defu(imports ?? {}, {\n [commandSourcePath.value]: `handle${pascalCase(command.name)}`,\n prompts: \"prompts\"\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isDevelopment\", \"isDebug\"],\n console: [\n \"debug\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isInteractive\",\n \"isHelp\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ],\n prompts: [\"text\", \"numeric\", \"toggle\", \"select\", \"isCancel\", \"sleep\"]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <CommandHandlerDeclaration\n command={command}\n banner={code`await banner(); `}>\n <IfStatement condition={code`!isInteractive`}>\n <CommandValidationLogic command={command} />\n </IfStatement>\n <Show\n when={\n Object.values(command.options ?? {}).filter(\n option => !option.optional\n ).length > 0 ||\n Object.values(command.arguments ?? {}).filter(\n argument => !argument.optional\n ).length > 0\n }>\n <ElseIfClause\n condition={code`!isHelp && (${Object.values(command.options ?? {})\n .filter(option => !option.optional)\n .map(option =>\n (option.kind === ReflectionKind.string ||\n option.kind === ReflectionKind.number) &&\n option.variadic\n ? `(!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } || options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0)`\n : `options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } === undefined`\n )\n .join(\" || \")}${\n Object.values(command.options ?? {}).filter(\n option => !option.optional\n ).length > 0 &&\n Object.values(command.arguments ?? {}).filter(\n argument => !argument.optional\n ).length > 0\n ? \" || \"\n : \"\"\n }${Object.values(command.arguments ?? {})\n .filter(argument => !argument.optional)\n .map(argument =>\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n ? `(!${camelCase(\n argument.name\n )} || ${camelCase(argument.name)}.length === 0)`\n : `${camelCase(argument.name)} === undefined`\n )\n .join(\" || \")}) `}>\n {code`writeLine(\"\"); `}\n <Spacing />\n <For each={Object.values(command.options ?? {})} doubleHardline>\n {option => (\n <>\n <Show when={!option.optional}>\n <IfStatement\n condition={code`!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }`}>\n <Switch>\n <Match\n when={option.kind === ReflectionKind.string}>{code`\n const value = await text({\n message: \"Please provide a value for the \\\\\"${option.name}\\\\\" option\",\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this option\";\n }\n\n return null;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n <Match\n when={option.kind === ReflectionKind.number}>{code`\n const value = await numeric({\n message: \"Please provide a numeric value for the \\\\\"${option.name}\\\\\" option\",\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n <Match\n when={option.kind === ReflectionKind.boolean}>{code`\n const value = await toggle({\n message: \"Please select a value for the \\\\\"${\n option.name\n }\\\\\" option\",\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n </Switch>\n </IfStatement>\n <Show\n when={\n (option.kind === ReflectionKind.string ||\n option.kind === ReflectionKind.number) &&\n option.variadic\n }>\n <ElseIfClause\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0`}>\n {code`\n const value = await text({\n message: \"Please provide one or more${\n option.kind === ReflectionKind.number\n ? \" numeric\"\n : \"\"\n } values for the \\\\\"${option.name}\\\\\" option (values are separated by a \\\\\",\\\\\" character)\",\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this option\";\n }\n if (val.split(\",\").map(v => v.trim()).filter(Boolean).length === 0) {\n return \"At least one value must be provided for this option\";\n }\n ${\n option.kind === ReflectionKind.number\n ? `const invalidIndex = val.split(\",\").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));\n if (invalidIndex !== -1) {\n return \\`Invalid numeric value provided for item #\\${invalidIndex + 1} - all provided items must be a valid number\\`;\n } `\n : \"\"\n }\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value.split(\",\").map(value => value.trim()).filter(Boolean)${\n option.kind === ReflectionKind.number\n ? `.map(Number)`\n : \"\"\n } ;\n `}\n </ElseIfClause>\n </Show>\n </Show>\n </>\n )}\n </For>\n <Spacing />\n <For each={command.arguments} doubleHardline>\n {argument => (\n <>\n <Show when={!argument.optional}>\n <IfStatement\n condition={code`!${camelCase(argument.name)}`}>\n <Switch>\n <Match\n when={\n argument.kind === ReflectionKind.string\n }>{code`\n const value = await text({\n message: \"Please provide a value for the \\\\\"${argument.name}\\\\\" argument\",\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this argument\";\n }\n\n return null;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value;\n `}</Match>\n <Match\n when={\n argument.kind === ReflectionKind.number\n }>{code`\n const value = await numeric({\n message: \"Please provide a numeric value for the \\\\\"${argument.name}\\\\\" argument\",\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value;\n `}</Match>\n <Match\n when={\n argument.kind === ReflectionKind.boolean\n }>{code`\n const value = await toggle({\n message: \"Please select a value for the \\\\\"${argument.name}\\\\\" argument\",\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value;\n `}</Match>\n </Switch>\n </IfStatement>\n <Show\n when={\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n }>\n <ElseIfClause\n condition={code`${camelCase(argument.name)}.length === 0`}>\n {code`\n const value = await text({\n message: \"Please provide one or more${\n argument.kind === ReflectionKind.number\n ? \" numeric\"\n : \"\"\n } (values are separated by a \\\\\",\\\\\" character)\",\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this argument\";\n }\n if (val.split(\",\").map(v => v.trim()).filter(Boolean).length === 0) {\n return \"At least one value must be provided for this argument\";\n }\n ${\n argument.kind === ReflectionKind.number\n ? `const invalidIndex = val.split(\",\").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));\n if (invalidIndex !== -1) {\n return \\`Invalid numeric value provided for item #\\${invalidIndex + 1} - all provided items must be a valid number\\`;\n } `\n : \"\"\n }\n\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value.split(\",\").map(value => value.trim()).filter(Boolean)${\n argument.kind === ReflectionKind.number\n ? `.map(Number)`\n : \"\"\n } ;\n `}\n </ElseIfClause>\n </Show>\n </Show>\n </>\n )}\n </For>\n {code`writeLine(\"\"); `}\n <Spacing />\n </ElseIfClause>\n </Show>\n </CommandHandlerDeclaration>\n </EntryFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmDA,SAAgBwB,aAAaC,OAA0B;CACrD,MAAM,EAAEC,SAASC,SAASC,gBAAgB,GAAGC,SAASJ;CAEtD,MAAMK,UAAUpB,eAAiC;CACjD,MAAMqB,WAAW9B,eACfgB,UACES,QAAQM,SACLC,QAAOC,YAAW,CAACtB,qBAAqBsB,QAAQ,CAAC,CACjDC,KAAK,IAAI,EACZ,WAEJ,CAAC;CACD,MAAMC,oBAAoBnC,eACxBiB,iBACEF,aACEC,UAAUa,QAAQO,WAAWtB,aAAagB,SAASO,MAAM,CAAC,EAC1DZ,QAAQa,MAAMC,OAAOC,QAAQf,QAAQa,MAAME,KAE/C,CACF,CAAC;CACD,MAAMC,iBAAiBzC,gBAAgB;EACrC,GAAGyB,QAAQa;EACXI,QAAQjB,QAAQkB;EACjB,EAAE;AAEH,QAAA,CAAAC,gBAEKlC,WAASmC,WACJjB,MAAI;EAAA,IACRkB,OAAI;AAAA,UAAEhB,SAASO;;EAAK,IACpBI,iBAAc;AAAA,UAAEA,eAAeJ;;EAAK,IACpCX,UAAO;AAAA,U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eAAe6D,SAC7B,aACA,GAAE;gCAGNJ,SAASS,cACL,iBAAiBT,SAASS,YAAW;kCAErC,GAAE;;;;;;;kCASJT,SAASE,SAAS3D,eAAe6D,SAC7B;;;0CAIA,GAAE;;;;;;;;;8BAUVlD,UAAU8C,SAASjB,KAAK,CAAA,gEACxBiB,SAASE,SAAS3D,eAAe6D,SAC7B,iBACA,GAAE;;;iBAET,CAAA;;eAAA,CAAA,CAAA;;aAAA,CAAA,CAAA;YAKV,CAAA;WAEFrE,IAAI;WAAiB6C,gBACrBpC,SAAO,EAAA,CAAA;WAAA;;SAAA,CAAA;;OAAA,CAAA,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAAoC,gBAKf3C,KAAG;EAAA,IAACsE,OAAI;AAAA,UAAEd,OAAOC,OAAOjC,QAAQ2B,SAAS;;EAAAA,WACvCuB,UAAK/B,gBACHzC,MAAI;GAAA,IACHqD,OAAI;AAAA,WAAEmB,MAAMC;;GAAS,IACrBC,WAAQ;AAAA,WAAAjC,gBAAGrB,cAAY,EAACE,SAASkD,OAAK,CAAA;;GAAA,IAAAvB,WAAA;AAAA,WAAAR,gBACrCtB,qBAAmB,EAACG,SAASkD,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
1
+ {"version":3,"file":"command-entry.mjs","names":["code","computed","For","Match","Show","Switch","ElseIfClause","IfStatement","ReflectionKind","Spacing","usePowerlines","EntryFile","isDynamicPathSegment","CommandHandlerDeclaration","CommandValidationLogic","findFilePath","relativePath","joinPaths","replaceExtension","camelCase","pascalCase","defu","BannerFunctionDeclaration","VirtualCommandEntry","CommandEntry","props","command","imports","builtinImports","rest","context","filePath","segments","filter","segment","join","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$createComponent","_$mergeProps","path","name","prompts","env","console","utils","upgrade","children","_$createIntrinsic","banner","condition","when","Object","values","options","option","optional","length","arguments","argument","map","kind","string","number","variadic","includes","each","doubleHardline","description","boolean","child","isVirtual","fallback"],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, For, Match, Show, Switch } from \"@alloy-js/core\";\nimport { ElseIfClause, IfStatement } from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { isDynamicPathSegment } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport {\n CommandHandlerDeclaration,\n CommandValidationLogic\n} from \"@shell-shock/preset-script/components/command-entry\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n const commandSourcePath = computed(() =>\n replaceExtension(\n relativePath(\n joinPaths(context.entryPath, findFilePath(filePath.value)),\n command.entry.input?.file || command.entry.file\n )\n )\n );\n const typeDefinition = computed(() => ({\n ...command.entry,\n output: command.id\n }));\n\n return (\n <>\n <EntryFile\n {...rest}\n path={filePath.value}\n typeDefinition={typeDefinition.value}\n imports={defu(imports ?? {}, {\n [commandSourcePath.value]: `handle${pascalCase(command.name)}`,\n prompts: \"prompts\"\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isDevelopment\", \"isDebug\"],\n console: [\n \"debug\",\n \"info\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isInteractive\",\n \"isHelp\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ],\n prompts: [\"text\", \"numeric\", \"toggle\", \"select\", \"isCancel\", \"sleep\"],\n upgrade: [\"checkForUpdates\"]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <CommandHandlerDeclaration\n command={command}\n banner={code`await banner(); `}>\n <IfStatement condition={code`!isInteractive`}>\n <CommandValidationLogic command={command} />\n </IfStatement>\n <Show\n when={\n Object.values(command.options ?? {}).filter(\n option => !option.optional\n ).length > 0 ||\n Object.values(command.arguments ?? {}).filter(\n argument => !argument.optional\n ).length > 0\n }>\n <ElseIfClause\n condition={code`!isHelp && (${Object.values(command.options ?? {})\n .filter(option => !option.optional)\n .map(option =>\n (option.kind === ReflectionKind.string ||\n option.kind === ReflectionKind.number) &&\n option.variadic\n ? `(!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } || options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0)`\n : `options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } === undefined`\n )\n .join(\" || \")}${\n Object.values(command.options ?? {}).filter(\n option => !option.optional\n ).length > 0 &&\n Object.values(command.arguments ?? {}).filter(\n argument => !argument.optional\n ).length > 0\n ? \" || \"\n : \"\"\n }${Object.values(command.arguments ?? {})\n .filter(argument => !argument.optional)\n .map(argument =>\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n ? `(!${camelCase(\n argument.name\n )} || ${camelCase(argument.name)}.length === 0)`\n : `${camelCase(argument.name)} === undefined`\n )\n .join(\" || \")}) `}>\n {code`writeLine(\"\"); `}\n <Spacing />\n <For each={Object.values(command.options ?? {})} doubleHardline>\n {option => (\n <>\n <Show when={!option.optional}>\n <IfStatement\n condition={code`!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }`}>\n <Switch>\n <Match\n when={option.kind === ReflectionKind.string}>{code`\n const value = await text({\n message: \"Please provide a value for the \\\\\"${option.name}\\\\\" option\",\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this option\";\n }\n\n return null;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n <Match\n when={option.kind === ReflectionKind.number}>{code`\n const value = await numeric({\n message: \"Please provide a numeric value for the \\\\\"${option.name}\\\\\" option\",\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n <Match\n when={option.kind === ReflectionKind.boolean}>{code`\n const value = await toggle({\n message: \"Please select a value for the \\\\\"${\n option.name\n }\\\\\" option\",\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n </Switch>\n </IfStatement>\n <Show\n when={\n (option.kind === ReflectionKind.string ||\n option.kind === ReflectionKind.number) &&\n option.variadic\n }>\n <ElseIfClause\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0`}>\n {code`\n const value = await text({\n message: \"Please provide one or more${\n option.kind === ReflectionKind.number\n ? \" numeric\"\n : \"\"\n } values for the \\\\\"${option.name}\\\\\" option (values are separated by a \\\\\",\\\\\" character)\",\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this option\";\n }\n if (val.split(\",\").map(v => v.trim()).filter(Boolean).length === 0) {\n return \"At least one value must be provided for this option\";\n }\n ${\n option.kind === ReflectionKind.number\n ? `const invalidIndex = val.split(\",\").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));\n if (invalidIndex !== -1) {\n return \\`Invalid numeric value provided for item #\\${invalidIndex + 1} - all provided items must be a valid number\\`;\n } `\n : \"\"\n }\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value.split(\",\").map(value => value.trim()).filter(Boolean)${\n option.kind === ReflectionKind.number\n ? `.map(Number)`\n : \"\"\n } ;\n `}\n </ElseIfClause>\n </Show>\n </Show>\n </>\n )}\n </For>\n <Spacing />\n <For each={command.arguments} doubleHardline>\n {argument => (\n <>\n <Show when={!argument.optional}>\n <IfStatement\n condition={code`!${camelCase(argument.name)}`}>\n <Switch>\n <Match\n when={\n argument.kind === ReflectionKind.string\n }>{code`\n const value = await text({\n message: \"Please provide a value for the \\\\\"${argument.name}\\\\\" argument\",\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this argument\";\n }\n\n return null;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value;\n `}</Match>\n <Match\n when={\n argument.kind === ReflectionKind.number\n }>{code`\n const value = await numeric({\n message: \"Please provide a numeric value for the \\\\\"${argument.name}\\\\\" argument\",\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value;\n `}</Match>\n <Match\n when={\n argument.kind === ReflectionKind.boolean\n }>{code`\n const value = await toggle({\n message: \"Please select a value for the \\\\\"${argument.name}\\\\\" argument\",\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value;\n `}</Match>\n </Switch>\n </IfStatement>\n <Show\n when={\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n }>\n <ElseIfClause\n condition={code`${camelCase(argument.name)}.length === 0`}>\n {code`\n const value = await text({\n message: \"Please provide one or more${\n argument.kind === ReflectionKind.number\n ? \" numeric\"\n : \"\"\n } (values are separated by a \\\\\",\\\\\" character)\",\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this argument\";\n }\n if (val.split(\",\").map(v => v.trim()).filter(Boolean).length === 0) {\n return \"At least one value must be provided for this argument\";\n }\n ${\n argument.kind === ReflectionKind.number\n ? `const invalidIndex = val.split(\",\").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));\n if (invalidIndex !== -1) {\n return \\`Invalid numeric value provided for item #\\${invalidIndex + 1} - all provided items must be a valid number\\`;\n } `\n : \"\"\n }\n\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value.split(\",\").map(value => value.trim()).filter(Boolean)${\n argument.kind === ReflectionKind.number\n ? `.map(Number)`\n : \"\"\n } ;\n `}\n </ElseIfClause>\n </Show>\n </Show>\n </>\n )}\n </For>\n {code`writeLine(\"\"); `}\n <Spacing />\n </ElseIfClause>\n </Show>\n </CommandHandlerDeclaration>\n </EntryFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmDA,SAAgBwB,aAAaC,OAA0B;CACrD,MAAM,EAAEC,SAASC,SAASC,gBAAgB,GAAGC,SAASJ;CAEtD,MAAMK,UAAUpB,eAAiC;CACjD,MAAMqB,WAAW9B,eACfgB,UACES,QAAQM,SACLC,QAAOC,YAAW,CAACtB,qBAAqBsB,QAAQ,CAAC,CACjDC,KAAK,IAAI,EACZ,WAEJ,CAAC;CACD,MAAMC,oBAAoBnC,eACxBiB,iBACEF,aACEC,UAAUa,QAAQO,WAAWtB,aAAagB,SAASO,MAAM,CAAC,EAC1DZ,QAAQa,MAAMC,OAAOC,QAAQf,QAAQa,MAAME,KAE/C,CACF,CAAC;CACD,MAAMC,iBAAiBzC,gBAAgB;EACrC,GAAGyB,QAAQa;EACXI,QAAQjB,QAAQkB;EACjB,EAAE;AAEH,QAAA,CAAAC,gBAEKlC,WAASmC,WACJjB,MAAI;EAAA,IACRkB,OAAI;AAAA,UAAEhB,SAASO;;EAAK,IACpBI,iBAAc;AAAA,UAAEA,eAAeJ;;EAAK,IACpCX,UAAO;AAAA,UA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A,yBACxDtD,IAAI;;oEAGCkE,SAASE,SAAS5D,eAAe8D,SAC7B,aACA,GAAE;gCAGNJ,SAASS,cACL,iBAAiBT,SAASS,YAAW;kCAErC,GAAE;;;;;;;kCASJT,SAASE,SAAS5D,eAAe8D,SAC7B;;;0CAIA,GAAE;;;;;;;;;8BAUVnD,UAAU+C,SAASlB,KAAK,CAAA,gEACxBkB,SAASE,SAAS5D,eAAe8D,SAC7B,iBACA,GAAE;;;iBAET,CAAA;;eAAA,CAAA,CAAA;;aAAA,CAAA,CAAA;YAKV,CAAA;WAEFtE,IAAI;WAAiB6C,gBACrBpC,SAAO,EAAA,CAAA;WAAA;;SAAA,CAAA;;OAAA,CAAA,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAAoC,gBAKf3C,KAAG;EAAA,IAACuE,OAAI;AAAA,UAAEd,OAAOC,OAAOlC,QAAQ4B,SAAS;;EAAAA,WACvCuB,UAAKhC,gBACHzC,MAAI;GAAA,IACHsD,OAAI;AAAA,WAAEmB,MAAMC;;GAAS,IACrBC,WAAQ;AAAA,WAAAlC,gBAAGrB,cAAY,EAACE,SAASmD,OAAK,CAAA;;GAAA,IAAAvB,WAAA;AAAA,WAAAT,gBACrCtB,qBAAmB,EAACG,SAASmD,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core2 from "@alloy-js/core";
1
+ import * as _alloy_js_core1 from "@alloy-js/core";
2
2
  import { CommandTree } from "@shell-shock/core/types/command";
3
3
  import { CommandRouterProps } from "@shell-shock/preset-script/components/command-router";
4
4
 
@@ -6,11 +6,11 @@ import { CommandRouterProps } from "@shell-shock/preset-script/components/comman
6
6
  interface CommandRouterSelectOptionsProps {
7
7
  commands?: Record<string, CommandTree>;
8
8
  }
9
- declare function CommandRouterSelectOptions(props: CommandRouterSelectOptionsProps): _alloy_js_core2.Children;
9
+ declare function CommandRouterSelectOptions(props: CommandRouterSelectOptionsProps): _alloy_js_core1.Children;
10
10
  /**
11
11
  * A component that renders a command router interface, allowing users to select and execute commands from a provided list of commands and segments. This component serves as a wrapper around the base CommandRouter, adding additional UI elements and logic for command selection.
12
12
  */
13
- declare function CommandRouter(props: CommandRouterProps): _alloy_js_core2.Children;
13
+ declare function CommandRouter(props: CommandRouterProps): _alloy_js_core1.Children;
14
14
  //#endregion
15
15
  export { CommandRouter, CommandRouterSelectOptions, CommandRouterSelectOptionsProps };
16
16
  //# sourceMappingURL=command-router.d.cts.map
@@ -47,6 +47,7 @@ function VirtualCommandEntry(props) {
47
47
  console: [
48
48
  "warn",
49
49
  "error",
50
+ "info",
50
51
  "help",
51
52
  "table",
52
53
  "colors",
@@ -45,6 +45,7 @@ function VirtualCommandEntry(props) {
45
45
  console: [
46
46
  "warn",
47
47
  "error",
48
+ "info",
48
49
  "help",
49
50
  "table",
50
51
  "colors",
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-command-entry.mjs","names":["computed","For","Show","usePowerlines","TypescriptFile","isDynamicPathSegment","VirtualCommandHandlerDeclaration","joinPaths","pascalCase","defu","BannerFunctionDeclaration","CommandEntry","CommandRouter","VirtualCommandEntry","props","command","imports","builtinImports","rest","context","filePath","entryPath","segments","filter","segment","join","_$createComponent","_$mergeProps","path","value","didyoumean2","name","default","Object","entries","children","child","isVirtual","reduce","ret","alias","env","console","utils","prompts","_$createIntrinsic","commands","each","values","when","fallback"],"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 { 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 { isDynamicPathSegment } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\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 { BannerFunctionDeclaration } from \"./banner-function-declaration\";\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 {\n didyoumean2: [\n { name: \"didYouMean\", default: true },\n { name: \"ReturnTypeEnums\" },\n { name: \"ThresholdTypeEnums\" }\n ]\n },\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 \"help\",\n \"table\",\n \"colors\",\n \"writeLine\",\n \"splitText\",\n \"stripAnsi\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"isInteractive\",\n \"isHelp\"\n ],\n prompts: [\"text\", \"numeric\", \"toggle\", \"select\", \"isCancel\", \"sleep\"]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\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":";;;;;;;;;;;;;;;;;AA4CA,SAAgBa,oBAAoBC,OAAiC;CACnE,MAAM,EAAEC,SAASC,SAASC,gBAAgB,GAAGC,SAASJ;CAEtD,MAAMK,UAAUhB,eAAiC;CACjD,MAAMiB,WAAWpB,eACfO,UACEY,QAAQE,WACRN,QAAQO,SACLC,QAAOC,YAAW,CAACnB,qBAAqBmB,QAAQ,CAAC,CACjDC,KAAK,IAAI,EACZ,WAEJ,CAAC;AAED,QAAA,CAAAC,gBAEKtB,gBAAcuB,WACTT,MAAI;EAAA,IACRU,OAAI;AAAA,UAAER,SAASS;;EAAK,IACpBb,UAAO;AAAA,UAAEP,KACP,EACEqB,aAAa;IACX;KAAEC,MAAM;KAAcC,SAAS;KAAM;IACrC,EAAED,MAAM,mBAAmB;IAC3B,EAAEA,MAAM,sBAAsB;IAAA,EAEjC,EACDf,WAAW,EAAE,EACbiB,OAAOC,QAAQnB,QAAQoB,SAAS,CAC7BZ,QAAQ,GAAGa,WAAWA,MAAMC,UAAU,CACtCC,QAAQC,KAAK,CAACR,MAAMK,WAAW;AAC9BG,QAAI,KAAKH,MAAML,UAAU,CACvB;KAAEA,MAAM;KAAWS,OAAO,SAAShC,WAAWuB,KAAK;KAAI,CACxD;AAED,WAAOQ;MACN,EAA2B,CAClC,CAAC;;EAAA,IACDtB,iBAAc;AAAA,UAAER,KAAKQ,kBAAkB,EAAE,EAAE;IACzCwB,KAAK,CAAC,iBAAiB,UAAU;IACjCC,SAAS;KACP;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACD;IACDC,OAAO;KACL;KACA;KACA;KACA;KACA;KACA;KACA;KACD;IACDC,SAAS;KAAC;KAAQ;KAAW;KAAU;KAAU;KAAY;KAAO;IACrE,CAAC;;EAAA,IAAAT,WAAA;AAAA,UAAA;IAAAT,gBACDhB,2BAAyB,EAAUK,SAAO,CAAA;IAAA8B,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAnB,gBAG1CpB,kCAAgC;KAAUS;KAAO,IAAAoB,WAAA;AAAA,aAAAT,gBAC/Cd,eAAa;OAAA,IACZU,WAAQ;AAAA,eAAEP,QAAQO;;OAAQ,IAC1BwB,WAAQ;AAAA,eAAE/B,QAAQoB;;OAAQ,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAAT,gBAI/BzB,KAAG;EAAA,IAAC8C,OAAI;AAAA,UAAEd,OAAOe,OAAOjC,QAAQoB,SAAS;;EAAAA,WACvCC,UAAKV,gBACHxB,MAAI;GAAA,IACH+C,OAAI;AAAA,WAAEb,MAAMC;;GAAS,IACrBa,WAAQ;AAAA,WAAAxB,gBAAGf,cAAY,EAACI,SAASqB,OAAK,CAAA;;GAAA,IAAAD,WAAA;AAAA,WAAAT,gBACrCb,qBAAmB,EAACE,SAASqB,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
1
+ {"version":3,"file":"virtual-command-entry.mjs","names":["computed","For","Show","usePowerlines","TypescriptFile","isDynamicPathSegment","VirtualCommandHandlerDeclaration","joinPaths","pascalCase","defu","BannerFunctionDeclaration","CommandEntry","CommandRouter","VirtualCommandEntry","props","command","imports","builtinImports","rest","context","filePath","entryPath","segments","filter","segment","join","_$createComponent","_$mergeProps","path","value","didyoumean2","name","default","Object","entries","children","child","isVirtual","reduce","ret","alias","env","console","utils","prompts","_$createIntrinsic","commands","each","values","when","fallback"],"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 { 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 { isDynamicPathSegment } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\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 { BannerFunctionDeclaration } from \"./banner-function-declaration\";\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 {\n didyoumean2: [\n { name: \"didYouMean\", default: true },\n { name: \"ReturnTypeEnums\" },\n { name: \"ThresholdTypeEnums\" }\n ]\n },\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 \"colors\",\n \"writeLine\",\n \"splitText\",\n \"stripAnsi\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"isInteractive\",\n \"isHelp\"\n ],\n prompts: [\"text\", \"numeric\", \"toggle\", \"select\", \"isCancel\", \"sleep\"]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\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":";;;;;;;;;;;;;;;;;AA4CA,SAAgBa,oBAAoBC,OAAiC;CACnE,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AC/Cd,eAAa;OAAA,IACZU,WAAQ;AAAA,eAAEP,QAAQO;;OAAQ,IAC1BwB,WAAQ;AAAA,eAAE/B,QAAQoB;;OAAQ,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAAT,gBAI/BzB,KAAG;EAAA,IAAC8C,OAAI;AAAA,UAAEd,OAAOe,OAAOjC,QAAQoB,SAAS;;EAAAA,WACvCC,UAAKV,gBACHxB,MAAI;GAAA,IACH+C,OAAI;AAAA,WAAEb,MAAMC;;GAAS,IACrBa,WAAQ;AAAA,WAAAxB,gBAAGf,cAAY,EAACI,SAASqB,OAAK,CAAA;;GAAA,IAAAD,WAAA;AAAA,WAAAT,gBACrCb,qBAAmB,EAACE,SAASqB,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
package/dist/index.cjs CHANGED
@@ -29,7 +29,7 @@ const plugin = (options = {}) => {
29
29
  return [
30
30
  (0, __shell_shock_plugin_console.default)(options),
31
31
  (0, __shell_shock_plugin_prompts.default)(options),
32
- (0, __shell_shock_plugin_upgrade.default)({ packageName: options.packageName }),
32
+ options.upgrade !== false && (0, __shell_shock_plugin_upgrade.default)(options.upgrade),
33
33
  {
34
34
  name: "shell-shock:cli-preset",
35
35
  config() {
@@ -54,6 +54,7 @@ const plugin = (options = {}) => {
54
54
  return (0, __powerlines_plugin_alloy_render.render)(this, [(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_bin_entry.BinEntry, {
55
55
  builtinImports: {
56
56
  console: [
57
+ "info",
57
58
  "divider",
58
59
  "stripAnsi",
59
60
  "writeLine",
@@ -78,7 +79,8 @@ const plugin = (options = {}) => {
78
79
  "select",
79
80
  "isCancel",
80
81
  "sleep"
81
- ]
82
+ ],
83
+ upgrade: ["checkForUpdates"]
82
84
  },
83
85
  get prefix() {
84
86
  return [
@@ -113,7 +115,7 @@ const plugin = (options = {}) => {
113
115
  }
114
116
  }),
115
117
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
116
- __alloy_js_core.code`await banner(0);`,
118
+ __alloy_js_core.code`await banner(0, false);`,
117
119
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
118
120
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
119
121
  (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_help.VirtualHelp, {
package/dist/index.mjs CHANGED
@@ -24,7 +24,7 @@ const plugin = (options = {}) => {
24
24
  return [
25
25
  console(options),
26
26
  prompts(options),
27
- upgrade({ packageName: options.packageName }),
27
+ options.upgrade !== false && upgrade(options.upgrade),
28
28
  {
29
29
  name: "shell-shock:cli-preset",
30
30
  config() {
@@ -49,6 +49,7 @@ const plugin = (options = {}) => {
49
49
  return render(this, [createComponent(BinEntry, {
50
50
  builtinImports: {
51
51
  console: [
52
+ "info",
52
53
  "divider",
53
54
  "stripAnsi",
54
55
  "writeLine",
@@ -73,7 +74,8 @@ const plugin = (options = {}) => {
73
74
  "select",
74
75
  "isCancel",
75
76
  "sleep"
76
- ]
77
+ ],
78
+ upgrade: ["checkForUpdates"]
77
79
  },
78
80
  get prefix() {
79
81
  return [
@@ -108,7 +110,7 @@ const plugin = (options = {}) => {
108
110
  }
109
111
  }),
110
112
  createIntrinsic("hbr", {}),
111
- code`await banner(0);`,
113
+ code`await banner(0, false);`,
112
114
  createIntrinsic("hbr", {}),
113
115
  createIntrinsic("hbr", {}),
114
116
  createComponent(VirtualHelp, {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","console","prompts","upgrade","BinEntry","VirtualHelp","BannerFunctionDeclaration","CommandEntry","CommandRouter","VirtualCommandEntry","getDefaultOptions","plugin","options","packageName","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","order","handler","_self$","_$createComponent","builtinImports","utils","prefix","_$createIntrinsic","children","when","Object","keys","commands","length","type","initializer","segments","values","each","doubleHardline","child","isVirtual","fallback","command"],"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, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport console from \"@shell-shock/plugin-console\";\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 { VirtualHelp } from \"@shell-shock/preset-script/components/help\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BannerFunctionDeclaration } from \"./components/banner-function-declaration\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\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) => {\n return [\n console(options),\n prompts(options),\n upgrade({\n packageName: options.packageName\n }),\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 configResolved() {\n this.dependencies.didyoumean2 = \"^7.0.4\";\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 \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\",\n \"help\",\n \"writeLine\",\n \"splitText\",\n \"stripAnsi\"\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 \"isCancel\",\n \"sleep\"\n ]\n }}\n prefix={\n <>\n <BannerFunctionDeclaration />\n <hbr />\n <hbr />\n </>\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 banner(0);`}\n <hbr />\n <hbr />\n <VirtualHelp\n options={this.options}\n commands={this.commands ?? {}}\n />\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 ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAae,UACXC,UAA4B,EAAE,KAC3B;AACH,QAAO;EACLX,QAAQW,QAAQ;EAChBV,QAAQU,QAAQ;EAChBT,QAAQ,EACNU,aAAaD,QAAQC,aACtB,CAAC;EACF;GACEC,MAA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O;AAAA,iBAAEa,OAAKb;;SAAO,IACrBuB,WAAQ;AAAA,iBAAEV,OAAKU,YAAY,EAAE;;SAAA,CAAA;QAAA;;MAAA,CAAA,EAAAT,gBAGhC5B,MAAI;MAAA,IAACkC,OAAI;AAAA,cAAEC,OAAOO,OAAOf,OAAKU,SAAS,CAACC,SAAS;;MAAC,IAAAL,WAAA;AAAA,cAAAL,gBAChD7B,KAAG;QAAA,IAAC4C,OAAI;AAAA,gBAAER,OAAOO,OAAOf,OAAKU,SAAS;;QAAEO,gBAAc;QAAAX,WACpDY,UAAKjB,gBACH5B,MAAI;SAAA,IACHkC,OAAI;AAAA,iBAAEW,MAAMC;;SAAS,IACrBC,WAAQ;AAAA,iBAAAnB,gBAAGnB,cAAY,EAACuC,SAASH,OAAK,CAAA;;SAAA,IAAAZ,WAAA;AAAA,iBAAAL,gBACrCjB,qBAAmB,EAACqC,SAASH,OAAK,CAAA;;SAAA,CAAA;QAEtC,CAAA;;MAAA,CAAA,CAIT,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAehC"}
1
+ {"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","console","prompts","upgrade","BinEntry","VirtualHelp","BannerFunctionDeclaration","CommandEntry","CommandRouter","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","order","handler","_self$","_$createComponent","builtinImports","utils","prefix","_$createIntrinsic","children","when","Object","keys","commands","length","type","initializer","segments","values","each","doubleHardline","child","isVirtual","fallback","command"],"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, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport console from \"@shell-shock/plugin-console\";\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 { VirtualHelp } from \"@shell-shock/preset-script/components/help\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BannerFunctionDeclaration } from \"./components/banner-function-declaration\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\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) => {\n return [\n console(options),\n prompts(options),\n options.upgrade !== false && upgrade(options.upgrade),\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 configResolved() {\n this.dependencies.didyoumean2 = \"^7.0.4\";\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 \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\",\n \"help\",\n \"writeLine\",\n \"splitText\",\n \"stripAnsi\"\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 \"isCancel\",\n \"sleep\"\n ],\n upgrade: [\"checkForUpdates\"]\n }}\n prefix={\n <>\n <BannerFunctionDeclaration />\n <hbr />\n <hbr />\n </>\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 banner(0, false);`}\n <hbr />\n <hbr />\n <VirtualHelp\n options={this.options}\n commands={this.commands ?? {}}\n />\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 ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAae,UACXC,UAA4B,EAAE,KAC3B;AACH,QAAO;EACLX,QAAQW,QAAQ;EAChBV,QAAQU,QAAQ;EAChBA,QAAQT,YAAY,SAASA,QAAQS,QAAQT,QAAQ;EACrD;GACEU,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,oEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEHM,iBAAiB;AACf,SAAKC,aAAaC,cAAc;;GAEnC;EACD;GACEP,MAAM;GACNQ,SAAS;IACPC,OAAO;IACP,MAAMC,UAAU;KAAA,MAAAC,SAAA;AACd,UAAKT,MACH,i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AAAL,WAAA;AAAA,cAAAL,gBAChD5B,KAAG;QAAA,IAAC2C,OAAI;AAAA,gBAAER,OAAOO,OAAOf,OAAKU,SAAS;;QAAEO,gBAAc;QAAAX,WACpDY,UAAKjB,gBACH3B,MAAI;SAAA,IACHiC,OAAI;AAAA,iBAAEW,MAAMC;;SAAS,IACrBC,WAAQ;AAAA,iBAAAnB,gBAAGlB,cAAY,EAACsC,SAASH,OAAK,CAAA;;SAAA,IAAAZ,WAAA;AAAA,iBAAAL,gBACrChB,qBAAmB,EAACoC,SAASH,OAAK,CAAA;;SAAA,CAAA;QAEtC,CAAA;;MAAA,CAAA,CAIT,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAe/B"}
@@ -1,11 +1,11 @@
1
1
  import { CommandBase, CommandOption } from "@shell-shock/core/types/command";
2
2
  import { Context } from "@shell-shock/core/types/context";
3
- import { ThemePluginResolvedConfig } from "@shell-shock/plugin-theme/types/plugin";
3
+ import { ThemePluginResolvedConfig, ThemePluginUserConfig } from "@shell-shock/plugin-theme/types/plugin";
4
4
  import { UpgradePluginContext, UpgradePluginOptions, UpgradePluginResolvedConfig, UpgradePluginUserConfig } from "@shell-shock/plugin-upgrade/types/plugin";
5
5
  import { ScriptPresetContext, ScriptPresetOptions, ScriptPresetResolvedConfig, ScriptPresetUserConfig } from "@shell-shock/preset-script/types/plugin";
6
6
 
7
7
  //#region src/types/plugin.d.ts
8
- type CLIPresetOptions = Omit<ScriptPresetOptions, "defaultOptions"> & UpgradePluginOptions & {
8
+ type CLIPresetOptions = Omit<ScriptPresetOptions, "defaultOptions"> & {
9
9
  /**
10
10
  * The default interactive mode to apply to commands.
11
11
  *
@@ -33,9 +33,16 @@ type CLIPresetOptions = Omit<ScriptPresetOptions, "defaultOptions"> & UpgradePlu
33
33
  * To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.
34
34
  */
35
35
  defaultOptions?: CommandOption[] | ((context: Context, input: CommandBase) => CommandOption[]) | false;
36
+ /**
37
+ * Whether to include the upgrade process provided by the `@shell-shock/plugin-upgrade` package. If set to `true`, the upgrade command will be included with default options. If set to an object, the provided options will be used to configure the upgrade command. If set to `false`, the upgrade command will not be included.
38
+ *
39
+ * @remarks
40
+ * The upgrade command allows users to check for and perform upgrades to the latest version of the application. If you would like to include the upgrade command in your CLI application, but manage its configuration separately, you can set this field to `true` and configure the upgrade plugin directly in your application's configuration.
41
+ */
42
+ upgrade?: UpgradePluginOptions | false;
36
43
  };
37
- type CLIPresetUserConfig = ScriptPresetUserConfig & UpgradePluginUserConfig & CLIPresetOptions;
38
- type CLIPresetResolvedConfig = ScriptPresetResolvedConfig & UpgradePluginResolvedConfig & Required<Omit<CLIPresetOptions, "theme">> & Pick<ThemePluginResolvedConfig, "theme">;
44
+ type CLIPresetUserConfig = ScriptPresetUserConfig & ThemePluginUserConfig & UpgradePluginUserConfig & Omit<CLIPresetOptions, "upgrade">;
45
+ type CLIPresetResolvedConfig = ScriptPresetResolvedConfig & UpgradePluginResolvedConfig & ThemePluginResolvedConfig & Required<Pick<CLIPresetOptions, "interactive" | "defaultOptions">>;
39
46
  type CLIPresetContext<TResolvedConfig extends CLIPresetResolvedConfig = CLIPresetResolvedConfig> = ScriptPresetContext<TResolvedConfig> & UpgradePluginContext<TResolvedConfig>;
40
47
  //#endregion
41
48
  export { CLIPresetContext, CLIPresetOptions, CLIPresetResolvedConfig, CLIPresetUserConfig };
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;KAqCY,gBAAA,GAAmB,KAAK,yCAClC;;AADF;;;;;;;;;AAmCA;EAAkC,WAAA,CAAA,EAAA,OAAA,GAAA,OAAA;EAChC;;;AAGF;;;;;;;;;AAKA;;EACoD,cAAA,CAAA,EAf5C,aAe4C,EAAA,GAAA,CAAA,CAAA,OAAA,EAdjC,OAciC,EAAA,KAAA,EAdjB,WAciB,EAAA,GAdD,aAcC,EAAA,CAAA,GAAA,KAAA;CAC5B;AAApB,KAXQ,mBAAA,GAAsB,sBAW9B,GAVF,uBAUE,GATF,gBASE;AACmB,KARX,uBAAA,GAA0B,0BAQf,GAPrB,2BAOqB,GANrB,QAMqB,CANZ,IAMY,CANP,gBAMO,EAAA,OAAA,CAAA,CAAA,GALrB,IAKqB,CALhB,yBAKgB,EAAA,OAAA,CAAA;AAArB,KAHU,gBAGV,CAAA,wBAFwB,uBAExB,GAFkD,uBAElD,CAAA,GADE,mBACF,CADsB,eACtB,CAAA,GAAA,oBAAA,CAAqB,eAArB,CAAA"}
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;KAwCY,gBAAA,GAAmB,KAAK;;AAApC;;;;;;;;;AA0CA;EAAkC,WAAA,CAAA,EAAA,OAAA,GAAA,OAAA;EAChC;;;;;AAIF;;;;;;;;AAKA;EAC0B,cAAA,CAAA,EAxBpB,aAwBoB,EAAA,GAAA,CAAA,CAAA,OAAA,EAvBT,OAuBS,EAAA,KAAA,EAvBO,WAuBP,EAAA,GAvBuB,aAuBvB,EAAA,CAAA,GAAA,KAAA;EAA0B;;;;;;YAdxC;;KAGA,mBAAA,GAAsB,yBAChC,wBACA,0BACA,KAAK;KAEK,uBAAA,GAA0B,6BACpC,8BACA,4BACA,SAAS,KAAK;KAEJ,yCACc,0BAA0B,2BAChD,oBAAoB,mBACtB,qBAAqB"}
@@ -1,11 +1,11 @@
1
1
  import { CommandBase, CommandOption } from "@shell-shock/core/types/command";
2
2
  import { Context } from "@shell-shock/core/types/context";
3
- import { ThemePluginResolvedConfig } from "@shell-shock/plugin-theme/types/plugin";
3
+ import { ThemePluginResolvedConfig, ThemePluginUserConfig } from "@shell-shock/plugin-theme/types/plugin";
4
4
  import { UpgradePluginContext, UpgradePluginOptions, UpgradePluginResolvedConfig, UpgradePluginUserConfig } from "@shell-shock/plugin-upgrade/types/plugin";
5
5
  import { ScriptPresetContext, ScriptPresetOptions, ScriptPresetResolvedConfig, ScriptPresetUserConfig } from "@shell-shock/preset-script/types/plugin";
6
6
 
7
7
  //#region src/types/plugin.d.ts
8
- type CLIPresetOptions = Omit<ScriptPresetOptions, "defaultOptions"> & UpgradePluginOptions & {
8
+ type CLIPresetOptions = Omit<ScriptPresetOptions, "defaultOptions"> & {
9
9
  /**
10
10
  * The default interactive mode to apply to commands.
11
11
  *
@@ -33,9 +33,16 @@ type CLIPresetOptions = Omit<ScriptPresetOptions, "defaultOptions"> & UpgradePlu
33
33
  * To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.
34
34
  */
35
35
  defaultOptions?: CommandOption[] | ((context: Context, input: CommandBase) => CommandOption[]) | false;
36
+ /**
37
+ * Whether to include the upgrade process provided by the `@shell-shock/plugin-upgrade` package. If set to `true`, the upgrade command will be included with default options. If set to an object, the provided options will be used to configure the upgrade command. If set to `false`, the upgrade command will not be included.
38
+ *
39
+ * @remarks
40
+ * The upgrade command allows users to check for and perform upgrades to the latest version of the application. If you would like to include the upgrade command in your CLI application, but manage its configuration separately, you can set this field to `true` and configure the upgrade plugin directly in your application's configuration.
41
+ */
42
+ upgrade?: UpgradePluginOptions | false;
36
43
  };
37
- type CLIPresetUserConfig = ScriptPresetUserConfig & UpgradePluginUserConfig & CLIPresetOptions;
38
- type CLIPresetResolvedConfig = ScriptPresetResolvedConfig & UpgradePluginResolvedConfig & Required<Omit<CLIPresetOptions, "theme">> & Pick<ThemePluginResolvedConfig, "theme">;
44
+ type CLIPresetUserConfig = ScriptPresetUserConfig & ThemePluginUserConfig & UpgradePluginUserConfig & Omit<CLIPresetOptions, "upgrade">;
45
+ type CLIPresetResolvedConfig = ScriptPresetResolvedConfig & UpgradePluginResolvedConfig & ThemePluginResolvedConfig & Required<Pick<CLIPresetOptions, "interactive" | "defaultOptions">>;
39
46
  type CLIPresetContext<TResolvedConfig extends CLIPresetResolvedConfig = CLIPresetResolvedConfig> = ScriptPresetContext<TResolvedConfig> & UpgradePluginContext<TResolvedConfig>;
40
47
  //#endregion
41
48
  export { CLIPresetContext, CLIPresetOptions, CLIPresetResolvedConfig, CLIPresetUserConfig };
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;KAqCY,gBAAA,GAAmB,KAAK,yCAClC;;AADF;;;;;;;;;AAmCA;EAAkC,WAAA,CAAA,EAAA,OAAA,GAAA,OAAA;EAChC;;;AAGF;;;;;;;;;AAKA;;EACoD,cAAA,CAAA,EAf5C,aAe4C,EAAA,GAAA,CAAA,CAAA,OAAA,EAdjC,OAciC,EAAA,KAAA,EAdjB,WAciB,EAAA,GAdD,aAcC,EAAA,CAAA,GAAA,KAAA;CAC5B;AAApB,KAXQ,mBAAA,GAAsB,sBAW9B,GAVF,uBAUE,GATF,gBASE;AACmB,KARX,uBAAA,GAA0B,0BAQf,GAPrB,2BAOqB,GANrB,QAMqB,CANZ,IAMY,CANP,gBAMO,EAAA,OAAA,CAAA,CAAA,GALrB,IAKqB,CALhB,yBAKgB,EAAA,OAAA,CAAA;AAArB,KAHU,gBAGV,CAAA,wBAFwB,uBAExB,GAFkD,uBAElD,CAAA,GADE,mBACF,CADsB,eACtB,CAAA,GAAA,oBAAA,CAAqB,eAArB,CAAA"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;KAwCY,gBAAA,GAAmB,KAAK;;AAApC;;;;;;;;;AA0CA;EAAkC,WAAA,CAAA,EAAA,OAAA,GAAA,OAAA;EAChC;;;;;AAIF;;;;;;;;AAKA;EAC0B,cAAA,CAAA,EAxBpB,aAwBoB,EAAA,GAAA,CAAA,CAAA,OAAA,EAvBT,OAuBS,EAAA,KAAA,EAvBO,WAuBP,EAAA,GAvBuB,aAuBvB,EAAA,CAAA,GAAA,KAAA;EAA0B;;;;;;YAdxC;;KAGA,mBAAA,GAAsB,yBAChC,wBACA,0BACA,KAAK;KAEK,uBAAA,GAA0B,6BACpC,8BACA,4BACA,SAAS,KAAK;KAEJ,yCACc,0BAA0B,2BAChD,oBAAoB,mBACtB,qBAAqB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/preset-cli",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "type": "module",
5
5
  "description": "A package containing a Shell Shock plugin to generate source code given a list design tokens.",
6
6
  "repository": {
@@ -170,12 +170,12 @@
170
170
  "@powerlines/deepkit": "^0.6.67",
171
171
  "@powerlines/plugin-alloy": "^0.23.17",
172
172
  "@powerlines/plugin-plugin": "^0.12.238",
173
- "@shell-shock/core": "^0.9.0",
174
- "@shell-shock/plugin-console": "^0.0.4",
175
- "@shell-shock/plugin-prompts": "^0.2.3",
176
- "@shell-shock/plugin-theme": "^0.3.2",
177
- "@shell-shock/plugin-upgrade": "^0.1.4",
178
- "@shell-shock/preset-script": "^0.6.13",
173
+ "@shell-shock/core": "^0.9.1",
174
+ "@shell-shock/plugin-console": "^0.0.5",
175
+ "@shell-shock/plugin-prompts": "^0.3.0",
176
+ "@shell-shock/plugin-theme": "^0.3.3",
177
+ "@shell-shock/plugin-upgrade": "^0.1.5",
178
+ "@shell-shock/preset-script": "^0.6.14",
179
179
  "@stryke/path": "0.26.6",
180
180
  "@stryke/string-format": "0.14.2",
181
181
  "cfonts": "^3.3.1",
@@ -210,5 +210,5 @@
210
210
  "./package.json": "./package.json"
211
211
  }
212
212
  },
213
- "gitHead": "cfda8730b7dac0e89647907af8bdf83635eee335"
213
+ "gitHead": "b94dfbfbfd27471351cac0596afe1f550d8dca57"
214
214
  }