@shell-shock/preset-cli 0.9.33 → 0.9.35

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 (65) hide show
  1. package/README.md +16 -7
  2. package/dist/command-entry-BCDDI3RN.mjs +548 -0
  3. package/dist/command-entry-BCDDI3RN.mjs.map +1 -0
  4. package/dist/command-entry-iZ5O5Iza.cjs +558 -0
  5. package/dist/components/banner-builtin.cjs +39 -14
  6. package/dist/components/banner-builtin.d.cts +1 -2
  7. package/dist/components/banner-builtin.d.cts.map +1 -1
  8. package/dist/components/banner-builtin.d.mts +1 -2
  9. package/dist/components/banner-builtin.mjs +6 -6
  10. package/dist/components/command-entry.cjs +2 -447
  11. package/dist/components/command-entry.d.cts +1 -2
  12. package/dist/components/command-entry.d.cts.map +1 -1
  13. package/dist/components/command-entry.d.mts +1 -2
  14. package/dist/components/command-entry.mjs +2 -446
  15. package/dist/components/command-router.cjs +6 -6
  16. package/dist/components/command-router.d.cts +0 -1
  17. package/dist/components/command-router.d.cts.map +1 -1
  18. package/dist/components/command-router.d.mts +0 -1
  19. package/dist/components/command-router.mjs +3 -3
  20. package/dist/components/index.cjs +3 -4
  21. package/dist/components/index.mjs +1 -2
  22. package/dist/components/update-builtin.cjs +7 -7
  23. package/dist/components/update-builtin.d.cts +0 -1
  24. package/dist/components/update-builtin.d.cts.map +1 -1
  25. package/dist/components/update-builtin.d.mts +0 -1
  26. package/dist/components/update-builtin.mjs +5 -5
  27. package/dist/components/virtual-command-entry.cjs +2 -114
  28. package/dist/components/virtual-command-entry.d.cts +1 -2
  29. package/dist/components/virtual-command-entry.d.cts.map +1 -1
  30. package/dist/components/virtual-command-entry.d.mts +1 -2
  31. package/dist/components/virtual-command-entry.mjs +2 -113
  32. package/dist/generator.cjs +158 -0
  33. package/dist/generator.d.cts +16 -0
  34. package/dist/generator.d.cts.map +1 -0
  35. package/dist/generator.d.mts +16 -0
  36. package/dist/generator.d.mts.map +1 -0
  37. package/dist/generator.mjs +156 -0
  38. package/dist/generator.mjs.map +1 -0
  39. package/dist/helpers/get-global-options.cjs +1 -0
  40. package/dist/helpers/get-global-options.d.cts +15 -0
  41. package/dist/helpers/get-global-options.d.cts.map +1 -0
  42. package/dist/helpers/get-global-options.d.mts +15 -0
  43. package/dist/helpers/get-global-options.d.mts.map +1 -0
  44. package/dist/helpers/get-global-options.mjs +4 -4
  45. package/dist/index.cjs +20 -130
  46. package/dist/index.d.cts +3 -3
  47. package/dist/index.d.cts.map +1 -1
  48. package/dist/index.d.mts +3 -3
  49. package/dist/index.mjs +25 -129
  50. package/dist/plugin-BUwcMpPx.d.mts +100 -0
  51. package/dist/plugin-BUwcMpPx.d.mts.map +1 -0
  52. package/dist/plugin-Bsdv5DH-.d.cts +100 -0
  53. package/dist/plugin-Bsdv5DH-.d.cts.map +1 -0
  54. package/dist/types/index.cjs +1 -0
  55. package/dist/types/index.d.cts +1 -1
  56. package/dist/types/index.d.mts +1 -1
  57. package/dist/types/index.mjs +2 -0
  58. package/dist/types/plugin.d.cts +2 -101
  59. package/dist/types/plugin.d.mts +2 -101
  60. package/package.json +53 -25
  61. package/dist/_virtual/_rolldown/runtime.cjs +0 -29
  62. package/dist/components/command-entry.mjs.map +0 -1
  63. package/dist/components/virtual-command-entry.mjs.map +0 -1
  64. package/dist/types/plugin.d.cts.map +0 -1
  65. package/dist/types/plugin.d.mts.map +0 -1
