@shell-shock/core 0.17.5 → 0.17.6

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 (73) hide show
  1. package/dist/components/command-validation-logic.cjs +214 -152
  2. package/dist/components/command-validation-logic.mjs +213 -152
  3. package/dist/components/command-validation-logic.mjs.map +1 -1
  4. package/dist/components/docs.cjs +113 -9
  5. package/dist/components/docs.mjs +109 -9
  6. package/dist/components/docs.mjs.map +1 -1
  7. package/dist/components/exec-builtin.cjs +36 -1
  8. package/dist/components/exec-builtin.d.cts.map +1 -1
  9. package/dist/components/exec-builtin.d.mts.map +1 -1
  10. package/dist/components/exec-builtin.mjs +35 -1
  11. package/dist/components/exec-builtin.mjs.map +1 -1
  12. package/dist/components/helpers.cjs +51 -2
  13. package/dist/components/helpers.mjs +50 -2
  14. package/dist/components/helpers.mjs.map +1 -1
  15. package/dist/components/index.cjs +17 -1
  16. package/dist/components/index.mjs +9 -9
  17. package/dist/components/options-parser-logic.cjs +411 -174
  18. package/dist/components/options-parser-logic.d.cts.map +1 -1
  19. package/dist/components/options-parser-logic.d.mts.map +1 -1
  20. package/dist/components/options-parser-logic.mjs +405 -174
  21. package/dist/components/options-parser-logic.mjs.map +1 -1
  22. package/dist/components/state-builtin.cjs +61 -5
  23. package/dist/components/state-builtin.mjs +60 -5
  24. package/dist/components/state-builtin.mjs.map +1 -1
  25. package/dist/components/usage.cjs +46 -3
  26. package/dist/components/usage.mjs +45 -3
  27. package/dist/components/usage.mjs.map +1 -1
  28. package/dist/components/utils-builtin.cjs +68 -3
  29. package/dist/components/utils-builtin.mjs +67 -3
  30. package/dist/components/utils-builtin.mjs.map +1 -1
  31. package/dist/helpers/automd.cjs +28 -13
  32. package/dist/helpers/automd.mjs +28 -13
  33. package/dist/helpers/automd.mjs.map +1 -1
  34. package/dist/index.cjs +11 -0
  35. package/dist/index.d.cts +2 -2
  36. package/dist/index.d.mts +2 -2
  37. package/dist/index.mjs +2 -2
  38. package/dist/plugin-utils/compute-bin.cjs +50 -0
  39. package/dist/plugin-utils/compute-bin.d.cts +13 -0
  40. package/dist/plugin-utils/compute-bin.d.cts.map +1 -0
  41. package/dist/plugin-utils/compute-bin.d.mts +13 -0
  42. package/dist/plugin-utils/compute-bin.d.mts.map +1 -0
  43. package/dist/plugin-utils/compute-bin.mjs +50 -0
  44. package/dist/plugin-utils/compute-bin.mjs.map +1 -0
  45. package/dist/plugin-utils/get-command-tree.cjs +50 -0
  46. package/dist/plugin-utils/get-command-tree.d.cts +15 -1
  47. package/dist/plugin-utils/get-command-tree.d.cts.map +1 -1
  48. package/dist/plugin-utils/get-command-tree.d.mts +15 -1
  49. package/dist/plugin-utils/get-command-tree.d.mts.map +1 -1
  50. package/dist/plugin-utils/get-command-tree.mjs +49 -1
  51. package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
  52. package/dist/plugin-utils/index.cjs +4 -0
  53. package/dist/plugin-utils/index.d.cts +3 -2
  54. package/dist/plugin-utils/index.d.mts +3 -2
  55. package/dist/plugin-utils/index.mjs +3 -2
  56. package/dist/plugin.cjs +170 -52
  57. package/dist/plugin.mjs +170 -52
  58. package/dist/plugin.mjs.map +1 -1
  59. package/dist/resolver/deepkit.cjs +1 -1
  60. package/dist/resolver/deepkit.mjs +1 -1
  61. package/dist/resolver/deepkit.mjs.map +1 -1
  62. package/dist/types/command.cjs +120 -10
  63. package/dist/types/command.d.cts +95 -8
  64. package/dist/types/command.d.cts.map +1 -1
  65. package/dist/types/command.d.mts +95 -8
  66. package/dist/types/command.d.mts.map +1 -1
  67. package/dist/types/command.mjs +109 -10
  68. package/dist/types/command.mjs.map +1 -1
  69. package/dist/types/index.cjs +12 -1
  70. package/dist/types/index.d.cts +2 -2
  71. package/dist/types/index.d.mts +2 -2
  72. package/dist/types/index.mjs +2 -2
  73. package/package.json +10 -10
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { CommandParameterKinds, __ΩAsCommandParameterConfig, __ΩBaseCommandParameter, __ΩBooleanCommandOption, __ΩBooleanCommandParameter, __ΩBooleanCommandParameterConfig, __ΩCommandArgument, __ΩCommandArgumentConfig, __ΩCommandBase, __ΩCommandConfig, __ΩCommandMetadata, __ΩCommandModule, __ΩCommandOption, __ΩCommandOptionConfig, __ΩCommandParameter, __ΩCommandParameterConfig, __ΩCommandParameterKind, __ΩCommandParameterType, __ΩCommandTree, __ΩNumberCommandParameter, __ΩNumberCommandParameterConfig, __ΩSerializedCommandTree, __ΩStringCommandParameter, __ΩStringCommandParameterConfig } from "./types/command.mjs";
1
+ import { CommandParameterKinds, __ΩAsCommandParameterConfig, __ΩBaseBooleanCommandParameter, __ΩBaseCommandParameter, __ΩBaseNumberCommandParameter, __ΩBaseSingleCommandParameter, __ΩBaseStringCommandParameter, __ΩBaseVariadicCommandParameter, __ΩBooleanCommandOption, __ΩBooleanCommandParameter, __ΩBooleanCommandParameterConfig, __ΩCommandArgument, __ΩCommandArgumentConfig, __ΩCommandBase, __ΩCommandConfig, __ΩCommandMetadata, __ΩCommandModule, __ΩCommandOption, __ΩCommandOptionConfig, __ΩCommandParameter, __ΩCommandParameterConfig, __ΩCommandParameterKind, __ΩCommandParameterType, __ΩCommandTree, __ΩNumberCommandParameter, __ΩNumberCommandParameterConfig, __ΩSerializedCommandTree, __ΩSingleBooleanCommandParameter, __ΩSingleNumberCommandParameter, __ΩSingleStringCommandParameter, __ΩStringCommandParameter, __ΩStringCommandParameterConfig, __ΩVariadicBooleanCommandParameter, __ΩVariadicNumberCommandParameter, __ΩVariadicStringCommandParameter } from "./types/command.mjs";
2
2
  import { __ΩOptions, __ΩOutputConfig, __ΩReferenceOptions, __ΩResolvedConfig, __ΩUserConfig } from "./types/config.mjs";
