@shell-shock/preset-cli 0.9.34 → 0.9.36

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 (64) hide show
  1. package/dist/command-entry-BCDDI3RN.mjs +548 -0
  2. package/dist/command-entry-BCDDI3RN.mjs.map +1 -0
  3. package/dist/command-entry-iZ5O5Iza.cjs +558 -0
  4. package/dist/components/banner-builtin.cjs +39 -14
  5. package/dist/components/banner-builtin.d.cts +1 -2
  6. package/dist/components/banner-builtin.d.cts.map +1 -1
  7. package/dist/components/banner-builtin.d.mts +1 -2
  8. package/dist/components/banner-builtin.mjs +6 -6
  9. package/dist/components/command-entry.cjs +2 -447
  10. package/dist/components/command-entry.d.cts +1 -2
  11. package/dist/components/command-entry.d.cts.map +1 -1
  12. package/dist/components/command-entry.d.mts +1 -2
  13. package/dist/components/command-entry.mjs +2 -446
  14. package/dist/components/command-router.cjs +6 -6
  15. package/dist/components/command-router.d.cts +0 -1
  16. package/dist/components/command-router.d.cts.map +1 -1
  17. package/dist/components/command-router.d.mts +0 -1
  18. package/dist/components/command-router.mjs +3 -3
  19. package/dist/components/index.cjs +3 -4
  20. package/dist/components/index.mjs +1 -2
  21. package/dist/components/update-builtin.cjs +7 -7
  22. package/dist/components/update-builtin.d.cts +0 -1
  23. package/dist/components/update-builtin.d.cts.map +1 -1
  24. package/dist/components/update-builtin.d.mts +0 -1
  25. package/dist/components/update-builtin.mjs +5 -5
  26. package/dist/components/virtual-command-entry.cjs +2 -114
  27. package/dist/components/virtual-command-entry.d.cts +1 -2
  28. package/dist/components/virtual-command-entry.d.cts.map +1 -1
  29. package/dist/components/virtual-command-entry.d.mts +1 -2
  30. package/dist/components/virtual-command-entry.mjs +2 -113
  31. package/dist/generator.cjs +158 -0
  32. package/dist/generator.d.cts +16 -0
  33. package/dist/generator.d.cts.map +1 -0
  34. package/dist/generator.d.mts +16 -0
  35. package/dist/generator.d.mts.map +1 -0
  36. package/dist/generator.mjs +156 -0
  37. package/dist/generator.mjs.map +1 -0
  38. package/dist/helpers/get-global-options.cjs +1 -0
  39. package/dist/helpers/get-global-options.d.cts +15 -0
  40. package/dist/helpers/get-global-options.d.cts.map +1 -0
  41. package/dist/helpers/get-global-options.d.mts +15 -0
  42. package/dist/helpers/get-global-options.d.mts.map +1 -0
  43. package/dist/helpers/get-global-options.mjs +4 -4
  44. package/dist/index.cjs +20 -130
  45. package/dist/index.d.cts +3 -3
  46. package/dist/index.d.cts.map +1 -1
  47. package/dist/index.d.mts +3 -3
  48. package/dist/index.mjs +25 -129
  49. package/dist/plugin-BUwcMpPx.d.mts +100 -0
  50. package/dist/plugin-BUwcMpPx.d.mts.map +1 -0
  51. package/dist/plugin-Bsdv5DH-.d.cts +100 -0
  52. package/dist/plugin-Bsdv5DH-.d.cts.map +1 -0
  53. package/dist/types/index.cjs +1 -0
  54. package/dist/types/index.d.cts +1 -1
  55. package/dist/types/index.d.mts +1 -1
  56. package/dist/types/index.mjs +2 -0
  57. package/dist/types/plugin.d.cts +2 -101
  58. package/dist/types/plugin.d.mts +2 -101
  59. package/package.json +53 -25
  60. package/dist/_virtual/_rolldown/runtime.cjs +0 -29
  61. package/dist/components/command-entry.mjs.map +0 -1
  62. package/dist/components/virtual-command-entry.mjs.map +0 -1
  63. package/dist/types/plugin.d.cts.map +0 -1
  64. package/dist/types/plugin.d.mts.map +0 -1