@@ -1,4 +1,4 @@
1
- import { getGlobalOptions } from "@shell-shock/preset-script/helpers/get-global-options";
1
+ import { getGlobalOptions as getGlobalOptions$1 } from "@shell-shock/preset-script/helpers/get-global-options";
2
2
 
3
3
  //#region src/helpers/get-global-options.ts
4
4
  /**
@@ -8,9 +8,9 @@ import { getGlobalOptions } from "@shell-shock/preset-script/helpers/get-global-
8
8
  * @param _ - The command input.
9
9
  * @returns The default command options.
10
10
  */
11
- function getGlobalOptions$1(context, _) {
11
+ function getGlobalOptions(context, _) {
12
12
  return [
13
- ...getGlobalOptions(),
13
+ ...getGlobalOptions$1(),
14
14
  context.config.interactive !== "never" && context.config.interactive !== true && {
15
15
  name: "interactive",
16
16
  title: "Interactive",
@@ -43,5 +43,5 @@ function getGlobalOptions$1(context, _) {
43
43
  }
44
44
 
45
45
  //#endregion
46
- export { getGlobalOptions$1 as getGlobalOptions };
46
+ export { getGlobalOptions };
47
47
  //# sourceMappingURL=get-global-options.mjs.map
package/dist/index.cjs CHANGED
@@ -1,32 +1,15 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
- const require_components_banner_builtin = require('./components/banner-builtin.cjs');
4
- const require_components_command_router = require('./components/command-router.cjs');
5
- const require_components_virtual_command_entry = require('./components/virtual-command-entry.cjs');
6
- const require_components_command_entry = require('./components/command-entry.cjs');
7
- const require_components_update_builtin = require('./components/update-builtin.cjs');
8
- const require_get_global_options = require('./helpers/get-global-options.cjs');
9
- let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
10
- let _alloy_js_core = require("@alloy-js/core");
11
- let _alloy_js_typescript = require("@alloy-js/typescript");
12
- let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
13
- let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
2
+ const require_generator = require('./generator.cjs');
3
+ const require_helpers_get_global_options = require('./helpers/get-global-options.cjs');
4
+ let _shell_shock_core_helpers_power_plant = require("@shell-shock/core/helpers/power-plant");
14
5
  let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
15
6
  let _shell_shock_plugin_changelog = require("@shell-shock/plugin-changelog");
16
- _shell_shock_plugin_changelog = require_runtime.__toESM(_shell_shock_plugin_changelog, 1);
17
7
  let _shell_shock_plugin_completions = require("@shell-shock/plugin-completions");
18
- _shell_shock_plugin_completions = require_runtime.__toESM(_shell_shock_plugin_completions, 1);
19
8
  let _shell_shock_plugin_console = require("@shell-shock/plugin-console");
20
- _shell_shock_plugin_console = require_runtime.__toESM(_shell_shock_plugin_console, 1);
21
9
  let _shell_shock_plugin_help = require("@shell-shock/plugin-help");
22
- _shell_shock_plugin_help = require_runtime.__toESM(_shell_shock_plugin_help, 1);
23
10
  let _shell_shock_plugin_prompts = require("@shell-shock/plugin-prompts");
24
- _shell_shock_plugin_prompts = require_runtime.__toESM(_shell_shock_plugin_prompts, 1);
25
11
  let _shell_shock_plugin_skills = require("@shell-shock/plugin-skills");
26
- _shell_shock_plugin_skills = require_runtime.__toESM(_shell_shock_plugin_skills, 1);
27
12
  let _shell_shock_plugin_update = require("@shell-shock/plugin-update");
28
- _shell_shock_plugin_update = require_runtime.__toESM(_shell_shock_plugin_update, 1);
29
- let _shell_shock_preset_script_components_bin_entry = require("@shell-shock/preset-script/components/bin-entry");
30
13
  let _stryke_path_join = require("@stryke/path/join");
31
14
  let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
32
15
  let node_fs = require("node:fs");
@@ -41,47 +24,34 @@ let powerlines = require("powerlines");
41
24
  */
42
25
  const plugin = (options = {}) => {
43
26
  return [
44
- ...(0, _shell_shock_plugin_console.default)(options),
45
- ...(0, _shell_shock_plugin_help.default)(options),
46
- ...(0, _shell_shock_plugin_prompts.default)(options),
47
- ...(0, powerlines.enable)((0, _shell_shock_plugin_changelog.default)(options.changelog), options.changelog !== false),
48
- ...(0, powerlines.enable)((0, _shell_shock_plugin_completions.default)(options.completions), options.completions !== false),
49
- ...(0, powerlines.enable)((0, _shell_shock_plugin_skills.default)(options.skills), options.skills !== false && (0, node_fs.existsSync)((0, _stryke_type_checks_is_set_object.isSetObject)(options.skills) && options.skills.path ? options.skills.path : (0, _stryke_path_join.joinPaths)(process.cwd(), "skills"))),
50
- (0, _shell_shock_plugin_update.default)(options),
27
+ ...(0, _shell_shock_plugin_console.plugin)(options),
28
+ ...(0, _shell_shock_plugin_help.plugin)(options),
29
+ ...(0, _shell_shock_plugin_prompts.plugin)(options),
30
+ ...(0, powerlines.enable)((0, _shell_shock_plugin_changelog.plugin)(options.changelog), options.changelog !== false),
31
+ ...(0, powerlines.enable)((0, _shell_shock_plugin_completions.plugin)(options.completions), options.completions !== false),
32
+ ...(0, powerlines.enable)((0, _shell_shock_plugin_skills.plugin)(options.skills), options.skills !== false && (0, node_fs.existsSync)((0, _stryke_type_checks_is_set_object.isSetObject)(options.skills) && options.skills.path ? options.skills.path : (0, _stryke_path_join.joinPaths)(process.cwd(), "skills"))),
33
+ (0, _shell_shock_plugin_update.plugin)(options),
51
34
  {
52
35
  name: "shell-shock/cli-preset:main",
53
36
  config() {
54
37
  this.debug("Providing default configuration for the Shell Shock `cli` preset.");
55
38
  return {
56
- globalOptions: require_get_global_options.getGlobalOptions,
39
+ globalOptions: require_helpers_get_global_options.getGlobalOptions,
57
40
  isCaseSensitive: false,
58
41
  ...options,
59
42
  env: {
60
- config: "@shell-shock/plugin-update/types/env#ShellShockUpdateEnv",
61
- validate: false
43
+ validate: false,
44
+ ...options.env
62
45
  }
63
46
  };
64
47
  },
65
48
  prepare: {
66
49
  order: "post",
67
50
  async handler() {
68
- const _self$ = this;
69
- this.debug("Rendering built-in modules.");
51
+ this.debug("Rendering built-in modules via Power Plant.");
70
52
  const commands = await (0, _shell_shock_core_plugin_utils.getCommandList)(this);
71
- this.debug(`Rendering \`banner\` built-ins for each of the ${commands.length} command modules.`);
72
- return (0, _powerlines_plugin_alloy_render.render)(this, [
73
- (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_update_builtin.UpdateBuiltin, {}),
74
- (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_banner_builtin.BannerBuiltin, { get command() {
75
- return (0, _shell_shock_core_plugin_utils.computeBin)(_self$);
76
- } }),
77
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
78
- get each() {
79
- return commands.sort((a, b) => a.name.localeCompare(b.name));
80
- },
81
- doubleHardline: true,
82
- children: (command) => (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_banner_builtin.BannerBuiltin, { command })
83
- })
84
- ]);
53
+ this.debug(`Rendering \`banner\` built-ins via Power Plant for each of the ${commands.length} command modules.`);
54
+ return (0, _shell_shock_core_helpers_power_plant.executeCommandGenerator)(this, require_generator.cliBuiltinsGenerator);
85
55
  }
86
56
  }
87
57
  },
@@ -90,90 +60,8 @@ const plugin = (options = {}) => {
90
60
  prepare: {
91
61
  order: "post",
92
62
  async handler() {
93
- const _self$2 = this;
94
- this.debug("Rendering entrypoint modules for the Shell Shock `cli` preset.");
95
- return (0, _powerlines_plugin_alloy_render.render)(this, [(0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_preset_script_components_bin_entry.BinEntry, {
96
- builtinImports: {
97
- console: [
98
- "info",
99
- "debug",
100
- "warn",
101
- "help",
102
- "error",
103
- "cursor",
104
- "divider",
105
- "stripAnsi",
106
- "writeLine",
107
- "splitText"
108
- ],
109
- utils: ["isMinimal", "isInteractive"],
110
- state: ["useArgs", "isHelp"],
111
- prompts: [
112
- "text",
113
- "numeric",
114
- "toggle",
115
- "select",
116
- "confirm",
117
- "isCancel"
118
- ],
119
- env: ["env", "paths"],
120
- update: ["executeUpdate"]
121
- },
122
- get children() {
123
- return [
124
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
125
- get when() {
126
- return Object.keys(_self$2.commands).length > 0;
127
- },
128
- get children() {
129
- return [
130
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
131
- "let": true,
132
- name: "args",
133
- type: "string[]",
134
- initializer: _alloy_js_core.code`useArgs();`
135
- }),
136
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
137
- (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
138
- segments: [],
139
- get commands() {
140
- return _self$2.commands ?? {};
141
- }
142
- }),
143
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
144
- ];
145
- }
146
- }),
147
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
148
- _alloy_js_core.code`await showBanner(0);`,
149
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
150
- _alloy_js_core.code`return showHelp(); `
151
- ];
152
- }
153
- }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
154
- get when() {
155
- return Object.values(_self$2.commands).length > 0;
156
- },
157
- get children() {
158
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
159
- get each() {
160
- return Object.values(_self$2.commands);
161
- },
162
- doubleHardline: true,
163
- children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
164
- get when() {
165
- return child.virtual;
166
- },
167
- get fallback() {
168
- return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
169
- },
170
- get children() {
171
- return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
172
- }
173
- })
174
- });
175
- }
176
- })]);
63
+ this.debug("Rendering entrypoint modules via Power Plant for the Shell Shock `cli` preset.");
64
+ return (0, _shell_shock_core_helpers_power_plant.executeCommandGenerator)(this, require_generator.cliEntrypointGenerator);
177
65
  }