3
3
  import { __ΩContext, __ΩUnresolvedContext } from "./types/context.mjs";
4
4
  import { __ΩBaseCommandOptions } from "./types/options.mjs";
5
5
  import { ShellShockAPI, createShellShock } from "./api.mjs";
6
6
 
7
- export { CommandParameterKinds, ShellShockAPI, __ΩAsCommandParameterConfig, __ΩBaseCommandOptions, __ΩBaseCommandParameter, __ΩBooleanCommandOption, __ΩBooleanCommandParameter, __ΩBooleanCommandParameterConfig, __ΩCommandArgument, __ΩCommandArgumentConfig, __ΩCommandBase, __ΩCommandConfig, __ΩCommandMetadata, __ΩCommandModule, __ΩCommandOption, __ΩCommandOptionConfig, __ΩCommandParameter, __ΩCommandParameterConfig, __ΩCommandParameterKind, __ΩCommandParameterType, __ΩCommandTree, __ΩContext, __ΩNumberCommandParameter, __ΩNumberCommandParameterConfig, __ΩOptions, __ΩOutputConfig, __ΩReferenceOptions, __ΩResolvedConfig, __ΩSerializedCommandTree, __ΩStringCommandParameter, __ΩStringCommandParameterConfig, __ΩUnresolvedContext, __ΩUserConfig, createShellShock };
7
+ export { CommandParameterKinds, ShellShockAPI, __ΩAsCommandParameterConfig, __ΩBaseBooleanCommandParameter, __ΩBaseCommandOptions, __ΩBaseCommandParameter, __ΩBaseNumberCommandParameter, __ΩBaseSingleCommandParameter, __ΩBaseStringCommandParameter, __ΩBaseVariadicCommandParameter, __ΩBooleanCommandOption, __ΩBooleanCommandParameter, __ΩBooleanCommandParameterConfig, __ΩCommandArgument, __ΩCommandArgumentConfig, __ΩCommandBase, __ΩCommandConfig, __ΩCommandMetadata, __ΩCommandModule, __ΩCommandOption, __ΩCommandOptionConfig, __ΩCommandParameter, __ΩCommandParameterConfig, __ΩCommandParameterKind, __ΩCommandParameterType, __ΩCommandTree, __ΩContext, __ΩNumberCommandParameter, __ΩNumberCommandParameterConfig, __ΩOptions, __ΩOutputConfig, __ΩReferenceOptions, __ΩResolvedConfig, __ΩSerializedCommandTree, __ΩSingleBooleanCommandParameter, __ΩSingleNumberCommandParameter, __ΩSingleStringCommandParameter, __ΩStringCommandParameter, __ΩStringCommandParameterConfig, __ΩUnresolvedContext, __ΩUserConfig, __ΩVariadicBooleanCommandParameter, __ΩVariadicNumberCommandParameter, __ΩVariadicStringCommandParameter, createShellShock };
@@ -0,0 +1,50 @@
1
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ const require_context_helpers = require('./context-helpers.cjs');
3
+ let _stryke_path_join_paths = require("@stryke/path/join-paths");
4
+ let _alloy_js_core = require("@alloy-js/core");
5
+
6
+ //#region src/plugin-utils/compute-bin.ts
7
+ function __assignType(fn, args) {
8
+ fn.__type = args;
9
+ return fn;
10
+ }
11
+ /**
12
+ * Compute the command tree for the CLI application, starting from the root bin command. This will be used to determine which commands are available in the CLI application and their respective details.
13
+ *
14
+ * @param context - The plugin context containing the necessary information to compute the command tree.
15
+ * @returns The computed command tree for the CLI application, starting from the root bin command. This will include all commands discovered in the project and their respective details, organized in a hierarchical structure based on their segments and paths.
16
+ */
17
+ function computeBin(context) {
18
+ return (0, _alloy_js_core.computed)(() => ({
19
+ id: "",
20
+ name: require_context_helpers.getAppName(context),
21
+ title: require_context_helpers.getAppTitle(context),
22
+ description: require_context_helpers.getAppDescription(context),
23
+ isVirtual: true,
24
+ path: null,
25
+ segments: [],
26
+ alias: [],
27
+ tags: [],
28
+ source: "file",
29
+ options: Object.fromEntries(context.options.map(__assignType((option) => [option.name, option], [
30
+ "option",
31
+ "",
32
+ "P\"2!\"/\""
33
+ ]))),
34
+ args: [],
35
+ entry: { file: (0, _stryke_path_join_paths.joinPaths)(context.entryPath, "bin.ts") },
36
+ parent: null,
37
+ children: context.commands
38
+ })).value;
39
+ }
40
+ computeBin.__type = [
41
+ "Context",
42
+ "context",
43
+ "CommandTree",
44
+ "computeBin",
45
+ "Compute the command tree for the CLI application, starting from the root bin command. This will be used to determine which commands are available in the CLI application and their respective details.",
46
+ "P\"w!2\"\"w#/$?%"
47
+ ];
48
+
49
+ //#endregion
50
+ exports.computeBin = computeBin;
@@ -0,0 +1,13 @@
1
+ import { CommandTree } from "../types/command.cjs";
2
+ import { Context } from "../types/context.cjs";
3
+ //#region src/plugin-utils/compute-bin.d.ts
4
+ /**
5
+ * Compute the command tree for the CLI application, starting from the root bin command. This will be used to determine which commands are available in the CLI application and their respective details.
6
+ *
7
+ * @param context - The plugin context containing the necessary information to compute the command tree.
8
+ * @returns The computed command tree for the CLI application, starting from the root bin command. This will include all commands discovered in the project and their respective details, organized in a hierarchical structure based on their segments and paths.
9
+ */
10
+ declare function computeBin(context: Context): CommandTree;
11
+ //#endregion
12
+ export { computeBin };
13
+ //# sourceMappingURL=compute-bin.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute-bin.d.cts","names":[],"sources":["../../src/plugin-utils/compute-bin.ts"],"mappings":";;;;;;;AA6BA;;iBAAgB,UAAA,CAAW,OAAA,EAAS,OAAA,GAAU,WAAA"}
@@ -0,0 +1,13 @@
1
+ import { CommandTree } from "../types/command.mjs";
2
+ import { Context } from "../types/context.mjs";
3
+ //#region src/plugin-utils/compute-bin.d.ts
4
+ /**
5
+ * Compute the command tree for the CLI application, starting from the root bin command. This will be used to determine which commands are available in the CLI application and their respective details.
6
+ *
7
+ * @param context - The plugin context containing the necessary information to compute the command tree.
8
+ * @returns The computed command tree for the CLI application, starting from the root bin command. This will include all commands discovered in the project and their respective details, organized in a hierarchical structure based on their segments and paths.
9
+ */
10
+ declare function computeBin(context: Context): CommandTree;
11
+ //#endregion
12
+ export { computeBin };
13
+ //# sourceMappingURL=compute-bin.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute-bin.d.mts","names":[],"sources":["../../src/plugin-utils/compute-bin.ts"],"mappings":";;;;;;;AA6BA;;iBAAgB,UAAA,CAAW,OAAA,EAAS,OAAA,GAAU,WAAA"}
@@ -0,0 +1,50 @@
1
+ import { getAppDescription, getAppName, getAppTitle } from "./context-helpers.mjs";
2
+ import { joinPaths } from "@stryke/path/join-paths";
3
+ import { computed } from "@alloy-js/core";
4
+
5
+ //#region src/plugin-utils/compute-bin.ts
6
+ function __assignType(fn, args) {
7
+ fn.__type = args;
8
+ return fn;
9
+ }
10
+ /**
11
+ * Compute the command tree for the CLI application, starting from the root bin command. This will be used to determine which commands are available in the CLI application and their respective details.
12
+ *
13
+ * @param context - The plugin context containing the necessary information to compute the command tree.
14
+ * @returns The computed command tree for the CLI application, starting from the root bin command. This will include all commands discovered in the project and their respective details, organized in a hierarchical structure based on their segments and paths.
15
+ */
16
+ function computeBin(context) {
17
+ return computed(() => ({
18
+ id: "",
19
+ name: getAppName(context),
20
+ title: getAppTitle(context),
21
+ description: getAppDescription(context),
22
+ isVirtual: true,
23
+ path: null,
24
+ segments: [],
25
+ alias: [],
26
+ tags: [],
27
+ source: "file",
28
+ options: Object.fromEntries(context.options.map(__assignType((option) => [option.name, option], [
29
+ "option",
30
+ "",
31
+ "P\"2!\"/\""
32
+ ]))),
33
+ args: [],
34
+ entry: { file: joinPaths(context.entryPath, "bin.ts") },
35
+ parent: null,
36
+ children: context.commands
37
+ })).value;
38
+ }
39
+ computeBin.__type = [
40
+ "Context",
41
+ "context",
42
+ "CommandTree",
43
+ "computeBin",
44
+ "Compute the command tree for the CLI application, starting from the root bin command. This will be used to determine which commands are available in the CLI application and their respective details.",
45
+ "P\"w!2\"\"w#/$?%"
46
+ ];
47
+
48
+ //#endregion
49
+ export { computeBin };
50
+ //# sourceMappingURL=compute-bin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute-bin.mjs","names":[],"sources":["../../src/plugin-utils/compute-bin.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { computed } from \"@alloy-js/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport type { CommandTree, Context } from \"../types\";\nimport { getAppDescription, getAppName, getAppTitle } from \"./context-helpers\";\n\n/**\n * Compute the command tree for the CLI application, starting from the root bin command. This will be used to determine which commands are available in the CLI application and their respective details.\n *\n * @param context - The plugin context containing the necessary information to compute the command tree.\n * @returns The computed command tree for the CLI application, starting from the root bin command. This will include all commands discovered in the project and their respective details, organized in a hierarchical structure based on their segments and paths.\n */\nexport function computeBin(context: Context): CommandTree {\n const bin = computed(() => ({\n id: \"\",\n name: getAppName(context),\n title: getAppTitle(context),\n description: getAppDescription(context),\n isVirtual: true,\n path: null,\n segments: [],\n alias: [],\n tags: [],\n source: \"file\",\n options: Object.fromEntries(\n context.options.map(option => [option.name, option])\n ),\n args: [],\n entry: {\n file: joinPaths(context.entryPath, \"bin.ts\")\n },\n parent: null,\n children: context.commands\n }));\n\n return bin.value;\n}\n"],"mappings":";;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;AA4BX,SAAc,WAAa,SAAG;AAoB1B,QAnBM,gBAAA;EACF,IAAE;EACN,MAAO,WAAY,QAAQ;EAC3B,OAAW,YAAE,QAAkB;EAC/B,aAAe,kBAAA,QAAA;EACX,WAAM;EACV,MAAU;EACV,UAAS,EAAA;EACL,OAAI,EAAA;EACR,MAAS,EAAA;EACT,QAAS;EACP,SAAQ,OAAQ,YAAc,QAAQ,QAAM,IAAM,cAAC,WAAA,CAAA,OAAA,MAAA,OAAA,EAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA,CAAA;EACpD,MAAA,EAAA;EACG,OAAI,EACD,MAAA,UAAA,QAAA,WAAA,SAAA,EACL;EACD,QAAA;EACD,UAAY,QAAA;EACZ,EAAA,CACC;;AAEL,WAAS,SAAS;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
@@ -61,7 +61,57 @@ getCommandList.__type = [
61
61
  "Retrieves a list of all command trees defined in the context.",
62
62
  "P\"w!2\"\"w#F`/$?%"
63
63
  ];