@@ -1,116 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_components_command_router = require('./command-router.cjs');
4
- const require_components_command_entry = require('./command-entry.cjs');
5
- let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
- let _alloy_js_core = require("@alloy-js/core");
7
- let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
8
- let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
9
- let _stryke_path_join = require("@stryke/path/join");
10
- let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
11
- let defu = require("defu");
12
- defu = require_runtime.__toESM(defu, 1);
13
- let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
14
- let _powerlines_plugin_alloy_typescript_components_typescript_file = require("@powerlines/plugin-alloy/typescript/components/typescript-file");
15
- let _shell_shock_preset_script_components_virtual_command_entry = require("@shell-shock/preset-script/components/virtual-command-entry");
2
+ const require_command_entry = require('../command-entry-iZ5O5Iza.cjs');
16
3
 
17
- //#region src/components/virtual-command-entry.tsx
18
- /**
19
- * The virtual command entry point for the Shell Shock project.
20
- */
21
- function VirtualCommandEntry(props) {
22
- const { command, imports, builtinImports, ...rest } = props;
23
- const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
24
- const filePath = (0, _alloy_js_core.computed)(() => (0, _stryke_path_join.joinPaths)(context.entryPath, command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)).join("/"), "index.ts"));
25
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_typescript_file.TypescriptFile, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
26
- get path() {
27
- return filePath.value;
28
- },
29
- get imports() {
30
- return (0, defu.default)(imports ?? {}, Object.entries(command.children).filter(([, child]) => child.virtual).reduce((ret, [name, child]) => {
31
- ret[`./${child.name}`] = [{
32
- name: "handler",
33
- alias: `handle${(0, _stryke_string_format_pascal_case.pascalCase)(name)}`
34
- }];
35
- return ret;
36
- }, {}));
37
- },
38
- get builtinImports() {
39
- return (0, defu.default)(builtinImports ?? {}, {
40
- env: ["isDevelopment", "isDebug"],
41
- console: [
42
- "warn",
43
- "error",
44
- "info",
45
- "help",
46
- "table",
47
- "writeLine",
48
- "splitText",
49
- "textColors",
50
- "stripAnsi"
51
- ],
52
- utils: [
53
- "isMinimal",
54
- "isUnicodeSupported",
55
- "isInteractive",
56
- "findSuggestions",
57
- "sleep"
58
- ],
59
- state: [
60
- {
61
- name: "GlobalOptions",
62
- type: true
63
- },
64
- "useGlobal",
65
- "useGlobalOptions",
66
- "withCommand",
67
- "useArgs",
68
- "hasFlag",
69
- "isHelp"
70
- ],
71
- prompts: [
72
- "text",
73
- "numeric",
74
- "toggle",
75
- "select",
76
- "isCancel"
77
- ],
78
- [(0, _stryke_path_join.joinPaths)("help", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showHelp"],
79
- [(0, _stryke_path_join.joinPaths)("banner", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showBanner"]
80
- });
81
- },
82
- get children() {
83
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}), (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_preset_script_components_virtual_command_entry.VirtualCommandHandlerDeclaration, {
84
- command,
85
- get children() {
86
- return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
87
- get segments() {
88
- return command.segments;
89
- },
90
- get commands() {
91
- return command.children;
92
- }
93
- });
94
- }
95
- })];
96
- }
97
- })), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
98
- get each() {
99
- return Object.values(command.children);
100
- },
101
- children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
102
- get when() {
103
- return child.virtual;
104
- },
105
- get fallback() {
106
- return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
107
- },
108
- get children() {
109
- return (0, _alloy_js_core_jsx_runtime.createComponent)(VirtualCommandEntry, { command: child });
110
- }
111
- })
112
- })];
113
- }
114
-
115
- //#endregion
116
- exports.VirtualCommandEntry = VirtualCommandEntry;
4
+ exports.VirtualCommandEntry = require_command_entry.VirtualCommandEntry;
@@ -1,6 +1,5 @@
1
1
  import { CommandTree } from "@shell-shock/core";
2
- import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
3
-
2
+ import { EntryFileProps } from "@shell-shock/core/contexts/power-plant";
4
3
  //#region src/components/virtual-command-entry.d.ts