178
66
  }
179
67
  }
@@ -181,5 +69,7 @@ const plugin = (options = {}) => {
181
69
  };
182
70
 
183
71
  //#endregion
72
+ exports.cliBuiltinsGenerator = require_generator.cliBuiltinsGenerator;
73
+ exports.cliEntrypointGenerator = require_generator.cliEntrypointGenerator;
184
74
  exports.default = plugin;
185
75
  exports.plugin = plugin;
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { CLIPresetContext, CLIPresetOptions } from "./types/plugin.cjs";
1
+ import { cliBuiltinsGenerator, cliEntrypointGenerator } from "./generator.cjs";
2
+ import { a as CLIPresetOptions, i as CLIPresetContext } from "./plugin-Bsdv5DH-.cjs";
2
3
  import { Plugin } from "powerlines";
3
-
4
4
  //#region src/index.d.ts
5
5
  /**
6
6
  * The Shell Shock CLI Preset plugin.
@@ -10,5 +10,5 @@ import { Plugin } from "powerlines";
10
10
  */
11
11
  declare const plugin: <TContext extends CLIPresetContext = CLIPresetContext>(options?: CLIPresetOptions) => Plugin<TContext>[];
12
12
  //#endregion
13
- export { plugin as default, plugin };
13
+ export { cliBuiltinsGenerator, cliEntrypointGenerator, plugin as default, plugin };
14
14
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;AAsDA;;;;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":";;;;;;;;;;cA+Ca,SAAU,iBAAiB,mBAAmB,kBACzD,UAAS,qBACR,OAAO"}
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { CLIPresetContext, CLIPresetOptions } from "./types/plugin.mjs";
1
+ import { cliBuiltinsGenerator, cliEntrypointGenerator } from "./generator.mjs";
2
+ import { a as CLIPresetOptions, i as CLIPresetContext } from "./plugin-BUwcMpPx.mjs";
2
3
  import { Plugin } from "powerlines";