64
+ /**
65
+ * Retrieves a list of all command paths defined in the context.
66
+ *
67
+ * @param context - The build context containing the command definitions.
68
+ * @returns A promise that resolves to an array of all command paths in the context.
69
+ */
70
+ async function getCommandPaths(context) {
71
+ const commandPaths = [];
72
+ await require_traverse_command_tree.traverseCommands(context, __assignType((commandTree) => {
73
+ if (commandTree.path) commandPaths.push(commandTree.path);
74
+ }, [
75
+ "commandTree",
76
+ "",
77
+ "P\"2!\"/\""
78
+ ]));
79
+ return commandPaths;
80
+ }
81
+ getCommandPaths.__type = [
82
+ "Context",
83
+ "context",
84
+ "getCommandPaths",
85
+ "Retrieves a list of all command paths defined in the context.",
86
+ "P\"w!2\"&F`/#?$"
87
+ ];
88
+ /**
89
+ * Retrieves a list of all command segments defined in the context.
90
+ *
91
+ * @param context - The build context containing the command definitions.
92
+ * @returns A promise that resolves to an array of all command segments in the context.
93
+ */
94
+ async function getCommandSegments(context) {
95
+ const commandSegments = [];
96
+ await require_traverse_command_tree.traverseCommands(context, __assignType((commandTree) => {
97
+ if (commandTree.path) commandSegments.push(commandTree.segments);
98
+ }, [
99
+ "commandTree",
100
+ "",
101
+ "P\"2!\"/\""
102
+ ]));
103
+ return commandSegments;
104
+ }
105
+ getCommandSegments.__type = [
106
+ "Context",
107
+ "context",
108
+ "getCommandSegments",
109
+ "Retrieves a list of all command segments defined in the context.",
110
+ "P\"w!2\"&FF`/#?$"
111
+ ];
64
112
 