5
4
  interface VirtualCommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
6
5
  command: CommandTree;
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-command-entry.d.cts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"mappings":";;;;UAkCiB,wBAAA,SAAiC,IAAA,CAChD,cAAA;EAGA,OAAA,EAAS,WAAA;AAAA;;;;iBAMK,mBAAA,CAAoB,KAAA,EAAO,wBAAwB,4BAAA,QAAA"}
1
+ {"version":3,"file":"virtual-command-entry.d.cts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"mappings":";;;UAkCiB,iCAAiC,KAChD;EAGA,SAAS;;;;;iBAMK,oBAAoB,OAAO,oDAAwB"}
@@ -1,6 +1,5 @@
1
- import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
1
+ import { EntryFileProps } from "@shell-shock/core/contexts/power-plant";
2
2
  import { CommandTree } from "@shell-shock/core";
3
-
4
3
  //#region src/components/virtual-command-entry.d.ts
5
4
  interface VirtualCommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
6
5
  command: CommandTree;
@@ -1,114 +1,3 @@
1
- import { CommandRouter } from "./command-router.mjs";
2
- import { CommandEntry } from "./command-entry.mjs";
3
- import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
4
- import { For, Show, computed } from "@alloy-js/core";
5
- import { Spacing } from "@powerlines/plugin-alloy/core/components";
6
- import { isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
7
- import { joinPaths } from "@stryke/path/join";
8
- import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
9
- import defu from "defu";
10
- import { pascalCase } from "@stryke/string-format/pascal-case";
11
- import { TypescriptFile } from "@powerlines/plugin-alloy/typescript/components/typescript-file";
12
- import { VirtualCommandHandlerDeclaration } from "@shell-shock/preset-script/components/virtual-command-entry";
1
+ import { n as VirtualCommandEntry } from "../command-entry-BCDDI3RN.mjs";
13
2
 
14
- //#region src/components/virtual-command-entry.tsx
15
- /**
16
- * The virtual command entry point for the Shell Shock project.
17
- */
18
- function VirtualCommandEntry(props) {
19
- const { command, imports, builtinImports, ...rest } = props;
20
- const context = usePowerlines();
21
- const filePath = computed(() => joinPaths(context.entryPath, command.segments.filter((segment) => !isDynamicPathSegment(segment)).join("/"), "index.ts"));
22
- return [createComponent(TypescriptFile, mergeProps(rest, {
23
- get path() {
24
- return filePath.value;
25
- },
26
- get imports() {
27
- return defu(imports ?? {}, Object.entries(command.children).filter(([, child]) => child.virtual).reduce((ret, [name, child]) => {
28
- ret[`./${child.name}`] = [{
29
- name: "handler",
30
- alias: `handle${pascalCase(name)}`
31
- }];
32
- return ret;
33
- }, {}));
34
- },
35
- get builtinImports() {
36
- return defu(builtinImports ?? {}, {
37
- env: ["isDevelopment", "isDebug"],
38
- console: [
39
- "warn",
40
- "error",
41
- "info",
42
- "help",
43
- "table",
44
- "writeLine",
45
- "splitText",
46
- "textColors",
47
- "stripAnsi"
48
- ],
49
- utils: [
50
- "isMinimal",
51
- "isUnicodeSupported",
52
- "isInteractive",
53
- "findSuggestions",
54
- "sleep"
55
- ],
56
- state: [
57
- {
58
- name: "GlobalOptions",
59
- type: true
60
- },
61
- "useGlobal",
62
- "useGlobalOptions",
63
- "withCommand",
64
- "useArgs",
65
- "hasFlag",
66
- "isHelp"
67
- ],
68
- prompts: [
69
- "text",
70
- "numeric",
71
- "toggle",
72
- "select",
73
- "isCancel"
74
- ],
75
- [joinPaths("help", ...command.segments.filter((segment) => !isDynamicPathSegment(segment)))]: ["showHelp"],
76
- [joinPaths("banner", ...command.segments.filter((segment) => !isDynamicPathSegment(segment)))]: ["showBanner"]
77
- });
78
- },
79
- get children() {
80
- return [createComponent(Spacing, {}), createComponent(VirtualCommandHandlerDeclaration, {
81
- command,
82
- get children() {
83
- return createComponent(CommandRouter, {
84
- get segments() {
85
- return command.segments;
86
- },
87
- get commands() {
88
- return command.children;
89
- }
90
- });
91
- }
92
- })];
93
- }
94
- })), createComponent(For, {
95
- get each() {
96
- return Object.values(command.children);
97
- },
98
- children: (child) => createComponent(Show, {
99
- get when() {
100
- return child.virtual;
101
- },
102
- get fallback() {
103
- return createComponent(CommandEntry, { command: child });
104
- },
105
- get children() {
106
- return createComponent(VirtualCommandEntry, { command: child });
107
- }
108
- })
109
- })];
110
- }
111
-
112
- //#endregion
113
- export { VirtualCommandEntry };
114
- //# sourceMappingURL=virtual-command-entry.mjs.map
3
+ export { VirtualCommandEntry };
@@ -0,0 +1,158 @@
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_components_banner_builtin = require('./components/banner-builtin.cjs');
3
+ const require_components_command_router = require('./components/command-router.cjs');
4
+ const require_command_entry = require('./command-entry-iZ5O5Iza.cjs');
5
+ const require_components_update_builtin = require('./components/update-builtin.cjs');
6
+ let _shell_shock_core_helpers_power_plant = require("@shell-shock/core/helpers/power-plant");
7
+ let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
8
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
9
+ let _alloy_js_core = require("@alloy-js/core");
10
+ let _alloy_js_typescript = require("@alloy-js/typescript");
11
+ let _power_plant_alloy_js_core_components = require("@power-plant/alloy-js/core/components");
12
+ let _shell_shock_preset_script_components_bin_entry = require("@shell-shock/preset-script/components/bin-entry");
13
+
14
+ //#region src/generator.tsx
15
+ /**
16
+ * Power Plant generator for Shell Shock CLI preset built-in modules.
17
+ *
18
+ * @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
19
+ */
20
+ const cliBuiltinsGenerator = (0, _shell_shock_core_helpers_power_plant.defineCommandGenerator)({
21
+ meta: {
22
+ name: "shell-shock-cli-builtins",
23
+ title: "Shell Shock CLI Builtins Generator",
24
+ description: "Generates CLI preset built-in modules (update, banner) from the Shell Shock command tree specification.",
25
+ version: "1.0",
26
+ tags: [
27
+ "shell-shock",
28
+ "cli",
29
+ "alloy-js",
30
+ "builtins"
31
+ ]
32
+ },
33
+ generator: async (_commands, options) => {
34
+ const commands = await (0, _shell_shock_core_plugin_utils.getCommandList)(options.context);
35
+ await (0, _shell_shock_core_helpers_power_plant.renderCommandTemplate)(options, [
36
+ (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_update_builtin.UpdateBuiltin, {}),
37
+ (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_banner_builtin.BannerBuiltin, { get command() {
38
+ return (0, _shell_shock_core_plugin_utils.computeBin)(options.context);
39
+ } }),
40
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
41
+ get each() {
42
+ return commands.sort((a, b) => a.name.localeCompare(b.name));
43
+ },
44
+ doubleHardline: true,
45
+ children: (command) => (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_banner_builtin.BannerBuiltin, { command })
46
+ })
47
+ ]);
48
+ }
49
+ });
50
+ /**
51
+ * Power Plant generator for Shell Shock CLI preset entrypoint modules.
52
+ *
53
+ * @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
54
+ */
55
+ const cliEntrypointGenerator = (0, _shell_shock_core_helpers_power_plant.defineCommandGenerator)({
56
+ meta: {
57
+ name: "shell-shock-cli-entrypoint",
58
+ title: "Shell Shock CLI Entrypoint Generator",
59
+ description: "Generates CLI preset entrypoint and command router modules from the Shell Shock command tree specification.",
60
+ version: "1.0",
61
+ tags: [
62
+ "shell-shock",
63
+ "cli",
64
+ "alloy-js",
65
+ "entrypoint"
66
+ ]
67
+ },
68
+ generator: async (_commands, options) => {
69
+ const context = options.context;
70
+ await (0, _shell_shock_core_helpers_power_plant.renderCommandTemplate)(options, [(0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_preset_script_components_bin_entry.BinEntry, {
71
+ builtinImports: {
72
+ console: [
73
+ "info",
74
+ "debug",
75
+ "warn",
76
+ "help",
77
+ "error",
78
+ "cursor",
79
+ "divider",
80
+ "stripAnsi",
81
+ "writeLine",
82
+ "splitText"
83
+ ],
84
+ utils: ["isMinimal", "isInteractive"],
85
+ state: ["useArgs", "isHelp"],
86
+ prompts: [
87
+ "text",
88
+ "numeric",
89
+ "toggle",
90
+ "select",
91
+ "confirm",
92
+ "isCancel"
93
+ ],
94
+ env: ["env", "paths"],
95
+ update: ["executeUpdate"]
96
+ },
97
+ get children() {
98
+ return [
99
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
100
+ get when() {
101
+ return Object.keys(context.commands).length > 0;
102
+ },
103
+ get children() {
104
+ return [
105
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
106
+ "let": true,
107
+ name: "args",
108
+ type: "string[]",
109
+ initializer: _alloy_js_core.code`useArgs();`
110
+ }),
111
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
112
+ (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
113
+ segments: [],
114
+ get commands() {
115
+ return context.commands ?? {};
116
+ }
117
+ }),
118
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
119
+ ];
120
+ }
121
+ }),
122
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
123
+ _alloy_js_core.code`await showBanner(0);`,
124
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components.Spacing, {}),
125
+ _alloy_js_core.code`return showHelp(); `
126
+ ];
127
+ }
128
+ }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
129
+ get when() {
130
+ return Object.values(context.commands).length > 0;
131
+ },
132
+ get children() {
133
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
134
+ get each() {
135
+ return Object.values(context.commands);
136
+ },
137
+ doubleHardline: true,
138
+ children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
139
+ get when() {
140
+ return child.virtual;
141
+ },
142
+ get fallback() {
143
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(require_command_entry.CommandEntry, { command: child });
144
+ },
145
+ get children() {
146
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(require_command_entry.VirtualCommandEntry, { command: child });
147
+ }
148
+ })
149
+ });
150
+ }
151
+ })]);
152
+ }
153
+ });
154
+
155
+ //#endregion
156
+ exports.cliBuiltinsGenerator = cliBuiltinsGenerator;
157
+ exports.default = cliBuiltinsGenerator;
158
+ exports.cliEntrypointGenerator = cliEntrypointGenerator;
@@ -0,0 +1,16 @@
1
+ //#region src/generator.d.ts
2
+ /**
3
+ * Power Plant generator for Shell Shock CLI preset built-in modules.
4
+ *
5
+ * @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
6
+ */
7
+ declare const cliBuiltinsGenerator: import("@power-plant/core").GeneratorConfigObject<Record<string, import("@shell-shock/schema").SerializedCommandTree>, import("@shell-shock/core/helpers/power-plant").CommandGeneratorOptions, void>;
8
+ /**
9
+ * Power Plant generator for Shell Shock CLI preset entrypoint modules.
10
+ *
11
+ * @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
12
+ */
13
+ declare const cliEntrypointGenerator: import("@power-plant/core").GeneratorConfigObject<Record<string, import("@shell-shock/schema").SerializedCommandTree>, import("@shell-shock/core/helpers/power-plant").CommandGeneratorOptions, void>;
14
+ //#endregion
15
+ export { cliBuiltinsGenerator, cliBuiltinsGenerator as default, cliEntrypointGenerator };
16
+ //# sourceMappingURL=generator.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.cts","names":[],"sources":["../src/generator.tsx"],"mappings":";;;;;;cAsCa,kDAAoB,sBAAA,6CAAA,wEAAA;;;;;;cAgCpB,oDAAsB,sBAAA,6CAAA,wEAAA"}
@@ -0,0 +1,16 @@
1
+ //#region src/generator.d.ts
2
+ /**
3
+ * Power Plant generator for Shell Shock CLI preset built-in modules.
4
+ *
5
+ * @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
6
+ */
7
+ declare const cliBuiltinsGenerator: import("@power-plant/core").GeneratorConfigObject<Record<string, import("@shell-shock/schema").SerializedCommandTree>, import("@shell-shock/core/helpers/power-plant").CommandGeneratorOptions, void>;
8
+ /**
9
+ * Power Plant generator for Shell Shock CLI preset entrypoint modules.
10
+ *
11
+ * @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
12
+ */
13
+ declare const cliEntrypointGenerator: import("@power-plant/core").GeneratorConfigObject<Record<string, import("@shell-shock/schema").SerializedCommandTree>, import("@shell-shock/core/helpers/power-plant").CommandGeneratorOptions, void>;
14
+ //#endregion
15
+ export { cliBuiltinsGenerator, cliBuiltinsGenerator as default, cliEntrypointGenerator };
16
+ //# sourceMappingURL=generator.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.mts","names":[],"sources":["../src/generator.tsx"],"mappings":""}
@@ -0,0 +1,156 @@
1
+ import { BannerBuiltin } from "./components/banner-builtin.mjs";
2
+ import { CommandRouter } from "./components/command-router.mjs";
3
+ import { n as VirtualCommandEntry, t as CommandEntry } from "./command-entry-BCDDI3RN.mjs";
4
+ import { UpdateBuiltin } from "./components/update-builtin.mjs";
5
+ import { defineCommandGenerator, renderCommandTemplate } from "@shell-shock/core/helpers/power-plant";
6
+ import { computeBin, getCommandList } from "@shell-shock/core/plugin-utils";
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 "@power-plant/alloy-js/core/components";
11
+ import { BinEntry } from "@shell-shock/preset-script/components/bin-entry";
12
+
13
+ //#region src/generator.tsx
14
+ /**
15
+ * Power Plant generator for Shell Shock CLI preset built-in modules.
16
+ *
17
+ * @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
18
+ */
19
+ const cliBuiltinsGenerator = defineCommandGenerator({
20
+ meta: {
21
+ name: "shell-shock-cli-builtins",
22
+ title: "Shell Shock CLI Builtins Generator",
23
+ description: "Generates CLI preset built-in modules (update, banner) from the Shell Shock command tree specification.",
24
+ version: "1.0",
25
+ tags: [
26
+ "shell-shock",
27
+ "cli",
28
+ "alloy-js",
29
+ "builtins"
30
+ ]
31
+ },
32
+ generator: async (_commands, options) => {
33
+ const commands = await getCommandList(options.context);
34
+ await renderCommandTemplate(options, [
35
+ createComponent(UpdateBuiltin, {}),
36
+ createComponent(BannerBuiltin, { get command() {
37
+ return computeBin(options.context);
38
+ } }),
39
+ createComponent(For, {
40
+ get each() {
41
+ return commands.sort((a, b) => a.name.localeCompare(b.name));
42
+ },
43
+ doubleHardline: true,
44
+ children: (command) => createComponent(BannerBuiltin, { command })
45
+ })
46
+ ]);
47
+ }
48
+ });
49
+ /**
50
+ * Power Plant generator for Shell Shock CLI preset entrypoint modules.
51
+ *
52
+ * @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
53
+ */
54
+ const cliEntrypointGenerator = defineCommandGenerator({
55
+ meta: {
56
+ name: "shell-shock-cli-entrypoint",
57
+ title: "Shell Shock CLI Entrypoint Generator",
58
+ description: "Generates CLI preset entrypoint and command router modules from the Shell Shock command tree specification.",
59
+ version: "1.0",
60
+ tags: [
61
+ "shell-shock",
62
+ "cli",
63
+ "alloy-js",
64
+ "entrypoint"
65
+ ]
66
+ },
67
+ generator: async (_commands, options) => {
68
+ const context = options.context;
69
+ await renderCommandTemplate(options, [createComponent(BinEntry, {
70
+ builtinImports: {
71
+ console: [
72
+ "info",
73
+ "debug",
74
+ "warn",
75
+ "help",
76
+ "error",
77
+ "cursor",
78
+ "divider",
79
+ "stripAnsi",
80
+ "writeLine",
81
+ "splitText"
82
+ ],
83
+ utils: ["isMinimal", "isInteractive"],
84
+ state: ["useArgs", "isHelp"],
85
+ prompts: [
86
+ "text",
87
+ "numeric",
88
+ "toggle",
89
+ "select",
90
+ "confirm",
91
+ "isCancel"
92
+ ],
93
+ env: ["env", "paths"],
94
+ update: ["executeUpdate"]
95
+ },
96
+ get children() {
97
+ return [
98
+ createComponent(Show, {
99
+ get when() {
100
+ return Object.keys(context.commands).length > 0;
101
+ },
102
+ get children() {
103
+ return [
104
+ createComponent(VarDeclaration, {
105
+ "let": true,
106
+ name: "args",
107
+ type: "string[]",
108
+ initializer: code`useArgs();`
109
+ }),
110
+ createIntrinsic("hbr", {}),
111
+ createComponent(CommandRouter, {
112
+ segments: [],
113
+ get commands() {
114
+ return context.commands ?? {};
115
+ }
116
+ }),
117
+ createIntrinsic("hbr", {})
118
+ ];
119
+ }
120
+ }),
121
+ createIntrinsic("hbr", {}),
122
+ code`await showBanner(0);`,
123
+ createComponent(Spacing, {}),
124
+ code`return showHelp(); `
125
+ ];
126
+ }
127
+ }), createComponent(Show, {
128
+ get when() {
129
+ return Object.values(context.commands).length > 0;
130
+ },
131
+ get children() {
132
+ return createComponent(For, {
133
+ get each() {
134
+ return Object.values(context.commands);
135
+ },
136
+ doubleHardline: true,
137
+ children: (child) => createComponent(Show, {
138
+ get when() {
139
+ return child.virtual;
140
+ },
141
+ get fallback() {
142
+ return createComponent(CommandEntry, { command: child });
143
+ },
144
+ get children() {
145
+ return createComponent(VirtualCommandEntry, { command: child });
146
+ }
147
+ })
148
+ });
149
+ }
150
+ })]);
151
+ }
152
+ });
153
+
154
+ //#endregion
155
+ export { cliBuiltinsGenerator, cliBuiltinsGenerator as default, cliEntrypointGenerator };
156
+ //# sourceMappingURL=generator.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.mjs","names":[],"sources":[],"mappings":""}
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
  let _shell_shock_preset_script_helpers_get_global_options = require("@shell-shock/preset-script/helpers/get-global-options");