3
-
4
4
  //#region src/index.d.ts
5
5
  /**
6
6
  * The Shell Shock CLI Preset plugin.
@@ -10,5 +10,5 @@ import { Plugin } from "powerlines";
10
10
  */
11
11
  declare const plugin: <TContext extends CLIPresetContext = CLIPresetContext>(options?: CLIPresetOptions) => Plugin<TContext>[];
12
12
  //#endregion
13
- export { plugin as default, plugin };
13
+ export { cliBuiltinsGenerator, cliEntrypointGenerator, plugin as default, plugin };
14
14
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1,23 +1,14 @@
1
- import { BannerBuiltin } from "./components/banner-builtin.mjs";
2
- import { CommandRouter } from "./components/command-router.mjs";
3
- import { VirtualCommandEntry } from "./components/virtual-command-entry.mjs";
4
- import { CommandEntry } from "./components/command-entry.mjs";
5
- import { UpdateBuiltin } from "./components/update-builtin.mjs";
1
+ import { cliBuiltinsGenerator, cliEntrypointGenerator } from "./generator.mjs";
6
2
  import { getGlobalOptions } from "./helpers/get-global-options.mjs";
7
- import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
8
- import { For, Show, code } from "@alloy-js/core";
9
- import { VarDeclaration } from "@alloy-js/typescript";
10
- import { Spacing } from "@powerlines/plugin-alloy/core/components";
11
- import { render } from "@powerlines/plugin-alloy/render";
12
- import { computeBin, getCommandList } from "@shell-shock/core/plugin-utils";
13
- import changelog from "@shell-shock/plugin-changelog";
14
- import completions from "@shell-shock/plugin-completions";
15
- import console from "@shell-shock/plugin-console";
16
- import help from "@shell-shock/plugin-help";
17
- import prompts from "@shell-shock/plugin-prompts";
18
- import skills from "@shell-shock/plugin-skills";
19
- import update from "@shell-shock/plugin-update";
20
- import { BinEntry } from "@shell-shock/preset-script/components/bin-entry";
3
+ import { executeCommandGenerator } from "@shell-shock/core/helpers/power-plant";
4
+ import { getCommandList } from "@shell-shock/core/plugin-utils";
5
+ import { plugin as plugin$1 } from "@shell-shock/plugin-changelog";
6
+ import { plugin as plugin$2 } from "@shell-shock/plugin-completions";
7
+ import { plugin as plugin$3 } from "@shell-shock/plugin-console";
8
+ import { plugin as plugin$4 } from "@shell-shock/plugin-help";
9
+ import { plugin as plugin$5 } from "@shell-shock/plugin-prompts";
10
+ import { plugin as plugin$6 } from "@shell-shock/plugin-skills";
11
+ import { plugin as plugin$7 } from "@shell-shock/plugin-update";
21
12
  import { joinPaths } from "@stryke/path/join";