65
113
  //#endregion
66
114
  exports.getCommandList = getCommandList;
115
+ exports.getCommandPaths = getCommandPaths;
116
+ exports.getCommandSegments = getCommandSegments;
67
117
  exports.getCommandTree = getCommandTree;
@@ -17,6 +17,20 @@ declare function getCommandTree(context: Context, path?: string[]): CommandTree
17
17
  * @returns A promise that resolves to an array of all command trees in the context.
18
18
  */
19
19
  declare function getCommandList(context: Context): Promise<CommandTree[]>;
20
+ /**
21
+ * Retrieves a list of all command paths defined in the context.
22
+ *
23
+ * @param context - The build context containing the command definitions.
24
+ * @returns A promise that resolves to an array of all command paths in the context.
25
+ */
26
+ declare function getCommandPaths(context: Context): Promise<string[]>;
27
+ /**
28
+ * Retrieves a list of all command segments defined in the context.
29
+ *
30
+ * @param context - The build context containing the command definitions.
31
+ * @returns A promise that resolves to an array of all command segments in the context.
32
+ */
33
+ declare function getCommandSegments(context: Context): Promise<string[][]>;
20
34
  //#endregion
21
- export { getCommandList, getCommandTree };
35
+ export { getCommandList, getCommandPaths, getCommandSegments, getCommandTree };
22
36
  //# sourceMappingURL=get-command-tree.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-command-tree.d.cts","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"mappings":";;;;;;AA8BA;;;;;iBAAgB,cAAA,CACd,OAAA,EAAS,OAAA,EACT,IAAA,cACC,WAAA;;;;;AA+BH;;iBAAsB,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,OAAA,CAAQ,WAAA"}