2
3
 
3
4
  //#region src/helpers/get-global-options.ts
@@ -0,0 +1,15 @@
1
+ import { i as CLIPresetContext } from "../plugin-Bsdv5DH-.cjs";
2
+ import "../types/index.cjs";
3
+ import { CommandBase, CommandOption } from "@shell-shock/core";
4
+ //#region src/helpers/get-global-options.d.ts
5
+ /**
6
+ * Get the default command options.
7
+ *
8
+ * @param context - The build context.
9
+ * @param _ - The command input.
10
+ * @returns The default command options.
11
+ */
12
+ declare function getGlobalOptions(context: CLIPresetContext, _: CommandBase): CommandOption[];
13
+ //#endregion
14
+ export { getGlobalOptions };
15
+ //# sourceMappingURL=get-global-options.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-global-options.d.cts","names":[],"sources":["../../src/helpers/get-global-options.ts"],"mappings":";;;;;;;;;;;iBA6BgB,iBACd,SAAS,kBACT,GAAG,cACF"}
@@ -0,0 +1,15 @@
1
+ import { i as CLIPresetContext } from "../plugin-BUwcMpPx.mjs";
2
+ import "../types/index.mjs";
3
+ import { CommandBase, CommandOption } from "@shell-shock/core";
4
+ //#region src/helpers/get-global-options.d.ts
5
+ /**
6
+ * Get the default command options.
7
+ *
8
+ * @param context - The build context.
9
+ * @param _ - The command input.
10
+ * @returns The default command options.
11
+ */
12
+ declare function getGlobalOptions(context: CLIPresetContext, _: CommandBase): CommandOption[];
13
+ //#endregion
14
+ export { getGlobalOptions };
15
+ //# sourceMappingURL=get-global-options.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-global-options.d.mts","names":[],"sources":["../../src/helpers/get-global-options.ts"],"mappings":""}