22
13
  import { isSetObject } from "@stryke/type-checks/is-set-object";
23
14
  import { existsSync } from "node:fs";
@@ -32,13 +23,13 @@ import { enable } from "powerlines";
32
23
  */
33
24
  const plugin = (options = {}) => {
34
25
  return [
35
- ...console(options),
36
- ...help(options),
37
- ...prompts(options),
38
- ...enable(changelog(options.changelog), options.changelog !== false),
39
- ...enable(completions(options.completions), options.completions !== false),
40
- ...enable(skills(options.skills), options.skills !== false && existsSync(isSetObject(options.skills) && options.skills.path ? options.skills.path : joinPaths(process.cwd(), "skills"))),
41
- update(options),
26
+ ...plugin$3(options),
27
+ ...plugin$4(options),
28
+ ...plugin$5(options),
29
+ ...enable(plugin$1(options.changelog), options.changelog !== false),
30
+ ...enable(plugin$2(options.completions), options.completions !== false),
31
+ ...enable(plugin$6(options.skills), options.skills !== false && existsSync(isSetObject(options.skills) && options.skills.path ? options.skills.path : joinPaths(process.cwd(), "skills"))),
32
+ plugin$7(options),
42
33
  {
43
34
  name: "shell-shock/cli-preset:main",
44
35
  config() {
@@ -48,31 +39,18 @@ const plugin = (options = {}) => {
48
39
  isCaseSensitive: false,
49
40
  ...options,
50
41
  env: {
51
- config: "@shell-shock/plugin-update/types/env#ShellShockUpdateEnv",
52
- validate: false
42
+ validate: false,
43
+ ...options.env
53
44
  }
54
45
  };
55
46
  },
56
47
  prepare: {
57
48
  order: "post",
58
49
  async handler() {
59
- const _self$ = this;
60
- this.debug("Rendering built-in modules.");
50
+ this.debug("Rendering built-in modules via Power Plant.");
61
51
  const commands = await getCommandList(this);
62
- this.debug(`Rendering \`banner\` built-ins for each of the ${commands.length} command modules.`);
63
- return render(this, [
64
- createComponent(UpdateBuiltin, {}),
65
- createComponent(BannerBuiltin, { get command() {
66
- return computeBin(_self$);
67
- } }),
68
- createComponent(For, {
69
- get each() {
70
- return commands.sort((a, b) => a.name.localeCompare(b.name));
71
- },
72
- doubleHardline: true,
73
- children: (command) => createComponent(BannerBuiltin, { command })
74
- })
75
- ]);
52
+ this.debug(`Rendering \`banner\` built-ins via Power Plant for each of the ${commands.length} command modules.`);
53
+ return executeCommandGenerator(this, cliBuiltinsGenerator);
76
54
  }
77
55
  }
78
56
  },
@@ -81,90 +59,8 @@ const plugin = (options = {}) => {
81
59
  prepare: {
82
60
  order: "post",
83
61
  async handler() {
84
- const _self$2 = this;
85
- this.debug("Rendering entrypoint modules for the Shell Shock `cli` preset.");
86
- return render(this, [createComponent(BinEntry, {
87
- builtinImports: {
88
- console: [
89
- "info",
90
- "debug",
91
- "warn",
92
- "help",
93
- "error",
94
- "cursor",
95
- "divider",
96
- "stripAnsi",
97
- "writeLine",
98
- "splitText"
99
- ],
100
- utils: ["isMinimal", "isInteractive"],
101
- state: ["useArgs", "isHelp"],
102
- prompts: [
103
- "text",
104
- "numeric",
105
- "toggle",
106
- "select",
107
- "confirm",
108
- "isCancel"
109
- ],
110
- env: ["env", "paths"],
111
- update: ["executeUpdate"]
112
- },
113
- get children() {
114
- return [
115
- createComponent(Show, {
116
- get when() {
117
- return Object.keys(_self$2.commands).length > 0;
118
- },
119
- get children() {
120
- return [
121
- createComponent(VarDeclaration, {
122
- "let": true,
123
- name: "args",
124
- type: "string[]",
125
- initializer: code`useArgs();`
126
- }),
127
- createIntrinsic("hbr", {}),
128
- createComponent(CommandRouter, {
129
- segments: [],
130
- get commands() {
131
- return _self$2.commands ?? {};
132
- }
133
- }),
134
- createIntrinsic("hbr", {})
135
- ];
136
- }
137
- }),
138
- createIntrinsic("hbr", {}),
139
- code`await showBanner(0);`,
140
- createComponent(Spacing, {}),
141
- code`return showHelp(); `
142
- ];
143
- }
144
- }), createComponent(Show, {
145
- get when() {
146
- return Object.values(_self$2.commands).length > 0;
147
- },
148
- get children() {
149
- return createComponent(For, {
150
- get each() {
151
- return Object.values(_self$2.commands);
152
- },
153
- doubleHardline: true,
154
- children: (child) => createComponent(Show, {
155
- get when() {
156
- return child.virtual;
157
- },
158
- get fallback() {
159
- return createComponent(CommandEntry, { command: child });
160
- },
161
- get children() {
162
- return createComponent(VirtualCommandEntry, { command: child });
163
- }
164
- })
165
- });
166
- }
167
- })]);
62
+ this.debug("Rendering entrypoint modules via Power Plant for the Shell Shock `cli` preset.");
63
+ return executeCommandGenerator(this, cliEntrypointGenerator);
168
64
  }
169
65
  }
170
66
  }
@@ -172,5 +68,5 @@ const plugin = (options = {}) => {
172
68
  };
173
69
 
174
70
  //#endregion
175
- export { plugin as default, plugin };
71
+ export { cliBuiltinsGenerator, cliEntrypointGenerator, plugin as default, plugin };
176
72
  //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,100 @@
1
+ import { ChangelogPluginContext, ChangelogPluginOptions, ChangelogPluginResolvedConfig, ChangelogPluginUserConfig } from "@shell-shock/plugin-changelog";
2
+ import { CompletionsPluginContext, CompletionsPluginOptions, CompletionsPluginResolvedConfig, CompletionsPluginUserConfig } from "@shell-shock/plugin-completions";
3
+ import { ConsolePluginContext, ConsolePluginResolvedConfig, ConsolePluginUserConfig } from "@shell-shock/plugin-console";
4
+ import { HelpPluginContext, HelpPluginOptions, HelpPluginResolvedConfig, HelpPluginUserConfig } from "@shell-shock/plugin-help";
5
+ import { SkillsPluginContext, SkillsPluginOptions, SkillsPluginResolvedConfig, SkillsPluginUserConfig } from "@shell-shock/plugin-skills";
6
+ import { ResolvedConfig } from "powerlines";
7
+ import { FigletOptions } from "figlet";
8
+ import { CommandBase, CommandOption, Context, UserConfig } from "@shell-shock/core";
9
+ import { BannerPluginContext, BannerPluginResolvedConfig, BannerPluginUserConfig } from "@shell-shock/plugin-banner";
10
+ import { PromptsPluginContext, PromptsPluginOptions, PromptsPluginResolvedConfig, PromptsPluginUserConfig } from "@shell-shock/plugin-prompts/types/plugin";
11
+ import { ThemePluginContext, ThemePluginResolvedConfig, ThemePluginUserConfig } from "@shell-shock/plugin-theme/types/plugin";
12
+ import { UpdatePluginContext, UpdatePluginOptions, UpdatePluginResolvedConfig, UpdatePluginUserConfig } from "@shell-shock/plugin-update/types/plugin";
13
+ import { ScriptPresetOptions } from "@shell-shock/preset-script/types/plugin";
14
+ //#region src/types/plugin.d.ts
15
+ type UpdateType = "confirm" | "auto" | "manual";
16
+ type CLIPresetBannerFontOption = "console" | "block" | "simpleBlock" | "simple" | "3d" | "simple3d" | "chrome" | "huge" | "shade" | "slick" | "grid" | "pallet" | "tiny";
17
+ interface CLIPresetBannerOption extends FigletOptions {
18
+ /**
19
+ * The text to display in the banner header. If not specified, the application name will be used.
20
+ */
21
+ text?: string;
22
+ }
23
+ interface CLIPresetBannerOverrideOption {
24
+ /**
25
+ * The text to display in the banner header verbatim, without applying figlet styling. If this option is set, it will take precedence over the `banner` option and any figlet styling will be ignored. This can be useful if you want to display a custom banner that does not conform to the constraints of figlet fonts, or if you want to include special characters or formatting that may not be supported by figlet. When this option is set, the specified text will be displayed exactly as provided in the banner header, without any modifications or styling applied.
26
+ */
27
+ override: string;
28
+ }
29
+ type CLIPresetOptions = Omit<ScriptPresetOptions, "globalOptions"> & HelpPluginOptions & PromptsPluginOptions & UpdatePluginOptions & {
30
+ /**
31
+ * The default interactive mode to apply to commands.
32
+ *
33
+ * @remarks
34
+ * The following modes are available:
35
+ * - `true`: Enable interactivity when a TTY is detected and no explicit interactive flag is set (default).
36
+ * - `false`: Disable interactivity unless an explicit interactive flag is set.
37
+ * - `"never"`: Always disable interactivity, regardless of TTY presence or flags.
38
+ *
39
+ * @defaultValue `true`
40
+ */
41
+ interactive?: boolean | "never";
42
+ /**
43
+ * A set of default command options to apply to each command.
44
+ *
45
+ * @remarks
46
+ * By default, Shell Shock adds the following set of default arguments to each command:
47
+ * - `--help` (`-h`, `-?`): Show help information.
48
+ * - `--version` (`-v`): Show the version of the application.
49
+ * - `--interactive` (`-i`, `--interact`): Enable interactive mode.
50
+ * - `--no-interactive`: Disable interactive mode.
51
+ * - `--no-banner`: Hide the banner displayed while running the CLI application.
52
+ * - `--verbose`: Enable verbose output.
53
+ *
54
+ * 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.
55
+ */
56
+ globalOptions?: CommandOption[] | ((context: Context, input: CommandBase) => CommandOption[]) | false;
57
+ /**
58
+ * The type of update to perform. This option determines how the update process will be handled.
59
+ *
60
+ * @remarks
61
+ * The update logic will behave differently based on the value of this field:
62
+ * - `"confirm"` - the user will be prompted to confirm the update before it is performed. This is the default behavior and is recommended for most users, as it provides an extra layer of safety against unintended updates.
63
+ * - `"auto"` - the update will be performed automatically without any user confirmation. This option is suitable for advanced users who want a seamless update experience and are confident in the stability of new versions.
64
+ * - `"manual"` - the command will only display the latest available version without performing any update. This option is useful for users who want to check for updates without making any changes to their system.
65
+ *
66
+ * @defaultValue "confirm"
67
+ */
68
+ updateType?: UpdateType | false;
69
+ /**
70
+ * The title to display in the banner for the CLI application. If not specified, the application name will be used.
71
+ *
72
+ * @see https://www.npmjs.com/package/figlet
73
+ * @see http://patorjk.com/software/taag/
74
+ *
75
+ * @remarks
76
+ * This option can be set to a string to specify the banner text directly, or an object with `figlet` options to customize the appearance of the banner. If an object is provided, the `text` property can be used to specify the banner text, and other properties can be used to customize the font, alignment, and other aspects of the banner's appearance.
77
+ */
78
+ banner?: string | CLIPresetBannerOption | CLIPresetBannerOverrideOption;
79
+ /**
80
+ * Configuration options for the `completions` plugin. This field allows you to customize the behavior of the `completions` plugin, which provides commands for generating shell completion scripts for the CLI application. You can specify which shells to generate completions for, and other related settings.
81
+ */
82
+ completions?: Pick<CompletionsPluginOptions, "shells"> | false;
83
+ /**
84
+ * Configuration options for the `changelog` plugin. This field allows you to customize the behavior of the `changelog` plugin, which provides commands for displaying the application's changelog. You can specify the path to the changelog file, the command name, and other related settings.
85
+ */
86
+ changelog?: ChangelogPluginOptions | false;
87
+ /**
88
+ * Configuration options for the `skills` plugin. This field allows you to customize the behavior of the `skills` plugin, which provides commands for managing and displaying the application's skills. You can specify the command name, and other related settings.
89
+ *
90
+ * @remarks
91
+ * If the `skills` plugin is enabled but the specified skills path does not exist, the plugin will be automatically disabled and a warning message will be logged. By default, the plugin looks for a `skills` directory in the current working directory.
92
+ */
93
+ skills?: SkillsPluginOptions | false;
94
+ };
95
+ type CLIPresetUserConfig = UserConfig & ThemePluginUserConfig & ConsolePluginUserConfig & PromptsPluginUserConfig & BannerPluginUserConfig & HelpPluginUserConfig & CompletionsPluginUserConfig & ChangelogPluginUserConfig & SkillsPluginUserConfig & UpdatePluginUserConfig & CLIPresetOptions;
96
+ type CLIPresetResolvedConfig = ResolvedConfig & ThemePluginResolvedConfig & ConsolePluginResolvedConfig & PromptsPluginResolvedConfig & BannerPluginResolvedConfig & HelpPluginResolvedConfig & CompletionsPluginResolvedConfig & ChangelogPluginResolvedConfig & SkillsPluginResolvedConfig & UpdatePluginResolvedConfig & Required<CLIPresetOptions>;
97
+ type CLIPresetContext<TResolvedConfig extends CLIPresetResolvedConfig = CLIPresetResolvedConfig> = Context<TResolvedConfig> & ThemePluginContext<TResolvedConfig> & ConsolePluginContext<TResolvedConfig> & PromptsPluginContext<TResolvedConfig> & BannerPluginContext<TResolvedConfig> & HelpPluginContext<TResolvedConfig> & CompletionsPluginContext<TResolvedConfig> & ChangelogPluginContext<TResolvedConfig> & SkillsPluginContext<TResolvedConfig> & UpdatePluginContext<TResolvedConfig>;
98
+ //#endregion
99
+ export { CLIPresetOptions as a, UpdateType as c, CLIPresetContext as i, CLIPresetBannerOption as n, CLIPresetResolvedConfig as o, CLIPresetBannerOverrideOption as r, CLIPresetUserConfig as s, CLIPresetBannerFontOption as t };
100
+ //# sourceMappingURL=plugin-BUwcMpPx.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-BUwcMpPx.d.mts","names":[],"sources":["../src/types/plugin.ts"],"mappings":""}