1
+ {"version":3,"file":"get-command-tree.d.cts","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"mappings":";;;;;;AA8BA;;;;;iBAAgB,cAAA,CACd,OAAA,EAAS,OAAA,EACT,IAAA,cACC,WAAA;;;;;AA+BH;;iBAAsB,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,OAAA,CAAQ,WAAA;;;;;;;iBAe1C,eAAA,CAAgB,OAAA,EAAS,OAAA,GAAU,OAAA;;;;;AAAzD;;iBAiBsB,kBAAA,CACpB,OAAA,EAAS,OAAA,GACR,OAAA"}
@@ -17,6 +17,20 @@ declare function getCommandTree(context: Context, path?: string[]): CommandTree
17
17
  * @returns A promise that resolves to an array of all command trees in the context.
18
18
  */
19
19
  declare function getCommandList(context: Context): Promise<CommandTree[]>;
20
+ /**
21
+ * Retrieves a list of all command paths defined in the context.
22
+ *
23
+ * @param context - The build context containing the command definitions.
24
+ * @returns A promise that resolves to an array of all command paths in the context.
25
+ */
26
+ declare function getCommandPaths(context: Context): Promise<string[]>;
27
+ /**
28
+ * Retrieves a list of all command segments defined in the context.
29
+ *
30
+ * @param context - The build context containing the command definitions.
31
+ * @returns A promise that resolves to an array of all command segments in the context.
32
+ */
33
+ declare function getCommandSegments(context: Context): Promise<string[][]>;
20
34
  //#endregion
21
- export { getCommandList, getCommandTree };
35
+ export { getCommandList, getCommandPaths, getCommandSegments, getCommandTree };
22
36
  //# sourceMappingURL=get-command-tree.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-command-tree.d.mts","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"mappings":";;;;;;AA8BA;;;;;iBAAgB,cAAA,CACd,OAAA,EAAS,OAAA,EACT,IAAA,cACC,WAAA;;;;;AA+BH;;iBAAsB,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,OAAA,CAAQ,WAAA"}
1
+ {"version":3,"file":"get-command-tree.d.mts","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"mappings":";;;;;;AA8BA;;;;;iBAAgB,cAAA,CACd,OAAA,EAAS,OAAA,EACT,IAAA,cACC,WAAA;;;;;AA+BH;;iBAAsB,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,OAAA,CAAQ,WAAA;;;;;;;iBAe1C,eAAA,CAAgB,OAAA,EAAS,OAAA,GAAU,OAAA;;;;;AAAzD;;iBAiBsB,kBAAA,CACpB,OAAA,EAAS,OAAA,GACR,OAAA"}
@@ -61,7 +61,55 @@ getCommandList.__type = [
61
61
  "Retrieves a list of all command trees defined in the context.",
62
62
  "P\"w!2\"\"w#F`/$?%"
63
63
  ];
64
+ /**
65
+ * Retrieves a list of all command paths defined in the context.
66
+ *
67
+ * @param context - The build context containing the command definitions.
68
+ * @returns A promise that resolves to an array of all command paths in the context.
69
+ */
70
+ async function getCommandPaths(context) {
71
+ const commandPaths = [];
72
+ await traverseCommands(context, __assignType((commandTree) => {
73
+ if (commandTree.path) commandPaths.push(commandTree.path);
74
+ }, [
75
+ "commandTree",
76
+ "",
77
+ "P\"2!\"/\""
78
+ ]));
79
+ return commandPaths;
80
+ }
81
+ getCommandPaths.__type = [
82
+ "Context",
83
+ "context",
84
+ "getCommandPaths",
85
+ "Retrieves a list of all command paths defined in the context.",
86
+ "P\"w!2\"&F`/#?$"
87
+ ];
88
+ /**
89
+ * Retrieves a list of all command segments defined in the context.
90
+ *
91
+ * @param context - The build context containing the command definitions.
92
+ * @returns A promise that resolves to an array of all command segments in the context.
93
+ */
94
+ async function getCommandSegments(context) {
95
+ const commandSegments = [];
96
+ await traverseCommands(context, __assignType((commandTree) => {
97
+ if (commandTree.path) commandSegments.push(commandTree.segments);
98
+ }, [
99
+ "commandTree",
100
+ "",
101
+ "P\"2!\"/\""
102
+ ]));
103
+ return commandSegments;
104
+ }
105
+ getCommandSegments.__type = [
106
+ "Context",
107
+ "context",
108
+ "getCommandSegments",
109
+ "Retrieves a list of all command segments defined in the context.",
110
+ "P\"w!2\"&FF`/#?$"
111
+ ];
64
112
 
65
113
  //#endregion
66
- export { getCommandList, getCommandTree };
114
+ export { getCommandList, getCommandPaths, getCommandSegments, getCommandTree };
67
115
  //# sourceMappingURL=get-command-tree.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-command-tree.mjs","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { isDynamicPathSegment } from \"./context-helpers\";\nimport { traverseCommands } from \"./traverse-command-tree\";\n\n/**\n * Retrieves a specific command tree based on the provided path.\n *\n * @param context - The build context containing the command definitions.\n * @param path - An array of strings representing the command path.\n * @returns The command tree at the specified path, or null if not found.\n */\nexport function getCommandTree(\n context: Context,\n path = [] as string[]\n): CommandTree | null {\n if (path.length === 0) {\n return null;\n }\n\n let currentTree: CommandTree | null = context.commands[path[0]!] ?? null;\n if (path.length > 1) {\n const segments = path\n .slice(1)\n .filter(segment => !isDynamicPathSegment(segment));\n for (const segment of segments) {\n if (\n currentTree?.children &&\n Object.prototype.hasOwnProperty.call(currentTree.children, segment)\n ) {\n currentTree = currentTree.children[segment] ?? null;\n } else {\n return null;\n }\n }\n }\n\n return currentTree;\n}\n\n/**\n * Retrieves a list of all command trees defined in the context.\n *\n * @param context - The build context containing the command definitions.\n * @returns A promise that resolves to an array of all command trees in the context.\n */\nexport async function getCommandList(context: Context): Promise<CommandTree[]> {\n const commandList: CommandTree[] = [];\n await traverseCommands(context, commandTree => {\n commandList.push(commandTree);\n });\n\n return commandList;\n}\n"],"mappings":";;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;;;AAYV,KAAK,KAAO,WAAW;;AAIxB,KAAO,KAAM,SAAC,GAAW;EAClB,MAAO,WAAU,KACf,MAAA,EAAA,CACA,OAAA,cAAwB,YAAW,CAAC,qBAAa,QAAA,EAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;iCAExD,KAAA,aAAA,YACa,OAAQ,UAAS,eAAc,KAAI,YAAa,UAAA,QAAA,CAC9D,eAAA,YAAA,SAAA,YAAA;MAGe,QAAO;;AAIrB,QAAS;;AAEX,eAAW,SAAa;CAAC;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOzB,eAAc,eAAA,SAAA;CACV,MAAG,cAAiB,EAAE;AACtB,OAAK,iBAAiB,SAAU,cAAA,gBAAA;AAC5B,cAAC,KAAA,YAAA;IACF;EAAC;EAAa;EAAA;EAAU,CAAA,CAAA;AAC3B,QAAI;;AAER,eAAQ,SAAc;CAAA;CAAY;CAAS;CAAgB;CAAA;CAAA;CAAA"}
1
+ {"version":3,"file":"get-command-tree.mjs","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { isDynamicPathSegment } from \"./context-helpers\";\nimport { traverseCommands } from \"./traverse-command-tree\";\n\n/**\n * Retrieves a specific command tree based on the provided path.\n *\n * @param context - The build context containing the command definitions.\n * @param path - An array of strings representing the command path.\n * @returns The command tree at the specified path, or null if not found.\n */\nexport function getCommandTree(\n context: Context,\n path = [] as string[]\n): CommandTree | null {\n if (path.length === 0) {\n return null;\n }\n\n let currentTree: CommandTree | null = context.commands[path[0]!] ?? null;\n if (path.length > 1) {\n const segments = path\n .slice(1)\n .filter(segment => !isDynamicPathSegment(segment));\n for (const segment of segments) {\n if (\n currentTree?.children &&\n Object.prototype.hasOwnProperty.call(currentTree.children, segment)\n ) {\n currentTree = currentTree.children[segment] ?? null;\n } else {\n return null;\n }\n }\n }\n\n return currentTree;\n}\n\n/**\n * Retrieves a list of all command trees defined in the context.\n *\n * @param context - The build context containing the command definitions.\n * @returns A promise that resolves to an array of all command trees in the context.\n */\nexport async function getCommandList(context: Context): Promise<CommandTree[]> {\n const commandList: CommandTree[] = [];\n await traverseCommands(context, commandTree => {\n commandList.push(commandTree);\n });\n\n return commandList;\n}\n\n/**\n * Retrieves a list of all command paths defined in the context.\n *\n * @param context - The build context containing the command definitions.\n * @returns A promise that resolves to an array of all command paths in the context.\n */\nexport async function getCommandPaths(context: Context): Promise<string[]> {\n const commandPaths: string[] = [];\n await traverseCommands(context, commandTree => {\n if (commandTree.path) {\n commandPaths.push(commandTree.path);\n }\n });\n\n return commandPaths;\n}\n\n/**\n * Retrieves a list of all command segments defined in the context.\n *\n * @param context - The build context containing the command definitions.\n * @returns A promise that resolves to an array of all command segments in the context.\n */\nexport async function getCommandSegments(\n context: Context\n): Promise<string[][]> {\n const commandSegments: string[][] = [];\n await traverseCommands(context, commandTree => {\n if (commandTree.path) {\n commandSegments.push(commandTree.segments);\n }\n });\n\n return commandSegments;\n}\n"],"mappings":";;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;;;AAYV,KAAK,KAAO,WAAW;;AAIxB,KAAO,KAAM,SAAC,GAAW;EAClB,MAAO,WAAU,KACf,MAAA,EAAA,CACA,OAAA,cAAwB,YAAW,CAAC,qBAAa,QAAA,EAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;iCAExD,KAAA,aAAA,YACa,OAAQ,UAAS,eAAc,KAAI,YAAa,UAAA,QAAA,CAC9D,eAAA,YAAA,SAAA,YAAA;MAGe,QAAO;;AAIrB,QAAS;;AAEX,eAAW,SAAa;CAAC;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOzB,eAAc,eAAA,SAAA;CACV,MAAG,cAAiB,EAAE;AACtB,OAAK,iBAAiB,SAAU,cAAA,gBAAA;AAC5B,cAAC,KAAA,YAAA;IACF;EAAC;EAAa;EAAA;EAAU,CAAA,CAAA;AAC3B,QAAI;;AAER,eAAQ,SAAc;CAAA;CAAY;CAAS;CAAgB;CAAA;CAAA;CAAA;;;;;;;AAO3D,eAAoB,gBAAA,SAAA;CACpB,MAAA,eAAA,EAAA;;AAEE,MAAA,YAAA,KACU,cAAW,KAAI,YAAc,KAAA;IAErC;EAAA;EAAmB;EAAC;EAAa,CAAC,CAAA;AAClC,QAAO;;AAEX,gBAAa,SAAS;CAAA;CAAe;CAAS;CAAkB;CAAe;CAAA;;;;;;;AAO/E,eAAA,mBAAA,SAAA;;AAEE,OAAA,iBAAA,SAAA,cAAA,gBAAA;AACC,MAAS,YAAW,KACtB,iBAAA,KAAA,YAAA,SAAA;IAEG;EAAA;EAAkB;EAAK;EAAS,CAAE,CAAC;AACrC,QAAA;;AAEF,mBAAQ,SAAoB;CAAC;CAAM;CAAA;CAAA;CAAA;CAAA"}
@@ -1,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_context_helpers = require('./context-helpers.cjs');
3
3
  const require_reflect = require('./reflect.cjs');
4
+ const require_compute_bin = require('./compute-bin.cjs');
4
5
  const require_type_checks = require('./type-checks.cjs');
5
6
  const require_deepkit = require('./deepkit.cjs');
6
7
  const require_description_helpers = require('./description-helpers.cjs');
@@ -9,6 +10,7 @@ const require_get_command_tree = require('./get-command-tree.cjs');
9
10
 
10
11
  exports.__ΩFormatDescriptionOptions = require_description_helpers.__ΩFormatDescriptionOptions;
11
12
  exports.__ΩFormatShortDescriptionOptions = require_description_helpers.__ΩFormatShortDescriptionOptions;
13
+ exports.computeBin = require_compute_bin.computeBin;
12
14
  exports.extractReflectionKind = require_deepkit.extractReflectionKind;
13
15
  exports.extractType = require_deepkit.extractType;
14
16
  exports.formatDescription = require_description_helpers.formatDescription;
@@ -18,6 +20,8 @@ exports.getAppDescription = require_context_helpers.getAppDescription;
18
20
  exports.getAppName = require_context_helpers.getAppName;
19
21
  exports.getAppTitle = require_context_helpers.getAppTitle;
20
22
  exports.getCommandList = require_get_command_tree.getCommandList;
23
+ exports.getCommandPaths = require_get_command_tree.getCommandPaths;
24
+ exports.getCommandSegments = require_get_command_tree.getCommandSegments;
21
25
  exports.getCommandTree = require_get_command_tree.getCommandTree;
22
26
  exports.getDynamicPathSegmentName = require_context_helpers.getDynamicPathSegmentName;
23
27
  exports.getPathSegmentGroupName = require_context_helpers.getPathSegmentGroupName;
@@ -1,8 +1,9 @@
1
+ import { computeBin } from "./compute-bin.cjs";
1
2
  import { getAppBin, getAppDescription, getAppName, getAppTitle, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases } from "./context-helpers.cjs";
2
3
  import { extractReflectionKind, extractType } from "./deepkit.cjs";
3
4
  import { FormatDescriptionOptions, FormatShortDescriptionOptions, formatDescription, formatShortDescription } from "./description-helpers.cjs";
4
- import { getCommandList, getCommandTree } from "./get-command-tree.cjs";
5
+ import { getCommandList, getCommandPaths, getCommandSegments, getCommandTree } from "./get-command-tree.cjs";
5
6
  import { sortOptions } from "./reflect.cjs";
6
7
  import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.cjs";
7
8
  import { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind } from "./type-checks.cjs";
8
- export { FormatDescriptionOptions, FormatShortDescriptionOptions, extractReflectionKind, extractType, formatDescription, formatShortDescription, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandList, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
9
+ export { FormatDescriptionOptions, FormatShortDescriptionOptions, computeBin, extractReflectionKind, extractType, formatDescription, formatShortDescription, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandList, getCommandPaths, getCommandSegments, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
@@ -1,8 +1,9 @@
1
+ import { computeBin } from "./compute-bin.mjs";
1
2
  import { getAppBin, getAppDescription, getAppName, getAppTitle, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases } from "./context-helpers.mjs";
2
3
  import { extractReflectionKind, extractType } from "./deepkit.mjs";
3
4
  import { FormatDescriptionOptions, FormatShortDescriptionOptions, formatDescription, formatShortDescription } from "./description-helpers.mjs";
4
- import { getCommandList, getCommandTree } from "./get-command-tree.mjs";
5
+ import { getCommandList, getCommandPaths, getCommandSegments, getCommandTree } from "./get-command-tree.mjs";
5
6
  import { sortOptions } from "./reflect.mjs";
6
7
  import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.mjs";
7
8
  import { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind } from "./type-checks.mjs";
8
- export { FormatDescriptionOptions, FormatShortDescriptionOptions, extractReflectionKind, extractType, formatDescription, formatShortDescription, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandList, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
9
+ export { FormatDescriptionOptions, FormatShortDescriptionOptions, computeBin, extractReflectionKind, extractType, formatDescription, formatShortDescription, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandList, getCommandPaths, getCommandSegments, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
@@ -1,9 +1,10 @@
1
1
  import { getAppBin, getAppDescription, getAppName, getAppTitle, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases } from "./context-helpers.mjs";
2
2
  import { sortOptions } from "./reflect.mjs";
3
+ import { computeBin } from "./compute-bin.mjs";
3
4
  import { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind } from "./type-checks.mjs";
4
5
  import { extractReflectionKind, extractType } from "./deepkit.mjs";
5
6
  import { __ΩFormatDescriptionOptions, __ΩFormatShortDescriptionOptions, formatDescription, formatShortDescription } from "./description-helpers.mjs";
6
7
  import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.mjs";
7
- import { getCommandList, getCommandTree } from "./get-command-tree.mjs";
8
+ import { getCommandList, getCommandPaths, getCommandSegments, getCommandTree } from "./get-command-tree.mjs";
8
9
 
9
- export { __ΩFormatDescriptionOptions, __ΩFormatShortDescriptionOptions, extractReflectionKind, extractType, formatDescription, formatShortDescription, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandList, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
10
+ export { __ΩFormatDescriptionOptions, __ΩFormatShortDescriptionOptions, computeBin, extractReflectionKind, extractType, formatDescription, formatShortDescription, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandList, getCommandPaths, getCommandSegments, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };